AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
LootMgr.h File Reference
#include "ByteBuffer.h"
#include "ConditionMgr.h"
#include "ObjectGuid.h"
#include "RefMgr.h"
#include "SharedDefines.h"
#include <list>
#include <map>
#include <unordered_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  LootValidatorRefMgr
 
struct  Loot
 
struct  LootView
 

Macros

#define MAX_NR_LOOT_ITEMS   18
 
#define MAX_NR_QUEST_ITEMS   32
 

Typedefs

typedef GuidSet AllowedLooterSet
 
typedef std::vector< QuestItemQuestItemList
 
typedef std::vector< LootItemLootItemList
 
typedef std::map< ObjectGuid, 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
}
 
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 = 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_Milling ()
 
void LoadLootTemplates_Pickpocketing ()
 
void LoadLootTemplates_Skinning ()
 
void LoadLootTemplates_Disenchant ()
 
void LoadLootTemplates_Prospecting ()
 
void LoadLootTemplates_Spell ()
 
void LoadLootTemplates_Reference ()
 
void LoadLootTemplates_Player ()
 
void LoadLootTables ()
 

Variables

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

Macro Definition Documentation

◆ MAX_NR_LOOT_ITEMS

#define MAX_NR_LOOT_ITEMS   18

◆ MAX_NR_QUEST_ITEMS

#define MAX_NR_QUEST_ITEMS   32

Typedef Documentation

◆ AllowedLooterSet

◆ LootIdSet

typedef std::set<uint32> LootIdSet

◆ LootItemList

typedef std::vector<LootItem> LootItemList

◆ LootStoreItemList

typedef std::list<LootStoreItem*> LootStoreItemList

◆ LootTemplateMap

typedef std::unordered_map<uint32, LootTemplate*> LootTemplateMap

◆ QuestItemList

typedef std::vector<QuestItem> QuestItemList

◆ QuestItemMap

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

Enumeration Type Documentation

◆ LootError

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 
95{
96 LOOT_ERROR_DIDNT_KILL = 0, // You don't have permission to loot that corpse.
97 LOOT_ERROR_TOO_FAR = 4, // You are too far away to loot that corpse.
98 LOOT_ERROR_BAD_FACING = 5, // You must be facing the corpse to loot it.
99 LOOT_ERROR_LOCKED = 6, // Someone is already looting that corpse.
100 LOOT_ERROR_NOTSTANDING = 8, // You need to be standing up to loot something!
101 LOOT_ERROR_STUNNED = 9, // You can't loot anything while stunned!
102 LOOT_ERROR_PLAYER_NOT_FOUND = 10, // Player not found
103 LOOT_ERROR_PLAY_TIME_EXCEEDED = 11, // Maximum play time exceeded
104 LOOT_ERROR_MASTER_INV_FULL = 12, // That player's inventory is full
105 LOOT_ERROR_MASTER_UNIQUE_ITEM = 13, // Player has too many of that item already
106 LOOT_ERROR_MASTER_OTHER = 14, // Can't assign item to that player
107 LOOT_ERROR_ALREADY_PICKPOCKETED = 15, // Your target has already had its pockets picked
108 LOOT_ERROR_NOT_WHILE_SHAPESHIFTED = 16 // You can't do that while shapeshifted.
109};
@ LOOT_ERROR_TOO_FAR
Definition: LootMgr.h:97
@ LOOT_ERROR_MASTER_OTHER
Definition: LootMgr.h:106
@ LOOT_ERROR_BAD_FACING
Definition: LootMgr.h:98
@ LOOT_ERROR_LOCKED
Definition: LootMgr.h:99
@ LOOT_ERROR_MASTER_INV_FULL
Definition: LootMgr.h:104
@ LOOT_ERROR_MASTER_UNIQUE_ITEM
Definition: LootMgr.h:105
@ LOOT_ERROR_DIDNT_KILL
Definition: LootMgr.h:96
@ LOOT_ERROR_PLAY_TIME_EXCEEDED
Definition: LootMgr.h:103
@ LOOT_ERROR_NOTSTANDING
Definition: LootMgr.h:100
@ LOOT_ERROR_NOT_WHILE_SHAPESHIFTED
Definition: LootMgr.h:108
@ LOOT_ERROR_PLAYER_NOT_FOUND
Definition: LootMgr.h:102
@ LOOT_ERROR_ALREADY_PICKPOCKETED
Definition: LootMgr.h:107
@ LOOT_ERROR_STUNNED
Definition: LootMgr.h:101

◆ LootMethod

enum LootMethod
Enumerator
FREE_FOR_ALL 
ROUND_ROBIN 
MASTER_LOOT 
GROUP_LOOT 
NEED_BEFORE_GREED 
57{
58 FREE_FOR_ALL = 0,
59 ROUND_ROBIN = 1,
60 MASTER_LOOT = 2,
61 GROUP_LOOT = 3,
63};
@ NEED_BEFORE_GREED
Definition: LootMgr.h:62
@ GROUP_LOOT
Definition: LootMgr.h:61
@ MASTER_LOOT
Definition: LootMgr.h:60
@ ROUND_ROBIN
Definition: LootMgr.h:59
@ FREE_FOR_ALL
Definition: LootMgr.h:58

◆ LootSlotType

