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;
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 {
304 bool allOpensConsumed = false;
306 {
307 // The fishing hole used once more
308 go->AddUse();
309
310 // If the max usage is reached, will be despawned in next tick
311 allOpensConsumed = go->GetUseCount() >= go->GetGOValue()->FishingHole.MaxOpens;
312 }
313
314 go->SetLootState(allOpensConsumed ? GO_JUST_DEACTIVATED : GO_READY);
315 }
316 else if (go->GetGoType() != GAMEOBJECT_TYPE_GATHERING_NODE && go->IsFullyLooted())
318
319 go->OnLootRelease(player);
320 }
321 else
322 {
323 // not fully looted object
324 go->SetLootState(GO_ACTIVATED, player);
325 }
326 }
327 else if (lguid.IsCorpse()) // ONLY remove insignia at BG
328 {
329 Corpse* corpse = ObjectAccessor::GetCorpse(*player, lguid);
330 if (!corpse || !corpse->IsWithinDistInMap(player, INTERACTION_DISTANCE))
331 return;
332
333 if (loot->isLooted())
334 {
335 corpse->m_loot = nullptr;
337 }
338 }
339 else if (lguid.IsItem())
340 {
341 Item* pItem = player->GetItemByGuid(lguid);
342 if (!pItem)
343 return;
344
345 ItemTemplate const* proto = pItem->GetTemplate();
346
347 // destroy only 5 items from stack in case prospecting and milling
348 if (loot->loot_type == LOOT_PROSPECTING || loot->loot_type == LOOT_MILLING)
349 {
350 pItem->m_lootGenerated = false;
351 pItem->m_loot = nullptr;
352
353 uint32 count = pItem->GetCount();
354
355 // >=5 checked in spell code, but will work for cheating cases also with removing from another stacks.
356 if (count > 5)
357 count = 5;
358
359 player->DestroyItemCount(pItem, count, true);
360 }
361 else
362 {
363 // Only delete item if no loot or money (unlooted loot is saved to db) or if it isn't an openable item
364 if (loot->isLooted() || !proto->HasFlag(ITEM_FLAG_HAS_LOOT))
365 player->DestroyItem(pItem->GetBagSlot(), pItem->GetSlot(), true);
366 }
367 return; // item can be looted only single player
368 }
369 else
370 {
371 Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid);
372 if (!creature)
373 return;
374
375 if (loot->isLooted())
376 {
377 if (creature->IsFullyLooted())
378 {
380
381 // skip pickpocketing loot for speed, skinning timer reduction is no-op in fact
382 if (!creature->IsAlive())
383 creature->AllLootRemovedFromCorpse();
384 }
385 }
386 else
387 {
388 // if the round robin player release, reset it.
389 if (player->GetGUID() == loot->roundRobinPlayer)
390 {
391 loot->roundRobinPlayer.Clear();
392 loot->NotifyLootList(creature->GetMap());
393 }
394 }
395 // force dynflag update to update looter and lootable info
397 }
398}
399
401{
402 std::unordered_map<ObjectGuid, Loot*> lootView = _player->GetAELootView();
403 for (auto const& [lootGuid, loot] : lootView)
404 DoLootRelease(loot);
405}
406
408{
409 AELootResult aeResult;
410
412 {
414 return;
415 }
416
417 // player on other map
418 Player* target = ObjectAccessor::GetPlayer(*_player, masterLootItem.Target);
419 if (!target)
420 {
422 return;
423 }
424
425 TC_LOG_DEBUG("network", "WorldSession::HandleLootMasterGiveOpcode (CMSG_LOOT_MASTER_GIVE, 0x02A3) Target = [{}].", target->GetName());
426
427 for (WorldPackets::Loot::LootRequest const& req : masterLootItem.Loot)
428 {
430
431 if (!loot || loot->GetLootMethod() != MASTER_LOOT)
432 return;
433
434 if (!_player->IsInRaidWith(target) || !_player->IsInMap(target))
435 {
437 TC_LOG_INFO("entities.player.cheat", "MasterLootItem: Player {} tried to give an item to ineligible player {} !", GetPlayer()->GetName(), target->GetName());
438 return;
439 }
440
441 if (!loot->HasAllowedLooter(masterLootItem.Target))
442 {
444 return;
445 }
446
447 if (req.LootListID >= loot->items.size())
448 {
450 TC_LOG_DEBUG("loot", "MasterLootItem: Player {} might be using a hack! (slot {}, size {})",
451 GetPlayer()->GetName(), req.LootListID, loot->items.size());
452 return;
453 }
454
455 LootItem& item = loot->items[req.LootListID];
456 if (item.type != LootItemType::Item)
457 {
459 return;
460 }
461
462 ItemPosCountVec dest;
463 InventoryResult msg = target->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.itemid, item.count);
464 if (!item.HasAllowedLooter(target->GetGUID()))
466 if (msg != EQUIP_ERR_OK)
467 {
468 if (msg == EQUIP_ERR_ITEM_MAX_COUNT)
470 else if (msg == EQUIP_ERR_INV_FULL)
472 else
474 return;
475 }
476
477 // now move item from loot to target inventory
478 if (Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.randomBonusListId, item.GetAllowedLooters(), item.context, &item.BonusListIDs))
479 aeResult.Add(newitem, item.count, loot->loot_type, loot->GetDungeonEncounterId());
480 else
481 target->ApplyItemLootedSpell(sObjectMgr->GetItemTemplate(item.itemid));
482
483 // mark as looted
484 item.count = 0;
485 item.is_looted = true;
486
487 loot->NotifyItemRemoved(req.LootListID, GetPlayer()->GetMap());
488 --loot->unlootedCount;
489 }
490
491 for (AELootResult::ResultValue const& resultValue : aeResult)
492 {
493 target->SendNewItem(resultValue.item, resultValue.count, false, false, true);
494 target->UpdateCriteria(CriteriaType::LootItem, resultValue.item->GetEntry(), resultValue.count);
495 target->UpdateCriteria(CriteriaType::GetLootByType, resultValue.item->GetEntry(), resultValue.count, resultValue.lootType);
496 target->UpdateCriteria(CriteriaType::LootAnyItem, resultValue.item->GetEntry(), resultValue.count);
497 }
498}
499
501{
502 LootRoll* lootRoll = GetPlayer()->GetLootRoll(packet.LootObj, packet.LootListID);
503 if (!lootRoll)
504 return;
505
506 lootRoll->PlayerVote(GetPlayer(), RollVote(packet.RollType));
507}
508
510{
511 if (packet.SpecID)
512 {
513 if (ChrSpecializationEntry const* chrSpec = sChrSpecializationStore.LookupEntry(packet.SpecID))
514 if (chrSpec->ClassID == GetPlayer()->GetClass())
515 GetPlayer()->SetLootSpecId(packet.SpecID);
516 }
517 else
519}
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:164
@ GO_READY
Definition GameObject.h:163
@ GO_JUST_DEACTIVATED
Definition GameObject.h:165
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:173
#define TC_LOG_INFO(filterType__, message__,...)
Definition Log.h:176
#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:1873
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:827
@ 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:104
std::unique_ptr< Loot > m_loot
Definition Corpse.h:141
void AllLootRemovedFromCorpse()
Loot * GetLootForPlayer(Player const *player) const override
bool IsFullyLooted() const
ObjectGuid GetOwnerGUID() const override
Definition GameObject.h:251
bool IsWithinDistInMap(Player const *player) const
void AddUse()
Definition GameObject.h:330
bool IsFullyLooted() const
GameObjectValue const * GetGOValue() const
Definition GameObject.h:213
void OnLootRelease(Player *looter)
void SetLootState(LootState s, Unit *unit=nullptr)
GameobjectTypes GetGoType() const
Definition GameObject.h:288
uint32 GetUseCount() const
Definition GameObject.h:332
Definition Group.h:209
ObjectGuid GetMasterLooterGuid() const
Definition Group.cpp:1645
GroupRefManager & GetMembers()
Definition Group.h:336
Definition Item.h:185
uint8 GetSlot() const
Definition Item.h:296
ItemTemplate const * GetTemplate() const
Definition Item.cpp:1233
std::unique_ptr< Loot > m_loot
Definition Item.h:334
bool m_lootGenerated
Definition Item.h:335
uint32 GetCount() const
Definition Item.h:289
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:3588
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:3578
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:9104
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:11288
bool ModifyMoney(int64 amount, bool sendError=true)
Definition Player.cpp:24800
void ApplyItemLootedSpell(Item *item, bool apply)
Definition Player.cpp:8820
void SendLootRelease(ObjectGuid guid) const
Definition Player.cpp:9062
std::unordered_map< ObjectGuid, Loot * > m_AELootView
Definition Player.h:3401
LootRoll * GetLootRoll(ObjectGuid const &lootObjectGuid, uint8 lootListId)
Definition Player.cpp:8997
bool isAllowedToLoot(Creature const *creature) const
Definition Player.cpp:18903
ObjectGuid const & GetLootGUID() const
Definition Player.h:2246
void SetLootGUID(ObjectGuid const &guid)
Definition Player.h:2247
bool IsAtGroupRewardDistance(WorldObject const *pRewardSource) const
Definition Player.cpp:26375
WorldSession * GetSession() const
Definition Player.h:2256
void SendNewItem(Item *item, uint32 quantity, bool pushed, bool created, bool broadcast=false, uint32 dungeonEncounterId=0)
Definition Player.cpp:13835
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition Player.cpp:12039
void SendLoot(Loot &loot, bool aeLooting=false)
Definition Player.cpp:9075
void UpdateCriteria(CriteriaType type, uint64 miscValue1=0, uint64 miscValue2=0, uint64 miscValue3=0, WorldObject *ref=nullptr)
Definition Player.cpp:27532
uint32 DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check=false)
Definition Player.cpp:12140
std::unordered_map< ObjectGuid, Loot * > const & GetAELootView() const
Definition Player.h:2249
void StoreLootItem(ObjectGuid lootWorldObjectGuid, uint8 lootSlot, Loot *loot, AELootResult *aeResult=nullptr)
Definition Player.cpp:27131
Group * GetGroup(Optional< uint8 > partyIndex)
Definition Player.h:2781
void SetLootSpecId(uint32 id)
Definition Player.h:1982
Item * GetItemByGuid(ObjectGuid guid) const
Definition Player.cpp:9522
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition Player.cpp:9970
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3253
bool IsAlive() const
Definition Unit.h:1205
void RemoveAurasWithInterruptFlags(InterruptFlags flag, SpellInfo const *source=nullptr)
Definition Unit.cpp:4259
float GetTotalAuraModifierByMiscValue(AuraType auraType, int32 misc_value) const
Definition Unit.cpp:5147
bool IsInRaidWith(Unit const *unit) const
Definition Unit.cpp:12272
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:5589
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:862
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:499
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:494
bool IsInMap(WorldObject const *obj) const
Definition Object.cpp:467
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:919
@ CONFIG_ENABLE_AE_LOOT
Definition World.h:200
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)
Definition CellImpl.h:140
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::@195 FishingHole