Register for your free account! | Forgot your password?

You last visited: Today at 11:59

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[MINI] Button for sort of Inventory

Discussion on [MINI] Button for sort of Inventory within the Metin2 PServer Designs, Websites & Scripts forum part of the Metin2 Private Server category.

Reply
 
Old   #1
 
xP3NG3Rx's Avatar
 
elite*gold: 50
Join Date: May 2011
Posts: 269
Received Thanks: 990
[MINI] Button for sort of Inventory

Hello,

I saw a new custome "system" by name Sort, which is resorting the whole inventory, and I made a little button for it from the standard metin2 interface files. I think I saw this on Rubinum and Shiro3 with an ugly icon



I think no need to explain how to implement it.
xP3NG3Rx is offline  
Thanks
5 Users
Old 05/25/2017, 06:16   #2
 
EULOG1SON's Avatar
 
elite*gold: 0
Join Date: Jun 2013
Posts: 196
Received Thanks: 50
nice

you can make the code? the part which is sorting your inventory with /sort_inventory command
EULOG1SON is offline  
Old 05/25/2017, 12:05   #3
 
I´m Raylee's Avatar
 
elite*gold: 105
Join Date: Jun 2015
Posts: 453
Received Thanks: 294
Nice work dude...
I´m Raylee is offline  
Old 05/25/2017, 12:55   #4
 
BizepsSupportAccount's Avatar
 
elite*gold: 0
Join Date: Dec 2014
Posts: 1,015
Received Thanks: 498
Nettes release, wird der Source Part nicht releast?
BizepsSupportAccount is offline  
Old 05/26/2017, 23:40   #5
 
xP3NG3Rx's Avatar
 
elite*gold: 50
Join Date: May 2011
Posts: 269
Received Thanks: 990
The sorting function is on my TODO list only, I didn't start to code yet.
xP3NG3Rx is offline  
Old 05/28/2017, 12:01   #6
 
BizepsSupportAccount's Avatar
 
elite*gold: 0
Join Date: Dec 2014
Posts: 1,015
Received Thanks: 498
Quote:
Originally Posted by xP3NG3Rx View Post
The sorting function is on my TODO list only, I didn't start to code yet.
'd be amazing if you code & release it.
BizepsSupportAccount is offline  
Old 05/31/2017, 08:41   #7
 
EULOG1SON's Avatar
 
elite*gold: 0
Join Date: Jun 2013
Posts: 196
Received Thanks: 50
You can coding the sorting function are you sure?
EULOG1SON is offline  
Old 06/04/2017, 01:37   #8

 
elite*gold: 0
Join Date: Jul 2009
Posts: 2,471
Received Thanks: 5,622
Code:
ACMD(do_sort_inventory)
{
	std::vector<CItem*> collectItems;
	std::vector<WORD> oldCells;
	int totalSize = 0;
	for (auto i = 0; i < INVENTORY_MAX_COUNT; ++i) {
		auto item = ch->GetInventoryItem(i);
		if (item) {
			totalSize += item->GetSize();
			oldCells.push_back(item->GetCell());
			collectItems.push_back(item);
		}
	}
	if (totalSize - 3 >= INVENTORY_MAX_COUNT) {
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("INVENTORY_FULL_CANNOT_SORT"));
		return;
	}

	for (auto& item : collectItems) {
		item->RemoveFromCharacter();
	}

	std::sort(collectItems.begin(), collectItems.end(),
	          []( CItem* a,  CItem* b) {
		          return a->GetVnum() < b->GetVnum();
	          });

	for (auto& sortedItem : collectItems) {
		auto cell = ch->GetEmptyInventory(sortedItem->GetSize());
		sortedItem->AddToCharacter(ch, TItemPos(INVENTORY, cell), false);
	}
}
Not the best but should work, could not work possibly im pretty drunk right now
.Alpha. is offline  
Thanks
4 Users
Old 06/04/2017, 02:41   #9
 
DasSchwarzeT's Avatar
 
elite*gold: 399
Join Date: Sep 2011
Posts: 5,323
Received Thanks: 3,938
Quote:
Originally Posted by .Alpha. View Post
im pretty drunk right now
+1
DasSchwarzeT is offline  
Old 06/07/2017, 02:04   #10
 
elite*gold: 0
Join Date: Jun 2012
Posts: 58
Received Thanks: 14
Quote:
Originally Posted by .Alpha. View Post
Code:
ACMD(do_sort_inventory)
{
	std::vector<CItem*> collectItems;
	std::vector<WORD> oldCells;
	int totalSize = 0;
	for (auto i = 0; i < INVENTORY_MAX_COUNT; ++i) {
		auto item = ch->GetInventoryItem(i);
		if (item) {
			totalSize += item->GetSize();
			oldCells.push_back(item->GetCell());
			collectItems.push_back(item);
		}
	}
	if (totalSize - 3 >= INVENTORY_MAX_COUNT) {
		ch->ChatPacket(CHAT_TYPE_INFO, LC_TEXT("INVENTORY_FULL_CANNOT_SORT"));
		return;
	}

	for (auto& item : collectItems) {
		item->RemoveFromCharacter();
	}

	std::sort(collectItems.begin(), collectItems.end(),
	          []( CItem* a,  CItem* b) {
		          return a->GetVnum() < b->GetVnum();
	          });

	for (auto& sortedItem : collectItems) {
		auto cell = ch->GetEmptyInventory(sortedItem->GetSize());
		sortedItem->AddToCharacter(ch, TItemPos(INVENTORY, cell), false);
	}
}
Not the best but should work, could not work possibly im pretty drunk right now
Works pretty well. Thanks. And thanks to penger too.
LordMG is offline  
Thanks
1 User
Old 06/08/2017, 19:56   #11
 
EULOG1SON's Avatar
 
elite*gold: 0
Join Date: Jun 2013
Posts: 196
Received Thanks: 50
can you do also a autostack function?
EULOG1SON is offline  
Old 03/02/2024, 16:46   #12
 
elite*gold: 0
Join Date: Sep 2023
Posts: 1
Received Thanks: 0
Hi, could anyone help me implement this function within my metin please?
cherezcl is offline  
Reply


Similar Threads Similar Threads
Moving event weapon through storage w/o sort button
08/31/2014 - 9Dragons - 33 Replies
In the last update GC disabled the Sort button so moving the event weapon through storage using the Sort button doesn't work any more. I saw some people that moved the event weapons using another method. They said they have another more complicated method, does anyone know that method?
Can you move untradeble items on Gc 9d without Sort button anymore?
08/27/2014 - 9Dragons - 7 Replies
Hey guys i ws wondering if some1 found another method to move untradeble items in storage , after 9dragons GC updated the game and removed the Sort Button . Thanks.
[B] Push Button [S] 10 e*gold/Button; 25 e*g/psd+Button
09/20/2013 - elite*gold Trading - 4 Replies
Moin, Hier könnt ihr folgenden Push Button kaufen: http://i.epvpimg.com/YlrYe.jpg Pro Button wären das 10e*g, pro Button mit .psd dazu 25e*g. Wenn ihr einen Button kaufen wollt, schreibt mir eine PN, damit ich den Namen ändern kann, alles hochladen kann und euch dann per Treasure schicken kann. ;) Schrift kann auch geändert werden. Dazu einfach in der PN schreiben, welche Schrift ihr haben wollt^^



All times are GMT +1. The time now is 11:59.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.