Jump to content
×
×
  • Create New...
  • 0

Ex Shop Sorting??


thespeedy

Question

5 answers to this question

Recommended Posts

  • 0

It's an interesting "bug". Sort like this:

		1	10	1	1
		10	20	1	1
		11	30	1	1
		12	40	1	1
		13	50	1	1
		14	60	1	1
		2	80	1	1
		3	90	1	1
		4	100	1	1
		5	110	1	1
		6	120	1	1
		7	130	1	1
		8	140	1	1
		9	150	1	1


I hope someone knows how to "fix" it.. :D

Link to comment
Share on other sites

  • 0
  • Honorable Member

You can sort the items by those names in Ascending or Descending, I did some (C&P)changes, but I did not test yet, so I do not know it works or not.
shop_manager.cpp

New function for sorting:

bool CompareShopItemPos(const SShopItemTable& lhs, const SShopItemTable& rhs)
{
	return (lhs.display_pos < rhs.display_pos);
}

Extended sorting statement:

	std::string stSort;
	if (!pNode->GetValue("sort", 0, stSort))
	{
		stSort = "None";
	}

	if (boost::iequals(stSort, "Asc"))
	{
		std::sort(shopItems.begin(), shopItems.end(), CompareShopItemName);
	}
	else if(boost::iequals(stSort, "Desc"))
	{
		std::sort(shopItems.rbegin(), shopItems.rend(), CompareShopItemName);
	}
	else if (boost::iequals(stSort, "Pos"))
	{
		std::sort(shopItems.begin(), shopItems.end(), CompareShopItemPos);
	}
Group B02
{
	Vnum	51
	Name	Costumes
	CoinType	SecondaryCoin
	Sort	Pos
	Group Items
	{
		#--#	Vnum	Count	Price
		1	41003	1	50
		2	41004	1	50
		3	45003	1	30
		4	45004	1	30
	}
}

 

  • Love 1
Link to comment
Share on other sites

  • 0

I think it would be better, if the serial number exactly follow, and not so:

		1	10	1	1
		10	20	1	1
		11	30	1	1
		12	40	1	1
		13	50	1	1
		14	60	1	1
		15	70	1	1
		16	80	1	1
		17	90	1	1
		18	100	1	1
		19	110	1	1
		2	120	1	1
		20	130	1	1
		21	140	1	1
		22	150	1	1
		3	160	1	1
		30	170	1	1
		31	180	1	1
		32	190	1	1
		4	200	1	1
		5	210	1	1
		6	220	1	1
		7	230	1	1
		8	240	1	1
		9	250	1	1

 

But so:

		1	10	1	1
		2	120	1	1
		3	160	1	1
		4	200	1	1
		5	210	1	1
		6	220	1	1
		7	230	1	1
		8	240	1	1
		9	250	1	1
		10	20	1	1
		11	30	1	1
		12	40	1	1
		13	50	1	1
		14	60	1	1
		15	70	1	1
		16	80	1	1
		17	90	1	1
		18	100	1	1
		19	110	1	1
		20	130	1	1
		21	140	1	1
		22	150	1	1
		30	170	1	1
		31	180	1	1
		32	190	1	1

 

This can be done?

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

      CRK - Cronikal [Play now][Official start on April 24, 2022 at 16:00][11 languages available]

    2. 57

      Forever Metin2

    3. 1

      NPC direct item enchant

    4. 37

      Official Mailbox

    5. 0

      [Request] Underground-MT2 Serverfiles, Database , Homepage & Client

    6. 0

      3 countries 3 phrases

    7. 1

      NPC direct item enchant

    8. 0

      Origins2 Global | International | A new concept - 10.06.2022

  • Recently Browsing

    • No registered users viewing this page.

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.