test(compare): trace core monthly event actions
This commit is contained in:
@@ -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]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"action": "NoticeToHistoryLog",
|
||||||
|
"args": ["<S>새해 알림</>", 6],
|
||||||
|
"environment": {
|
||||||
|
"year": 191,
|
||||||
|
"month": 1,
|
||||||
|
"startyear": 190
|
||||||
|
},
|
||||||
|
"setup": {},
|
||||||
|
"observe": {}
|
||||||
|
}
|
||||||
@@ -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"]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,7 +33,7 @@ function comparisonMonthlyPatch(string $table, int $id, array $values): void
|
|||||||
'idColumn' => 'nation',
|
'idColumn' => 'nation',
|
||||||
'allowed' => [
|
'allowed' => [
|
||||||
'name', 'color', 'capital', 'gennum', 'gold', 'rice', 'tech',
|
'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',
|
'rate', 'strategic_cmd_limit', 'surlimit', 'spy',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@@ -174,6 +174,7 @@ function comparisonMonthlyDetails(array $observe, int $worldHistoryAfterId): arr
|
|||||||
'strategicCommandLimit' => 'strategic_cmd_limit',
|
'strategicCommandLimit' => 'strategic_cmd_limit',
|
||||||
'surrenderLimit' => 'surlimit',
|
'surrenderLimit' => 'surlimit',
|
||||||
'spy' => 'spy',
|
'spy' => 'spy',
|
||||||
|
'chiefSet' => 'chief_set',
|
||||||
],
|
],
|
||||||
['spy'],
|
['spy'],
|
||||||
),
|
),
|
||||||
@@ -292,6 +293,10 @@ function comparisonMonthlyEventTraceMain(): void
|
|||||||
'AddGlobalBetray',
|
'AddGlobalBetray',
|
||||||
'LostUniqueItem',
|
'LostUniqueItem',
|
||||||
'MergeInheritPointRank',
|
'MergeInheritPointRank',
|
||||||
|
'ProcessIncome',
|
||||||
|
'NoticeToHistoryLog',
|
||||||
|
'NewYear',
|
||||||
|
'ResetOfficerLock',
|
||||||
'PreUpdateMonthly',
|
'PreUpdateMonthly',
|
||||||
'PostUpdateMonthly',
|
'PostUpdateMonthly',
|
||||||
];
|
];
|
||||||
@@ -602,7 +607,7 @@ function comparisonMonthlyEventTraceMain(): void
|
|||||||
throw new \InvalidArgumentException('ProcessSemiAnnual requires resource');
|
throw new \InvalidArgumentException('ProcessSemiAnnual requires resource');
|
||||||
}
|
}
|
||||||
$action = new $actionClass($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'] ?? [];
|
$args = $request['args'] ?? [];
|
||||||
if (!is_array($args)) {
|
if (!is_array($args)) {
|
||||||
throw new \InvalidArgumentException("{$actionName} args must be an array");
|
throw new \InvalidArgumentException("{$actionName} args must be an array");
|
||||||
@@ -631,6 +636,12 @@ function comparisonMonthlyEventTraceMain(): void
|
|||||||
if ($actionName === 'LostUniqueItem' && count($args) > 1) {
|
if ($actionName === 'LostUniqueItem' && count($args) > 1) {
|
||||||
throw new \InvalidArgumentException('LostUniqueItem args must have at most one entry');
|
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);
|
$action = new $actionClass(...$args);
|
||||||
} else {
|
} else {
|
||||||
$action = new $actionClass();
|
$action = new $actionClass();
|
||||||
|
|||||||
Reference in New Issue
Block a user