Jump to content

Offline Shop duplicate bug


birender
 Share

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?
 

http://prntscr.com/h17odw

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 

 

IMG_23102017_213829_0.png

Edited by birender
  • Like 1
Link to comment
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
 Share

×
×
  • Create New...