Jump to content

Recommended Posts

  • Active Member

Hello!

I was testing something on my server and I had to use /i a tons, so I just extended it instead. With this extension you can get as many items as you want (of course with limitation of your max inventory space.)

For this we will working in only one file, called "cmd_gm.cpp".

 

So, in cmd_gm.cpp fine ACMD(do_item) and edit the following things in the function.

Be careful, because there's a chance that you don't use "g_bItemCountLimit" but "MAX_ITEM_COUNT" (or something like that) instead.

//Find this:
	if (*arg2)
	{
		str_to_number(iCount, arg2);
		iCount = MINMAX(1, iCount, g_bItemCountLimit);
	}
//And comment out iCount limitations like this:
	if (*arg2)
	{
		str_to_number(iCount, arg2);
		//iCount = MINMAX(1, iCount, g_bItemCountLimit);
	}

//Find this:
  if (item->IsDragonSoul())
  {
      [...]
  }

//and after that add this:

		else if (!item->IsStackable())
		{
			M2_DESTROY_ITEM(item);
			for (int i = 0; i < iCount; i++)
			{
				LPITEM newItem = ITEM_MANAGER::instance().CreateItem(dwVnum, 1);
				int iEmptyPos = ch->GetEmptyInventory(newItem->GetSize());

				if (iEmptyPos != -1)
				{
					newItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
					LogManager::instance().ItemLog(ch, newItem, "GM", item->GetName());
				}
				else
				{
					M2_DESTROY_ITEM(item);
					ch->ChatPacket(CHAT_TYPE_INFO, "Not enough inventory space.");
					break;
				}
			}
		}
		else if (item->IsStackable() && iCount > g_bItemCountLimit)
		{
			M2_DESTROY_ITEM(item);
			while (iCount != 0)
			{
				LPITEM newItem;
				if (iCount >= g_bItemCountLimit)
				{
					newItem = ITEM_MANAGER::instance().CreateItem(dwVnum, g_bItemCountLimit);
					iCount -= g_bItemCountLimit;
				}
				else
				{
					newItem = ITEM_MANAGER::instance().CreateItem(dwVnum, iCount);
					iCount -= iCount;
				}

				int iEmptyPos = ch->GetEmptyInventory(newItem->GetSize());

				if (iEmptyPos != -1)
				{
					newItem->AddToCharacter(ch, TItemPos(INVENTORY, iEmptyPos));
					LogManager::instance().ItemLog(ch, newItem, "GM", item->GetName());
				}
				else
				{
					M2_DESTROY_ITEM(newItem);
					ch->ChatPacket(CHAT_TYPE_INFO, "Not enough inventory space.");
					break;
				}
			}
		}
Edited by Valki
  • Metin2 Dev 1
  • Love 1
Link to comment
https://metin2.dev/topic/29871-extended-i-command/
Share on other sites

  • Active Member
21 hours ago, Mafuyu said:

its already public. Dont know where it was but i have something like that already implemented month ago. i guess it was here on metin2dev

Well, I did not know that. 

Link to comment
https://metin2.dev/topic/29871-extended-i-command/#findComment-152967
Share on other sites

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 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.