TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LootMgr.h File Reference
#include "ItemEnchantmentMgr.h"
#include "ByteBuffer.h"
#include "RefManager.h"
#include "SharedDefines.h"
#include "ConditionMgr.h"
#include "ObjectGuid.h"
#include <map>
#include <vector>
#include <list>
+ Include dependency graph for LootMgr.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  LootStoreItem
 
struct  LootItem
 
struct  QuestItem
 
class  LootStore
 
class  LootTemplate
 
class  LootValidatorRef
 
class  LootValidatorRefManager
 
struct  Loot
 

Namespaces

 WorldPackets
 
 WorldPackets::Loot
 

Macros

#define MAX_NR_LOOT_ITEMS   16
 
#define MAX_NR_QUEST_ITEMS   32
 

Typedefs

typedef std::vector< QuestItemQuestItemList
 
typedef std::vector< LootItemLootItemList
 
typedef std::map
< ObjectGuid::LowType,
QuestItemList * > 
QuestItemMap
 
typedef std::list
< LootStoreItem * > 
LootStoreItemList
 
typedef std::unordered_map
< uint32, LootTemplate * > 
LootTemplateMap
 
typedef std::set< uint32LootIdSet
 

Enumerations

enum  RollType {
  ROLL_PASS = 0, ROLL_NEED = 1, ROLL_GREED = 2, ROLL_DISENCHANT = 3,
  MAX_ROLL_TYPE = 4
}
 
enum  RollMask {
  ROLL_FLAG_TYPE_PASS = 0x01, ROLL_FLAG_TYPE_NEED = 0x02, ROLL_FLAG_TYPE_GREED = 0x04, ROLL_FLAG_TYPE_DISENCHANT = 0x08,
  ROLL_ALL_TYPE_NO_DISENCHANT = 0x07, ROLL_ALL_TYPE_MASK = 0x0F
}
 
enum  LootMethod {
  FREE_FOR_ALL = 0, ROUND_ROBIN = 1, MASTER_LOOT = 2, GROUP_LOOT = 3,
  NEED_BEFORE_GREED = 4, PERSONAL_LOOT = 5
}
 
enum  PermissionTypes {
  ALL_PERMISSION = 0, GROUP_PERMISSION = 1, MASTER_PERMISSION = 2, RESTRICTED_PERMISSION = 3,
  ROUND_ROBIN_PERMISSION = 4, OWNER_PERMISSION = 5, NONE_PERMISSION = 6
}
 
enum  LootType {
  LOOT_NONE = 0, LOOT_CORPSE = 1, LOOT_PICKPOCKETING = 2, LOOT_FISHING = 3,
  LOOT_DISENCHANTING = 4, LOOT_SKINNING = 6, LOOT_PROSPECTING = 7, LOOT_MILLING = 8,
  LOOT_FISHINGHOLE = 20, LOOT_INSIGNIA = 21, LOOT_FISHING_JUNK = 22
}
 
enum  LootError {
  LOOT_ERROR_DIDNT_KILL = 0, LOOT_ERROR_TOO_FAR = 4, LOOT_ERROR_BAD_FACING = 5, LOOT_ERROR_LOCKED = 6,
  LOOT_ERROR_NOTSTANDING = 8, LOOT_ERROR_STUNNED = 9, LOOT_ERROR_PLAYER_NOT_FOUND = 10, LOOT_ERROR_PLAY_TIME_EXCEEDED = 11,
  LOOT_ERROR_MASTER_INV_FULL = 12, LOOT_ERROR_MASTER_UNIQUE_ITEM = 13, LOOT_ERROR_MASTER_OTHER = 14, LOOT_ERROR_ALREADY_PICKPOCKETED = 15,
  LOOT_ERROR_NOT_WHILE_SHAPESHIFTED = 16
}
 
enum  LootSlotType {
  LOOT_SLOT_TYPE_ALLOW_LOOT = 0, LOOT_SLOT_TYPE_ROLL_ONGOING = 1, LOOT_SLOT_TYPE_MASTER = 3, LOOT_SLOT_TYPE_LOCKED = 2,
  LOOT_SLOT_TYPE_OWNER = 4
}
 

Functions

TC_GAME_API void LoadLootTemplates_Creature ()
 
TC_GAME_API void LoadLootTemplates_Fishing ()
 
TC_GAME_API void LoadLootTemplates_Gameobject ()
 
