feat, refac: 매달 실행되는 함수 마저 구현

- NewYear: 새해(AddAge 일부)
- AssignGeneralSpeciality: 특히 부여(AddAge 일부)
- RaiseDisaster
- RandomizeCityTradeRate
- ResetOfficeLock: 구 updateQuaterly
This commit is contained in:
2023-03-12 17:02:30 +09:00
parent 54380950eb
commit 7b1a9157e1
5 changed files with 349 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
<?php
namespace sammo\Event\Action;
use sammo\ActionLogger;
use sammo\DB;
class NewYear extends \sammo\Event\Action
{
public function run(array $env)
{
$year = $env['year'];
$month = $env['month'];
$logger = new ActionLogger(0, 0, $year, $month, false);
$logger->pushGlobalActionLog("<C>{$year}</>년이 되었습니다.");
$logger->flush(); //TODO: globalAction류는 전역에서 관리하는것이 좋을 듯.
$db = DB::db();
//나이와 호봉 증가
$db->update('general', [
'age' => $db->sqleval('age+1'),
], true);
$db->update('general', [
'belong' => $db->sqleval('belong+1')
], 'nation != 0');
}
}