OregonCore  revision fb2a440-git
Your Favourite TBC server
LootMgr.h File Reference
#include "ItemEnchantmentMgr.h"
#include "ByteBuffer.h"
#include "Utilities/LinkedReference/RefManager.h"
#include "ConditionMgr.h"
#include <map>
#include <vector>

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
 
struct  LootView
 

Macros

#define MAX_NR_LOOT_ITEMS   16
 
#define MAX_NR_QUEST_ITEMS   32
 

Typedefs

typedef std::vector< QuestItemQuestItemList
 
typedef std::map< uint32, QuestItemList * > QuestItemMap
 
typedef std::vector< LootStoreItemLootStoreItemList
 
typedef UNORDERED_MAP< uint32, LootTemplate * > LootTemplateMap
 
typedef std::set< uint32LootIdSet
 

Enumerations

enum  LootMethod {
  FREE_FOR_ALL = 0, ROUND_ROBIN = 1, MASTER_LOOT = 2, GROUP_LOOT = 3,
  NEED_BEFORE_GREED = 4
}
 
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_SKINNING = 2, LOOT_FISHING = 3,
  LOOT_PICKPOCKETING = 4, LOOT_DISENCHANTING = 5, LOOT_PROSPECTING = 6, LOOT_INSIGNIA = 7,
  LOOT_FISHINGHOLE = 8
}
 
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 = 2, LOOT_SLOT_TYPE_LOCKED = 3,
  LOOT_SLOT_TYPE_OWNER = 4
}
 

Functions

ByteBufferoperator<< (ByteBuffer &b, LootItem const &li)
 
ByteBufferoperator<< (ByteBuffer &b, LootView const &lv)
 
void LoadLootTemplates_Creature ()
 
void LoadLootTemplates_Fishing ()
 
void LoadLootTemplates_Gameobject ()
 
void LoadLootTemplates_Item ()
 
void LoadLootTemplates_Mail ()
 
void LoadLootTemplates_Pickpocketing ()
 
void LoadLootTemplates_Skinning ()
 
void LoadLootTemplates_Disenchant ()
 
void LoadLootTemplates_Prospecting ()
 
void LoadLootTemplates_Reference ()
 
void LoadLootTables ()
 

Variables

LootStore LootTemplates_Creature
 
LootStore LootTemplates_Fishing
 
LootStore LootTemplates_Gameobject
 
LootStore LootTemplates_Item
 
LootStore LootTemplates_Mail
 
LootStore LootTemplates_Pickpocketing
 
LootStore LootTemplates_Reference
 
LootStore LootTemplates_Skinning
 
LootStore LootTemplates_Disenchant
 
LootStore LootTemplates_Prospecting
 

Macro Definition Documentation

#define MAX_NR_LOOT_ITEMS   16

Definition at line 29 of file LootMgr.h.

Referenced by Loot::AddItem(), Loot::FillLoot(), and Loot::FillQuestLoot().

#define MAX_NR_QUEST_ITEMS   32

Definition at line 31 of file LootMgr.h.

Referenced by Loot::AddItem(), and Loot::FillLoot().

Typedef Documentation

typedef std::set<uint32> LootIdSet

Definition at line 166 of file LootMgr.h.

typedef std::vector<LootStoreItem> LootStoreItemList

Definition at line 163 of file LootMgr.h.

Definition at line 164 of file LootMgr.h.

typedef std::vector<QuestItem> QuestItemList

Definition at line 159 of file LootMgr.h.

typedef std::map<uint32, QuestItemList*> QuestItemMap

Definition at line 162 of file LootMgr.h.

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 

Definition at line 70 of file LootMgr.h.

71 {
72  LOOT_ERROR_DIDNT_KILL = 0, // You don't have permission to loot that corpse.
73  LOOT_ERROR_TOO_FAR = 4, // You are too far away to loot that corpse.
74  LOOT_ERROR_BAD_FACING = 5, // You must be facing the corpse to loot it.
75  LOOT_ERROR_LOCKED = 6, // Someone is already looting that corpse.
76  LOOT_ERROR_NOTSTANDING = 8, // You need to be standing up to loot something!
77  LOOT_ERROR_STUNNED = 9, // You can't loot anything while stunned!
78  LOOT_ERROR_PLAYER_NOT_FOUND = 10, // Player not found
79  LOOT_ERROR_PLAY_TIME_EXCEEDED = 11, // Maximum play time exceeded
80  LOOT_ERROR_MASTER_INV_FULL = 12, // That player's inventory is full
81  LOOT_ERROR_MASTER_UNIQUE_ITEM = 13, // Player has too many of that item already
82  LOOT_ERROR_MASTER_OTHER = 14, // Can't assign item to that player
83  LOOT_ERROR_ALREADY_PICKPOCKETED = 15, // Your target has already had its pockets picked
84  LOOT_ERROR_NOT_WHILE_SHAPESHIFTED = 16 // You can't do that while shapeshifted.
85 };
enum LootMethod
Enumerator
FREE_FOR_ALL 
ROUND_ROBIN 
MASTER_LOOT 
GROUP_LOOT 
NEED_BEFORE_GREED 

Definition at line 34 of file LootMgr.h.

35 {
36  FREE_FOR_ALL = 0,
37  ROUND_ROBIN = 1,
38  MASTER_LOOT = 2,
39  GROUP_LOOT = 3,
41 };
Enumerator
LOOT_SLOT_TYPE_ALLOW_LOOT 
LOOT_SLOT_TYPE_ROLL_ONGOING 
LOOT_SLOT_TYPE_MASTER 
LOOT_SLOT_TYPE_LOCKED 
LOOT_SLOT_TYPE_OWNER 

Definition at line 88 of file LootMgr.h.

89 {
90  LOOT_SLOT_TYPE_ALLOW_LOOT = 0, // player can loot the item.
91  LOOT_SLOT_TYPE_ROLL_ONGOING = 1, // roll is ongoing. player cannot loot.
92  LOOT_SLOT_TYPE_MASTER = 2, // item can only be distributed by group loot master.
93  LOOT_SLOT_TYPE_LOCKED = 3, // item is shown in red. player cannot loot.
94  LOOT_SLOT_TYPE_OWNER = 4 // ignore binding confirmation and etc, for single player looting
95 };
enum LootType
Enumerator
LOOT_NONE 
LOOT_CORPSE 
LOOT_SKINNING 
LOOT_FISHING 
LOOT_PICKPOCKETING 

unsupported by client, sending LOOT_SKINNING instead

LOOT_DISENCHANTING 

unsupported by client, sending LOOT_SKINNING instead

LOOT_PROSPECTING 

unsupported by client, sending LOOT_SKINNING instead

LOOT_INSIGNIA 

unsupported by client, sending LOOT_SKINNING instead

LOOT_FISHINGHOLE 

unsupported by client, sending LOOT_FISHING instead

Definition at line 54 of file LootMgr.h.

55 {
56  LOOT_NONE = 0,
57 
58  LOOT_CORPSE = 1,
59  LOOT_SKINNING = 2,
60  LOOT_FISHING = 3,
61 
62  LOOT_PICKPOCKETING = 4,
63  LOOT_DISENCHANTING = 5,
64 
65  LOOT_PROSPECTING = 6,
66  LOOT_INSIGNIA = 7,
67  LOOT_FISHINGHOLE = 8
68 };
unsupported by client, sending LOOT_FISHING instead
Definition: LootMgr.h:67
unsupported by client, sending LOOT_SKINNING instead
Definition: LootMgr.h:65
unsupported by client, sending LOOT_SKINNING instead
Definition: LootMgr.h:63
unsupported by client, sending LOOT_SKINNING instead
Definition: LootMgr.h:66
unsupported by client, sending LOOT_SKINNING instead
Definition: LootMgr.h:62
Enumerator
ALL_PERMISSION 
GROUP_PERMISSION 
MASTER_PERMISSION 
RESTRICTED_PERMISSION 
ROUND_ROBIN_PERMISSION 
OWNER_PERMISSION 
NONE_PERMISSION 

Definition at line 43 of file LootMgr.h.

Function Documentation

void LoadLootTables ( )
inline

Definition at line 431 of file LootMgr.h.

