Guest Ezrekith Posted November 8, 2017 at 12:47 AM Share Posted November 8, 2017 at 12:47 AM (edited) Yolo! ServerSource / game / exchange.cpp Search for bool CExchange::CheckSpace() Replace with this and don't forget to edit it for yourself! bool CExchange::CheckSpace() { int INVENTORY_PAGE_COUNT = 9; //your max inventory page int INVENTORY_PAGE_SIZE = 63; //your max inventory size (In my case its 9*7 check your inventorywindow.py slot func and make some math with it) CGrid* pGrids[INVENTORY_PAGE_COUNT]; for (int i = 0; i < INVENTORY_PAGE_COUNT; ++i) { pGrids[i] = new CGrid(9, INVENTORY_PAGE_SIZE / 9); //Setup with your inventory page pGrids[i]->Clear(); } LPCHARACTER victim = GetCompany()->GetOwner(); LPITEM item; for (int iPage = 0; iPage < INVENTORY_PAGE_COUNT; ++iPage) { int iAdd = iPage * INVENTORY_PAGE_SIZE; for (int i = 0; i < INVENTORY_PAGE_SIZE; ++i) { if (!(item = victim->GetInventoryItem(iAdd + i))) continue; pGrids[iPage]->Put(i, 1, item->GetSize()); } } for (int i = 0; i < EXCHANGE_ITEM_MAX_NUM; ++i) { if (!(item = m_apItems[i])) continue; bool bFree = false; for (int iPage = 0; iPage < INVENTORY_PAGE_COUNT; ++iPage) { int iPos = pGrids[iPage]->FindBlank(1, item->GetSize()); if (iPos >= 0) { pGrids[iPage]->Put(iPos, 1, item->GetSize()); bFree = true; break; } } if (!bFree) { for (int i = 0; i < INVENTORY_PAGE_COUNT; ++i) M2_DELETE(pGrids[i]); return false; } } for (int i = 0; i < INVENTORY_PAGE_COUNT; ++i) M2_DELETE(pGrids[i]); return true; } Edited November 8, 2017 at 01:39 AM by Ezrekith Link to comment Share on other sites More sharing options...
[Admin] tierrilopes Posted November 8, 2017 at 01:26 AM Share Posted November 8, 2017 at 01:26 AM #Vectors Link to comment Share on other sites More sharing options...
Guest Ezrekith Posted November 8, 2017 at 01:32 AM Share Posted November 8, 2017 at 01:32 AM @Tierri Lopes Link to comment Share on other sites More sharing options...
Avorish Posted January 1, 2021 at 01:15 AM Share Posted January 1, 2021 at 01:15 AM thanks Link to comment Share on other sites More sharing options...
metser Posted January 1, 2021 at 09:29 AM Share Posted January 1, 2021 at 09:29 AM köszi Link to comment Share on other sites More sharing options...
P3NG3R Posted November 6, 2021 at 09:52 PM Share Posted November 6, 2021 at 09:52 PM ty Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now