Jump to content

Shop Ex Renewal


Recommended Posts

I saw you updated the whole code of the system.

 

I have error compiling with this part :

 

https://gyazo.com/235a4eb21016fa5f8a348692f3d73e90

#ifdef ENABLE_RENEWAL_SHOPEX
	{
		std::unordered_set<CShop*> v;
		// include unordered_set
		auto ExDelete = [&v](TShopMap& c) {
			for (auto it = c.begin(); !c.empty() && it != c.end();) {
				const auto shop = it->second;
				if (shop && shop->IsShopEx()) {
					it = c.erase(it);
					v.insert(shop);
				}
				else
					++it;
			}
		};
		ExDelete(m_map_pkShopByNPCVnum);
		ExDelete(m_map_pkShop);
		for (const auto& del : v)
			delete del;
	}
#endif

What do you mean with include unordered set ?
I try to #include "<boost>unordered_set.hpp" but that does not work so far.

 

 

Edited by Chief
Link to post
  • Replies 65
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

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: Hidden Content Give reaction to this post to see the hidden content.  

M2 Download Center Download Here ( Internal ) Download Here ( GitHub )   Anyway now you can sell shop items with sockets and attrs at shopex. New price types. New sorting options Every Item can have different price type. price_type: 1:Gold 2:Second Coin 3:Item 4:EXP sort: Asc,Desc,Vnum,Price,Name,Type  

8: your shit files

Posted Images

57 minutes ago, Owsap said:

@Chief you should show us the error you are having, try to change 

std::unordered_set<CShop*> v;

 ↓

 

boost::unordered_set<CShop*> v;

 

Edited post.

 

 

Don´t work.

 

https://gyazo.com/5b43ecf7a6f070278aea0090e1bb4335

 

Added :

#include <boost/unordered_set.hpp> to shop_manager.cpp

 

Now i get

 

SYSERR: Apr 23 17:28:12 :: Boot: shop table size error

Edit: didn´t recompiled whole src.

 

Sooo after that all , shop is empty:

 

https://gyazo.com/bc9e12a7d422c819addc64c4f743a9ce

But thanks @Owsap

 

Edited by Chief
Link to post
  • 3 months later...

Have a other problem.

He use to show items: 
CShopEx::AddGuest()
But when i buy something, he use:
pkShop->Buy()

This Buy is shop.cpp and not shopex.cpp

So the Buy of shop.cpp does not know the items from shopex.

So everytime m_itemVector.size() = 0

And so i cant buy items on shopex

Edited by V0lvox
Link to post
  • 2 weeks later...

SYSERR: Aug 18 08:48:50 :: pid_init: 
Start of pid: 5058

SYSERR: Aug 18 08:48:51 :: Boot: shop table size error
SYSERR: Aug 18 08:48:51 :: SpawnEventHelper: cannot get map base position 1
SYSERR: Aug 18 08:48:51 :: SpawnEventHelper: cannot get map base position 3
SYSERR: Aug 18 08:48:51 :: SpawnEventHelper: cannot get map base position 21
SYSERR: Aug 18 08:48:51 :: SpawnEventHelper: cannot get map base position 23
SYSERR: Aug 18 08:48:51 :: SpawnEventHelper: cannot get map base position 41
SYSERR: Aug 18 08:48:51 :: SpawnEventHelper: cannot get map base position 43
SYSERR: Aug 18 08:48:51 :: pid_deinit: 
End of pid

 

Where its the problem ? =(

Link to post
2 hours ago, [email protected] said:

SYSERR: Aug 18 08:48:50 :: pid_init: 
Start of pid: 5058

SYSERR: Aug 18 08:48:51 :: Boot: shop table size error
SYSERR: Aug 18 08:48:51 :: SpawnEventHelper: cannot get map base position 1
SYSERR: Aug 18 08:48:51 :: SpawnEventHelper: cannot get map base position 3
SYSERR: Aug 18 08:48:51 :: SpawnEventHelper: cannot get map base position 21
SYSERR: Aug 18 08:48:51 :: SpawnEventHelper: cannot get map base position 23
SYSERR: Aug 18 08:48:51 :: SpawnEventHelper: cannot get map base position 41
SYSERR: Aug 18 08:48:51 :: SpawnEventHelper: cannot get map base position 43
SYSERR: Aug 18 08:48:51 :: pid_deinit: 
End of pid

 

Where its the problem ? =(

Boot: shop table size error

there

Link to post
  • 4 months later...
  • 2 weeks later...

Problem with socket0 (item time)

 

I tried to put in 30 days, but it didn't work, so I took the full timestamp and it worked, however, time goes on, even in the store

 

Can anyone help me fix:


- Add in socket0 only 2592000 for 30 days, not "1615058951"
- Time does not count while the item is in the store

  • Think 1
Link to post

For anyone who wants to reload 'shopex' & 'shopex_item' using /reload p

(works on the db/mysql version only)

1. You must have this

2. game/src

input_db.cpp

Spoiler


In void CInputDB::ReloadProto(const char * c_pData) search for:
 

    /*

    * SHOP

    */

 

    wSize = decode_2bytes(c_pData);

    c_pData += sizeof(WORD);

    sys_log(0, "RELOAD: SHOP: %d", wSize);


 

    if (wSize)

    {

        CShopManager::instance().Initialize((TShopTable *)c_pData, wSize);

        c_pData += wSize * sizeof(TShopTable);

    }

Add below:
 

    /*

    * SHOPEX

    */

 

    wSize = decode_2bytes(c_pData);

    c_pData += sizeof(WORD);

    sys_log(0, "RELOAD: SHOPEX: %d", wSize);

 

    if (wSize)

    {

        CShopManager::instance().InitializeShopEX((TShopTable *)c_pData, wSize);

        c_pData += wSize * sizeof(TShopTable);

    }

 

3. db/src

 

ClientManager.cpp

Spoiler

 

In void CClientManager::QUERY_RELOAD_PROTO() search for:

 

                sizeof(WORD) + sizeof(TShopTable) * m_iShopTableSize +

 

Add below:

 

                #if defined(ENABLE_RENEWAL_SHOPEX)

                sizeof(WORD) + sizeof(TShopTable) * m_iShopEXTableSize +

                #endif

 

Search:
 

        tmp->EncodeWORD(m_iShopTableSize);

        tmp->Encode(m_pShopTable, sizeof(TShopTable) * m_iShopTableSize);

 

Add below:

 

#if defined(ENABLE_RENEWAL_SHOPEX)

        tmp->EncodeWORD(m_iShopEXTableSize);

        tmp->Encode(m_pShopEXTable, sizeof(TShopTable) * m_iShopEXTableSize);

#endif

 


And that's it

Proof

https://imgur.com/a/Aua1FXj

Edited by lucaluca
Added Proof
  • Good 2
Link to post
  • Honorable Member
On 2/1/2021 at 11:16 PM, Klaus said:

Problem with socket0 (item time)

 

I tried to put in 30 days, but it didn't work, so I took the full timestamp and it worked, however, time goes on, even in the store

 

Can anyone help me fix:


- Add in socket0 only 2592000 for 30 days, not "1615058951"
- Time does not count while the item is in the store

Hey, I made a little change.

If you want to use item with limit times, don't change sockets. Let it be 0 (it will use item_proto's time)

  • Love 1
  • Good 2

I'll be offline for a few months🌛

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.




Shoutbox

Shoutbox

Chatroom Rules

 

Join our Discord

A request for help = Shoutbox Ban

Be respectful & Respect the rules

 

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