References LoadLootTemplates_Creature(), LoadLootTemplates_Disenchant(), LoadLootTemplates_Fishing(), LoadLootTemplates_Gameobject(), LoadLootTemplates_Item(), LoadLootTemplates_Mail(), LoadLootTemplates_Pickpocketing(), LoadLootTemplates_Prospecting(), LoadLootTemplates_Reference(), and LoadLootTemplates_Skinning().

Referenced by ChatHandler::HandleReloadAllLootCommand(), and World::SetInitialWorldSettings().

432 {
444 }
void LoadLootTemplates_Skinning()
Definition: LootMgr.cpp:1452
void LoadLootTemplates_Prospecting()
Definition: LootMgr.cpp:1421
void LoadLootTemplates_Gameobject()
Definition: LootMgr.cpp:1354
void LoadLootTemplates_Mail()
Definition: LootMgr.cpp:1436
void LoadLootTemplates_Reference()
Definition: LootMgr.cpp:1478
void LoadLootTemplates_Fishing()
Definition: LootMgr.cpp:1339
void LoadLootTemplates_Item()
Definition: LootMgr.cpp:1380
void LoadLootTemplates_Disenchant()
Definition: LootMgr.cpp:1314
void LoadLootTemplates_Creature()
Definition: LootMgr.cpp:1288
void LoadLootTemplates_Pickpocketing()
Definition: LootMgr.cpp:1395
void LoadLootTemplates_Creature ( )

Definition at line 1288 of file LootMgr.cpp.

References LootStore::LoadAndCollectLootIds(), SQLStorage::LookupEntry(), LootTemplates_Creature, SQLStorage::MaxEntry, LootStore::ReportNonExistingId(), LootStore::ReportUnusedIds(), and sCreatureStorage.

Referenced by ChatHandler::HandleReloadLootTemplatesCreatureCommand(), LoadLootTables(), and LootView::LootView().

1289 {
1290  LootIdSet ids_set, ids_setUsed;
1292 
1293  // remove real entries and check existence loot
1294  for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
1295  {
1296  if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
1297  {
1298  if (uint32 lootid = cInfo->lootid)
1299  {
1300  if (ids_set.find(lootid) == ids_set.end())
1302  else
1303  ids_setUsed.insert(lootid);
1304  }
1305  }
1306  }
1307  for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
1308  ids_set.erase(*itr);
1309 
1310  // output error for any still listed (not referenced from appropriate table) ids
1312 }
SQLStorage sCreatureStorage
void ReportNonExistingId(uint32 id) const
Definition: LootMgr.cpp:220
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:213
LootStore LootTemplates_Creature("creature_loot_template","creature entry")
std::set< uint32 > LootIdSet
Definition: LootMgr.h:166
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
void LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:199
uint32 MaxEntry
Definition: SQLStorage.h:62
ACE_UINT32 uint32
Definition: Define.h:71
void LoadLootTemplates_Disenchant ( )

Definition at line 1314 of file LootMgr.cpp.

References LootStore::LoadAndCollectLootIds(), SQLStorage::LookupEntry(), LootTemplates_Disenchant, SQLStorage::MaxEntry, LootStore::ReportNonExistingId(), LootStore::ReportUnusedIds(), and sItemStorage.

Referenced by ChatHandler::HandleReloadLootTemplatesDisenchantCommand(), LoadLootTables(), and LootView::LootView().

1315 {
1316  LootIdSet ids_set, ids_setUsed;
1318 
1319  // remove real entries and check existence loot
1320  for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i)
1321  {
1322  if (ItemTemplate const* proto = sItemStorage.LookupEntry<ItemTemplate>(i))
1323  {
1324  if (uint32 lootid = proto->DisenchantID)
1325  {
1326  if (ids_set.find(lootid) == ids_set.end())
1328  else
1329  ids_setUsed.insert(lootid);
1330  }
1331  }
1332  }
1333  for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
1334  ids_set.erase(*itr);
1335  // output error for any still listed (not referenced from appropriate table) ids
1337 }
void ReportNonExistingId(uint32 id) const
Definition: LootMgr.cpp:220
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:213
std::set< uint32 > LootIdSet
Definition: LootMgr.h:166
SQLStorage sItemStorage
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
void LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:199
uint32 MaxEntry
Definition: SQLStorage.h:62
ACE_UINT32 uint32
Definition: Define.h:71
LootStore LootTemplates_Disenchant("disenchant_loot_template","item disenchant id")
void LoadLootTemplates_Fishing ( )

