redscoutyt2 3 Posted October 21, 2021 Share Posted October 21, 2021 (edited) Hi guys. I have a mount inventory system which is using the belt inventory. I have a button for it, and I had to have a Belt on to use it(like official) but I wanted to use it without Belt If you want to do this follow this tutorial, I'm not good at coding, so maybe there's better solution, but I did this that way. Sorry for my English. Open char_item.cpp and search: bool CHARACTER::IsEmptyItemGrid(TItemPos Cell, BYTE bSize, int iExceptionCell) const Search this in IsEmptyItemGrid (Item disappear fix by: Pisti95) if (Cell.IsBeltInventoryPosition()) { LPITEM beltItem = GetWear(WEAR_BELT); if (NULL == beltItem) return false; if (false == CBeltInventoryHelper::IsAvailableCell(bCell - BELT_INVENTORY_SLOT_START, beltItem->GetValue(0))) return false; Comment it, make it look like this: if (Cell.IsBeltInventoryPosition()) { //LPITEM beltItem = GetWear(WEAR_BELT); //if (NULL == beltItem) // return true; //if (false == CBeltInventoryHelper::IsAvailableCell(bCell - BELT_INVENTORY_SLOT_START, beltItem->GetValue(0))) // return false; Open belt_inventory_helper.h Search for: static bool IsExistItemInBeltInventory(LPCHARACTER pc) Make it look like this: static bool IsExistItemInBeltInventory(LPCHARACTER pc) { //for (WORD i = BELT_INVENTORY_SLOT_START; i < BELT_INVENTORY_SLOT_END; ++i) //{ // LPITEM beltInventoryItem = pc->GetInventoryItem(i); // // if (NULL != beltInventoryItem) // return true; //} return true; } You can compile game. Python part to ,,turn off" disabled slots, and make it look like you have a Belt on Open uiinventory.py Search this in class BeltInventoryWindow def RefreshSlot(self): Change this: self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, True) To this: self.wndBeltInventorySlot.SetAlwaysRenderCoverButton(slotNumber, False) Then change this: self.wndBeltInventorySlot.DisableCoverButton(slotNumber) To this: self.wndBeltInventorySlot.EnableCoverButton(slotNumber) And I dont know if its necessary, but I did these thing too Search for this in class BeltInventoryWindow def __LoadWindow(self): In this search for: for i in xrange(item.BELT_INVENTORY_SLOT_COUNT): slotNumber = item.BELT_INVENTORY_SLOT_START + i wndBeltInventorySlot.SetCoverButton(slotNumber, "d:/ymir work/ui/game/quest/slot_button_01.sub",\ "d:/ymir work/ui/game/quest/slot_button_01.sub",\ "d:/ymir work/ui/game/quest/slot_button_01.sub") "d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", False, False) And comment the last line, make it look like this: #"d:/ymir work/ui/game/belt_inventory/slot_disabled.tga", False, False) Client source (Still don't know, if it's necessary or not) Open Userinterface/PythonPlayerModule.cpp Search for: #ifdef ENABLE_NEW_EQUIPMENT_SYSTEM PyObject * playerIsEquippingBelt(PyObject* poSelf, PyObject* poArgs) { Make it look like this: (Change PyObject * playerIsAvailableBeltInventoryCell(PyObject* poSelf, PyObject* poArgs) too! ) #ifdef ENABLE_NEW_EQUIPMENT_SYSTEM PyObject * playerIsEquippingBelt(PyObject* poSelf, PyObject* poArgs) { const CPythonPlayer* player = CPythonPlayer::InstancePtr(); bool bEquipping = false; // const TItemData* data = player->GetItemData(TItemPos(EQUIPMENT, c_Equipment_Belt)); // // if (NULL != data) // bEquipping = 0 < data->count; return Py_BuildValue("b", bEquipping); } PyObject * playerIsAvailableBeltInventoryCell(PyObject* poSelf, PyObject* poArgs) { const CPythonPlayer* player = CPythonPlayer::InstancePtr(); // const TItemData* pData = player->GetItemData(TItemPos(EQUIPMENT, c_Equipment_Belt)); // // if (NULL == pData || 0 == pData->count) // return Py_BuildValue("b", true); // // CItemManager::Instance().SelectItemData(pData->vnum); CItemData * pItem = CItemManager::Instance().GetSelectedItemDataPointer(); long beltGrade = pItem->GetValue(0); int pos = 0; if (!PyTuple_GetInteger(poArgs, 0, &pos)) return Py_BadArgument(); //return Py_BuildValue("b", CBeltInventoryHelper::IsAvailableCell(pos - c_Belt_Inventory_Slot_Start, GetItemGrade(pItem->GetName()))); return Py_BuildValue("b", CBeltInventoryHelper::IsAvailableCell(pos - c_Belt_Inventory_Slot_Start, beltGrade)); } #endif And we're done. Have a good day! Edited October 22, 2021 by redscoutyt2 2 1 Link to comment Share on other sites More sharing options...
redscoutyt2 3 Posted October 22, 2021 Author Share Posted October 22, 2021 (edited) It has one bug I can't solve. The problem is: When I drag an item(first item) to another item(second item), the second item disappears and the first item goes to the second item slot, and the second item just disappears. If i log out, or restart the client nothing will happen only when I restart the server. When I restart the server the second item which is disappers, will appear again. Solved, i'll update the post. Edited October 22, 2021 by redscoutyt2 Link to comment Share on other sites More sharing options...
Pisti95 134 Posted December 31, 2021 Share Posted December 31, 2021 if use char_item.cpp from martysama : Plus additional: Search for: // @fixme141 BEGIN if (TItemPos(item->GetWindow(), item->GetCell()).IsBeltInventoryPosition()) { LPITEM beltItem = GetWear(WEAR_BELT); if (NULL == beltItem) { ChatPacket(CHAT_TYPE_INFO, "<Belt> You can't use this item if you have no equipped belt."); return false; } if (false == CBeltInventoryHelper::IsAvailableCell(item->GetCell() - BELT_INVENTORY_SLOT_START, beltItem->GetValue(0))) { ChatPacket(CHAT_TYPE_INFO, "<Belt> You can't use this item if you don't upgrade your belt."); return false; } } // @fixme141 END Make it look like this: // @fixme141 BEGIN if (TItemPos(item->GetWindow(), item->GetCell()).IsBeltInventoryPosition()) { /*LPITEM beltItem = GetWear(WEAR_BELT); if (NULL == beltItem) { ChatPacket(CHAT_TYPE_INFO, "<Belt> You can't use this item if you have no equipped belt."); return false; } if (false == CBeltInventoryHelper::IsAvailableCell(item->GetCell() - BELT_INVENTORY_SLOT_START, beltItem->GetValue(0))) { ChatPacket(CHAT_TYPE_INFO, "<Belt> You can't use this item if you don't upgrade your belt."); return false; }*/ return true; } // @fixme141 END Good luck! 1 1 1 Link to comment Share on other sites More sharing options...
2DsSDKMN 41 Posted November 21, 2022 Share Posted November 21, 2022 (edited) Hello, i did all from post but it work just in belt_inventory_helper.h with return false; after that i did4 inventory, i cant find anywhere(Dev,Hub,PvPelit.) solution for this bug ( log nothing, syserr nothing ) https://metin2.download/picture/Xby4tW5pRJf9mkD1I75NhJPNgExiDX8S/.gif I know, its server side, but can anyone give me some advice please? Problem is you can put items from safebox to belt inventory. Code: char_item: if (Cell.IsBeltInventoryPosition()) { //LPITEM beltItem = GetWear(WEAR_BELT); //if (NULL == beltItem) //return false; //if (false == CBeltInventoryHelper::IsAvailableCell(bCell - BELT_INVENTORY_SLOT_START, beltItem->GetValue(0))) //return false; if (m_pointsInstant.bItemGrid[bCell]) { if (m_pointsInstant.bItemGrid[bCell] == iExceptionCell) return true; return false; } if (bSize == 1) return true; } belt_inv_helper: static bool IsExistItemInBeltInventory(LPCHARACTER pc) { //for (WORD i = BELT_INVENTORY_SLOT_START; i < BELT_INVENTORY_SLOT_END; ++i) //{ //LPITEM beltInventoryItem = pc->GetInventoryItem(i); //if (NULL != beltInventoryItem) //return true; //} return false; } Edited November 21, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
2DsSDKMN 41 Posted November 22, 2022 Share Posted November 22, 2022 19 hours ago, 2DsSDKMN said: Hello, i did all from post but it work just in belt_inventory_helper.h with return false; after that i did4 inventory, i cant find anywhere(Dev,Hub,PvPelit.) solution for this bug ( log nothing, syserr nothing ) https://metin2.download/picture/Xby4tW5pRJf9mkD1I75NhJPNgExiDX8S/.gif I know, its server side, but can anyone give me some advice please? Problem is you can put items from safebox to belt inventory. Code: char_item: if (Cell.IsBeltInventoryPosition()) { //LPITEM beltItem = GetWear(WEAR_BELT); //if (NULL == beltItem) //return false; //if (false == CBeltInventoryHelper::IsAvailableCell(bCell - BELT_INVENTORY_SLOT_START, beltItem->GetValue(0))) //return false; if (m_pointsInstant.bItemGrid[bCell]) { if (m_pointsInstant.bItemGrid[bCell] == iExceptionCell) return true; return false; } if (bSize == 1) return true; } belt_inv_helper: static bool IsExistItemInBeltInventory(LPCHARACTER pc) { //for (WORD i = BELT_INVENTORY_SLOT_START; i < BELT_INVENTORY_SLOT_END; ++i) //{ //LPITEM beltInventoryItem = pc->GetInventoryItem(i); //if (NULL != beltInventoryItem) //return true; //} return false; } # edit solved Link to comment Share on other sites More sharing options...
Many 0 Posted November 2, 2023 Share Posted November 2, 2023 Hello, i make mount inventory for your description but ctrl+g not working jsut normal inventory, i try cmd_general.cpp for INVENTORY to BELT_INVENTORY but not working. Any one help me? ( CTRL+G combinate for belt inventory ( mount inventory ) Link to comment Share on other sites More sharing options...
Pisti95 134 Posted November 4, 2023 Share Posted November 4, 2023 (edited) @Many my cmd_general.cpp: Detail: if (ch->GetHorse() != NULL) { sys_log(1, "[DO_RIDE] start riding"); ch->StartRiding(); return; } for (UINT i=0; i<INVENTORY_AND_EQUIP_SLOT_MAX; ++i) //INVENTORY_MAX_NUM { LPITEM item = ch->GetInventoryItem(i); if (NULL == item) continue; if (item->IsRideItem()) { if ( NULL==ch->GetWear(WEAR_UNIQUE1) || NULL==ch->GetWear(WEAR_UNIQUE2) #ifdef ENABLE_MOUNT_COSTUME_SYSTEM || NULL==ch->GetWear(WEAR_COSTUME_MOUNT) #endif ) Edited November 4, 2023 by Pisti95 1 Link to comment Share on other sites More sharing options...
Recommended Posts