Jump to content

Offline Shop duplicate bug


Go to solution Solved by Abel(Tiger),

Recommended Posts

Hello there , 
I have a bug of duplication in offline shop.
a players duplicates items using ken offline shop with refresh unsold items
*  i just need one command or coding that is if offline shop is opened that refresh unsold items must not allow items to remove that's it
or
* refresh unsold item box must not open  when offline shop is opened and also if refresh unsold box is opened  then offline shop should not be created
can anyone made coding for that so it will avoid that duplication?
https://metin2.download/picture/r3F9504x09DVmF8K988YXgTtGTP6KMUj/.gif

Spoiler


void COfflineShopManager::RefreshUnsoldItems(LPCHARACTER ch)
{
    TPacketGCShop pack;
    pack.header = HEADER_GC_OFFLINE_SHOP;
    pack.subheader = SHOP_SUBHEADER_GC_UPDATE_ITEM2;

    TPacketGCOfflineShopStart pack2;
    memset(&pack2, 0, sizeof(pack2));
    pack2.owner_vid = 0;

    char szQuery[1024];
    if (g_bOfflineShopSocketMax == 3)
#ifdef USE_LENTS_SHOULDER_SASH
        snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,price,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6,applytype0,applyvalue0,applytype1,applyvalue1,applytype2,applyvalue2,applytype3,applyvalue3,applytype4,applyvalue4,applytype5,applyvalue5,applytype6,applyvalue6,applytype7,applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u and status = 1", get_table_postfix(), ch->GetPlayerID());
#else        
        snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,price,socket0,socket1,socket2,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6 FROM %soffline_shop_item WHERE owner_id = %u and status = 1", get_table_postfix(), ch->GetPlayerID());
#endif    
    else if (g_bOfflineShopSocketMax == 4)
#ifdef USE_LENTS_SHOULDER_SASH
        snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,price,socket0,socket1,socket2,socket3,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6,applytype0,applyvalue0,applytype1,applyvalue1,applytype2,applyvalue2,applytype3,applyvalue3,applytype4,applyvalue4,applytype5,applyvalue5,applytype6,applyvalue6,applytype7,applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u and status = 1", get_table_postfix(), ch->GetPlayerID());
#else        
        snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,price,socket0,socket1,socket2,socket3,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6 FROM %soffline_shop_item WHERE owner_id = %u and status = 1", get_table_postfix(), ch->GetPlayerID());
#endif    
    else if (g_bOfflineShopSocketMax == 5)
#ifdef USE_LENTS_SHOULDER_SASH
        snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,price,socket0,socket1,socket2,socket3,socket4,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6,applytype0,applyvalue0,applytype1,applyvalue1,applytype2,applyvalue2,applytype3,applyvalue3,applytype4,applyvalue4,applytype5,applyvalue5,applytype6,applyvalue6,applytype7,applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u and status = 1", get_table_postfix(), ch->GetPlayerID());
#else
        snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,price,socket0,socket1,socket2,socket3,socket4,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6 FROM %soffline_shop_item WHERE owner_id = %u and status = 1", get_table_postfix(), ch->GetPlayerID());
#endif    
    else if (g_bOfflineShopSocketMax == 6)
#ifdef USE_LENTS_SHOULDER_SASH
        snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,price,socket0,socket1,socket2,socket3,socket4,socket5,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6,applytype0,applyvalue0,applytype1,applyvalue1,applytype2,applyvalue2,applytype3,applyvalue3,applytype4,applyvalue4,applytype5,applyvalue5,applytype6,applyvalue6,applytype7,applyvalue7 FROM %soffline_shop_item WHERE owner_id = %u and status = 1", get_table_postfix(), ch->GetPlayerID());
#else        
        snprintf(szQuery, sizeof(szQuery), "SELECT pos,count,vnum,price,socket0,socket1,socket2,socket3,socket4,socket5,attrtype0,attrvalue0,attrtype1,attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6 FROM %soffline_shop_item WHERE owner_id = %u and status = 1", get_table_postfix(), ch->GetPlayerID());
#endif    

    std::auto_ptr<SQLMsg> pMsg(DBManager::instance().DirectQuery(szQuery));

    MYSQL_ROW row;
    while (NULL != (row = mysql_fetch_row(pMsg->Get()->pSQLResult)))
    {
        BYTE bPos = 0;
        str_to_number(bPos, row[0]);

        str_to_number(pack2.items[bPos].count, row[1]);
        str_to_number(pack2.items[bPos].vnum, row[2]);
        str_to_number(pack2.items[bPos].price, row[3]);

        DWORD alSockets[ITEM_SOCKET_MAX_NUM];
        for (int i = 0, n = 4; i < ITEM_SOCKET_MAX_NUM; ++i, n++)
            str_to_number(alSockets, row[n]);

        TPlayerItemAttribute aAttr[ITEM_ATTRIBUTE_MAX_NUM];
        for (int i = 0, iStartType = 7, iStartValue = 8; i < ITEM_ATTRIBUTE_MAX_NUM; ++i, iStartType += 2, iStartValue += 2)
        {
            str_to_number(aAttr.bType, row[iStartType]);
            str_to_number(aAttr.sValue, row[iStartValue]);
        }

        thecore_memcpy(pack2.items[bPos].alSockets, alSockets, sizeof(pack2.items[bPos].alSockets));
        thecore_memcpy(pack2.items[bPos].aAttr, aAttr, sizeof(pack2.items[bPos].aAttr));
    }

    pack.size = sizeof(pack) + sizeof(pack2);
    
    if (ch->GetDesc())
    {
        ch->GetDesc()->BufferedPacket(&pack, sizeof(TPacketGCShop));
        ch->GetDesc()->Packet(&pack2, sizeof(TPacketGCOfflineShopStart));
    }
}

 


Will be happy if anyone helps 

regards 

Hawk 

pictre.jpg

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

  • Active+ Member
  • Solution

This bug is old =) Very old. 

In :

void COfflineShopManager::TakeItem(LPCHARACTER ch, BYTE bPos)

Search:

"FROM %soffline_shop_item WHERE owner_id = %u and pos = %d", get_table_postfix(), ch->GetPlayerID(), bPos);

Replace with:

"FROM %soffline_shop_item WHERE owner_id = %u and pos = %d and status = 1", get_table_postfix(), ch->GetPlayerID(), bPos);

  • Love 1
Link to comment
Share on other sites

4 hours ago, Abel(Tiger) said:

This bug is old =) Very old. 

In :

void COfflineShopManager::TakeItem(LPCHARACTER ch, BYTE bPos)

Search:

"FROM %soffline_shop_item WHERE owner_id = %u and pos = %d", get_table_postfix(), ch->GetPlayerID(), bPos);

Replace with:

"FROM %soffline_shop_item WHERE owner_id = %u and pos = %d and status = 1", get_table_postfix(), ch->GetPlayerID(), bPos);

Thanks dude its works 
close the thread please :)

Link to comment
Share on other sites

  • 2 years later...

no work WARNING!!

I FIX THAT AND THE OTHER METHODS AND CAN DUPLICATE 

DELETE KEN OFFLINE SHOP

can duplicate 100% sure

Dec 21 14:00:05 :: QUEST [REWARD] nameplayer give exp2 0
Dec 21 14:00:05 :: QUEST timer name erfahrung cycle 25 pc 213 npc 4294967295 loop? 0
Dec 21 14:00:05 :: QUEST add timer 0x33d8d280 2
Dec 21 14:00:05 :: QUEST remove with no cancel 0x33fb4220

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

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.