Jump to content

Shop Ex Renewal


Recommended Posts

  • 3 weeks later...
  • Honorable Member
On 9/8/2019 at 3:00 PM, Zeph said:

You added quest or something to open shop in npc?

 

On 9/8/2019 at 2:34 PM, displayjokes said:

Can you show me this function: bool CShopManager::Initialize(TShopTable * table, int size)

From your shop_manager.cpp in game>src please?


You must add the value 1 to OnClick column of your shop NPC in mob_proto.
Example:

PQg3Xaz.png

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

  • 2 weeks later...
  • 2 months later...
  • 1 month later...

I have a question, when i add costume weapon in shop, after buy item dissapering in equipment, i try add bonuses in shop_table_ex but then i have 2x same bonus, i added socket -1 but the same, what can i do?

 

Maybe you know what's wrong? @VegaS™ @Mali61

 

Propably i have to edit this code, but i don't know how.

 


#ifdef ENABLE_RENEWAL_SHOPEX
        char getval[256];
        for (int j = 0; j < ITEM_ATTRIBUTE_MAX_NUM; j++) {
            if (j < ITEM_SOCKET_MAX_NUM) {
                snprintf(getval,sizeof(getval), "socket%d", j);
                if (!pItemGroup->GetValue(i, getval, shopItems[i].alSockets[j])) {
                    sys_err("row(%d) stage %d of group items of group %s does not have socket column", i,j, pNode->GetNodeName().c_str());
                    return false;
                }
            }
            snprintf(getval,sizeof(getval), "attr_type%d", j);
            if (!pItemGroup->GetValue(i, getval, shopItems[i].aAttr[j].bType)) {
                sys_err("row(%d) stage %d of group items of group %s does not have attr_type column", i, j, pNode->GetNodeName().c_str());
                return false;
            }
            snprintf(getval,sizeof(getval), "attr_value%d", j);
            if (!pItemGroup->GetValue(i, getval, shopItems[i].aAttr[j].sValue)) {
                sys_err("row(%d) stage %d of group items of group %s does not have attr_value column", i, j, pNode->GetNodeName().c_str());
                return false;
            }
        }
        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;
            }
        }
#endif

[/spoiler]

Link to comment
Share on other sites

  • 4 weeks later...
  • 1 month later...

Good working system Thanks.

 

Just 1 Question. When i add item with time like Mount and add in socket0 slot Timevalue like 2592000 = 30d ->
 

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

How can i fix it ?

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

  • 2 weeks later...
  • Bronze
On 3/23/2020 at 9:54 PM, Chief said:

Good working system Thanks.

 

Just 1 Question. When i add item with time like Mount and add in socket0 slot Timevalue like 2592000 = 30d ->
 

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

How can i fix it ?

 You have to check item type and change socket0  data in source, because socket0 is a timestamp or you give a unix timestamp in the future. https://www.epochconverter.com/

 

Hi Guys, i have a problem i make something wrong,  i had bigger shop size ( 8x10) 

	pack2.owner_vid = owner_vid;
	pack2.shop_tab_count = m_vec_shopTabs.size();
	char temp[18108]; // ĂÖ´ë 1728 * 3
	char* buf = &temp[0];
	size_t size = 0;

So i enlarge the temp variable size, but i think this it wasn't the correct number ?

 

Because  client give me this error :

 

CPythonNetworkStream::CheckPacket - Not enough dynamic packet size: header 38 packet size: 18108 SYSERR: RECV< HEADER_GC_SHOP (4) SYSERR: bc 46 0a SYSERR: RECV< 199 (18104)

 

If anybody have idea what i make it wrong, pls help me. Thanks. Sorry for my bad english.

@Mali61 @VegaS

 

 

Edited by Metin2 Dev
Core X - External 2 Internal
  • Metin2 Dev 2

giphy.gif

Best regards, Arlinamid

Link to comment
Share on other sites

  • Honorable Member
On 3/23/2020 at 11:54 PM, Chief said:

Good working system Thanks.

 

Just 1 Question. When i add item with time like Mount and add in socket0 slot Timevalue like 2592000 = 30d ->
 

https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

How can i fix it ?

now it's fixed. if you don't add any (socket or attr), it's adding proto's (sockets or attrs)

....

for shop table size error:

if your tables.h doesn't have

#include "service.h"

add it.

And be careful about duplicate npcs (shop & shopex)

Edited by Metin2 Dev
Core X - External 2 Internal

 

Link to comment
Share on other sites

  • Honorable Member

Not sure where I could share this but here is a way to simply reload the ShopTableEx in-game.

In reply to @Chief, @CHMarvin, @thespeedy and a contribution to @masodikbela's & @Mali61 post.

 

 

Reload ShopTableEx

 

game/src/cmd_gm.cpp

Spoiler

/// 1.
// Add
#include "shop_manager.h"

/// 2.
// Search
		switch (LOWER(*arg1))

// Add above
		if (strstr(arg1, "shop_ex"))
		{
			char szShopTableExFileName[256];
			snprintf(szShopTableExFileName, sizeof(szShopTableExFileName),
				"%s/shop_table_ex.txt", LocaleService_GetBasePath().c_str());

			if (CShopManager::instance().ReloadShopTableEx(szShopTableExFileName))
				ch->ChatPacket(CHAT_TYPE_INFO, "Reloading ShopTableEx.");
			else
				ch->ChatPacket(CHAT_TYPE_INFO, "Failed to reload ShopTableEx.");

			return;
		}

 

game/src/shop_manager.cpp

Spoiler

/// 1.
// Search
bool CShopManager::ReadShopTableEx(const char* stFileName)

// Add above
bool CShopManager::ReloadShopTableEx(const char* stFileName)
{
	return ReadShopTableEx(stFileName, true);
}

/// 2.
// Search
bool CShopManager::ReadShopTableEx(const char* stFileName)

// Replace with
bool CShopManager::ReadShopTableEx(const char* stFileName, bool bReload)

/// 3.
// Search
	typedef std::multimap <DWORD, TShopTableEx> TMapNPCshop;
	TMapNPCshop map_npcShop;

// Add below
	if (bReload)
	{
		sys_log(0, "RELOADING ShopTableEx");
		map_npcShop.clear();
		m_map_pkShopByNPCVnum.clear();
		m_map_pkShop.clear();
	}

 

game/src/shop_manager.h

Spoiler

/// 1.
// Search
	void Destroy();

// Add below
	bool ReloadShopTableEx(const char* stFileName);

/// 2.
// Search
	bool ReadShopTableEx(const char* stFileName);

// Replace with
	bool ReadShopTableEx(const char* stFileName, bool bReload = false);

 

 

Result

 

https://metin2.download/picture/o46OU9SVu96fNAANCWZ2lTT1krtmT0r0/.gif

 

4f5c26dcf871788ee09bef14d3392a7b.gif

 

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

  • Honorable Member
23 hours ago, Owsap said:

Not sure where I could share this but here is a way to simply reload the ShopTableEx in-game.

In reply to @Chief, @CHMarvin, @thespeedy and a contribution to @masodikbela's & @Mali61 post.

thank you but those containers are using by normal shops too

18 hours ago, jeddawee said:

Thank you for the release it works perfectly ❤️  

 

 

hmm is there any way to make it through MySQL ( something like shop_ex and shop_item_ex ) ??

i think it would be better than .txt 

 

But this is shopex :)

 

Update:

*Added reload command

Edited by Mali61

 

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.