Enumerator
LOOT_SLOT_TYPE_ALLOW_LOOT 
LOOT_SLOT_TYPE_ROLL_ONGOING 
LOOT_SLOT_TYPE_MASTER 
LOOT_SLOT_TYPE_LOCKED 
LOOT_SLOT_TYPE_OWNER 
113{
114 LOOT_SLOT_TYPE_ALLOW_LOOT = 0, // player can loot the item.
115 LOOT_SLOT_TYPE_ROLL_ONGOING = 1, // roll is ongoing. player cannot loot.
116 LOOT_SLOT_TYPE_MASTER = 2, // item can only be distributed by group loot master.
117 LOOT_SLOT_TYPE_LOCKED = 3, // item is shown in red. player cannot loot.
118 LOOT_SLOT_TYPE_OWNER = 4, // ignore binding confirmation and etc, for single player looting
119};
@ LOOT_SLOT_TYPE_MASTER
Definition: LootMgr.h:116
@ LOOT_SLOT_TYPE_ROLL_ONGOING
Definition: LootMgr.h:115
@ LOOT_SLOT_TYPE_ALLOW_LOOT
Definition: LootMgr.h:114
@ LOOT_SLOT_TYPE_OWNER
Definition: LootMgr.h:118
@ LOOT_SLOT_TYPE_LOCKED
Definition: LootMgr.h:117

◆ LootType

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 
77{
78 LOOT_NONE = 0,
79
80 LOOT_CORPSE = 1,
82 LOOT_FISHING = 3,
84 // ignored always by client
85 LOOT_SKINNING = 6,
87 LOOT_MILLING = 8,
88
89 LOOT_FISHINGHOLE = 20, // unsupported by client, sending LOOT_FISHING instead
90 LOOT_INSIGNIA = 21, // unsupported by client, sending LOOT_CORPSE instead
91 LOOT_FISHING_JUNK = 22 // unsupported by client, sending LOOT_FISHING instead
92};
@ LOOT_PICKPOCKETING
Definition: LootMgr.h:81
@ LOOT_MILLING
Definition: LootMgr.h:87
@ LOOT_FISHING_JUNK
Definition: LootMgr.h:91
@ LOOT_CORPSE
Definition: LootMgr.h:80
@ LOOT_FISHING
Definition: LootMgr.h:82
@ LOOT_INSIGNIA
Definition: LootMgr.h:90
@ LOOT_DISENCHANTING
Definition: LootMgr.h:83
@ LOOT_SKINNING
Definition: LootMgr.h:85
@ LOOT_FISHINGHOLE
Definition: LootMgr.h:89
@ LOOT_NONE
Definition: LootMgr.h:78
@ LOOT_PROSPECTING
Definition: LootMgr.h:86

◆ PermissionTypes

Enumerator
ALL_PERMISSION 
GROUP_PERMISSION 
MASTER_PERMISSION 
RESTRICTED_PERMISSION 
ROUND_ROBIN_PERMISSION 
OWNER_PERMISSION 
NONE_PERMISSION 
66{
74};
@ OWNER_PERMISSION
Definition: LootMgr.h:72
@ ALL_PERMISSION
Definition: LootMgr.h:67
@ RESTRICTED_PERMISSION
Definition: LootMgr.h:70
@ NONE_PERMISSION
Definition: LootMgr.h:73
@ ROUND_ROBIN_PERMISSION
Definition: LootMgr.h:71
@ MASTER_PERMISSION
Definition: LootMgr.h:69
@ GROUP_PERMISSION
Definition: LootMgr.h:68

◆ RollMask

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 
41{
46
49};
@ ROLL_ALL_TYPE_NO_DISENCHANT
Definition: LootMgr.h:47
@ ROLL_FLAG_TYPE_DISENCHANT
Definition: LootMgr.h:45
@ ROLL_ALL_TYPE_MASK
Definition: LootMgr.h:48
@ ROLL_FLAG_TYPE_GREED
Definition: LootMgr.h:44
@ ROLL_FLAG_TYPE_PASS
Definition: LootMgr.h:42
@ ROLL_FLAG_TYPE_NEED
Definition: LootMgr.h:43

◆ RollType

enum RollType
Enumerator
ROLL_PASS 
ROLL_NEED 
ROLL_GREED 
ROLL_DISENCHANT 
MAX_ROLL_TYPE 
32{
33 ROLL_PASS = 0,
34 ROLL_NEED = 1,
35 ROLL_GREED = 2,
38};
@ MAX_ROLL_TYPE
Definition: LootMgr.h:37
@ ROLL_PASS
Definition: LootMgr.h:33
@ ROLL_GREED
Definition: LootMgr.h:35
@ ROLL_NEED
Definition: LootMgr.h:34
@ ROLL_DISENCHANT
Definition: LootMgr.h:36

Function Documentation

◆ LoadLootTables()

void LoadLootTables ( )
inline
444{
456
458
460}
void LoadLootTemplates_Pickpocketing()
Definition: LootMgr.cpp:2152
void LoadLootTemplates_Player()
Definition: LootMgr.cpp:2324
void LoadLootTemplates_Spell()
Definition: LootMgr.cpp:2281
void LoadLootTemplates_Milling()
Definition: LootMgr.cpp:2121
void LoadLootTemplates_Gameobject()
Definition: LootMgr.cpp:2059
void LoadLootTemplates_Creature()
Definition: LootMgr.cpp:1963
void LoadLootTemplates_Fishing()
Definition: LootMgr.cpp:2033
void LoadLootTemplates_Reference()
Definition: LootMgr.cpp:2345
void LoadLootTemplates_Prospecting()
Definition: LootMgr.cpp:2188
void LoadLootTemplates_Mail()
Definition: LootMgr.cpp:2219
void LoadLootTemplates_Disenchant()
Definition: LootMgr.cpp:1999
void LoadLootTemplates_Item()
Definition: LootMgr.cpp:2095
void LoadLootTemplates_Skinning()
Definition: LootMgr.cpp:2245

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

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

◆ LoadLootTemplates_Creature()

