Jump to content

Recommended Posts

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
https://metin2.dev/topic/28247-question-about-a-condition-in-c/
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Bot
				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)

english_banner.gif

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.

Don't use any images from : imgur, turkmmop, freakgamers, inforge, hizliresim... Or your content will be deleted without notice...
Use : https://metin2.download/media/add/

Please use https://metin2.download/ when uploading files smaller than 100MB, otherwise the approval will take longer due to manual upload.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • 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.