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 // ignore for remote control state
53 return;
54
55 // Skip casting invalid spells right away
56 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(packet.Cast.SpellID, _player->GetMap()->GetDifficultyID());
57 if (!spellInfo)
58 {
59 TC_LOG_ERROR("network", "WorldSession::HandleUseItemOpcode: attempted to cast a non-existing spell (Id: {})", packet.Cast.SpellID);
60 return;
61 }
62
63 if (_player->CanRequestSpellCast(spellInfo, _player))
64 _player->RequestSpellCast(std::make_unique<SpellCastRequest>(std::move(packet.Cast), _player->GetGUID(), SpellCastRequestItemData(packet.PackSlot, packet.Slot, packet.CastItem)));
65 else
67}
68
70{
71 Player* player = GetPlayer();
72
73 // ignore for remote control state
74 if (player->GetUnitBeingMoved() != player)
75 return;
76 TC_LOG_INFO("network", "bagIndex: {}, slot: {}", packet.Slot, packet.PackSlot);
77
78 // additional check, client outputs message on its own
79 if (!player->IsAlive())
80 {
81 player->SendEquipError(EQUIP_ERR_PLAYER_DEAD, nullptr, nullptr);
82 return;
83 }
84
85 Item* item = player->GetItemByPos(packet.Slot, packet.PackSlot);
86 if (!item)
87 {
88 player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
89 return;
90 }
91
92 ItemTemplate const* proto = item->GetTemplate();
93 if (!proto)
94 {
95 player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, nullptr);
96 return;
97 }
98
99 // Verify that the bag is an actual bag or wrapped item that can be used "normally"
100 if (!proto->HasFlag(ITEM_FLAG_HAS_LOOT) && !item->IsWrapped())
101 {
102 player->SendEquipError(EQUIP_ERR_CLIENT_LOCKED_OUT, item, nullptr);
103 TC_LOG_ERROR("entities.player.cheat", "Possible hacking attempt: Player {} {} tried to open item [{}, entry: {}] which is not openable!",
104 player->GetName(), player->GetGUID().ToString(), item->GetGUID().ToString(), proto->GetId());
105 return;
106 }
107
108 // locked item
109 uint32 lockId = proto->GetLockID();
110 if (lockId)
111 {
112 LockEntry const* lockInfo = sLockStore.LookupEntry(lockId);
113
114 if (!lockInfo)
115 {
116 player->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, nullptr);
117 TC_LOG_ERROR("network", "WORLD::OpenItem: item {} has an unknown lockId: {}!", item->GetGUID().ToString(), lockId);
118 return;
119 }
120
121 // was not unlocked yet
122 if (item->IsLocked())
123 {
124 player->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, nullptr);
125 return;
126 }
127 }
128
129 if (item->IsWrapped())
130 {
132 stmt->setUInt64(0, item->GetGUID().GetCounter());
134 .WithPreparedCallback([this, pos = item->GetPos(), itemGuid = item->GetGUID()](PreparedQueryResult result)
135 {
136 HandleOpenWrappedItemCallback(pos, itemGuid, std::move(result));
137 }));
138 }
139 else
140 {
141 // If item doesn't already have loot, attempt to load it. If that
142 // fails then this is first time opening, generate loot
143 if (!item->m_lootGenerated && !sLootItemStorage->LoadStoredLoot(item, player))
144 {
145 Loot* loot = new Loot(player->GetMap(), item->GetGUID(), LOOT_ITEM, nullptr);
146 item->m_loot.reset(loot);
147 item->m_lootGenerated = true;
149 loot->FillLoot(item->GetEntry(), LootTemplates_Item, player, true, loot->gold != 0);
150
151 // Force save the loot and money items that were just rolled
152 // Also saves the container item ID in Loot struct (not to DB)
153 if (loot->gold > 0 || loot->unlootedCount > 0)
154 sLootItemStorage->AddNewStoredLoot(item->GetGUID().GetCounter(), loot, player);
155 }
156 if (item->m_loot)
157 player->SendLoot(*item->m_loot);
158 else
160 }
161}
162
164{
165 if (!GetPlayer())
166 return;
167
168 Item* item = GetPlayer()->GetItemByPos(pos);
169 if (!item)
170 return;
171
172 if (item->GetGUID() != itemGuid || !item->IsWrapped()) // during getting result, gift was swapped with another item
173 return;
174
175 if (!result)
176 {
177 TC_LOG_ERROR("network", "Wrapped item {} does't have record in character_gifts table and will deleted", item->GetGUID().ToString());
178 GetPlayer()->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
179 return;
180 }
181
182 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
183
184 Field* fields = result->Fetch();
185 uint32 entry = fields[0].GetUInt32();
186 uint32 flags = fields[1].GetUInt32();
187
189 item->SetEntry(entry);
193
195
197 stmt->setUInt64(0, itemGuid.GetCounter());
198 trans->Append(stmt);
199
200 CharacterDatabase.CommitTransaction(trans);
201}
202
204{
205 if (GameObject* obj = GetPlayer()->GetGameObjectIfCanInteractWith(packet.Guid))
206 {
207 // ignore for remote control state
208 if (GetPlayer()->GetUnitBeingMoved() != GetPlayer())
209 if (!(GetPlayer()->IsOnVehicle(GetPlayer()->GetUnitBeingMoved()) || GetPlayer()->IsMounted()) && !obj->GetGOInfo()->IsUsableMounted())
210 return;
211
212 obj->Use(GetPlayer());
213 }
214}
215
217{
218 // ignore for remote control state
220 return;
221
222 if (GameObject* go = GetPlayer()->GetGameObjectIfCanInteractWith(packet.Guid))
223 {
224 if (go->AI()->OnReportUse(_player))
225 return;
226
228 }
229}
230
232{
233 // Skip casting invalid spells right away
234 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cast.Cast.SpellID, _player->GetMap()->GetDifficultyID());
235 if (!spellInfo)
236 {
237 TC_LOG_ERROR("network", "WorldSession::HandleCastSpellOpcode: attempted to cast a non-existing spell (Id: {})", cast.Cast.SpellID);
238 return;
239 }
240
241 // ignore for remote control state (for player case)
242 Unit* mover = _player->GetUnitBeingMoved();
243 if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER)
244 return;
245
246 Unit* castingUnit = mover;
247 if (castingUnit->IsCreature() && !castingUnit->ToCreature()->HasSpell(spellInfo->Id))
248 {
249 // If the vehicle creature does not have the spell but it allows the passenger to cast own spells
250 // change caster to player and let him cast
251 if (!_player->IsOnVehicle(castingUnit) || spellInfo->CheckVehicle(_player) != SPELL_CAST_OK)
252 return;
253
254 castingUnit = _player;
255 }
256
257 if (cast.Cast.MoveUpdate.has_value())
259
260 if (_player->CanRequestSpellCast(spellInfo, castingUnit))
261 _player->RequestSpellCast(std::make_unique<SpellCastRequest>(std::move(cast.Cast), castingUnit->GetGUID()));
262 else
264}
265
267{
268 if (_player->IsNonMeleeSpellCast(false))
269 {
270 _player->InterruptNonMeleeSpells(false, packet.SpellID, false);
271 _player->CancelPendingCastRequest(); // canceling casts also cancels pending spell cast requests
272 }
273}
274
276{
277 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cancelAura.SpellID, _player->GetMap()->GetDifficultyID());
278 if (!spellInfo)
279 return;
280
281 // not allow remove spells with attr SPELL_ATTR0_CANT_CANCEL
283 return;
284
285 // channeled spell case (it currently cast then)
286 if (spellInfo->IsChanneled())
287 {
289 if (curSpell->GetSpellInfo()->Id == uint32(cancelAura.SpellID))
291 return;
292 }
293
294 // non channeled case:
295 // don't allow remove non positive spells
296 // don't allow cancelling passive auras (some of them are visible)
297 if (!spellInfo->IsPositive() || spellInfo->IsPassive())
298 return;
299
301}
302
304{
305 if (!sSpellMgr->GetSpellInfo(packet.SpellID, DIFFICULTY_NONE))
306 {
307 TC_LOG_ERROR("network", "WORLD: unknown PET spell id {}", packet.SpellID);
308 return;
309 }
310
312
313 if (!pet)
314 {
315 TC_LOG_ERROR("network", "HandlePetCancelAura: Attempt to cancel an aura for non-existant {} by player '{}'", packet.PetGUID.ToString(), GetPlayer()->GetName());
316 return;
317 }
318
319 if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharmed())
320 {
321 TC_LOG_ERROR("network", "HandlePetCancelAura: {} is not a pet of player '{}'", packet.PetGUID.ToString(), GetPlayer()->GetName());
322 return;
323 }
324
325 if (!pet->IsAlive())
326 {
328 return;
329 }
330
332}
333
335{
337 {
338 SpellInfo const* spellInfo = aurApp->GetBase()->GetSpellInfo();
339 return !spellInfo->HasAttribute(SPELL_ATTR0_NO_AURA_CANCEL) && spellInfo->IsPositive() && !spellInfo->IsPassive();
340 });
341}
342
344{
346 {
347 SpellInfo const* spellInfo = aurApp->GetBase()->GetSpellInfo();
348 return !spellInfo->HasAttribute(SPELL_ATTR0_NO_AURA_CANCEL) && spellInfo->IsPositive() && !spellInfo->IsPassive();
349 });
350}
351
353{
354 Unit* mover = _player->GetUnitBeingMoved();
355 if (!mover || mover->GetGUID() != cancelModSpeedNoControlAuras.TargetGUID)
356 return;
357
359 {
360 SpellInfo const* spellInfo = aurApp->GetBase()->GetSpellInfo();
361 return !spellInfo->HasAttribute(SPELL_ATTR0_NO_AURA_CANCEL) && spellInfo->IsPositive() && !spellInfo->IsPassive();
362 });
363}
364
366{
367 // may be better send SMSG_CANCEL_AUTO_REPEAT?
368 // cancel and prepare for deleting
370}
371
376
378{
379 // ignore for remote control state (for player case)
380 Unit* mover = _player->GetUnitBeingMoved();
381 if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER)
382 return;
383
384 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cancelChanneling.ChannelSpell, mover->GetMap()->GetDifficultyID());
385 if (!spellInfo)
386 return;
387
388 // not allow remove spells with attr SPELL_ATTR0_CANT_CANCEL
390 return;
391
393 if (!spell || spell->GetSpellInfo()->Id != spellInfo->Id)
394 return;
395
397}
398
403
405{
406 // ignore for remote control state (for player case)
407 Unit* mover = _player->GetUnitBeingMoved();
408 if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER)
409 return;
410
412 if (!spell || spell->GetSpellInfo()->Id != uint32(spellEmpowerRelease.SpellID) || !spell->IsEmpowerSpell())
413 return;
414
415 spell->SetEmpowerReleasedByClient(true);
416}
417
419{
420 // ignore for remote control state (for player case)
421 Unit* mover = _player->GetUnitBeingMoved();
422 if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER)
423 return;
424
426 if (!spell || spell->GetSpellInfo()->Id != uint32(spellEmpowerRestart.SpellID) || !spell->IsEmpowerSpell())
427 return;
428
429 spell->SetEmpowerReleasedByClient(false);
430}
431
433{
434 // ignore for remote control state
436 return;
437
438 uint8 slotId = totemDestroyed.Slot;
439 slotId += SUMMON_SLOT_TOTEM;
440
441 if (slotId >= MAX_TOTEM_SLOT)
442 return;
443
444 if (!_player->m_SummonSlot[slotId])
445 return;
446
448 if (totem && totem->IsTotem() && (totemDestroyed.TotemGUID.IsEmpty() || totem->GetGUID() == totemDestroyed.TotemGUID))
449 totem->DespawnOrUnsummon();
450}
451
453{
454 if (_player->m_activePlayerData->SelfResSpells.FindIndex(selfRes.SpellID) < 0)
455 return;
456
457 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(selfRes.SpellID, _player->GetMap()->GetDifficultyID());
458 if (!spellInfo)
459 return;
460
462 return; // silent return, client should display error by itself and not send this opcode
463
466}
467
469{
470 // this will get something not in world. crash
472
473 if (!unit)
474 return;
475
477 if (!unit->IsInWorld())
478 return;
479
481}
482
484{
485 ObjectGuid guid = getMirrorImageData.UnitGUID;
486
487 // Get unit for which data is needed by client
488 Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
489 if (!unit)
490 return;
491
493 return;
494
495 // Get creator of the unit (SPELL_AURA_CLONE_CASTER does not stack)
496 Unit* creator = unit->GetAuraEffectsByType(SPELL_AURA_CLONE_CASTER).front()->GetCaster();
497 if (!creator)
498 return;
499
500 if (Player* player = creator->ToPlayer())
501 {
502 WorldPackets::Spells::MirrorImageComponentedData mirrorImageComponentedData;
503 mirrorImageComponentedData.UnitGUID = guid;
504 if (ChrModelEntry const* chrModel = sDB2Manager.GetChrModel(creator->GetRace(), creator->GetGender()))
505 mirrorImageComponentedData.ChrModelID = chrModel->ID;
506 mirrorImageComponentedData.RaceID = creator->GetRace();
507 mirrorImageComponentedData.Gender = creator->GetGender();
508 mirrorImageComponentedData.ClassID = creator->GetClass();
509
510 for (UF::ChrCustomizationChoice const& customization : player->m_playerData->Customizations)
511 mirrorImageComponentedData.Customizations.push_back(customization);
512
513 Guild* guild = player->GetGuild();
514 mirrorImageComponentedData.GuildGUID = (guild ? guild->GetGUID() : ObjectGuid::Empty);
515
516 mirrorImageComponentedData.ItemDisplayID.reserve(11);
517
518 static constexpr EquipmentSlots itemSlots[] =
519 {
531 };
532
533 // Display items in visible slots
534 for (EquipmentSlots slot : itemSlots)
535 {
536 uint32 itemDisplayId;
537 if (Item const* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
538 itemDisplayId = item->GetDisplayId(player);
539 else
540 itemDisplayId = 0;
541
542 mirrorImageComponentedData.ItemDisplayID.push_back(itemDisplayId);
543 }
544 SendPacket(mirrorImageComponentedData.Write());
545 }
546 else
547 {
548 WorldPackets::Spells::MirrorImageCreatureData mirrorImageCreatureData;
549 mirrorImageCreatureData.UnitGUID = guid;
550 mirrorImageCreatureData.DisplayID = creator->GetDisplayId();
551 SendPacket(mirrorImageCreatureData.Write());
552 }
553}
554
556{
557 Unit* caster = ObjectAccessor::GetUnit(*_player, packet.Target);
558 if (!caster)
559 return;
560
561 Spell* spell = caster->FindCurrentSpellBySpellId(packet.SpellID);
562 if (!spell || !spell->m_targets.HasDst())
563 return;
564
565 spell->m_targets.ModDst(packet.CollisionPos);
566
567 // we changed dest, recalculate flight time
569
571 notify.Caster = packet.Target;
572 notify.CastID = packet.CastID;
573 notify.CollisionPos = packet.CollisionPos;
574 caster->SendMessageToSet(notify.Write(), true);
575}
576
578{
579 Unit* caster = ObjectAccessor::GetUnit(*_player, packet.Guid);
580 Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_GENERIC_SPELL) : nullptr;
581 if (!spell || spell->m_spellInfo->Id != uint32(packet.SpellID) || spell->m_castId != packet.CastID || !spell->m_targets.HasDst() || !spell->m_targets.HasSrc())
582 return;
583
584 spell->m_targets.ModSrc(packet.FirePos);
585 spell->m_targets.ModDst(packet.ImpactPos);
586 spell->m_targets.SetPitch(packet.Pitch);
587 spell->m_targets.SetSpeed(packet.Speed);
588
589 if (packet.Status)
591}
592
594{
595 Unit* target = ObjectAccessor::GetUnit(*_player, updateAuraVisual.TargetGUID);
596 if (!target)
597 return;
598
599 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(updateAuraVisual.SpellID, _player->GetMap()->GetDifficultyID());
600 if (!spellInfo)
601 return;
602
603 uint32 spellXspellVisualId = _player->GetCastSpellXSpellVisualId(spellInfo);
604 for (auto const& [_, auraApp] : Trinity::Containers::MapEqualRange(target->GetAppliedAuras(), spellInfo->Id))
605 if (auraApp->GetBase()->GetCasterGUID() == _player->GetGUID())
606 auraApp->GetBase()->SetSpellVisual({ .SpellXSpellVisualID = spellXspellVisualId });
607
608 if (_player->GetChannelSpellId() == spellInfo->Id)
609 _player->SetChannelVisual({ .SpellXSpellVisualID = spellXspellVisualId });
610}
611
613{
614 AreaTrigger* target = ObjectAccessor::GetAreaTrigger(*_player, updateAreaTriggerVisual.TargetGUID);
615 if (!target)
616 return;
617
618 if (target->GetCasterGuid() != _player->GetGUID())
619 return;
620
621 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(target->m_areaTriggerData->SpellForVisuals, _player->GetMap()->GetDifficultyID());
622 if (!spellInfo)
623 return;
624
625 target->SetSpellVisual({ .SpellXSpellVisualID = _player->GetCastSpellXSpellVisualId(spellInfo) });
626}
627
629{
630 Player* player = GetPlayer();
632 return;
633
634 SpellKeyboundOverrideEntry const* spellKeyboundOverride = sSpellKeyboundOverrideStore.LookupEntry(keyboundOverride.OverrideID);
635 if (!spellKeyboundOverride)
636 return;
637
638 player->CastSpell(player, spellKeyboundOverride->Data);
639}
@ 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:569
@ DIFFICULTY_NONE
Definition DBCEnums.h:933
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:190
#define TC_LOG_INFO(filterType__, message__,...)
Definition Log.h:184
#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
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
@ CMSG_MOVE_STOP
Definition Opcodes.h:674
EquipmentSlots
Definition Player.h:727
@ EQUIPMENT_SLOT_SHOULDERS
Definition Player.h:731
@ EQUIPMENT_SLOT_BODY
Definition Player.h:732
@ EQUIPMENT_SLOT_HANDS
Definition Player.h:738
@ EQUIPMENT_SLOT_TABARD
Definition Player.h:747
@ EQUIPMENT_SLOT_HEAD
Definition Player.h:729
@ EQUIPMENT_SLOT_LEGS
Definition Player.h:735
@ EQUIPMENT_SLOT_BACK
Definition Player.h:743
@ EQUIPMENT_SLOT_WAIST
Definition Player.h:734
@ EQUIPMENT_SLOT_FEET
Definition Player.h:736
@ EQUIPMENT_SLOT_CHEST
Definition Player.h:733
@ EQUIPMENT_SLOT_WRISTS
Definition Player.h:737
#define INVENTORY_SLOT_BAG_0
Definition Player.h:723
@ SPELL_ATTR7_BYPASS_NO_RESURRECT_AURA
@ SUMMON_SLOT_TOTEM
@ SPELL_ATTR0_NO_AURA_CANCEL
#define MAX_TOTEM_SLOT
@ SPELL_CAST_OK
@ 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:599
@ CURRENT_GENERIC_SPELL
Definition Unit.h:598
@ CURRENT_AUTOREPEAT_SPELL
Definition Unit.h:600
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
bool IsCreature() const
Definition BaseEntity.h:172
TypeID GetTypeId() const
Definition BaseEntity.h:166
bool HasSpell(uint32 spellID) const override
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:179
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition Item.cpp:1258
uint8 GetSlot() const
Definition Item.h:290
bool IsWrapped() const
Definition Item.h:260
void ReplaceAllItemFlags(ItemFieldFlags flags)
Definition Item.h:220
bool IsLocked() const
Definition Item.h:261
ItemTemplate const * GetTemplate() const
Definition Item.cpp:1233
uint16 GetPos() const
Definition Item.h:294
void SetMaxDurability(uint32 maxDurability)
Definition Item.h:269
std::unique_ptr< Loot > m_loot
Definition Item.h:328
bool m_lootGenerated
Definition Item.h:329
uint8 GetBagSlot() const
Definition Item.cpp:1331
void SetGiftCreator(ObjectGuid guid)
Definition Item.h:204
Difficulty GetDifficultyID() const
Definition Map.h:360
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
Creature * ToCreature()
Definition Object.h:121
void SetEntry(uint32 entry)
Definition Object.h:90
void SendLootError(ObjectGuid const &lootObj, ObjectGuid const &owner, LootError error) const
Definition Player.cpp:9196
void SendEquipError(InventoryResult msg, Item const *item1=nullptr, Item const *item2=nullptr, uint32 itemId=0) const
Definition Player.cpp:13130
UF::UpdateField< UF::ActivePlayerData, int32(WowCS::EntityFragment::CGObject), TYPEID_ACTIVE_PLAYER > m_activePlayerData
Definition Player.h:3062
void SaveInventoryAndGoldToDB(CharacterDatabaseTransaction trans)
Definition Player.cpp:20843
Item * GetItemByPos(uint16 pos) const
Definition Player.cpp:9630
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
bool CanRequestSpellCast(SpellInfo const *spell, Unit const *castingUnit) const
Definition Player.cpp:31604
void SetEmpowerMinHoldStagePercent(float empowerMinHoldStagePercent)
Definition Player.h:2088
void RequestSpellCast(std::unique_ptr< SpellCastRequest > castRequest)
Definition Player.cpp:31573
void CancelPendingCastRequest()
Definition Player.cpp:31586
void RemoveSelfResSpell(int32 spellId)
Definition Player.h:2987
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
SpellCastResult CheckVehicle(Unit const *caster) const
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
static void SendCastResult(Player *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:4699
void SetEmpowerReleasedByClient(bool release)
Definition Spell.cpp:8390
void RecalculateDelayMomentForDst()
Definition Spell.cpp:856
ObjectGuid m_castId
Definition Spell.h:604
SpellInfo const *const m_spellInfo
Definition Spell.h:599
Definition Unit.h:635
uint32 GetChannelSpellId() const
Definition Unit.h:1423
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3751
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3955
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1342
uint32 GetCastSpellXSpellVisualId(SpellInfo const *spellInfo) const override
Definition Unit.cpp:14509
bool HasAuraTypeWithMiscvalue(AuraType auraType, int32 miscValue) const
Definition Unit.cpp:4827
uint8 GetClass() const
Definition Unit.h:764
std::array< ObjectGuid, MAX_SUMMON_SLOT > m_SummonSlot
Definition Unit.h:1501
void HandleSpellClick(Unit *clicker, int8 seatId=-1)
Definition Unit.cpp:12636
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
Definition Unit.cpp:3246
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3231
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition Unit.cpp:3201
bool IsAlive() const
Definition Unit.h:1185
void SetChannelVisual(SpellCastVisual channelVisual)
Definition Unit.h:1433
bool IsOnVehicle(Unit const *vehicle) const
Definition Unit.cpp:12106
Gender GetGender() const
Definition Unit.h:767
uint32 GetDisplayId() const
Definition Unit.h:1610
Unit * GetUnitBeingMoved() const
Definition Unit.h:1251
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:4814
void SendPetActionFeedback(PetActionFeedback msg, uint32 spellId)
-------—Pet responses methods--------------—
Definition Unit.cpp:10632
AuraApplicationMap & GetAppliedAuras()
Definition Unit.h:1295
bool IsTotem() const
Definition Unit.h:753
uint8 GetRace() const
Definition Unit.h:761
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true)
Definition Unit.cpp:3159
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1466
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition Object.cpp:1094
Map * GetMap() const
Definition Object.h:411
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2217
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