port: CPythonSkill + skill module + EterBase/Poly (1:1 40250)

Copy PythonSkill.cpp and the EterBase/Poly formula parser verbatim, drop the
pending stand-in and the skill module stub, register initskill() after
initfly() and build CPythonSkill in m_pySkill's place. LoadLocaleData now
loads skilldesc/skilltable. Skill and item icon handles go through
Py_BuildPointer/PyTuple_GetPointer (ILP32 ints truncate 64-bit pointers).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
shenlei
2026-09-24 03:07:15 +09:00
co-authored by Claude Opus 5.5
parent 7358bf444a
commit 03de3f314a
25 changed files with 3944 additions and 328 deletions
+1
View File
@@ -535,3 +535,4 @@
{"time": "2026-09-24T08:00:00Z", "event": "port_round", "unit": "PORT-PLAN batch 2 P3-c: PythonExchange + PythonExchangeModule", "ported": ["UserInterface/PythonExchange.cpp", "UserInterface/PythonExchangeModule.cpp"], "adapted": [], "divergent": [], "needs_live": ["exchange with a real second player"], "tests": ["port.login_flow: net.SendExchangeStartPacket -> fake GC_EXCHANGE START/ITEM_ADD/GOLD_ADD fills target side, uiexchange opens; SendExchangeExitPacket -> END closes", "port.login_live 192.168.21.203: passes", "ctest all 19/19, python_game_render_test offline PASS", "port_map.py check: 0 errors"], "todo": ["PythonTextTail item tails", "PythonMiniMap", "CEffectManager", "CPythonSkill"]} {"time": "2026-09-24T08:00:00Z", "event": "port_round", "unit": "PORT-PLAN batch 2 P3-c: PythonExchange + PythonExchangeModule", "ported": ["UserInterface/PythonExchange.cpp", "UserInterface/PythonExchangeModule.cpp"], "adapted": [], "divergent": [], "needs_live": ["exchange with a real second player"], "tests": ["port.login_flow: net.SendExchangeStartPacket -> fake GC_EXCHANGE START/ITEM_ADD/GOLD_ADD fills target side, uiexchange opens; SendExchangeExitPacket -> END closes", "port.login_live 192.168.21.203: passes", "ctest all 19/19, python_game_render_test offline PASS", "port_map.py check: 0 errors"], "todo": ["PythonTextTail item tails", "PythonMiniMap", "CEffectManager", "CPythonSkill"]}
{"time": "2026-09-24T09:00:00Z", "event": "port_round", "unit": "PORT-PLAN batch 2 P3-d: PythonTextTail + textTail module", "ported": ["UserInterface/PythonTextTail.cpp", "UserInterface/PythonTextTailModule.cpp"], "adapted": ["EterLib/GrpScreen.cpp:CScreen::ProjectPosition", "EterLib/GrpScreen.cpp:CScreen::UnprojectPosition", "UserInterface/UserInterface.cpp:ApplicationStringTable_GetString", "UserInterface/UserInterface.cpp:ApplicationStringTable_GetStringz"], "divergent": [], "needs_live": [], "tests": ["port.login_flow: ground item name tail registered, ALT frame projects it, CPythonTextTail::Pick returns the item VID, deleted on pickup", "port.login_live 192.168.21.203: passes", "ctest all 19/19, python_game_render_test offline PASS", "port_map.py check: 0 errors"], "todo": ["PythonMiniMap", "CEffectManager", "CPythonSkill"]} {"time": "2026-09-24T09:00:00Z", "event": "port_round", "unit": "PORT-PLAN batch 2 P3-d: PythonTextTail + textTail module", "ported": ["UserInterface/PythonTextTail.cpp", "UserInterface/PythonTextTailModule.cpp"], "adapted": ["EterLib/GrpScreen.cpp:CScreen::ProjectPosition", "EterLib/GrpScreen.cpp:CScreen::UnprojectPosition", "UserInterface/UserInterface.cpp:ApplicationStringTable_GetString", "UserInterface/UserInterface.cpp:ApplicationStringTable_GetStringz"], "divergent": [], "needs_live": [], "tests": ["port.login_flow: ground item name tail registered, ALT frame projects it, CPythonTextTail::Pick returns the item VID, deleted on pickup", "port.login_live 192.168.21.203: passes", "ctest all 19/19, python_game_render_test offline PASS", "port_map.py check: 0 errors"], "todo": ["PythonMiniMap", "CEffectManager", "CPythonSkill"]}
{"time": "2026-09-24T10:00:00Z", "event": "port_round", "unit": "PORT-PLAN batch 2 P3-e: PythonMiniMap + miniMap module", "ported": ["UserInterface/PythonMiniMap.cpp", "UserInterface/PythonMiniMapModule.cpp", "PRTerrainLib/StdAfx.cpp"], "adapted": [], "divergent": ["GameLib/MapManager.cpp:CMapManager::IsMapOutdoor (false until CMapOutdoor is ported)"], "needs_live": [], "tests": ["port.login_flow: miniMap.isShow() after uiminimap, GetAtlasSize() not loaded", "port.login_live 192.168.21.203: passes", "ctest all 19/19, python_game_render_test offline PASS", "port_map.py check: 0 errors"], "todo": ["CMapOutdoor (minimap terrain textures, atlas)", "CEffectManager", "CPythonSkill"]} {"time": "2026-09-24T10:00:00Z", "event": "port_round", "unit": "PORT-PLAN batch 2 P3-e: PythonMiniMap + miniMap module", "ported": ["UserInterface/PythonMiniMap.cpp", "UserInterface/PythonMiniMapModule.cpp", "PRTerrainLib/StdAfx.cpp"], "adapted": [], "divergent": ["GameLib/MapManager.cpp:CMapManager::IsMapOutdoor (false until CMapOutdoor is ported)"], "needs_live": [], "tests": ["port.login_flow: miniMap.isShow() after uiminimap, GetAtlasSize() not loaded", "port.login_live 192.168.21.203: passes", "ctest all 19/19, python_game_render_test offline PASS", "port_map.py check: 0 errors"], "todo": ["CMapOutdoor (minimap terrain textures, atlas)", "CEffectManager", "CPythonSkill"]}
{"time": "2026-09-24T12:00:00Z", "event": "port_round", "unit": "batch 3-a: CPythonSkill + skill module + EterBase/Poly", "ported": ["UserInterface/PythonSkill.cpp", "EterBase/Poly/Base.cpp", "EterBase/Poly/Poly.cpp", "EterBase/Poly/SymTable.cpp", "EterBase/Poly/Symbol.cpp"], "adapted": ["PythonSkill.cpp: icon handle functions (Py_BuildPointer), skillGetGradeData (varargs struct)", "PythonItemModule.cpp: itemGetIconInstance/itemDeleteIconInstance (Py_BuildPointer)"], "divergent": [], "needs_live": [], "tests": ["port.login_flow: skill 1 name/type/cooltime after LoadLocaleData; grade icon + icon instance in game", "port.login_live 192.168.21.203 passes", "ctest 19/19, python_game_render_test PASS", "port_map check 0 errors"], "todo": ["EffectLib", "CMapOutdoor", "default route switch"]}
@@ -0,0 +1,38 @@
{
"reference": "EterBase/Poly/Base.cpp",
"reference_sha256": "44777e6173df4d43f20730d2a241ecb5a2576561cb5c49d89645ab83f119aa6d",
"priority": "P4",
"contracts": [],
"functions": {
"CBase::CBase": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Base.cpp:CBase::CBase"
]
},
"CBase::~CBase": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Base.cpp:CBase::~CBase"
]
},
"CBase::isNumber": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Base.cpp:CBase::isNumber"
]
},
"CBase::isVar": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Base.cpp:CBase::isVar"
]
},
"CBase::isSymbol": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Base.cpp:CBase::isSymbol"
]
}
}
}
+152
View File
@@ -0,0 +1,152 @@
{
"reference": "EterBase/Poly/Poly.cpp",
"reference_sha256": "1ca53bed299366c916408e02c9e23b4a799134b63174bab9246d2d79e75b7a3c",
"priority": "P4",
"contracts": [],
"functions": {
"_random": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:_random"
]
},
"CPoly::SetRandom": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::SetRandom"
]
},
"CPoly::my_irandom": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::my_irandom"
]
},
"CPoly::my_frandom": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::my_frandom"
]
},
"CPoly::CPoly": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::CPoly"
]
},
"CPoly::~CPoly": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::~CPoly"
]
},
"CPoly::SetStr": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::SetStr"
]
},
"CPoly::Eval": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::Eval"
]
},
"CPoly::Analyze": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::Analyze"
]
},
"CPoly::Clear": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::Clear"
]
},
"CPoly::expr": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::expr"
]
},
"CPoly::error": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::error"
]
},
"CPoly::lexan": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::lexan"
]
},
"CPoly::term": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::term"
]
},
"CPoly::factor": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::factor"
]
},
"CPoly::expo": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::expo"
]
},
"CPoly::match": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::match"
]
},
"CPoly::emit": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::emit"
]
},
"CPoly::find": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::find"
]
},
"CPoly::insert": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::insert"
]
},
"CPoly::SetVar": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::SetVar"
]
},
"CPoly::GetVarCount": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::GetVarCount"
]
},
"CPoly::GetVarName": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::GetVarName"
]
},
"CPoly::init": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Poly.cpp:CPoly::init"
]
}
}
}
@@ -0,0 +1,20 @@
{
"reference": "EterBase/Poly/SymTable.cpp",
"reference_sha256": "055323b1fbc4360c9f751089eb537afabb42343d19b65439dbe7d2a2a47d2fb4",
"priority": "P4",
"contracts": [],
"functions": {
"CSymTable::CSymTable": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/SymTable.cpp:CSymTable::CSymTable"
]
},
"CSymTable::~CSymTable": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/SymTable.cpp:CSymTable::~CSymTable"
]
}
}
}
@@ -0,0 +1,50 @@
{
"reference": "EterBase/Poly/Symbol.cpp",
"reference_sha256": "018d4ee2824ccf9b10c859650ff22e47d815c03d958caa7490acc4c90479a032",
"priority": "P4",
"contracts": [],
"functions": {
"CSymbol::CSymbol": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Symbol.cpp:CSymbol::CSymbol"
]
},
"CSymbol::~CSymbol": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Symbol.cpp:CSymbol::~CSymbol"
]
},
"CSymbol::Equal": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Symbol.cpp:CSymbol::Equal"
]
},
"CSymbol::Less": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Symbol.cpp:CSymbol::Less"
]
},
"CSymbol::GetType": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Symbol.cpp:CSymbol::GetType"
]
},
"CSymbol::SetType": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Symbol.cpp:CSymbol::SetType"
]
},
"CSymbol::issymbol": {
"status": "PORTED",
"impl": [
"extension/src/port/EterBase/Poly/Symbol.cpp:CSymbol::issymbol"
]
}
}
}
@@ -63,8 +63,8 @@
"impl": [ "impl": [
"extension/src/platform/UserInterface/PythonApplication.cpp:LoadLocaleData" "extension/src/platform/UserInterface/PythonApplication.cpp:LoadLocaleData"
], ],
"note": "Body verbatim in the platform CPythonApplication stand-in; CPythonSkill is still pending, so RegisterSkillDesc fails and it returns false after the item and mob tables load (localeinfo.py ignores the result).", "note": "Body verbatim in the platform CPythonApplication stand-in (the class itself is not ported); it reads item/mob tables and CPythonSkill's skilldesc/skilltable.",
"test": "extension/tests/port_login_flow_test.cpp step 3c (port.login_flow / port.login_live: item 19 Sword+9, mob 101 Wild Dog)" "test": "extension/tests/port_login_flow_test.cpp step 3c (port.login_flow / port.login_live: item 19 Sword+9, mob 101 Wild Dog, skill 1 Three-Way Cut cool time 12)"
}, },
"__GetWindowMode": { "__GetWindowMode": {
"status": "TODO" "status": "TODO"
@@ -133,16 +133,20 @@
] ]
}, },
"itemGetIconInstance": { "itemGetIconInstance": {
"status": "PORTED", "status": "ADAPTED",
"impl": [ "impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemGetIconInstance" "extension/src/port/UserInterface/PythonItemModule.cpp:itemGetIconInstance"
] ],
"note": "Returns/reads the pointer through Py_BuildPointer/PyTuple_GetPointer instead of Py_BuildValue(\"i\")/PyTuple_GetInteger: 40250 is ILP32, a 64-bit pointer truncated in \"i\" crashed wndMgr.SetSlot.",
"test": "extension/tests/port_login_flow_test.cpp (compiles with the same handle helpers as skill icon instances)"
}, },
"itemDeleteIconInstance": { "itemDeleteIconInstance": {
"status": "PORTED", "status": "ADAPTED",
"impl": [ "impl": [
"extension/src/port/UserInterface/PythonItemModule.cpp:itemDeleteIconInstance" "extension/src/port/UserInterface/PythonItemModule.cpp:itemDeleteIconInstance"
] ],
"note": "Returns/reads the pointer through Py_BuildPointer/PyTuple_GetPointer instead of Py_BuildValue(\"i\")/PyTuple_GetInteger: 40250 is ILP32, a 64-bit pointer truncated in \"i\" crashed wndMgr.SetSlot.",
"test": "extension/tests/port_login_flow_test.cpp (compiles with the same handle helpers as skill icon instances)"
}, },
"itemIsEquipmentVID": { "itemIsEquipmentVID": {
"status": "PORTED", "status": "PORTED",
@@ -0,0 +1,608 @@
{
"reference": "UserInterface/PythonSkill.cpp",
"reference_sha256": "c3c5d946aa801cbcc2a42c32e1c77ae59113a263f5618faaa8e15fc77b903fac",
"priority": "P1",
"contracts": [],
"functions": {
"SplitLine": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:SplitLine"
]
},
"string_replace_word": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:string_replace_word"
]
},
"CPythonSkill::RegisterSkillTable": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::RegisterSkillTable"
]
},
"CPythonSkill::__RegisterGradeIconImage": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::__RegisterGradeIconImage"
]
},
"CPythonSkill::__RegisterNormalIconImage": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::__RegisterNormalIconImage"
]
},
"CPythonSkill::RegisterSkillDesc": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::RegisterSkillDesc"
]
},
"CPythonSkill::Destroy": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::Destroy"
]
},
"CPythonSkill::RegisterSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::RegisterSkill"
]
},
"CPythonSkill::GetSkillData": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::GetSkillData"
]
},
"CPythonSkill::GetSkillDataByName": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::GetSkillDataByName"
]
},
"CPythonSkill::SetPathName": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SetPathName"
]
},
"CPythonSkill::GetPathName": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::GetPathName"
]
},
"CPythonSkill::TEST": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::TEST"
]
},
"CPythonSkill::CPythonSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::CPythonSkill"
]
},
"CPythonSkill::~CPythonSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::~CPythonSkill"
]
},
"CPythonSkill::SSkillData::GetName": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::GetName"
]
},
"CPythonSkill::SSkillData::GetType": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::GetType"
]
},
"CPythonSkill::SSkillData::IsMeleeSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsMeleeSkill"
]
},
"CPythonSkill::SSkillData::IsChargeSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsChargeSkill"
]
},
"CPythonSkill::SSkillData::IsOnlyForGuildWar": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsOnlyForGuildWar"
]
},
"CPythonSkill::SSkillData::GetTargetRange": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::GetTargetRange"
]
},
"CPythonSkill::SSkillData::CanChangeDirection": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::CanChangeDirection"
]
},
"CPythonSkill::SSkillData::IsFanRange": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsFanRange"
]
},
"CPythonSkill::SSkillData::IsCircleRange": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsCircleRange"
]
},
"CPythonSkill::SSkillData::IsAutoSearchTarget": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsAutoSearchTarget"
]
},
"CPythonSkill::SSkillData::IsNeedCorpse": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsNeedCorpse"
]
},
"CPythonSkill::SSkillData::IsNeedTarget": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsNeedTarget"
]
},
"CPythonSkill::SSkillData::IsToggleSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsToggleSkill"
]
},
"CPythonSkill::SSkillData::IsUseHPSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsUseHPSkill"
]
},
"CPythonSkill::SSkillData::IsStandingSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsStandingSkill"
]
},
"CPythonSkill::SSkillData::CanUseWeaponType": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::CanUseWeaponType"
]
},
"CPythonSkill::SSkillData::IsOnlyForAlliance": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsOnlyForAlliance"
]
},
"CPythonSkill::SSkillData::CanUseForMe": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::CanUseForMe"
]
},
"CPythonSkill::SSkillData::CanUseIfNotEnough": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::CanUseIfNotEnough"
]
},
"CPythonSkill::SSkillData::IsNeedEmptyBottle": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsNeedEmptyBottle"
]
},
"CPythonSkill::SSkillData::IsNeedPoisonBottle": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsNeedPoisonBottle"
]
},
"CPythonSkill::SSkillData::IsNeedBow": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsNeedBow"
]
},
"CPythonSkill::SSkillData::IsHorseSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsHorseSkill"
]
},
"CPythonSkill::SSkillData::IsMovingSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsMovingSkill"
]
},
"CPythonSkill::SSkillData::IsAttackSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsAttackSkill"
]
},
"CPythonSkill::SSkillData::IsTimeIncreaseSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsTimeIncreaseSkill"
]
},
"CPythonSkill::SSkillData::GetState": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::GetState"
]
},
"CPythonSkill::SSkillData::ProcessFormula": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::ProcessFormula"
]
},
"CPythonSkill::SSkillData::GetAffectDescription": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::GetAffectDescription"
]
},
"CPythonSkill::SSkillData::GetSkillCoolTime": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::GetSkillCoolTime"
]
},
"CPythonSkill::SSkillData::GetTargetCount": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::GetTargetCount"
]
},
"CPythonSkill::SSkillData::GetSkillMotionIndex": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::GetSkillMotionIndex"
]
},
"CPythonSkill::SSkillData::GetMaxLevel": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::GetMaxLevel"
]
},
"CPythonSkill::SSkillData::GetLevelUpPoint": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::GetLevelUpPoint"
]
},
"CPythonSkill::SSkillData::IsNoMotion": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsNoMotion"
]
},
"CPythonSkill::SSkillData::IsCanUseSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::IsCanUseSkill"
]
},
"CPythonSkill::SSkillData::GetMotionLoopCount": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::GetMotionLoopCount"
]
},
"CPythonSkill::SSkillData::GetNeedSP": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::GetNeedSP"
]
},
"CPythonSkill::SSkillData::GetContinuationSP": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::GetContinuationSP"
]
},
"CPythonSkill::SSkillData::GetDuration": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::GetDuration"
]
},
"CPythonSkill::SSkillData::SSkillData": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:CPythonSkill::SSkillData::SSkillData"
]
},
"skillSetPathName": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillSetPathName"
]
},
"skillRegisterSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillRegisterSkill"
]
},
"skillLoadSkillData": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillLoadSkillData"
]
},
"skillRegisterSkillDesc": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillRegisterSkillDesc"
]
},
"skillClearSkillData": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillClearSkillData"
]
},
"skillGetSkillName": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillName"
]
},
"skillGetSkillDescription": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillDescription"
]
},
"skillGetSkillType": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillType"
]
},
"skillGetSkillConditionDescriptionCount": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillConditionDescriptionCount"
]
},
"skillGetSkillConditionDescription": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillConditionDescription"
]
},
"skillGetSkillAffectDescriptionCount": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillAffectDescriptionCount"
]
},
"skillGetSkillAffectDescription": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillAffectDescription"
]
},
"skillGetSkillCoolTime": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillCoolTime"
]
},
"skillGetSkillNeedSP": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillNeedSP"
]
},
"skillGetSkillContinuationSP": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillContinuationSP"
]
},
"skillGetSkillMaxLevel": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillMaxLevel"
]
},
"skillGetSkillLevelUpPoint": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillLevelUpPoint"
]
},
"skillGetSkillLevelLimit": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillLevelLimit"
]
},
"skillIsSkillRequirement": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillIsSkillRequirement"
]
},
"skillGetSkillRequirementData": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillRequirementData"
]
},
"skillGetSkillRequireStatCount": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillRequireStatCount"
]
},
"skillGetSkillRequireStatData": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetSkillRequireStatData"
]
},
"skillCanLevelUpSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillCanLevelUpSkill"
]
},
"skillCheckRequirementSueccess": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillCheckRequirementSueccess"
]
},
"skillGetNeedCharacterLevel": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetNeedCharacterLevel"
]
},
"skillIsToggleSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillIsToggleSkill"
]
},
"skillIsUseHPSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillIsUseHPSkill"
]
},
"skillIsStandingSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillIsStandingSkill"
]
},
"skillCanUseSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillCanUseSkill"
]
},
"skillIsLevelUpSkill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillIsLevelUpSkill"
]
},
"skillGetIconName": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetIconName"
]
},
"skillGetIconImage": {
"status": "ADAPTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetIconImage"
],
"note": "Returns/reads the pointer through Py_BuildPointer/PyTuple_GetPointer instead of Py_BuildValue(\"i\")/PyTuple_GetInteger: 40250 is ILP32, a 64-bit pointer truncated in \"i\" crashed wndMgr.SetSlot.",
"test": "extension/tests/port_login_flow_test.cpp (port.login_flow in-game step: grade icon image + icon instance round trip)"
},
"skillGetIconInstance": {
"status": "ADAPTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetIconInstance"
],
"note": "Returns/reads the pointer through Py_BuildPointer/PyTuple_GetPointer instead of Py_BuildValue(\"i\")/PyTuple_GetInteger: 40250 is ILP32, a 64-bit pointer truncated in \"i\" crashed wndMgr.SetSlot.",
"test": "extension/tests/port_login_flow_test.cpp (port.login_flow in-game step: grade icon image + icon instance round trip)"
},
"skillGetIconImageNew": {
"status": "ADAPTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetIconImageNew"
],
"note": "Returns/reads the pointer through Py_BuildPointer/PyTuple_GetPointer instead of Py_BuildValue(\"i\")/PyTuple_GetInteger: 40250 is ILP32, a 64-bit pointer truncated in \"i\" crashed wndMgr.SetSlot.",
"test": "extension/tests/port_login_flow_test.cpp (port.login_flow in-game step: grade icon image + icon instance round trip)"
},
"skillGetIconInstanceNew": {
"status": "ADAPTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetIconInstanceNew"
],
"note": "Returns/reads the pointer through Py_BuildPointer/PyTuple_GetPointer instead of Py_BuildValue(\"i\")/PyTuple_GetInteger: 40250 is ILP32, a 64-bit pointer truncated in \"i\" crashed wndMgr.SetSlot.",
"test": "extension/tests/port_login_flow_test.cpp (port.login_flow in-game step: grade icon image + icon instance round trip)"
},
"skillDeleteIconInstance": {
"status": "ADAPTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillDeleteIconInstance"
],
"note": "Returns/reads the pointer through Py_BuildPointer/PyTuple_GetPointer instead of Py_BuildValue(\"i\")/PyTuple_GetInteger: 40250 is ILP32, a 64-bit pointer truncated in \"i\" crashed wndMgr.SetSlot.",
"test": "extension/tests/port_login_flow_test.cpp (port.login_flow in-game step: grade icon image + icon instance round trip)"
},
"skillGetGradeData": {
"status": "ADAPTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetGradeData"
],
"note": "40250 passes the non-trivial TGradeData through varargs (\"i\" reads its first 4 bytes); clang rejects that, so the same first 4 bytes are read explicitly. No root script calls skill.GetGradeData.",
"test": "extension/tests/port_login_flow_test.cpp (module imports; function unused by root scripts)"
},
"skillGetNewAffectDataCount": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetNewAffectDataCount"
]
},
"skillGetNewAffectData": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetNewAffectData"
]
},
"skillGetDuration": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillGetDuration"
]
},
"skillTEST": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:skillTEST"
]
},
"initskill": {
"status": "PORTED",
"impl": [
"extension/src/port/UserInterface/PythonSkill.cpp:initskill"
]
}
}
}
+2
View File
@@ -444,6 +444,8 @@ extension/third_party/cpython-2.7.18/ # 静态库(2P 批次
P3-e(2026-09-24):`PythonMiniMap.cpp` 与 `PythonMiniMapModule.cpp` 原样移植(无手改),删除 pending 替身与 miniMap 模块桩,`initMiniMap()` 按 40250 顺序在 `initnet()` 之后;`PRTerrainLib/StdAfx.cpp`(`PR_FCNV/PR_ICNV`)原样复制,UserInterface PCH 按 40250 补 `PRTerrainLib/StdAfx.h`,`TerrainType.h` 的 `PR_FLOAT_TO_INTASM` 在非 MSVC 下用 `lrintf`(x87 fistp 默认舍入)代替内联汇编;`D3DXMath.h` 补 `D3DXColorModulate`。缺口:`CMapOutdoor` 未移植(地形由 Godot 适配层绘制),pending `CMapManager::IsMapOutdoor()` 返回 false(记 DIVERGENT),`GetMapOutdoorRef` 与 pending `CMapOutdoor::GetTerrainPointer/GetBaseXY` 只为链接存在、不可达——小地图地形贴图、标记与大地图(atlas)因此走 40250「非室外地图」路径不显示,待 `CMapOutdoor` 移植后自然恢复。`port.login_flow` 验证 uiminimap 创建并显示 miniMap、`GetAtlasSize()` 报未载入。P3 物品链与三个 UI 单元至此完成;下一步候选:`CMapOutdoor`(解锁小地图/大地图)、`CEffectManager`/EffectLib、`CPythonSkill`。 P3-e(2026-09-24):`PythonMiniMap.cpp` 与 `PythonMiniMapModule.cpp` 原样移植(无手改),删除 pending 替身与 miniMap 模块桩,`initMiniMap()` 按 40250 顺序在 `initnet()` 之后;`PRTerrainLib/StdAfx.cpp`(`PR_FCNV/PR_ICNV`)原样复制,UserInterface PCH 按 40250 补 `PRTerrainLib/StdAfx.h`,`TerrainType.h` 的 `PR_FLOAT_TO_INTASM` 在非 MSVC 下用 `lrintf`(x87 fistp 默认舍入)代替内联汇编;`D3DXMath.h` 补 `D3DXColorModulate`。缺口:`CMapOutdoor` 未移植(地形由 Godot 适配层绘制),pending `CMapManager::IsMapOutdoor()` 返回 false(记 DIVERGENT),`GetMapOutdoorRef` 与 pending `CMapOutdoor::GetTerrainPointer/GetBaseXY` 只为链接存在、不可达——小地图地形贴图、标记与大地图(atlas)因此走 40250「非室外地图」路径不显示,待 `CMapOutdoor` 移植后自然恢复。`port.login_flow` 验证 uiminimap 创建并显示 miniMap、`GetAtlasSize()` 报未载入。P3 物品链与三个 UI 单元至此完成;下一步候选:`CMapOutdoor`(解锁小地图/大地图)、`CEffectManager`/EffectLib、`CPythonSkill`。
批次 3-a CPythonSkill(2026-09-24):`UserInterface/PythonSkill.cpp`(含 skill 模块)与 `EterBase/Poly/`(技能公式解析器)原样移植,删除 pending 替身与 skill 模块桩,`initskill()` 按 40250 顺序在 `initfly()` 之后,实例按 `m_pySkill` 位置进 PythonBoot 的 `GameSingletons`;平台 `PythonApplication.cpp` 里重复的 `SKILL_EFFECT_UPGRADE_ENABLE` 删掉(40250 定义在 PythonSkill.cpp),`LoadLocaleData` 的 skilldesc/skilltable 现在真正载入。改动:技能图标/图标实例句柄用 `Py_BuildPointer`/`PyTuple_GetPointer`(item 模块的 `GetIconInstance/DeleteIconInstance` 同改),`skillGetGradeData` 把非平凡结构传进 varargs(clang 拒绝),改为显式读同样的前 4 字节(脚本不调用)。`port.login_flow`:选角阶段 skill 1 = Three-Way Cut、ACTIVE、冷却 12;进游戏后主动技能只有分等级图标(`GetIconImage` 为 0,与 40250 相同),`GetIconImageNew/GetIconInstanceNew` 可用;真服同样通过。
每个切片都必须同时跑 legacy/port 双路回归;只有 2V3 稳定并把默认路由切到 `port` 后,才能删除总开关和剩余 legacy 宿主。 每个切片都必须同时跑 legacy/port 双路回归;只有 2V3 稳定并把默认路由切到 `port` 后,才能删除总开关和剩余 legacy 宿主。
## 5. 数据源切换:m2dev assets → 40250 ## 5. 数据源切换:m2dev assets → 40250
@@ -136,21 +136,6 @@ void AddStubConstants_shop(PyObject* poModule)
} }
// 40250 UserInterface/PythonSkill.cpp // 40250 UserInterface/PythonSkill.cpp
void AddStubConstants_skill(PyObject* poModule)
{
(void) poModule;
PyModule_AddIntConstant(poModule, "SKILL_TYPE_NONE", CPythonSkill::SKILL_TYPE_NONE);
PyModule_AddIntConstant(poModule, "SKILL_TYPE_ACTIVE", CPythonSkill::SKILL_TYPE_ACTIVE);
PyModule_AddIntConstant(poModule, "SKILL_TYPE_SUPPORT", CPythonSkill::SKILL_TYPE_SUPPORT);
PyModule_AddIntConstant(poModule, "SKILL_TYPE_GUILD", CPythonSkill::SKILL_TYPE_GUILD);
PyModule_AddIntConstant(poModule, "SKILL_TYPE_HORSE", CPythonSkill::SKILL_TYPE_HORSE);
PyModule_AddIntConstant(poModule, "SKILL_TYPE_MAX_NUM", CPythonSkill::SKILL_TYPE_MAX_NUM);
PyModule_AddIntConstant(poModule, "SKILL_GRADE_COUNT", CPythonSkill::SKILL_GRADE_COUNT);
PyModule_AddIntConstant(poModule, "SKILL_GRADE_STEP_COUNT", CPythonSkill::SKILL_GRADE_STEP_COUNT);
PyModule_AddIntConstant(poModule, "SKILL_GRADEGAP", CPythonSkill::SKILL_GRADEGAP);
PyModule_AddIntConstant(poModule, "SKILL_EFFECT_COUNT", CPythonSkill::SKILL_EFFECT_COUNT);
}
// 40250 UserInterface/PythonSoundManagerModule.cpp // 40250 UserInterface/PythonSoundManagerModule.cpp
void AddStubConstants_snd(PyObject* poModule) void AddStubConstants_snd(PyObject* poModule)
{ {
@@ -15,7 +15,6 @@ void AddStubConstants_profiler(PyObject* poModule);
void AddStubConstants_quest(PyObject* poModule); void AddStubConstants_quest(PyObject* poModule);
void AddStubConstants_safebox(PyObject* poModule); void AddStubConstants_safebox(PyObject* poModule);
void AddStubConstants_shop(PyObject* poModule); void AddStubConstants_shop(PyObject* poModule);
void AddStubConstants_skill(PyObject* poModule);
void AddStubConstants_snd(PyObject* poModule); void AddStubConstants_snd(PyObject* poModule);
void AddStubConstants_systemSetting(PyObject* poModule); void AddStubConstants_systemSetting(PyObject* poModule);
void AddStubConstants_udp(PyObject* poModule); void AddStubConstants_udp(PyObject* poModule);
@@ -430,90 +429,6 @@ PyMethodDef methods_shop[] = {
{ "BuildPrivateShop", stub_shop_BuildPrivateShop, METH_VARARGS }, { "BuildPrivateShop", stub_shop_BuildPrivateShop, METH_VARARGS },
{ NULL, NULL } { NULL, NULL }
}; };
// 40250 UserInterface/PythonSkill.cpp: skill export names.
PyObject* stub_skill_SetPathName(PyObject*, PyObject*) { return stub_call_named("skill.SetPathName", Py_BuildNone()); }
PyObject* stub_skill_RegisterSkill(PyObject*, PyObject*) { return stub_call_named("skill.RegisterSkill", Py_BuildNone()); }
PyObject* stub_skill_LoadSkillData(PyObject*, PyObject*) { return stub_call_named("skill.LoadSkillData", Py_BuildNone()); }
PyObject* stub_skill_ClearSkillData(PyObject*, PyObject*) { return stub_call_named("skill.ClearSkillData", Py_BuildNone()); }
PyObject* stub_skill_GetSkillName(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillName", Py_BuildValue("s", "")); }
PyObject* stub_skill_GetSkillDescription(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillDescription", Py_BuildValue("s", "")); }
PyObject* stub_skill_GetSkillType(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillType", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetSkillConditionDescriptionCount(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillConditionDescriptionCount", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetSkillConditionDescription(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillConditionDescription", Py_BuildValue("s", "")); }
PyObject* stub_skill_GetSkillAffectDescriptionCount(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillAffectDescriptionCount", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetSkillAffectDescription(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillAffectDescription", Py_BuildValue("s", "")); }
PyObject* stub_skill_GetSkillCoolTime(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillCoolTime", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetSkillNeedSP(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillNeedSP", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetSkillContinuationSP(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillContinuationSP", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetSkillMaxLevel(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillMaxLevel", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetSkillLevelUpPoint(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillLevelUpPoint", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetSkillLevelLimit(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillLevelLimit", Py_BuildValue("i", 0)); }
PyObject* stub_skill_IsSkillRequirement(PyObject*, PyObject*) { return stub_call_named("skill.IsSkillRequirement", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetSkillRequirementData(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillRequirementData", Py_BuildValue("si", "", 0)); }
PyObject* stub_skill_GetSkillRequireStatCount(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillRequireStatCount", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetSkillRequireStatData(PyObject*, PyObject*) { return stub_call_named("skill.GetSkillRequireStatData", Py_BuildValue("ii", 0, 0)); }
PyObject* stub_skill_CanLevelUpSkill(PyObject*, PyObject*) { return stub_call_named("skill.CanLevelUpSkill", Py_BuildValue("i", 0)); }
PyObject* stub_skill_IsLevelUpSkill(PyObject*, PyObject*) { return stub_call_named("skill.IsLevelUpSkill", Py_BuildValue("i", 0)); }
PyObject* stub_skill_CheckRequirementSueccess(PyObject*, PyObject*) { return stub_call_named("skill.CheckRequirementSueccess", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetNeedCharacterLevel(PyObject*, PyObject*) { return stub_call_named("skill.GetNeedCharacterLevel", Py_BuildValue("i", 0)); }
PyObject* stub_skill_IsToggleSkill(PyObject*, PyObject*) { return stub_call_named("skill.IsToggleSkill", Py_BuildValue("i", 0)); }
PyObject* stub_skill_IsUseHPSkill(PyObject*, PyObject*) { return stub_call_named("skill.IsUseHPSkill", Py_BuildValue("i", 0)); }
PyObject* stub_skill_IsStandingSkill(PyObject*, PyObject*) { return stub_call_named("skill.IsStandingSkill", Py_BuildValue("i", 0)); }
PyObject* stub_skill_CanUseSkill(PyObject*, PyObject*) { return stub_call_named("skill.CanUseSkill", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetIconName(PyObject*, PyObject*) { return stub_call_named("skill.GetIconName", Py_BuildValue("s", "")); }
PyObject* stub_skill_GetIconImage(PyObject*, PyObject*) { return stub_call_named("skill.GetIconImage", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetIconImageNew(PyObject*, PyObject*) { return stub_call_named("skill.GetIconImageNew", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetIconInstance(PyObject*, PyObject*) { return stub_call_named("skill.GetIconInstance", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetIconInstanceNew(PyObject*, PyObject*) { return stub_call_named("skill.GetIconInstanceNew", Py_BuildValue("i", 0)); }
PyObject* stub_skill_DeleteIconInstance(PyObject*, PyObject*) { return stub_call_named("skill.DeleteIconInstance", Py_BuildNone()); }
PyObject* stub_skill_GetGradeData(PyObject*, PyObject*) { return stub_call_named("skill.GetGradeData", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetNewAffectDataCount(PyObject*, PyObject*) { return stub_call_named("skill.GetNewAffectDataCount", Py_BuildValue("i", 0)); }
PyObject* stub_skill_GetNewAffectData(PyObject*, PyObject*) { return stub_call_named("skill.GetNewAffectData", Py_BuildValue("sff", "", 0.0, 0.0)); }
PyObject* stub_skill_GetDuration(PyObject*, PyObject*) { return stub_call_named("skill.GetDuration", Py_BuildValue("i", 0)); }
PyObject* stub_skill_TEST(PyObject*, PyObject*) { return stub_call_named("skill.TEST", Py_BuildNone()); }
PyMethodDef methods_skill[] = {
{ "SetPathName", stub_skill_SetPathName, METH_VARARGS },
{ "RegisterSkill", stub_skill_RegisterSkill, METH_VARARGS },
{ "LoadSkillData", stub_skill_LoadSkillData, METH_VARARGS },
{ "ClearSkillData", stub_skill_ClearSkillData, METH_VARARGS },
{ "GetSkillName", stub_skill_GetSkillName, METH_VARARGS },
{ "GetSkillDescription", stub_skill_GetSkillDescription, METH_VARARGS },
{ "GetSkillType", stub_skill_GetSkillType, METH_VARARGS },
{ "GetSkillConditionDescriptionCount", stub_skill_GetSkillConditionDescriptionCount, METH_VARARGS },
{ "GetSkillConditionDescription", stub_skill_GetSkillConditionDescription, METH_VARARGS },
{ "GetSkillAffectDescriptionCount", stub_skill_GetSkillAffectDescriptionCount, METH_VARARGS },
{ "GetSkillAffectDescription", stub_skill_GetSkillAffectDescription, METH_VARARGS },
{ "GetSkillCoolTime", stub_skill_GetSkillCoolTime, METH_VARARGS },
{ "GetSkillNeedSP", stub_skill_GetSkillNeedSP, METH_VARARGS },
{ "GetSkillContinuationSP", stub_skill_GetSkillContinuationSP, METH_VARARGS },
{ "GetSkillMaxLevel", stub_skill_GetSkillMaxLevel, METH_VARARGS },
{ "GetSkillLevelUpPoint", stub_skill_GetSkillLevelUpPoint, METH_VARARGS },
{ "GetSkillLevelLimit", stub_skill_GetSkillLevelLimit, METH_VARARGS },
{ "IsSkillRequirement", stub_skill_IsSkillRequirement, METH_VARARGS },
{ "GetSkillRequirementData", stub_skill_GetSkillRequirementData, METH_VARARGS },
{ "GetSkillRequireStatCount", stub_skill_GetSkillRequireStatCount, METH_VARARGS },
{ "GetSkillRequireStatData", stub_skill_GetSkillRequireStatData, METH_VARARGS },
{ "CanLevelUpSkill", stub_skill_CanLevelUpSkill, METH_VARARGS },
{ "IsLevelUpSkill", stub_skill_IsLevelUpSkill, METH_VARARGS },
{ "CheckRequirementSueccess", stub_skill_CheckRequirementSueccess, METH_VARARGS },
{ "GetNeedCharacterLevel", stub_skill_GetNeedCharacterLevel, METH_VARARGS },
{ "IsToggleSkill", stub_skill_IsToggleSkill, METH_VARARGS },
{ "IsUseHPSkill", stub_skill_IsUseHPSkill, METH_VARARGS },
{ "IsStandingSkill", stub_skill_IsStandingSkill, METH_VARARGS },
{ "CanUseSkill", stub_skill_CanUseSkill, METH_VARARGS },
{ "GetIconName", stub_skill_GetIconName, METH_VARARGS },
{ "GetIconImage", stub_skill_GetIconImage, METH_VARARGS },
{ "GetIconImageNew", stub_skill_GetIconImageNew, METH_VARARGS },
{ "GetIconInstance", stub_skill_GetIconInstance, METH_VARARGS },
{ "GetIconInstanceNew", stub_skill_GetIconInstanceNew, METH_VARARGS },
{ "DeleteIconInstance", stub_skill_DeleteIconInstance, METH_VARARGS },
{ "GetGradeData", stub_skill_GetGradeData, METH_VARARGS },
{ "GetNewAffectDataCount", stub_skill_GetNewAffectDataCount, METH_VARARGS },
{ "GetNewAffectData", stub_skill_GetNewAffectData, METH_VARARGS },
{ "GetDuration", stub_skill_GetDuration, METH_VARARGS },
{ "TEST", stub_skill_TEST, METH_VARARGS },
{ NULL, NULL }
};
// 40250 UserInterface/PythonSoundManagerModule.cpp: snd export names. // 40250 UserInterface/PythonSoundManagerModule.cpp: snd export names.
PyObject* stub_snd_PlaySound(PyObject*, PyObject*) { return stub_call_named("snd.PlaySound", Py_BuildNone()); } PyObject* stub_snd_PlaySound(PyObject*, PyObject*) { return stub_call_named("snd.PlaySound", Py_BuildNone()); }
PyObject* stub_snd_PlaySound3D(PyObject*, PyObject*) { return stub_call_named("snd.PlaySound3D", Py_BuildNone()); } PyObject* stub_snd_PlaySound3D(PyObject*, PyObject*) { return stub_call_named("snd.PlaySound3D", Py_BuildNone()); }
@@ -692,11 +607,6 @@ void init_2v0_gameplay_stubs() {
PyModule_AddIntConstant(module, "__port_stub__", 1); PyModule_AddIntConstant(module, "__port_stub__", 1);
AddStubConstants_shop(module); AddStubConstants_shop(module);
} }
{
PyObject* module = Py_InitModule("skill", methods_skill);
PyModule_AddIntConstant(module, "__port_stub__", 1);
AddStubConstants_skill(module);
}
{ {
PyObject* module = Py_InitModule("snd", methods_snd); PyObject* module = Py_InitModule("snd", methods_snd);
PyModule_AddIntConstant(module, "__port_stub__", 1); PyModule_AddIntConstant(module, "__port_stub__", 1);
@@ -27,6 +27,7 @@
#include "UserInterface/PythonMiniMap.h" #include "UserInterface/PythonMiniMap.h"
#include "UserInterface/PythonEventManager.h" #include "UserInterface/PythonEventManager.h"
#include "UserInterface/PythonBackground.h" #include "UserInterface/PythonBackground.h"
#include "UserInterface/PythonSkill.h"
#include "UserInterface/PythonQuest.h" #include "UserInterface/PythonQuest.h"
#include "UserInterface/PythonMessenger.h" #include "UserInterface/PythonMessenger.h"
#include "UserInterface/PythonSafeBox.h" #include "UserInterface/PythonSafeBox.h"
@@ -117,6 +118,7 @@ struct GameSingletons
CPythonMiniMap pyMiniMap; CPythonMiniMap pyMiniMap;
CPythonEventManager pyEventManager; CPythonEventManager pyEventManager;
CPythonBackground pyBackground; CPythonBackground pyBackground;
CPythonSkill pySkill;
CPythonQuest pyQuest; CPythonQuest pyQuest;
CPythonMessenger pyManager; CPythonMessenger pyManager;
CPythonSafeBox pySafeBox; CPythonSafeBox pySafeBox;
@@ -356,6 +358,7 @@ bool run_main_script_body(const char* lpCmdLine, std::string* error)
initMiniMap(); initMiniMap();
initeffect(); initeffect();
initfly(); initfly();
initskill();
initServerStateChecker(); initServerStateChecker();
init_2v0_gameplay_stubs(); init_2v0_gameplay_stubs();
@@ -320,11 +320,9 @@ void CPythonApplication::SetForceSightRange(int) { MT_PLATFORM_STUB(); }
void CMovieMan::PlayLogo(const char*) { MT_PLATFORM_STUB(); } void CMovieMan::PlayLogo(const char*) { MT_PLATFORM_STUB(); }
BOOL PERF_CHECKER_RENDER_GAME = FALSE; BOOL PERF_CHECKER_RENDER_GAME = FALSE;
BOOL SKILL_EFFECT_UPGRADE_ENABLE = FALSE;
double g_specularSpd = 0; double g_specularSpd = 0;
// 40250 UserInterface/PythonApplication.cpp, verbatim. PORT: CPythonSkill is still a stand-in, so // 40250 UserInterface/PythonApplication.cpp, verbatim.
// RegisterSkillDesc fails and the function returns false after the item and mob tables load.
// SUPPORT_NEW_KOREA_SERVER // SUPPORT_NEW_KOREA_SERVER
bool LoadLocaleData(const char* localePath) bool LoadLocaleData(const char* localePath)
{ {
@@ -1,210 +0,0 @@
// Stand-in for the 40250 logic unit UserInterface/PythonSkill.cpp, not ported yet: the members the ported units
// reference, as platform_stub.py stubs. Delete this file in the commit that ports the unit into port/
// (docs/PORT-PLAN.md).
#include "UserInterface/StdAfx.h"
#include "UserInterface/PythonSkill.h"
#include "../../PlatformStub.h"
auto CPythonSkill::SSkillData::IsNeedCorpse() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsToggleSkill() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsChargeSkill() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::GetSkillData(DWORD, TSkillData **) -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::GetTargetRange() const -> DWORD
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<DWORD>();
}
auto CPythonSkill::SSkillData::CanChangeDirection() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsFanRange() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsCircleRange() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsAutoSearchTarget() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsNeedTarget() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsUseHPSkill() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsStandingSkill() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::CanUseWeaponType(DWORD) -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsOnlyForAlliance() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::CanUseForMe() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::CanUseIfNotEnough() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsNeedEmptyBottle() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsNeedPoisonBottle() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsNeedBow() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsAttackSkill() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsHorseSkill() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsMovingSkill() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::IsOnlyForGuildWar() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::GetSkillCoolTime(float) -> DWORD
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<DWORD>();
}
auto CPythonSkill::SSkillData::GetNeedSP(float) -> int
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<int>();
}
auto CPythonSkill::SSkillData::GetMotionLoopCount(float) -> DWORD
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<DWORD>();
}
auto CPythonSkill::SSkillData::GetTargetCount(float) -> DWORD
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<DWORD>();
}
auto CPythonSkill::SSkillData::GetSkillMotionIndex(int) -> DWORD
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<DWORD>();
}
auto CPythonSkill::SSkillData::IsCanUseSkill() -> bool
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<bool>();
}
auto CPythonSkill::SSkillData::IsNoMotion() -> BOOL
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BOOL>();
}
auto CPythonSkill::SSkillData::GetType() const -> BYTE
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<BYTE>();
}
auto CPythonSkill::Destroy() -> void
{
MT_PLATFORM_STUB();
}
auto CPythonSkill::RegisterSkillTable(const char *) -> bool
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<bool>();
}
auto CPythonSkill::RegisterSkillDesc(const char *) -> bool
{
MT_PLATFORM_STUB();
return mt_platform_stub_return<bool>();
}
+27
View File
@@ -0,0 +1,27 @@
#include "StdAfx.h"
#include "Base.h"
CBase::CBase()
{
id = 0;
}
CBase::~CBase()
{
}
bool CBase::isNumber()
{
return (id & MID_NUMBER) != 0 ? true : false;
}
bool CBase::isVar()
{
return (id & MID_VARIABLE) != 0 ? true : false;
}
bool CBase::isSymbol()
{
return (id & MID_SYMBOL) != 0 ? true : false;
}
+25
View File
@@ -0,0 +1,25 @@
#ifndef __POLY_BASE_H__
#define __POLY_BASE_H__
#define MID_UNKNOWN 0
#define MID_NUMBER 256
#define MID_VARIABLE 512
#define MID_SYMBOL 1024
#define MID_LONG MID_NUMBER + 1
#define MID_SQRT MID_NUMBER + 2
#define MID_FRACTION MID_NUMBER + 3
class CBase
{
public:
bool isSymbol();
bool isVar();
bool isNumber();
int id;
CBase();
virtual ~CBase();
};
#endif
+622
View File
@@ -0,0 +1,622 @@
#include "StdAfx.h"
#include <string>
#include <assert.h>
#include "Poly.h"
#include <cmath>
#include <cctype>
#include <cstdlib>
using namespace std;
double _random()
{
return rand() / (RAND_MAX + 1.0);
}
void CPoly::SetRandom(int iRandomType)
{
m_iRandomType = iRandomType;
}
int CPoly::my_irandom(double start, double end)
{
switch (m_iRandomType)
{
case RANDOM_TYPE_FORCE_MIN:
return int(start);
break;
case RANDOM_TYPE_FORCE_MAX:
return int(end);
break;
}
// Make range as inclusive-exclusive
int is = int(start + 0.5);
int ie = int(end - start + 0.5) + 1;
return int(_random() * ie + is);
}
double CPoly::my_frandom(double start, double end)
{
return _random() * (end - start) + start;
}
CPoly::CPoly()
{
m_iRandomType = RANDOM_TYPE_FREELY;
uiLookPos = 0;
ErrorOccur = true;
lSymbol.clear();
STSize = 0;
MathSymbolCount = 0;
lSymbol.reserve(50);
init();
}
CPoly::~CPoly()
{
Clear();
}
void CPoly::SetStr(const string & str)
{
strData = str;
}
float CPoly::Eval()
{
int stNow;
double save[POLY_MAXSTACK],t;
int iSp=0;
if (ErrorOccur)
{
/*THROW(new CEvalException("Evaluate Error"));*/
return 0;
}
//TEST
//list<int>::iterator pos = tokenBase.begin();
//list<double>::iterator posn = numBase.begin();
vector<int>::iterator pos = tokenBase.begin();
vector<double>::iterator posn = numBase.begin();
while (pos != tokenBase.end())
{
stNow=*pos;
++pos;
switch (stNow)
{
case POLY_NUM:
save[iSp++]=*posn++; break;
case POLY_ID:
save[iSp++]=
lSymbol[ *pos ]->dVal;
pos++;
break;
//case '+':
case POLY_PLU:
iSp--;
save[iSp-1]+=save[iSp]; break;
//case '-':
case POLY_MIN:
iSp--;
save[iSp-1]-=save[iSp]; break;
//case '*':
case POLY_MUL:
iSp--;
save[iSp-1]*=save[iSp]; break;
//case '%':
case POLY_MOD:
iSp--;
if (save[iSp]==0)
{
//THROW(new CEvalException("Divide by 0"));
return 0;
}
save[iSp-1]=fmod(save[iSp-1],save[iSp]); break;
//case '/':
case POLY_DIV:
iSp--;
if (save[iSp]==0)
{
//THROW(new CEvalException("Divide by 0"));
return 0;
}
save[iSp-1]/=save[iSp]; break;
//case '^':
case POLY_POW:
iSp--;
save[iSp-1]=pow(save[iSp-1],save[iSp]); break;
case POLY_ROOT:
if (save[iSp-1]<0)
{
//THROW(new CEvalException("Negative in root"));
return 0;
}
save[iSp-1]=sqrt(save[iSp-1]); break;
case POLY_COS:
save[iSp-1]=cos(save[iSp-1]); break;
case POLY_SIN:
save[iSp-1]=sin(save[iSp-1]); break;
case POLY_TAN:
if (!(t=cos(save[iSp-1])))
{
//THROW (new CEvalException("Divide by 0"));
return 0;
}
save[iSp-1]=tan(save[iSp-1]); break;
case POLY_CSC:
if (!(t=sin(save[iSp-1])))
{
//THROW(new CEvalException("Divide by 0"));
return 0;
}
save[iSp-1]=1/t; break;
case POLY_SEC:
if (!(t=cos(save[iSp-1])))
{
//THROW(new CEvalException("Divide by 0"));
return 0;
}
save[iSp-1]=1/t; break;
case POLY_COT:
if (!(t=sin(save[iSp-1])))
{
//THROW(new CEvalException("Divide by 0"));
return 0;
}
save[iSp-1]=cos(save[iSp-1])/t; break;
case POLY_LN:
if (save[iSp-1]<=0)
{
//THROW( new CEvalException("Call Log with minus number"));
return 0;
}
save[iSp-1]=log(save[iSp-1]); break;
case POLY_LOG10:
if (save[iSp-1]<=0)
{
//THROW( new CEvalException("Call Log with minus number"));
return 0;
}
save[iSp-1]=log10(save[iSp-1]); break;
case POLY_LOG:
if (save[iSp-1]<=0)
{
//THROW( new CEvalException("Call Log with minus number"));
return 0;
}
if (save[iSp-2]<=0 || save[iSp-2]==1)
{
//THROW( new CEvalException("Call Log with minus number"));
return 0;
}
save[iSp-2]=log(save[iSp-1])/log(save[iSp-2]);
iSp--;
break;
case POLY_ABS:
save[iSp-1]=fabs(save[iSp-1]);
break;
case POLY_FLOOR:
save[iSp-1]=floor(save[iSp-1]);
break;
case POLY_IRAND:
save[iSp-2]=my_irandom(save[iSp-2],save[iSp-1]);
iSp--;
break;
case POLY_FRAND:
save[iSp-2]=my_frandom(save[iSp-2],save[iSp-1]);
iSp--;
break;
case POLY_MINF:
save[iSp-2]=(save[iSp-2]<save[iSp-1])?save[iSp-2]:save[iSp-1];
iSp--;
break;
case POLY_MAXF:
save[iSp-2]=(save[iSp-2]>save[iSp-1])?save[iSp-2]:save[iSp-1];
iSp--;
break;
/*case POLY_MOD:
save[iSp-2]=fmod(save[iSp-2],save[iSp-1]);
iSp--;
break;*/
default:
return 0;
//THROW(new CEvalException("Token Error"));
}
}
return float(save[iSp-1]);
}
int CPoly::Analyze(const char * pszStr)
{
if (pszStr)
SetStr(pszStr);
if (0 == strData.length())
return true;
//DisposeList();
ErrorOccur = false;
uiLookPos = 0;
iLookAhead = lexan();
expr();
if (tokenBase.empty())
{
//THROW(new CParseException("No Data"));
return false;
}
return !ErrorOccur;
}
void CPoly::Clear()
{
int i;
//while (!tokenBase.IsEmpty()) listBase.RemoveTail();
//while (!numBase.IsEmpty()) numBase.RemoveTail();
tokenBase.clear();
numBase.clear();
for (i = 0;i < STSize; ++i)
{
if (lSymbol[i]) delete lSymbol[i];
lSymbol[i]=NULL;
}
//lSymbol.FreeExtra();
lSymbol.clear();
SymbolIndex.clear();
STSize=0;
MathSymbolCount=0;
}
void CPoly::expr()
{
int t;
switch (iLookAhead)
{
case '+':
case '-':
uiLookPos--;
iLookAhead = POLY_NUM;
iNumToken = iToken = 0;
}
term();
while (!ErrorOccur)
{
switch (iLookAhead)
{
case '+':
case '-':
t=iLookAhead;
match(t);
term();
emit(t,POLY_NONE);
continue;
case POLY_EOS: case ')': case ',': return;
default:
error();
//THROW( new CParseException("Error Parsing"));
return;
}
}
}
void CPoly::error()
{
iErrorPos=uiLookPos;
ErrorOccur=true;
}
int CPoly::lexan()
{
int t;
double tt;
while (uiLookPos < strData.size())
{
if (strData[uiLookPos] == ' ' || strData[uiLookPos] == '\t')
;
else if (isdigit(strData[uiLookPos]))
{
t = 0;
for (;uiLookPos<strData.size();uiLookPos++)
{
if (isdigit(strData[uiLookPos]))
t = t * 10 + strData[uiLookPos] - '0';
else
break;
}
iToken=t;
tt=0.1;
iNumToken=0;
if (uiLookPos<strData.size() && strData[uiLookPos]=='.')
{
uiLookPos++;
for (;uiLookPos<strData.size();uiLookPos++,tt*=0.1)
{
if (isdigit(strData[uiLookPos]))
iNumToken+=tt*(strData[uiLookPos]-'0');
else
break;
}
}
iNumToken+=iToken;
return POLY_NUM;
}
else if (isalpha(strData[uiLookPos]))
{
string localSymbol("");
while (uiLookPos<strData.size() && isalpha(strData[uiLookPos]))
{
localSymbol+=strData[uiLookPos];
uiLookPos++;
}
iToken= find(localSymbol);
if (iToken==-1)
{
iToken=insert(localSymbol,POLY_ID);
}
return lSymbol[(/*FindIndex*/(iToken))]->token;
}
else
{
iToken=0;
return strData[uiLookPos++];
}
uiLookPos++;
}
return POLY_EOS;
}
void CPoly::term()
{
int t;
factor();
while (!ErrorOccur)
{
switch (iLookAhead)
{
case '*':
case '/':
case '%':
t=iLookAhead;
match(t);
factor();
emit(t,POLY_NONE);
continue;
default:
return;
}
}
}
void CPoly::factor()
{
int t;
expo();
while (!ErrorOccur)
{
switch (iLookAhead)
{
case '^':
t=iLookAhead;
match(t);
expo();
emit(t,POLY_NONE);
continue;
default:
return;
}
}
}
void CPoly::expo()
{
int t;
switch (iLookAhead)
{
case '(':
match('('); expr(); match(')'); break;
case POLY_NUM:
emit(POLY_NUM, iToken); match(POLY_NUM); break;
case POLY_ID:
emit(POLY_ID,(int)/*FindIndex*/(iToken)); match(POLY_ID); break;
case POLY_ROOT:
case POLY_SIN:
case POLY_COT:
case POLY_TAN:
case POLY_CSC:
case POLY_SEC:
case POLY_LN:
case POLY_LOG10:
case POLY_COS:
case POLY_ABS:
case POLY_FLOOR:
t=iLookAhead;
match(iLookAhead); match('('); expr(); match(')'); emit(t,iToken);
break;
case POLY_LOG:
case POLY_MINF:
case POLY_MAXF:
case POLY_IRAND:
case POLY_FRAND:
case POLY_MOD:
t=iLookAhead;
match(iLookAhead); match('('); expr(); match(','); expr(); match(')'); emit(t,iToken);
break;
case POLY_EOS:
break;
default:
error();
//THROW( new CParseException("Error Parsing"));
}
}
void CPoly::match(int t)
{
if (iLookAhead==t) iLookAhead=lexan(); else error();
}
void CPoly::emit(int t, int tval)
{
switch (t)
{
case '+':
tokenBase.push_back(POLY_PLU);
break;
case '-':
tokenBase.push_back(POLY_MIN);
break;
case '*':
tokenBase.push_back(POLY_MUL);
break;
case '/':
tokenBase.push_back(POLY_DIV);
break;
case '%':
tokenBase.push_back(POLY_MOD);
break;
case '^':
tokenBase.push_back(POLY_POW);
break;
case POLY_ROOT:
case POLY_SIN:
case POLY_TAN:
case POLY_COT:
case POLY_COS:
case POLY_CSC:
case POLY_SEC:
case POLY_LOG:
case POLY_LN:
case POLY_LOG10:
case POLY_ABS:
case POLY_MINF:
case POLY_MAXF:
case POLY_IRAND:
case POLY_FRAND:
case POLY_MOD:
case POLY_FLOOR:
tokenBase.push_back(t);
break;
case POLY_NUM:
tokenBase.push_back(t);
numBase.push_back(iNumToken);
break;
case POLY_ID:
tokenBase.push_back(t);
tokenBase.push_back(tval); break;
default:
error();
Clear();
//THROW( new CParseException("Error Parsing"));
return;
}
}
int CPoly::find(const string & s)
{
int l, m, r;
l = 0;
r = STSize - 1;
while (l <= r)
{
m = (l + r) >> 1;
if (lSymbol[SymbolIndex[m]]->strlex == s)
return SymbolIndex[m];
else if (lSymbol[SymbolIndex[m]]->strlex < s)
l = m + 1;
else
r = m - 1;
}
return -1;
}
int CPoly::insert(const string & s, int tok)
{
int i;
bool bAdded=false;
lSymbol.push_back(new CSymTable(tok,s));
for (i=0;i<STSize;i++)
{
if (s<lSymbol[SymbolIndex[i]]->strlex)
{
SymbolIndex.insert(SymbolIndex.begin()+i,STSize);
bAdded=true;
break;
}
}
if (!bAdded)
{
//SymbolIndex.SetAtGrow(STSize,STSize);
SymbolIndex.push_back(STSize);
}
STSize++;
return STSize-1;
}
int CPoly::SetVar(const string & strName, double dVar)
{
if (ErrorOccur) return false;
int index=find(strName);
if (index==-1) return false;
CSymTable* stVar = lSymbol[(/*FindIndex*/(index))];
stVar->dVal=dVar;
return true;
}
int CPoly::GetVarCount()
{
return lSymbol.size() - MathSymbolCount;
}
const char * CPoly::GetVarName(unsigned int dwIndex)
{
assert(dwIndex + MathSymbolCount < lSymbol.size());
return lSymbol[dwIndex + MathSymbolCount]->strlex.c_str();
}
void CPoly::init()
{
insert("min",POLY_MINF);
insert("max",POLY_MAXF);
insert("number", POLY_IRAND);
insert("irandom", POLY_IRAND);
insert("irand", POLY_IRAND);
insert("frandom",POLY_FRAND);
insert("frand",POLY_FRAND);
insert("rt",POLY_ROOT);
insert("sqrt",POLY_ROOT);
insert("cos",POLY_COS);
insert("sin",POLY_SIN);
insert("tan",POLY_TAN);
insert("cot",POLY_COT);
insert("csc",POLY_CSC);
insert("cosec",POLY_COSEC);
insert("sec",POLY_SEC);
insert("pi",POLY_PI);
SetVar("pi",3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117068);
insert("e",POLY_EXP);
SetVar("e",2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427);
insert("log",POLY_LOG);
insert("ln",POLY_LN);
insert("log10",POLY_LOG10);
insert("abs",POLY_ABS);
insert("mod",POLY_MOD);
insert("floor",POLY_FLOOR);
MathSymbolCount = STSize;
}
@@ -0,0 +1,2 @@
#pragma once
#include "../StdAfx.h"
@@ -0,0 +1,11 @@
#include "StdAfx.h"
#include "SymTable.h"
CSymTable::CSymTable(int aTok, std::string aStr) : dVal(0), token(aTok), strlex(aStr)
{
}
CSymTable::~CSymTable()
{
}
@@ -0,0 +1,50 @@
#include "StdAfx.h"
#include "Symbol.h"
CSymbol::CSymbol()
{
id = MID_SYMBOL;
iType = ST_UNKNOWN;
}
CSymbol::~CSymbol()
{
}
bool CSymbol::Equal(CSymbol dif)
{
if (dif.iType/10 == iType/10) return true;
return false;
}
bool CSymbol::Less(CSymbol dif)
{
if (dif.iType/10 > iType/10) return true;
return false;
}
int CSymbol::GetType()
{
return iType;
}
void CSymbol::SetType(int Type)
{
iType=Type;
}
int CSymbol::issymbol(int ch)
{
switch(ch)
{
case SY_PLUS : return ST_PLUS;
case SY_MINUS : return ST_MINUS;
case SY_MULTIPLY: return ST_MULTIPLY;
case SY_DIVIDE : return SY_DIVIDE;
case SY_CARET : return SY_CARET;
case SY_OPEN : return SY_OPEN;
case SY_CLOSE : return ST_CLOSE;
}
return 0;
}
+39
View File
@@ -0,0 +1,39 @@
#ifndef __POLY_SYMBOL_H__
#define __POLY_SYMBOL_H__
#include "Base.h"
#define ST_UNKNOWN 0
#define ST_PLUS 11
#define ST_MINUS 12
#define ST_MULTIPLY 23
#define ST_DIVIDE 24
#define ST_CARET 35
#define ST_OPEN 06
#define ST_CLOSE 07
#define SY_PLUS '+'
#define SY_MINUS '-'
#define SY_MULTIPLY '*'
#define SY_DIVIDE '/'
#define SY_CARET '^'
#define SY_OPEN '('
#define SY_CLOSE ')'
class CSymbol : public CBase
{
private:
int iType;
public:
CSymbol();
virtual ~CSymbol();
static int issymbol(int ch);
void SetType(int Type);
int GetType();
bool Equal(CSymbol dif);
bool Less(CSymbol dif);
};
#endif
@@ -283,13 +283,13 @@ PyObject * itemGetIconInstance(PyObject * poSelf, PyObject * poArgs)
CGraphicImageInstance * pImageInstance = CGraphicImageInstance::New(); CGraphicImageInstance * pImageInstance = CGraphicImageInstance::New();
pImageInstance->SetImagePointer(pImage); pImageInstance->SetImagePointer(pImage);
return Py_BuildValue("i", pImageInstance); return Py_BuildPointer(pImageInstance); // PORT: was Py_BuildValue("i", ...) (ILP32 handle)
} }
PyObject * itemDeleteIconInstance(PyObject * poSelf, PyObject * poArgs) PyObject * itemDeleteIconInstance(PyObject * poSelf, PyObject * poArgs)
{ {
int iHandle; CGraphicImageInstance * iHandle; // PORT: was int (ILP32 handle)
if (!PyTuple_GetInteger(poArgs, 0, &iHandle)) if (!PyTuple_GetPointer(poArgs, 0, &iHandle))
return Py_BadArgument(); return Py_BadArgument();
CGraphicImageInstance::Delete((CGraphicImageInstance *) iHandle); CGraphicImageInstance::Delete((CGraphicImageInstance *) iHandle);
File diff suppressed because it is too large Load Diff
@@ -57,6 +57,7 @@ void initChat();
void initnet(); void initnet();
void initeffect(); void initeffect();
void initfly(); void initfly();
void initskill();
void initServerStateChecker(); void initServerStateChecker();
extern const std::string& ApplicationStringTable_GetString(DWORD dwID); extern const std::string& ApplicationStringTable_GetString(DWORD dwID);
+20 -1
View File
@@ -222,7 +222,10 @@ int main(int argc, char** argv)
CHECK(PackInitialize("pack")); CHECK(PackInitialize("pack"));
std::string error; std::string error;
CHECK(PythonBoot::Start(stdlib.c_str(), &error)); const bool started = PythonBoot::Start(stdlib.c_str(), &error);
if (!started)
std::fprintf(stderr, "PythonBoot::Start: %s\n", error.c_str());
CHECK(started);
PythonBoot::SetUISize(800, 600); PythonBoot::SetUISize(800, 600);
const bool ran = PythonBoot::RunMainScript("", &error); const bool ran = PythonBoot::RunMainScript("", &error);
if (!ran) if (!ran)
@@ -316,6 +319,12 @@ int main(int argc, char** argv)
"_mob = nonplayer.GetMonsterName(101)\n" "_mob = nonplayer.GetMonsterName(101)\n"
"assert _mob, 'mob 101 has no name'\n" "assert _mob, 'mob 101 has no name'\n"
"import sys\nsys.stderr.write('port_login_flow_test: mob 101 %s\\n' % _mob)")); "import sys\nsys.stderr.write('port_login_flow_test: mob 101 %s\\n' % _mob)"));
// CPythonSkill read skilldesc.txt and skilltable.txt (RegisterSkillDesc/RegisterSkillTable); skill 1's
// cool time is skilltable's constant "12".
CHECK(py("import skill\n"
"assert skill.GetSkillName(1, 0) == 'Three-Way Cut', skill.GetSkillName(1, 0)\n"
"assert skill.GetSkillType(1) == skill.SKILL_TYPE_ACTIVE, skill.GetSkillType(1)\n"
"assert skill.GetSkillCoolTime(1, 1.0) == 12, skill.GetSkillCoolTime(1, 1.0)"));
} }
// 4-5. Start the game on the slot: DirectEnter, the second game login and the loading phase. // 4-5. Start the game on the slot: DirectEnter, the second game login and the loading phase.
@@ -501,6 +510,16 @@ int main(int argc, char** argv)
"assert item.GetItemType() == item.ITEM_TYPE_WEAPON and item.GetItemSubType() == item.WEAPON_SWORD\n" "assert item.GetItemType() == item.ITEM_TYPE_WEAPON and item.GetItemSubType() == item.WEAPON_SWORD\n"
"assert item.GetValue(3) > 0, 'min attack'")); "assert item.GetValue(3) > 0, 'min attack'"));
// skill icons: RegisterSkillDesc loaded each skill's .sub icons; an active skill has one per grade
// (__RegisterGradeIconImage) and no plain icon, as in 40250. The icon instance handle survives the 64-bit
// round trip (Py_BuildPointer).
CHECK(py("import skill\n"
"assert skill.GetIconImage(1) == 0\n"
"assert skill.GetIconImageNew(1, 0) != 0, 'skill 1 has no grade icon'\n"
"_icon = skill.GetIconInstanceNew(1, 0)\n"
"assert _icon != 0\n"
"skill.DeleteIconInstance(_icon)"));
// miniMap module (PythonMiniMapModule.cpp): uiminimap.MiniMap created and showed it. CMapOutdoor is not // miniMap module (PythonMiniMapModule.cpp): uiminimap.MiniMap created and showed it. CMapOutdoor is not
// ported, so CMapManager::IsMapOutdoor() is false and the atlas reports "not loaded" as 40250 does off an // ported, so CMapManager::IsMapOutdoor() is false and the atlas reports "not loaded" as 40250 does off an
// outdoor map. // outdoor map.