Mali61

c++ [RLS]Shop EX Renewal

34 posts in this topic

After 

		if (pItemGroup->GetValue(i, "price_type", shopItems[i].price_type) && pItemGroup->GetValue(i, "price_vnum", shopItems[i].price_vnum) && shopItems[i].price_type == 3) {
			if (shopItems[i].price_type > 4 || shopItems[i].price_type < 1) {
				sys_err("row(%d) of group items of group %s price_type is wrong!", i, pNode->GetNodeName().c_str());
				return false;
			}
			TItemTable * pProto = ITEM_MANAGER::instance().GetTable(shopItems[i].price_vnum);
			if (!pProto) {
				sys_err("NOT GET ITEM PROTO %d", shopItems[i].price_vnum);
				return false;
			}
		}

 

You can add this to clean the memory

 

memset(&getval, 0, sizeof(getval));

 

Share this post


Link to post
Share on other sites
19 minutes ago, ManiacRobert said:

After 


		if (pItemGroup->GetValue(i, "price_type", shopItems[i].price_type) && pItemGroup->GetValue(i, "price_vnum", shopItems[i].price_vnum) && shopItems[i].price_type == 3) {
			if (shopItems[i].price_type > 4 || shopItems[i].price_type < 1) {
				sys_err("row(%d) of group items of group %s price_type is wrong!", i, pNode->GetNodeName().c_str());
				return false;
			}
			TItemTable * pProto = ITEM_MANAGER::instance().GetTable(shopItems[i].price_vnum);
			if (!pProto) {
				sys_err("NOT GET ITEM PROTO %d", shopItems[i].price_vnum);
				return false;
			}
		}

 

You can add this to clean the memory

 


memset(&getval, 0, sizeof(getval));

 

not necessary

Share this post


Link to post
Share on other sites

I am glad you added new prices as i said in your last topic

Great work

 

Just one thing to ask , in shopex is there a way to make the shop gui extend height if there are more choices let's say like : ARMOR-ITEMS-WEAPONS...etc so it look good

  • Like 1

Share this post


Link to post
Share on other sites

#New sorting options added:

sort: Asc,Desc,Vnum,Price,Name,Type

----------

21 hours ago, MrQuin said:

I am glad you added new prices as i said in your last topic

Great work

 

Just one thing to ask , in shopex is there a way to make the shop gui extend height if there are more choices let's say like : ARMOR-ITEMS-WEAPONS...etc so it look good

You are looking for:

Spoiler

asd.png

Don't forget the change SHOP_TAB_COUNT_MAX from Server/length.h and Client/Packet.h

  • Like 1

Share this post


Link to post
Share on other sites
vor 2 Stunden schrieb Mali61:

#New sorting options added:


sort: Asc,Desc,Vnum,Price,Name,Type

----------

You are looking for:

  Inhalt unsichtbar machen

asd.png

Don't forget the change SHOP_TAB_COUNT_MAX from Server/length.h and Client/Packet.h

Cant see the picture

Share this post


Link to post
Share on other sites
2 minutes ago, Dalí said:

this happens when freelancers are better than "developers". Good job mate!

I never had such a claim but thanks 😅

Share this post


Link to post
Share on other sites

expected primary-expression before '['token on shop manager line 534

line 534


