Dennis 168 Posted August 25, 2015 Share Posted August 25, 2015 (edited) Hey Guys I have a Problem. I have 6 Inventory Pages works fine but when i sell a item over slotPos 255 -> Remove the item from slotPos 0 for example: Slot 256 -> Sell/Remove Slot 0 Slot 257 -> Sell/Remove Slot 1 Slot 258 -> Sell/Remove Slot 2 etc. Here is Source part: Game Source -> input_main.cpp int CInputMain::Shop(LPCHARACTER ch, const char * data, size_t uiBytes) { TPacketCGShop * p = (TPacketCGShop *) data; if (uiBytes < sizeof(TPacketCGShop)) return -1; if (test_server) sys_log(0, "CInputMain::Shop() ==> SubHeader %d", p->subheader); const char * c_pData = data + sizeof(TPacketCGShop); uiBytes -= sizeof(TPacketCGShop); switch (p->subheader) { case SHOP_SUBHEADER_CG_END: sys_log(1, "INPUT: %s SHOP: END", ch->GetName()); CShopManager::instance().StopShopping(ch); return 0; case SHOP_SUBHEADER_CG_BUY: { if (uiBytes < sizeof(BYTE) + sizeof(BYTE)) return -1; BYTE bPos = *(c_pData + 1); sys_log(1, "INPUT: %s SHOP: BUY %d", ch->GetName(), bPos); CShopManager::instance().Buy(ch, bPos); return (sizeof(BYTE) + sizeof(BYTE)); } case SHOP_SUBHEADER_CG_SELL: { if (uiBytes < sizeof(BYTE)) { #ifdef __DEBUG__ ch->ChatPacket(CHAT_TYPE_INFO, "Return -1"); #endif return -1; } BYTE pos = *c_pData; sys_log(0, "INPUT: %s SHOP: SELL", ch->GetName()); CShopManager::instance().Sell(ch, pos); #ifdef __DEBUG__ ch->ChatPacket(CHAT_TYPE_INFO, "return pos: %u", pos); ch->ChatPacket(CHAT_TYPE_INFO, "return sizeof(BYTE)"); #endif return sizeof(BYTE); } case SHOP_SUBHEADER_CG_SELL2: { if (uiBytes < sizeof(BYTE)+sizeof(BYTE)) { #ifdef __DEBUG__ ch->ChatPacket(CHAT_TYPE_INFO, "return -1"); #endif return -1; } UINT pos = *(c_pData++); BYTE count = *(c_pData); sys_log(0, "INPUT: %s SHOP: SELL2", ch->GetName()); CShopManager::instance().Sell(ch, pos, count); #ifdef __DEBUG__ ch->ChatPacket(CHAT_TYPE_INFO, "return pos: %u, count: %d", pos, count); ch->ChatPacket(CHAT_TYPE_INFO, "return sizeof(BYTE) + sizeof(BYTE)"); #endif return sizeof(BYTE)+sizeof(BYTE); } default: sys_err("CInputMain::Shop : Unknown subheader %d : %s", p->subheader, ch->GetName()); break; } return 0; } Client Part -> PythonNetworkStreamPhaseGameItem.cpp bool CPythonNetworkStream::SendShopSellPacketNew(UINT bySlot, BYTE byCount) { if (!__CanActMainInstance()) return true; TPacketCGShop PacketShop; PacketShop.header = HEADER_CG_SHOP; PacketShop.subheader = SHOP_SUBHEADER_CG_SELL2; if (!Send(sizeof(TPacketCGShop), &PacketShop)) { Tracef("SendShopSellPacket Error\n"); return false; } if (!Send(sizeof(BYTE), &bySlot)) { Tracef("SendShopAddSellPacket Error\n"); return false; } if (!Send(sizeof(BYTE), &byCount)) { Tracef("SendShopAddSellPacket Error\n"); return false; } Tracef(" SendShopSellPacketNew(bySlot=%d, byCount=%d)\n", bySlot, byCount); return SendSequence(); } Here is a Image: Has anyone a fix Edited August 19, 2022 by Metin2 Dev Core X - External 2 Internal Link to comment Share on other sites More sharing options...
designer132 6 Posted August 25, 2015 Share Posted August 25, 2015 max number in "BYTE" type is 255... Link to comment Share on other sites More sharing options...
Morphe 160 Posted August 25, 2015 Share Posted August 25, 2015 (edited) You have to change all slot count from BYTE type to int type.There are many files to modified. Because BYTE is max 255, and you have over 255 slots. 255+ slots are bugged. Edited August 25, 2015 by Morphe Link to comment Share on other sites More sharing options...
Premium Galet 514 Posted August 25, 2015 Premium Share Posted August 25, 2015 By the way, dragon soul and belt won't work anymore, you have to change the BYTE to int and "255" to something like "900" Link to comment Share on other sites More sharing options...
Ken 905 Posted August 25, 2015 Share Posted August 25, 2015 (edited) bool CPythonNetworkStream::SendShopSellPacketNew(WORD bySlot, BYTE byCount) { if (!__CanActMainInstance()) return true; TPacketCGShop PacketShop; PacketShop.header = HEADER_CG_SHOP; PacketShop.subheader = SHOP_SUBHEADER_CG_SELL2; if (!Send(sizeof(TPacketCGShop), &PacketShop)) { Tracef("SendShopSellPacket Error\n"); return false; } if (!Send(sizeof(WORD), &bySlot)) { Tracef("SendShopAddSellPacket Error\n"); return false; } if (!Send(sizeof(BYTE), &byCount)) { Tracef("SendShopAddSellPacket Error\n"); return false; } Tracef(" SendShopSellPacketNew(bySlot=%d, byCount=%d)\n", bySlot, byCount); return SendSequence(); } int CInputMain::Shop(LPCHARACTER ch, const char * data, size_t uiBytes) { TPacketCGShop * p = (TPacketCGShop *) data; if (uiBytes < sizeof(TPacketCGShop)) return -1; if (test_server) sys_log(0, "CInputMain::Shop() ==> SubHeader %d", p->subheader); const char * c_pData = data + sizeof(TPacketCGShop); uiBytes -= sizeof(TPacketCGShop); switch (p->subheader) { case SHOP_SUBHEADER_CG_END: sys_log(1, "INPUT: %s SHOP: END", ch->GetName()); CShopManager::instance().StopShopping(ch); return 0; case SHOP_SUBHEADER_CG_BUY: { if (uiBytes < sizeof(WORD) + sizeof(BYTE)) return -1; WORD bPos = *(c_pData + 1); sys_log(1, "INPUT: %s SHOP: BUY %u", ch->GetName(), bPos); CShopManager::instance().Buy(ch, bPos); return (sizeof(WORD) + sizeof(BYTE)); } case SHOP_SUBHEADER_CG_SELL: { if (uiBytes < sizeof(WORD)) { #ifdef __DEBUG__ ch->ChatPacket(CHAT_TYPE_INFO, "Return -1"); #endif return -1; } WORD pos = *c_pData; sys_log(0, "INPUT: %s SHOP: SELL", ch->GetName()); CShopManager::instance().Sell(ch, pos); #ifdef __DEBUG__ ch->ChatPacket(CHAT_TYPE_INFO, "return pos: %u", pos); ch->ChatPacket(CHAT_TYPE_INFO, "return sizeof(WORD)"); #endif return sizeof(WORD); } case SHOP_SUBHEADER_CG_SELL2: { if (uiBytes < sizeof(WORD)+sizeof(BYTE)) { #ifdef __DEBUG__ ch->ChatPacket(CHAT_TYPE_INFO, "return -1"); #endif return -1; } WORD pos = *(c_pData++); BYTE count = *(c_pData); sys_log(0, "INPUT: %s SHOP: SELL2", ch->GetName()); CShopManager::instance().Sell(ch, pos, count); #ifdef __DEBUG__ ch->ChatPacket(CHAT_TYPE_INFO, "return pos: %u, count: %d", pos, count); ch->ChatPacket(CHAT_TYPE_INFO, "return sizeof(BYTE) + sizeof(BYTE)"); #endif return sizeof(WORD)+sizeof(BYTE); } default: sys_err("CInputMain::Shop : Unknown subheader %d : %s", p->subheader, ch->GetName()); break; } return 0; } Kind Regards ~ Ken Edited August 25, 2015 by Ken Do not be sorry, be better. Link to comment Share on other sites More sharing options...
Dennis 168 Posted August 25, 2015 Author Share Posted August 25, 2015 (edited) The Only Bug is the Shop sell. Belt works fine . Thx Ken i try it #EDIT Thx Ken but dont work. Edited August 25, 2015 by Dennis Link to comment Share on other sites More sharing options...
Dennis 168 Posted August 25, 2015 Author Share Posted August 25, 2015 (edited) Problem solved. Thread can be closed Edited August 25, 2015 by Dennis Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now