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 "Common.h"
20#include "Config.h"
21#include "DatabaseEnv.h"
22#include "Log.h"
23#include "DBCStores.h"
24#include "GameClient.h"
25#include "GameObject.h"
26#include "GameObjectAI.h"
27#include "GameObjectPackets.h"
28#include "Item.h"
29#include "MovementPackets.h"
30#include "ObjectAccessor.h"
31#include "ObjectMgr.h"
32#include "Opcodes.h"
33#include "Player.h"
34#include "ScriptMgr.h"
35#include "Spell.h"
36#include "SpellAuraEffects.h"
37#include "SpellMgr.h"
38#include "SpellPackets.h"
39#include "Totem.h"
40#include "TotemPackets.h"
41#include "World.h"
42#include "WorldPacket.h"
43
45{
46 // some spell cast packet including more data (for projectiles?)
47 if (castFlags & 0x02)
48 {
49 // not sure about these two
50 float elevation, speed;
51 recvPacket >> elevation;
52 recvPacket >> speed;
53
54 targets.SetPitch(elevation);
55 targets.SetSpeed(speed);
56
57 uint8 hasMovementData;
58 recvPacket >> hasMovementData;
59 if (hasMovementData)
60 {
61 OpcodeClient opcode = static_cast<OpcodeClient>(recvPacket.read<uint32>());
62 MovementInfo movementInfo;
63 recvPacket >> movementInfo.guid.ReadAsPacked();
64 recvPacket >> movementInfo;
65 HandleMovementOpcode(opcode, movementInfo);
66 }
67 }
68}
69
71{
73 Player* pUser = _player;
74
75 uint8 bagIndex, slot, castFlags;
76 uint8 castCount; // next cast if exists (single or not)
77 ObjectGuid itemGUID;
78 uint32 glyphIndex; // something to do with glyphs?
79 uint32 spellId; // cast spell id
80
81 recvPacket >> bagIndex >> slot >> castCount >> spellId >> itemGUID >> glyphIndex >> castFlags;
82
83 if (glyphIndex >= MAX_GLYPH_SLOT_INDEX)
84 {
85 pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
86 return;
87 }
88
89 Item* pItem = pUser->GetUseableItemByPos(bagIndex, slot);
90 if (!pItem)
91 {
92 pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
93 return;
94 }
95
96 if (pItem->GetGUID() != itemGUID)
97 {
98 pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
99 return;
100 }
101
102 TC_LOG_DEBUG("network", "WORLD: CMSG_USE_ITEM packet, bagIndex: {}, slot: {}, castCount: {}, spellId: {}, Item: {}, glyphIndex: {}, data length = {}", bagIndex, slot, castCount, spellId, pItem->GetEntry(), glyphIndex, (uint32)recvPacket.size());
103
104 ItemTemplate const* proto = pItem->GetTemplate();
105 if (!proto)
106 {
107 pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, nullptr);
108 return;
109 }
110
111 // some item classes can be used only in equipped state
112 if (proto->GetInventoryType() != INVTYPE_NON_EQUIP && !pItem->IsEquipped())
113 {
114 pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, nullptr);
115 return;
116 }
117
118 InventoryResult msg = pUser->CanUseItem(pItem);
119 if (msg != EQUIP_ERR_OK)
120 {
121 pUser->SendEquipError(msg, pItem, nullptr);
122 return;
123 }
124
125 // only allow conjured consumable, bandage, poisons (all should have the 2^21 item flag set in DB)
127 {
128 pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, nullptr);
129 return;
130 }
131
132 // don't allow items banned in arena
133 if (proto->HasFlag(ITEM_FLAG_NOT_USEABLE_IN_ARENA) && pUser->InArena())
134 {
135 pUser->SendEquipError(EQUIP_ERR_NOT_DURING_ARENA_MATCH, pItem, nullptr);
136 return;
137 }
138
139 if (pUser->IsInCombat())
140 {
141 for (ItemEffect const& effectData : proto->Effects)
142 {
143 if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(effectData.SpellID))
144 {
145 if (!spellInfo->CanBeUsedInCombat())
146 {
147 pUser->SendEquipError(EQUIP_ERR_NOT_IN_COMBAT, pItem, nullptr);
148 return;
149 }
150 }
151 }
152 }
153
154 // check also BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory)
156 {
157 if (!pItem->IsSoulBound())
158 {
159 pItem->SetState(ITEM_CHANGED, pUser);
160 pItem->SetBinding(true);
161 }
162 }
163
164 SpellCastTargets targets;
165 targets.Read(recvPacket, pUser);
166 HandleClientCastFlags(recvPacket, castFlags, targets);
167
168 // Note: If script stop casting it must send appropriate data to client to prevent stuck item in gray state.
169 if (!sScriptMgr->OnItemUse(pUser, pItem, targets))
170 {
171 // no script or script not process request by self
172 pUser->CastItemUseSpell(pItem, spellId, targets, castCount, glyphIndex);
173 }
174}
175
177{
178 TC_LOG_DEBUG("network", "WORLD: CMSG_OPEN_ITEM packet, data length = {}", (uint32)recvPacket.size());
179
180 Player* player = GetPlayer();
181
182 // ignore for remote control state
183 if (player->IsCharmed())
184 return;
185
186 // additional check, client outputs message on its own
187 if (!player->IsAlive())
188 {
189 player->SendEquipError(EQUIP_ERR_PLAYER_DEAD, nullptr, nullptr);
190 return;
191 }
192
193 uint8 bagIndex, slot;
194 recvPacket >> bagIndex >> slot;
195
196 TC_LOG_INFO("network", "bagIndex: {}, slot: {}", bagIndex, slot);
197
198 Item* item = player->GetItemByPos(bagIndex, slot);
199 if (!item)
200 {
201 player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
202 return;
203 }
204
205 ItemTemplate const* proto = item->GetTemplate();
206 if (!proto)
207 {
208 player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, item, nullptr);
209 return;
210 }
211
212 // Verify that the bag is an actual bag or wrapped item that can be used "normally"
213 if (!proto->HasFlag(ITEM_FLAG_HAS_LOOT) && !item->IsWrapped())
214 {
215 player->SendEquipError(EQUIP_ERR_CLIENT_LOCKED_OUT, item, nullptr);
216 TC_LOG_ERROR("entities.player.cheat", "Possible hacking attempt: Player {} {} tried to open item [{}, entry: {}] which is not openable!",
217 player->GetName(), player->GetGUID().ToString(), item->GetGUID().ToString(), proto->GetId());
218 return;
219 }
220
221 // locked item
222 uint32 lockId = proto->GetLockID();
223 if (lockId)
224 {
225 LockEntry const* lockInfo = sLockStore.LookupEntry(lockId);
226
227 if (!lockInfo)
228 {
229 player->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, nullptr);
230 TC_LOG_ERROR("network", "WORLD::OpenItem: item {} has an unknown lockId: {}!", item->GetGUID().ToString(), lockId);
231 return;
232 }
233
234 // was not unlocked yet
235 if (item->IsLocked())
236 {
237 player->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, nullptr);
238 return;
239 }
240 }
241
242 if (item->IsWrapped())
243 {
245 stmt->setUInt32(0, item->GetGUID().GetCounter());
247 .WithPreparedCallback(std::bind(&WorldSession::HandleOpenWrappedItemCallback, this, item->GetPos(), item->GetGUID(), std::placeholders::_1)));
248 }
249 else
250 player->SendLoot(item->GetGUID(), LOOT_CORPSE);
251}
252
254{
255 if (!GetPlayer())
256 return;
257
258 Item* item = GetPlayer()->GetItemByPos(pos);
259 if (!item)
260 return;
261
262 if (item->GetGUID() != itemGuid || !item->IsWrapped()) // during getting result, gift was swapped with another item
263 return;
264
265 if (!result)
266 {
267 TC_LOG_ERROR("network", "Wrapped item {} does't have record in character_gifts table and will deleted", itemGuid.ToString());
268 GetPlayer()->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
269 return;
270 }
271
272 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
273
274 Field* fields = result->Fetch();
275 uint32 entry = fields[0].GetUInt32();
276 uint32 flags = fields[1].GetUInt32();
277
279 item->SetEntry(entry);
283
285
287 stmt->setUInt32(0, itemGuid.GetCounter());
288 trans->Append(stmt);
289
290 CharacterDatabase.CommitTransaction(trans);
291}
292
294{
295 if (GameObject* obj = GetPlayer()->GetGameObjectIfCanInteractWith(packet.Guid))
296 {
297 // ignore for remote control state
298 if (GetPlayer()->IsCharmed())
299 if (!(GetPlayer()->IsOnVehicle(GetPlayer()->GetCharmed()) || GetPlayer()->IsMounted()) && !obj->GetGOInfo()->IsUsableMounted())
300 return;
301
302 obj->Use(GetPlayer());
303 }
304}
305
307{
308 // ignore for remote control state
309 if (_player->IsCharmed())
310 return;
311
312 if (GameObject* go = GetPlayer()->GetGameObjectIfCanInteractWith(packet.Guid))
313 {
314 if (go->AI()->OnReportUse(_player))
315 return;
316
318 }
319}
320
322{
323 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(castRequest.Cast.SpellID);
324 if (!spellInfo)
325 {
326 TC_LOG_ERROR("network", "WorldSession::HandleCastSpellOpcode: attempted to cast a non-existing spell (Id: {})", castRequest.Cast.SpellID);
327 return;
328 }
329
330 if (spellInfo->IsPassive())
331 return;
332
333 TriggerCastFlags triggerFlag = TRIGGERED_NONE;
334
335 // client provided targets
336 SpellCastTargets targets(_player, castRequest.Cast);
337
338 // not have spell in spellbook
339 if (!_player->HasActiveSpell(spellInfo->Id))
340 {
341 bool allow = false;
342
343 // allow casting of unknown spells for special lock cases
344 if (GameObject* go = targets.GetGOTarget())
345 if (go->GetSpellForLock(_player) == spellInfo)
346 allow = true;
347
348 // allow casting of spells triggered by clientside periodic trigger auras
350 {
351 allow = true;
352 triggerFlag = TRIGGERED_FULL_MASK;
353 }
354
355 if (!allow)
356 return;
357 }
358
359 // Client is resending autoshot cast opcode when other spell is cast during shoot rotation
360 // Skip it to prevent "interrupt" message
361 // Also check targets! target may have changed and we need to interrupt current spell
362 if (spellInfo->IsAutoRepeatRangedSpell())
364 if (spell->m_spellInfo == spellInfo && spell->m_targets.GetUnitTargetGUID() == targets.GetUnitTargetGUID())
365 return;
366
367 // auto-selection buff level base at target level (in spellInfo)
368 // TODO: is this even necessary? client already seems to send correct rank for "standard" buffs
369 if (spellInfo->IsPositive())
370 if (Unit* target = targets.GetUnitTarget())
371 {
372 SpellInfo const* actualSpellInfo = spellInfo->GetAuraRankForLevel(target->GetLevel());
373
374 // if rank not found then function return NULL but in explicit cast case original spell can be cast and later failed with appropriate error message
375 if (actualSpellInfo)
376 spellInfo = actualSpellInfo;
377 }
378
379 if (castRequest.Cast.MissileTrajectory && castRequest.Cast.MissileTrajectory->MoveUpdate)
380 HandleMovementOpcode(MSG_MOVE_STOP, *castRequest.Cast.MissileTrajectory->MoveUpdate);
381
382 Spell* spell = new Spell(_player, spellInfo, triggerFlag);
383 spell->m_fromClient = true;
384 spell->m_cast_count = castRequest.Cast.CastID;
385 spell->prepare(targets);
386}
387
389{
390 if (_player->IsCharmed())
391 return;
392
393 if (_player->IsNonMeleeSpellCast(false))
394 _player->InterruptNonMeleeSpells(false, cancelCast.SpellID, false);
395}
396
398{
399 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cancelAura.SpellID);
400 if (!spellInfo)
401 return;
402
403 // not allow remove spells with attr SPELL_ATTR0_CANT_CANCEL
405 return;
406
407 // channeled spell case (it currently cast then)
408 if (spellInfo->IsChanneled())
409 {
411 if (curSpell->GetSpellInfo()->Id == cancelAura.SpellID)
413 return;
414 }
415
416 // non channeled case:
417 // don't allow remove non positive spells
418 // don't allow cancelling passive auras (some of them are visible)
419 if (!spellInfo->IsPositive() || spellInfo->IsPassive())
420 return;
421
423
424 // If spell being removed is a resource tracker, see if player was tracking both (herbs / minerals) and remove the other
426 {
428 if (!auraEffects.empty())
429 {
430 // Build list of spell IDs to cancel. Trying to cancel the aura while iterating
431 // over AuraEffectList caused "incompatible iterator" errors on second pass
432 std::list<uint32> spellIDs;
433
434 for (Unit::AuraEffectList::const_iterator auraEffect = auraEffects.begin(); auraEffect != auraEffects.end(); ++auraEffect)
435 spellIDs.push_back((*auraEffect)->GetId());
436
437 // Remove all auras related to resource tracking (only Herbs and Minerals in 3.3.5a)
438 for (std::list<uint32>::iterator it = spellIDs.begin(); it != spellIDs.end(); ++it)
440 }
441 }
442}
443
445{
446 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(packet.SpellID);
447 if (!spellInfo)
448 {
449 TC_LOG_ERROR("network", "WORLD: unknown PET spell id {}", packet.SpellID);
450 return;
451 }
452
454
455 if (!pet)
456 {
457 TC_LOG_ERROR("network", "HandlePetCancelAura: Attempt to cancel an aura for non-existant {} by player '{}'", packet.PetGUID.ToString(), GetPlayer()->GetName());
458 return;
459 }
460
461 if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharmed())
462 {
463 TC_LOG_ERROR("network", "HandlePetCancelAura: {} is not a pet of player '{}'", packet.PetGUID.ToString(), GetPlayer()->GetName());
464 return;
465 }
466
467 if (!pet->IsAlive())
468 {
470 return;
471 }
472
474}
475
477{
479 {
480 SpellInfo const* spellInfo = aurApp->GetBase()->GetSpellInfo();
481 return !spellInfo->HasAttribute(SPELL_ATTR0_CANT_CANCEL) && spellInfo->IsPositive() && !spellInfo->IsPassive();
482 });
483}
484
486{
488 {
489 SpellInfo const* spellInfo = aurApp->GetBase()->GetSpellInfo();
490 return !spellInfo->HasAttribute(SPELL_ATTR0_CANT_CANCEL) && spellInfo->IsPositive() && !spellInfo->IsPassive();
491 });
492}
493
495{
496 // may be better send SMSG_CANCEL_AUTO_REPEAT?
497 // cancel and prepare for deleting
499}
500
502{
504
505 // ignore for remote control state (for player case)
506 if (!mover)
507 return;
508
509 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cancelChanneling.ChannelSpell);
510 if (!spellInfo)
511 return;
512
513 // not allow remove spells with attr SPELL_ATTR0_CANT_CANCEL
515 return;
516
518 if (!spell || spell->GetSpellInfo()->Id != spellInfo->Id)
519 return;
520
522}
523
525{
526 // ignore for remote control state
527 if (_player->IsCharmed())
528 return;
529
530 uint8 slotId = totemDestroyed.Slot;
531 slotId += SUMMON_SLOT_TOTEM_FIRE;
532
533 if (slotId >= MAX_TOTEM_SLOT)
534 return;
535
536 if (!_player->m_SummonSlot[slotId])
537 return;
538
540 if (totem && totem->IsTotem())
541 totem->ToTotem()->UnSummon();
542}
543
545{
546 TC_LOG_DEBUG("network", "WORLD: CMSG_SELF_RES"); // empty opcode
547
548 if (SpellInfo const* spell = sSpellMgr->GetSpellInfo(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)))
549 {
551 return; // silent return, client should display error by itself and not send this opcode
552
553 _player->CastSpell(_player, spell->Id);
555 }
556}
557
559{
560 ObjectGuid guid;
561 recvData >> guid;
562
563 // this will get something not in world. crash
565
566 if (!unit)
567 return;
568
570 if (!unit->IsInWorld())
571 return;
572
574}
575
577{
578 ObjectGuid guid;
579 recvData >> guid;
580
581 // Get unit for which data is needed by client
582 Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
583 if (!unit)
584 return;
585
587 return;
588
589 // Get creator of the unit (SPELL_AURA_CLONE_CASTER does not stack)
590 Unit* creator = unit->GetAuraEffectsByType(SPELL_AURA_CLONE_CASTER).front()->GetCaster();
591 if (!creator)
592 return;
593
595 data << guid;
596 data << uint32(creator->GetDisplayId());
597 data << uint8(creator->GetRace());
598 data << uint8(creator->GetGender());
599 data << uint8(creator->GetClass());
600
601 if (Player* player = creator->ToPlayer())
602 {
603 data << uint8(player->GetSkinId());
604 data << uint8(player->GetFaceId());
605 data << uint8(player->GetHairStyleId());
606 data << uint8(player->GetHairColorId());
607 data << uint8(player->GetFacialStyle());
608 data << uint32(player->GetGuildId());
609
610 static EquipmentSlots const itemSlots[] =
611 {
624 };
625
626 // Display items in visible slots
627 for (EquipmentSlots const* itr = &itemSlots[0]; *itr != EQUIPMENT_SLOT_END; ++itr)
628 {
629 if (*itr == EQUIPMENT_SLOT_HEAD && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_HELM))
630 data << uint32(0);
631 else if (*itr == EQUIPMENT_SLOT_BACK && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK))
632 data << uint32(0);
633 else if (Item const* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, *itr))
634 data << uint32(item->GetDisplayId());
635 else
636 data << uint32(0);
637 }
638 }
639 else
640 {
641 // Skip player data for creatures
642 data << uint8(0);
643 data << uint32(0);
644 data << uint32(0);
645 data << uint32(0);
646 data << uint32(0);
647 data << uint32(0);
648 data << uint32(0);
649 data << uint32(0);
650 data << uint32(0);
651 data << uint32(0);
652 data << uint32(0);
653 data << uint32(0);
654 data << uint32(0);
655 data << uint32(0);
656 }
657
658 SendPacket(&data);
659}
660
662{
663 TC_LOG_DEBUG("network", "WORLD: CMSG_UPDATE_PROJECTILE_POSITION");
664
665 ObjectGuid casterGuid;
666 uint32 spellId;
667 uint8 castCount;
668 float x, y, z; // Position of missile hit
669
670 recvPacket >> casterGuid;
671 recvPacket >> spellId;
672 recvPacket >> castCount;
673 recvPacket >> x;
674 recvPacket >> y;
675 recvPacket >> z;
676
677 Unit* caster = ObjectAccessor::GetUnit(*_player, casterGuid);
678 if (!caster)
679 return;
680
681 Spell* spell = caster->FindCurrentSpellBySpellId(spellId);
682 if (!spell || !spell->m_targets.HasDst())
683 return;
684
685 Position pos = *spell->m_targets.GetDstPos();
686 pos.Relocate(x, y, z);
687 spell->m_targets.ModDst(pos);
688
689 // we changed dest, recalculate flight time
691
693 data << casterGuid;
694 data << uint8(castCount);
695 data << float(x);
696 data << float(y);
697 data << float(z);
698 caster->SendMessageToSet(&data, true);
699}
@ CHAR_DEL_GIFT
@ CHAR_SEL_CHARACTER_GIFT_BY_ITEM
@ ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT
Definition DBCEnums.h:192
DBCStorage< LockEntry > sLockStore(LockEntryfmt)
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
std::shared_ptr< PreparedResultSet > PreparedQueryResult
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
uint8_t uint8
Definition Define.h:135
uint16_t uint16
Definition Define.h:134
uint32_t uint32
Definition Define.h:133
uint16 flags
InventoryResult
Definition ItemDefines.h:25
@ EQUIP_ERR_NOT_DURING_ARENA_MATCH
@ EQUIP_ERR_PLAYER_DEAD
Definition ItemDefines.h:64
@ EQUIP_ERR_CLIENT_LOCKED_OUT
Definition ItemDefines.h:65
@ EQUIP_ERR_NOT_IN_COMBAT
Definition ItemDefines.h:86
@ EQUIP_ERR_ITEM_LOCKED
Definition ItemDefines.h:62
@ EQUIP_ERR_ITEM_NOT_FOUND
Definition ItemDefines.h:49
@ EQUIP_ERR_OK
Definition ItemDefines.h:26
@ ITEM_CLASS_CONSUMABLE
ItemFieldFlags
@ ITEM_FLAG_IGNORE_DEFAULT_ARENA_RESTRICTIONS
@ ITEM_FLAG_HAS_LOOT
@ ITEM_FLAG_NOT_USEABLE_IN_ARENA
@ BIND_WHEN_USE
@ BIND_QUEST_ITEM
@ BIND_WHEN_PICKED_UP
@ INVTYPE_NON_EQUIP
@ ITEM_CHANGED
Definition Item.h:54
#define TC_LOG_DEBUG(filterType__,...)
Definition Log.h:156
#define TC_LOG_ERROR(filterType__,...)
Definition Log.h:165
#define TC_LOG_INFO(filterType__,...)
Definition Log.h:159
@ LOOT_CORPSE
Definition Loot.h:92
EquipmentSlots
Definition Player.h:558
@ EQUIPMENT_SLOT_SHOULDERS
Definition Player.h:562
@ EQUIPMENT_SLOT_BODY
Definition Player.h:563
@ EQUIPMENT_SLOT_HANDS
Definition Player.h:569
@ EQUIPMENT_SLOT_TABARD
Definition Player.h:578
@ EQUIPMENT_SLOT_END
Definition Player.h:579
@ EQUIPMENT_SLOT_HEAD
Definition Player.h:560
@ EQUIPMENT_SLOT_LEGS
Definition Player.h:566
@ EQUIPMENT_SLOT_BACK
Definition Player.h:574
@ EQUIPMENT_SLOT_WAIST
Definition Player.h:565
@ EQUIPMENT_SLOT_FEET
Definition Player.h:567
@ EQUIPMENT_SLOT_CHEST
Definition Player.h:564
@ EQUIPMENT_SLOT_WRISTS
Definition Player.h:568
@ PLAYER_FLAGS_HIDE_CLOAK
Definition Player.h:357
@ PLAYER_FLAGS_HIDE_HELM
Definition Player.h:356
#define INVENTORY_SLOT_BAG_0
Definition Player.h:555
#define sScriptMgr
Definition ScriptMgr.h:1168
@ SPELL_ATTR7_BYPASS_NO_RESURRECT_AURA
#define MAX_GLYPH_SLOT_INDEX
@ SPELL_ATTR0_CANT_CANCEL
#define MAX_TOTEM_SLOT
@ SUMMON_SLOT_TOTEM_FIRE
@ AURA_REMOVE_BY_CANCEL
@ SPELL_AURA_PREVENT_RESURRECTION
@ SPELL_AURA_CLONE_CASTER
@ SPELL_AURA_TRACK_RESOURCES
@ SPELL_AURA_MOUNTED
@ SPELL_AURA_MOD_SCALE
@ SPELL_AURA_PERIODIC_TRIGGER_SPELL_FROM_CLIENT
TriggerCastFlags
@ TRIGGERED_FULL_MASK
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
@ TRIGGERED_NONE
#define sSpellMgr
Definition SpellMgr.h:738
@ CURRENT_CHANNELED_SPELL
Definition Unit.h:622
@ CURRENT_AUTOREPEAT_SPELL
Definition Unit.h:623
@ PLAYER_FLAGS
@ PLAYER_SELF_RES_SPELL
Aura * GetBase() const
Definition SpellAuras.h:75
size_t size() const
Definition ByteBuffer.h:413
Class used to access individual fields of database query result.
Definition Field.h:92
uint32 GetUInt32() const
Definition Field.cpp:61
Unit * GetActivelyMovedUnit() const
Definition GameClient.h:37
Definition Item.h:62
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition Item.cpp:644
uint8 GetSlot() const
Definition Item.h:143
bool IsWrapped() const
Definition Item.h:115
void ReplaceAllItemFlags(ItemFieldFlags flags)
Definition Item.h:94
void SetBinding(bool val)
Definition Item.h:90
bool IsLocked() const
Definition Item.h:116
ItemTemplate const * GetTemplate() const
Definition Item.cpp:541
bool IsSoulBound() const
Definition Item.h:96
bool IsEquipped() const
Definition Item.cpp:722
uint16 GetPos() const
Definition Item.h:147
void SetMaxDurability(uint32 maxDurability)
Definition Item.h:122
uint8 GetBagSlot() const
Definition Item.cpp:717
void SetGiftCreator(ObjectGuid guid)
Definition Item.h:85
LowType GetCounter() const
Definition ObjectGuid.h:156
static ObjectGuid const Empty
Definition ObjectGuid.h:140
std::string ToString() const
PackedGuidReader ReadAsPacked()
Definition ObjectGuid.h:146
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:241
bool IsInWorld() const
Definition Object.h:73
uint32 GetEntry() const
Definition Object.h:81
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:78
void SetEntry(uint32 entry)
Definition Object.h:82
void SetUInt32Value(uint16 index, uint32 value)
Definition Object.cpp:577
static Player * ToPlayer(Object *o)
Definition Object.h:183
void SendEquipError(InventoryResult msg, Item const *item1=nullptr, Item const *item2=nullptr, uint32 itemId=0) const
Definition Player.cpp:13070
Item * GetUseableItemByPos(uint8 bag, uint8 slot) const
Definition Player.cpp:9567
void SaveInventoryAndGoldToDB(CharacterDatabaseTransaction trans)
Definition Player.cpp:19316
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, WorldObject *ref=nullptr)
Definition Player.cpp:24914
bool HasActiveSpell(uint32 spell) const
Definition Player.cpp:3894
Item * GetItemByPos(uint16 pos) const
Definition Player.cpp:9550
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition Player.cpp:12111
void SendLoot(ObjectGuid guid, LootType loot_type)
Definition Player.cpp:8084
void CastItemUseSpell(Item *item, uint32 spellId, SpellCastTargets const &targets, uint8 cast_count, uint32 misc)
Definition Player.cpp:7826
bool InArena() const
Definition Player.cpp:23123
InventoryResult CanUseItem(Item *pItem, bool not_loading=true) const
Definition Player.cpp:11368
void setUInt32(uint8 index, uint32 value)
void SetPitch(float pitch)
ObjectGuid GetUnitTargetGUID() const
Definition Spell.cpp:265
void ModDst(Position const &pos)
Definition Spell.cpp:458
GameObject * GetGOTarget() const
Definition Spell.cpp:299
void SetSpeed(float speed)
void Read(ByteBuffer &data, Unit *caster)
Definition Spell.cpp:171
bool HasDst() const
Definition Spell.cpp:480
Unit * GetUnitTarget() const
Definition Spell.cpp:273
WorldLocation const * GetDstPos() const
Definition Spell.cpp:423
bool IsPassive() const
uint32 Id
Definition SpellInfo.h:289
SpellInfo const * GetAuraRankForLevel(uint8 level) const
bool IsChanneled() const
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:375
bool IsPositive() const
bool IsAutoRepeatRangedSpell() const
bool HasAura(AuraType aura) const
Definition Spell.h:152
SpellInfo const * GetSpellInfo() const
Definition Spell.h:459
bool m_fromClient
Definition Spell.h:401
SpellCastTargets m_targets
Definition Spell.h:409
uint8 m_cast_count
Definition Spell.h:400
SpellCastResult prepare(SpellCastTargets const &targets, AuraEffect const *triggeredByAura=nullptr)
Definition Spell.cpp:3091
void RecalculateDelayMomentForDst()
Definition Spell.cpp:957
void UnSummon(uint32 msTime=0) override
Definition Totem.cpp:103
Definition Unit.h:783
bool IsCharmed() const
Definition Unit.h:1293
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3584
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3788
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1397
uint8 GetClass() const
Definition Unit.h:909
void HandleSpellClick(Unit *clicker, int8 seatId=-1)
Definition Unit.cpp:12449
Spell * FindCurrentSpellBySpellId(uint32 spell_id) const
Definition Unit.cpp:3131
Totem * ToTotem()
Definition Unit.h:1807
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3116
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition Unit.cpp:3086
bool IsAlive() const
Definition Unit.h:1247
Gender GetGender() const
Definition Unit.h:912
uint32 GetDisplayId() const
Definition Unit.h:1598
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, SpellCastResult result=SPELL_FAILED_INTERRUPTED, Optional< SpellCastResult > resultOther={})
Definition Unit.cpp:3044
bool HasAuraType(AuraType auraType) const
Definition Unit.cpp:4565
bool HasAuraTypeWithTriggerSpell(AuraType auratype, uint32 triggerSpell) const
Definition Unit.cpp:4605
std::list< AuraEffect * > AuraEffectList
Definition Unit.h:801
bool IsTotem() const
Definition Unit.h:900
void SendPetActionFeedback(PetActionFeedback msg, uint32 spellId) const
-------—Pet responses methods--------------—
Definition Unit.cpp:10233
ObjectGuid m_SummonSlot[MAX_SUMMON_SLOT]
Definition Unit.h:1500
uint8 GetRace() const
Definition Unit.h:906
bool IsInCombat() const
Definition Unit.h:1158
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1489
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition Object.cpp:1784
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2833
std::string const & GetName() const
Definition Object.h:384
void HandleMovementOpcode(OpcodeClient opcode, MovementInfo &movementInfo)
void HandleCancelChanneling(WorldPackets::Spells::CancelChannelling &cancelChanneling)
void SendPacket(WorldPacket const *packet)
Send a packet to the client.
void HandleOpenItemOpcode(WorldPacket &recvPacket)
QueryCallbackProcessor _queryProcessor
void HandleGameObjectUseOpcode(WorldPackets::GameObject::GameObjUse &packet)
void HandleUpdateProjectilePosition(WorldPacket &recvPacket)
Player * GetPlayer() const
void HandleSelfResOpcode(WorldPacket &recvData)
void HandleMirrorImageDataRequest(WorldPacket &recvData)
void HandleCastSpellOpcode(WorldPackets::Spells::CastSpell &castRequest)
Player * _player
void HandleCancelAutoRepeatSpellOpcode(WorldPackets::Spells::CancelAutoRepeatSpell &cancelAutoRepeatSpell)
void HandleCancelAuraOpcode(WorldPackets::Spells::CancelAura &cancelAura)
void HandleGameobjectReportUse(WorldPackets::GameObject::GameObjReportUse &packet)
void HandleOpenWrappedItemCallback(uint16 pos, ObjectGuid itemGuid, PreparedQueryResult result)
void HandleCancelMountAuraOpcode(WorldPackets::Spells::CancelMountAura &cancelMountAura)
void HandleTotemDestroyed(WorldPackets::Totem::TotemDestroyed &totemDestroyed)
void HandleUseItemOpcode(WorldPacket &recvPacket)
void HandleClientCastFlags(WorldPacket &recvPacket, uint8 castFlags, SpellCastTargets &targets)
GameClient * GetGameClient() const
void HandleSpellClick(WorldPacket &recvData)
void HandleCancelGrowthAuraOpcode(WorldPackets::Spells::CancelGrowthAura &cancelGrowthAura)
void HandleCancelCastOpcode(WorldPackets::Spells::CancelCast &cancelCast)
void HandlePetCancelAuraOpcode(WorldPackets::Spells::PetCancelAura &packet)
Opcodes
Definition Opcodes.h:29
@ SMSG_SET_PROJECTILE_POSITION
Definition Opcodes.h:1244
@ SMSG_MIRRORIMAGE_DATA
Definition Opcodes.h:1055
@ MSG_MOVE_STOP
Definition Opcodes.h:212
#define sWorld
Definition World.h:901
@ CONFIG_ALLOW_TRACK_BOTH_RESOURCES
Definition World.h:162
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 &)
std::array< ItemEffect, MAX_ITEM_PROTO_SPELLS > Effects
uint32 GetId() const
ItemBondingType GetBonding() const
bool HasFlag(ItemFlags flag) const
::InventoryType GetInventoryType() const
uint32 MaxDurability
uint32 GetLockID() const
uint32 GetClass() const
ObjectGuid guid
void Relocate(float x, float y)
Definition Position.h:66
Optional< MissileTrajectoryRequest > MissileTrajectory