TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
LootMgr.cpp File Reference
#include "LootMgr.h"
#include "Log.h"
#include "ObjectMgr.h"
#include "World.h"
#include "Util.h"
#include "SharedDefines.h"
#include "SpellMgr.h"
#include "SpellInfo.h"
#include "Group.h"
#include "Player.h"
#include "Containers.h"
#include "LootPackets.h"
+ Include dependency graph for LootMgr.cpp:

Classes

struct  LootGroupInvalidSelector
 
class  LootTemplate::LootGroup
 

Functions

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

Variables

static Rates const qualityToRate [MAX_ITEM_QUALITY]
 
LootStore LootTemplates_Creature ("creature_loot_template","creature entry", true)
 
LootStore LootTemplates_Disenchant ("disenchant_loot_template","item disenchant id", true)
 
LootStore LootTemplates_Fishing ("fishing_loot_template","area id", true)
 
LootStore LootTemplates_Gameobject ("gameobject_loot_template","gameobject entry", true)
 
LootStore LootTemplates_Item ("item_loot_template","item entry", true)
 
LootStore LootTemplates_Mail ("mail_loot_template","mail template id", false)
 
LootStore LootTemplates_Milling ("milling_loot_template","item entry (herb)", true)
 
LootStore LootTemplates_Pickpocketing ("pickpocketing_loot_template","creature pickpocket lootid", true)
 
LootStore LootTemplates_Prospecting ("prospecting_loot_template","item entry (ore)", true)
 
LootStore LootTemplates_Reference ("reference_loot_template","reference id", false)
 
LootStore LootTemplates_Skinning ("skinning_loot_template","creature skinning id", true)
 
LootStore LootTemplates_Spell ("spell_loot_template","spell id (random item creating)", false)
 

Function Documentation

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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:

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

LootStore LootTemplates_Creature("creature_loot_template","creature entry", true)
LootStore LootTemplates_Disenchant("disenchant_loot_template","item disenchant id", true)
LootStore LootTemplates_Fishing("fishing_loot_template","area id", true)
LootStore LootTemplates_Gameobject("gameobject_loot_template","gameobject entry", true)
LootStore LootTemplates_Item("item_loot_template","item entry", true)
LootStore LootTemplates_Mail("mail_loot_template","mail template id", false)
LootStore LootTemplates_Milling("milling_loot_template","item entry (herb)", true)
LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template","creature pickpocket lootid", true)
LootStore LootTemplates_Prospecting("prospecting_loot_template","item entry (ore)", true)
LootStore LootTemplates_Reference("reference_loot_template","reference id", false)
LootStore LootTemplates_Skinning("skinning_loot_template","creature skinning id", true)
LootStore LootTemplates_Spell("spell_loot_template","spell id (random item creating)", false)
Rates const qualityToRate[MAX_ITEM_QUALITY]
static
Initial value: