AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
LootGroupInvalidSelector Struct Reference
Inheritance diagram for LootGroupInvalidSelector:
Acore::unary_function< LootStoreItem *, bool >

Public Member Functions

 LootGroupInvalidSelector (Loot const &loot, uint16 lootMode)
 
bool operator() (LootStoreItem *item) const
 

Private Attributes

Loot const & _loot
 
uint16 _lootMode
 

Additional Inherited Members

- Public Types inherited from Acore::unary_function< LootStoreItem *, bool >
typedef LootStoreItemargument_type
 
typedef bool result_type
 

Detailed Description

Constructor & Destructor Documentation

◆ LootGroupInvalidSelector()

LootGroupInvalidSelector::LootGroupInvalidSelector ( Loot const &  loot,
uint16  lootMode 
)
inlineexplicit
61: _loot(loot), _lootMode(lootMode) { }
uint16 _lootMode
Definition: LootMgr.cpp:91
Loot const & _loot
Definition: LootMgr.cpp:90

Member Function Documentation

◆ operator()()

bool LootGroupInvalidSelector::operator() ( LootStoreItem item) const
inline
64 {
65 if (!(item->lootmode & _lootMode))
66 return true;
67
68 if (!item->reference)
69 {
70 ItemTemplate const* _proto = sObjectMgr->GetItemTemplate(item->itemid);
71 if (!_proto)
72 return true;
73
74 uint8 foundDuplicates = 0;
75 for (std::vector<LootItem>::const_iterator itr = _loot.items.begin(); itr != _loot.items.end(); ++itr)
76 if (itr->itemid == item->itemid && itr->groupid == item->groupid)
77 {
78 ++foundDuplicates;
79 if (_proto->InventoryType == 0 && foundDuplicates == 3 && _proto->ItemId != 47242 /*Trophy of the Crusade*/) // Non-equippable items are limited to 3 drops
80 return true;
81 else if (_proto->InventoryType != 0 && foundDuplicates == 1) // Equippable item are limited to 1 drop
82 return true;
83 }
84 }
85
86 return false;
87 }
std::uint8_t uint8
Definition: Define.h:109
#define sObjectMgr
Definition: ObjectMgr.h:1635
Definition: ItemTemplate.h:619
uint32 InventoryType
Definition: ItemTemplate.h:632
uint32 ItemId
Definition: ItemTemplate.h:620
int32 reference
Definition: LootMgr.h:130
uint32 itemid
Definition: LootMgr.h:129
uint16 lootmode
Definition: LootMgr.h:133
uint8 groupid
Definition: LootMgr.h:134
std::vector< LootItem > items
Definition: LootMgr.h:320

References _loot, _lootMode, LootStoreItem::groupid, ItemTemplate::InventoryType, ItemTemplate::ItemId, LootStoreItem::itemid, Loot::items, LootStoreItem::lootmode, LootStoreItem::reference, and sObjectMgr.

Member Data Documentation

◆ _loot

Loot const& LootGroupInvalidSelector::_loot
private

Referenced by operator()().

◆ _lootMode

uint16 LootGroupInvalidSelector::_lootMode
private

Referenced by operator()().