Definition at line 1339 of file LootMgr.cpp.

References LootStore::LoadAndCollectLootIds(), LootTemplates_Fishing, LootStore::ReportUnusedIds(), and sAreaStore.

Referenced by ChatHandler::HandleReloadLootTemplatesFishingCommand(), LoadLootTables(), and LootView::LootView().

1340 {
1341  LootIdSet ids_set;
1343 
1344  // remove real entries and check existence loot
1345  for (uint32 i = 1; i < sAreaStore.GetNumRows(); ++i)
1346  if (AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(i))
1347  if (ids_set.find(areaEntry->ID) != ids_set.end())
1348  ids_set.erase(areaEntry->ID);
1349 
1350  // output error for any still listed (not referenced from appropriate table) ids
1352 }
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:213
std::set< uint32 > LootIdSet
Definition: LootMgr.h:166
LootStore LootTemplates_Fishing("fishing_loot_template","area id")
void LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:199
ACE_UINT32 uint32
Definition: Define.h:71
DBCStorage< AreaTableEntry > sAreaStore(AreaTableEntryfmt)
void LoadLootTemplates_Gameobject ( )

Definition at line 1354 of file LootMgr.cpp.

References LootStore::LoadAndCollectLootIds(), SQLStorage::LookupEntry(), LootTemplates_Gameobject, SQLStorage::MaxEntry, LootStore::ReportNonExistingId(), LootStore::ReportUnusedIds(), and sGOStorage.

Referenced by ChatHandler::HandleReloadLootTemplatesGameobjectCommand(), LoadLootTables(), and LootView::LootView().

1355 {
1356  LootIdSet ids_set, ids_setUsed;
1358 
1359  // remove real entries and check existence loot
1360  for (uint32 i = 1; i < sGOStorage.MaxEntry; ++i)
1361  {
1362  if (GameObjectInfo const* gInfo = sGOStorage.LookupEntry<GameObjectInfo>(i))
1363  {
1364  if (uint32 lootid = gInfo->GetLootId())
1365  {
1366  if (ids_set.find(lootid) == ids_set.end())
1368  else
1369  ids_setUsed.insert(lootid);
1370  }
1371  }
1372  }
1373  for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
1374  ids_set.erase(*itr);
1375 
1376  // output error for any still listed (not referenced from appropriate table) ids
1378 }
void ReportNonExistingId(uint32 id) const
Definition: LootMgr.cpp:220
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:213
LootStore LootTemplates_Gameobject("gameobject_loot_template","gameobject entry")
std::set< uint32 > LootIdSet
Definition: LootMgr.h:166
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
void LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:199
uint32 MaxEntry
Definition: SQLStorage.h:62
SQLStorage sGOStorage
ACE_UINT32 uint32
Definition: Define.h:71
void LoadLootTemplates_Item ( )

Definition at line 1380 of file LootMgr.cpp.

References ITEM_PROTO_FLAG_HAS_LOOT, LootStore::LoadAndCollectLootIds(), SQLStorage::LookupEntry(), LootTemplates_Item, SQLStorage::MaxEntry, LootStore::ReportUnusedIds(), and sItemStorage.

Referenced by ChatHandler::HandleReloadLootTemplatesItemCommand(), LoadLootTables(), and LootView::LootView().

1381 {
1382  LootIdSet ids_set;
1384 
1385  // remove real entries and check existence loot
1386  for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i)
1387  if (ItemTemplate const* proto = sItemStorage.LookupEntry<ItemTemplate>(i))
1388  if (ids_set.find(proto->ItemId) != ids_set.end() && proto->Flags & ITEM_PROTO_FLAG_HAS_LOOT)
1389  ids_set.erase(proto->ItemId);
1390 
1391  // output error for any still listed (not referenced from appropriate table) ids
1393 }
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:213
std::set< uint32 > LootIdSet
Definition: LootMgr.h:166
LootStore LootTemplates_Item("item_loot_template","item entry")
SQLStorage sItemStorage
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
void LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:199
uint32 MaxEntry
Definition: SQLStorage.h:62
ACE_UINT32 uint32
Definition: Define.h:71
void LoadLootTemplates_Mail ( )

