TrinityCore
Loading...
Searching...
No Matches
SpellHandler.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 "AreaTrigger.h"
20#include "AreaTriggerPackets.h"
21#include "CollectionMgr.h"
22#include "Common.h"
23#include "DatabaseEnv.h"
24#include "DB2Stores.h"
25#include "GameObject.h"
26#include "GameObjectAI.h"
27#include "GameObjectPackets.h"
28#include "Guild.h"
29#include "GuildMgr.h"
30#include "Item.h"
31#include "Log.h"
32#include "Loot.h"
33#include "LootItemStorage.h"
34#include "LootMgr.h"
35#include "Map.h"
36#include "Player.h"
37#include "ObjectAccessor.h"
38#include "ObjectMgr.h"
39#include "ScriptMgr.h"
40#include "Spell.h"
41#include "SpellAuraEffects.h"
42#include "SpellCastRequest.h"
43#include "SpellMgr.h"
44#include "SpellPackets.h"
45#include "TemporarySummon.h"
46#include "TotemPackets.h"
47#include "World.h"
48
50{
51 // Skip casting invalid spells right away
52 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(packet.Cast.SpellID, _player->GetMap()->GetDifficultyID());
53 if (!spellInfo)
54 {
55 TC_LOG_ERROR("network", "WorldSession::HandleUseItemOpcode: attempted to cast a non-existing spell (Id: {})", packet.Cast.SpellID);
56 return;
57 }
58
59 if (_player->CanRequestSpellCast(spellInfo, _player))
60 _player->RequestSpellCast(std::make_unique<SpellCastRequest>(std::move(packet.Cast), _player->GetGUID(), SpellCastRequestItemData(packet.PackSlot, packet.Slot, packet.CastItem)));
61 else
63}
64
66{
67 Player* player = GetPlayer();
68
69 // ignore for remote control state
70 if (player->IsCharmed())
71 return;
72
73 TC_LOG_INFO("network", "bagIndex: {}, slot: {}", packet.Slot, packet.PackSlot);
74
75 // additional check, client outputs message on its own
76 if (!player->IsAlive())
77 {
78 player->SendEquipError(EQUIP_ERR_PLAYER_DEAD, nullptr, nullptr);
79 return;
80 }
81
82 Item* item = player->GetItemByPos(packet.Slot, packet.PackSlot);
83 if (!item)
84 {
85 player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
86 return;
87 }
88
89 ItemTemplate const* proto = item->GetTemplate();
90 if (!proto)
91 {
92 player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, nullptr);
93 return;
94 }
95
96 // Verify that the bag is an actual bag or wrapped item that can be used "normally"
97 if (!proto->HasFlag(ITEM_FLAG_HAS_LOOT) && !item->IsWrapped())
98 {
99 player->SendEquipError(EQUIP_ERR_CLIENT_LOCKED_OUT, item, nullptr);
100 TC_LOG_ERROR("entities.player.cheat", "Possible hacking attempt: Player {} {} tried to open item [{}, entry: {}] which is not openable!",
101 player->GetName(), player->GetGUID().ToString(), item->GetGUID().ToString(), proto->GetId());
102 return;
103 }
104
105 // locked item
106 uint32 lockId = proto->GetLockID();
107 if (lockId)
108 {
109 LockEntry const* lockInfo = sLockStore.LookupEntry(lockId);
110
111 if (!lockInfo)
112 {
113 player->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, nullptr);
114 TC_LOG_ERROR("network", "WORLD::OpenItem: item {} has an unknown lockId: {}!", item->GetGUID().ToString(), lockId);
115 return;
116 }
117
118 // was not unlocked yet
119 if (item->IsLocked())
120 {
121 player->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, nullptr);
122 return;
123 }
124 }
125
126 if (item->IsWrapped())
127 {
129 stmt->setUInt64(0, item->GetGUID().GetCounter());
131 .WithPreparedCallback([this, pos = item->GetPos(), itemGuid = item->GetGUID()](PreparedQueryResult result)
132 {
133 HandleOpenWrappedItemCallback(pos, itemGuid, std::move(result));
134 }));
135 }
136 else
137 {
138 // If item doesn't already have loot, attempt to load it. If that
139 // fails then this is first time opening, generate loot
140 if (!item->m_lootGenerated && !sLootItemStorage->LoadStoredLoot(item, player))
141 {
142 Loot* loot = new Loot(player->GetMap(), item->GetGUID(), LOOT_ITEM, nullptr);
143 item->m_loot.reset(loot);
144 item->m_lootGenerated = true;
146 loot->FillLoot(item->GetEntry(), LootTemplates_Item, player, true, loot->gold != 0);
147
148 // Force save the loot and money items that were just rolled
149 // Also saves the container item ID in Loot struct (not to DB)
150 if (loot->gold > 0 || loot->unlootedCount > 0)
151 sLootItemStorage->AddNewStoredLoot(item->GetGUID().GetCounter(), loot, player);
152 }
153 if (item->m_loot)
154 player->SendLoot(*item->m_loot);
155 else
157 }
158}
159
161{
162 if (!GetPlayer())
163 return;
164
165 Item* item = GetPlayer()->GetItemByPos(pos);
166 if (!item)
167 return;
168
169 if (item->GetGUID() != itemGuid || !item->IsWrapped()) // during getting result, gift was swapped with another item
170 return;
171
172 if (!result)
173 {
174 TC_LOG_ERROR("network", "Wrapped item {} does't have record in character_gifts table and will deleted", item->GetGUID().ToString());
175 GetPlayer()->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
176 return;
177 }
178
179 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
180
181 Field* fields = result->Fetch();
182 uint32 entry = fields[0].GetUInt32();
183 uint32 flags = fields[1].GetUInt32();
184
186 item->SetEntry(entry);
190
192
194 stmt->setUInt64(0, itemGuid.GetCounter());
195 trans->Append(stmt);
196
197 CharacterDatabase.CommitTransaction(trans);
198}
199
201{
202 if (GameObject* obj = GetPlayer()->GetGameObjectIfCanInteractWith(packet.Guid))
203 {
204 // ignore for remote control state
205 if (GetPlayer()->IsCharmed())
206 if (!(GetPlayer()->IsOnVehicle(GetPlayer()->GetCharmed()) || GetPlayer()->IsMounted()) && !obj->GetGOInfo()->IsUsableMounted())
207 return;
208
209 obj->Use(GetPlayer());
210 }
211}
212
214{
215 // ignore for remote control state
216 if (_player->IsCharmed())
217 return;
218
219 if (GameObject* go = GetPlayer()->GetGameObjectIfCanInteractWith(packet.Guid))
220 {
221 if (go->AI()->OnReportUse(_player))
222 return;
223
225 }
226}
227
229{
230 // Skip casting invalid spells right away
231 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(castRequest.Cast.SpellID, _player->GetMap()->GetDifficultyID());
232 if (!spellInfo)
233 {
234 TC_LOG_ERROR("network", "WorldSession::HandleCastSpellOpcode: attempted to cast a non-existing spell (Id: {})", castRequest.Cast.SpellID);
235 return;
236 }
237
238 if (castRequest.Cast.MoveUpdate.has_value())
240
241 if (_player->CanRequestSpellCast(spellInfo, _player))
242 _player->RequestSpellCast(std::make_unique<SpellCastRequest>(std::move(castRequest.Cast), _player->GetGUID()));
243 else
245}
246
248{
249 if (_player->IsCharmed())
250 return;
251
252 if (_player->IsNonMeleeSpellCast(false))
253 {
254 _player->InterruptNonMeleeSpells(false, packet.SpellID, false);
255 _player->CancelPendingCastRequest(); // canceling casts also cancels pending spell cast requests
256 }
257}
258
260{
261 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cancelAura.SpellID, _player->GetMap()->GetDifficultyID());
262 if (!spellInfo)
263 return;
264
265 // not allow remove spells with attr SPELL_ATTR0_CANT_CANCEL
267 return;
268
269 // channeled spell case (it currently cast then)
270 if (spellInfo->IsChanneled())
271 {
273 if (curSpell->GetSpellInfo()->Id == uint32(cancelAura.SpellID))
275 return;
276 }
277
278 // non channeled case:
279 // don't allow remove non positive spells
280 // don't allow cancelling passive auras (some of them are visible)
281 if (!spellInfo->IsPositive() || spellInfo->IsPassive())
282 return;
283
285}
286
288{
289 if (!sSpellMgr->GetSpellInfo(packet.SpellID, DIFFICULTY_NONE))
290 {
291 TC_LOG_ERROR("network", "WORLD: unknown PET spell id {}", packet.SpellID);
292 return;
293 }
294
296
297 if (!pet)
298 {
299 TC_LOG_ERROR("network", "HandlePetCancelAura: Attempt to cancel an aura for non-existant {} by player '{}'", packet.PetGUID.ToString(), GetPlayer()->GetName());
300 return;
301 }
302
303 if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharmed())
304 {
305 TC_LOG_ERROR("network", "HandlePetCancelAura: {} is not a pet of player '{}'", packet.PetGUID.ToString(), GetPlayer()->GetName());
306 return;
307 }
308
309 if (!pet->IsAlive())
310 {
312 return;
313 }
314
316}
317
319{
321 {
322 SpellInfo const* spellInfo = aurApp->GetBase()->GetSpellInfo();
323 return !spellInfo->HasAttribute(SPELL_ATTR0_NO_AURA_CANCEL) && spellInfo->IsPositive() && !spellInfo->IsPassive();
324 });
325}
326
328{
330 {
331 SpellInfo const* spellInfo = aurApp->GetBase()->GetSpellInfo();
332 return !spellInfo->HasAttribute(SPELL_ATTR0_NO_AURA_CANCEL) && spellInfo->IsPositive() && !spellInfo->IsPassive();
333 });
334}
335
337{
338 Unit* mover = _player->GetUnitBeingMoved();
339 if (!mover || mover->GetGUID() != cancelModSpeedNoControlAuras.TargetGUID)
340 return;
341
343 {
344 SpellInfo const* spellInfo = aurApp->GetBase()->GetSpellInfo();
345 return !spellInfo->HasAttribute(SPELL_ATTR0_NO_AURA_CANCEL) && spellInfo->IsPositive() && !spellInfo->IsPassive();
346 });
347}
348
353
358
360{
361 // ignore for remote control state (for player case)
362 Unit* mover = _player->GetUnitBeingMoved();
363 if (!mover)
364 return;
365
366 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cancelChanneling.ChannelSpell, mover->GetMap()->GetDifficultyID());
367 if (!spellInfo)
368 return;
369
370 // not allow remove spells with attr SPELL_ATTR0_CANT_CANCEL
372 return;
373
375 if (!spell || spell->GetSpellInfo()->Id != spellInfo->Id)
376 return;
377
379}
380
385
387{
388 // ignore for remote control state (for player case)
389 Unit* mover = _player->GetUnitBeingMoved();
390 if (!mover)
391 return;
392
394 if (!spell || spell->GetSpellInfo()->Id != uint32(spellEmpowerRelease.SpellID) || !spell->IsEmpowerSpell())
395 return;
396
397 spell->SetEmpowerReleasedByClient(true);
398}
399
401{
402 // ignore for remote control state (for player case)
403 Unit* mover = _player->GetUnitBeingMoved();
404 if (!mover)
405 return;
406
408 if (!spell || spell->GetSpellInfo()->Id != uint32(spellEmpowerRestart.SpellID) || !spell->IsEmpowerSpell())
409 return;
410
411 spell->SetEmpowerReleasedByClient(false);
412}
413
415{
416 // ignore for remote control state
417 if (_player->IsCharmed())
418 return;
419
420 uint8 slotId = totemDestroyed.Slot;
421 slotId += SUMMON_SLOT_TOTEM;
422
423 if (slotId >= MAX_TOTEM_SLOT)
424 return;
425
426 if (!_player->m_SummonSlot[slotId])
427 return;
428
430 if (totem && totem->IsTotem() && (totemDestroyed.TotemGUID.IsEmpty() || totem->GetGUID() == totemDestroyed.TotemGUID))
431 totem->DespawnOrUnsummon();
432}
433
435{
436 if (_player->m_activePlayerData->SelfResSpells.FindIndex(selfRes.SpellID) < 0)
437 return;
438
439 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(selfRes.SpellID, _player->GetMap()->GetDifficultyID());
440 if (!spellInfo)
441 return;
442
444 return; // silent return, client should display error by itself and not send this opcode
445
448}
449
451{
452 // this will get something not in world. crash
454
455 if (!unit)
456 return;
457
459 if (!unit->IsInWorld())
460 return;
461
463}
464
466{
467 ObjectGuid guid = getMirrorImageData.UnitGUID;
468
469 // Get unit for which data is needed by client
470 Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
471 if (!unit)
472 return;
473
475 return;
476
477 // Get creator of the unit (SPELL_AURA_CLONE_CASTER does not stack)
478 Unit* creator = unit->GetAuraEffectsByType(SPELL_AURA_CLONE_CASTER).front()->GetCaster();
479 if (!creator)
480 return;
481
482 if (Player* player = creator->ToPlayer())
483 {
484 WorldPackets::Spells::MirrorImageComponentedData mirrorImageComponentedData;
485 mirrorImageComponentedData.UnitGUID = guid;
486 if (ChrModelEntry const* chrModel = sDB2Manager.GetChrModel(creator->GetRace(), creator->GetGender()))
487 mirrorImageComponentedData.ChrModelID = chrModel->ID;
488 mirrorImageComponentedData.DisplayScale = creator->GetDisplayScale();
489 mirrorImageComponentedData.RaceID = creator->GetRace();
490 mirrorImageComponentedData.Gender = creator->GetGender();
491 mirrorImageComponentedData.ClassID = creator->GetClass();
492 mirrorImageComponentedData.Customizations.assign(player->m_playerData->Customizations.begin(), player->m_playerData->Customizations.end());
493
494 Guild* guild = player->GetGuild();
495 mirrorImageComponentedData.GuildGUID = (guild ? guild->GetGUID() : ObjectGuid::Empty);
496
497 mirrorImageComponentedData.ItemDisplayID.reserve(11);
498
499 static constexpr EquipmentSlots itemSlots[] =
500 {
512 };
513
514 // Display items in visible slots
515 for (EquipmentSlots slot : itemSlots)
516 {
517 uint32 itemDisplayId;
518 if (Item const* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
519 itemDisplayId = item->GetDisplayId(player);
520 else
521 itemDisplayId = 0;
522
523 mirrorImageComponentedData.ItemDisplayID.push_back(itemDisplayId);
524 }
525 SendPacket(mirrorImageComponentedData.Write());
526 }
527 else
528 {
529 WorldPackets::Spells::MirrorImageCreatureData mirrorImageCreatureData;
530 mirrorImageCreatureData.UnitGUID = guid;
531 mirrorImageCreatureData.DisplayID = creator->GetDisplayId();
532 SendPacket(mirrorImageCreatureData.Write());
533 }
534}
535
537{
538 Unit* caster = ObjectAccessor::GetUnit(*_player, packet.Target);
539 if (!caster)
540 return;
541
542 Spell* spell = caster->FindCurrentSpellBySpellId(packet.SpellID);
543 if (!spell || !spell->m_targets.HasDst())
544 return;
545
546 spell->m_targets.ModDst(packet.CollisionPos);
547
548 // we changed dest, recalculate flight time
550
552 notify.Caster = packet.Target;
553 notify.CastID = packet.CastID;
554 notify.CollisionPos = packet.CollisionPos;
555 caster->SendMessageToSet(notify.Write(), true);
556}
557
559{
560 Unit* caster = ObjectAccessor::GetUnit(*_player, packet.Guid);
561 Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_GENERIC_SPELL) : nullptr;
562 if (!spell || spell->m_spellInfo->Id != uint32(packet.SpellID) || spell->m_castId != packet.CastID || !spell->m_targets.HasDst() || !spell->m_targets.HasSrc())
563 return;
564
565 spell->m_targets.ModSrc(packet.FirePos);
566 spell->m_targets.ModDst(packet.ImpactPos);
567 spell->m_targets.SetPitch(packet.Pitch);
568 spell->m_targets.SetSpeed(packet.Speed);
569
570 if (packet.Status)
572}
573
575{
576 Unit* target = ObjectAccessor::GetUnit(*_player, updateAuraVisual.TargetGUID);
577 if (!target)
578 return;
579
580 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(updateAuraVisual.SpellID, _player->GetMap()->GetDifficultyID());
581 if (!spellInfo)
582 return;
583
584 uint32 spellXspellVisualId = _player->GetCastSpellXSpellVisualId(spellInfo);
585 for (auto const& [_, auraApp] : Trinity::Containers::MapEqualRange(target->GetAppliedAuras(), spellInfo->Id))
586 if (auraApp->GetBase()->GetCasterGUID() == _player->GetGUID())
587 auraApp->GetBase()->SetSpellVisual({ .SpellXSpellVisualID = spellXspellVisualId });
588
589 if (_player->GetChannelSpellId() == spellInfo->Id)
590 _player->SetChannelVisual({ .SpellXSpellVisualID = spellXspellVisualId });
591}
592
594{
595 AreaTrigger* target = ObjectAccessor::GetAreaTrigger(*_player, updateAreaTriggerVisual.TargetGUID);
596 if (!target)
597 return;
598
599 if (target->GetCasterGuid() != _player->GetGUID())
600 return;
601
602 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(target->m_areaTriggerData->SpellForVisuals, _player->GetMap()->GetDifficultyID());
603 if (!spellInfo)
604 return;
605
606 target->SetSpellVisual({ .SpellXSpellVisualID = _player->GetCastSpellXSpellVisualId(spellInfo) });
607}
608
610{
611 Player* player = GetPlayer();
613 return;
614
615 SpellKeyboundOverrideEntry const* spellKeyboundOverride = sSpellKeyboundOverrideStore.LookupEntry(keyboundOverride.OverrideID);
616 if (!spellKeyboundOverride)
617 return;
618
619 player->CastSpell(player, spellKeyboundOverride->Data);
620}
@ CHAR_DEL_GIFT
@ CHAR_SEL_CHARACTER_GIFT_BY_ITEM
DB2Storage< LockEntry > sLockStore("Lock.db2", &LockLoadInfo::Instance)
DB2Storage< SpellKeyboundOverrideEntry > sSpellKeyboundOverrideStore("SpellKeyboundOverride.db2", &SpellKeyboundOverrideLoadInfo::Instance)
#define sDB2Manager
Definition DB2Stores.h:579
@ DIFFICULTY_NONE
Definition DBCEnums.h:936
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
uint8_t uint8
Definition Define.h:156
uint16_t uint16
Definition Define.h:155
uint32_t uint32
Definition Define.h:154
uint16 flags
@ EQUIP_ERR_PLAYER_DEAD
Definition ItemDefines.h:65
@ EQUIP_ERR_CLIENT_LOCKED_OUT
Definition ItemDefines.h:66
@ EQUIP_ERR_ITEM_LOCKED
Definition ItemDefines.h:63
@ EQUIP_ERR_ITEM_NOT_FOUND
Definition ItemDefines.h:49
ItemFieldFlags
@ ITEM_FLAG_HAS_LOOT
@ ITEM_CHANGED
Definition Item.h:47
#define TC_LOG_ERROR(filterType__, message__,...)
Definition Log.h:182
#define TC_LOG_INFO(filterType__, message__,...)
Definition Log.h:176
#define sLootItemStorage
LootStore LootTemplates_Item("item_loot_template", "item entry", true)
@ LOOT_ITEM
Definition Loot.h:106
@ LOOT_ERROR_NO_LOOT
Definition Loot.h:152
@ CMSG_MOVE_STOP
Definition Opcodes.h:691
EquipmentSlots
Definition Player.h:713
@ EQUIPMENT_SLOT_SHOULDERS
Definition Player.h:717
@ EQUIPMENT_SLOT_BODY
Definition Player.h:718
@ EQUIPMENT_SLOT_HANDS
Definition Player.h:724
@ EQUIPMENT_SLOT_TABARD
Definition Player.h:733
@ EQUIPMENT_SLOT_HEAD
Definition Player.h:715
@ EQUIPMENT_SLOT_LEGS
Definition Player.h:721
@ EQUIPMENT_SLOT_BACK
Definition Player.h:729
@ EQUIPMENT_SLOT_WAIST
Definition Player.h:720
@ EQUIPMENT_SLOT_FEET
Definition Player.h:722
@ EQUIPMENT_SLOT_CHEST
Definition Player.h:719
@ EQUIPMENT_SLOT_WRISTS
Definition Player.h:723
constexpr uint8 INVENTORY_SLOT_BAG_0
Definition Player.h:706
@ SPELL_ATTR7_BYPASS_NO_RESURRECT_AURA
@ SUMMON_SLOT_TOTEM
@ SPELL_ATTR0_NO_AURA_CANCEL
#define MAX_TOTEM_SLOT
@ SPELL_FAILED_SPELL_IN_PROGRESS
@ AURA_REMOVE_BY_CANCEL
@ SPELL_AURA_PREVENT_RESURRECTION
@ SPELL_AURA_CLONE_CASTER
@ SPELL_AURA_KEYBOUND_OVERRIDE
@ SPELL_AURA_MOUNTED
@ SPELL_AURA_MOD_SCALE
@ SPELL_AURA_MOD_SPEED_NO_CONTROL
#define sSpellMgr
Definition SpellMgr.h:812
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:611
@ CURRENT_GENERIC_SPELL
Definition Unit.h:610
ObjectGuid const & GetCasterGuid() const
UF::UpdateField< UF::AreaTriggerData, int32(WowCS::EntityFragment::CGObject), TYPEID_AREATRIGGER > m_areaTriggerData
void SetSpellVisual(SpellCastVisual const &visual)
Aura * GetBase() const
Definition SpellAuras.h:82
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
bool IsInWorld() const
Definition BaseEntity.h:158
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Class used to access individual fields of database query result.
Definition Field.h:94
uint32 GetUInt32() const noexcept
Definition Field.cpp:57
Definition Guild.h:329
ObjectGuid GetGUID() const
Definition Guild.h:755
Definition Item.h:185
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition Item.cpp:1258
uint8 GetSlot() const
Definition Item.h:296
bool IsWrapped() const
Definition Item.h:266
void ReplaceAllItemFlags(ItemFieldFlags flags)
Definition Item.h:226
bool IsLocked() const
Definition Item.h:267
ItemTemplate const * GetTemplate() const
Definition Item.cpp:1233
uint16 GetPos() const
Definition Item.h:300
void SetMaxDurability(uint32 maxDurability)
Definition Item.h:275
std::unique_ptr< Loot > m_loot
Definition Item.h:334
bool m_lootGenerated
Definition Item.h:335
uint8 GetBagSlot() const
Definition Item.cpp:1331
void SetGiftCreator(ObjectGuid guid)
Definition Item.h:210
Difficulty GetDifficultyID() const
Definition Map.h:363
LowType GetCounter() const
Definition ObjectGuid.h:336
static ObjectGuid const Empty
Definition ObjectGuid.h:314
bool IsEmpty() const
Definition ObjectGuid.h:362
std::string ToString() const
Player * ToPlayer()
Definition Object.h:126
uint32 GetEntry() const
Definition Object.h:89
void SetEntry(uint32 entry)
Definition Object.h:90
void SendLootError(ObjectGuid const &lootObj, ObjectGuid const &owner, LootError error) const
Definition Player.cpp:9104
void SendEquipError(InventoryResult msg, Item const *item1=nullptr, Item const *item2=nullptr, uint32 itemId=0) const
Definition Player.cpp:13048
UF::UpdateField< UF::ActivePlayerData, int32(WowCS::EntityFragment::CGObject), TYPEID_ACTIVE_PLAYER > m_activePlayerData
Definition Player.h:3048
void SaveInventoryAndGoldToDB(CharacterDatabaseTransaction trans)
Definition Player.cpp:20790
Item * GetItemByPos(uint16 pos) const
Definition Player.cpp:9538
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
bool CanRequestSpellCast(SpellInfo const *spell, Unit const *castingUnit) const
Definition Player.cpp:31530
void SetEmpowerMinHoldStagePercent(float empowerMinHoldStagePercent)
Definition Player.h:2071
void RequestSpellCast(std::unique_ptr< SpellCastRequest > castRequest)
Definition Player.cpp:31499
void CancelPendingCastRequest()
Definition Player.cpp:31512
void RemoveSelfResSpell(int32 spellId)
Definition Player.h:2971
void setUInt64(uint8 index, uint64 value)
void SetPitch(float pitch)
void ModDst(Position const &pos)
Definition Spell.cpp:371
bool HasSrc() const
Definition Spell.cpp:388
void SetSpeed(float speed)
bool HasDst() const
Definition Spell.cpp:393
void ModSrc(Position const &pos)
Definition Spell.cpp:320
uint32 const Id
Definition SpellInfo.h:328
bool IsPassive() const
bool IsChanneled() const
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:456
bool IsPositive() const
Definition Spell.h:277
SpellInfo const * GetSpellInfo() const
Definition Spell.h:702
SpellCastTargets m_targets
Definition Spell.h:651
bool IsEmpowerSpell() const
Definition Spell.h:673
void SetEmpowerReleasedByClient(bool release)
Definition Spell.cpp:8329
void RecalculateDelayMomentForDst()
Definition Spell.cpp:905
static void SendCastResult(Player const *caster, SpellInfo const *spellInfo, SpellCastVisual spellVisual, ObjectGuid cast_count, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE, int32 *param1=nullptr, int32 *param2=nullptr)
Definition Spell.cpp:4641
ObjectGuid m_castId
Definition Spell.h:604
SpellInfo const *const m_spellInfo
Definition Spell.h:599
Definition Unit.h:647
uint32 GetChannelSpellId() const
Definition Unit.h:1443
bool IsCharmed() const
Definition Unit.h:1256
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3769
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3973
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1362
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true, bool skipChanneledAllowingActions=false) const
Definition Unit.cpp:3219
uint32 GetCastSpellXSpellVisualId(SpellInfo const *spellInfo) const override
Definition Unit.cpp:14656
float GetDisplayScale() const
Definition Unit.h:1638
bool HasAuraTypeWithMiscvalue(AuraType auraType, int32 miscValue) const
Definition Unit.cpp:4845
uint8 GetClass() const
Definition Unit.h:776
std::array< ObjectGuid, MAX_SUMMON_SLOT > m_SummonSlot
Definition Unit.h:1524
void HandleSpellClick(Unit *clicker, int8 seatId=-1)
Definition Unit.cpp:12732
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
Definition Unit.cpp:3268
void CancelAutoRepeatSpell()
Definition Unit.cpp:3201
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3253
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, SpellCastResult result=SPELL_FAILED_INTERRUPTED, Optional< SpellCastResult > resultOther={}, ObjectGuid const &interrupter=ObjectGuid::Empty)
Definition Unit.cpp:3158
bool IsAlive() const
Definition Unit.h:1205
void SetChannelVisual(SpellCastVisual channelVisual)
Definition Unit.h:1453
Gender GetGender() const
Definition Unit.h:779
uint32 GetDisplayId() const
Definition Unit.h:1637
Unit * GetUnitBeingMoved() const
Definition Unit.h:1271
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:4832
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1315
bool IsTotem() const
Definition Unit.h:765
void SendPetActionFeedback(PetActionFeedback msg, uint32 spellId) const
-------—Pet responses methods--------------—
Definition Unit.cpp:10700
uint8 GetRace() const
Definition Unit.h:773
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1490
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition Object.cpp:1099
Map * GetMap() const
Definition Object.h:411
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
std::string const & GetName() const
Definition Object.h:342
std::vector< UF::ChrCustomizationChoice > Customizations
TaggedPosition< Position::XYZ > CollisionPos
TaggedPosition< Position::XYZ > ImpactPos
TaggedPosition< Position::XYZ > FirePos
void HandleMovementOpcode(OpcodeClient opcode, MovementInfo &movementInfo)
void HandleUpdateMissileTrajectory(WorldPackets::Spells::UpdateMissileTrajectory &packet)
void HandleKeyboundOverride(WorldPackets::Spells::KeyboundOverride &keyboundOverride)
void HandleCancelChanneling(WorldPackets::Spells::CancelChannelling &cancelChanneling)
QueryCallbackProcessor _queryProcessor
void HandleGameObjectUseOpcode(WorldPackets::GameObject::GameObjUse &packet)
void HandleCancelModSpeedNoControlAuras(WorldPackets::Spells::CancelModSpeedNoControlAuras &cancelModSpeedNoControlAuras)
void HandleUseItemOpcode(WorldPackets::Spells::UseItem &packet)
void HandleMissileTrajectoryCollision(WorldPackets::Spells::MissileTrajectoryCollision &packet)
Player * GetPlayer() const
void HandleUpdateAreaTriggerVisual(WorldPackets::AreaTrigger::UpdateAreaTriggerVisual const &updateAreaTriggerVisual)
void HandleSpellEmpowerRelease(WorldPackets::Spells::SpellEmpowerRelease const &spellEmpowerRelease)
void HandleOpenItemOpcode(WorldPackets::Spells::OpenItem &packet)
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
void HandleCastSpellOpcode(WorldPackets::Spells::CastSpell &castRequest)
void HandleSelfResOpcode(WorldPackets::Spells::SelfRes &selfRes)
Player * _player
void HandleSpellEmpowerRestart(WorldPackets::Spells::SpellEmpowerRestart const &spellEmpowerRestart)
void HandleUpdateAuraVisual(WorldPackets::Spells::UpdateAuraVisual const &updateAuraVisual)
void HandleSpellClick(WorldPackets::Spells::SpellClick &spellClick)
void HandleCancelAutoRepeatSpellOpcode(WorldPackets::Spells::CancelAutoRepeatSpell &cancelAutoRepeatSpell)
void HandleCancelQueuedSpellOpcode(WorldPackets::Spells::CancelQueuedSpell &cancelQueuedSpell)
void HandleCancelAuraOpcode(WorldPackets::Spells::CancelAura &cancelAura)
void HandleGameobjectReportUse(WorldPackets::GameObject::GameObjReportUse &packet)
void HandleMirrorImageDataRequest(WorldPackets::Spells::GetMirrorImageData &getMirrorImageData)
void HandleOpenWrappedItemCallback(uint16 pos, ObjectGuid itemGuid, PreparedQueryResult result)
void HandleCancelMountAuraOpcode(WorldPackets::Spells::CancelMountAura &cancelMountAura)
void HandleTotemDestroyed(WorldPackets::Totem::TotemDestroyed &totemDestroyed)
void HandleCancelGrowthAuraOpcode(WorldPackets::Spells::CancelGrowthAura &cancelGrowthAura)
void HandleSetEmpowerMinHoldStagePercent(WorldPackets::Spells::SetEmpowerMinHoldStagePercent const &setEmpowerMinHoldStagePercent)
void HandleCancelCastOpcode(WorldPackets::Spells::CancelCast &packet)
void HandlePetCancelAuraOpcode(WorldPackets::Spells::PetCancelAura &packet)
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API AreaTrigger * GetAreaTrigger(WorldObject const &u, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreatureOrPetOrVehicle(WorldObject const &, ObjectGuid const &)
auto MapEqualRange(M &map, typename M::key_type const &key)
uint32 GetId() const
uint32 MinMoneyLoot
uint32 MaxMoneyLoot
bool HasFlag(ItemFlags flag) const
uint32 MaxDurability
uint32 GetLockID() const
Definition Loot.h:286
uint8 unlootedCount
Definition Loot.h:291
void generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
Definition Loot.cpp:845
uint32 gold
Definition Loot.h:290
bool FillLoot(uint32 lootId, LootStore const &store, Player *lootOwner, bool personal, bool noEmptyError=false, uint16 lootMode=LOOT_MODE_DEFAULT, ItemContext context=ItemContext::NONE)
Definition Loot.cpp:859
Optional< MovementInfo > MoveUpdate