TC_GAME_API void LoadLootTemplates_Item ()
 
TC_GAME_API void LoadLootTemplates_Mail ()
 
TC_GAME_API void LoadLootTemplates_Milling ()
 
TC_GAME_API void LoadLootTemplates_Pickpocketing ()
 
TC_GAME_API void LoadLootTemplates_Skinning ()
 
TC_GAME_API void LoadLootTemplates_Disenchant ()
 
TC_GAME_API void LoadLootTemplates_Prospecting ()
 
TC_GAME_API void LoadLootTemplates_Spell ()
 
TC_GAME_API void LoadLootTemplates_Reference ()
 
TC_GAME_API void LoadLootTables ()
 

Variables

TC_GAME_API LootStore LootTemplates_Creature
 
TC_GAME_API LootStore LootTemplates_Fishing
 
TC_GAME_API LootStore LootTemplates_Gameobject
 
TC_GAME_API LootStore LootTemplates_Item
 
TC_GAME_API LootStore LootTemplates_Mail
 
TC_GAME_API LootStore LootTemplates_Milling
 
TC_GAME_API LootStore LootTemplates_Pickpocketing
 
TC_GAME_API LootStore LootTemplates_Reference
 
TC_GAME_API LootStore LootTemplates_Skinning
 
TC_GAME_API LootStore LootTemplates_Disenchant
 
TC_GAME_API LootStore LootTemplates_Prospecting
 
TC_GAME_API LootStore LootTemplates_Spell
 

Macro Definition Documentation

#define MAX_NR_LOOT_ITEMS   16
#define MAX_NR_QUEST_ITEMS   32

Typedef Documentation

typedef std::set<uint32> LootIdSet
typedef std::vector<LootItem> LootItemList
typedef std::list<LootStoreItem*> LootStoreItemList
typedef std::unordered_map<uint32, LootTemplate*> LootTemplateMap
typedef std::vector<QuestItem> QuestItemList

Enumeration Type Documentation

enum LootError
Enumerator
LOOT_ERROR_DIDNT_KILL 
LOOT_ERROR_TOO_FAR 
LOOT_ERROR_BAD_FACING 
LOOT_ERROR_LOCKED 
LOOT_ERROR_NOTSTANDING 
LOOT_ERROR_STUNNED 
LOOT_ERROR_PLAYER_NOT_FOUND 
LOOT_ERROR_PLAY_TIME_EXCEEDED 
LOOT_ERROR_MASTER_INV_FULL 
LOOT_ERROR_MASTER_UNIQUE_ITEM 
LOOT_ERROR_MASTER_OTHER 
LOOT_ERROR_ALREADY_PICKPOCKETED 
LOOT_ERROR_NOT_WHILE_SHAPESHIFTED 
105 {
106  LOOT_ERROR_DIDNT_KILL = 0, // You don't have permission to loot that corpse.
107  LOOT_ERROR_TOO_FAR = 4, // You are too far away to loot that corpse.
108  LOOT_ERROR_BAD_FACING = 5, // You must be facing the corpse to loot it.
109  LOOT_ERROR_LOCKED = 6, // Someone is already looting that corpse.
110  LOOT_ERROR_NOTSTANDING = 8, // You need to be standing up to loot something!
111  LOOT_ERROR_STUNNED = 9, // You can't loot anything while stunned!
112  LOOT_ERROR_PLAYER_NOT_FOUND = 10, // Player not found
113  LOOT_ERROR_PLAY_TIME_EXCEEDED = 11, // Maximum play time exceeded
114  LOOT_ERROR_MASTER_INV_FULL = 12, // That player's inventory is full
115  LOOT_ERROR_MASTER_UNIQUE_ITEM = 13, // Player has too many of that item already
116  LOOT_ERROR_MASTER_OTHER = 14, // Can't assign item to that player
117  LOOT_ERROR_ALREADY_PICKPOCKETED = 15, // Your target has already had its pockets picked
118  LOOT_ERROR_NOT_WHILE_SHAPESHIFTED = 16 // You can't do that while shapeshifted.
119 };
Definition: LootMgr.h:112
Definition: LootMgr.h:114
Definition: LootMgr.h:115
Definition: LootMgr.h:108
Definition: LootMgr.h:113
Definition: LootMgr.h:109
Definition: LootMgr.h:117
Definition: LootMgr.h:107
Definition: LootMgr.h:116
Definition: LootMgr.h:111
Definition: LootMgr.h:118
Definition: LootMgr.h:106
Definition: LootMgr.h:110
enum LootMethod
Enumerator
FREE_FOR_ALL 
ROUND_ROBIN 
MASTER_LOOT 
GROUP_LOOT 
NEED_BEFORE_GREED 
PERSONAL_LOOT 
66 {
67  FREE_FOR_ALL = 0,
68  ROUND_ROBIN = 1,
69  MASTER_LOOT = 2,
70  GROUP_LOOT = 3,
72  PERSONAL_LOOT = 5
73 };
Definition: LootMgr.h:70
Definition: LootMgr.h:67
Definition: LootMgr.h:68
Definition: LootMgr.h:71
Definition: LootMgr.h:72
Definition: LootMgr.h:69
Enumerator
LOOT_SLOT_TYPE_ALLOW_LOOT 
LOOT_SLOT_TYPE_ROLL_ONGOING 
LOOT_SLOT_TYPE_MASTER 
LOOT_SLOT_TYPE_LOCKED 
LOOT_SLOT_TYPE_OWNER 
123 {
124  LOOT_SLOT_TYPE_ALLOW_LOOT = 0, // player can loot the item.
125  LOOT_SLOT_TYPE_ROLL_ONGOING = 1, // roll is ongoing. player cannot loot.
126  LOOT_SLOT_TYPE_MASTER = 3, // item can only be distributed by group loot master.
127  LOOT_SLOT_TYPE_LOCKED = 2, // item is shown in red. player cannot loot.
128  LOOT_SLOT_TYPE_OWNER = 4 // ignore binding confirmation and etc, for single player looting
129 };
Definition: LootMgr.h:124
Definition: LootMgr.h:125
Definition: LootMgr.h:128
Definition: LootMgr.h:126
Definition: LootMgr.h:127
enum LootType
Enumerator
LOOT_NONE 
LOOT_CORPSE 
LOOT_PICKPOCKETING 
LOOT_FISHING 
LOOT_DISENCHANTING 
LOOT_SKINNING 
LOOT_PROSPECTING 
LOOT_MILLING 
LOOT_FISHINGHOLE 
LOOT_INSIGNIA 
LOOT_FISHING_JUNK 
87 {
88  LOOT_NONE = 0,
89 
90  LOOT_CORPSE = 1,
92  LOOT_FISHING = 3,
94  // ignored always by client
95  LOOT_SKINNING = 6,
96  LOOT_PROSPECTING = 7,
97  LOOT_MILLING = 8,
98 
99  LOOT_FISHINGHOLE = 20, // unsupported by client, sending LOOT_FISHING instead
100  LOOT_INSIGNIA = 21, // unsupported by client, sending LOOT_CORPSE instead
101  LOOT_FISHING_JUNK = 22 // unsupported by client, sending LOOT_FISHING instead
102 };
Definition: LootMgr.h:95
Definition: LootMgr.h:99
Definition: LootMgr.h:96
Definition: LootMgr.h:101
Definition: LootMgr.h:88
Definition: LootMgr.h:90
Definition: LootMgr.h:93
Definition: LootMgr.h:97
Definition: LootMgr.h:100
Definition: LootMgr.h:91
Definition: LootMgr.h:92
Enumerator
ALL_PERMISSION 
GROUP_PERMISSION 
MASTER_PERMISSION 
RESTRICTED_PERMISSION 
ROUND_ROBIN_PERMISSION 
OWNER_PERMISSION 
NONE_PERMISSION 
76 {
77  ALL_PERMISSION = 0,
78  GROUP_PERMISSION = 1,
82  OWNER_PERMISSION = 5,
83  NONE_PERMISSION = 6
84 };
Definition: LootMgr.h:78
Definition: LootMgr.h:77
Definition: LootMgr.h:83
Definition: LootMgr.h:82
Definition: LootMgr.h:79
Definition: LootMgr.h:80
Definition: LootMgr.h:81
enum RollMask
Enumerator
ROLL_FLAG_TYPE_PASS 
ROLL_FLAG_TYPE_NEED 
ROLL_FLAG_TYPE_GREED 
ROLL_FLAG_TYPE_DISENCHANT 
ROLL_ALL_TYPE_NO_DISENCHANT 
ROLL_ALL_TYPE_MASK 
50 {
51  ROLL_FLAG_TYPE_PASS = 0x01,
52  ROLL_FLAG_TYPE_NEED = 0x02,
53  ROLL_FLAG_TYPE_GREED = 0x04,
55 
57  ROLL_ALL_TYPE_MASK = 0x0F
58 };
Definition: LootMgr.h:54
Definition: LootMgr.h:52
Definition: LootMgr.h:51
Definition: LootMgr.h:53
Definition: LootMgr.h:56
Definition: LootMgr.h:57
enum RollType
Enumerator
ROLL_PASS 
ROLL_NEED 
ROLL_GREED 
ROLL_DISENCHANT 
MAX_ROLL_TYPE 
41 {
42  ROLL_PASS = 0,
43  ROLL_NEED = 1,
44  ROLL_GREED = 2,
45  ROLL_DISENCHANT = 3,
46  MAX_ROLL_TYPE = 4
47 };
Definition: LootMgr.h:46
Definition: LootMgr.h:42
Definition: LootMgr.h:43
Definition: LootMgr.h:44
Definition: LootMgr.h:45