Definition at line 1436 of file LootMgr.cpp.

References LootStore::LoadAndCollectLootIds(), LootTemplates_Mail, LootStore::ReportUnusedIds(), and sObjectMgr.

Referenced by ChatHandler::HandleReloadLootTemplatesMailCommand(), LoadLootTables(), and LootView::LootView().

1437 {
1438  LootIdSet ids_set;
1440 
1441  // remove real entries and check existence loot
1442  ObjectMgr::QuestMap const& questMap = sObjectMgr.GetQuestTemplates();
1443  for (ObjectMgr::QuestMap::const_iterator itr = questMap.begin(); itr != questMap.end(); ++itr)
1444  if (uint32 mail_template_id = itr->second->GetRewMailTemplateId())
1445  if (ids_set.find(mail_template_id) != ids_set.end())
1446  ids_set.erase(mail_template_id);
1447 
1448  // output error for any still listed (not referenced from appropriate table) ids
1450 }
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:213
#define sObjectMgr
Definition: ObjectMgr.h:1285
LootStore LootTemplates_Mail("mail_loot_template","mail template id")
std::set< uint32 > LootIdSet
Definition: LootMgr.h:166
UNORDERED_MAP< uint32, Quest * > QuestMap
Definition: ObjectMgr.h:530
void LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:199
ACE_UINT32 uint32
Definition: Define.h:71
void LoadLootTemplates_Pickpocketing ( )

Definition at line 1395 of file LootMgr.cpp.

References LootStore::LoadAndCollectLootIds(), SQLStorage::LookupEntry(), LootTemplates_Pickpocketing, SQLStorage::MaxEntry, LootStore::ReportNonExistingId(), LootStore::ReportUnusedIds(), and sCreatureStorage.

Referenced by ChatHandler::HandleReloadLootTemplatesPickpocketingCommand(), LoadLootTables(), and LootView::LootView().

1396 {
1397  LootIdSet ids_set, ids_setUsed;
1399 
1400  // remove real entries and check existence loot
1401  for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
1402  {
1403  if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
1404  {
1405  if (uint32 lootid = cInfo->pickpocketLootId)
1406  {
1407  if (ids_set.find(lootid) == ids_set.end())
1409  else
1410  ids_setUsed.insert(lootid);
1411  }
1412  }
1413  }
1414  for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
1415  ids_set.erase(*itr);
1416 
1417  // output error for any still listed (not referenced from appropriate table) ids
1419 }
SQLStorage sCreatureStorage
void ReportNonExistingId(uint32 id) const
Definition: LootMgr.cpp:220
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:213
std::set< uint32 > LootIdSet
Definition: LootMgr.h:166
LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template","creature pickpocket lootid")
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
void LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:199
uint32 MaxEntry
Definition: SQLStorage.h:62
ACE_UINT32 uint32
Definition: Define.h:71
void LoadLootTemplates_Prospecting ( )

Definition at line 1421 of file LootMgr.cpp.

References LootStore::LoadAndCollectLootIds(), SQLStorage::LookupEntry(), LootTemplates_Prospecting, SQLStorage::MaxEntry, LootStore::ReportUnusedIds(), and sItemStorage.

Referenced by ChatHandler::HandleReloadLootTemplatesProspectingCommand(), LoadLootTables(), and LootView::LootView().

1422 {
1423  LootIdSet ids_set;
1425 
1426  // remove real entries and check existence loot
1427  for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i)
1428  if (ItemTemplate const* proto = sItemStorage.LookupEntry<ItemTemplate>(i))
1429  if (ids_set.find(proto->ItemId) != ids_set.end())
1430  ids_set.erase(proto->ItemId);
1431 
1432  // output error for any still listed (not referenced from appropriate table) ids
1434 }
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:213
LootStore LootTemplates_Prospecting("prospecting_loot_template","item entry (ore)")
std::set< uint32 > LootIdSet
Definition: LootMgr.h:166
SQLStorage sItemStorage
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
void LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:199
uint32 MaxEntry
Definition: SQLStorage.h:62
ACE_UINT32 uint32
Definition: Define.h:71
void LoadLootTemplates_Reference ( )

