Jump to content
For maintenance and updates, the community will be offline on 31 December 2022 ×
  • 0

Question about a condition in c++


Kafa

Question

Hey, in official i noticed there is this condition. "1465    You need %d perpendicular slots in your inventory to open the Chest."

 

Can someone show me how such a condition would look like? I also think this is something important. 

 

Greetings.

Link to comment
Share on other sites

  • Answers 3
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

3 answers to this question

Recommended Posts

  • 0
  • Bronze
				BYTE bMaxItemSize = 1;
				const CSpecialItemGroup* pGroup = ITEM_MANAGER::instance().GetSpecialItemGroup(dwBoxVnum);
				if (pGroup)
				{
					for (int i = 0; i < pGroup->GetGroupSize(); i++)
					{
						const TItemTable* itemTable = ITEM_MANAGER::instance().GetTable(pGroup->GetVnum(i));
						if(itemTable)
						{
							if(itemTable->bSize > bMaxItemSize)
							{
								bMaxItemSize = itemTable->bSize;
								if(bMaxItemSize == 3)
									break;
							}
						}
					}
				}
				
				if(GetEmptyInventory(bMaxItemSize) == -1)
				{
					ChatPacket(CHAT_TYPE_INFO, "You need %d perpendicular slots in your inventory to open the Chest.", bMaxItemSize);
					return false;
				}

 

Place it in char_item.cpp inside case ITEM_GIFTBOX: after dwBoxVnum. (there are other cases for other types of chests, this instruction is only for giftbox type). 

Also I think the max size from the chest must be a info loaded when the special group is loaded and saved in a variable.

The code I posted for you increases the time complexity of the function and it's not a good ideea 😀

 

Edited by Abel(Tiger)
Link to comment
Share on other sites

  • 0
6 hours ago, Abel(Tiger) said:
				BYTE bMaxItemSize = 1;
				const CSpecialItemGroup* pGroup = ITEM_MANAGER::instance().GetSpecialItemGroup(dwBoxVnum);
				if (pGroup)
				{
					for (int i = 0; i < pGroup->GetGroupSize(); i++)
					{
						const TItemTable* itemTable = ITEM_MANAGER::instance().GetTable(pGroup->GetVnum(i));
						if(itemTable)
						{
							if(itemTable->bSize > bMaxItemSize)
							{
								bMaxItemSize = itemTable->bSize;
								if(bMaxItemSize == 3)
									break;
							}
						}
					}
				}
				
				if(GetEmptyInventory(bMaxItemSize) == -1)
				{
					ChatPacket(CHAT_TYPE_INFO, "You need %d perpendicular slots in your inventory to open the Chest.", bMaxItemSize);
					return false;
				}

 

Place it in char_item.cpp inside case ITEM_GIFTBOX: after dwBoxVnum. (there are other cases for other types of chests, this instruction is only for giftbox type). 

Also I think the max size from the chest must be a info loaded when the special group is loaded and saved in a variable.

The code I posted for you increases the time complexity of the function and it's not a good ideea 😀

 

 

It was a patch to a item duplication bug. I'm pretty sure this is something everyone needs (since the dupe-bug appeared on official server)

 

Big thanks to you abel.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Activity

    1. 992

      [40250] Reference Serverfile + Client + Src [15 Available Languages]

    2. 3

      Biologist Manager (C++ & LUA)

    3. 3

      Visual studio 2022 compiling issue

    4. 63

      Metin2 | Mount System Renewal

    5. 58

      Metin2 2004 Beta Client

    6. 0

      🔥Paradise2 PVP SERVER GLOBAL!! EN-ES-PT 🕐📢Apertura 11 de diciembre 21 horas de España!

    7. 0

      Please help here ( Sush system problem )

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.