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
60: _loot(loot), _lootMode(lootMode) { }
uint16 _lootMode
Definition: LootMgr.cpp:90
Loot const & _loot
Definition: LootMgr.cpp:89

Member Function Documentation

◆ operator()()

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