merge: trace monthly post tail effects
This commit is contained in:
@@ -0,0 +1,128 @@
|
|||||||
|
{
|
||||||
|
"action": "PostUpdateMonthly",
|
||||||
|
"environment": {
|
||||||
|
"year": 193,
|
||||||
|
"month": 2,
|
||||||
|
"startyear": 193,
|
||||||
|
"seedYear": 193,
|
||||||
|
"seedMonth": 1
|
||||||
|
},
|
||||||
|
"setup": {
|
||||||
|
"world": {
|
||||||
|
"hiddenSeed": "monthly-post-tail-2"
|
||||||
|
},
|
||||||
|
"syncEnvironment": true,
|
||||||
|
"clearNeutralAuctions": true,
|
||||||
|
"resetCities": true,
|
||||||
|
"resetGenerals": true,
|
||||||
|
"deleteOtherGenerals": true,
|
||||||
|
"keepGeneralIds": [1, 2],
|
||||||
|
"resetNations": true,
|
||||||
|
"deleteOtherNations": true,
|
||||||
|
"keepNationIds": [1, 2],
|
||||||
|
"resetDiplomacy": true,
|
||||||
|
"gameEnvironment": {
|
||||||
|
"tournament": 0,
|
||||||
|
"tnmt_trig": true,
|
||||||
|
"tnmt_pattern": [0, 1, 2, 3],
|
||||||
|
"prev_winner": null
|
||||||
|
},
|
||||||
|
"general": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"values": {
|
||||||
|
"name": "갑장",
|
||||||
|
"nation": 1,
|
||||||
|
"city": 1,
|
||||||
|
"officer_level": 12,
|
||||||
|
"npc": 0,
|
||||||
|
"gold": 5000,
|
||||||
|
"rice": 7000,
|
||||||
|
"crew": 100,
|
||||||
|
"leadership": 50,
|
||||||
|
"strength": 40,
|
||||||
|
"intel": 30,
|
||||||
|
"experience": 100,
|
||||||
|
"dedication": 200
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"values": {
|
||||||
|
"name": "을장",
|
||||||
|
"nation": 2,
|
||||||
|
"city": 2,
|
||||||
|
"officer_level": 12,
|
||||||
|
"npc": 0,
|
||||||
|
"gold": 6000,
|
||||||
|
"rice": 8000,
|
||||||
|
"crew": 200,
|
||||||
|
"leadership": 60,
|
||||||
|
"strength": 50,
|
||||||
|
"intel": 40,
|
||||||
|
"experience": 300,
|
||||||
|
"dedication": 400
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"nation": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"values": {
|
||||||
|
"name": "갑국",
|
||||||
|
"capital": 1,
|
||||||
|
"gold": 10000,
|
||||||
|
"rice": 20000,
|
||||||
|
"tech": 100,
|
||||||
|
"level": 2,
|
||||||
|
"gennum": 1,
|
||||||
|
"power": 7
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"values": {
|
||||||
|
"name": "을국",
|
||||||
|
"capital": 2,
|
||||||
|
"gold": 2000,
|
||||||
|
"rice": 3000,
|
||||||
|
"tech": 50,
|
||||||
|
"level": 1,
|
||||||
|
"gennum": 1,
|
||||||
|
"power": 8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"city": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"values": {
|
||||||
|
"name": "갑성",
|
||||||
|
"nation": 1,
|
||||||
|
"level": 4,
|
||||||
|
"supply": 1,
|
||||||
|
"front": 3,
|
||||||
|
"pop": 1000,
|
||||||
|
"pop_max": 2000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"values": {
|
||||||
|
"name": "을성",
|
||||||
|
"nation": 2,
|
||||||
|
"level": 4,
|
||||||
|
"supply": 1,
|
||||||
|
"front": 3,
|
||||||
|
"pop": 2000,
|
||||||
|
"pop_max": 4000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"observe": {
|
||||||
|
"generalIds": [1, 2],
|
||||||
|
"nationIds": [1, 2],
|
||||||
|
"cityIds": [1, 2]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -364,6 +364,13 @@ function comparisonMonthlyEventTraceMain(): void
|
|||||||
DB::db()->delete('ng_auction', '`type` = %s AND finished = 0', 'uniqueItem');
|
DB::db()->delete('ng_auction', '`type` = %s AND finished = 0', 'uniqueItem');
|
||||||
DB::db()->query('DELETE FROM storage WHERE namespace LIKE %s', 'ut\\_%');
|
DB::db()->query('DELETE FROM storage WHERE namespace LIKE %s', 'ut\\_%');
|
||||||
}
|
}
|
||||||
|
if (($setup['clearNeutralAuctions'] ?? false) === true) {
|
||||||
|
DB::db()->delete(
|
||||||
|
'ng_auction',
|
||||||
|
'`type` IN %ls AND host_general_id = 0',
|
||||||
|
['buyRice', 'sellRice'],
|
||||||
|
);
|
||||||
|
}
|
||||||
foreach (comparisonIntegerList($setup['clearNationTurnIds'] ?? [], 'clearNationTurnIds') as $nationId) {
|
foreach (comparisonIntegerList($setup['clearNationTurnIds'] ?? [], 'clearNationTurnIds') as $nationId) {
|
||||||
DB::db()->delete('nation_turn', 'nation_id = %i', $nationId);
|
DB::db()->delete('nation_turn', 'nation_id = %i', $nationId);
|
||||||
}
|
}
|
||||||
@@ -525,7 +532,16 @@ function comparisonMonthlyEventTraceMain(): void
|
|||||||
}
|
}
|
||||||
UniqueConst::$hiddenSeed = $worldPatch['hiddenSeed'];
|
UniqueConst::$hiddenSeed = $worldPatch['hiddenSeed'];
|
||||||
}
|
}
|
||||||
foreach (['isunited', 'refreshLimit', 'block_change_scout', 'lastNPCTroopLeaderID'] as $key) {
|
foreach ([
|
||||||
|
'isunited',
|
||||||
|
'refreshLimit',
|
||||||
|
'block_change_scout',
|
||||||
|
'lastNPCTroopLeaderID',
|
||||||
|
'tournament',
|
||||||
|
'tnmt_trig',
|
||||||
|
'tnmt_pattern',
|
||||||
|
'prev_winner',
|
||||||
|
] as $key) {
|
||||||
if (array_key_exists($key, $gameEnvironmentPatch)) {
|
if (array_key_exists($key, $gameEnvironmentPatch)) {
|
||||||
$gameStorage->setValue($key, $gameEnvironmentPatch[$key]);
|
$gameStorage->setValue($key, $gameEnvironmentPatch[$key]);
|
||||||
}
|
}
|
||||||
@@ -544,6 +560,8 @@ function comparisonMonthlyEventTraceMain(): void
|
|||||||
(int)($db->queryFirstField('SELECT COALESCE(MAX(nation), 0) FROM nation') ?? 0);
|
(int)($db->queryFirstField('SELECT COALESCE(MAX(nation), 0) FROM nation') ?? 0);
|
||||||
$eventIdBeforeAction =
|
$eventIdBeforeAction =
|
||||||
(int)($db->queryFirstField('SELECT COALESCE(MAX(id), 0) FROM event') ?? 0);
|
(int)($db->queryFirstField('SELECT COALESCE(MAX(id), 0) FROM event') ?? 0);
|
||||||
|
$auctionIdBeforeAction =
|
||||||
|
(int)($db->queryFirstField('SELECT COALESCE(MAX(id), 0) FROM ng_auction') ?? 0);
|
||||||
$snapshotRequest = ['observe' => $request['observe'] ?? []];
|
$snapshotRequest = ['observe' => $request['observe'] ?? []];
|
||||||
$snapshotRequest['observe']['logAfterId'] =
|
$snapshotRequest['observe']['logAfterId'] =
|
||||||
(int)($db->queryFirstField('SELECT COALESCE(MAX(id), 0) FROM general_record') ?? 0);
|
(int)($db->queryFirstField('SELECT COALESCE(MAX(id), 0) FROM general_record') ?? 0);
|
||||||
@@ -817,6 +835,30 @@ function comparisonMonthlyEventTraceMain(): void
|
|||||||
'develcost',
|
'develcost',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
if ($actionName === 'PostUpdateMonthly') {
|
||||||
|
$response['gameEnvironment'] = KVStorage::getStorage(DB::db(), 'game_env')->getValues([
|
||||||
|
'tournament',
|
||||||
|
'tnmt_trig',
|
||||||
|
'tnmt_pattern',
|
||||||
|
'tnmt_type',
|
||||||
|
'tnmt_auto',
|
||||||
|
'phase',
|
||||||
|
]);
|
||||||
|
$response['createdNeutralAuctions'] = array_map(
|
||||||
|
static fn(array $row): array => [
|
||||||
|
'id' => (int)$row['id'],
|
||||||
|
'type' => $row['type'],
|
||||||
|
'target' => $row['target'],
|
||||||
|
'detail' => Json::decode($row['detail']),
|
||||||
|
],
|
||||||
|
iterator_to_array(
|
||||||
|
$db->query(
|
||||||
|
'SELECT id, `type`, target, detail FROM ng_auction WHERE id > %i AND host_general_id = 0 ORDER BY id',
|
||||||
|
$auctionIdBeforeAction,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
if (in_array($actionName, ['OpenNationBetting', 'FinishNationBetting'], true)) {
|
if (in_array($actionName, ['OpenNationBetting', 'FinishNationBetting'], true)) {
|
||||||
$bettingStorage = KVStorage::getStorage(DB::db(), 'betting');
|
$bettingStorage = KVStorage::getStorage(DB::db(), 'betting');
|
||||||
$response['betting'] = $bettingStorage->getAll();
|
$response['betting'] = $bettingStorage->getAll();
|
||||||
|
|||||||
Reference in New Issue
Block a user