TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LootItem Struct Reference

#include <LootMgr.h>

Public Member Functions

 LootItem (LootStoreItem const &li)
 
 LootItem ()
 
bool AllowedForPlayer (Player const *player) const
 
void AddAllowedLooter (Player const *player)
 
GuidSet constGetAllowedLooters () const
 

Public Attributes

uint32 itemid
 
uint32 randomSuffix
 
int32 randomPropertyId
 
std::vector< int32BonusListIDs
 
ConditionContainer conditions
 
GuidSet allowedGUIDs
 
uint8 count: 8
 
bool is_looted: 1
 
bool is_blocked: 1
 
bool freeforall: 1
 
bool is_underthreshold: 1
 
bool is_counted: 1
 
bool needs_quest: 1
 
bool follow_loot_rules: 1
 
bool canSave
 

Constructor & Destructor Documentation

LootItem::LootItem ( LootStoreItem const li)
explicit
357 {
358  itemid = li.itemid;
359  conditions = li.conditions;
360 
361  ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemid);
362  freeforall = proto && (proto->GetFlags() & ITEM_FLAG_PARTY_LOOT);
364 
365  needs_quest = li.needs_quest;
366 
369  count = 0;
370  is_looted = 0;
371  is_blocked = 0;
372  is_underthreshold = 0;
373  is_counted = 0;
374  canSave = true;
375 }
bool follow_loot_rules
Definition: LootMgr.h:172
bool is_counted
Definition: LootMgr.h:170
TC_GAME_API uint32 GenerateEnchSuffixFactor(uint32 item_id)
Definition: ItemEnchantmentMgr.cpp:121
bool is_underthreshold
Definition: LootMgr.h:169
Definition: ItemTemplate.h:270
bool freeforall
Definition: LootMgr.h:168
bool is_blocked
Definition: LootMgr.h:167
uint32 randomSuffix
Definition: LootMgr.h:160
Definition: ItemTemplate.h:184
ConditionContainer conditions
Definition: LootMgr.h:163
bool is_looted
Definition: LootMgr.h:166
#define sObjectMgr
Definition: ObjectMgr.h:1567
int32 randomPropertyId
Definition: LootMgr.h:161
static int32 GenerateItemRandomPropertyId(uint32 item_id)
Definition: Item.cpp:594
bool canSave
Definition: LootMgr.h:173
bool needs_quest
Definition: LootMgr.h:171
uint32 FlagsCu
Definition: ItemTemplate.h:716
Definition: ItemTemplate.h:647
uint32 GetFlags() const
Definition: ItemTemplate.h:656
uint8 count
Definition: LootMgr.h:165
uint32 itemid
Definition: LootMgr.h:159

+ Here is the call graph for this function:

LootItem::LootItem ( )
inline
180  : itemid(0), randomSuffix(0), randomPropertyId(0), count(0), is_looted(false), is_blocked(false),
181  freeforall(false), is_underthreshold(false), is_counted(false), needs_quest(false), follow_loot_rules(false),
182  canSave(true){ };
bool follow_loot_rules
Definition: LootMgr.h:172
bool is_counted
Definition: LootMgr.h:170
bool is_underthreshold
Definition: LootMgr.h:169
bool freeforall
Definition: LootMgr.h:168
bool is_blocked
Definition: LootMgr.h:167
uint32 randomSuffix
Definition: LootMgr.h:160
bool is_looted
Definition: LootMgr.h:166
int32 randomPropertyId
Definition: LootMgr.h:161
bool canSave
Definition: LootMgr.h:173
bool needs_quest
Definition: LootMgr.h:171
uint8 count
Definition: LootMgr.h:165
uint32 itemid
Definition: LootMgr.h:159

Member Function Documentation

void LootItem::AddAllowedLooter ( Player const player)
407 {
408  allowedGUIDs.insert(player->GetGUID());
409 }
GuidSet allowedGUIDs
Definition: LootMgr.h:164

+ Here is the caller graph for this function:

bool LootItem::AllowedForPlayer ( Player const player) const
379 {
380  // DB conditions check
381  if (!sConditionMgr->IsObjectMeetToConditions(const_cast<Player*>(player), conditions))
382  return false;
383 
384  ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemid);
385  if (!pProto)
386  return false;
387 
388  // not show loot for players without profession or those who already know the recipe
389  if ((pProto->GetFlags() & ITEM_FLAG_SMART_LOOT) && (!player->HasSkill(pProto->GetRequiredSkill()) || player->HasSpell(pProto->Effects[1]->SpellID)))
390  return false;
391 
392  // not show loot for not own team
393  if ((pProto->GetFlags2() & ITEM_FLAG2_HORDE_ONLY) && player->GetTeam() != HORDE)
394  return false;
395 
396  if ((pProto->GetFlags2() & ITEM_FLAG2_ALLIANCE_ONLY) && player->GetTeam() != ALLIANCE)
397  return false;
398 
399  // check quest requirements
400  if (!(pProto->FlagsCu & ITEM_FLAGS_CU_IGNORE_QUEST_STATUS) && ((needs_quest || (pProto->GetStartQuest() && player->GetQuestStatus(pProto->GetStartQuest()) != QUEST_STATUS_NONE)) && !player->HasQuestForItem(itemid)))
401  return false;
402 
403  return true;
404 }
Definition: ItemTemplate.h:269
Definition: ItemTemplate.h:198
ConditionContainer conditions
Definition: LootMgr.h:163
#define sObjectMgr
Definition: ObjectMgr.h:1567
Definition: QuestDef.h:110
Definition: SharedDefines.h:1000
uint32 GetFlags2() const
Definition: ItemTemplate.h:657
Definition: ItemTemplate.h:209
std::vector< ItemEffectEntry const * > Effects
Definition: ItemTemplate.h:707
uint32 GetRequiredSkill() const
Definition: ItemTemplate.h:669
uint32 GetStartQuest() const
Definition: ItemTemplate.h:686
#define sConditionMgr
Definition: ConditionMgr.h:307
Definition: SharedDefines.h:999
bool needs_quest
Definition: LootMgr.h:171
uint32 FlagsCu
Definition: ItemTemplate.h:716
Definition: ItemTemplate.h:210
Definition: ItemTemplate.h:647
uint32 GetFlags() const
Definition: ItemTemplate.h:656
uint32 itemid
Definition: LootMgr.h:159

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GuidSet const& LootItem::GetAllowedLooters ( ) const
inline
187 { return allowedGUIDs; }
GuidSet allowedGUIDs
Definition: LootMgr.h:164

+ Here is the caller graph for this function:

Member Data Documentation

GuidSet LootItem::allowedGUIDs
std::vector<int32> LootItem::BonusListIDs
bool LootItem::canSave
ConditionContainer LootItem::conditions
uint8 LootItem::count
bool LootItem::follow_loot_rules
bool LootItem::freeforall
bool LootItem::is_blocked
bool LootItem::is_counted
bool LootItem::is_looted
bool LootItem::is_underthreshold
uint32 LootItem::itemid
bool LootItem::needs_quest
int32 LootItem::randomPropertyId
uint32 LootItem::randomSuffix

The documentation for this struct was generated from the following files: