.ZeNu 3123 Posted July 7, 2018 Share Posted July 7, 2018 (edited) M2 Download Center This is the hidden content, please Sign In or Sign Up ( Internal ) // If you use my special storage, and ofc if you want add "ACMD(do_sort_special_storage);" too. ^ //////////// CMD.CPP //////////// Search : ACMD(do_stun); Add after : #ifdef ENABLE_SORT_INVENTORY ACMD(do_sort_items); ACMD(do_sort_special_storage); #endif Search: { "notice", do_notice, 0, POS_DEAD, GM_LOW_WIZARD }, Add after : #ifdef ENABLE_SORT_INVENTORY { "click_sort_items", do_sort_items, 0, POS_DEAD, GM_PLAYER }, { "click_sort_special_storage", do_sort_special_storage, 0, POS_DEAD, GM_PLAYER }, #endif //////////// CMD_GNERAL.CPP //////////// ADD THIS : #ifdef ENABLE_SORT_INVENTORY ACMD (do_sort_items) { if (ch->IsDead() || ch->GetExchange() || ch->IsShop() || ch->IsOpenSafebox() || ch->IsCubeOpen()) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't sort your inventory with those windows open.")); return; } int lastSortInventoryPulse = ch->GetSortInventoryPulse(); int currentPulse = thecore_pulse(); if (lastSortInventoryPulse > currentPulse) { int deltaInSeconds = ((lastSortInventoryPulse / PASSES_PER_SEC(1)) - (currentPulse / PASSES_PER_SEC(1))); int minutes = deltaInSeconds / 60; int seconds = (deltaInSeconds - (minutes * 60)); return; } for (int i = 0; i < INVENTORY_MAX_NUM; ++i) { LPITEM item = ch->GetInventoryItem(i); if(!item) continue; if(item->isLocked()) continue; if(item->GetCount() == g_bItemCountLimit) continue; if (item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK)) { for (int j = i; j < INVENTORY_MAX_NUM; ++j) { LPITEM item2 = ch->GetInventoryItem(j); if(!item2) continue; if(item2->isLocked()) continue; if (item2->GetVnum() == item->GetVnum()) { bool bStopSockets = false; for (int k = 0; k < ITEM_SOCKET_MAX_NUM; ++k) { if (item2->GetSocket(k) != item->GetSocket(k)) { bStopSockets = true; break; } } if(bStopSockets) continue; BYTE bAddCount = MIN(g_bItemCountLimit - item->GetCount(), item2->GetCount()); item->SetCount(item->GetCount() + bAddCount); item2->SetCount(item2->GetCount() - bAddCount); continue; } } } } ch->SetNextSortInventoryPulse(thecore_pulse() + PASSES_PER_SEC(60)); } ACMD (do_sort_special_storage) { if (ch->IsDead() || ch->GetExchange() || ch->IsShop() || ch->IsOpenSafebox() || ch->IsCubeOpen()) { ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can't sort your inventory with those windows open.")); return; } int lastSortSpecialStoragePulse = ch->GetSortSpecialStoragePulse(); int currentPulse = thecore_pulse(); if (lastSortSpecialStoragePulse > currentPulse) { int deltaInSeconds = ((lastSortSpecialStoragePulse / PASSES_PER_SEC(1)) - (currentPulse / PASSES_PER_SEC(1))); int minutes = deltaInSeconds / 60; int seconds = (deltaInSeconds - (minutes * 60)); ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("You can sort your inventory again in %02d seconds."), seconds); return; } for (int m = 0; m < 3; m++) { for (int i = 0; i < SPECIAL_INVENTORY_MAX_NUM; ++i) { LPITEM item; switch(m) { case 0: item = ch->GetUpgradeInventoryItem(i); break; case 1: item = ch->GetBookInventoryItem(i); break; case 2: item = ch->GetStoneInventoryItem(i); break; default: item = ch->GetUpgradeInventoryItem(i); break; } if(!item) continue; if(item->isLocked()) continue; if(item->GetCount() == g_bItemCountLimit) continue; if (item->IsStackable() && !IS_SET(item->GetAntiFlag(), ITEM_ANTIFLAG_STACK)) { for (int j = i; j < SPECIAL_INVENTORY_MAX_NUM; ++j) { LPITEM item2; switch(m) { case 0: item2 = ch->GetUpgradeInventoryItem(j); break; case 1: item2 = ch->GetBookInventoryItem(j); break; case 2: item2 = ch->GetStoneInventoryItem(j); break; default: item2 = ch->GetUpgradeInventoryItem(j); break; } if(!item2) continue; if(item2->isLocked()) continue; if (item2->GetVnum() == item->GetVnum()) { bool bStopSockets = false; for (int k = 0; k < ITEM_SOCKET_MAX_NUM; ++k) { if (item2->GetSocket(k) != item->GetSocket(k)) { bStopSockets = true; break; } } if(bStopSockets) continue; BYTE bAddCount = MIN(g_bItemCountLimit - item->GetCount(), item2->GetCount()); item->SetCount(item->GetCount() + bAddCount); item2->SetCount(item2->GetCount() - bAddCount); continue; } } } } } ch->SetNextSortSpecialStoragePulse(thecore_pulse() + PASSES_PER_SEC(60)); } #endif //////////// char.cpp //////////// Search : m_iSyncHackCount = 0; Add after: #ifdef ENABLE_SORT_INVENTORY m_sortInventoryPulse = 0; m_sortSpecialStoragePulse = 0; #endif //////////// char.h //////////// Search : void GiveGold(INT iAmount); Add after : #ifdef ENABLE_SORT_INVENTORY void SetNextSortInventoryPulse(int pulse) { m_sortInventoryPulse = pulse; } int GetSortInventoryPulse() { return m_sortInventoryPulse; } void SetNextSortSpecialStoragePulse(int pulse) { m_sortSpecialStoragePulse = pulse; } int GetSortSpecialStoragePulse() { return m_sortSpecialStoragePulse; } #endif Search : LPSHOP m_pkShop; LPSHOP m_pkMyShop; std::string m_stShopSign; LPCHARACTER m_pkChrShopOwner; Add after : #ifdef ENABLE_SORT_INVENTORY int m_sortInventoryPulse; int m_sortSpecialStoragePulse; #endif /////// Service.h //////// Add this : #define ENABLE_SORT_INVENTORY Description : https://metin2.download/picture/crvP0X3XlM4WoKb0U11qEUG6QSXIXea9/.gif Edited August 27, 2022 by Metin2 Dev Core X - External 2 Internal 56 1 1 1 2 1 2 17 7 60 Link to comment Share on other sites More sharing options...
Management Karbust 4899 Posted July 17, 2018 Management Share Posted July 17, 2018 Thank you for sharing! Can you also share the button code please? 1 Link to comment Share on other sites More sharing options...
PeaceMaker 121 Posted August 30, 2018 Share Posted August 30, 2018 On 7/7/2018 at 4:24 PM, .Elijah said: // If you use my special storage, and ofc if you want add "ACMD(do_sort_special_storage);" too. ^ "my special storage" can you link it for me ? Link to comment Share on other sites More sharing options...
.ZeNu 3123 Posted August 30, 2018 Author Share Posted August 30, 2018 Acum 5 ore, PeaceMaker a spus: "my special storage" can you link it for me ? This is the hidden content, please Sign In or Sign Up 49 1 1 2 1 9 33 Link to comment Share on other sites More sharing options...
Forum Moderator Raylee 657 Posted August 30, 2018 Forum Moderator Share Posted August 30, 2018 2 hours ago, .Elijah said: This is the hidden content, please Sign In or Sign Up Please create an extra topic for that Thank you. Best regards Raylee 12 1 1 1 6 1 7 Link to comment Share on other sites More sharing options...
Ciucciamelo 0 Posted September 11, 2018 Share Posted September 11, 2018 Excuse me, does it work? Should I take the mega files or the code you posted yourself? thx Link to comment Share on other sites More sharing options...
Ciffer 13 Posted September 21, 2018 Share Posted September 21, 2018 Buggy Link to comment Share on other sites More sharing options...
Suzar 21 Posted June 17, 2021 Share Posted June 17, 2021 it's not sorting, it's stacking Link to comment Share on other sites More sharing options...
Recommended Posts