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://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

#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 Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 2
  • Confused 1
Link to comment
Share on other sites

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://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

 

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://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

But thanks @Owsap

 

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

  • 3 months later...
  • Active Member

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 comment
Share on other sites

  • 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 comment
Share on other sites

  • Active Member
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 comment
Share on other sites

  • 4 months later...
  • 2 weeks later...
  • Active Member

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 comment
Share on other sites

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

Spoiler

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

  • 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)

  • Good 2
  • Love 1

 

Link to comment
Share on other sites

  • 1 month later...
  • Active+ Member

Hi again, i conclude that, normal shops can be oppened,

9001 can't open but doesnt do core.crash

9002 can't open and do core.crash,

any idea??

 

#0  0x0060ab78 in std::__1::operator==<SShopTableEx*, SShopTableEx*> (__x=..., __y=...)
    at /usr/include/c++/v1/iterator:1506
No locals.
#1  std::__1::operator!=<SShopTableEx*> (__x=..., __y=...) at /usr/include/c++/v1/iterator:1558
No locals.
#2  CShopEx::AddGuest (this=0x0, ch=<optimized out>, owner_vid=0, bOtherEmpire=<optimized out>)
    at shopEx.cpp:75
        it = {__i = 0x23138af8}
        pack = {header = 38 '&', size = 39769, subheader = 10 '\n'}
        pack2 = {owner_vid = 62200, shop_tab_count = 3 '\003'}
        temp = "ARMOR\000\000\000\000\000\000\000\000\000\000>\000\000\000h\214\377\377?\252\027\001\000\000\001\000\000\000\311+\000\000\250a\000\000\000\000\000\000\001", '\000' <repeats 47 times>, "\001\000\000\000\000#,\000\000\372\000\000\000\000\000\000\000\001\000\270", '\000' <repeats 27 times>, "\001\320\a", '\000' <repeats 15 times>, "\001", '\000' <repeats 83 times>...
        size = 10466
        buf = 0xffffac92 "\202\"\240$\252!\345\003"
#3  0x00000000 in ?? ()
No symbol table info available.
 

Edited by Doose
Link to comment
Share on other sites

  • 2 weeks later...

gmake: *** [Makefile:183: .obj/shopEx.o] Error 1
root@jailsrc:/source/Server/game/src # gmake -j2
compiling shopEx.cpp
shopEx.cpp: In member function 'virtual bool CShopEx::AddGuest(LPCHARACTER, DWORD, bool)':
shopEx.cpp:125:17: error: qualified-id in declaration before '(' token
  125 | int CShopEx::Buy(LPCHARACTER ch, BYTE pos)
      |                 ^
shopEx.cpp:292:34: error: expected '}' at end of input
  292 |     return (SHOP_SUBHEADER_GC_OK);
      |                                  ^
shopEx.cpp:47:1: note: to match this '{'
   47 | {
      | ^
shopEx.cpp:292:34: warning: control reaches end of non-void function [-Wreturn-type]
  292 |     return (SHOP_SUBHEADER_GC_OK);
 

Any ideea?

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...
  • Premium
32 minutes ago, TysonDMG said:

SYSERR: Jun 14 05:26:29 :: InitializeShopEX: Shop vnum(11) already exists.
SYSERR: Jun 14 05:26:29 :: Boot: shopex table Initialize error

help, please?

You need use an vnum id that not exists already

Edited by DemOnJR

plague.png.1f5de75b42146262dcd655a5a8078

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.