client: AVA2 Won (cheque) system, revision mt20261027

ENABLE_CHEQUE_SYSTEM / ENABLE_WON_EXCHANGE_WINDOW = 1: Won in trades,
private shop Won prices (int32 cheque[] after the CG_MYSHOP items), shop
item cheque prices, mt_won script fixes, zh locale_game_ex overlay staged
into locale_zh_ava2 (fixes the swapped %s/%d in WONEXCHANGE_CONFIRM_QUESTION_2).

Also zero-init every TPacketCGExchange: arg1 was uninitialised and the
HEAD server drops arg1 > UINT32_MAX, so accept/cancel/item-add were lost
and trades never completed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-10-24 15:30:45 +09:00
co-authored by Claude Opus 5.5
parent 909fc8f851
commit 1a4d8295ff
17 changed files with 238 additions and 217 deletions
@@ -79,6 +79,22 @@ int main(int argc, char** argv)
assert(PortShopPayloadValid(SHOP_SUBHEADER_GC_UPDATE_PRICE,(char*)&price,sizeof(price)));
assert(!PortShopPayloadValid(SHOP_SUBHEADER_GC_UPDATE_PRICE,(char*)&price,4));
assert(!PortShopPayloadValid(255,nullptr,0));
// revision27 Won prices: START + int32 cheque[SHOP_HOST_ITEM_MAX_NUM], each 0..999 on a real item.
static_assert(SHOP_SUBHEADER_GC_START_CHEQUE==40 && SHOP_SUBHEADER_GC_NOT_ENOUGH_CHEQUE==41);
static_assert(EXCHANGE_SUBHEADER_CG_CHEQUE_ADD==6 && EXCHANGE_SUBHEADER_GC_CHEQUE_ADD==8 && EXCHANGE_SUBHEADER_GC_LESS_CHEQUE==9);
records[0].price=0;
int32_t cheques[SHOP_HOST_ITEM_MAX_NUM]={};cheques[0]=999;
std::vector<char> won(sizeof(DWORD)+sizeof(records)+sizeof(cheques));
memcpy(won.data()+sizeof(DWORD),records,sizeof(records));
memcpy(won.data()+sizeof(DWORD)+sizeof(records),cheques,sizeof(cheques));
assert(PortShopPayloadValid(SHOP_SUBHEADER_GC_START_CHEQUE,won.data(),won.size()));
assert(!PortShopPayloadValid(SHOP_SUBHEADER_GC_START_CHEQUE,won.data(),won.size()-4));
assert(!PortShopPayloadValid(SHOP_SUBHEADER_GC_START,won.data(),won.size()));
cheques[0]=1000;memcpy(won.data()+sizeof(DWORD)+sizeof(records),cheques,sizeof(cheques));
assert(!PortShopPayloadValid(SHOP_SUBHEADER_GC_START_CHEQUE,won.data(),won.size()));
cheques[0]=0;cheques[1]=5;memcpy(won.data()+sizeof(DWORD)+sizeof(records),cheques,sizeof(cheques));
assert(!PortShopPayloadValid(SHOP_SUBHEADER_GC_START_CHEQUE,won.data(),won.size()));
assert(PortShopPayloadValid(SHOP_SUBHEADER_GC_NOT_ENOUGH_CHEQUE,nullptr,0));
}
static_assert(sizeof(TPacketCGExchange::arg1)==8);
static_assert(sizeof(TPacketCGExchange)==14);