Definition at line 1478 of file LootMgr.cpp.

References LootStore::CheckLootRefs(), LootStore::LoadAndCollectLootIds(), LootTemplates_Creature, LootTemplates_Disenchant, LootTemplates_Fishing, LootTemplates_Gameobject, LootTemplates_Item, LootTemplates_Mail, LootTemplates_Pickpocketing, LootTemplates_Prospecting, LootTemplates_Reference, LootTemplates_Skinning, and LootStore::ReportUnusedIds().

Referenced by ChatHandler::HandleReloadLootTemplatesReferenceCommand(), LoadLootTables(), and LootView::LootView().

1479 {
1480  LootIdSet ids_set;
1482 
1483  // check references and remove used
1494 
1495  // output error for any still listed ids (not referenced from any loot table)
1497 }
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:213
LootStore LootTemplates_Gameobject("gameobject_loot_template","gameobject entry")
LootStore LootTemplates_Creature("creature_loot_template","creature entry")
LootStore LootTemplates_Prospecting("prospecting_loot_template","item entry (ore)")
LootStore LootTemplates_Mail("mail_loot_template","mail template id")
void CheckLootRefs(LootIdSet *ref_set=NULL) const
Definition: LootMgr.cpp:207
std::set< uint32 > LootIdSet
Definition: LootMgr.h:166
LootStore LootTemplates_Item("item_loot_template","item entry")
LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template","creature pickpocket lootid")
LootStore LootTemplates_Reference("reference_loot_template","reference id")
LootStore LootTemplates_Fishing("fishing_loot_template","area id")
void LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:199
LootStore LootTemplates_Skinning("skinning_loot_template","creature skinning id")
LootStore LootTemplates_Disenchant("disenchant_loot_template","item disenchant id")
void LoadLootTemplates_Skinning ( )

Definition at line 1452 of file LootMgr.cpp.

References LootStore::LoadAndCollectLootIds(), SQLStorage::LookupEntry(), LootTemplates_Skinning, SQLStorage::MaxEntry, LootStore::ReportNonExistingId(), LootStore::ReportUnusedIds(), and sCreatureStorage.

Referenced by ChatHandler::HandleReloadLootTemplatesSkinningCommand(), LoadLootTables(), and LootView::LootView().

1453 {
1454  LootIdSet ids_set, ids_setUsed;
1456 
1457  // remove real entries and check existence loot
1458  for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
1459  {
1460  if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
1461  {
1462  if (uint32 lootid = cInfo->SkinLootId)
1463  {
1464  if (ids_set.find(lootid) == ids_set.end())
1466  else
1467  ids_setUsed.insert(lootid);
1468  }
1469  }
1470  }
1471  for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
1472  ids_set.erase(*itr);
1473 
1474  // output error for any still listed (not referenced from appropriate table) ids
1476 }
SQLStorage sCreatureStorage
void ReportNonExistingId(uint32 id) const
Definition: LootMgr.cpp:220
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:213
std::set< uint32 > LootIdSet
Definition: LootMgr.h:166
T const * LookupEntry(uint32 id) const
Definition: SQLStorage.h:52
void LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:199
uint32 MaxEntry
Definition: SQLStorage.h:62
ACE_UINT32 uint32
Definition: Define.h:71
LootStore LootTemplates_Skinning("skinning_loot_template","creature skinning id")
ByteBuffer& operator<< ( ByteBuffer b,
LootItem const &  li 
)

Definition at line 751 of file LootMgr.cpp.

References LootItem::count, LootItem::itemid, LootItem::randomPropertyId, LootItem::randomSuffix, and sObjectMgr.

Referenced by LootValidatorRefManager::rend().

752 {
753  b << uint32(li.itemid);
754  b << uint32(li.count); // nr of items of this type
755  b << uint32(sObjectMgr.GetItemTemplate(li.itemid)->DisplayInfoID);
756  b << uint32(li.randomSuffix);
757  b << uint32(li.randomPropertyId);
758  //b << uint8(0); // slot type - will send after this function call
759  return b;
760 }
#define sObjectMgr
Definition: ObjectMgr.h:1285
ACE_UINT32 uint32
Definition: Define.h:71
ByteBuffer& operator<< ( ByteBuffer b,
LootView const &  lv 
)

