TrinityCore
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 "CollectionMgr.h"
20#include "Common.h"
21#include "DatabaseEnv.h"
22#include "DB2Stores.h"
23#include "GameObjectAI.h"
24#include "GameObjectPackets.h"
25#include "Guild.h"
26#include "GuildMgr.h"
27#include "Item.h"
28#include "Log.h"
29#include "Loot.h"
30#include "LootItemStorage.h"
31#include "LootMgr.h"
32#include "Map.h"
33#include "Player.h"
34#include "ObjectAccessor.h"
35#include "ObjectMgr.h"
36#include "ScriptMgr.h"
37#include "Spell.h"
38#include "SpellAuraEffects.h"
39#include "SpellCastRequest.h"
40#include "SpellMgr.h"
41#include "SpellPackets.h"
42#include "TemporarySummon.h"
43#include "TotemPackets.h"
44#include "World.h"
45
47{
48 // ignore for remote control state
50 return;
51
52 // Skip casting invalid spells right away
53 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(packet.Cast.SpellID, _player->GetMap()->GetDifficultyID());
54 if (!spellInfo)
55 {
56 TC_LOG_ERROR("network", "WorldSession::HandleUseItemOpcode: attempted to cast a non-existing spell (Id: {})", packet.Cast.SpellID);
57 return;
58 }
59
60 if (_player->CanRequestSpellCast(spellInfo, _player))
61 _player->RequestSpellCast(std::make_unique<SpellCastRequest>(std::move(packet.Cast), _player->GetGUID(), SpellCastRequestItemData(packet.PackSlot, packet.Slot, packet.CastItem)));
62 else
64}
65
67{
68 Player* player = GetPlayer();
69
70 // ignore for remote control state
71 if (player->GetUnitBeingMoved() != player)
72 return;
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()->GetUnitBeingMoved() != GetPlayer())
206 if (!(GetPlayer()->IsOnVehicle(GetPlayer()->GetUnitBeingMoved()) || GetPlayer()->IsMounted()) && !obj->GetGOInfo()->IsUsableMounted())
207 return;
208
209 obj->Use(GetPlayer());
210 }
211}
212
214{
215 // ignore for remote control state
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(cast.Cast.SpellID, _player->GetMap()->GetDifficultyID());
232 if (!spellInfo)
233 {
234 TC_LOG_ERROR("network", "WorldSession::HandleCastSpellOpcode: attempted to cast a non-existing spell (Id: {})", cast.Cast.SpellID);
235 return;
236 }
237
238 // ignore for remote control state (for player case)
239 Unit* mover = _player->GetUnitBeingMoved();
240 if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER)
241 return;
242
243 Unit* castingUnit = mover;
244 if (castingUnit->IsCreature() && !castingUnit->ToCreature()->HasSpell(spellInfo->Id))
245 {
246 // If the vehicle creature does not have the spell but it allows the passenger to cast own spells
247 // change caster to player and let him cast
248 if (!_player->IsOnVehicle(castingUnit) || spellInfo->CheckVehicle(_player) != SPELL_CAST_OK)
249 return;
250
251 castingUnit = _player;
252 }
253
254 if (cast.Cast.MoveUpdate.has_value())
256
257 if (_player->CanRequestSpellCast(spellInfo, castingUnit))
258 _player->RequestSpellCast(std::make_unique<SpellCastRequest>(std::move(cast.Cast), castingUnit->GetGUID()));
259 else
261}
262
264{
265 if (_player->IsNonMeleeSpellCast(false))
266 {
267 _player->InterruptNonMeleeSpells(false, packet.SpellID, false);
268 _player->CancelPendingCastRequest(); // canceling casts also cancels pending spell cast requests
269 }
270}
271
273{
274 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cancelAura.SpellID, _player->GetMap()->GetDifficultyID());
275 if (!spellInfo)
276 return;
277
278 // not allow remove spells with attr SPELL_ATTR0_CANT_CANCEL
280 return;
281
282 // channeled spell case (it currently cast then)
283 if (spellInfo->IsChanneled())
284 {
286 if (curSpell->GetSpellInfo()->Id == uint32(cancelAura.SpellID))
288 return;
289 }
290
291 // non channeled case:
292 // don't allow remove non positive spells
293 // don't allow cancelling passive auras (some of them are visible)
294 if (!spellInfo->IsPositive() || spellInfo->IsPassive())
295 return;
296
298}
299
301{
302 if (!sSpellMgr->GetSpellInfo(packet.SpellID, DIFFICULTY_NONE))
303 {
304 TC_LOG_ERROR("network", "WORLD: unknown PET spell id {}", packet.SpellID);
305 return;
306 }
307
309
310 if (!pet)
311 {
312 TC_LOG_ERROR("network", "HandlePetCancelAura: Attempt to cancel an aura for non-existant {} by player '{}'", packet.PetGUID.ToString(), GetPlayer()->GetName());
313 return;
314 }
315
316 if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharmed())
317 {
318 TC_LOG_ERROR("network", "HandlePetCancelAura: {} is not a pet of player '{}'", packet.PetGUID.ToString(), GetPlayer()->GetName());
319 return;
320 }
321
322 if (!pet->IsAlive())
323 {
325 return;
326 }
327
329}
330
332{
334 {
335 SpellInfo const* spellInfo = aurApp->GetBase()->GetSpellInfo();
336 return !spellInfo->HasAttribute(SPELL_ATTR0_NO_AURA_CANCEL) && spellInfo->IsPositive() && !spellInfo->IsPassive();
337 });
338}
339
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
350{
351 Unit* mover = _player->GetUnitBeingMoved();
352 if (!mover || mover->GetGUID() != cancelModSpeedNoControlAuras.TargetGUID)
353 return;
354
356 {
357 SpellInfo const* spellInfo = aurApp->GetBase()->GetSpellInfo();
358 return !spellInfo->HasAttribute(SPELL_ATTR0_NO_AURA_CANCEL) && spellInfo->IsPositive() && !spellInfo->IsPassive();
359 });
360}
361
363{
364 // may be better send SMSG_CANCEL_AUTO_REPEAT?
365 // cancel and prepare for deleting
367}
368
370{
372}
373
375{
376 // ignore for remote control state (for player case)
377 Unit* mover = _player->GetUnitBeingMoved();
378 if (mover != _player && mover->GetTypeId() == TYPEID_PLAYER)
379 return;
380
381 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cancelChanneling.ChannelSpell, mover->GetMap()->GetDifficultyID());
382 if (!spellInfo)
383 return;
384
385 // not allow remove spells with attr SPELL_ATTR0_CANT_CANCEL
387 return;
388
390 if (!spell || spell->GetSpellInfo()->Id != spellInfo->Id)
391 return;
392
394}
395
397{
398 // ignore for remote control state
400 return;
401
402 uint8 slotId = totemDestroyed.Slot;
403 slotId += SUMMON_SLOT_TOTEM;
404
405 if (slotId >= MAX_TOTEM_SLOT)
406 return;
407
408 if (!_player->m_SummonSlot[slotId])
409 return;
410
412 if (totem && totem->IsTotem() && (totemDestroyed.TotemGUID.IsEmpty() || totem->GetGUID() == totemDestroyed.TotemGUID))
413 totem->DespawnOrUnsummon();
414}
415
417{
418 if (_player->m_activePlayerData->SelfResSpells.FindIndex(selfRes.SpellID) < 0)
419 return;
420
421 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(selfRes.SpellID, _player->GetMap()->GetDifficultyID());
422 if (!spellInfo)
423 return;
424
426 return; // silent return, client should display error by itself and not send this opcode
427
430}
431
433{
434 // this will get something not in world. crash
436
437 if (!unit)
438 return;
439
441 if (!unit->IsInWorld())
442 return;
443
445}
446
448{
449 ObjectGuid guid = getMirrorImageData.UnitGUID;
450
451 // Get unit for which data is needed by client
452 Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
453 if (!unit)
454 return;
455
457 return;
458
459 // Get creator of the unit (SPELL_AURA_CLONE_CASTER does not stack)
460 Unit* creator = unit->GetAuraEffectsByType(SPELL_AURA_CLONE_CASTER).front()->GetCaster();
461 if (!creator)
462 return;
463
464 if (Player* player = creator->ToPlayer())
465 {
466 WorldPackets::Spells::MirrorImageComponentedData mirrorImageComponentedData;
467 mirrorImageComponentedData.UnitGUID = guid;
468 mirrorImageComponentedData.DisplayID = creator->GetDisplayId();
469 mirrorImageComponentedData.RaceID = creator->GetRace();
470 mirrorImageComponentedData.Gender = creator->GetGender();
471 mirrorImageComponentedData.ClassID = creator->GetClass();
472
473 for (UF::ChrCustomizationChoice const& customization : player->m_playerData->Customizations)
474 mirrorImageComponentedData.Customizations.push_back(customization);
475
476 Guild* guild = player->GetGuild();
477 mirrorImageComponentedData.GuildGUID = (guild ? guild->GetGUID() : ObjectGuid::Empty);
478
479 mirrorImageComponentedData.ItemDisplayID.reserve(11);
480
481 static EquipmentSlots const itemSlots[] =
482 {
494 };
495
496 // Display items in visible slots
497 for (EquipmentSlots slot : itemSlots)
498 {
499 uint32 itemDisplayId;
500 if (Item const* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
501 itemDisplayId = item->GetDisplayId(player);
502 else
503 itemDisplayId = 0;
504
505 mirrorImageComponentedData.ItemDisplayID.push_back(itemDisplayId);
506 }
507 SendPacket(mirrorImageComponentedData.Write());
508 }
509 else
510 {
511 WorldPackets::Spells::MirrorImageCreatureData mirrorImageCreatureData;
512 mirrorImageCreatureData.UnitGUID = guid;
513 mirrorImageCreatureData.DisplayID = creator->GetDisplayId();
514 SendPacket(mirrorImageCreatureData.Write());
515 }
516}
517
519{
520 Unit* caster = ObjectAccessor::GetUnit(*_player, packet.Target);
521 if (!caster)
522 return;
523
524 Spell* spell = caster->FindCurrentSpellBySpellId(packet.SpellID);
525 if (!spell || !spell->m_targets.HasDst())
526 return;
527
528 Position pos = *spell->m_targets.GetDstPos();
529 pos.Relocate(packet.CollisionPos);
530 spell->m_targets.ModDst(pos);
531
532 // we changed dest, recalculate flight time
534
536 notify.Caster = packet.Target;
537 notify.CastID = packet.CastID;
538 notify.CollisionPos = packet.CollisionPos;
539 caster->SendMessageToSet(notify.Write(), true);
540}
541
543{
544 Unit* caster = ObjectAccessor::GetUnit(*_player, packet.Guid);
545 Spell* spell = caster ? caster->GetCurrentSpell(CURRENT_GENERIC_SPELL) : nullptr;
546 if (!spell || spell->m_spellInfo->Id != uint32(packet.SpellID) || spell->m_castId != packet.CastID || !spell->m_targets.HasDst() || !spell->m_targets.HasSrc())
547 return;
548
549 spell->m_targets.ModSrc(packet.FirePos);
550 spell->m_targets.ModDst(packet.ImpactPos);
551 spell->m_targets.SetPitch(packet.Pitch);
552 spell->m_targets.SetSpeed(packet.Speed);
553
554 if (packet.Status)
556}
557
559{
560 Player* player = GetPlayer();
562 return;
563
564 SpellKeyboundOverrideEntry const* spellKeyboundOverride = sSpellKeyboundOverrideStore.LookupEntry(keyboundOverride.OverrideID);
565 if (!spellKeyboundOverride)
566 return;
567
568 player->CastSpell(player, spellKeyboundOverride->Data);
569}
@ CHAR_DEL_GIFT
@ CHAR_SEL_CHARACTER_GIFT_BY_ITEM
DB2Storage< LockEntry > sLockStore("Lock.db2", &LockLoadInfo::Instance)
DB2Storage< SpellKeyboundOverrideEntry > sSpellKeyboundOverrideStore("SpellKeyboundOverride.db2", &SpellKeyboundOverrideLoadInfo::Instance)
@ DIFFICULTY_NONE
Definition: DBCEnums.h:874
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint8_t uint8
Definition: Define.h:144
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
uint16 flags
Definition: DisableMgr.cpp:49
@ 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
Definition: ItemTemplate.h:130
@ ITEM_FLAG_HAS_LOOT
Definition: ItemTemplate.h:178
@ ITEM_CHANGED
Definition: Item.h:55
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:165
#define TC_LOG_INFO(filterType__,...)
Definition: Log.h:159
#define sLootItemStorage
LootStore LootTemplates_Item("item_loot_template", "item entry", true)
@ LOOT_ITEM
Definition: Loot.h:105
@ LOOT_ERROR_NO_LOOT
Definition: Loot.h:151
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
EquipmentSlots
Definition: Player.h:629
@ EQUIPMENT_SLOT_SHOULDERS
Definition: Player.h:633
@ EQUIPMENT_SLOT_BODY
Definition: Player.h:634
@ EQUIPMENT_SLOT_HANDS
Definition: Player.h:640
@ EQUIPMENT_SLOT_TABARD
Definition: Player.h:649
@ EQUIPMENT_SLOT_HEAD
Definition: Player.h:631
@ EQUIPMENT_SLOT_LEGS
Definition: Player.h:637
@ EQUIPMENT_SLOT_BACK
Definition: Player.h:645
@ EQUIPMENT_SLOT_WAIST
Definition: Player.h:636
@ EQUIPMENT_SLOT_FEET
Definition: Player.h:638
@ EQUIPMENT_SLOT_CHEST
Definition: Player.h:635
@ EQUIPMENT_SLOT_WRISTS
Definition: Player.h:639
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:625
@ 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:849
@ CURRENT_CHANNELED_SPELL
Definition: Unit.h:591
@ CURRENT_GENERIC_SPELL
Definition: Unit.h:590
@ CURRENT_AUTOREPEAT_SPELL
Definition: Unit.h:592
Aura * GetBase() const
Definition: SpellAuras.h:78
bool HasSpell(uint32 spellID) const override
Definition: Creature.cpp:2863
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
Class used to access individual fields of database query result.
Definition: Field.h:90
uint32 GetUInt32() const
Definition: Field.cpp:62
Definition: Guild.h:329
ObjectGuid GetGUID() const
Definition: Guild.h:753
Definition: Item.h:170
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition: Item.cpp:1166
uint8 GetSlot() const
Definition: Item.h:280
bool IsWrapped() const
Definition: Item.h:250
void ReplaceAllItemFlags(ItemFieldFlags flags)
Definition: Item.h:211
bool IsLocked() const
Definition: Item.h:251
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1141
uint16 GetPos() const
Definition: Item.h:284
void SetMaxDurability(uint32 maxDurability)
Definition: Item.h:259
std::unique_ptr< Loot > m_loot
Definition: Item.h:317
bool m_lootGenerated
Definition: Item.h:318
uint8 GetBagSlot() const
Definition: Item.cpp:1239
void SetGiftCreator(ObjectGuid guid)
Definition: Item.h:195
Difficulty GetDifficultyID() const
Definition: Map.h:324
LowType GetCounter() const
Definition: ObjectGuid.h:293
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
bool IsEmpty() const
Definition: ObjectGuid.h:319
std::string ToString() const
Definition: ObjectGuid.cpp:554
static Creature * ToCreature(Object *o)
Definition: Object.h:219
bool IsInWorld() const
Definition: Object.h:154
TypeID GetTypeId() const
Definition: Object.h:173
uint32 GetEntry() const
Definition: Object.h:161
bool IsCreature() const
Definition: Object.h:218
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
void SetEntry(uint32 entry)
Definition: Object.h:162
static Player * ToPlayer(Object *o)
Definition: Object.h:213
void SendLootError(ObjectGuid const &lootObj, ObjectGuid const &owner, LootError error) const
Definition: Player.cpp:9148
void SendEquipError(InventoryResult msg, Item const *item1=nullptr, Item const *item2=nullptr, uint32 itemId=0) const
Definition: Player.cpp:13254
void SaveInventoryAndGoldToDB(CharacterDatabaseTransaction trans)
Definition: Player.cpp:20364
Item * GetItemByPos(uint16 pos) const
Definition: Player.cpp:9582
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition: Player.cpp:12180
void SendLoot(Loot &loot, bool aeLooting=false)
Definition: Player.cpp:9119
void UpdateCriteria(CriteriaType type, uint64 miscValue1=0, uint64 miscValue2=0, uint64 miscValue3=0, WorldObject *ref=nullptr)
Definition: Player.cpp:26767
bool CanRequestSpellCast(SpellInfo const *spell, Unit const *castingUnit) const
Definition: Player.cpp:30255
void RequestSpellCast(std::unique_ptr< SpellCastRequest > castRequest)
Definition: Player.cpp:30224
UF::UpdateField< UF::ActivePlayerData, 0, TYPEID_ACTIVE_PLAYER > m_activePlayerData
Definition: Player.h:2864
void CancelPendingCastRequest()
Definition: Player.cpp:30237
void RemoveSelfResSpell(int32 spellId)
Definition: Player.h:2812
void setUInt64(const uint8 index, const uint64 value)
void SetPitch(float pitch)
Definition: SpellDefines.h:390
void ModDst(Position const &pos)
Definition: Spell.cpp:403
bool HasSrc() const
Definition: Spell.cpp:420
void SetSpeed(float speed)
Definition: SpellDefines.h:392
bool HasDst() const
Definition: Spell.cpp:425
void ModSrc(Position const &pos)
Definition: Spell.cpp:352
WorldLocation const * GetDstPos() const
Definition: Spell.cpp:368
uint32 const Id
Definition: SpellInfo.h:325
bool IsPassive() const
Definition: SpellInfo.cpp:1592
bool IsChanneled() const
Definition: SpellInfo.cpp:1719
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
SpellCastResult CheckVehicle(Unit const *caster) const
Definition: SpellInfo.cpp:2395
bool IsPositive() const
Definition: SpellInfo.cpp:1709
Definition: Spell.h:255
SpellInfo const * GetSpellInfo() const
Definition: Spell.h:650
SpellCastTargets m_targets
Definition: Spell.h:607
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:4643
void RecalculateDelayMomentForDst()
Definition: Spell.cpp:874
ObjectGuid m_castId
Definition: Spell.h:568
SpellInfo const *const m_spellInfo
Definition: Spell.h:563
Definition: Unit.h:627
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3608
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3812
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1321
bool HasAuraTypeWithMiscvalue(AuraType auraType, int32 miscValue) const
Definition: Unit.cpp:4687
uint8 GetClass() const
Definition: Unit.h:752
std::array< ObjectGuid, MAX_SUMMON_SLOT > m_SummonSlot
Definition: Unit.h:1460
void HandleSpellClick(Unit *clicker, int8 seatId=-1)
Definition: Unit.cpp:12027
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
Definition: Unit.cpp:3104
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:3089
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:3059
bool IsAlive() const
Definition: Unit.h:1164
bool IsOnVehicle(Unit const *vehicle) const
Definition: Unit.cpp:11475
Gender GetGender() const
Definition: Unit.h:755
uint32 GetDisplayId() const
Definition: Unit.h:1567
Unit * GetUnitBeingMoved() const
Definition: Unit.h:1230
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:4674
void SendPetActionFeedback(PetActionFeedback msg, uint32 spellId)
-------—Pet responses methods--------------—
Definition: Unit.cpp:10001
bool IsTotem() const
Definition: Unit.h:742
uint8 GetRace() const
Definition: Unit.h:749
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true)
Definition: Unit.cpp:3017
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition: Unit.h:1442
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.cpp:1744
Map * GetMap() const
Definition: Object.h:624
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
std::string const & GetName() const
Definition: Object.h:555
std::vector< UF::ChrCustomizationChoice > Customizations
Definition: SpellPackets.h:893
WorldPacket const * Write() override
TaggedPosition< Position::XYZ > CollisionPos
Definition: SpellPackets.h:952
TaggedPosition< Position::XYZ > ImpactPos
Definition: SpellPackets.h:981
TaggedPosition< Position::XYZ > FirePos
Definition: SpellPackets.h:980
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 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 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 HandleCancelCastOpcode(WorldPackets::Spells::CancelCast &packet)
void HandlePetCancelAuraOpcode(WorldPackets::Spells::PetCancelAura &packet)
@ CMSG_MOVE_STOP
Definition: Opcodes.h:579
TC_GAME_API bool GetName(uint32 accountId, std::string &name)
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
TC_GAME_API Creature * GetCreatureOrPetOrVehicle(WorldObject const &, ObjectGuid const &)
uint32 GetId() const
Definition: ItemTemplate.h:776
uint32 MinMoneyLoot
Definition: ItemTemplate.h:833
uint32 MaxMoneyLoot
Definition: ItemTemplate.h:834
bool HasFlag(ItemFlags flag) const
Definition: ItemTemplate.h:871
uint32 MaxDurability
Definition: ItemTemplate.h:827
uint32 GetLockID() const
Definition: ItemTemplate.h:810
Definition: Loot.h:281
uint8 unlootedCount
Definition: Loot.h:286
void generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
Definition: Loot.cpp:745
uint32 gold
Definition: Loot.h:285
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:759
constexpr void Relocate(float x, float y)
Definition: Position.h:63
Optional< MovementInfo > MoveUpdate
Definition: SpellPackets.h:248