Jump to content

Someone can modify this?


Recommended Posts

How i can modify this from:

/search_in_shops (VNUM)   ex /search_in_shops 189

in...

/search_in_shops (VNUM) (ITEM-ID-from shop table)   ex /search_in_shops 189 50

To not find all items with vnum just one item with specified id.

 

struct FSearch
{
	FSearch(LPCHARACTER ch, int Vnum) : m_ch(ch), itemVnum(Vnum)
	{
	}
	void operator () (LPENTITY ent)
	{
		if (ent->IsType(ENTITY_CHARACTER))
		{
			LPCHARACTER ch = (LPCHARACTER) ent;

			if (ch->GetRaceNum() !>= 30000 && GetRaceNum() <= 30007) //umutk kaşmir
				return;
			char szQuery[1024];
			sprintf(szQuery,
			"SELECT * FROM %soffline_shop_item WHERE owner_id = %u AND vnum = %d",
			get_table_postfix(), ch->GetOfflineShopRealOwner(), itemVnum);

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

			if (pSearchQuery->uiSQLErrno != 0) {
				sys_err("Item Search Query Failed, Error code: %ld", pSearchQuery->uiSQLErrno);
				return;
			}
			if (!pSearchQuery->Get()->uiNumRows){
				return;
			}
			CTargetManager::Instance().CreateTarget(m_ch->GetPlayerID(), 9999, ch->GetName(), 3, ch->GetVID(), 0, m_ch->GetMapIndex(), NULL, 1);
		}
	}
	LPCHARACTER m_ch;
	int itemVnum;
};

	
void COfflineShopManager::SearchInShops(LPCHARACTER ch, int vnum)
{
	if (!ch)
		return;
	LPSECTREE_MAP pSecMap = SECTREE_MANAGER::instance().GetMap(ch->GetMapIndex());
	if (!pSecMap)
		return;
	FSearch f(ch, vnum);
	pSecMap->for_each(f);
	ch->SetQuestFlag("item_search.flood_check", get_global_time());
}
       
              
ACMD(do_search_in_shops)
{
	char arg1[256];
	one_argument(argument, arg1, sizeof(arg1));

	int vnum = 0;
	str_to_number(vnum, arg1);

	int iFloodResult = ch->GetQuestFlag("item_search.flood_check");
	if (iFloodResult){
		if (get_global_time() < iFloodResult + 3) {
			ch->ChatPacket(CHAT_TYPE_INFO, "Cok hizlisin.");
			return;
		}
	}

	COfflineShopManager::Instance().SearchInShops(ch, vnum);
}

 

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Popular Days

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



  • Similar Content

  • Activity

    1. 0

      QuickSell in SpecialInventory Problem

    2. 5
    3. 12

      Legendary items effect

    4. 0

      M2Project Research | Teamler - Beta Tester

    5. 5

      How To Directx9 Device Creation with Multiple Thread Support

    6. 25

      Increase Safebox / Warehouse

    7. 25

      Increase Safebox / Warehouse

  • Recently Browsing

    • No registered users viewing this page.
×
×
  • 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.