Jump to content

Recommended Posts

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Active+ Member
Posted (edited)
On 4/4/2024 at 1:12 AM, Neoxx said:

i add 4 pages in inventory work prefect but when i try to put weapon or Armor in page 3 or 4 i 'cant. (the problem only with 2 or 3 slot items) 

Did you change size in Cpp files serverside and client side ?

 

 

SERVER SIDE Length.h

// Look for
INVENTORY_MAX_NUM		= 90,

// Modify
INVENTORY_MAX_NUM		= 180,



CHAR_ITEM.cpp

// Look for
					BYTE bPage = bCell / (INVENTORY_MAX_NUM / 2);
// Modify
					BYTE bPage = bCell / (INVENTORY_MAX_NUM / 4);

// Look for (Again...)
					BYTE bPage = bCell / (INVENTORY_MAX_NUM / 2);
// Modify (Again...)
					BYTE bPage = bCell / (INVENTORY_MAX_NUM / 4);

// Look for
					if (p / (INVENTORY_MAX_NUM / 2) != bPage)
// Modify
					if (p / (INVENTORY_MAX_NUM / 4) != bPage)

// Look for (Again...)
					if (p / (INVENTORY_MAX_NUM / 2) != bPage)
// Modify (Again...)
					if (p / (INVENTORY_MAX_NUM / 4) != bPage)



Exchange.cpp

// Look for the CheckSpace function
bool CExchange::CheckSpace()
{
	// Content...
}

// Replace the whole function!
bool CExchange::CheckSpace()
{
	static CGrid s_grid1(5, INVENTORY_MAX_NUM/5/4);
	static CGrid s_grid2(5, INVENTORY_MAX_NUM/5/4);
	static CGrid s_grid3(5, INVENTORY_MAX_NUM/5/4);
	static CGrid s_grid4(5, INVENTORY_MAX_NUM/5/4);
	
	s_grid1.Clear();
	s_grid2.Clear();
	s_grid3.Clear();
	s_grid4.Clear();

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

	int i;

	const int perPageSlotCount = INVENTORY_MAX_NUM / 4;

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

		BYTE itemSize = item->GetSize();

		if (i < perPageSlotCount) // Notice: This is adjusted for 4 Pages only!
			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
			s_grid4.Put(i - perPageSlotCount * 3, 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;
		
		BYTE 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
		{
			int 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;
			}

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

	return true;
}

 

Edited by Lycawn

spacer.png

Link to comment
Share on other sites

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.