void LoadLootTemplates_Creature ( )
1964{
1965 LOG_INFO("server.loading", "Loading Creature Loot Templates...");
1966
1967 uint32 oldMSTime = getMSTime();
1968
1969 LootIdSet lootIdSet, lootIdSetUsed;
1971
1972 // Remove real entries and check loot existence
1973 CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
1974 for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
1975 {
1976 if (uint32 lootid = itr->second.lootid)
1977 {
1978 if (lootIdSet.find(lootid) == lootIdSet.end())
1979 LootTemplates_Creature.ReportNonExistingId(lootid, "Creature", itr->second.Entry);
1980 else
1981 lootIdSetUsed.insert(lootid);
1982 }
1983 }
1984
1985 for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr)
1986 lootIdSet.erase(*itr);
1987
1988 // output error for any still listed (not referenced from appropriate table) ids
1990
1991 if (count)
1992 LOG_INFO("server.loading", ">> Loaded {} Creature Loot Templates in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
1993 else
1994 LOG_WARN("server.loading", ">> Loaded 0 creature loot templates. DB table `creature_loot_template` is empty");
1995
1996 LOG_INFO("server.loading", " ");
1997}
#define LOG_INFO(filterType__,...)
Definition: Log.h:165
#define LOG_WARN(filterType__,...)
Definition: Log.h:161
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:131
uint32 getMSTime()
Definition: Timer.h:103
std::uint32_t uint32
Definition: Define.h:107
#define sObjectMgr
Definition: ObjectMgr.h:1635
std::unordered_map< uint32, CreatureTemplate > CreatureTemplateContainer
Definition: CreatureData.h:292
LootStore LootTemplates_Creature("creature_loot_template", "creature entry", true)
std::set< uint32 > LootIdSet
Definition: LootMgr.h:204
uint32 LoadAndCollectLootIds(LootIdSet &ids_set)
Definition: LootMgr.cpp:267
void ReportNonExistingId(uint32 lootId) const
Definition: LootMgr.cpp:290
void ReportUnusedIds(LootIdSet const &ids_set) const
Definition: LootMgr.cpp:283

References getMSTime(), GetMSTimeDiffToNow(), LootStore::LoadAndCollectLootIds(), LOG_INFO, LOG_WARN, LootTemplates_Creature, LootStore::ReportNonExistingId(), LootStore::ReportUnusedIds(), and sObjectMgr.

Referenced by reload_commandscript::HandleReloadLootTemplatesCreatureCommand(), and LoadLootTables().

◆ LoadLootTemplates_Disenchant()

void LoadLootTemplates_Disenchant ( )
2000{
2001 LOG_INFO("server.loading", "Loading Disenchanting Loot Templates...");
2002
2003 uint32 oldMSTime = getMSTime();
2004
2005 LootIdSet lootIdSet, lootIdSetUsed;
2007
2008 ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
2009 for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
2010 {
2011 if (uint32 lootid = itr->second.DisenchantID)
2012 {
2013 if (lootIdSet.find(lootid) == lootIdSet.end())
2015 else
2016 lootIdSetUsed.insert(lootid);
2017 }
2018 }
2019
2020 for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr)
2021 lootIdSet.erase(*itr);
2022
2023 // output error for any still listed (not referenced from appropriate table) ids
2025
2026 if (count)
2027 LOG_INFO("server.loading", ">> Loaded {} disenchanting loot templates in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
2028 else
2029 LOG_WARN("server.loading", ">> Loaded 0 disenchanting loot templates. DB table `disenchant_loot_template` is empty");
2030 LOG_INFO("server.loading", " ");
2031}
std::unordered_map< uint32, ItemTemplate > ItemTemplateContainer
Definition: ItemTemplate.h:835
LootStore LootTemplates_Disenchant("disenchant_loot_template", "item disenchant id", true)

References getMSTime(), GetMSTimeDiffToNow(), LootStore::LoadAndCollectLootIds(), LOG_INFO, LOG_WARN, LootTemplates_Disenchant, LootStore::ReportNonExistingId(), LootStore::ReportUnusedIds(), and sObjectMgr.

Referenced by reload_commandscript::HandleReloadLootTemplatesDisenchantCommand(), and LoadLootTables().

◆ LoadLootTemplates_Fishing()

