Jump to content

Cannot Find Item - Visual Bug Shop Offline Add/Remove item /Change Price


Recommended Posts

  • Premium

Hello i have a visual bug with Shop Offline , when someone try to add or remove item , change price in Shop Offline , it's bugged like in photo , and they need to close shop and remake him.

dovadashopoff.jpg

I think it's something from client src or root . Or is because i have 40x Slot Max in Original Shop and Inventory , and in Offline Shop 120x Slots ?

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

  • Active+ Member

In offlineshop_manager.cpp replace Refresh function with that:

Spoiler

void COfflineShopManager::Refresh(LPCHARACTER ch)
{
	if (!ch) return;

	LPCHARACTER npc = CHARACTER_MANAGER::Instance().Find(FindMyOfflineShop(ch->GetPlayerID()));
	if (npc)
	{
		LPOFFLINESHOP pkOfflineShop = npc->GetOfflineShop();
		if (!pkOfflineShop)
			return;

		pkOfflineShop->Refresh(ch);
		return;
	}

	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];
	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 "
#ifdef USE_LENTS_SHOULDER_SASH
		", applytype0, applyvalue0, "
		"applytype1, applyvalue1, "
		"applytype2, applyvalue2, "
		"applytype3, applyvalue3, "
		"applytype4, applyvalue4, "
		"applytype5, applyvalue5, "
		"applytype6, applyvalue6, "
		"applytype7, applyvalue7 "
#endif
		"FROM %soffline_shop_item WHERE owner_id = %u and status = 0", get_table_postfix(), ch->GetPlayerID());

	std::auto_ptr<SQLMsg> pMsg(DBManager::Instance().DirectQuery(szQuery));
	if (pMsg->Get()->uiNumRows == 0)
		memset(&pack2, 0, sizeof(pack2));
	else
	{
		for (int i = 0; i < mysql_num_rows(pMsg->Get()->pSQLResult); ++i)
		{
			MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);
			int cur = 0;

			BYTE bPos = 0;
			str_to_number(bPos, row[cur++]);

			str_to_number(pack2.items[bPos].count, row[cur++]);
			str_to_number(pack2.items[bPos].vnum, row[cur++]);
			str_to_number(pack2.items[bPos].price, row[cur++]);

			for (BYTE j = 0; j < ITEM_SOCKET_MAX_NUM; j++) str_to_number(pack2.items[bPos].alSockets[j], row[cur++]);
			for (BYTE n = 0; n < ITEM_ATTRIBUTE_MAX_NUM; n++)
			{
				str_to_number(pack2.items[bPos].aAttr[n].bType, row[cur++]);
				str_to_number(pack2.items[bPos].aAttr[n].sValue, row[cur++]);
			}
		}
	}

	pack.size = sizeof(pack) + sizeof(pack2);

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

 

 

  • Love 2
Link to comment
Share on other sites

15 hours ago, Abel(Tiger) said:

In offlineshop_manager.cpp replace Refresh function with that:

  Reveal hidden contents


void COfflineShopManager::Refresh(LPCHARACTER ch)
{
	if (!ch) return;

	LPCHARACTER npc = CHARACTER_MANAGER::Instance().Find(FindMyOfflineShop(ch->GetPlayerID()));
	if (npc)
	{
		LPOFFLINESHOP pkOfflineShop = npc->GetOfflineShop();
		if (!pkOfflineShop)
			return;

		pkOfflineShop->Refresh(ch);
		return;
	}

	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];
	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 "
#ifdef USE_LENTS_SHOULDER_SASH
		", applytype0, applyvalue0, "
		"applytype1, applyvalue1, "
		"applytype2, applyvalue2, "
		"applytype3, applyvalue3, "
		"applytype4, applyvalue4, "
		"applytype5, applyvalue5, "
		"applytype6, applyvalue6, "
		"applytype7, applyvalue7 "
#endif
		"FROM %soffline_shop_item WHERE owner_id = %u and status = 0", get_table_postfix(), ch->GetPlayerID());

	std::auto_ptr<SQLMsg> pMsg(DBManager::Instance().DirectQuery(szQuery));
	if (pMsg->Get()->uiNumRows == 0)
		memset(&pack2, 0, sizeof(pack2));
	else
	{
		for (int i = 0; i < mysql_num_rows(pMsg->Get()->pSQLResult); ++i)
		{
			MYSQL_ROW row = mysql_fetch_row(pMsg->Get()->pSQLResult);
			int cur = 0;

			BYTE bPos = 0;
			str_to_number(bPos, row[cur++]);

			str_to_number(pack2.items[bPos].count, row[cur++]);
			str_to_number(pack2.items[bPos].vnum, row[cur++]);
			str_to_number(pack2.items[bPos].price, row[cur++]);

			for (BYTE j = 0; j < ITEM_SOCKET_MAX_NUM; j++) str_to_number(pack2.items[bPos].alSockets[j], row[cur++]);
			for (BYTE n = 0; n < ITEM_ATTRIBUTE_MAX_NUM; n++)
			{
				str_to_number(pack2.items[bPos].aAttr[n].bType, row[cur++]);
				str_to_number(pack2.items[bPos].aAttr[n].sValue, row[cur++]);
			}
		}
	}

	pack.size = sizeof(pack) + sizeof(pack2);

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

 

 

Thx you Abel, is working great xD

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.