diff --git a/src/port/UserInterface/GameType.h b/src/port/UserInterface/GameType.h index 5c84c413..29c49589 100644 --- a/src/port/UserInterface/GameType.h +++ b/src/port/UserInterface/GameType.h @@ -151,6 +151,12 @@ const DWORD c_DragonSoul_Inventory_Box_Size = 32; const DWORD c_DragonSoul_Inventory_Count = CItemData::DS_SLOT_NUM_TYPES * DRAGON_SOUL_GRADE_MAX * c_DragonSoul_Inventory_Box_Size; const DWORD c_DragonSoul_Inventory_End = c_DragonSoul_Inventory_Start + c_DragonSoul_Inventory_Count; +#ifdef ENABLE_SPECIAL_STORAGE +const DWORD c_Special_Inventory_Page_Size = 5 * 9; +const DWORD c_Special_Inventory_Page_Count = 4; +const DWORD c_Special_ItemSlot_Count = c_Special_Inventory_Page_Size * c_Special_Inventory_Page_Count; +#endif + enum ESlotType { SLOT_TYPE_NONE, @@ -165,6 +171,13 @@ enum ESlotType SLOT_TYPE_PRIVATE_SHOP, SLOT_TYPE_MALL, SLOT_TYPE_DRAGON_SOUL_INVENTORY, +#ifdef ENABLE_SPECIAL_STORAGE + SLOT_TYPE_UPGRADE_INVENTORY, + SLOT_TYPE_BOOK_INVENTORY, + SLOT_TYPE_STONE_INVENTORY, + SLOT_TYPE_CHANGE_INVENTORY, + SLOT_TYPE_COSTUME_INVENTORY, +#endif SLOT_TYPE_SWITCHBOT, // PORT: AVA2 switchbot SLOT_TYPE_MAX, }; @@ -177,13 +190,26 @@ enum EWindows SAFEBOX, MALL, DRAGON_SOUL_INVENTORY, - GROUND, // NOTE: 2013년 2월5일 현재까지 unused.. 왜 있는거지??? - SWITCHBOT, // PORT: AVA2 switchbot; 7 on the wire = metin2-server EWindows SWITCHBOT BELT_INVENTORY, // NOTE: W2.1 버전에 새로 추가되는 벨트 슬롯 아이템이 제공하는 벨트 인벤토리 - + SWITCHBOT, // PORT: AVA2 switchbot; 7 on the wire = metin2-server EWindows SWITCHBOT +#ifdef ENABLE_SPECIAL_STORAGE + UPGRADE_INVENTORY, // 8 + BOOK_INVENTORY, // 9 + STONE_INVENTORY, // 10 + CHANGE_INVENTORY, // 11 + COSTUME_INVENTORY, // 12 +#endif + GROUND, // NOTE: 2013년 2월5일 현재까지 unused.. 왜 있는거지??? WINDOW_TYPE_MAX, }; static_assert(SWITCHBOT == 7, "SWITCHBOT window must match the server"); +#ifdef ENABLE_SPECIAL_STORAGE +static_assert(UPGRADE_INVENTORY == 8, "UPGRADE_INVENTORY window must match the server"); +static_assert(BOOK_INVENTORY == 9, "BOOK_INVENTORY window must match the server"); +static_assert(STONE_INVENTORY == 10, "STONE_INVENTORY window must match the server"); +static_assert(CHANGE_INVENTORY == 11, "CHANGE_INVENTORY window must match the server"); +static_assert(COSTUME_INVENTORY == 12, "COSTUME_INVENTORY window must match the server"); +#endif enum EDSInventoryMaxNum { @@ -260,6 +286,15 @@ typedef struct SItemPos case SWITCHBOT: return cell < SWITCHBOT_SLOT_COUNT; break; +#ifdef ENABLE_SPECIAL_STORAGE + case UPGRADE_INVENTORY: + case BOOK_INVENTORY: + case STONE_INVENTORY: + case CHANGE_INVENTORY: + case COSTUME_INVENTORY: + return cell < c_Special_ItemSlot_Count; + break; +#endif default: return false; } @@ -275,6 +310,13 @@ typedef struct SItemPos case BELT_INVENTORY: case DRAGON_SOUL_INVENTORY: +#ifdef ENABLE_SPECIAL_STORAGE + case UPGRADE_INVENTORY: + case BOOK_INVENTORY: + case STONE_INVENTORY: + case CHANGE_INVENTORY: + case COSTUME_INVENTORY: +#endif return false; break; diff --git a/src/port/UserInterface/Locale_inc.h b/src/port/UserInterface/Locale_inc.h index 004378ec..81b11d45 100644 --- a/src/port/UserInterface/Locale_inc.h +++ b/src/port/UserInterface/Locale_inc.h @@ -6,4 +6,5 @@ #define ENABLE_NEW_PET_SYSTEM #define ENABLE_ATTR_6TH_7TH #define __BL_67_ATTR__ +#define ENABLE_SPECIAL_STORAGE //#define ENABLE_DISCORD_RPC diff --git a/src/port/UserInterface/PythonApplicationModule.cpp b/src/port/UserInterface/PythonApplicationModule.cpp index e1bc4acf..d6ad7a50 100644 --- a/src/port/UserInterface/PythonApplicationModule.cpp +++ b/src/port/UserInterface/PythonApplicationModule.cpp @@ -1577,6 +1577,12 @@ void initapp() PyModule_AddIntConstant(poModule, "BL_67_ATTR", 0); #endif +#ifdef ENABLE_SPECIAL_STORAGE + PyModule_AddIntConstant(poModule, "ENABLE_SPECIAL_STORAGE", 1); +#else + PyModule_AddIntConstant(poModule, "ENABLE_SPECIAL_STORAGE", 0); +#endif + #ifdef USE_OPENID PyModule_AddIntConstant(poModule, "USE_OPENID", 1); if (openid_test) diff --git a/src/port/UserInterface/PythonPlayer.cpp b/src/port/UserInterface/PythonPlayer.cpp index 0e03c5b4..f007e5d4 100644 --- a/src/port/UserInterface/PythonPlayer.cpp +++ b/src/port/UserInterface/PythonPlayer.cpp @@ -615,6 +615,18 @@ const TItemData * CPythonPlayer::GetItemData(TItemPos Cell) const return &m_playerStatus.aDSItem[Cell.cell]; case SWITCHBOT: // PORT: AVA2 switchbot return &m_playerStatus.aSwitchbotItem[Cell.cell]; +#ifdef ENABLE_SPECIAL_STORAGE + case UPGRADE_INVENTORY: + return &m_playerStatus.aSSUItem[Cell.cell]; + case BOOK_INVENTORY: + return &m_playerStatus.aSSBItem[Cell.cell]; + case STONE_INVENTORY: + return &m_playerStatus.aSSSItem[Cell.cell]; + case CHANGE_INVENTORY: + return &m_playerStatus.aSSCItem[Cell.cell]; + case COSTUME_INVENTORY: + return &m_playerStatus.aCostumeItem[Cell.cell]; +#endif default: return NULL; } @@ -647,6 +659,23 @@ void CPythonPlayer::SetItemData(TItemPos Cell, const TItemData & c_rkItemInst) case SWITCHBOT: // PORT: AVA2 switchbot m_playerStatus.aSwitchbotItem[Cell.cell] = c_rkItemInst; break; +#ifdef ENABLE_SPECIAL_STORAGE + case UPGRADE_INVENTORY: + m_playerStatus.aSSUItem[Cell.cell] = c_rkItemInst; + break; + case BOOK_INVENTORY: + m_playerStatus.aSSBItem[Cell.cell] = c_rkItemInst; + break; + case STONE_INVENTORY: + m_playerStatus.aSSSItem[Cell.cell] = c_rkItemInst; + break; + case CHANGE_INVENTORY: + m_playerStatus.aSSCItem[Cell.cell] = c_rkItemInst; + break; + case COSTUME_INVENTORY: + m_playerStatus.aCostumeItem[Cell.cell] = c_rkItemInst; + break; +#endif } } @@ -694,6 +723,24 @@ DWORD CPythonPlayer::GetItemCountByVnum(DWORD dwVnum) return dwCount; } +#ifdef ENABLE_SPECIAL_STORAGE +DWORD CPythonPlayer::GetItemCountByTT(DWORD dwVnum) +{ + DWORD dwCount = 0; + + for (int i = 0; i < c_Special_ItemSlot_Count; ++i) + { + const TItemData & c_rItemData = m_playerStatus.aSSUItem[i]; + if (c_rItemData.vnum == dwVnum) + { + dwCount += c_rItemData.count; + } + } + + return dwCount; +} +#endif + DWORD CPythonPlayer::GetItemID(TItemPos Cell) { const auto item=Cell.IsValidCell() ? GetItemData(Cell) : nullptr; diff --git a/src/port/UserInterface/PythonPlayer.h b/src/port/UserInterface/PythonPlayer.h index e15c4c34..7a85cea3 100644 --- a/src/port/UserInterface/PythonPlayer.h +++ b/src/port/UserInterface/PythonPlayer.h @@ -120,6 +120,13 @@ class CPythonPlayer : public CSingleton, public IAbstractPlayer TItemData aItem[c_Inventory_Count]; TItemData aDSItem[c_DragonSoul_Inventory_Count]; TItemData aSwitchbotItem[SWITCHBOT_SLOT_COUNT]; // PORT: AVA2 switchbot window +#ifdef ENABLE_SPECIAL_STORAGE + TItemData aSSUItem[c_Special_ItemSlot_Count]; + TItemData aSSBItem[c_Special_ItemSlot_Count]; + TItemData aSSSItem[c_Special_ItemSlot_Count]; + TItemData aSSCItem[c_Special_ItemSlot_Count]; + TItemData aCostumeItem[c_Special_ItemSlot_Count]; +#endif TQuickSlot aQuickSlot[QUICKSLOT_MAX_NUM]; TSkillInstance aSkill[SKILL_MAX_NUM]; long m_alPoint[POINT_MAX_NUM]; @@ -294,6 +301,9 @@ class CPythonPlayer : public CSingleton, public IAbstractPlayer DWORD GetItemFlags(TItemPos Cell); DWORD GetItemCount(TItemPos Cell); DWORD GetItemCountByVnum(DWORD dwVnum); +#ifdef ENABLE_SPECIAL_STORAGE + DWORD GetItemCountByTT(DWORD dwVnum); +#endif DWORD GetItemMetinSocket(TItemPos Cell, DWORD dwMetinSocketIndex); DWORD GetItemID(TItemPos Cell); const char* GetItemNewName(TItemPos Cell); diff --git a/src/port/UserInterface/PythonPlayerModule.cpp b/src/port/UserInterface/PythonPlayerModule.cpp index 98e05b08..35ee1bab 100644 --- a/src/port/UserInterface/PythonPlayerModule.cpp +++ b/src/port/UserInterface/PythonPlayerModule.cpp @@ -948,6 +948,18 @@ PyObject * playerGetItemCountByVnum(PyObject* poSelf, PyObject* poArgs) return Py_BuildValue("i", ItemNum); } +#ifdef ENABLE_SPECIAL_STORAGE +PyObject * playerGetItemCountByTT(PyObject* poSelf, PyObject* poArgs) +{ + int ivnum; + if (!PyTuple_GetInteger(poArgs, 0, &ivnum)) + return Py_BuildException(); + + int ItemNum = CPythonPlayer::Instance().GetItemCountByTT(ivnum); + return Py_BuildValue("i", ItemNum); +} +#endif + // PORT: AVA2 pet dialogs identify the saved item and display its custom name. static bool PortItemPosition(PyObject* args,TItemPos& cell) { @@ -2397,6 +2409,9 @@ void initPlayer() { "GetItemFlags", playerGetItemFlags, METH_VARARGS }, { "GetItemCount", playerGetItemCount, METH_VARARGS }, { "GetItemCountByVnum", playerGetItemCountByVnum, METH_VARARGS }, +#ifdef ENABLE_SPECIAL_STORAGE + { "GetItemCountByTT", playerGetItemCountByTT, METH_VARARGS }, +#endif { "GetItemMetinSocket", playerGetItemMetinSocket, METH_VARARGS }, { "GetItemID", playerGetItemID, METH_VARARGS }, { "GetItemNewName", playerGetItemNewName, METH_VARARGS }, @@ -2627,6 +2642,13 @@ void initPlayer() PyModule_AddIntConstant(poModule, "SLOT_TYPE_MALL", SLOT_TYPE_MALL); PyModule_AddIntConstant(poModule, "SLOT_TYPE_EMOTION", SLOT_TYPE_EMOTION); PyModule_AddIntConstant(poModule, "SLOT_TYPE_DRAGON_SOUL_INVENTORY", SLOT_TYPE_DRAGON_SOUL_INVENTORY); +#ifdef ENABLE_SPECIAL_STORAGE + PyModule_AddIntConstant(poModule, "SLOT_TYPE_UPGRADE_INVENTORY", SLOT_TYPE_UPGRADE_INVENTORY); + PyModule_AddIntConstant(poModule, "SLOT_TYPE_BOOK_INVENTORY", SLOT_TYPE_BOOK_INVENTORY); + PyModule_AddIntConstant(poModule, "SLOT_TYPE_STONE_INVENTORY", SLOT_TYPE_STONE_INVENTORY); + PyModule_AddIntConstant(poModule, "SLOT_TYPE_CHANGE_INVENTORY", SLOT_TYPE_CHANGE_INVENTORY); + PyModule_AddIntConstant(poModule, "SLOT_TYPE_COSTUME_INVENTORY", SLOT_TYPE_COSTUME_INVENTORY); +#endif PyModule_AddIntConstant(poModule, "SLOT_TYPE_SWITCHBOT", SLOT_TYPE_SWITCHBOT); // PORT: AVA2 switchbot PyModule_AddIntConstant(poModule, "ON_TOP_WND_NONE", 0); @@ -2646,6 +2668,17 @@ void initPlayer() PyModule_AddIntConstant(poModule, "DRAGON_SOUL_INVENTORY", DRAGON_SOUL_INVENTORY); PyModule_AddIntConstant(poModule, "GROUND", GROUND); PyModule_AddIntConstant(poModule, "SWITCHBOT", SWITCHBOT); // PORT: AVA2 switchbot +#ifdef ENABLE_SPECIAL_STORAGE + PyModule_AddIntConstant(poModule, "UPGRADE_INVENTORY", UPGRADE_INVENTORY); + PyModule_AddIntConstant(poModule, "BOOK_INVENTORY", BOOK_INVENTORY); + PyModule_AddIntConstant(poModule, "STONE_INVENTORY", STONE_INVENTORY); + PyModule_AddIntConstant(poModule, "CHANGE_INVENTORY", CHANGE_INVENTORY); + PyModule_AddIntConstant(poModule, "COSTUME_INVENTORY", COSTUME_INVENTORY); + + PyModule_AddIntConstant(poModule, "SPECIAL_PAGE_SIZE", c_Special_Inventory_Page_Size); + PyModule_AddIntConstant(poModule, "SPECIAL_PAGE_COUNT", c_Special_Inventory_Page_Count); + PyModule_AddIntConstant(poModule, "SPECIAL_SLOT_COUNT", c_Special_ItemSlot_Count); +#endif PyModule_AddIntConstant(poModule, "ITEM_MONEY", -1); diff --git a/tests/port/port_python_ui_modules_test.cpp b/tests/port/port_python_ui_modules_test.cpp index d5ba5990..d83a3a36 100644 --- a/tests/port/port_python_ui_modules_test.cpp +++ b/tests/port/port_python_ui_modules_test.cpp @@ -85,6 +85,22 @@ int main(int argc, char** argv) "assert app.BL_67_ATTR == 1\n" "assert player.ON_TOP_WND_ATTR_67 == 7\n" "assert player.ON_TOP_WND_NONE == 0\n" + "assert app.ENABLE_SPECIAL_STORAGE == 1\n" + "assert player.SWITCHBOT == 7\n" + "assert player.UPGRADE_INVENTORY == 8\n" + "assert player.BOOK_INVENTORY == 9\n" + "assert player.STONE_INVENTORY == 10\n" + "assert player.CHANGE_INVENTORY == 11\n" + "assert player.COSTUME_INVENTORY == 12\n" + "assert player.SLOT_TYPE_UPGRADE_INVENTORY > 0\n" + "assert player.SLOT_TYPE_BOOK_INVENTORY > 0\n" + "assert player.SLOT_TYPE_STONE_INVENTORY > 0\n" + "assert player.SLOT_TYPE_CHANGE_INVENTORY > 0\n" + "assert player.SLOT_TYPE_COSTUME_INVENTORY > 0\n" + "assert player.SPECIAL_PAGE_SIZE == 45\n" + "assert player.SPECIAL_PAGE_COUNT == 4\n" + "assert player.SPECIAL_SLOT_COUNT == 180\n" + "assert hasattr(player, 'GetItemCountByTT')\n" "import net\n" "assert hasattr(net, 'Send67AttrPacket')\n" "assert hasattr(net, 'Send67AttrClosePacket')\n"