void LoadLootTemplates_Fishing ( )
2034{
2035 LOG_INFO("server.loading", "Loading Fishing Loot Templates...");
2036
2037 uint32 oldMSTime = getMSTime();
2038
2039 LootIdSet lootIdSet;
2041
2042 // remove real entries and check existence loot
2043 for (uint32 i = 1; i < sAreaTableStore.GetNumRows(); ++i)
2044 if (AreaTableEntry const* areaEntry = sAreaTableStore.LookupEntry(i))
2045 if (lootIdSet.find(areaEntry->ID) != lootIdSet.end())
2046 lootIdSet.erase(areaEntry->ID);
2047
2048 // output error for any still listed (not referenced from appropriate table) ids
2050
2051 if (count)
2052 LOG_INFO("server.loading", ">> Loaded {} Fishing Loot Templates in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
2053 else
2054 LOG_WARN("server.loading", ">> Loaded 0 fishing loot templates. DB table `fishing_loot_template` is empty");
2055
2056 LOG_INFO("server.loading", " ");
2057}
LootStore LootTemplates_Fishing("fishing_loot_template", "area id", true)
DBCStorage< AreaTableEntry > sAreaTableStore(AreaTableEntryfmt)
Definition: DBCStructure.h:518

References getMSTime(), GetMSTimeDiffToNow(), LootStore::LoadAndCollectLootIds(), LOG_INFO, LOG_WARN, LootTemplates_Fishing, LootStore::ReportUnusedIds(), and sAreaTableStore.

Referenced by reload_commandscript::HandleReloadLootTemplatesFishingCommand(), and LoadLootTables().

◆ LoadLootTemplates_Gameobject()

void LoadLootTemplates_Gameobject ( )
2060{
2061 LOG_INFO("server.loading", "Loading Gameobject Loot Templates...");
2062
2063 uint32 oldMSTime = getMSTime();
2064
2065 LootIdSet lootIdSet, lootIdSetUsed;
2067
2068 // remove real entries and check existence loot
2069 GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates();
2070 for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr)
2071 {
2072 if (uint32 lootid = itr->second.GetLootId())
2073 {
2074 if (lootIdSet.find(lootid) == lootIdSet.end())
2075 LootTemplates_Gameobject.ReportNonExistingId(lootid, "Gameobject", itr->second.entry);
2076 else
2077 lootIdSetUsed.insert(lootid);
2078 }
2079 }
2080
2081 for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr)
2082 lootIdSet.erase(*itr);
2083
2084 // output error for any still listed (not referenced from appropriate table) ids
2086
2087 if (count)
2088 LOG_INFO("server.loading", ">> Loaded {} Gameobject Loot Templates in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
2089 else
2090 LOG_WARN("server.loading", ">> Loaded 0 gameobject loot templates. DB table `gameobject_loot_template` is empty");
2091
2092 LOG_INFO("server.loading", " ");
2093}
std::unordered_map< uint32, GameObjectTemplate > GameObjectTemplateContainer
Definition: GameObject.h:42
LootStore LootTemplates_Gameobject("gameobject_loot_template", "gameobject entry", true)

References getMSTime(), GetMSTimeDiffToNow(), LootStore::LoadAndCollectLootIds(), LOG_INFO, LOG_WARN, LootTemplates_Gameobject, LootStore::ReportNonExistingId(), LootStore::ReportUnusedIds(), and sObjectMgr.

Referenced by reload_commandscript::HandleReloadLootTemplatesGameobjectCommand(), and LoadLootTables().

◆ LoadLootTemplates_Item()