Function Documentation

TC_GAME_API void LoadLootTables ( )
1882 {
1894 
1896 }
void LoadLootTemplates_Milling()
Definition: LootMgr.cpp:1661
void LoadLootTemplates_Creature()
Definition: LootMgr.cpp:1511
void LoadLootTemplates_Spell()
Definition: LootMgr.cpp:1811
void LoadLootTemplates_Reference()
Definition: LootMgr.cpp:1853
void LoadLootTemplates_Pickpocketing()
Definition: LootMgr.cpp:1690
void LoadLootTemplates_Prospecting()
Definition: LootMgr.cpp:1724
void LoadLootTemplates_Gameobject()
Definition: LootMgr.cpp:1603
void LoadLootTemplates_Skinning()
Definition: LootMgr.cpp:1777
void LoadLootTemplates_Item()
Definition: LootMgr.cpp:1637
void LoadLootTemplates_Fishing()
Definition: LootMgr.cpp:1579
void LoadLootTemplates_Disenchant()
Definition: LootMgr.cpp:1545
void LoadLootTemplates_Mail()
Definition: LootMgr.cpp:1753

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TC_GAME_API void LoadLootTemplates_Creature ( )
1512 {
1513  TC_LOG_INFO("server.loading", "Loading creature loot templates...");
1514 
1515  uint32 oldMSTime = getMSTime();
1516 
1517  LootIdSet lootIdSet, lootIdSetUsed;
1519 
1520  // Remove real entries and check loot existence
1521  CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
1522  for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
1523  {
1524  if (uint32 lootid = itr->second.lootid)
1525  {
1526  if (lootIdSet.find(lootid) == lootIdSet.end())
1527  LootTemplates_Creature.ReportNonExistingId(lootid, "Creature", itr->second.Entry);
1528  else
1529  lootIdSetUsed.insert(lootid);
1530  }
1531  }
1532 
1533  for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr)
1534  lootIdSet.erase(*itr);
1535 
1536  // output error for any still listed (not referenced from appropriate table) ids
1538 
1539  if (count)
1540  TC_LOG_INFO("server.loading", ">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1541  else
1542  TC_LOG_ERROR("server.loading", ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty");
1543 }
LootStore LootTemplates_Creature("creature_loot_template","creature entry", true)
uint32 LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:247
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:263
uint32 getMSTime()
Definition: Timer.h:24
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32_t uint32
Definition: Define.h:150
std::set< uint32 > LootIdSet
Definition: LootMgr.h:211
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
void ReportNonExistingId(uint32 lootId) const
Definition: LootMgr.cpp:270
std::unordered_map< uint32, CreatureTemplate > CreatureTemplateContainer
Definition: Creature.h:213

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TC_GAME_API void LoadLootTemplates_Disenchant ( )
1546 {
1547  TC_LOG_INFO("server.loading", "Loading disenchanting loot templates...");
1548 
1549  uint32 oldMSTime = getMSTime();
1550 
1551  LootIdSet lootIdSet, lootIdSetUsed;
1553 
1554  for (uint32 i = 0; i < sItemDisenchantLootStore.GetNumRows(); ++i)
1555  {
1556  ItemDisenchantLootEntry const* disenchant = sItemDisenchantLootStore.LookupEntry(i);
1557  if (!disenchant)
1558  continue;
1559 
1560  uint32 lootid = disenchant->ID;
1561  if (lootIdSet.find(lootid) == lootIdSet.end())
1563  else
1564  lootIdSetUsed.insert(lootid);
1565  }
1566 
1567  for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr)
1568  lootIdSet.erase(*itr);
1569 
1570  // output error for any still listed (not referenced from appropriate table) ids
1572 
1573  if (count)
1574  TC_LOG_INFO("server.loading", ">> Loaded %u disenchanting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1575  else
1576  TC_LOG_ERROR("server.loading", ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty");
1577 }
LootStore LootTemplates_Disenchant("disenchant_loot_template","item disenchant id", true)
Definition: DB2Structure.h:685
uint32 LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:247
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:263
uint32 getMSTime()
Definition: Timer.h:24
uint32_t uint32
Definition: Define.h:150
std::set< uint32 > LootIdSet
Definition: LootMgr.h:211
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
void ReportNonExistingId(uint32 lootId) const
Definition: LootMgr.cpp:270
uint32 ID
Definition: DB2Structure.h:687
DB2Storage< ItemDisenchantLootEntry > sItemDisenchantLootStore("ItemDisenchantLoot.db2", ItemDisenchantLootFormat, HOTFIX_SEL_ITEM_DISENCHANT_LOOT)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TC_GAME_API void LoadLootTemplates_Fishing ( )
1580 {
1581  TC_LOG_INFO("server.loading", "Loading fishing loot templates...");
1582 
1583  uint32 oldMSTime = getMSTime();
1584 
1585  LootIdSet lootIdSet;
1587 
1588  // remove real entries and check existence loot
1589  for (uint32 i = 1; i < sAreaTableStore.GetNumRows(); ++i)
1590  if (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(i))
1591  if (lootIdSet.find(areaEntry->ID) != lootIdSet.end())
1592  lootIdSet.erase(areaEntry->ID);
1593 
1594  // output error for any still listed (not referenced from appropriate table) ids
1596 
1597  if (count)
1598  TC_LOG_INFO("server.loading", ">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1599  else
1600  TC_LOG_ERROR("server.loading", ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty");
1601 }
Definition: DBCStructure.h:37
uint32 LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:247
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:263
uint32 getMSTime()
Definition: Timer.h:24
LootStore LootTemplates_Fishing("fishing_loot_template","area id", true)
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTablefmt)
uint32_t uint32
Definition: Define.h:150
std::set< uint32 > LootIdSet
Definition: LootMgr.h:211
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TC_GAME_API void LoadLootTemplates_Gameobject ( )
1604 {
1605  TC_LOG_INFO("server.loading", "Loading gameobject loot templates...");
1606 
1607  uint32 oldMSTime = getMSTime();
1608 
1609  LootIdSet lootIdSet, lootIdSetUsed;
1611 
1612  // remove real entries and check existence loot
1613  GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates();
1614  for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr)
1615  {
1616  if (uint32 lootid = itr->second.GetLootId())
1617  {
1618  if (lootIdSet.find(lootid) == lootIdSet.end())
1619  LootTemplates_Gameobject.ReportNonExistingId(lootid, "Gameobject", itr->second.entry);
1620  else
1621  lootIdSetUsed.insert(lootid);
1622  }
1623  }
1624 
1625  for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr)
1626  lootIdSet.erase(*itr);
1627 
1628  // output error for any still listed (not referenced from appropriate table) ids
1630 
1631  if (count)
1632  TC_LOG_INFO("server.loading", ">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1633  else
1634  TC_LOG_ERROR("server.loading", ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty");
1635 }
uint32 LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:247
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:263
uint32 getMSTime()
Definition: Timer.h:24
#define sObjectMgr
Definition: ObjectMgr.h:1567
LootStore LootTemplates_Gameobject("gameobject_loot_template","gameobject entry", true)
uint32_t uint32
Definition: Define.h:150
std::set< uint32 > LootIdSet
Definition: LootMgr.h:211
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
std::unordered_map< uint32, GameObjectTemplate > GameObjectTemplateContainer
Definition: GameObject.h:769
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
void ReportNonExistingId(uint32 lootId) const
Definition: LootMgr.cpp:270

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TC_GAME_API void LoadLootTemplates_Item ( )
1638 {
1639  TC_LOG_INFO("server.loading", "Loading item loot templates...");
1640 
1641  uint32 oldMSTime = getMSTime();
1642 
1643  LootIdSet lootIdSet;
1644  uint32 count = LootTemplates_Item.LoadAndCollectLootIds(lootIdSet);
1645 
1646  // remove real entries and check existence loot
1647  ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
1648  for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
1649  if (lootIdSet.find(itr->second.GetId()) != lootIdSet.end() && itr->second.GetFlags() & ITEM_FLAG_OPENABLE)
1650  lootIdSet.erase(itr->second.GetId());
1651 
1652  // output error for any still listed (not referenced from appropriate table) ids
1654 
1655  if (count)
1656  TC_LOG_INFO("server.loading", ">> Loaded %u item loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1657  else
1658  TC_LOG_ERROR("server.loading", ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty");
1659 }
uint32 LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:247
LootStore LootTemplates_Item("item_loot_template","item entry", true)
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:263
uint32 getMSTime()
Definition: Timer.h:24
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32_t uint32
Definition: Define.h:150
std::set< uint32 > LootIdSet
Definition: LootMgr.h:211
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
std::unordered_map< uint32, ItemTemplate > ItemTemplateContainer
Definition: ItemTemplate.h:769
Definition: ItemTemplate.h:175

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TC_GAME_API void LoadLootTemplates_Mail ( )
1754 {
1755  TC_LOG_INFO("server.loading", "Loading mail loot templates...");
1756 
1757  uint32 oldMSTime = getMSTime();
1758 
1759  LootIdSet lootIdSet;
1760  uint32 count = LootTemplates_Mail.LoadAndCollectLootIds(lootIdSet);
1761 
1762  // remove real entries and check existence loot
1763  for (uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i)
1764  if (sMailTemplateStore.LookupEntry(i))
1765  if (lootIdSet.find(i) != lootIdSet.end())
1766  lootIdSet.erase(i);
1767 
1768  // output error for any still listed (not referenced from appropriate table) ids
1770 
1771  if (count)
1772  TC_LOG_INFO("server.loading", ">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1773  else
1774  TC_LOG_ERROR("server.loading", ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty");
1775 }
uint32 LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:247
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:263
uint32 getMSTime()
Definition: Timer.h:24
DB2Storage< MailTemplateEntry > sMailTemplateStore("MailTemplate.db2", MailTemplateFormat, HOTFIX_SEL_MAIL_TEMPLATE)
uint32_t uint32
Definition: Define.h:150
std::set< uint32 > LootIdSet
Definition: LootMgr.h:211
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
LootStore LootTemplates_Mail("mail_loot_template","mail template id", false)
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TC_GAME_API void LoadLootTemplates_Milling ( )
1662 {
1663  TC_LOG_INFO("server.loading", "Loading milling loot templates...");
1664 
1665  uint32 oldMSTime = getMSTime();
1666 
1667  LootIdSet lootIdSet;
1669 
1670  // remove real entries and check existence loot
1671  ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
1672  for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
1673  {
1674  if (!(itr->second.GetFlags() & ITEM_FLAG_MILLABLE))
1675  continue;
1676 
1677  if (lootIdSet.find(itr->second.GetId()) != lootIdSet.end())
1678  lootIdSet.erase(itr->second.GetId());
1679  }
1680 
1681  // output error for any still listed (not referenced from appropriate table) ids
1683 
1684  if (count)
1685  TC_LOG_INFO("server.loading", ">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1686  else
1687  TC_LOG_ERROR("server.loading", ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty");
1688 }
uint32 LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:247
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:263
uint32 getMSTime()
Definition: Timer.h:24
#define sObjectMgr
Definition: ObjectMgr.h:1567
LootStore LootTemplates_Milling("milling_loot_template","item entry (herb)", true)
Definition: ItemTemplate.h:202
uint32_t uint32
Definition: Define.h:150
std::set< uint32 > LootIdSet
Definition: LootMgr.h:211
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
std::unordered_map< uint32, ItemTemplate > ItemTemplateContainer
Definition: ItemTemplate.h:769

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TC_GAME_API void LoadLootTemplates_Pickpocketing ( )
1691 {
1692  TC_LOG_INFO("server.loading", "Loading pickpocketing loot templates...");
1693 
1694  uint32 oldMSTime = getMSTime();
1695 
1696  LootIdSet lootIdSet, lootIdSetUsed;
1698 
1699  // Remove real entries and check loot existence
1700  CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
1701  for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
1702  {
1703  if (uint32 lootid = itr->second.pickpocketLootId)
1704  {
1705  if (lootIdSet.find(lootid) == lootIdSet.end())
1706  LootTemplates_Pickpocketing.ReportNonExistingId(lootid, "Creature", itr->second.Entry);
1707  else
1708  lootIdSetUsed.insert(lootid);
1709  }
1710  }
1711 
1712  for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr)
1713  lootIdSet.erase(*itr);
1714 
1715  // output error for any still listed (not referenced from appropriate table) ids
1717 
1718  if (count)
1719  TC_LOG_INFO("server.loading", ">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1720  else
1721  TC_LOG_ERROR("server.loading", ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty");
1722 }
uint32 LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:247
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:263
uint32 getMSTime()
Definition: Timer.h:24
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32_t uint32
Definition: Define.h:150
std::set< uint32 > LootIdSet
Definition: LootMgr.h:211
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template","creature pickpocket lootid", true)
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
void ReportNonExistingId(uint32 lootId) const
Definition: LootMgr.cpp:270
std::unordered_map< uint32, CreatureTemplate > CreatureTemplateContainer
Definition: Creature.h:213

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TC_GAME_API void LoadLootTemplates_Prospecting ( )
1725 {
1726  TC_LOG_INFO("server.loading", "Loading prospecting loot templates...");
1727 
1728  uint32 oldMSTime = getMSTime();
1729 
1730  LootIdSet lootIdSet;
1732 
1733  // remove real entries and check existence loot
1734  ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
1735  for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
1736  {
1737  if (!(itr->second.GetFlags() & ITEM_FLAG_PROSPECTABLE))
1738  continue;
1739 
1740  if (lootIdSet.find(itr->second.GetId()) != lootIdSet.end())
1741  lootIdSet.erase(itr->second.GetId());
1742  }
1743 
1744  // output error for any still listed (not referenced from appropriate table) ids
1746 
1747  if (count)
1748  TC_LOG_INFO("server.loading", ">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1749  else
1750  TC_LOG_ERROR("server.loading", ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty");
1751 }
LootStore LootTemplates_Prospecting("prospecting_loot_template","item entry (ore)", true)
uint32 LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:247
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:263
uint32 getMSTime()
Definition: Timer.h:24
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32_t uint32
Definition: Define.h:150
std::set< uint32 > LootIdSet
Definition: LootMgr.h:211
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
Definition: ItemTemplate.h:191
std::unordered_map< uint32, ItemTemplate > ItemTemplateContainer
Definition: ItemTemplate.h:769

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TC_GAME_API void LoadLootTemplates_Reference ( )
1854 {
1855  TC_LOG_INFO("server.loading", "Loading reference loot templates...");
1856 
1857  uint32 oldMSTime = getMSTime();
1858 
1859  LootIdSet lootIdSet;
1861 
1862  // check references and remove used
1866  LootTemplates_Item.CheckLootRefs(&lootIdSet);
1872  LootTemplates_Mail.CheckLootRefs(&lootIdSet);
1874 
1875  // output error for any still listed ids (not referenced from any loot table)
1877 
1878  TC_LOG_INFO("server.loading", ">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime));
1879 }
LootStore LootTemplates_Disenchant("disenchant_loot_template","item disenchant id", true)
LootStore LootTemplates_Creature("creature_loot_template","creature entry", true)
LootStore LootTemplates_Prospecting("prospecting_loot_template","item entry (ore)", true)
uint32 LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:247
LootStore LootTemplates_Item("item_loot_template","item entry", true)
LootStore LootTemplates_Skinning("skinning_loot_template","creature skinning id", true)
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:263
uint32 getMSTime()
Definition: Timer.h:24
LootStore LootTemplates_Milling("milling_loot_template","item entry (herb)", true)
LootStore LootTemplates_Fishing("fishing_loot_template","area id", true)
LootStore LootTemplates_Gameobject("gameobject_loot_template","gameobject entry", true)
void CheckLootRefs(LootIdSet *ref_set=NULL) const
Definition: LootMgr.cpp:257
uint32_t uint32
Definition: Define.h:150
std::set< uint32 > LootIdSet
Definition: LootMgr.h:211
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
LootStore LootTemplates_Mail("mail_loot_template","mail template id", false)
LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template","creature pickpocket lootid", true)
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
LootStore LootTemplates_Reference("reference_loot_template","reference id", false)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TC_GAME_API void LoadLootTemplates_Skinning ( )
1778 {
1779  TC_LOG_INFO("server.loading", "Loading skinning loot templates...");
1780 
1781  uint32 oldMSTime = getMSTime();
1782 
1783  LootIdSet lootIdSet, lootIdSetUsed;
1785 
1786  // remove real entries and check existence loot
1787  CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
1788  for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
1789  {
1790  if (uint32 lootid = itr->second.SkinLootId)
1791  {
1792  if (lootIdSet.find(lootid) == lootIdSet.end())
1793  LootTemplates_Skinning.ReportNonExistingId(lootid, "Creature", itr->second.Entry);
1794  else
1795  lootIdSetUsed.insert(lootid);
1796  }
1797  }
1798 
1799  for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr)
1800  lootIdSet.erase(*itr);
1801 
1802  // output error for any still listed (not referenced from appropriate table) ids
1804 
1805  if (count)
1806  TC_LOG_INFO("server.loading", ">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1807  else
1808  TC_LOG_ERROR("server.loading", ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty");
1809 }
uint32 LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:247
LootStore LootTemplates_Skinning("skinning_loot_template","creature skinning id", true)
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:263
uint32 getMSTime()
Definition: Timer.h:24
#define sObjectMgr
Definition: ObjectMgr.h:1567
uint32_t uint32
Definition: Define.h:150
std::set< uint32 > LootIdSet
Definition: LootMgr.h:211
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
void ReportNonExistingId(uint32 lootId) const
Definition: LootMgr.cpp:270
std::unordered_map< uint32, CreatureTemplate > CreatureTemplateContainer
Definition: Creature.h:213

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TC_GAME_API void LoadLootTemplates_Spell ( )
1812 {
1813  TC_LOG_INFO("server.loading", "Loading spell loot templates...");
1814 
1815  uint32 oldMSTime = getMSTime();
1816 
1817  LootIdSet lootIdSet;
1819 
1820  // remove real entries and check existence loot
1821  for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id)
1822  {
1823  SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
1824  if (!spellInfo)
1825  continue;
1826 
1827  // possible cases
1828  if (!spellInfo->IsLootCrafting())
1829  continue;
1830 
1831  if (lootIdSet.find(spell_id) == lootIdSet.end())
1832  {
1833  // not report about not trainable spells (optionally supported by DB)
1834  // ignore 61756 (Northrend Inscription Research (FAST QA VERSION) for example
1836  {
1837  LootTemplates_Spell.ReportNonExistingId(spell_id, "Spell", spellInfo->Id);
1838  }
1839  }
1840  else
1841  lootIdSet.erase(spell_id);
1842  }
1843 
1844  // output error for any still listed (not referenced from appropriate table) ids
1846 
1847  if (count)
1848  TC_LOG_INFO("server.loading", ">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
1849  else
1850  TC_LOG_ERROR("server.loading", ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty");
1851 }
bool IsLootCrafting() const
Definition: SpellInfo.cpp:1238
uint32 Id
Definition: SpellInfo.h:329
uint32 LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:247
Definition: SpellInfo.h:326
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:263
uint32 getMSTime()
Definition: Timer.h:24
Definition: SharedDefines.h:361
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:462
#define sSpellMgr
Definition: SpellMgr.h:756
uint32_t uint32
Definition: Define.h:150
std::set< uint32 > LootIdSet
Definition: LootMgr.h:211
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:42
LootStore LootTemplates_Spell("spell_loot_template","spell id (random item creating)", false)
Definition: SharedDefines.h:372
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:201
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
void ReportNonExistingId(uint32 lootId) const
Definition: LootMgr.cpp:270

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

TC_GAME_API LootStore LootTemplates_Creature
TC_GAME_API LootStore LootTemplates_Disenchant
TC_GAME_API LootStore LootTemplates_Fishing
TC_GAME_API LootStore LootTemplates_Gameobject
TC_GAME_API LootStore LootTemplates_Item
TC_GAME_API LootStore LootTemplates_Mail
TC_GAME_API LootStore LootTemplates_Milling
TC_GAME_API LootStore LootTemplates_Pickpocketing
TC_GAME_API LootStore LootTemplates_Prospecting
TC_GAME_API LootStore LootTemplates_Reference
TC_GAME_API LootStore LootTemplates_Skinning
TC_GAME_API LootStore LootTemplates_Spell