feat: complete xxf-ch5 35 features migration, protocol bindings, and gate validation

- S1: Chinese locale pack, target HP/drop preview, elemental icons, exchange level display, item highlight, FOV settings, advanced skybox, GM warp.
- S2: 5-page 225-slot inventory, seamless channel switch, wiki/drop query/chest preview.
- S3: Auto-refine/attribute locks, sash combine/absorb, talisman/elemental stats, costume/mount/shining slots, changelook, soulbind, glove, quiver, magic reduction.
- S4: Modern cube renewal, mythic dragon soul (6 grades/1152 slots), DS attr change, global rankings, dice system.
- S5: Multi-token shop, offline private shop search, offline shop state machine, 64-bit gold alignment, Won dual currency exchange.
- S6: Single account 5-character slot adaptive wire protocol, Wolfman profession & claw weapon/applies, Conqueror level & Sungma attributes, pets & 6th/7th attrs, battle pass & boss tracking.
- Pass 42/42 platform gate test suites in scripts/port_gate.sh macos.
This commit is contained in:
shen
2026-10-22 01:29:14 -07:00
parent 867633667f
commit 846a993183
345 changed files with 48463 additions and 326 deletions
+73 -8
View File
@@ -1,3 +1,7 @@
// Execute C++ assertions in Release test builds as well.
#ifdef NDEBUG
#undef NDEBUG
#endif
#include "EterPythonLib/StdAfx.h"
#include "EterPythonLib/PythonWindowManager.h"
#include "ScriptLib/PythonLauncher.h"
@@ -11,8 +15,13 @@ extern void initshop();
extern void initprivateShopSearch();
#include "UserInterface/PythonPlayer.h"
#include "UserInterface/PythonShop.h"
#include "UserInterface/ShopPacketValidation.h"
#include "UserInterface/PythonExchange.h"
#include "UserInterface/PythonSafeBox.h"
#include "UserInterface/PythonGuild.h"
#include "UserInterface/PythonPrivateShopSearch.h"
#include <cassert>
#include <new>
#include "../../src/platform/ScriptLib/PythonHost.h"
#include <cstdio>
@@ -42,10 +51,60 @@ int main(int argc, char** argv)
initItem();
initchrmgr();
initnet();
static_assert(sizeof(TOfflineShopItemData)==84);
static_assert(CItemData::APPLY_RESIST_HUMAN==99);
static_assert(sizeof(TShopItemData)==47);
static_assert(sizeof(TShopItemTable)==17);
static_assert(sizeof(TPacketGCShopUpdatePrice)==8);
{
TShopItemData records[SHOP_HOST_ITEM_MAX_NUM] = {};
records[0].vnum=19;records[0].count=1;records[0].price=100000000000LL;
std::vector<char> payload(sizeof(DWORD)+sizeof(records));
memcpy(payload.data()+sizeof(DWORD),records,sizeof(records));
assert(PortShopPayloadValid(SHOP_SUBHEADER_GC_START,payload.data(),payload.size()));
assert(!PortShopPayloadValid(SHOP_SUBHEADER_GC_START,payload.data(),payload.size()-1));
records[0].price=-1;
memcpy(payload.data()+sizeof(DWORD),records,sizeof(records));
assert(!PortShopPayloadValid(SHOP_SUBHEADER_GC_START,payload.data(),payload.size()));
TPacketGCShopStartEx header={};header.shop_tab_count=SHOP_TAB_COUNT_MAX+1;
assert(!PortShopPayloadValid(SHOP_SUBHEADER_GC_START_EX,(char*)&header,sizeof(header)));
std::vector<char> extended(sizeof(header)+sizeof(TPacketGCShopStartEx::TSubPacketShopTab),0);
header.shop_tab_count=1;memcpy(extended.data(),&header,sizeof(header));
assert(PortShopPayloadValid(SHOP_SUBHEADER_GC_START_EX,extended.data(),extended.size()));
memset(extended.data()+sizeof(header),'x',SHOP_TAB_NAME_MAX);
assert(!PortShopPayloadValid(SHOP_SUBHEADER_GC_START_EX,extended.data(),extended.size()));
TPacketGCShopUpdateItem update={};update.pos=SHOP_TAB_COUNT_MAX*SHOP_HOST_ITEM_MAX_NUM;
assert(!PortShopPayloadValid(SHOP_SUBHEADER_GC_UPDATE_ITEM,(char*)&update,sizeof(update)));
const int64_t price=100000000000LL;
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));
}
static_assert(sizeof(TPacketCGExchange::arg1)==8);
static_assert(sizeof(TPacketCGExchange)==14);
static_assert(sizeof(TPacketGCExchange)==51);
static_assert(sizeof(TPacketGCExchange::arg1)==8);
static_assert(sizeof(TPacketGCGuildInfo::gold)==8);
CPythonExchange exchange; initTrade();
CPythonSafeBox safebox; initsafebox();
CPythonGuild guild; initguild();
exchange.SetElkToSelf(5000000000LL);
exchange.SetElkToTarget(10000000000LL);
safebox.SetMoney(100000000000LL);
guild.SetGuildMoney(200000000000LL);
{
alignas(CPythonPlayer) unsigned char storage[sizeof(CPythonPlayer)];
memset(storage, 0x78, sizeof(storage));
auto* initialized = new (storage) CPythonPlayer;
assert(initialized->GetGold64() == 0);
initialized->~CPythonPlayer();
}
CPythonPlayer player;
initPlayer();
CPythonShop shop;
initshop();
TShopItemData shopItem={};shopItem.vnum=19;shopItem.count=1;shopItem.price=100000000000LL;
shop.SetItemData(0,shopItem);
CPythonPrivateShopSearch privateShopSearch;
initprivateShopSearch();
CPythonPlayer::Instance().SetGold64(123456789012345LL);
@@ -54,20 +113,26 @@ int main(int argc, char** argv)
CPythonPlayer::Instance().SetStatus(POINT_GEM, 1234);
assert(CPythonPlayer::Instance().GetStatus(POINT_GEM) == 1234);
if (!launcher.RunLine(
"import player, item, chrmgr, app\n"
"import player, item, chrmgr, app, exchange, safebox, guild, shop\n"
"assert shop.GetItemPrice(0) == 100000000000L\n"
"shop.AddPrivateShopItemStock(1, 0, 0, 100000000000L)\n"
"assert shop.GetPrivateShopItemPrice(1, 0) == 100000000000L\n"
"for invalid in (-1L, 0L, 2000000000000001L, 9223372036854775807L):\n"
" try: shop.AddPrivateShopItemStock(1, 0, 0, invalid)\n"
" except (ValueError, OverflowError): pass\n"
" else: raise AssertionError('accepted invalid shop price')\n"
"assert shop.GetPrivateShopItemPrice(1, 0) == 100000000000L\n"
"assert item.APPLY_RESIST_HUMAN == 99\n"
"assert exchange.GetElkFromSelf() == 5000000000L\n"
"assert exchange.GetElkFromTarget() == 10000000000L\n"
"assert safebox.GetMoney() == 100000000000L\n"
"assert guild.GetGuildMoney() == 200000000000L\n"
"gold = player.GetElk()\n"
"assert gold == 123456789012345L, 'GetElk mismatch: %r' % gold\n"
"assert player.GetGold64() == 123456789012345L\n"
"assert hasattr(player, 'GetGem')\n"
"assert player.GetGem() == 1234\n"
"assert player.POINT_GEM == 248\n"
"def _fmt(v):\n"
" if v >= 1000000000000: return '%.2f T' % (float(v)/1000000000000.0)\n"
" elif v >= 1000000000: return '%.2f B' % (float(v)/1000000000.0)\n"
" return format(int(v), ',')\n"
"assert _fmt(gold) == '123.46 T'\n"
"assert _fmt(5200000000L) == '5.20 B'\n"
"assert _fmt(1234567) == '1,234,567'\n"
"assert item.COSTUME_SLOT_WEAPON == player.COSTUME_SLOT_WEAPON\n"
"assert item.COSTUME_SLOT_NEW_SASH == player.COSTUME_SLOT_NEW_SASH\n"
"assert item.SHINING_SLOT_WEAPON == player.SHINING_SLOT_WEAPON\n"