std::sort(shopItems.begin(), shopItems.end(), [stSort](const TShopItemTable& i1, const TShopItemTable& i2)


full line


#ifdef ENABLE_RENEWAL_SHOPEX
else {
std::sort(shopItems.begin(), shopItems.end(), [stSort](const TShopItemTable& i1, const TShopItemTable& i2)
{
TItemTable* lItem = ITEM_MANAGER::instance().GetTable(i1.vnum);
TItemTable* rItem = ITEM_MANAGER::instance().GetTable(i2.vnum);
if (stSort == "Vnum")
return i1.vnum > i2.vnum;
else if (stSort == "Price")
return i1.price > i2.price;
else if (stSort == "Name" && lItem && rItem)
return strcmp(lItem->szLocaleName, rItem->szLocaleName) < 0;
else if (stSort == "Type" && lItem && rItem)
return lItem->bType > rItem->bType;
});
}
#endif

 

@VegaS™  do you know how to solve?

Share this post


Link to post
Share on other sites
40 minutes ago, Thundernatsu said:

expected primary-expression before '['token on shop manager line 534
line 534
std::sort(shopItems.begin(), shopItems.end(), [stSort](const TShopItemTable& i1, const TShopItemTable& i2)

Lambda expressions (since C++11), you need CFLAG += -std=c++11, if you want to do it without, then you've to do something like this:

  • shop_manager.cpp

1.1 Search for:

Spoiler

bool CompareShopItemName(const SShopItemTable& lhs, const SShopItemTable& rhs)
{
	TItemTable* lItem = ITEM_MANAGER::instance().GetTable(lhs.vnum);
	TItemTable* rItem = ITEM_MANAGER::instance().GetTable(rhs.vnum);
	if (lItem && rItem)
		return strcmp(lItem->szLocaleName, rItem->szLocaleName) < 0;
	else
		return true;
}

1.2 Add after:

Spoiler

#ifdef ENABLE_RENEWAL_SHOPEX
bool CompareShopItemVnum(const SShopItemTable& lhs, const SShopItemTable& rhs)
{
	return lhs.vnum > rhs.vnum;
}

bool CompareShopItemPrice(const SShopItemTable& lhs, const SShopItemTable& rhs)
{
	return lhs.price > rhs.price;
}

bool CompareShopItemType(const SShopItemTable& lhs, const SShopItemTable& rhs)
{
	const TItemTable * lItem = ITEM_MANAGER::instance().GetTable(lhs.vnum);
	const TItemTable * rItem = ITEM_MANAGER::instance().GetTable(rhs.vnum);
	return (lItem && rItem) ? lItem->bType > rItem->bType : true;
}
#endif

 

2.1 Search for:

Spoiler

#ifdef ENABLE_RENEWAL_SHOPEX
	else {
		std::sort(shopItems.begin(), shopItems.end(), [stSort](const TShopItemTable& i1, const TShopItemTable& i2) 
		{
			TItemTable* lItem = ITEM_MANAGER::instance().GetTable(i1.vnum);
			TItemTable* rItem = ITEM_MANAGER::instance().GetTable(i2.vnum);
			if (stSort == "Vnum")
				return i1.vnum > i2.vnum;
			else if (stSort == "Price")
				return i1.price > i2.price;
			else if (stSort == "Name" && lItem && rItem)
				return strcmp(lItem->szLocaleName, rItem->szLocaleName) < 0;
			else if (stSort == "Type" && lItem && rItem)
				return lItem->bType > rItem->bType;
		});
	}
#endif

 

2.2 Replace with:

Spoiler

#ifdef ENABLE_RENEWAL_SHOPEX
	else if (boost::iequals(stSort, "Vnum"))
		std::sort(shopItems.begin(), shopItems.end(), CompareShopItemVnum);
	else if (boost::iequals(stSort, "Price"))
		std::sort(shopItems.begin(), shopItems.end(), CompareShopItemPrice);
	else if (boost::iequals(stSort, "Name"))
		std::sort(shopItems.begin(), shopItems.end(), CompareShopItemName);
	else if (boost::iequals(stSort, "Type"))
		std::sort(shopItems.begin(), shopItems.end(), CompareShopItemType);
#endif

 

 

 

  • Like 2

Share this post


Link to post
Share on other sites

Hey, i installed the system but when i'm in game i try to open the shop and nothing happens.

Shop does not open and syserrs are clean.

 

Edit: Normal Shops works fine 😕

Edited by displayjokes

Share this post


Link to post
Share on other sites
23 godziny temu, displayjokes napisał:

Hey, i installed the system but when i'm in game i try to open the shop and nothing happens.

Shop does not open and syserrs are clean.

 

Edit: Normal Shops works fine 😕

I have the same problem :(

Share this post


Link to post
Share on other sites
5 hours ago, Zeph said:

I have the same problem :(

I've tested a lot of things and that happens everytime, i even tried to open the shop with quest, but it seems like it's not there the shop at all, only the file is beeing loaded because it gave me conflicts with same npc that had shops

Share this post


Link to post
Share on other sites
15 minut temu, displayjokes napisał:

I've tested a lot of things and that happens everytime, i even tried to open the shop with quest, but it seems like it's not there the shop at all, only the file is beeing loaded because it gave me conflicts with same npc that had shops

We have to wait for solution i think.

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.