Revert revisions 67325b1a0af0 and a0cba24b9060.

Made vendors ignore gold cost by default when extended cost is set, except when item has ITEM_FLAGS_EXTRA_EXT_COST_REQUIRES_GOLD flag

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-07-15 10:12:51 +02:00
parent 26582fd48b
commit 894a065203
10 changed files with 49 additions and 43 deletions
+5 -6
View File
@@ -307,17 +307,16 @@ enum ChatType
// Vendors
struct VendorItem
{
VendorItem(uint32 _item, int32 _maxcount, uint32 _incrtime, int32 _ExtendedCost)
VendorItem(uint32 _item, int32 _maxcount, uint32 _incrtime, uint32 _ExtendedCost)
: item(_item), maxcount(_maxcount), incrtime(_incrtime), ExtendedCost(_ExtendedCost) {}
uint32 item;
int32 maxcount; // 0 for infinity item amount
uint32 incrtime; // time for restore items amount if maxcount != 0
int32 ExtendedCost;
uint32 ExtendedCost;
//helpers
bool IsExcludeMoneyPrice() const { return ExtendedCost > 0; }
uint32 GetExtendedCostId() const { return std::abs(ExtendedCost); }
bool IsGoldRequired(ItemPrototype const* pProto) const { return pProto->Flags2 & ITEM_FLAGS_EXTRA_EXT_COST_REQUIRES_GOLD || !ExtendedCost; }
};
typedef std::vector<VendorItem*> VendorItemList;
@@ -332,12 +331,12 @@ struct VendorItemData
}
bool Empty() const { return m_items.empty(); }
uint8 GetItemCount() const { return m_items.size(); }
void AddItem(uint32 item, int32 maxcount, uint32 ptime, int32 ExtendedCost)
void AddItem(uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost)
{
m_items.push_back(new VendorItem(item, maxcount, ptime, ExtendedCost));
}
bool RemoveItem(uint32 item_id);
VendorItem const* FindItemCostPair(uint32 item_id, int32 extendedCost) const;
VendorItem const* FindItemCostPair(uint32 item_id, uint32 extendedCost) const;
void Clear()
{
for (VendorItemList::const_iterator itr = m_items.begin(); itr != m_items.end(); ++itr)