Jump to content

Inventory increase


Go to solution Solved by Crow,

Recommended Posts

Dear Devs,

Since I couldn't find a topic like this, I thought I'd open one. My problem is that I just can't figure out where I can increase max inventory towards 256.

Images:

spacer.png

spacer.png

In the first picture, the first 4 inventories look like this, but the 5th can only hold 4 blessing scrolls. 4x63=252+4=256

So I would have to rewrite BYTE, but it just doesn't work out anyway.

I'll share a few lines of code that I've rewritten in case I need something else that I don't know about at the moment.

exchange.cpp:

bool CExchange::CheckSpace()
{
	static CGrid s_grid1(5, INVENTORY_MAX_NUM/5/6);
	static CGrid s_grid2(5, INVENTORY_MAX_NUM/5/6);
	static CGrid s_grid3(5, INVENTORY_MAX_NUM/5/6);
	static CGrid s_grid4(5, INVENTORY_MAX_NUM/5/6);
	static CGrid s_grid5(5, INVENTORY_MAX_NUM/5/6);
	static CGrid s_grid6(5, INVENTORY_MAX_NUM/5/6);
	
	s_grid1.Clear();
	s_grid2.Clear();
	s_grid3.Clear();
	s_grid4.Clear();
	s_grid5.Clear();
	s_grid6.Clear();

	LPCHARACTER	victim = GetCompany()->GetOwner();
	LPITEM item;

	int i;

	const int perPageSlotCount = INVENTORY_MAX_NUM / 6;

	for (i = 0; i < INVENTORY_MAX_NUM; ++i) {
		if (!(item = victim->GetInventoryItem(i)))
			continue;

		int32_t itemSize = item->GetSize();

		if (i < perPageSlotCount)
			s_grid1.Put(i, 1, itemSize);
		else if (i < perPageSlotCount * 2)
			s_grid2.Put(i - perPageSlotCount, 1, itemSize);
		else if (i < perPageSlotCount * 3)
			s_grid3.Put(i - perPageSlotCount * 2, 1, itemSize);
		else if (i < perPageSlotCount * 4)
			s_grid4.Put(i - perPageSlotCount * 3, 1, itemSize);
		else if (i < perPageSlotCount * 5)
			s_grid5.Put(i - perPageSlotCount * 4, 1, itemSize);
		else
			s_grid6.Put(i - perPageSlotCount * 5, 1, itemSize);
	}
	//-----------------------------------------------------------
	
	// ??... ??°ˇ °ł?´˝? °°??¸¸... ?????® ?????? ł?¸? ???? ?¸°? ??¶? ¸¸?? ł? ?߸???´? ¤?¤?
	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;
		
		int32_t itemSize = item->GetSize();

		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[wPos])
				{
					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
		{
			int32_t iPos = s_grid1.FindBlank(1, itemSize);
			if (iPos >= 0) {
				s_grid1.Put(iPos, 1, itemSize);
				continue;
			}

			iPos = s_grid2.FindBlank(1, itemSize);
			if (iPos >= 0) {
				s_grid2.Put(iPos, 1, itemSize);
				continue;
			}

			iPos = s_grid3.FindBlank(1, itemSize);
			if (iPos >= 0) {
				s_grid3.Put(iPos, 1, itemSize);
				continue;
			}

			iPos = s_grid4.FindBlank(1, itemSize);
			if (iPos >= 0) {
				s_grid4.Put(iPos, 1, itemSize);
				continue;
			}

			iPos = s_grid5.FindBlank(1, itemSize);
			if (iPos >= 0) {
				s_grid5.Put(iPos, 1, itemSize);
				continue;
			}

			iPos = s_grid6.FindBlank(1, itemSize);
			if (iPos >= 0) {
				s_grid6.Put(iPos, 1, itemSize);
				continue;
			}

			return false;  // No space left in inventory
			
		}
	}

	return true;
}

char_item.cpp:

bool CHARACTER::IsEmptyItemGrid(TItemPos Cell, BYTE bSize, int iExceptionCell) const
{
	switch (Cell.window_type)
	{
	case INVENTORY:
		{
			int32_t bCell = Cell.cell;

			// bItemCell은 0이 false임을 나타내기 위해 + 1 해서 처리한다.
			// 따라서 iExceptionCell에 1을 더해 비교한다.
			++iExceptionCell;

			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;

			}
			else if (bCell >= INVENTORY_MAX_NUM)
				return false;

			if (m_pointsInstant.bItemGrid[bCell])
			{
				if (m_pointsInstant.bItemGrid[bCell] == iExceptionCell)
				{
					if (bSize == 1)
						return true;

					int j = 1;
					int32_t bPage = bCell / (INVENTORY_MAX_NUM / 6);

					do
					{
						int32_t p = bCell + (5 * j);

						if (p >= INVENTORY_MAX_NUM)
							return false;

						if (p / (INVENTORY_MAX_NUM / 6) != bPage)
							return false;

						if (m_pointsInstant.bItemGrid[p])
							if (m_pointsInstant.bItemGrid[p] != iExceptionCell)
								return false;
					}
					while (++j < bSize);

					return true;
				}
				else
					return false;
			}

			// 크기가 1이면 한칸을 차지하는 것이므로 그냥 리턴
			if (1 == bSize)
				return true;
			else
			{
				int j = 1;
				int32_t bPage = bCell / (INVENTORY_MAX_NUM / 6);

				do
				{
					int32_t p = bCell + (5 * j);

					if (p >= INVENTORY_MAX_NUM)
						return false;

					if (p / (INVENTORY_MAX_NUM / 6) != bPage)
						return false;

					if (m_pointsInstant.bItemGrid[p])
						if (m_pointsInstant.bItemGrid[p] != iExceptionCell)
							return false;
				}
				while (++j < bSize);

				return true;
			}
		}

length.h:

INVENTORY_MAX_NUM		= 378,

inventorywindow.py:

EQUIPMENT_START_INDEX = 378

uiinventory.py:

self.inventoryTab.append(self.GetChild("Inventory_Tab_01"))
self.inventoryTab.append(self.GetChild("Inventory_Tab_02"))
self.inventoryTab.append(self.GetChild("Inventory_Tab_03"))
self.inventoryTab.append(self.GetChild("Inventory_Tab_04"))
self.inventoryTab.append(self.GetChild("Inventory_Tab_05"))
self.inventoryTab.append(self.GetChild("Inventory_Tab_06"))

self.inventoryTab[0].SetEvent(lambda arg=0: self.SetInventoryPage(arg))
self.inventoryTab[1].SetEvent(lambda arg=1: self.SetInventoryPage(arg))
self.inventoryTab[2].SetEvent(lambda arg=2: self.SetInventoryPage(arg))
self.inventoryTab[3].SetEvent(lambda arg=3: self.SetInventoryPage(arg))
self.inventoryTab[4].SetEvent(lambda arg=4: self.SetInventoryPage(arg))
self.inventoryTab[5].SetEvent(lambda arg=5: self.SetInventoryPage(arg))
self.inventoryTab[0].Down()
self.inventoryPageIndex = 0

def SetInventoryPage(self, page):
self.inventoryTab[self.inventoryPageIndex].SetUp()
self.inventoryPageIndex = page
self.inventoryTab[self.inventoryPageIndex].Down()
self.RefreshBagSlotWindow()

if slotNumber >= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex:
slotNumber -= player.INVENTORY_PAGE_SIZE*self.inventoryPageIndex

beltinventorywindow.py:

EQUIPMENT_START_INDEX = 378

GameType.h:

const DWORD c_Inventory_Page_Size = 7*9; // x*y
const DWORD c_Inventory_Page_Count = 6;

Hope someone can help.

I have no idea what I'm missing out.

Thank you in advance for your answers.

Sincerely, Crow

Edited by Crow
Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.