void LoadLootTemplates_Item ( )
2096{
2097 LOG_INFO("server.loading", "Loading Item Loot Templates...");
2098
2099 uint32 oldMSTime = getMSTime();
2100
2101 LootIdSet lootIdSet;
2103
2104 // remove real entries and check existence loot
2105 ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
2106 for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
2107 if (lootIdSet.find(itr->second.ItemId) != lootIdSet.end() && itr->second.HasFlag(ITEM_FLAG_HAS_LOOT))
2108 lootIdSet.erase(itr->second.ItemId);
2109
2110 // output error for any still listed (not referenced from appropriate table) ids
2112
2113 if (count)
2114 LOG_INFO("server.loading", ">> Loaded {} item loot templates in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
2115 else
2116 LOG_WARN("server.loading", ">> Loaded 0 item loot templates. DB table `item_loot_template` is empty");
2117
2118 LOG_INFO("server.loading", " ");
2119}
@ ITEM_FLAG_HAS_LOOT
Definition: ItemTemplate.h:149
LootStore LootTemplates_Item("item_loot_template", "item entry", true)

References getMSTime(), GetMSTimeDiffToNow(), ITEM_FLAG_HAS_LOOT, LootStore::LoadAndCollectLootIds(), LOG_INFO, LOG_WARN, LootTemplates_Item, LootStore::ReportUnusedIds(), and sObjectMgr.

Referenced by reload_commandscript::HandleReloadLootTemplatesItemCommand(), and LoadLootTables().

◆ LoadLootTemplates_Mail()

void LoadLootTemplates_Mail ( )
2220{
2221 LOG_INFO("server.loading", "Loading Mail Loot Templates...");
2222
2223 uint32 oldMSTime = getMSTime();
2224
2225 LootIdSet lootIdSet;
2227
2228 // remove real entries and check existence loot
2229 for (uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i)
2230 if (sMailTemplateStore.LookupEntry(i))
2231 if (lootIdSet.find(i) != lootIdSet.end())
2232 lootIdSet.erase(i);
2233
2234 // output error for any still listed (not referenced from appropriate table) ids
2236
2237 if (count)
2238 LOG_INFO("server.loading", ">> Loaded {} mail loot templates in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
2239 else
2240 LOG_WARN("server.loading", ">> Loaded 0 mail loot templates. DB table `mail_loot_template` is empty");
2241
2242 LOG_INFO("server.loading", " ");
2243}
LootStore LootTemplates_Mail("mail_loot_template", "mail template id", false)
DBCStorage< MailTemplateEntry > sMailTemplateStore(MailTemplateEntryfmt)

References getMSTime(), GetMSTimeDiffToNow(), LootStore::LoadAndCollectLootIds(), LOG_INFO, LOG_WARN, LootTemplates_Mail, LootStore::ReportUnusedIds(), and sMailTemplateStore.

Referenced by reload_commandscript::HandleReloadLootTemplatesMailCommand(), and LoadLootTables().

◆ LoadLootTemplates_Milling()

void LoadLootTemplates_Milling ( )
2122{
2123 LOG_INFO("server.loading", "Loading Milling Loot Templates...");
2124
2125 uint32 oldMSTime = getMSTime();
2126
2127 LootIdSet lootIdSet;
2129
2130 // remove real entries and check existence loot
2131 ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
2132 for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
2133 {
2134 if (!itr->second.HasFlag(ITEM_FLAG_IS_MILLABLE))
2135 continue;
2136
2137 if (lootIdSet.find(itr->second.ItemId) != lootIdSet.end())
2138 lootIdSet.erase(itr->second.ItemId);
2139 }
2140
2141 // output error for any still listed (not referenced from appropriate table) ids
2143
2144 if (count)
2145 LOG_INFO("server.loading", ">> Loaded {} milling loot templates in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
2146 else
2147 LOG_WARN("server.loading", ">> Loaded 0 milling loot templates. DB table `milling_loot_template` is empty");
2148
2149 LOG_INFO("server.loading", " ");
2150}
@ ITEM_FLAG_IS_MILLABLE
Definition: ItemTemplate.h:176
LootStore LootTemplates_Milling("milling_loot_template", "item entry (herb)", true)

References getMSTime(), GetMSTimeDiffToNow(), ITEM_FLAG_IS_MILLABLE, LootStore::LoadAndCollectLootIds(), LOG_INFO, LOG_WARN, LootTemplates_Milling, LootStore::ReportUnusedIds(), and sObjectMgr.

Referenced by reload_commandscript::HandleReloadLootTemplatesMillingCommand(), and LoadLootTables().

◆ LoadLootTemplates_Pickpocketing()

void LoadLootTemplates_Pickpocketing ( )
2153{
2154 LOG_INFO("server.loading", "Loading Pickpocketing Loot Templates...");
2155
2156 uint32 oldMSTime = getMSTime();
2157
2158 LootIdSet lootIdSet, lootIdSetUsed;
2160
2161 // Remove real entries and check loot existence
2162 CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
2163 for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
2164 {
2165 if (uint32 lootid = itr->second.pickpocketLootId)
2166 {
2167 if (lootIdSet.find(lootid) == lootIdSet.end())
2168 LootTemplates_Pickpocketing.ReportNonExistingId(lootid, "Creature", itr->second.Entry);
2169 else
2170 lootIdSetUsed.insert(lootid);
2171 }
2172 }
2173
2174 for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr)
2175 lootIdSet.erase(*itr);
2176
2177 // output error for any still listed (not referenced from appropriate table) ids
2179
2180 if (count)
2181 LOG_INFO("server.loading", ">> Loaded {} pickpocketing loot templates in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
2182 else
2183 LOG_WARN("server.loading", ">> Loaded 0 pickpocketing loot templates. DB table `pickpocketing_loot_template` is empty");
2184
2185 LOG_INFO("server.loading", " ");
2186}
LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template", "creature pickpocket lootid", true)

References getMSTime(), GetMSTimeDiffToNow(), LootStore::LoadAndCollectLootIds(), LOG_INFO, LOG_WARN, LootTemplates_Pickpocketing, LootStore::ReportNonExistingId(), LootStore::ReportUnusedIds(), and sObjectMgr.

Referenced by reload_commandscript::HandleReloadLootTemplatesPickpocketingCommand(), and LoadLootTables().

◆ LoadLootTemplates_Player()

void LoadLootTemplates_Player ( )
2325{
2326 LOG_INFO("server.loading", "Loading Player Loot Templates...");
2327
2328 uint32 oldMSTime = getMSTime();
2329
2330 LootIdSet lootIdSet;
2332
2333 if (count)
2334 {
2335 LOG_INFO("server.loading", ">> Loaded {} player loot templates in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
2336 }
2337 else
2338 {
2339 LOG_WARN("server.loading", ">> Loaded 0 player loot templates. DB table `player_loot_template` is empty");
2340 }
2341
2342 LOG_INFO("server.loading", " ");
2343}
LootStore LootTemplates_Player("player_loot_template", "team id", true)

References getMSTime(), GetMSTimeDiffToNow(), LootStore::LoadAndCollectLootIds(), LOG_INFO, LOG_WARN, and LootTemplates_Player.

Referenced by reload_commandscript::HandleReloadLootTemplatesPlayerCommand(), and LoadLootTables().

◆ LoadLootTemplates_Prospecting()

void LoadLootTemplates_Prospecting ( )
2189{
2190 LOG_INFO("server.loading", "Loading Prospecting Loot Templates...");
2191
2192 uint32 oldMSTime = getMSTime();
2193
2194 LootIdSet lootIdSet;
2196
2197 // remove real entries and check existence loot
2198 ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
2199 for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
2200 {
2201 if (!itr->second.HasFlag(ITEM_FLAG_IS_PROSPECTABLE))
2202 continue;
2203
2204 if (lootIdSet.find(itr->second.ItemId) != lootIdSet.end())
2205 lootIdSet.erase(itr->second.ItemId);
2206 }
2207
2208 // output error for any still listed (not referenced from appropriate table) ids
2210
2211 if (count)
2212 LOG_INFO("server.loading", ">> Loaded {} prospecting loot templates in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
2213 else
2214 LOG_WARN("server.loading", ">> Loaded 0 prospecting loot templates. DB table `prospecting_loot_template` is empty");
2215
2216 LOG_INFO("server.loading", " ");
2217}
@ ITEM_FLAG_IS_PROSPECTABLE
Definition: ItemTemplate.h:165
LootStore LootTemplates_Prospecting("prospecting_loot_template", "item entry (ore)", true)

References getMSTime(), GetMSTimeDiffToNow(), ITEM_FLAG_IS_PROSPECTABLE, LootStore::LoadAndCollectLootIds(), LOG_INFO, LOG_WARN, LootTemplates_Prospecting, LootStore::ReportUnusedIds(), and sObjectMgr.

Referenced by reload_commandscript::HandleReloadLootTemplatesProspectingCommand(), and LoadLootTables().

◆ LoadLootTemplates_Reference()

void LoadLootTemplates_Reference ( )
2346{
2347 LOG_INFO("server.loading", "Loading Reference Loot Templates...");
2348
2349 uint32 oldMSTime = getMSTime();
2350
2351 LootIdSet lootIdSet;
2353
2354 // check references and remove used
2366
2367 // output error for any still listed ids (not referenced from any loot table)
2369
2370 LOG_INFO("server.loading", ">> Loaded reference loot templates in {} ms", GetMSTimeDiffToNow(oldMSTime));
2371 LOG_INFO("server.loading", " ");
2372}
LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true)
LootStore LootTemplates_Reference("reference_loot_template", "reference id", false)
void CheckLootRefs(LootIdSet *ref_set=nullptr) const
Definition: LootMgr.cpp:277

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

Referenced by reload_commandscript::HandleReloadLootTemplatesReferenceCommand(), and LoadLootTables().

◆ LoadLootTemplates_Skinning()

void LoadLootTemplates_Skinning ( )
2246{
2247 LOG_INFO("server.loading", "Loading Skinning Loot Templates...");
2248
2249 uint32 oldMSTime = getMSTime();
2250
2251 LootIdSet lootIdSet, lootIdSetUsed;
2253
2254 // remove real entries and check existence loot
2255 CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
2256 for (CreatureTemplateContainer::const_iterator itr = ctc->begin(); itr != ctc->end(); ++itr)
2257 {
2258 if (uint32 lootid = itr->second.SkinLootId)
2259 {
2260 if (lootIdSet.find(lootid) == lootIdSet.end())
2261 LootTemplates_Skinning.ReportNonExistingId(lootid, "Creature", itr->second.Entry);
2262 else
2263 lootIdSetUsed.insert(lootid);
2264 }
2265 }
2266
2267 for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr)
2268 lootIdSet.erase(*itr);
2269
2270 // output error for any still listed (not referenced from appropriate table) ids
2272
2273 if (count)
2274 LOG_INFO("server.loading", ">> Loaded {} skinning loot templates in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
2275 else
2276 LOG_WARN("server.loading", ">> Loaded 0 skinning loot templates. DB table `skinning_loot_template` is empty");
2277
2278 LOG_INFO("server.loading", " ");
2279}

References getMSTime(), GetMSTimeDiffToNow(), LootStore::LoadAndCollectLootIds(), LOG_INFO, LOG_WARN, LootTemplates_Skinning, LootStore::ReportNonExistingId(), LootStore::ReportUnusedIds(), and sObjectMgr.

Referenced by reload_commandscript::HandleReloadLootTemplatesSkinningCommand(), and LoadLootTables().

◆ LoadLootTemplates_Spell()

void LoadLootTemplates_Spell ( )
2282{
2283 LOG_INFO("server.loading", "Loading Spell Loot Templates...");
2284
2285 uint32 oldMSTime = getMSTime();
2286
2287 LootIdSet lootIdSet;
2289
2290 // remove real entries and check existence loot
2291 for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id)
2292 {
2293 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);
2294 if (!spellInfo)
2295 continue;
2296
2297 // possible cases
2298 if (!spellInfo->IsLootCrafting())
2299 continue;
2300
2301 if (lootIdSet.find(spell_id) == lootIdSet.end())
2302 {
2303 // not report about not trainable spells (optionally supported by DB)
2304 // ignore 61756 (Northrend Inscription Research (FAST QA VERSION) for example
2306 {
2307 LootTemplates_Spell.ReportNonExistingId(spell_id, "Spell", spellInfo->Id);
2308 }
2309 }
2310 else
2311 lootIdSet.erase(spell_id);
2312 }
2313
2314 // output error for any still listed (not referenced from appropriate table) ids
2316
2317 if (count)
2318 LOG_INFO("server.loading", ">> Loaded {} spell loot templates in {} ms", count, GetMSTimeDiffToNow(oldMSTime));
2319 else
2320 LOG_WARN("server.loading", ">> Loaded 0 spell loot templates. DB table `spell_loot_template` is empty");
2321 LOG_INFO("server.loading", " ");
2322}
@ SPELL_ATTR0_IS_TRADESKILL
Definition: SharedDefines.h:387
@ SPELL_ATTR0_NOT_SHAPESHIFTED
Definition: SharedDefines.h:398
#define sSpellMgr
Definition: SpellMgr.h:825
LootStore LootTemplates_Spell("spell_loot_template", "spell id (random item creating)", false)
Definition: SpellInfo.h:316
uint32 Id
Definition: SpellInfo.h:320
bool IsLootCrafting() const
Definition: SpellInfo.cpp:925
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:415

References getMSTime(), GetMSTimeDiffToNow(), SpellInfo::HasAttribute(), SpellInfo::Id, SpellInfo::IsLootCrafting(), LootStore::LoadAndCollectLootIds(), LOG_INFO, LOG_WARN, LootTemplates_Spell, LootStore::ReportNonExistingId(), LootStore::ReportUnusedIds(), SPELL_ATTR0_IS_TRADESKILL, SPELL_ATTR0_NOT_SHAPESHIFTED, and sSpellMgr.

Referenced by reload_commandscript::HandleReloadLootTemplatesSpellCommand(), and LoadLootTables().

◆ operator<<() [1/2]

ByteBuffer & operator<< ( ByteBuffer b,
LootItem const &  li 
)
993{
994 b << uint32(li.itemid);
995 b << uint32(li.count); // nr of items of this type
996 b << uint32(sObjectMgr->GetItemTemplate(li.itemid)->DisplayInfoID);
997 b << uint32(li.randomSuffix);
998 b << uint32(li.randomPropertyId);
999 //b << uint8(0); // slot type - will send after this function call
1000 return b;
1001}

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

◆ operator<<() [2/2]

ByteBuffer & operator<< ( ByteBuffer b,
LootView const &  lv 
)
1004{
1005 if (lv.permission == NONE_PERMISSION)
1006 {
1007 b << uint32(0); //gold
1008 b << uint8(0); // item count
1009 return b; // nothing output more
1010 }
1011
1012 Loot& l = lv.loot;
1013
1014 uint8 itemsShown = 0;
1015
1016 b << uint32(l.gold); //gold
1017
1018 std::size_t count_pos = b.wpos(); // pos of item count byte
1019 b << uint8(0); // item count placeholder
1020
1021 switch (lv.permission)
1022 {
1023 case GROUP_PERMISSION:
1024 case MASTER_PERMISSION:
1026 {
1027 bool isMasterLooter = lv.viewer->GetGroup() && lv.viewer->GetGroup()->GetMasterLooterGuid() == lv.viewer->GetGUID();
1028
1029 // if you are not the round-robin group looter, you can only see
1030 // blocked rolled items and quest items, and !ffa items
1031 for (uint8 i = 0; i < l.items.size(); ++i)
1032 {
1033 if (!l.items[i].is_looted && !l.items[i].freeforall && (l.items[i].conditions.empty() || isMasterLooter) && l.items[i].AllowedForPlayer(lv.viewer, l.sourceWorldObjectGUID))
1034 {
1035 uint8 slot_type = 0;
1036
1037 if (l.items[i].is_blocked) // for ML & restricted is_blocked = !is_underthreshold
1038 {
1039 switch (lv.permission)
1040 {
1041 case GROUP_PERMISSION:
1042 slot_type = LOOT_SLOT_TYPE_ROLL_ONGOING;
1043 break;
1044 case MASTER_PERMISSION:
1045 {
1046 if (lv.viewer->GetGroup())
1047 {
1048 if (lv.viewer->GetGroup()->GetMasterLooterGuid() == lv.viewer->GetGUID())
1049 slot_type = LOOT_SLOT_TYPE_MASTER;
1050 else
1051 slot_type = LOOT_SLOT_TYPE_LOCKED;
1052 }
1053 break;
1054 }
1056 slot_type = LOOT_SLOT_TYPE_LOCKED;
1057 break;
1058 default:
1059 continue;
1060 }
1061 }
1062 else if (l.items[i].rollWinnerGUID)
1063 {
1064 if (l.items[i].rollWinnerGUID == lv.viewer->GetGUID())
1065 slot_type = LOOT_SLOT_TYPE_OWNER;
1066 else
1067 continue;
1068 }
1069 else if (!l.roundRobinPlayer || lv.viewer->GetGUID() == l.roundRobinPlayer || !l.items[i].is_underthreshold)
1070 {
1071 // no round robin owner or he has released the loot
1072 // or it IS the round robin group owner
1073 // => item is lootable
1074 slot_type = LOOT_SLOT_TYPE_ALLOW_LOOT;
1075 }
1076 else
1077 // item shall not be displayed.
1078 continue;
1079
1080 b << uint8(i) << l.items[i];
1081 b << uint8(slot_type);
1082 ++itemsShown;
1083 }
1084 }
1085 break;
1086 }
1088 {
1089 for (uint8 i = 0; i < l.items.size(); ++i)
1090 {
1091 if (!l.items[i].is_looted && !l.items[i].freeforall && l.items[i].conditions.empty() && l.items[i].AllowedForPlayer(lv.viewer, l.sourceWorldObjectGUID))
1092 {
1093 if (l.roundRobinPlayer && lv.viewer->GetGUID() != l.roundRobinPlayer)
1094 // item shall not be displayed.
1095 continue;
1096
1097 b << uint8(i) << l.items[i];
1099 ++itemsShown;
1100 }
1101 }
1102 break;
1103 }
1104 case ALL_PERMISSION:
1105 case OWNER_PERMISSION:
1106 {
1108 for (uint8 i = 0; i < l.items.size(); ++i)
1109 {
1110 if (!l.items[i].is_looted && !l.items[i].freeforall && l.items[i].conditions.empty() && l.items[i].AllowedForPlayer(lv.viewer, l.sourceWorldObjectGUID))
1111 {
1112 b << uint8(i) << l.items[i];
1113 b << uint8(slot_type);
1114 ++itemsShown;
1115 }
1116 }
1117 break;
1118 }
1119 default:
1120 return b;
1121 }
1122
1124
1125 // Xinef: items that do not follow loot rules need this
1126 LootSlotType partySlotType = lv.permission == MASTER_PERMISSION ? LOOT_SLOT_TYPE_MASTER : slotType;
1127
1128 QuestItemMap const& lootPlayerQuestItems = l.GetPlayerQuestItems();
1129 QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(lv.viewer->GetGUID());
1130 if (q_itr != lootPlayerQuestItems.end())
1131 {
1132 QuestItemList* q_list = q_itr->second;
1133 for (QuestItemList::const_iterator qi = q_list->begin(); qi != q_list->end(); ++qi)
1134 {
1135 LootItem& item = l.quest_items[qi->index];
1136 if (!qi->is_looted && !item.is_looted)
1137 {
1138 bool showInLoot = true;
1139 bool hasQuestForItem = lv.viewer->HasQuestForItem(item.itemid, 0, false, &showInLoot);
1140 if (!hasQuestForItem)
1141 {
1142 if (!showInLoot)
1143 {
1144 const_cast<QuestItem*>(&(*qi))->is_looted = true;
1145 if (!item.freeforall)
1146 {
1147 item.is_looted = true;
1148 }
1149 continue;
1150 }
1151
1152 b << uint8(l.items.size() + (qi - q_list->begin()));
1153 b << item;
1155 }
1156 else
1157 {
1158 b << uint8(l.items.size() + (qi - q_list->begin()));
1159 b << item;
1160
1161 if (item.follow_loot_rules)
1162 {
1163 switch (lv.permission)
1164 {
1165 case MASTER_PERMISSION:
1167 break;
1169 b << (item.is_blocked ? uint8(LOOT_SLOT_TYPE_LOCKED) : uint8(slotType));
1170 break;
1171 case GROUP_PERMISSION:
1173 if (!item.is_blocked)
1175 else
1177 break;
1178 default:
1179 b << uint8(slotType);
1180 break;
1181 }
1182 }
1183 else if (!item.freeforall)
1184 b << uint8(partySlotType);
1185 else
1186 b << uint8(slotType);
1187 }
1188
1189 ++itemsShown;
1190 }
1191 }
1192 }
1193
1194 QuestItemMap const& lootPlayerFFAItems = l.GetPlayerFFAItems();
1195 QuestItemMap::const_iterator ffa_itr = lootPlayerFFAItems.find(lv.viewer->GetGUID());
1196 if (ffa_itr != lootPlayerFFAItems.end())
1197 {
1198 QuestItemList* ffa_list = ffa_itr->second;
1199 for (QuestItemList::const_iterator fi = ffa_list->begin(); fi != ffa_list->end(); ++fi)
1200 {
1201 LootItem& item = l.items[fi->index];
1202 if (!fi->is_looted && !item.is_looted)
1203 {
1204 b << uint8(fi->index);
1205 b << item;
1206 // Xinef: Here are FFA items, so dont use owner permision
1207 b << uint8(LOOT_SLOT_TYPE_ALLOW_LOOT /*slotType*/);
1208 ++itemsShown;
1209 }
1210 }
1211 }
1212
1213 QuestItemMap const& lootPlayerNonQuestNonFFAConditionalItems = l.GetPlayerNonQuestNonFFAConditionalItems();
1214 QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(lv.viewer->GetGUID());
1215 if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end())
1216 {
1217 QuestItemList* conditional_list = nn_itr->second;
1218 for (QuestItemList::const_iterator ci = conditional_list->begin(); ci != conditional_list->end(); ++ci)
1219 {
1220 LootItem& item = l.items[ci->index];
1221 if (!ci->is_looted && !item.is_looted)
1222 {
1223 b << uint8(ci->index);
1224 b << item;
1225 if (item.follow_loot_rules)
1226 {
1227 switch (lv.permission)
1228 {
1229 case MASTER_PERMISSION:
1231 break;
1233 b << (item.is_blocked ? uint8(LOOT_SLOT_TYPE_LOCKED) : uint8(slotType));
1234 break;
1235 case GROUP_PERMISSION:
1237 if (!item.is_blocked)
1239 else
1241 break;
1242 default:
1243 b << uint8(slotType);
1244 break;
1245 }
1246 }
1247 else if (!item.freeforall)
1248 b << uint8(partySlotType);
1249 else
1250 b << uint8(slotType);
1251 ++itemsShown;
1252 }
1253 }
1254 }
1255
1256 //update number of items shown
1257 b.put<uint8>(count_pos, itemsShown);
1258
1259 return b;
1260}
std::uint8_t uint8
Definition: Define.h:109
std::map< ObjectGuid, QuestItemList * > QuestItemMap
Definition: LootMgr.h:200
LootSlotType
Definition: LootMgr.h:113
std::vector< QuestItem > QuestItemList
Definition: LootMgr.h:198
Definition: LootMgr.h:154
uint32 itemid
Definition: LootMgr.h:155
bool is_looted
Definition: LootMgr.h:163
bool freeforall
Definition: LootMgr.h:165
Definition: LootMgr.h:185
Definition: LootMgr.h:313
ObjectGuid sourceWorldObjectGUID
Definition: LootMgr.h:330
ObjectGuid roundRobinPlayer
Definition: LootMgr.h:324
uint32 gold
Definition: LootMgr.h:322
QuestItemMap const & GetPlayerQuestItems() const
Definition: LootMgr.h:316
std::vector< LootItem > items
Definition: LootMgr.h:320
QuestItemMap const & GetPlayerFFAItems() const
Definition: LootMgr.h:317
QuestItemMap const & GetPlayerNonQuestNonFFAConditionalItems() const
Definition: LootMgr.h:318
std::vector< LootItem > quest_items
Definition: LootMgr.h:321
std::size_t wpos() const
Definition: ByteBuffer.h:330
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:137

Variable Documentation

◆ LootTemplates_Creature

LootStore LootTemplates_Creature
extern

◆ LootTemplates_Disenchant

LootStore LootTemplates_Disenchant
extern

◆ LootTemplates_Fishing

LootStore LootTemplates_Fishing
extern

◆ LootTemplates_Gameobject

LootStore LootTemplates_Gameobject
extern

◆ LootTemplates_Item

LootStore LootTemplates_Item
extern

◆ LootTemplates_Mail

LootStore LootTemplates_Mail
extern

◆ LootTemplates_Milling

LootStore LootTemplates_Milling
extern

◆ LootTemplates_Pickpocketing

LootStore LootTemplates_Pickpocketing
extern

◆ LootTemplates_Player

LootStore LootTemplates_Player
extern

◆ LootTemplates_Prospecting

LootStore LootTemplates_Prospecting
extern

◆ LootTemplates_Reference

◆ LootTemplates_Skinning

LootStore LootTemplates_Skinning
extern

◆ LootTemplates_Spell

LootStore LootTemplates_Spell
extern

Referenced by LoadLootTemplates_Spell().