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
482 {
483 m_items.push_back(new VendorItem(item, maxcount, ptime, ExtendedCost));
484 }
Definition: CreatureData.h:454
VendorItemList m_items
Definition: CreatureData.h:470

References m_items.

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

◆ Clear()

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

References m_items.

◆ Empty()

bool VendorItemData::Empty ( ) const
inline
479{ 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
111{
112 for (VendorItemList::const_iterator i = m_items.begin(); i != m_items.end(); ++i)
113 if ((*i)->item == item_id && (*i)->ExtendedCost == extendedCost)
114 return *i;
115 return nullptr;
116}

References m_items.

Referenced by ObjectMgr::IsVendorItemValid().

◆ GetItem()

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

References m_items.

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

◆ GetItemCount()

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

References m_items.

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

◆ RemoveItem()

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

References m_items.

Member Data Documentation

◆ m_items