Jump to content

Fast Split


Recommended Posts

M2 Download Center

This is the hidden content, please
( Internal )

 

 

A very fast item split system written by me. A very optimized one. Instead of sending hundered of packets it only sends maybe a dozen max. It is searching algorithm is also better than most split systems. It can do

backward searching.

 

This is the hidden content, please

  • Metin2 Dev 87
  • Angry 1
  • Not Good 1
  • Think 1
  • Good 17
  • Love 1
  • Love 29
Link to comment
Share on other sites

  • Honorable Member

I don't understand, why are you sending game to client packets?

and this is not optimized, vec is copying object every time

 8e416d472f.PNG

Edited by Metin2 Dev
Core X - External 2 Internal
  • Love 3

 

Link to comment
Share on other sites

		if (iSlot >= 0 && iSlot <= INVENTORY_MAX_NUM && bCount >= 0 && bCount <= g_bItemCountLimit)
		{
			LPITEM item = ch->GetInventoryItem(iSlot);

			if (item)
			{
				BYTE bItemCount = item->GetCount();

				TItemPos ItemCell;

				ItemCell.window_type = INVENTORY;
				ItemCell.cell = item->GetCell();

				for (int i = 0; i < (bItemCount / bCount) - 1; ++i)
				{
					int iEmptySlot = ch->GetEmptyInventory(item->GetSize());

					TItemPos DestItemCell;

					DestItemCell.window_type = INVENTORY;
					DestItemCell.cell = iEmptySlot;

					ch->MoveItem(ItemCell, DestItemCell, bCount);
				}
			}
		}

 

With command that using args - (Item Slot & Split Count)

 

I don't know why you copy the Item, but items that can be Split have no Sockets & Bonus random so the copy seems useless (Is just a move from the count of the item).

Edited by HITRON
Link to comment
Share on other sites

  • Management

Good Idea!

Awesome!

 

happy fun GIF

Edited by Metin2 Dev
Core X - External 2 Internal
  • Lmao 1
Link to comment
Share on other sites

On 11/1/2020 at 7:15 PM, HITRON said:

		if (iSlot >= 0 && iSlot <= INVENTORY_MAX_NUM && bCount >= 0 && bCount <= g_bItemCountLimit)
		{
			LPITEM item = ch->GetInventoryItem(iSlot);

			if (item)
			{
				BYTE bItemCount = item->GetCount();

				TItemPos ItemCell;

				ItemCell.window_type = INVENTORY;
				ItemCell.cell = item->GetCell();

				for (int i = 0; i < (bItemCount / bCount) - 1; ++i)
				{
					int iEmptySlot = ch->GetEmptyInventory(item->GetSize());

					TItemPos DestItemCell;

					DestItemCell.window_type = INVENTORY;
					DestItemCell.cell = iEmptySlot;

					ch->MoveItem(ItemCell, DestItemCell, bCount);
				}
			}
		}

 

With command that using args - (Item Slot & Split Count)

 

I don't know why you copy the Item, but items that can be Split have no Sockets & Bonus random so the copy seems useless (Is just a move from the count of the item).

Is this your split function? If it is I'd like to see a video of you trying to split all the items by 1 in a completly empty inventory. And yours doesn't do backward searching. Yeah maybe you can further optimize it without copying the socket and attributes, I haven't tried it tbh.

Link to comment
Share on other sites

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.