From 84d9cf9eb431b12e97f7ebba470730d1f2d0d514 Mon Sep 17 00:00:00 2001 From: hided62 Date: Sat, 25 Jul 2026 22:47:35 +0000 Subject: [PATCH] test(compare): trace core monthly event actions --- .../fixtures/monthly_core_new_year.json | 34 +++++++++ hwe/compare/fixtures/monthly_core_notice.json | 11 +++ ...thly_core_process_income_gold_in_july.json | 75 +++++++++++++++++++ .../monthly_core_reset_officer_lock.json | 33 ++++++++ hwe/compare/monthly_event_trace.php | 15 +++- 5 files changed, 166 insertions(+), 2 deletions(-) create mode 100644 hwe/compare/fixtures/monthly_core_new_year.json create mode 100644 hwe/compare/fixtures/monthly_core_notice.json create mode 100644 hwe/compare/fixtures/monthly_core_process_income_gold_in_july.json create mode 100644 hwe/compare/fixtures/monthly_core_reset_officer_lock.json diff --git a/hwe/compare/fixtures/monthly_core_new_year.json b/hwe/compare/fixtures/monthly_core_new_year.json new file mode 100644 index 00000000..39c1b2c2 --- /dev/null +++ b/hwe/compare/fixtures/monthly_core_new_year.json @@ -0,0 +1,34 @@ +{ + "action": "NewYear", + "environment": { + "year": 191, + "month": 1, + "startyear": 190 + }, + "setup": { + "resetGenerals": true, + "deleteOtherGenerals": true, + "keepGeneralIds": [1, 2], + "general": [ + { + "id": 1, + "values": { + "nation": 1, + "age": 30, + "belong": 3 + } + }, + { + "id": 2, + "values": { + "nation": 0, + "age": 30, + "belong": 4 + } + } + ] + }, + "observe": { + "generalIds": [1, 2] + } +} diff --git a/hwe/compare/fixtures/monthly_core_notice.json b/hwe/compare/fixtures/monthly_core_notice.json new file mode 100644 index 00000000..f63889f3 --- /dev/null +++ b/hwe/compare/fixtures/monthly_core_notice.json @@ -0,0 +1,11 @@ +{ + "action": "NoticeToHistoryLog", + "args": ["새해 알림", 6], + "environment": { + "year": 191, + "month": 1, + "startyear": 190 + }, + "setup": {}, + "observe": {} +} diff --git a/hwe/compare/fixtures/monthly_core_process_income_gold_in_july.json b/hwe/compare/fixtures/monthly_core_process_income_gold_in_july.json new file mode 100644 index 00000000..16ed3062 --- /dev/null +++ b/hwe/compare/fixtures/monthly_core_process_income_gold_in_july.json @@ -0,0 +1,75 @@ +{ + "action": "ProcessIncome", + "args": ["gold"], + "environment": { + "year": 190, + "month": 7, + "startyear": 190 + }, + "setup": { + "resetCities": true, + "resetGenerals": true, + "deleteOtherGenerals": true, + "keepGeneralIds": [1], + "resetNations": true, + "deleteOtherNations": true, + "keepNationIds": [1], + "general": [ + { + "id": 1, + "values": { + "nation": 1, + "city": 1, + "officer_level": 5, + "npc": 0, + "gold": 1000, + "rice": 1000, + "dedication": 100 + } + } + ], + "nation": [ + { + "id": 1, + "values": { + "name": "갑국", + "capital": 1, + "gold": 10000, + "rice": 20000, + "level": 1, + "rate_tmp": 20 + } + } + ], + "city": [ + { + "id": 1, + "values": { + "name": "갑성", + "nation": 1, + "level": 4, + "supply": 1, + "pop": 10000, + "pop_max": 20000, + "agri": 1000, + "agri_max": 2000, + "comm": 1000, + "comm_max": 2000, + "secu": 1000, + "secu_max": 2000, + "trust": 80, + "def": 500, + "def_max": 1000, + "wall": 500, + "wall_max": 1000 + } + } + ] + }, + "observe": { + "generalIds": [1], + "nationIds": [1], + "cityIds": [1], + "nationEnvironmentKeys": ["prev_income_gold", "prev_income_rice"] + } +} diff --git a/hwe/compare/fixtures/monthly_core_reset_officer_lock.json b/hwe/compare/fixtures/monthly_core_reset_officer_lock.json new file mode 100644 index 00000000..29f39711 --- /dev/null +++ b/hwe/compare/fixtures/monthly_core_reset_officer_lock.json @@ -0,0 +1,33 @@ +{ + "action": "ResetOfficerLock", + "environment": { + "year": 191, + "month": 1, + "startyear": 190 + }, + "setup": { + "resetCities": true, + "resetNations": true, + "city": [ + { + "id": 1, + "values": { + "nation": 1, + "officer_set": 1 + } + } + ], + "nation": [ + { + "id": 1, + "values": { + "chief_set": 1 + } + } + ] + }, + "observe": { + "cityIds": [1], + "nationIds": [1] + } +} diff --git a/hwe/compare/monthly_event_trace.php b/hwe/compare/monthly_event_trace.php index 5e14a401..8f5761b8 100644 --- a/hwe/compare/monthly_event_trace.php +++ b/hwe/compare/monthly_event_trace.php @@ -33,7 +33,7 @@ function comparisonMonthlyPatch(string $table, int $id, array $values): void 'idColumn' => 'nation', 'allowed' => [ 'name', 'color', 'capital', 'gennum', 'gold', 'rice', 'tech', - 'power', 'level', 'type', 'rate_tmp', 'scout', 'aux', + 'power', 'level', 'type', 'rate_tmp', 'scout', 'chief_set', 'aux', 'rate', 'strategic_cmd_limit', 'surlimit', 'spy', ], ], @@ -174,6 +174,7 @@ function comparisonMonthlyDetails(array $observe, int $worldHistoryAfterId): arr 'strategicCommandLimit' => 'strategic_cmd_limit', 'surrenderLimit' => 'surlimit', 'spy' => 'spy', + 'chiefSet' => 'chief_set', ], ['spy'], ), @@ -292,6 +293,10 @@ function comparisonMonthlyEventTraceMain(): void 'AddGlobalBetray', 'LostUniqueItem', 'MergeInheritPointRank', + 'ProcessIncome', + 'NoticeToHistoryLog', + 'NewYear', + 'ResetOfficerLock', 'PreUpdateMonthly', 'PostUpdateMonthly', ]; @@ -602,7 +607,7 @@ function comparisonMonthlyEventTraceMain(): void throw new \InvalidArgumentException('ProcessSemiAnnual requires resource'); } $action = new $actionClass($resource); - } elseif (in_array($actionName, ['CreateManyNPC', 'RegNPC', 'RegNeutralNPC', 'RaiseInvader', 'AutoDeleteInvader', 'ChangeCity', 'OpenNationBetting', 'FinishNationBetting', 'BlockScoutAction', 'UnblockScoutAction', 'AddGlobalBetray', 'LostUniqueItem'], true)) { + } elseif (in_array($actionName, ['CreateManyNPC', 'RegNPC', 'RegNeutralNPC', 'RaiseInvader', 'AutoDeleteInvader', 'ChangeCity', 'OpenNationBetting', 'FinishNationBetting', 'BlockScoutAction', 'UnblockScoutAction', 'AddGlobalBetray', 'LostUniqueItem', 'ProcessIncome', 'NoticeToHistoryLog'], true)) { $args = $request['args'] ?? []; if (!is_array($args)) { throw new \InvalidArgumentException("{$actionName} args must be an array"); @@ -631,6 +636,12 @@ function comparisonMonthlyEventTraceMain(): void if ($actionName === 'LostUniqueItem' && count($args) > 1) { throw new \InvalidArgumentException('LostUniqueItem args must have at most one entry'); } + if ($actionName === 'ProcessIncome' && count($args) !== 1) { + throw new \InvalidArgumentException('ProcessIncome args must have exactly one entry'); + } + if ($actionName === 'NoticeToHistoryLog' && (count($args) < 1 || count($args) > 2)) { + throw new \InvalidArgumentException('NoticeToHistoryLog args must have one or two entries'); + } $action = new $actionClass(...$args); } else { $action = new $actionClass();