AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
VendorItemData Struct Reference

#include "CreatureData.h"

Public Member Functions

VendorItemGetItem (uint32 slot) const
 
bool Empty () const
 
uint8 GetItemCount () const
 
void AddItem (uint32 item, int32 maxcount, uint32 ptime, uint32 ExtendedCost)
 
bool RemoveItem (uint32 item_id)
 
VendorItem const * FindItemCostPair (uint32 item_id, uint32 extendedCost) const
 
void Clear ()
 

Public Attributes

VendorItemList m_items
 

Detailed Description

Member Function Documentation

◆ AddItem()

void VendorItemData::AddItem ( uint32  item,
int32  maxcount,
uint32  ptime,
uint32  ExtendedCost 
)
inline
485 {
486 m_items.push_back(new VendorItem(item, maxcount, ptime, ExtendedCost));
487 }
Definition: CreatureData.h:457
VendorItemList m_items
Definition: CreatureData.h:473

References m_items.

Referenced by ObjectMgr::AddVendorItem(), ObjectMgr::LoadReferenceVendor(), and ObjectMgr::LoadVendors().

◆ Clear()

void VendorItemData::Clear ( )
inline
491 {
492 for (VendorItemList::const_iterator itr = m_items.begin(); itr != m_items.end(); ++itr)
493 delete (*itr);
494 m_items.clear();
495 }

References m_items.

◆ Empty()

bool VendorItemData::Empty ( ) const
inline
482{ return m_items.empty(); }

References m_items.

Referenced by Player::BuyItemFromVendorSlot(), and Player::PrepareGossipMenu().

◆ FindItemCostPair()

VendorItem const * VendorItemData::FindItemCostPair ( uint32  item_id,
uint32  extendedCost 
) const
112{
113 for (VendorItemList::const_iterator i = m_items.begin(); i != m_items.end(); ++i)
114 if ((*i)->item == item_id && (*i)->ExtendedCost == extendedCost)
115 return *i;
116 return nullptr;
117}

References m_items.

Referenced by ObjectMgr::IsVendorItemValid().

◆ GetItem()

VendorItem * VendorItemData::GetItem ( uint32  slot) const
inline
476 {
477 if (slot >= m_items.size())
478 return nullptr;
479
480 return m_items[slot];
481 }

References m_items.

Referenced by Player::BuyItemFromVendorSlot(), and WorldSession::SendListInventory().

◆ GetItemCount()

uint8 VendorItemData::GetItemCount ( ) const
inline
483{ return m_items.size(); }

References m_items.

Referenced by Player::BuyItemFromVendorSlot(), and WorldSession::SendListInventory().

◆ RemoveItem()

bool VendorItemData::RemoveItem ( uint32  item_id)
93{
94 bool found = false;
95 for (VendorItemList::iterator i = m_items.begin(); i != m_items.end();)
96 {
97 if ((*i)->item == item_id)
98 {
99 i = m_items.erase(i++);
100 found = true;
101 }
102 else
103 ++i;
104 }
105 return found;
106}

References m_items.

Member Data Documentation

◆ m_items