19 #ifndef TRINITY_LOOTMGR_H
20 #define TRINITY_LOOTMGR_H
60 #define MAX_NR_LOOT_ITEMS 16
62 #define MAX_NR_QUEST_ITEMS 32
140 bool needs_quest : 1;
149 : itemid(_itemid), reference(_reference), chance(_chance), lootmode(_lootmode),
150 needs_quest(_needs_quest), groupid(_groupid), mincount(_mincount), maxcount(_maxcount)
153 bool Roll(
bool rate)
const;
169 bool is_underthreshold : 1;
171 bool needs_quest : 1;
172 bool follow_loot_rules : 1;
180 LootItem() : itemid(0), randomSuffix(0), randomPropertyId(0), count(0), is_looted(
false), is_blocked(
false),
185 bool AllowedForPlayer(
Player const* player)
const;
186 void AddAllowedLooter(
Player const* player);
196 : index(0), is_looted(
false) { }
199 : index(_index), is_looted(_islooted) { }
216 explicit LootStore(
char const* name,
char const* entryName,
bool ratesAllowed)
217 : m_name(name), m_entryName(entryName), m_ratesAllowed(ratesAllowed) { }
225 void ReportUnusedIds(
LootIdSet const& ids_set)
const;
226 void ReportNonExistingId(
uint32 lootId)
const;
227 void ReportNonExistingId(
uint32 lootId,
const char* ownerType,
uint32 ownerId)
const;
229 bool HaveLootFor(
uint32 loot_id)
const {
return m_LootTemplates.find(loot_id) != m_LootTemplates.end(); }
230 bool HaveQuestLootFor(
uint32 loot_id)
const;
231 bool HaveQuestLootForPlayer(
uint32 loot_id,
Player* player)
const;
234 void ResetConditions();
237 char const*
GetName()
const {
return m_name; }
262 void Process(
Loot& loot,
bool rate,
uint16 lootMode,
uint8 groupId = 0)
const;
264 void CopyConditions(
LootItem* li)
const;
275 bool isReference(
uint32 id);
332 Loot(
uint32 _gold = 0) : gold(_gold), unlootedCount(0), roundRobinPlayer(), loot_type(
LOOT_CORPSE), maxDuplicates(1), _difficultyBonusTreeMod(0){ }
339 void DeleteLootItemFromContainerItemDB(
uint32 itemID);
340 void DeleteLootMoneyFromContainerItemDB();
345 i_LootValidatorRefManager.insertFirst(pLootValidatorRef);
351 for (QuestItemMap::const_iterator itr = PlayerQuestItems.begin(); itr != PlayerQuestItems.end(); ++itr)
353 PlayerQuestItems.clear();
355 for (QuestItemMap::const_iterator itr = PlayerFFAItems.begin(); itr != PlayerFFAItems.end(); ++itr)
357 PlayerFFAItems.clear();
359 for (QuestItemMap::const_iterator itr = PlayerNonQuestNonFFAConditionalItems.begin(); itr != PlayerNonQuestNonFFAConditionalItems.end(); ++itr)
361 PlayerNonQuestNonFFAConditionalItems.clear();
363 PlayersLooting.clear();
368 roundRobinPlayer.
Clear();
370 i_LootValidatorRefManager.clearReferences();
371 _difficultyBonusTreeMod = 0;
374 bool empty()
const {
return items.empty() && gold == 0; }
375 bool isLooted()
const {
return gold == 0 && unlootedCount == 0; }
377 void NotifyItemRemoved(
uint8 lootIndex);
378 void NotifyQuestItemRemoved(
uint8 questIndex);
379 void NotifyMoneyRemoved();
383 void generateMoneyLoot(
uint32 minAmount,
uint32 maxAmount);
391 bool hasItemFor(
Player* player)
const;
392 bool hasOverThresholdItem()
const;
399 void FillNotNormalLootFor(
Player* player,
bool presentAtLooting);
PermissionTypes
Definition: LootMgr.h:75
RollType
Definition: LootMgr.h:40
Definition: LootMgr.h:112
TC_GAME_API void LoadLootTemplates_Fishing()
Definition: LootMgr.cpp:1579
char const * m_entryName
Definition: LootMgr.h:246
TC_GAME_API LootStore LootTemplates_Item
uint8 maxcount
Definition: LootMgr.h:143
uint32 _difficultyBonusTreeMod
Definition: LootMgr.h:414
TC_GAME_API LootStore LootTemplates_Reference
Definition: LootMgr.h:114
Definition: LootMgr.h:288
TC_GAME_API void LoadLootTemplates_Item()
Definition: LootMgr.cpp:1637
bool m_ratesAllowed
Definition: LootMgr.h:247
void addLootValidatorRef(LootValidatorRef *pLootValidatorRef)
Definition: LootMgr.h:343
Definition: LootMgr.h:190
TC_GAME_API LootStore LootTemplates_Milling
QuestItemMap PlayerFFAItems
Definition: LootMgr.h:406
Definition: ConditionMgr.h:194
bool is_looted
Definition: LootMgr.h:193
TC_GAME_API void LoadLootTemplates_Disenchant()
Definition: LootMgr.cpp:1545
iterator begin()
Definition: LootMgr.h:306
LootItem()
Definition: LootMgr.h:180
TC_GAME_API void LoadLootTemplates_Reference()
Definition: LootMgr.cpp:1853
Definition: LootMgr.h:134
TC_GAME_API LootStore LootTemplates_Creature
TC_GAME_API void LoadLootTemplates_Milling()
Definition: LootMgr.cpp:1661
std::list< LootStoreItem * > LootStoreItemList
Definition: LootMgr.h:208
std::vector< LootGroup * > LootGroups
Definition: LootMgr.h:252
Definition: LootMgr.h:115
Definition: LootMgr.h:108
LootTemplate()
Definition: LootMgr.h:256
float chance
Definition: LootMgr.h:138
TC_GAME_API void LoadLootTables()
Definition: LootMgr.cpp:1881
std::vector< LootItem > LootItemList
Definition: LootMgr.h:206
LootStore(char const *name, char const *entryName, bool ratesAllowed)
Definition: LootMgr.h:216
LootStoreItemList Entries
Definition: LootMgr.h:278
uint16 lootmode
Definition: LootMgr.h:139
LootGroups Groups
Definition: LootMgr.h:279
Definition: LootMgr.h:101
Definition: LootMgr.h:113
uint32 randomSuffix
Definition: LootMgr.h:160
arena_t NULL
Definition: jemalloc_internal.h:624
#define false
Definition: CascPort.h:18
TC_GAME_API LootStore LootTemplates_Spell
TC_GAME_API LootStore LootTemplates_Disenchant
uint32 itemid
Definition: LootMgr.h:136
char const * GetEntryName() const
Definition: LootMgr.h:238
Definition: LootMgr.h:109
ConditionContainer conditions
Definition: LootMgr.h:163
iterator end()
Definition: LootMgr.h:307
TC_GAME_API LootStore LootTemplates_Fishing
void sourceObjectDestroyLink() override
Definition: LootMgr.h:293
Definition: RefManager.h:26
void clear()
Definition: LootMgr.h:349
Definition: LootMgr.h:124
TC_GAME_API LootStore LootTemplates_Gameobject
Definition: LootMgr.h:117
Definition: SharedDefines.h:69
void RemoveLooter(ObjectGuid GUID)
Definition: LootMgr.h:381
LootSlotType
Definition: LootMgr.h:122
LootValidatorRef * getLast()
Definition: LootMgr.h:304
#define true
Definition: CascPort.h:17
int32 randomPropertyId
Definition: LootMgr.h:161
QuestItemMap const & GetPlayerNonQuestNonFFAConditionalItems() const
Definition: LootMgr.h:318
Definition: LootMgr.h:298
RollMask
Definition: LootMgr.h:49
TC_GAME_API LootStore LootTemplates_Pickpocketing
QuestItemMap const & GetPlayerQuestItems() const
Definition: LootMgr.h:316
TC_GAME_API void LoadLootTemplates_Mail()
Definition: LootMgr.cpp:1753
Reference< TO, FROM > * getLast()
Definition: RefManager.h:35
GuidSet allowedGUIDs
Definition: LootMgr.h:164
uint8 unlootedCount
Definition: LootMgr.h:323
LootStoreItem(uint32 _itemid, uint32 _reference, float _chance, bool _needs_quest, uint16 _lootmode, uint8 _groupid, uint8 _mincount, uint8 _maxcount)
Definition: LootMgr.h:148
GuidSet const & GetAllowedLooters() const
Definition: LootMgr.h:187
void targetObjectDestroyLink() override
Definition: LootMgr.h:292
char const * m_name
Definition: LootMgr.h:245
LootType
Definition: LootMgr.h:86
TC_GAME_API void LoadLootTemplates_Gameobject()
Definition: LootMgr.cpp:1603
Definition: LootMgr.h:314
bool canSave
Definition: LootMgr.h:173
uint8 index
Definition: LootMgr.h:192
ObjectGuid const & GetGUID() const
Definition: LootMgr.h:335
TC_GAME_API LootStore LootTemplates_Prospecting
Definition: LootMgr.h:107
LootTemplateMap m_LootTemplates
Definition: LootMgr.h:244
Vector2int16 & operator=(const Any &a)
QuestItem(uint8 _index, bool _islooted=false)
Definition: LootMgr.h:198
int32_t int32
Definition: Define.h:146
Definition: Reference.h:27
uint32_t uint32
Definition: Define.h:150
Definition: LootMgr.h:125
uint16_t uint16
Definition: Define.h:151
Definition: LinkedList.h:141
Definition: LootMgr.h:128
Definition: LootMgr.cpp:80
std::set< uint32 > LootIdSet
Definition: LootMgr.h:211
ObjectGuid _GUID
Definition: LootMgr.h:413
ConditionContainer conditions
Definition: LootMgr.h:144
TC_GAME_API LootStore LootTemplates_Skinning
bool empty() const
Definition: LootMgr.h:374
uint8 mincount
Definition: LootMgr.h:142
bool HaveLootFor(uint32 loot_id) const
Definition: LootMgr.h:229
char const * GetName() const
Definition: LootMgr.h:237
ObjectGuid roundRobinPlayer
Definition: LootMgr.h:324
uint32 gold
Definition: LootMgr.h:322
Definition: BattlegroundMgr.h:57
virtual ~LootStore()
Definition: LootMgr.h:219
Definition: LootMgr.h:157
Loot(uint32 _gold=0)
Definition: LootMgr.h:332
void Clear()
Definition: ObjectGuid.h:215
Definition: LootMgr.h:116
iterator rend()
Definition: LootMgr.h:309
uint8 maxDuplicates
Definition: LootMgr.h:326
Definition: LootMgr.h:250
TC_GAME_API void LoadLootTemplates_Pickpocketing()
Definition: LootMgr.cpp:1690
QuestItem()
Definition: LootMgr.h:195
Reference< TO, FROM > * getFirst()
Definition: RefManager.h:33
iterator rbegin()
Definition: LootMgr.h:308
std::vector< LootItem > items
Definition: LootMgr.h:320
bool isLooted() const
Definition: LootMgr.h:375
Definition: LootMgr.h:100
Definition: LootMgr.h:213
Definition: LootMgr.h:111
LootType loot_type
Definition: LootMgr.h:325
std::vector< QuestItem > QuestItemList
Definition: LootMgr.h:203
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:332
LootValidatorRefManager i_LootValidatorRefManager
Definition: LootMgr.h:410
Definition: LootPackets.h:58
#define TC_GAME_API
Definition: Define.h:134
TC_GAME_API void LoadLootTemplates_Creature()
Definition: LootMgr.cpp:1511
LootMethod
Definition: LootMgr.h:65
Definition: LootMgr.h:118
LinkedListHead::Iterator< LootValidatorRef > iterator
Definition: LootMgr.h:301
uint8_t uint8
Definition: Define.h:152
QuestItemMap PlayerQuestItems
Definition: LootMgr.h:405
QuestItemMap const & GetPlayerFFAItems() const
Definition: LootMgr.h:317
Definition: LootMgr.h:106
Definition: LootMgr.h:126
void AddLooter(ObjectGuid GUID)
Definition: LootMgr.h:380
ObjectGuid containerID
Definition: LootMgr.h:330
std::unordered_map< uint32, LootTemplate * > LootTemplateMap
Definition: LootMgr.h:209
TC_GAME_API void LoadLootTemplates_Prospecting()
Definition: LootMgr.cpp:1724
Definition: LootMgr.h:127
Definition: ObjectGuid.h:189
std::map< ObjectGuid::LowType, QuestItemList * > QuestItemMap
Definition: LootMgr.h:207
bool IsRatesAllowed() const
Definition: LootMgr.h:239
std::vector< int32 > BonusListIDs
Definition: LootMgr.h:162
~Loot()
Definition: LootMgr.h:333
std::vector< Condition * > ConditionContainer
Definition: ConditionMgr.h:239
LootValidatorRef()
Definition: LootMgr.h:291
QuestItemMap PlayerNonQuestNonFFAConditionalItems
Definition: LootMgr.h:407
TC_GAME_API LootStore LootTemplates_Mail
Definition: LootMgr.h:110
uint32 itemid
Definition: LootMgr.h:159
std::vector< LootItem > quest_items
Definition: LootMgr.h:321
uint32 reference
Definition: LootMgr.h:137
TC_GAME_API void LoadLootTemplates_Skinning()
Definition: LootMgr.cpp:1777
LootValidatorRef * getFirst()
Definition: LootMgr.h:303
LootError
Definition: LootMgr.h:104
void SetGUID(ObjectGuid const &guid)
Definition: LootMgr.h:336
GuidSet PlayersLooting
Definition: LootMgr.h:404
TC_GAME_API void LoadLootTemplates_Spell()
Definition: LootMgr.cpp:1811