port: PythonItem + item module (batch 2 P3-b)

Verbatim 40250 CPythonItem and the item Python module replace the
pending stand-in and the module stub; CPythonApplication::Create calls
m_pyItem.Create() in 40250 order. itemGetIconImage returns its handle
through Py_BuildPointer (the ILP32 int truncated it and wndMgr.SetSlot
crashed on the live inventory). CMapManager::GetNormal evaluates
CTerrain::CalculateNormal on the native height tile; the item text-tail
members stay stubs, Pick answering -1 like an empty tail map.

The fake server drops vnum 19 next to the actor at entergame and answers
CG_ITEM_PICKUP with GC_ITEM_GROUND_DEL; login_flow picks it up through
player.PickCloseItem and checks item.SelectItem(19).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-24 00:50:16 +09:00
co-authored by Claude Opus 5.5
parent f0564a7f12
commit 9298500df9
19 changed files with 2178 additions and 454 deletions
+1
View File
@@ -531,3 +531,4 @@
{"time": "2026-09-24T04:00:00Z", "event": "port_round", "unit": "PORT-PLAN batch 2: verify and mark 28 units copied into port/ in 2V1/2A", "ported": ["28 units, 372 functions: PythonNetworkStream{,PhaseLoading,PhaseLogin,PhaseSelect,PhaseHandShake,PhaseOffline,Event}, AccountConnector, NetStream, NetPacketHeaderMap, NetAddress, NetDevice, TextTag, EterPack, EterPackManager, EterPackCursor, EterPackPolicy_CSHybridCrypt, Timer, cipher, lzo, Random, Stl, tea, Arabic, StringCodec, StringCodec_Vietnamese, InsultChecker, AffectFlagContainer"], "adapted": [], "divergent": [], "needs_live": [], "tests": ["port_copy.py diff: 23 exact mechanical copies, 5 with // PORT: edits only; StringCodec_Vietnamese (not CP949) differs by BOM + include case", "no same-named platform/pending files", "ctest all 19/19 + render test on the same tree", "port_map.py check: 0 errors"], "todo": ["P2 ServerStateChecker (module still stubbed)", "P3 items/minimap/text tail"]}
{"time": "2026-09-24T05:00:00Z", "event": "port_round", "unit": "PORT-PLAN batch 2 P2: ServerStateChecker + module", "ported": ["UserInterface/ServerStateChecker.cpp", "UserInterface/ServerStateCheckerModule.cpp"], "adapted": [], "divergent": [], "needs_live": [], "tests": ["port.login_flow: fake state port answers CG_STATE_CHECKER, NotifyChannelState(2, 1)", "port.login_live 192.168.21.203: channel states {1: 1, 2: 1}", "ctest all 19/19, python_game_render_test offline PASS", "port_map.py check: 0 errors"], "todo": ["P3 item chain: ItemData, ItemManager, PythonItem, PythonExchange"]}
{"time": "2026-09-24T06:00:00Z", "event": "port_round", "unit": "PORT-PLAN batch 2 P3-a: ItemData, ItemManager, PythonNonPlayer + LoadLocaleData", "ported": ["GameLib/ItemData.cpp", "GameLib/ItemManager.cpp", "UserInterface/PythonNonPlayer.cpp", "UserInterface/PythonNonPlayerModule.cpp"], "adapted": ["UserInterface/PythonApplication.cpp:LoadLocaleData"], "divergent": [], "needs_live": [], "tests": ["port.login_flow 3c: item 19 Sword+9 type 1 refine 9, mob 101 Wild Dog", "port.login_live 192.168.21.203: same", "ctest all 19/19, python_game_render_test offline PASS", "port_map.py check: 0 errors"], "todo": ["P3-b PythonItem + PythonItemModule", "CPythonSkill (RegisterSkillDesc/Table) still pending"]}
{"time": "2026-09-24T07:00:00Z", "event": "port_round", "unit": "PORT-PLAN batch 2 P3-b: PythonItem + PythonItemModule", "ported": ["UserInterface/PythonItem.cpp", "UserInterface/PythonItemModule.cpp"], "adapted": ["UserInterface/PythonItemModule.cpp:itemGetIconImage", "GameLib/MapManager.cpp:CMapManager::GetNormal"], "divergent": [], "needs_live": [], "tests": ["port.login_flow: fake GC_ITEM_GROUND_ADD vnum 19 + ownership, player.PickCloseItem -> CG_ITEM_PICKUP -> GC_ITEM_GROUND_DEL removes it", "port.login_flow: item.SelectItem(19) name/type/subtype/value", "port.login_live 192.168.21.203: passes (icon pointer truncation segfault fixed)", "ctest all 19/19, python_game_render_test offline PASS", "port_map.py check: 0 errors"], "todo": ["P3-c PythonExchange", "PythonTextTail item tails (Register/Delete/SetOwner/Pick still stubs)", "CEffectManager (dropitem.mse)"]}
+6 -1
View File
@@ -179,7 +179,12 @@
"status": "TODO"
},
"CMapManager::GetNormal": {
"status": "TODO"
"status": "ADAPTED",
"impl": [
"extension/src/platform/pending/GameLib/MapManager.cpp:CMapManager::GetNormal"
],
"test": "extension/tests/port_login_flow_test.cpp (port.login_flow: ground item vnum 19 add/ownership/PickCloseItem/GROUND_DEL; item.SelectItem(19))",
"note": "CMapOutdoor::GetNormal tile clamp + CTerrain::CalculateNormal formula evaluated per call on the native height tile (no m_acNormalMap until CMapOutdoor/CTerrain are ported)."
},
"CMapManager::isPhysicalCollision": {
"status": "TODO"
@@ -0,0 +1,194 @@
{
"reference": "UserInterface/PythonItem.cpp",
"reference_sha256": "8917e3780091f01c584e180677000fa971c2d8d12a6d2da5a6f9e1588d567937",
"priority": "P3",
"contracts": [],
"functions": {
"CPythonItem::GetInfo": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::GetInfo"
]
},
"CPythonItem::TGroundItemInstance::Clear": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::TGroundItemInstance::Clear"
]
},
"CPythonItem::TGroundItemInstance::__PlayDropSound": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::TGroundItemInstance::__PlayDropSound"
]
},
"CPythonItem::TGroundItemInstance::Update": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::TGroundItemInstance::Update"
]
},
"CPythonItem::Update": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::Update"
]
},
"CPythonItem::Render": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::Render"
]
},
"CPythonItem::SetUseSoundFileName": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::SetUseSoundFileName"
]
},
"CPythonItem::SetDropSoundFileName": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::SetDropSoundFileName"
]
},
"CPythonItem::PlayUseSound": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::PlayUseSound"
]
},
"CPythonItem::PlayDropSound": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::PlayDropSound"
]
},
"CPythonItem::PlayUsePotionSound": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::PlayUsePotionSound"
]
},
"CPythonItem::__GetDropSoundType": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::__GetDropSoundType"
]
},
"CPythonItem::__GetUseSoundType": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::__GetUseSoundType"
]
},
"CPythonItem::CreateItem": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::CreateItem"
]
},
"CPythonItem::SetOwnership": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::SetOwnership"
]
},
"CPythonItem::GetOwnership": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::GetOwnership"
]
},
"CPythonItem::DeleteAllItems": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::DeleteAllItems"
]
},
"CPythonItem::DeleteItem": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::DeleteItem"
]
},
"CPythonItem::GetCloseMoney": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::GetCloseMoney"
]
},
"CPythonItem::GetCloseItem": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::GetCloseItem"
]
},
"CPythonItem::GetGroundItemPosition": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::GetGroundItemPosition"
]
},
"CPythonItem::__Pick": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::__Pick"
]
},
"CPythonItem::GetPickedItemID": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::GetPickedItemID"
]
},
"CPythonItem::GetVirtualNumberOfGroundItem": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::GetVirtualNumberOfGroundItem"
]
},
"CPythonItem::BuildNoGradeNameData": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::BuildNoGradeNameData"
]
},
"CPythonItem::GetNoGradeNameDataCount": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::GetNoGradeNameDataCount"
]
},
"CPythonItem::GetNoGradeNameDataPtr": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::GetNoGradeNameDataPtr"
]
},
"CPythonItem::Destroy": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::Destroy"
]
},
"CPythonItem::Create": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::Create"
]
},
"CPythonItem::CPythonItem": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::CPythonItem"
]
},
"CPythonItem::~CPythonItem": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItem.cpp:CPythonItem::~CPythonItem"
]
}
}
}
@@ -0,0 +1,232 @@
{
"reference": "UserInterface/PythonItemModule.cpp",
"reference_sha256": "6eb7357f37a19961a8b3293ce3098321b5a8231b8f09391a5bccbbaf7157bbe7",
"priority": "P3",
"contracts": [],
"functions": {
"itemSetUseSoundFileName": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemSetUseSoundFileName"
]
},
"itemSetDropSoundFileName": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemSetDropSoundFileName"
]
},
"itemSelectItem": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemSelectItem"
]
},
"itemGetItemName": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetItemName"
]
},
"itemGetItemDescription": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetItemDescription"
]
},
"itemGetItemSummary": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetItemSummary"
]
},
"itemGetIconImage": {
"status": "ADAPTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetIconImage"
],
"test": "extension/tests/port_login_flow_test.cpp (port.login_live: inventory slots set icons without the truncated-pointer crash)",
"note": "Returns the CGraphicSubImage* through Py_BuildPointer instead of Py_BuildValue(\"i\"): 40250 is ILP32, and wndMgr.SetSlot reads the handle back with PyTuple_GetPointer."
},
"itemGetIconImageFileName": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetIconImageFileName"
]
},
"itemGetItemSize": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetItemSize"
]
},
"itemGetItemType": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetItemType"
]
},
"itemGetItemSubType": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetItemSubType"
]
},
"itemGetIBuyItemPrice": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetIBuyItemPrice"
]
},
"itemGetISellItemPrice": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetISellItemPrice"
]
},
"itemIsAntiFlag": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemIsAntiFlag"
]
},
"itemIsFlag": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemIsFlag"
]
},
"itemIsWearableFlag": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemIsWearableFlag"
]
},
"itemIs1GoldItem": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemIs1GoldItem"
]
},
"itemGetLimit": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetLimit"
]
},
"itemGetAffect": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetAffect"
]
},
"itemGetValue": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetValue"
]
},
"itemGetSocket": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetSocket"
]
},
"itemGetIconInstance": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetIconInstance"
]
},
"itemDeleteIconInstance": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemDeleteIconInstance"
]
},
"itemIsEquipmentVID": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemIsEquipmentVID"
]
},
"itemGetUseType": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetUseType"
]
},
"itemIsRefineScroll": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemIsRefineScroll"
]
},
"itemIsDetachScroll": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemIsDetachScroll"
]
},
"itemCanAddToQuickSlotItem": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemCanAddToQuickSlotItem"
]
},
"itemIsKey": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemIsKey"
]
},
"itemIsMetin": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemIsMetin"
]
},
"itemRender": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemRender"
]
},
"itemUpdate": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemUpdate"
]
},
"itemCreateItem": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemCreateItem"
]
},
"itemDeleteItem": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemDeleteItem"
]
},
"itemPick": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemPick"
]
},
"itemLoadItemTable": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemLoadItemTable"
]
},
"initItem": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:initItem"
]
}
}
}