From 697685c3f57ffb9498e1a957333ea4fa6dd87b9a Mon Sep 17 00:00:00 2001 From: click Date: Fri, 30 Apr 2010 22:35:37 +0200 Subject: Add support for vendors selling the same items with different extendedCost - original code by Vladimir (thanks mate) Closes issue #1756 --HG-- branch : trunk --- src/game/ObjectMgr.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/game/ObjectMgr.cpp') diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index bc4b5cac9ec..94d735f10f0 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -8617,10 +8617,9 @@ bool ObjectMgr::RemoveVendorItem(uint32 entry,uint32 item, bool savetodb) if (iter == m_mCacheVendorItemMap.end()) return false; - if (!iter->second.FindItem(item)) + if(!iter->second.RemoveItem(item)) return false; - iter->second.RemoveItem(item); if (savetodb) WorldDatabase.PExecuteLog("DELETE FROM npc_vendor WHERE entry='%u' AND item='%u'",entry, item); return true; } @@ -8691,12 +8690,12 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max if (!vItems) return true; // later checks for non-empty lists - if (vItems->FindItem(item_id)) + if(vItems->FindItemCostPair(item_id,ExtendedCost)) { if (pl) - ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST,item_id); + ChatHandler(pl).PSendSysMessage(LANG_ITEM_ALREADY_IN_LIST, item_id, ExtendedCost); else - sLog.outErrorDb("Table `(game_event_)npc_vendor` has duplicate items %u for vendor (Entry: %u), ignore", item_id, vendor_entry); + sLog.outErrorDb( "Table `npc_vendor` has duplicate items %u (with extended cost %u) for vendor (Entry: %u), ignoring", item_id, ExtendedCost, vendor_entry); return false; } -- cgit v1.2.3