TrinityCore
Loading...
Searching...
No Matches
LootHandler.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#include "WorldSession.h"
19#include "CellImpl.h"
20#include "Common.h"
21#include "Corpse.h"
22#include "Creature.h"
23#include "DB2Stores.h"
24#include "GameObject.h"
25#include "GridNotifiersImpl.h"
26#include "Group.h"
27#include "Guild.h"
28#include "Item.h"
29#include "Log.h"
30#include "Loot.h"
31#include "LootItemStorage.h"
32#include "LootPackets.h"
33#include "MapUtils.h"
34#include "Object.h"
35#include "ObjectAccessor.h"
36#include "ObjectMgr.h"
37#include "Player.h"
38#include "SpellMgr.h"
39#include "World.h"
40
42{
43public:
44 static float constexpr LootDistance = 30.0f;
45
46 AELootCreatureCheck(Player* looter, ObjectGuid mainLootTarget) : _looter(looter), _mainLootTarget(mainLootTarget) { }
47
48 bool operator()(Creature const* creature) const
49 {
50 return IsValidAELootTarget(creature);
51 }
52
53 bool IsValidLootTarget(Creature const* creature) const
54 {
55 if (creature->IsAlive())
56 return false;
57
58 if (!_looter->IsWithinDist(creature, LootDistance))
59 return false;
60
61 return _looter->isAllowedToLoot(creature);
62 }
63
64 bool IsValidAELootTarget(Creature const* creature) const
65 {
66 if (creature->GetGUID() == _mainLootTarget)
67 return false;
68
69 return IsValidLootTarget(creature);
70 }
71
72private:
75};
76
78{
79 Player* player = GetPlayer();
80 AELootResult aeResult;
81 AELootResult* aeResultPtr = player->GetAELootView().size() > 1 ? &aeResult : nullptr;
82
83 for (WorldPackets::Loot::LootRequest const& req : packet.Loot)
84 {
85 Loot* loot = Trinity::Containers::MapGetValuePtr(player->GetAELootView(), req.Object);
86 if (!loot)
87 {
89 continue;
90 }
91
92 ObjectGuid lguid = loot->GetOwnerGUID();
93
94 if (lguid.IsGameObject())
95 {
96 GameObject* go = player->GetMap()->GetGameObject(lguid);
97
98 // not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
99 if (!go || ((go->GetOwnerGUID() != player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(player)))
100 {
101 player->SendLootRelease(lguid);
102 continue;
103 }
104 }
105 else if (lguid.IsCreatureOrVehicle())
106 {
107 Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid);
108 if (!creature)
109 {
110 player->SendLootError(req.Object, lguid, LOOT_ERROR_NO_LOOT);
111 continue;
112 }
113
115 {
116 player->SendLootError(req.Object, lguid, LOOT_ERROR_TOO_FAR);
117 continue;
118 }
119 }
120
121 player->StoreLootItem(lguid, req.LootListID, loot, aeResultPtr);
122
123 // If player is removing the last LootItem, delete the empty container.
124 if (loot->isLooted() && lguid.IsItem())
125 player->GetSession()->DoLootRelease(loot);
126 }
127
128 if (aeResultPtr)
129 {
130 for (AELootResult::ResultValue const& resultValue : aeResult)
131 {
132 player->SendNewItem(resultValue.item, resultValue.count, false, false, true, resultValue.dungeonEncounterId);
133 player->UpdateCriteria(CriteriaType::LootItem, resultValue.item->GetEntry(), resultValue.count);
134 player->UpdateCriteria(CriteriaType::GetLootByType, resultValue.item->GetEntry(), resultValue.count, resultValue.lootType);
135 player->UpdateCriteria(CriteriaType::LootAnyItem, resultValue.item->GetEntry(), resultValue.count);
136 }
137 }
138
140}
141
143{
144 Player* player = GetPlayer();
145 std::vector<Loot*> forceLootRelease;
146 for (std::pair<ObjectGuid const, Loot*> const& lootView : player->GetAELootView())
147 {
148 Loot* loot = lootView.second;
149 ObjectGuid guid = loot->GetOwnerGUID();
150 bool shareMoney = loot->loot_type == LOOT_CORPSE;
151
152 loot->NotifyMoneyRemoved(player->GetMap());
153 if (shareMoney && player->GetGroup()) //item, pickpocket and players can be looted only single player
154 {
155 Group* group = player->GetGroup();
156
157 std::vector<Player*> playersNear;
158 for (GroupReference const& itr : group->GetMembers())
159 {
160 Player* member = itr.GetSource();
161 if (!loot->HasAllowedLooter(member->GetGUID()))
162 continue;
163
164 if (player->IsAtGroupRewardDistance(member))
165 playersNear.push_back(member);
166 }
167
168 uint64 goldPerPlayer = uint64(loot->gold / playersNear.size());
169
170 for (std::vector<Player*>::const_iterator i = playersNear.begin(); i != playersNear.end(); ++i)
171 {
172 uint64 goldMod = CalculatePct(goldPerPlayer, (*i)->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_MONEY_GAIN, 1));
173
174 (*i)->ModifyMoney(goldPerPlayer + goldMod);
175 (*i)->UpdateCriteria(CriteriaType::MoneyLootedFromCreatures, goldPerPlayer);
176
178 packet.Money = goldPerPlayer;
179 packet.MoneyMod = goldMod;
180 packet.SoleLooter = playersNear.size() <= 1 ? true : false;
181 (*i)->SendDirectMessage(packet.Write());
182 }
183 }
184 else
185 {
187
188 player->ModifyMoney(loot->gold + goldMod);
190
192 packet.Money = loot->gold;
193 packet.MoneyMod = goldMod;
194 packet.SoleLooter = true; // "You loot..."
195 SendPacket(packet.Write());
196 }
197
198 loot->LootMoney();
199
200 // Delete the money loot record from the DB
201 if (loot->loot_type == LOOT_ITEM)
202 sLootItemStorage->RemoveStoredMoneyForContainer(guid.GetCounter());
203
204 // Delete container if empty
205 if (loot->isLooted() && guid.IsItem())
206 forceLootRelease.push_back(loot);
207 }
208
209 for (Loot* loot : forceLootRelease)
210 player->GetSession()->DoLootRelease(loot);
211}
212
214{
215 // Check possible cheat
216 if (!GetPlayer()->IsAlive() || !packet.Unit.IsCreatureOrVehicle())
217 return;
218
219 Creature* lootTarget = ObjectAccessor::GetCreature(*GetPlayer(), packet.Unit);
220 if (!lootTarget)
221 return;
222
223 AELootCreatureCheck check(_player, packet.Unit);
224 if (!check.IsValidLootTarget(lootTarget))
225 return;
226
227 // interrupt cast
228 if (GetPlayer()->IsNonMeleeSpellCast(false))
230
232
233 bool const aeLootEnabled = sWorld->getBoolConfig(CONFIG_ENABLE_AE_LOOT);
234 std::vector<Creature*> corpses;
235 if (aeLootEnabled)
236 {
237 Trinity::CreatureListSearcher searcher(_player, corpses, check);
239 if (corpses.size() > 49)
240 corpses.resize(49); // lootTarget is 50th, not in corpses vector
241 }
242
243 if (!corpses.empty())
245
246 GetPlayer()->SendLoot(*lootTarget->GetLootForPlayer(GetPlayer()));
247
248 if (!corpses.empty())
249 {
250 // main target
252
253 for (Creature* creature : corpses)
254 {
255 GetPlayer()->SendLoot(*creature->GetLootForPlayer(GetPlayer()), true);
257 }
258 }
259}
260
262{
263 // cheaters can modify lguid to prevent correct apply loot release code and re-loot
264 // use internal stored guid
265 if (Loot* loot = GetPlayer()->GetLootByWorldObjectGUID(packet.Unit))
266 DoLootRelease(loot);
267}
268
270{
271 ObjectGuid lguid = loot->GetOwnerGUID();
272 Player *player = GetPlayer();
273
274 if (player->GetLootGUID() == lguid)
276
277 //Player is not looking at loot list, he doesn't need to see updates on the loot list
278 loot->RemoveLooter(player->GetGUID());
279 player->SendLootRelease(lguid);
280 player->m_AELootView.erase(loot->GetGUID());
281
282 if (player->GetAELootView().empty())
284
285 if (!player->IsInWorld())
286 return;
287
288 if (lguid.IsGameObject())
289 {
290 GameObject* go = GetPlayer()->GetMap()->GetGameObject(lguid);
291
292 // not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO
293 if (!go || ((go->GetOwnerGUID() != player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(player)))
294 return;
295
297 {
299 {
301 }
302 else if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGHOLE)
303 { // The fishing hole used once more
304 go->AddUse(); // if the max usage is reached, will be despawned in next tick
305 if (go->GetUseCount() >= go->GetGOValue()->FishingHole.MaxOpens)
307 else
309 }
310 else if (go->GetGoType() != GAMEOBJECT_TYPE_GATHERING_NODE && go->IsFullyLooted())
312
313 go->OnLootRelease(player);
314 }
315 else
316 {
317 // not fully looted object
318 go->SetLootState(GO_ACTIVATED, player);
319 }
320 }
321 else if (lguid.IsCorpse()) // ONLY remove insignia at BG
322 {
323 Corpse* corpse = ObjectAccessor::GetCorpse(*player, lguid);
324 if (!corpse || !corpse->IsWithinDistInMap(player, INTERACTION_DISTANCE))
325 return;
326
327 if (loot->isLooted())
328 {
329 corpse->m_loot = nullptr;
331 }
332 }
333 else if (lguid.IsItem())
334 {
335 Item* pItem = player->GetItemByGuid(lguid);
336 if (!pItem)
337 return;
338
339 ItemTemplate const* proto = pItem->GetTemplate();
340
341 // destroy only 5 items from stack in case prospecting and milling
342 if (loot->loot_type == LOOT_PROSPECTING || loot->loot_type == LOOT_MILLING)
343 {
344 pItem->m_lootGenerated = false;
345 pItem->m_loot = nullptr;
346
347 uint32 count = pItem->GetCount();
348
349 // >=5 checked in spell code, but will work for cheating cases also with removing from another stacks.
350 if (count > 5)
351 count = 5;
352
353 player->DestroyItemCount(pItem, count, true);
354 }
355 else
356 {
357 // Only delete item if no loot or money (unlooted loot is saved to db) or if it isn't an openable item
358 if (loot->isLooted() || !proto->HasFlag(ITEM_FLAG_HAS_LOOT))
359 player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
360 }
361 return; // item can be looted only single player
362 }
363 else
364 {
365 Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid);
366 if (!creature)
367 return;
368
369 if (loot->isLooted())
370 {
371 if (creature->IsFullyLooted())
372 {
374
375 // skip pickpocketing loot for speed, skinning timer reduction is no-op in fact
376 if (!creature->IsAlive())
377 creature->AllLootRemovedFromCorpse();
378 }
379 }
380 else
381 {
382 // if the round robin player release, reset it.
383 if (player->GetGUID() == loot->roundRobinPlayer)
384 {
385 loot->roundRobinPlayer.Clear();
386 loot->NotifyLootList(creature->GetMap());
387 }
388 }
389 // force dynflag update to update looter and lootable info
391 }
392}
393
395{
396 std::unordered_map<ObjectGuid, Loot*> lootView = _player->GetAELootView();
397 for (auto const& [lootGuid, loot] : lootView)
398 DoLootRelease(loot);
399}
400
402{
403 AELootResult aeResult;
404
406 {
408 return;
409 }
410
411 // player on other map
412 Player* target = ObjectAccessor::GetPlayer(*_player, masterLootItem.Target);
413 if (!target)
414 {
416 return;
417 }
418
419 TC_LOG_DEBUG("network", "WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [{}].", target->GetName());
420
421 for (WorldPackets::Loot::LootRequest const& req : masterLootItem.Loot)
422 {
424
425 if (!loot || loot->GetLootMethod() != MASTER_LOOT)
426 return;
427
428 if (!_player->IsInRaidWith(target) || !_player->IsInMap(target))
429 {
431 TC_LOG_INFO("entities.player.cheat", "MasterLootItem: Player {} tried to give an item to ineligible player {} !", GetPlayer()->GetName(), target->GetName());
432 return;
433 }
434
435 if (!loot->HasAllowedLooter(masterLootItem.Target))
436 {
438 return;
439 }
440
441 if (req.LootListID >= loot->items.size())
442 {
444 TC_LOG_DEBUG("loot", "MasterLootItem: Player {} might be using a hack! (slot {}, size {})",
445 GetPlayer()->GetName(), req.LootListID, loot->items.size());
446 return;
447 }
448
449 LootItem& item = loot->items[req.LootListID];
450 if (item.type != LootItemType::Item)
451 {
453 return;
454 }
455
456 ItemPosCountVec dest;
457 InventoryResult msg = target->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.itemid, item.count);
458 if (!item.HasAllowedLooter(target->GetGUID()))
460 if (msg != EQUIP_ERR_OK)
461 {
462 if (msg == EQUIP_ERR_ITEM_MAX_COUNT)
464 else if (msg == EQUIP_ERR_INV_FULL)
466 else
468 return;
469 }
470
471 // now move item from loot to target inventory
472 if (Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, &item.BonusListIDs))
473 aeResult.Add(newitem, item.count, loot->loot_type, loot->GetDungeonEncounterId());
474 else
475 target->ApplyItemLootedSpell(sObjectMgr->GetItemTemplate(item.itemid));
476
477 // mark as looted
478 item.count = 0;
479 item.is_looted = true;
480
481 loot->NotifyItemRemoved(req.LootListID, GetPlayer()->GetMap());
482 --loot->unlootedCount;
483 }
484
485 for (AELootResult::ResultValue const& resultValue : aeResult)
486 {
487 target->SendNewItem(resultValue.item, resultValue.count, false, false, true);
488 target->UpdateCriteria(CriteriaType::LootItem, resultValue.item->GetEntry(), resultValue.count);
489 target->UpdateCriteria(CriteriaType::GetLootByType, resultValue.item->GetEntry(), resultValue.count, resultValue.lootType);
490 target->UpdateCriteria(CriteriaType::LootAnyItem, resultValue.item->GetEntry(), resultValue.count);
491 }
492}
493
495{
496 LootRoll* lootRoll = GetPlayer()->GetLootRoll(packet.LootObj, packet.LootListID);
497 if (!lootRoll)
498 return;
499
500 lootRoll->PlayerVote(GetPlayer(), RollVote(packet.RollType));
501}
502
504{
505 if (packet.SpecID)
506 {
507 if (ChrSpecializationEntry const* chrSpec = sChrSpecializationStore.LookupEntry(packet.SpecID))
508 if (chrSpec->ClassID == GetPlayer()->GetClass())
509 GetPlayer()->SetLootSpecId(packet.SpecID);
510 }
511 else
513}
DB2Storage< ChrSpecializationEntry > sChrSpecializationStore("ChrSpecialization.db2", &ChrSpecializationLoadInfo::Instance)
@ MoneyLootedFromCreatures
uint64_t uint64
Definition Define.h:153
uint32_t uint32
Definition Define.h:154
@ GO_ACTIVATED
Definition GameObject.h:158
@ GO_READY
Definition GameObject.h:157
@ GO_JUST_DEACTIVATED
Definition GameObject.h:159
InventoryResult
Definition ItemDefines.h:25
@ EQUIP_ERR_CANT_EQUIP_EVER
Definition ItemDefines.h:36
@ EQUIP_ERR_OK
Definition ItemDefines.h:26
@ EQUIP_ERR_INV_FULL
Definition ItemDefines.h:77
@ EQUIP_ERR_ITEM_MAX_COUNT
Definition ItemDefines.h:43
@ ITEM_FLAG_HAS_LOOT
#define TC_LOG_DEBUG(filterType__, message__,...)
Definition Log.h:181
#define TC_LOG_INFO(filterType__, message__,...)
Definition Log.h:184
#define sLootItemStorage
@ LOOT_MILLING
Definition Loot.h:116
@ LOOT_CORPSE
Definition Loot.h:102
@ LOOT_ITEM
Definition Loot.h:106
@ LOOT_PROSPECTING
Definition Loot.h:115
@ MASTER_LOOT
Definition Loot.h:92
@ LOOT_ERROR_TOO_FAR
Definition Loot.h:140
@ LOOT_ERROR_NO_LOOT
Definition Loot.h:152
@ LOOT_ERROR_MASTER_OTHER
Definition Loot.h:149
@ LOOT_ERROR_MASTER_INV_FULL
Definition Loot.h:147
@ LOOT_ERROR_MASTER_UNIQUE_ITEM
Definition Loot.h:148
@ LOOT_ERROR_DIDNT_KILL
Definition Loot.h:139
@ LOOT_ERROR_PLAYER_NOT_FOUND
Definition Loot.h:145
RollVote
Definition Loot.h:65
#define INTERACTION_DISTANCE
#define sObjectMgr
Definition ObjectMgr.h:1885
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:841
@ GAMEOBJECT_TYPE_FISHINGHOLE
@ GAMEOBJECT_TYPE_FISHINGNODE
@ GAMEOBJECT_TYPE_GATHERING_NODE
@ CORPSE_DYNFLAG_LOOTABLE
@ UNIT_DYNFLAG_LOOTABLE
@ SPELL_AURA_MOD_MONEY_GAIN
@ PROC_SPELL_PHASE_NONE
Definition SpellMgr.h:223
@ PROC_SPELL_TYPE_MASK_ALL
Definition SpellMgr.h:216
@ PROC_FLAG_LOOTED
Definition SpellMgr.h:143
@ PROC_FLAG_NONE
Definition SpellMgr.h:92
@ PROC_HIT_NONE
Definition SpellMgr.h:234
@ UNIT_FLAG_LOOTING
@ NULL_BAG
Definition Unit.h:63
@ NULL_SLOT
Definition Unit.h:64
T CalculatePct(T base, U pct)
Definition Util.h:72
bool IsValidLootTarget(Creature const *creature) const
AELootCreatureCheck(Player *looter, ObjectGuid mainLootTarget)
ObjectGuid _mainLootTarget
bool IsValidAELootTarget(Creature const *creature) const
bool operator()(Creature const *creature) const
static float constexpr LootDistance
void Add(Item *item, uint8 count, LootType lootType, uint32 dungeonEncounterId)
Definition Loot.cpp:1240
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
void ForceUpdateFieldChange(UF::UpdateFieldPrivateSetter< T > const &)
Definition BaseEntity.h:208
UF::UpdateFieldHolder m_values
Definition BaseEntity.h:205
bool IsInWorld() const
Definition BaseEntity.h:158
void RemoveCorpseDynamicFlag(CorpseDynFlags dynamicFlags)
Definition Corpse.h:95
std::unique_ptr< Loot > m_loot
Definition Corpse.h:132
void AllLootRemovedFromCorpse()
Loot * GetLootForPlayer(Player const *player) const override
bool IsFullyLooted() const
ObjectGuid GetOwnerGUID() const override
Definition GameObject.h:245
bool IsWithinDistInMap(Player const *player) const
void AddUse()
Definition GameObject.h:324
bool IsFullyLooted() const
GameObjectValue const * GetGOValue() const
Definition GameObject.h:207
void OnLootRelease(Player *looter)
void SetLootState(LootState s, Unit *unit=nullptr)
GameobjectTypes GetGoType() const
Definition GameObject.h:282
uint32 GetUseCount() const
Definition GameObject.h:326
Definition Group.h:205
ObjectGuid GetMasterLooterGuid() const
Definition Group.cpp:1675
GroupRefManager & GetMembers()
Definition Group.h:332
Definition Item.h:179
uint8 GetSlot() const
Definition Item.h:290
ItemTemplate const * GetTemplate() const
Definition Item.cpp:1233
std::unique_ptr< Loot > m_loot
Definition Item.h:328
bool m_lootGenerated
Definition Item.h:329
uint32 GetCount() const
Definition Item.h:283
uint8 GetBagSlot() const
Definition Item.cpp:1331
bool PlayerVote(Player *player, RollVote vote)
Definition Loot.cpp:521
GameObject * GetGameObject(ObjectGuid const &guid)
Definition Map.cpp:3552
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:3542
LowType GetCounter() const
Definition ObjectGuid.h:336
static ObjectGuid const Empty
Definition ObjectGuid.h:314
bool IsCorpse() const
Definition ObjectGuid.h:374
bool IsItem() const
Definition ObjectGuid.h:371
bool IsGameObject() const
Definition ObjectGuid.h:372
bool IsCreatureOrVehicle() const
Definition ObjectGuid.h:367
void Clear()
Definition ObjectGuid.h:329
void RemoveDynamicFlag(uint32 flag)
Definition Object.h:98
UF::UpdateField< UF::ObjectData, int32(WowCS::EntityFragment::CGObject), TYPEID_OBJECT > m_objectData
Definition Object.h:161
void SendLootError(ObjectGuid const &lootObj, ObjectGuid const &owner, LootError error) const
Definition Player.cpp:9196
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 itemId, bool update, ItemRandomBonusListId randomBonusListId=0, GuidSet const &allowedLooters=GuidSet(), ItemContext context=ItemContext::NONE, std::vector< int32 > const *bonusListIDs=nullptr, bool addToCollection=true)
Definition Player.cpp:11370
bool ModifyMoney(int64 amount, bool sendError=true)
Definition Player.cpp:24850
void ApplyItemLootedSpell(Item *item, bool apply)
Definition Player.cpp:8912
void SendLootRelease(ObjectGuid guid) const
Definition Player.cpp:9154
std::unordered_map< ObjectGuid, Loot * > m_AELootView
Definition Player.h:3415
LootRoll * GetLootRoll(ObjectGuid const &lootObjectGuid, uint8 lootListId)
Definition Player.cpp:9089
bool isAllowedToLoot(Creature const *creature) const
Definition Player.cpp:18944
ObjectGuid const & GetLootGUID() const
Definition Player.h:2262
void SetLootGUID(ObjectGuid const &guid)
Definition Player.h:2263
bool IsAtGroupRewardDistance(WorldObject const *pRewardSource) const
Definition Player.cpp:26434
WorldSession * GetSession() const
Definition Player.h:2272
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition Player.cpp:12121
void SendLoot(Loot &loot, bool aeLooting=false)
Definition Player.cpp:9167
void UpdateCriteria(CriteriaType type, uint64 miscValue1=0, uint64 miscValue2=0, uint64 miscValue3=0, WorldObject *ref=nullptr)
Definition Player.cpp:27588
uint32 DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check=false)
Definition Player.cpp:12222
std::unordered_map< ObjectGuid, Loot * > const & GetAELootView() const
Definition Player.h:2265
void StoreLootItem(ObjectGuid lootWorldObjectGuid, uint8 lootSlot, Loot *loot, AELootResult *aeResult=nullptr)
Definition Player.cpp:27187
Group * GetGroup(Optional< uint8 > partyIndex)
Definition Player.h:2796
void SetLootSpecId(uint32 id)
Definition Player.h:1997
Item * GetItemByGuid(ObjectGuid guid) const
Definition Player.cpp:9614
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition Player.cpp:10050
void SendNewItem(Item *item, uint32 quantity, bool received, bool created, bool broadcast=false, uint32 dungeonEncounterId=0)
Definition Player.cpp:13878
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3231
bool IsAlive() const
Definition Unit.h:1185
void RemoveAurasWithInterruptFlags(InterruptFlags flag, SpellInfo const *source=nullptr)
Definition Unit.cpp:4241
float GetTotalAuraModifierByMiscValue(AuraType auraType, int32 misc_value) const
Definition Unit.cpp:5129
bool IsInRaidWith(Unit const *unit) const
Definition Unit.cpp:12177
static void ProcSkillsAndAuras(Unit *actor, Unit *actionTarget, ProcFlagsInit const &typeMaskActor, ProcFlagsInit const &typeMaskActionTarget, ProcFlagsSpellType spellTypeMask, ProcFlagsSpellPhase spellPhaseMask, ProcFlagsHit hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
Definition Unit.cpp:5570
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:847
Map * GetMap() const
Definition Object.h:411
std::string const & GetName() const
Definition Object.h:342
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:501
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:496
bool IsInMap(WorldObject const *obj) const
Definition Object.cpp:469
WorldPacket const * Write() override
Array< LootRequest, 100 > Loot
Definition LootPackets.h:95
WorldPacket const * Write() override
Array< LootRequest, 100 > Loot
void HandleLootMasterGiveOpcode(WorldPackets::Loot::MasterLootItem &masterLootItem)
void HandleLootReleaseOpcode(WorldPackets::Loot::LootRelease &packet)
void HandleLootMoneyOpcode(WorldPackets::Loot::LootMoney &packet)
void HandleLootOpcode(WorldPackets::Loot::LootUnit &packet)
void DoLootRelease(Loot *loot)
Player * GetPlayer() const
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
Player * _player
void HandleAutostoreLootItemOpcode(WorldPackets::Loot::LootItem &packet)
void DoLootReleaseAll()
void HandleSetLootSpecialization(WorldPackets::Loot::SetLootSpecialization &packet)
void HandleLootRoll(WorldPackets::Loot::LootRoll &packet)
#define sWorld
Definition World.h:916
@ CONFIG_ENABLE_AE_LOOT
Definition World.h:199
TC_GAME_API Player * GetPlayer(Map const *, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
TC_GAME_API Corpse * GetCorpse(WorldObject const &u, ObjectGuid const &guid)
auto MapGetValuePtr(M &map, typename M::key_type const &key)
Definition MapUtils.h:37
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition CellImpl.h:179
bool HasFlag(ItemFlags flag) const
bool HasAllowedLooter(ObjectGuid const &looter) const
Definition Loot.cpp:205
std::vector< int32 > BonusListIDs
Definition Loot.h:181
uint32 itemid
Definition Loot.h:178
uint32 count
Definition Loot.h:186
bool is_looted
Definition Loot.h:188
ItemRandomBonusListId randomBonusListId
Definition Loot.h:180
ItemContext context
Definition Loot.h:182
GuidSet const & GetAllowedLooters() const
Definition Loot.h:217
LootItemType type
Definition Loot.h:187
Definition Loot.h:286
void NotifyLootList(Map const *map) const
Definition Loot.cpp:736
bool isLooted() const
Definition Loot.h:312
void LootMoney()
Definition Loot.cpp:1060
void NotifyMoneyRemoved(Map const *map)
Definition Loot.cpp:779
void NotifyItemRemoved(uint8 lootListId, Map const *map)
Definition Loot.cpp:756
uint8 unlootedCount
Definition Loot.h:291
ObjectGuid roundRobinPlayer
Definition Loot.h:292
ObjectGuid const & GetOwnerGUID() const
Definition Loot.h:304
uint32 gold
Definition Loot.h:290
ObjectGuid const & GetGUID() const
Definition Loot.h:303
std::vector< LootItem > items
Definition Loot.h:289
void RemoveLooter(ObjectGuid GUID)
Definition Loot.h:320
uint32 GetDungeonEncounterId() const
Definition Loot.h:309
LootMethod GetLootMethod() const
Definition Loot.h:307
LootType loot_type
Definition Loot.h:293
bool HasAllowedLooter(ObjectGuid const &looter) const
Definition Loot.cpp:840
UpdateField< uint32, 0, 2 > DynamicFlags
struct GameObjectValue::@193 FishingHole