merge: trace monthly scout policy actions
This commit is contained in:
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"action": "BlockScoutAction",
|
||||||
|
"args": [true],
|
||||||
|
"setup": {
|
||||||
|
"resetNations": true,
|
||||||
|
"deleteOtherNations": true,
|
||||||
|
"keepNationIds": [1, 2],
|
||||||
|
"nation": [
|
||||||
|
{ "id": 1, "values": { "name": "위", "level": 2, "scout": 0 } },
|
||||||
|
{ "id": 2, "values": { "name": "촉", "level": 2, "scout": 0 } }
|
||||||
|
],
|
||||||
|
"gameEnvironment": {
|
||||||
|
"block_change_scout": false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"environment": {
|
||||||
|
"year": 200,
|
||||||
|
"month": 1,
|
||||||
|
"startyear": 190
|
||||||
|
},
|
||||||
|
"observe": {
|
||||||
|
"nationIds": [1, 2]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
{
|
||||||
|
"action": "UnblockScoutAction",
|
||||||
|
"args": [false],
|
||||||
|
"setup": {
|
||||||
|
"resetNations": true,
|
||||||
|
"deleteOtherNations": true,
|
||||||
|
"keepNationIds": [1, 2],
|
||||||
|
"nation": [
|
||||||
|
{ "id": 1, "values": { "name": "위", "level": 2, "scout": 1 } },
|
||||||
|
{ "id": 2, "values": { "name": "촉", "level": 2, "scout": 1 } }
|
||||||
|
],
|
||||||
|
"gameEnvironment": {
|
||||||
|
"block_change_scout": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"environment": {
|
||||||
|
"year": 200,
|
||||||
|
"month": 1,
|
||||||
|
"startyear": 190
|
||||||
|
},
|
||||||
|
"observe": {
|
||||||
|
"nationIds": [1, 2]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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', 'aux',
|
'power', 'level', 'type', 'rate_tmp', 'scout', 'aux',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'general' => [
|
'general' => [
|
||||||
@@ -142,6 +142,7 @@ function comparisonMonthlyDetails(array $observe, int $worldHistoryAfterId): arr
|
|||||||
'rice' => 'rice',
|
'rice' => 'rice',
|
||||||
'rate' => 'rate_tmp',
|
'rate' => 'rate_tmp',
|
||||||
'typeCode' => 'type',
|
'typeCode' => 'type',
|
||||||
|
'scout' => 'scout',
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
comparisonRowsById('nation', 'nation', comparisonIntegerList($observe['nationIds'] ?? [], 'nationIds')),
|
comparisonRowsById('nation', 'nation', comparisonIntegerList($observe['nationIds'] ?? [], 'nationIds')),
|
||||||
@@ -209,6 +210,8 @@ function comparisonMonthlyEventTraceMain(): void
|
|||||||
'ProvideNPCTroopLeader',
|
'ProvideNPCTroopLeader',
|
||||||
'OpenNationBetting',
|
'OpenNationBetting',
|
||||||
'FinishNationBetting',
|
'FinishNationBetting',
|
||||||
|
'BlockScoutAction',
|
||||||
|
'UnblockScoutAction',
|
||||||
];
|
];
|
||||||
if (!in_array($actionName, $supportedActions, true)) {
|
if (!in_array($actionName, $supportedActions, true)) {
|
||||||
throw new \InvalidArgumentException('unsupported monthly action');
|
throw new \InvalidArgumentException('unsupported monthly action');
|
||||||
@@ -420,7 +423,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'], true)) {
|
} elseif (in_array($actionName, ['CreateManyNPC', 'RegNPC', 'RegNeutralNPC', 'RaiseInvader', 'AutoDeleteInvader', 'ChangeCity', 'OpenNationBetting', 'FinishNationBetting', 'BlockScoutAction', 'UnblockScoutAction'], 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");
|
||||||
@@ -440,6 +443,9 @@ function comparisonMonthlyEventTraceMain(): void
|
|||||||
if ($actionName === 'FinishNationBetting' && count($args) !== 1) {
|
if ($actionName === 'FinishNationBetting' && count($args) !== 1) {
|
||||||
throw new \InvalidArgumentException('FinishNationBetting args must have exactly one entry');
|
throw new \InvalidArgumentException('FinishNationBetting args must have exactly one entry');
|
||||||
}
|
}
|
||||||
|
if (in_array($actionName, ['BlockScoutAction', 'UnblockScoutAction'], true) && count($args) > 1) {
|
||||||
|
throw new \InvalidArgumentException("{$actionName} args must have at most one entry");
|
||||||
|
}
|
||||||
$action = new $actionClass(...$args);
|
$action = new $actionClass(...$args);
|
||||||
} else {
|
} else {
|
||||||
$action = new $actionClass();
|
$action = new $actionClass();
|
||||||
@@ -657,6 +663,11 @@ function comparisonMonthlyEventTraceMain(): void
|
|||||||
$response['inheritancePrevious'][(string)$ownerId] = is_array($value) ? ($value[0] ?? 0) : 0;
|
$response['inheritancePrevious'][(string)$ownerId] = is_array($value) ? ($value[0] ?? 0) : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (in_array($actionName, ['BlockScoutAction', 'UnblockScoutAction'], true)) {
|
||||||
|
$response['gameEnvironment'] = KVStorage::getStorage(DB::db(), 'game_env')->getValues([
|
||||||
|
'block_change_scout',
|
||||||
|
]);
|
||||||
|
}
|
||||||
if ($actionName === 'RaiseInvader') {
|
if ($actionName === 'RaiseInvader') {
|
||||||
$response['createdEvents'] = array_map(
|
$response['createdEvents'] = array_map(
|
||||||
static fn(array $row): array => comparisonPickRow(
|
static fn(array $row): array => comparisonPickRow(
|
||||||
|
|||||||
Reference in New Issue
Block a user