Definition at line 762 of file LootMgr.cpp.

References ALL_PERMISSION, Player::GetGroup(), Object::GetGUID(), Object::GetGUIDLow(), Group::GetMasterLooterGuid(), Loot::GetPlayerFFAItems(), Loot::GetPlayerNonQuestNonFFAConditionalItems(), Loot::GetPlayerQuestItems(), Loot::gold, GROUP_PERMISSION, LootItem::is_looted, Loot::items, LootView::loot, LOOT_SLOT_TYPE_ALLOW_LOOT, LOOT_SLOT_TYPE_LOCKED, LOOT_SLOT_TYPE_MASTER, LOOT_SLOT_TYPE_OWNER, LOOT_SLOT_TYPE_ROLL_ONGOING, MASTER_PERMISSION, NONE_PERMISSION, OWNER_PERMISSION, LootView::permission, ByteBuffer::put(), Loot::quest_items, RESTRICTED_PERMISSION, ROUND_ROBIN_PERMISSION, Loot::roundRobinPlayer, LootView::viewer, and ByteBuffer::wpos().

763 {
764  if (lv.permission == NONE_PERMISSION)
765  {
766  b << uint32(0); // gold
767  b << uint8(0); // item count
768  return b;
769  }
770 
771  Loot &l = lv.loot;
772 
773  uint8 itemsShown = 0;
774 
775  b << uint32(l.gold); //gold
776 
777  size_t count_pos = b.wpos(); // pos of item count byte
778  b << uint8(0); // item count placeholder
779 
780  switch (lv.permission)
781  {
782  case GROUP_PERMISSION:
783  case MASTER_PERMISSION:
785  {
786  // if you are not the round-robin group looter, you can only see
787  // blocked rolled items and quest items, and !ffa items
788  for (uint8 i = 0; i < l.items.size(); ++i)
789  {
790  if (!l.items[i].is_looted && !l.items[i].freeforall && l.items[i].conditions.empty() && l.items[i].AllowedForPlayer(lv.viewer))
791  {
792  uint8 slot_type;
793 
794  if (l.items[i].is_blocked) // for ML & restricted is_blocked = !is_underthreshold
795  {
796  switch (lv.permission)
797  {
798  case GROUP_PERMISSION:
799  slot_type = LOOT_SLOT_TYPE_ROLL_ONGOING;
800  break;
801  case MASTER_PERMISSION:
802  {
803  if (lv.viewer->GetGroup() && lv.viewer->GetGroup()->GetMasterLooterGuid() == lv.viewer->GetGUID())
804  slot_type = LOOT_SLOT_TYPE_MASTER;
805  else
806  slot_type = LOOT_SLOT_TYPE_LOCKED;
807  break;
808  }
810  slot_type = LOOT_SLOT_TYPE_LOCKED;
811  break;
812  default:
813  continue;
814  }
815  }
816  else if (!l.roundRobinPlayer || lv.viewer->GetGUID() == l.roundRobinPlayer || !l.items[i].is_underthreshold)
817  {
818  // no round robin owner or he has released the loot
819  // or it IS the round robin group owner
820  // => item is lootable
821  slot_type = LOOT_SLOT_TYPE_ALLOW_LOOT;
822  }
823  else
824  // item shall not be displayed.
825  continue;
826 
827  b << uint8(i) << l.items[i];
828  b << uint8(slot_type);
829  ++itemsShown;
830  }
831  }
832  break;
833  }
835  {
836  for (uint8 i = 0; i < l.items.size(); ++i)
837  {
838  if (!l.items[i].is_looted && !l.items[i].freeforall && l.items[i].conditions.empty() && l.items[i].AllowedForPlayer(lv.viewer))
839  {
840  if (l.roundRobinPlayer && lv.viewer->GetGUID() != l.roundRobinPlayer)
841  // item shall not be displayed.
842  continue;
843 
844  b << uint8(i) << l.items[i];
846  ++itemsShown;
847  }
848  }
849  break;
850  }
851  case ALL_PERMISSION:
852  case OWNER_PERMISSION:
853  {
854  uint8 slot_type = lv.permission == OWNER_PERMISSION ? LOOT_SLOT_TYPE_OWNER : LOOT_SLOT_TYPE_ALLOW_LOOT;
855  for (uint8 i = 0; i < l.items.size(); ++i)
856  {
857  if (!l.items[i].is_looted && !l.items[i].freeforall && l.items[i].conditions.empty() && l.items[i].AllowedForPlayer(lv.viewer))
858  {
859  b << uint8(i) << l.items[i];
860  b << uint8(slot_type);
861  ++itemsShown;
862  }
863  }
864  break;
865  }
866  default:
867  return b;
868  }
869 
871  QuestItemMap const& lootPlayerQuestItems = l.GetPlayerQuestItems();
872  QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(lv.viewer->GetGUIDLow());
873  if (q_itr != lootPlayerQuestItems.end())
874  {
875  QuestItemList* q_list = q_itr->second;
876  for (QuestItemList::const_iterator qi = q_list->begin(); qi != q_list->end(); ++qi)
877  {
878  LootItem &item = l.quest_items[qi->index];
879  if (!qi->is_looted && !item.is_looted)
880  {
881  b << uint8(l.items.size() + (qi - q_list->begin()));
882  b << item;
883  b << uint8(slotType);
884  ++itemsShown;
885  }
886  }
887  }
888 
889  QuestItemMap const& lootPlayerFFAItems = l.GetPlayerFFAItems();
890  QuestItemMap::const_iterator ffa_itr = lootPlayerFFAItems.find(lv.viewer->GetGUIDLow());
891  if (ffa_itr != lootPlayerFFAItems.end())
892  {
893  QuestItemList* ffa_list = ffa_itr->second;
894  for (QuestItemList::const_iterator fi = ffa_list->begin(); fi != ffa_list->end(); ++fi)
895  {
896  LootItem &item = l.items[fi->index];
897  if (!fi->is_looted && !item.is_looted)
898  {
899  b << uint8(fi->index);
900  b << item;
901  b << uint8(slotType);
902  ++itemsShown;
903  }
904  }
905  }
906 
907  QuestItemMap const& lootPlayerNonQuestNonFFAConditionalItems = l.GetPlayerNonQuestNonFFAConditionalItems();
908  QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(lv.viewer->GetGUIDLow());
909  if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end())
910  {
911  QuestItemList* conditional_list = nn_itr->second;
912  for (QuestItemList::const_iterator ci = conditional_list->begin(); ci != conditional_list->end(); ++ci)
913  {
914  LootItem &item = l.items[ci->index];
915  if (!ci->is_looted && !item.is_looted)
916  {
917  b << uint8(ci->index);
918  b << item;
919  b << uint8(slotType);
920  ++itemsShown;
921  }
922  }
923  }
924 
925  //update number of items shown
926  b.put<uint8>(count_pos, itemsShown);
927 
928  return b;
929 }
std::map< uint32, QuestItemList * > QuestItemMap
Definition: LootMgr.h:162
bool is_looted
Definition: LootMgr.h:131
LootSlotType
Definition: LootMgr.h:88
QuestItemMap const & GetPlayerNonQuestNonFFAConditionalItems() const
Definition: LootMgr.h:302
size_t wpos() const
Definition: ByteBuffer.h:264
QuestItemMap const & GetPlayerQuestItems() const
Definition: LootMgr.h:294
ACE_UINT8 uint8
Definition: Define.h:73
Definition: LootMgr.h:290
void put(size_t pos, T value)
Definition: ByteBuffer.h:79
uint64 roundRobinPlayer
Definition: LootMgr.h:311
uint32 gold
Definition: LootMgr.h:309
std::vector< LootItem > items
Definition: LootMgr.h:307
std::vector< QuestItem > QuestItemList
Definition: LootMgr.h:159
QuestItemMap const & GetPlayerFFAItems() const
Definition: LootMgr.h:298
ACE_UINT32 uint32
Definition: Define.h:71
std::vector< LootItem > quest_items
Definition: LootMgr.h:308

Variable Documentation