cBaraN 109 Posted March 24, 2015 Share Posted March 24, 2015 (edited) Hi guys! While i was watching on youtube videos , I saw accidentally noticed the problem in Metin2 videos. The problem for you, I'll help you solve the problem for you both as you know. BUG VİDEO Let's solve the bug! Open exchange.cpp and search; for (i = 0; i < INVENTORY_MAX_NUM / 2; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; s_grid1.Put(i, 1, item->GetSize()); } Find this code; for (i = 0; i < INVENTORY_MAX_NUM / 2; ++i) EDİT : bool CExchange::CheckSpace() { static CGrid s_grid1(5, INVENTORY_MAX_NUM / 5 / 4 ); // inven page 1 static CGrid s_grid2(5, INVENTORY_MAX_NUM / 5 / 4); // inven page 2 static CGrid s_grid3(5, INVENTORY_MAX_NUM / 5 / 4); // inven page 3 static CGrid s_grid4(5, INVENTORY_MAX_NUM / 5 / 4); // inven page 4 s_grid1.Clear(); s_grid2.Clear(); s_grid3.Clear(); s_grid4.Clear(); LPCHARACTER victim = GetCompany()->GetOwner(); LPITEM item; int i; /* PAGE SLOT COUNT fixed exchange bug from one item copright -cBaraN- */ int INVENTORY_PAGE_SLOT_COUNT = INVENTORY_MAX_NUM/4; for (i = 0; i < INVENTORY_PAGE_SLOT_COUNT; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; s_grid1.Put(i, 1, item->GetSize()); } for (i = INVENTORY_PAGE_SLOT_COUNT; i < INVENTORY_PAGE_SLOT_COUNT*2; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; s_grid2.Put(i - INVENTORY_PAGE_SLOT_COUNT, 1, item->GetSize()); } for (i = INVENTORY_PAGE_SLOT_COUNT*2; i < INVENTORY_PAGE_SLOT_COUNT*3; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; s_grid3.Put(i - INVENTORY_PAGE_SLOT_COUNT*2, 1, item->GetSize()); } for (i = INVENTORY_PAGE_SLOT_COUNT*3; i < INVENTORY_PAGE_SLOT_COUNT*4; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; s_grid4.Put(i - INVENTORY_PAGE_SLOT_COUNT*3, 1, item->GetSize()); } // ¾Æ... ¹º°¡ °³º´½Å °°Áö¸¸... ¿ëÈ¥¼® Àκ¥À» ³ë¸Ö Àκ¥ º¸°í µû¶ó ¸¸µç ³» À߸øÀÌ´Ù ¤Ğ¤Ğ static std::vector <WORD> s_vDSGrid(DRAGON_SOUL_INVENTORY_MAX_NUM); // ÀÏ´Ü ¿ëÈ¥¼®À» ±³È¯ÇÏÁö ¾ÊÀ» °¡´É¼ºÀÌ Å©¹Ç·Î, ¿ëÈ¥¼® Àκ¥ º¹»ç´Â ¿ëÈ¥¼®ÀÌ ÀÖÀ» ¶§ Çϵµ·Ï ÇÑ´Ù. bool bDSInitialized = false; for (i = 0; i < EXCHANGE_ITEM_MAX_NUM; ++i) { if (!(item = m_apItems[i])) continue; if (item->IsDragonSoul()) { if (!victim->DragonSoul_IsQualified()) { return false; } if (!bDSInitialized) { bDSInitialized = true; victim->CopyDragonSoulItemGrid(s_vDSGrid); } bool bExistEmptySpace = false; WORD wBasePos = DSManager::instance().GetBasePosition(item); if (wBasePos >= DRAGON_SOUL_INVENTORY_MAX_NUM) return false; for (int i = 0; i < DRAGON_SOUL_BOX_SIZE; i++) { WORD wPos = wBasePos + i; if (0 == s_vDSGrid[wBasePos]) { bool bEmpty = true; for (int j = 1; j < item->GetSize(); j++) { if (s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM]) { bEmpty = false; break; } } if (bEmpty) { for (int j = 0; j < item->GetSize(); j++) { s_vDSGrid[wPos + j * DRAGON_SOUL_BOX_COLUMN_NUM] = wPos + 1; } bExistEmptySpace = true; break; } } if (bExistEmptySpace) break; } if (!bExistEmptySpace) return false; } else { int iPos = s_grid1.FindBlank(1, item->GetSize()); if (iPos >= 0) { s_grid1.Put(iPos, 1, item->GetSize()); }else { iPos = s_grid2.FindBlank(1, item->GetSize()); if (iPos >= 0) { s_grid2.Put(iPos, 1, item->GetSize()); }else { iPos = s_grid3.FindBlank(1, item->GetSize()); if (iPos >= 0) { s_grid3.Put(iPos, 1, item->GetSize()); }else { iPos = s_grid4.FindBlank(1, item->GetSize()); if (iPos >= 0) { s_grid4.Put(iPos, 1, item->GetSize()); }else { return false; } } } } } } return true; } Best regards; Can BARAN... Watch this video if you want to thank. : when u try change a 2sword hand ( 3 slots ) and u only have 2 slots free you can make the change but the other person cant give u the 2sword hand, because u dont have space in your inventory, but u give to him yours items in inventory. I hope that I have been helpful with this little information about the bug. And sorry my english. Edited August 19, 2022 by Metin2 Dev Core X - External 2 Internal 1 2 6 Link to comment Share on other sites More sharing options...
MANYAK 5 Posted March 24, 2015 Share Posted March 24, 2015 I thank you. You answer me skype Link to comment Share on other sites More sharing options...
Syron 297 Posted March 24, 2015 Share Posted March 24, 2015 You must create new grids too. This bug appears only if you implement them wrong. Nice post, bro! static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 3 static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 4 s_grid3.Clear(); s_grid4.Clear(); for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; s_grid3.Put(i, 1, item->GetSize()); } for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; s_grid4.Put(i, 1, item->GetSize()); } 1 Link to comment Share on other sites More sharing options...
cBaraN 109 Posted March 24, 2015 Author Share Posted March 24, 2015 You must create new grids too. This bug appears only if you implement them wrong. You will see that normally would be a problem if you try bro. Best regards; Can BARAN... Link to comment Share on other sites More sharing options...
cBaraN 109 Posted March 24, 2015 Author Share Posted March 24, 2015 You must create new grids too. This bug appears only if you implement them wrong. Nice post, bro! static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 3 static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 4 s_grid3.Clear(); s_grid4.Clear(); for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; s_grid3.Put(i, 1, item->GetSize()); } for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; s_grid4.Put(i, 1, item->GetSize()); } Try as you will see, I told you my bro. Best regards; Can BARAN... Link to comment Share on other sites More sharing options...
Syron 297 Posted March 24, 2015 Share Posted March 24, 2015 You must create new grids too. This bug appears only if you implement them wrong. Nice post, bro! static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 3 static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 4 s_grid3.Clear(); s_grid4.Clear(); for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; s_grid3.Put(i, 1, item->GetSize()); } for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; s_grid4.Put(i, 1, item->GetSize()); } Try as you will see, I told you my bro. Best regards; Can BARAN... Yeah... Tested right now, but you must add the grids too. Thank you again for this post ! 1 Link to comment Share on other sites More sharing options...
Despero 131 Posted March 24, 2015 Share Posted March 24, 2015 thank you cBaran for the fix 1 Link to comment Share on other sites More sharing options...
cBaraN 109 Posted March 24, 2015 Author Share Posted March 24, 2015 thank you cBaran for the fix No problem Best regards; Can BARAN... Link to comment Share on other sites More sharing options...
ScreamMyName 100 Posted March 24, 2015 Share Posted March 24, 2015 e : K I get it now.. which branch are you using, coz i don't have this bug. Link to comment Share on other sites More sharing options...
ѕeмa™ 308 Posted March 24, 2015 Share Posted March 24, 2015 when u try change a 2sword hand ( 3 slots ) and u only have 2 slots free you can make the change but the other person cant give u the 2sword hand, because u dont have space in your inventory, but u give to him yours items in inventory. I hope that I have been helpful with this little information about the bug. And sorry my english. 1 https://m2admin.net/ Link to comment Share on other sites More sharing options...
cBaraN 109 Posted March 24, 2015 Author Share Posted March 24, 2015 when u try change a 2sword hand ( 3 slots ) and u only have 2 slots free you can make the change but the other person cant give u the 2sword hand, because u dont have space in your inventory, but u give to him yours items in inventory. I hope that I have been helpful with this little information about the bug. And sorry my english. Thanks for the explanation bro. Best regards; Can BARAN... Link to comment Share on other sites More sharing options...
safademirel 292 Posted March 24, 2015 Share Posted March 24, 2015 You must create new grids too. This bug appears only if you implement them wrong. Nice post, bro! static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 3 static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 4 s_grid3.Clear(); s_grid4.Clear(); for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; s_grid3.Put(i, 1, item->GetSize()); } for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; s_grid4.Put(i, 1, item->GetSize()); } You're wrong static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 3 static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 4 Will cause the bugs but there is a fix for this. Link to comment Share on other sites More sharing options...
Syron 297 Posted March 25, 2015 Share Posted March 25, 2015 You must create new grids too. This bug appears only if you implement them wrong. Nice post, bro! static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 3 static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 4 s_grid3.Clear(); s_grid4.Clear(); for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; s_grid3.Put(i, 1, item->GetSize()); } for (i = 0; i < INVENTORY_MAX_NUM / 4; ++i) { if (!(item = victim->GetInventoryItem(i))) continue; s_grid4.Put(i, 1, item->GetSize()); } You're wrong static CGrid s_grid3(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 3 static CGrid s_grid4(5, INVENTORY_MAX_NUM/5 / 2); // inventory page 4 Will cause the bugs but there is a fix for this. I've never encountered any problem with Inventory Slots using INVENTORY_MAX_NUM/5 / 2 But... whatever Link to comment Share on other sites More sharing options...
Premium Cataclismo 86 Posted March 25, 2015 Premium Share Posted March 25, 2015 So you're adding a variable to the code, but you're not using it anywhere. How does that solve the bug? This is not a bug fix at all. Your code does nothing. Link to comment Share on other sites More sharing options...
Tacticus 74 Posted March 25, 2015 Share Posted March 25, 2015 not work i tested...any other solution? Link to comment Share on other sites More sharing options...
Premium Cataclismo 86 Posted March 25, 2015 Premium Share Posted March 25, 2015 not work i tested...any other solution? So you're adding a variable to the code, but you're not using it anywhere. How does that solve the bug? This is not a bug fix at all. Your code does nothing. Link to comment Share on other sites More sharing options...
cBaraN 109 Posted March 25, 2015 Author Share Posted March 25, 2015 not work i tested...any other solution? So you're adding a variable to the code, but you're not using it anywhere. How does that solve the bug? This is not a bug fix at all. Your code does nothing. Correct structure works, i tested. Best regards; Can BARAN... Link to comment Share on other sites More sharing options...
Premium Cataclismo 86 Posted March 25, 2015 Premium Share Posted March 25, 2015 not work i tested...any other solution? So you're adding a variable to the code, but you're not using it anywhere. How does that solve the bug? This is not a bug fix at all. Your code does nothing. Correct structure works, i tested. Best regards; Can BARAN... Think about it. You added a variable which it's not used by anything. How can a simple variable, which is never used, to change how your code works? Check what you've posted again. Link to comment Share on other sites More sharing options...
cBaraN 109 Posted March 25, 2015 Author Share Posted March 25, 2015 not work i tested...any other solution? So you're adding a variable to the code, but you're not using it anywhere. How does that solve the bug? This is not a bug fix at all. Your code does nothing. Correct structure works, i tested. Best regards; Can BARAN... Think about it. You added a variable which it's not used by anything. How can a simple variable, which is never used, to change how your code works? Check what you've posted again. Freebsd "gmake clean" will not work without using the code. Try again. Best regards; Can BARAN... Link to comment Share on other sites More sharing options...
Think 117 Posted March 25, 2015 Share Posted March 25, 2015 You are not being reasonable, nor replying to the actual question. Maybe you did fix something, but if you did, I have to agree with Cataclismo, it's not published in this thread. Instead of blindly doing gmake clean, explain why should it fix anything to add a variable. Link to comment Share on other sites More sharing options...
Adrian1428 31 Posted March 25, 2015 Share Posted March 25, 2015 Search "INVENTORY_PAGE_SLOT_COUNT" (0 hits in 0 files) This is not used in game source , so how can it work? Link to comment Share on other sites More sharing options...
cBaraN 109 Posted March 25, 2015 Author Share Posted March 25, 2015 You are not being reasonable, nor replying to the actual question. Maybe you did fix something, but if you did, I have to agree with Cataclismo, it's not published in this thread. Instead of blindly doing gmake clean, explain why should it fix anything to add a variable. Ow... sorry, I forgot to share resources. I add to this thread. Thx, think Best regards; Can BARAN... Link to comment Share on other sites More sharing options...
Premium Cataclismo 86 Posted March 25, 2015 Premium Share Posted March 25, 2015 Search "INVENTORY_PAGE_SLOT_COUNT" (0 hits in 0 files) This is not used in game source , so how can it work? It's not working. Read above. Link to comment Share on other sites More sharing options...
Adrian1428 31 Posted March 25, 2015 Share Posted March 25, 2015 Search "INVENTORY_PAGE_SLOT_COUNT" (0 hits in 0 files) This is not used in game source , so how can it work? It's not working. Read above. I understand , last night when I read the topic seemed strange to just add a variable. I see now he edited the subject, and it may work. Link to comment Share on other sites More sharing options...
cBaraN 109 Posted March 25, 2015 Author Share Posted March 25, 2015 Search "INVENTORY_PAGE_SLOT_COUNT" (0 hits in 0 files) This is not used in game source , so how can it work? It's not working. Read above. I renew the expression. You can look at. Best regards; Can BARAN... Link to comment Share on other sites More sharing options...
Recommended Posts