Add support for vendors selling the same items with different extendedCost - original code by Vladimir (thanks mate)

Closes issue #1756

--HG--
branch : trunk
This commit is contained in:
click committed 2010-04-30 22:35:37 +02:00
1 parent 4b1a9916ac
commit 697685c3f5
8 files changed
+51 -36

No files matched your search

+4 -5
View File
@@ -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;
}