|
You last visited: Today at 15:02
Offline Shop duplicate bug
10/24/2017, 05:57
|
#1
|
elite*gold: 0
Join Date: Sep 2012
Posts: 127
Received Thanks: 14
|
Offline Shop duplicate bug
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?
void COfflineShopManager::RefreshUnsoldItems(LPCHARACTE R 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,attrt ype0,attrvalue0,attrtype1,attrvalue1,attrtype2,att rvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4, attrtype5,attrvalue5,attrtype6,attrvalue6,applytyp e0,applyvalue0,applytype1,applyvalue1,applytype2,a pplyvalue2,applytype3,applyvalue3,applytype4,apply value4,applytype5,applyvalue5,applytype6,applyvalu e6,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,attrt ype0,attrvalue0,attrtype1,attrvalue1,attrtype2,att rvalue2,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,socke t3,attrtype0,attrvalue0,attrtype1,attrvalue1,attrt ype2,attrvalue2,attrtype3,attrvalue3,attrtype4,att rvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6, applytype0,applyvalue0,applytype1,applyvalue1,appl ytype2,applyvalue2,applytype3,applyvalue3,applytyp e4,applyvalue4,applytype5,applyvalue5,applytype6,a pplyvalue6,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,socke t3,attrtype0,attrvalue0,attrtype1,attrvalue1,attrt ype2,attrvalue2,attrtype3,attrvalue3,attrtype4,att rvalue4,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,socke t3,socket4,attrtype0,attrvalue0,attrtype1,attrvalu e1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrt ype4,attrvalue4,attrtype5,attrvalue5,attrtype6,att rvalue6,applytype0,applyvalue0,applytype1,applyval ue1,applytype2,applyvalue2,applytype3,applyvalue3, applytype4,applyvalue4,applytype5,applyvalue5,appl ytype6,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,socke t3,socket4,attrtype0,attrvalue0,attrtype1,attrvalu e1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrt ype4,attrvalue4,attrtype5,attrvalue5,attrtype6,att rvalue6 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,socke t3,socket4,socket5,attrtype0,attrvalue0,attrtype1, attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalu e3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrt ype6,attrvalue6,applytype0,applyvalue0,applytype1, applyvalue1,applytype2,applyvalue2,applytype3,appl yvalue3,applytype4,applyvalue4,applytype5,applyval ue5,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,socke t3,socket4,socket5,attrtype0,attrvalue0,attrtype1, attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalu e3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrt ype6,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
|
|
|
10/25/2017, 14:18
|
#2
|
elite*gold: 544
Join Date: Sep 2016
Posts: 144
Received Thanks: 204
|
Quote:
Originally Posted by humanforu
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?
void COfflineShopManager::RefreshUnsoldItems(LPCHARACTE R 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,attrt ype0,attrvalue0,attrtype1,attrvalue1,attrtype2,att rvalue2,attrtype3,attrvalue3,attrtype4,attrvalue4, attrtype5,attrvalue5,attrtype6,attrvalue6,applytyp e0,applyvalue0,applytype1,applyvalue1,applytype2,a pplyvalue2,applytype3,applyvalue3,applytype4,apply value4,applytype5,applyvalue5,applytype6,applyvalu e6,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,attrt ype0,attrvalue0,attrtype1,attrvalue1,attrtype2,att rvalue2,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,socke t3,attrtype0,attrvalue0,attrtype1,attrvalue1,attrt ype2,attrvalue2,attrtype3,attrvalue3,attrtype4,att rvalue4,attrtype5,attrvalue5,attrtype6,attrvalue6, applytype0,applyvalue0,applytype1,applyvalue1,appl ytype2,applyvalue2,applytype3,applyvalue3,applytyp e4,applyvalue4,applytype5,applyvalue5,applytype6,a pplyvalue6,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,socke t3,attrtype0,attrvalue0,attrtype1,attrvalue1,attrt ype2,attrvalue2,attrtype3,attrvalue3,attrtype4,att rvalue4,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,socke t3,socket4,attrtype0,attrvalue0,attrtype1,attrvalu e1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrt ype4,attrvalue4,attrtype5,attrvalue5,attrtype6,att rvalue6,applytype0,applyvalue0,applytype1,applyval ue1,applytype2,applyvalue2,applytype3,applyvalue3, applytype4,applyvalue4,applytype5,applyvalue5,appl ytype6,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,socke t3,socket4,attrtype0,attrvalue0,attrtype1,attrvalu e1,attrtype2,attrvalue2,attrtype3,attrvalue3,attrt ype4,attrvalue4,attrtype5,attrvalue5,attrtype6,att rvalue6 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,socke t3,socket4,socket5,attrtype0,attrvalue0,attrtype1, attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalu e3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrt ype6,attrvalue6,applytype0,applyvalue0,applytype1, applyvalue1,applytype2,applyvalue2,applytype3,appl yvalue3,applytype4,applyvalue4,applytype5,applyval ue5,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,socke t3,socket4,socket5,attrtype0,attrvalue0,attrtype1, attrvalue1,attrtype2,attrvalue2,attrtype3,attrvalu e3,attrtype4,attrvalue4,attrtype5,attrvalue5,attrt ype6,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
|
Try to add "AND status=1" to the querys in offlineshop_manager.cpp at "void COfflineShopManager::TakeItem(LPCHARACTER ch, BYTE bPos)"
second method (not tested)
open input_main.cpp and edit:
Code:
case SHOP_SUBHEADER_CG_TAKE_ITEM:
{
if (uiBytes < sizeof(BYTE))
return -1;
BYTE bPos = *c_pData;
sys_log(0, "INPUT: %s OFFLINE_SHOP_TAKE_ITEM", ch->GetName());
COfflineShopManager::instance().TakeItem(ch, bPos);
return (sizeof(BYTE));
}
to
Code:
case SHOP_SUBHEADER_CG_TAKE_ITEM:
{
if (uiBytes < sizeof(BYTE))
return -1;
BYTE bPos = *c_pData;
if (!COfflineShopManager::instance().HasOfflineShop(ch)){
sys_log(0, "INPUT: %s OFFLINE_SHOP_TAKE_ITEM", ch->GetName());
COfflineShopManager::instance().TakeItem(ch, bPos);
}
return (sizeof(BYTE));
}
and
Code:
case SHOP_SUBHEADER_CG_REFRESH_UNSOLD_ITEMS:
{
sys_log(0, "INPUT: %s OFFLINE_SHOP_REFRESH_UNSOLD_ITEMS", ch->GetName());
COfflineShopManager::instance().RefreshUnsoldItems(ch);
return 0;
}
to
Code:
case SHOP_SUBHEADER_CG_REFRESH_UNSOLD_ITEMS:
{
if (!COfflineShopManager::instance().HasOfflineShop(ch)){
sys_log(0, "INPUT: %s OFFLINE_SHOP_REFRESH_UNSOLD_ITEMS", ch->GetName());
COfflineShopManager::instance().RefreshUnsoldItems(ch);
}
return 0;
}
|
|
|
10/26/2017, 06:33
|
#3
|
elite*gold: 0
Join Date: Sep 2012
Posts: 127
Received Thanks: 14
|
Quote:
Originally Posted by GucciMane.
Try to add "AND status=1" to the querys in offlineshop_manager.cpp at "void COfflineShopManager::TakeItem(LPCHARACTER ch, BYTE bPos)"
second method (not tested)
open input_main.cpp and edit:
Code:
case SHOP_SUBHEADER_CG_TAKE_ITEM:
{
if (uiBytes < sizeof(BYTE))
return -1;
BYTE bPos = *c_pData;
sys_log(0, "INPUT: %s OFFLINE_SHOP_TAKE_ITEM", ch->GetName());
COfflineShopManager::instance().TakeItem(ch, bPos);
return (sizeof(BYTE));
}
to
Code:
case SHOP_SUBHEADER_CG_TAKE_ITEM:
{
if (uiBytes < sizeof(BYTE))
return -1;
BYTE bPos = *c_pData;
if (!COfflineShopManager::instance().HasOfflineShop(ch)){
sys_log(0, "INPUT: %s OFFLINE_SHOP_TAKE_ITEM", ch->GetName());
COfflineShopManager::instance().TakeItem(ch, bPos);
}
return (sizeof(BYTE));
}
and
Code:
case SHOP_SUBHEADER_CG_REFRESH_UNSOLD_ITEMS:
{
sys_log(0, "INPUT: %s OFFLINE_SHOP_REFRESH_UNSOLD_ITEMS", ch->GetName());
COfflineShopManager::instance().RefreshUnsoldItems(ch);
return 0;
}
to
Code:
case SHOP_SUBHEADER_CG_REFRESH_UNSOLD_ITEMS:
{
if (!COfflineShopManager::instance().HasOfflineShop(ch)){
sys_log(0, "INPUT: %s OFFLINE_SHOP_REFRESH_UNSOLD_ITEMS", ch->GetName());
COfflineShopManager::instance().RefreshUnsoldItems(ch);
}
return 0;
}
|
Thanks dude i already added status = 1 and its solved anyway thanks for this coding
|
|
|
All times are GMT +2. The time now is 15:02.
|
|