TrinityCore
SpellEffects.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 "Spell.h"
19#include "AccountMgr.h"
20#include "AreaTrigger.h"
22#include "AzeriteItem.h"
23#include "Battleground.h"
24#include "BattlegroundMgr.h"
25#include "BattlePetMgr.h"
26#include "CellImpl.h"
27#include "CharmInfo.h"
28#include "CombatLogPackets.h"
29#include "CombatPackets.h"
30#include "Common.h"
31#include "Conversation.h"
32#include "Creature.h"
33#include "CreatureAI.h"
34#include "CreatureTextMgr.h"
35#include "DatabaseEnv.h"
36#include "DB2Stores.h"
37#include "DuelPackets.h"
38#include "DynamicObject.h"
39#include "GameEventSender.h"
40#include "GameObject.h"
41#include "GameObjectAI.h"
42#include "GameTime.h"
43#include "Garrison.h"
44#include "GossipDef.h"
45#include "GridNotifiers.h"
46#include "GridNotifiersImpl.h"
47#include "Group.h"
48#include "Guild.h"
49#include "InstanceScript.h"
50#include "Item.h"
51#include "Language.h"
52#include "Log.h"
53#include "Loot.h"
54#include "LootMgr.h"
55#include "Map.h"
56#include "MiscPackets.h"
57#include "MotionMaster.h"
58#include "MoveSpline.h"
59#include "ObjectAccessor.h"
60#include "ObjectMgr.h"
61#include "OutdoorPvPMgr.h"
62#include "PathGenerator.h"
63#include "Pet.h"
64#include "PhasingHandler.h"
65#include "Player.h"
66#include "ReputationMgr.h"
67#include "RestMgr.h"
68#include "SceneObject.h"
69#include "ScriptMgr.h"
70#include "SharedDefines.h"
71#include "SkillExtraItems.h"
72#include "SocialMgr.h"
73#include "SpellAuraEffects.h"
74#include "SpellAuras.h"
75#include "SpellHistory.h"
76#include "SpellMgr.h"
77#include "SpellPackets.h"
78#include "TalentPackets.h"
79#include "TemporarySummon.h"
80#include "Totem.h"
81#include "TraitMgr.h"
82#include "TraitPacketsCommon.h"
83#include "Unit.h"
84#include "Util.h"
85#include "World.h"
86#include "WorldPacket.h"
87#include "WorldSession.h"
88
90{
92 &Spell::EffectInstaKill, // 1 SPELL_EFFECT_INSTAKILL
93 &Spell::EffectSchoolDMG, // 2 SPELL_EFFECT_SCHOOL_DAMAGE
94 &Spell::EffectDummy, // 3 SPELL_EFFECT_DUMMY
95 &Spell::EffectUnused, // 4 SPELL_EFFECT_PORTAL_TELEPORT unused
96 &Spell::EffectNULL, // 5 SPELL_EFFECT_5
97 &Spell::EffectApplyAura, // 6 SPELL_EFFECT_APPLY_AURA
98 &Spell::EffectEnvironmentalDMG, // 7 SPELL_EFFECT_ENVIRONMENTAL_DAMAGE
99 &Spell::EffectPowerDrain, // 8 SPELL_EFFECT_POWER_DRAIN
100 &Spell::EffectHealthLeech, // 9 SPELL_EFFECT_HEALTH_LEECH
101 &Spell::EffectHeal, // 10 SPELL_EFFECT_HEAL
102 &Spell::EffectBind, // 11 SPELL_EFFECT_BIND
103 &Spell::EffectNULL, // 12 SPELL_EFFECT_PORTAL
104 &Spell::EffectTeleportToReturnPoint, // 13 SPELL_EFFECT_TELEPORT_TO_RETURN_POINT
105 &Spell::EffectIncreaseCurrencyCap, // 14 SPELL_EFFECT_INCREASE_CURRENCY_CAP
106 &Spell::EffectTeleportUnitsWithVisualLoadingScreen, // 15 SPELL_EFFECT_TELEPORT_WITH_SPELL_VISUAL_KIT_LOADING_SCREEN
107 &Spell::EffectQuestComplete, // 16 SPELL_EFFECT_QUEST_COMPLETE
108 &Spell::EffectWeaponDmg, // 17 SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL
109 &Spell::EffectResurrect, // 18 SPELL_EFFECT_RESURRECT
110 &Spell::EffectAddExtraAttacks, // 19 SPELL_EFFECT_ADD_EXTRA_ATTACKS
111 &Spell::EffectUnused, // 20 SPELL_EFFECT_DODGE one spell: Dodge
112 &Spell::EffectUnused, // 21 SPELL_EFFECT_EVADE one spell: Evade (DND)
113 &Spell::EffectParry, // 22 SPELL_EFFECT_PARRY
114 &Spell::EffectBlock, // 23 SPELL_EFFECT_BLOCK one spell: Block
115 &Spell::EffectCreateItem, // 24 SPELL_EFFECT_CREATE_ITEM
116 &Spell::EffectUnused, // 25 SPELL_EFFECT_WEAPON
117 &Spell::EffectUnused, // 26 SPELL_EFFECT_DEFENSE one spell: Defense
118 &Spell::EffectPersistentAA, // 27 SPELL_EFFECT_PERSISTENT_AREA_AURA
119 &Spell::EffectSummonType, // 28 SPELL_EFFECT_SUMMON
120 &Spell::EffectLeap, // 29 SPELL_EFFECT_LEAP
121 &Spell::EffectEnergize, // 30 SPELL_EFFECT_ENERGIZE
122 &Spell::EffectWeaponDmg, // 31 SPELL_EFFECT_WEAPON_PERCENT_DAMAGE
123 &Spell::EffectTriggerMissileSpell, // 32 SPELL_EFFECT_TRIGGER_MISSILE
124 &Spell::EffectOpenLock, // 33 SPELL_EFFECT_OPEN_LOCK
125 &Spell::EffectSummonChangeItem, // 34 SPELL_EFFECT_SUMMON_CHANGE_ITEM
126 &Spell::EffectUnused, // 35 SPELL_EFFECT_APPLY_AREA_AURA_PARTY
127 &Spell::EffectLearnSpell, // 36 SPELL_EFFECT_LEARN_SPELL
128 &Spell::EffectUnused, // 37 SPELL_EFFECT_SPELL_DEFENSE one spell: SPELLDEFENSE (DND)
129 &Spell::EffectDispel, // 38 SPELL_EFFECT_DISPEL
130 &Spell::EffectUnused, // 39 SPELL_EFFECT_LANGUAGE
131 &Spell::EffectDualWield, // 40 SPELL_EFFECT_DUAL_WIELD
132 &Spell::EffectJump, // 41 SPELL_EFFECT_JUMP
133 &Spell::EffectJumpDest, // 42 SPELL_EFFECT_JUMP_DEST
134 &Spell::EffectTeleUnitsFaceCaster, // 43 SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER
135 &Spell::EffectLearnSkill, // 44 SPELL_EFFECT_SKILL_STEP
136 &Spell::EffectPlayMovie, // 45 SPELL_EFFECT_PLAY_MOVIE
137 &Spell::EffectUnused, // 46 SPELL_EFFECT_SPAWN clientside, unit appears as if it was just spawned
138 &Spell::EffectTradeSkill, // 47 SPELL_EFFECT_TRADE_SKILL
139 &Spell::EffectUnused, // 48 SPELL_EFFECT_STEALTH one spell: Base Stealth
140 &Spell::EffectUnused, // 49 SPELL_EFFECT_DETECT one spell: Detect
141 &Spell::EffectTransmitted, // 50 SPELL_EFFECT_TRANS_DOOR
142 &Spell::EffectUnused, // 51 SPELL_EFFECT_FORCE_CRITICAL_HIT unused
143 &Spell::EffectNULL, // 52 SPELL_EFFECT_SET_MAX_BATTLE_PET_COUNT
144 &Spell::EffectEnchantItemPerm, // 53 SPELL_EFFECT_ENCHANT_ITEM
145 &Spell::EffectEnchantItemTmp, // 54 SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY
146 &Spell::EffectTameCreature, // 55 SPELL_EFFECT_TAMECREATURE
147 &Spell::EffectSummonPet, // 56 SPELL_EFFECT_SUMMON_PET
148 &Spell::EffectLearnPetSpell, // 57 SPELL_EFFECT_LEARN_PET_SPELL
149 &Spell::EffectWeaponDmg, // 58 SPELL_EFFECT_WEAPON_DAMAGE
150 &Spell::EffectCreateRandomItem, // 59 SPELL_EFFECT_CREATE_RANDOM_ITEM create item base at spell specific loot
151 &Spell::EffectProficiency, // 60 SPELL_EFFECT_PROFICIENCY
152 &Spell::EffectSendEvent, // 61 SPELL_EFFECT_SEND_EVENT
153 &Spell::EffectPowerBurn, // 62 SPELL_EFFECT_POWER_BURN
154 &Spell::EffectThreat, // 63 SPELL_EFFECT_THREAT
155 &Spell::EffectTriggerSpell, // 64 SPELL_EFFECT_TRIGGER_SPELL
156 &Spell::EffectUnused, // 65 SPELL_EFFECT_APPLY_AREA_AURA_RAID
157 &Spell::EffectRechargeItem, // 66 SPELL_EFFECT_RECHARGE_ITEM
158 &Spell::EffectHealMaxHealth, // 67 SPELL_EFFECT_HEAL_MAX_HEALTH
159 &Spell::EffectInterruptCast, // 68 SPELL_EFFECT_INTERRUPT_CAST
160 &Spell::EffectDistract, // 69 SPELL_EFFECT_DISTRACT
161 &Spell::EffectNULL, // 70 SPELL_EFFECT_COMPLETE_AND_REWARD_WORLD_QUEST
162 &Spell::EffectPickPocket, // 71 SPELL_EFFECT_PICKPOCKET
163 &Spell::EffectAddFarsight, // 72 SPELL_EFFECT_ADD_FARSIGHT
164 &Spell::EffectUntrainTalents, // 73 SPELL_EFFECT_UNTRAIN_TALENTS
165 &Spell::EffectApplyGlyph, // 74 SPELL_EFFECT_APPLY_GLYPH
166 &Spell::EffectHealMechanical, // 75 SPELL_EFFECT_HEAL_MECHANICAL one spell: Mechanical Patch Kit
167 &Spell::EffectSummonObjectWild, // 76 SPELL_EFFECT_SUMMON_OBJECT_WILD
168 &Spell::EffectScriptEffect, // 77 SPELL_EFFECT_SCRIPT_EFFECT
169 &Spell::EffectUnused, // 78 SPELL_EFFECT_ATTACK
170 &Spell::EffectSanctuary, // 79 SPELL_EFFECT_SANCTUARY
171 &Spell::EffectNULL, // 80 SPELL_EFFECT_MODIFY_FOLLOWER_ITEM_LEVEL
172 &Spell::EffectNULL, // 81 SPELL_EFFECT_PUSH_ABILITY_TO_ACTION_BAR
173 &Spell::EffectNULL, // 82 SPELL_EFFECT_BIND_SIGHT
174 &Spell::EffectDuel, // 83 SPELL_EFFECT_DUEL
175 &Spell::EffectStuck, // 84 SPELL_EFFECT_STUCK
176 &Spell::EffectSummonPlayer, // 85 SPELL_EFFECT_SUMMON_PLAYER
177 &Spell::EffectActivateObject, // 86 SPELL_EFFECT_ACTIVATE_OBJECT
178 &Spell::EffectGameObjectDamage, // 87 SPELL_EFFECT_GAMEOBJECT_DAMAGE
179 &Spell::EffectGameObjectRepair, // 88 SPELL_EFFECT_GAMEOBJECT_REPAIR
180 &Spell::EffectGameObjectSetDestructionState, // 89 SPELL_EFFECT_GAMEOBJECT_SET_DESTRUCTION_STATE
181 &Spell::EffectKillCreditPersonal, // 90 SPELL_EFFECT_KILL_CREDIT Kill credit but only for single person
182 &Spell::EffectNULL, // 91 SPELL_EFFECT_THREAT_ALL
183 &Spell::EffectEnchantHeldItem, // 92 SPELL_EFFECT_ENCHANT_HELD_ITEM
184 &Spell::EffectForceDeselect, // 93 SPELL_EFFECT_FORCE_DESELECT
185 &Spell::EffectSelfResurrect, // 94 SPELL_EFFECT_SELF_RESURRECT
186 &Spell::EffectSkinning, // 95 SPELL_EFFECT_SKINNING
187 &Spell::EffectCharge, // 96 SPELL_EFFECT_CHARGE
188 &Spell::EffectCastButtons, // 97 SPELL_EFFECT_CAST_BUTTON (totem bar since 3.2.2a)
189 &Spell::EffectKnockBack, // 98 SPELL_EFFECT_KNOCK_BACK
190 &Spell::EffectDisEnchant, // 99 SPELL_EFFECT_DISENCHANT
191 &Spell::EffectInebriate, //100 SPELL_EFFECT_INEBRIATE
192 &Spell::EffectFeedPet, //101 SPELL_EFFECT_FEED_PET
193 &Spell::EffectDismissPet, //102 SPELL_EFFECT_DISMISS_PET
194 &Spell::EffectReputation, //103 SPELL_EFFECT_REPUTATION
195 &Spell::EffectSummonObject, //104 SPELL_EFFECT_SUMMON_OBJECT_SLOT1
196 &Spell::EffectNULL, //105 SPELL_EFFECT_SURVEY
197 &Spell::EffectChangeRaidMarker, //106 SPELL_EFFECT_CHANGE_RAID_MARKER
198 &Spell::EffectNULL, //107 SPELL_EFFECT_SHOW_CORPSE_LOOT
199 &Spell::EffectDispelMechanic, //108 SPELL_EFFECT_DISPEL_MECHANIC
200 &Spell::EffectResurrectPet, //109 SPELL_EFFECT_RESURRECT_PET
201 &Spell::EffectDestroyAllTotems, //110 SPELL_EFFECT_DESTROY_ALL_TOTEMS
202 &Spell::EffectDurabilityDamage, //111 SPELL_EFFECT_DURABILITY_DAMAGE
203 &Spell::EffectNULL, //112 SPELL_EFFECT_112
204 &Spell::EffectCancelConversation, //113 SPELL_EFFECT_CANCEL_CONVERSATION
205 &Spell::EffectTaunt, //114 SPELL_EFFECT_ATTACK_ME
206 &Spell::EffectDurabilityDamagePCT, //115 SPELL_EFFECT_DURABILITY_DAMAGE_PCT
207 &Spell::EffectSkinPlayerCorpse, //116 SPELL_EFFECT_SKIN_PLAYER_CORPSE one spell: Remove Insignia, bg usage, required special corpse flags...
208 &Spell::EffectSpiritHeal, //117 SPELL_EFFECT_SPIRIT_HEAL one spell: Spirit Heal
209 &Spell::EffectSkill, //118 SPELL_EFFECT_SKILL professions and more
210 &Spell::EffectUnused, //119 SPELL_EFFECT_APPLY_AREA_AURA_PET
211 &Spell::EffectTeleportGraveyard, //120 SPELL_EFFECT_TELEPORT_GRAVEYARD
212 &Spell::EffectWeaponDmg, //121 SPELL_EFFECT_NORMALIZED_WEAPON_DMG
213 &Spell::EffectUnused, //122 SPELL_EFFECT_122 unused
214 &Spell::EffectSendTaxi, //123 SPELL_EFFECT_SEND_TAXI taxi/flight related (misc value is taxi path id)
215 &Spell::EffectPullTowards, //124 SPELL_EFFECT_PULL_TOWARDS
216 &Spell::EffectModifyThreatPercent, //125 SPELL_EFFECT_MODIFY_THREAT_PERCENT
217 &Spell::EffectStealBeneficialBuff, //126 SPELL_EFFECT_STEAL_BENEFICIAL_BUFF spell steal effect?
218 &Spell::EffectProspecting, //127 SPELL_EFFECT_PROSPECTING Prospecting spell
219 &Spell::EffectUnused, //128 SPELL_EFFECT_APPLY_AREA_AURA_FRIEND
220 &Spell::EffectUnused, //129 SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
221 &Spell::EffectRedirectThreat, //130 SPELL_EFFECT_REDIRECT_THREAT
222 &Spell::EffectPlaySound, //131 SPELL_EFFECT_PLAY_SOUND sound id in misc value (SoundEntries.dbc)
223 &Spell::EffectPlayMusic, //132 SPELL_EFFECT_PLAY_MUSIC sound id in misc value (SoundEntries.dbc)
224 &Spell::EffectUnlearnSpecialization, //133 SPELL_EFFECT_UNLEARN_SPECIALIZATION unlearn profession specialization
225 &Spell::EffectKillCredit, //134 SPELL_EFFECT_KILL_CREDIT misc value is creature entry
226 &Spell::EffectNULL, //135 SPELL_EFFECT_CALL_PET
227 &Spell::EffectHealPct, //136 SPELL_EFFECT_HEAL_PCT
228 &Spell::EffectEnergizePct, //137 SPELL_EFFECT_ENERGIZE_PCT
229 &Spell::EffectLeapBack, //138 SPELL_EFFECT_LEAP_BACK Leap back
230 &Spell::EffectQuestClear, //139 SPELL_EFFECT_CLEAR_QUEST Reset quest status (miscValue - quest ID)
231 &Spell::EffectForceCast, //140 SPELL_EFFECT_FORCE_CAST
232 &Spell::EffectForceCast, //141 SPELL_EFFECT_FORCE_CAST_WITH_VALUE
233 &Spell::EffectTriggerSpell, //142 SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE
234 &Spell::EffectUnused, //143 SPELL_EFFECT_APPLY_AREA_AURA_OWNER
235 &Spell::EffectKnockBack, //144 SPELL_EFFECT_KNOCK_BACK_DEST
236 &Spell::EffectPullTowardsDest, //145 SPELL_EFFECT_PULL_TOWARDS_DEST Black Hole Effect
237 &Spell::EffectNULL, //146 SPELL_EFFECT_RESTORE_GARRISON_TROOP_VITALITY
238 &Spell::EffectQuestFail, //147 SPELL_EFFECT_QUEST_FAIL quest fail
239 &Spell::EffectTriggerMissileSpell, //148 SPELL_EFFECT_TRIGGER_MISSILE_SPELL_WITH_VALUE
240 &Spell::EffectChargeDest, //149 SPELL_EFFECT_CHARGE_DEST
241 &Spell::EffectQuestStart, //150 SPELL_EFFECT_QUEST_START
242 &Spell::EffectTriggerRitualOfSummoning, //151 SPELL_EFFECT_TRIGGER_SPELL_2
243 &Spell::EffectSummonRaFFriend, //152 SPELL_EFFECT_SUMMON_RAF_FRIEND summon Refer-a-Friend
244 &Spell::EffectCreateTamedPet, //153 SPELL_EFFECT_CREATE_TAMED_PET misc value is creature entry
245 &Spell::EffectDiscoverTaxi, //154 SPELL_EFFECT_DISCOVER_TAXI
246 &Spell::EffectTitanGrip, //155 SPELL_EFFECT_TITAN_GRIP Allows you to equip two-handed axes, maces and swords in one hand, but you attack $49152s1% slower than normal.
247 &Spell::EffectEnchantItemPrismatic, //156 SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC
248 &Spell::EffectCreateItem2, //157 SPELL_EFFECT_CREATE_ITEM_2 create item or create item template and replace by some randon spell loot item
249 &Spell::EffectMilling, //158 SPELL_EFFECT_MILLING milling
250 &Spell::EffectRenamePet, //159 SPELL_EFFECT_ALLOW_RENAME_PET allow rename pet once again
251 &Spell::EffectForceCast, //160 SPELL_EFFECT_FORCE_CAST_2
252 &Spell::EffectNULL, //161 SPELL_EFFECT_TALENT_SPEC_COUNT second talent spec (learn/revert)
253 &Spell::EffectActivateSpec, //162 SPELL_EFFECT_TALENT_SPEC_SELECT activate primary/secondary spec
254 &Spell::EffectNULL, //163 SPELL_EFFECT_OBLITERATE_ITEM
255 &Spell::EffectRemoveAura, //164 SPELL_EFFECT_REMOVE_AURA
256 &Spell::EffectDamageFromMaxHealthPCT, //165 SPELL_EFFECT_DAMAGE_FROM_MAX_HEALTH_PCT
257 &Spell::EffectGiveCurrency, //166 SPELL_EFFECT_GIVE_CURRENCY
258 &Spell::EffectUpdatePlayerPhase, //167 SPELL_EFFECT_UPDATE_PLAYER_PHASE
259 &Spell::EffectNULL, //168 SPELL_EFFECT_ALLOW_CONTROL_PET
260 &Spell::EffectDestroyItem, //169 SPELL_EFFECT_DESTROY_ITEM
261 &Spell::EffectUpdateZoneAurasAndPhases, //170 SPELL_EFFECT_UPDATE_ZONE_AURAS_AND_PHASES
262 &Spell::EffectSummonPersonalGameObject, //171 SPELL_EFFECT_SUMMON_PERSONAL_GAMEOBJECT
263 &Spell::EffectResurrectWithAura, //172 SPELL_EFFECT_RESURRECT_WITH_AURA
264 &Spell::EffectUnlockGuildVaultTab, //173 SPELL_EFFECT_UNLOCK_GUILD_VAULT_TAB
265 &Spell::EffectApplyAura, //174 SPELL_EFFECT_APPLY_AURA_ON_PET
266 &Spell::EffectNULL, //175 SPELL_EFFECT_175
267 &Spell::EffectSanctuary, //176 SPELL_EFFECT_SANCTUARY_2
268 &Spell::EffectNULL, //177 SPELL_EFFECT_DESPAWN_PERSISTENT_AREA_AURA
269 &Spell::EffectUnused, //178 SPELL_EFFECT_178 unused
270 &Spell::EffectCreateAreaTrigger, //179 SPELL_EFFECT_CREATE_AREATRIGGER
271 &Spell::EffectNULL, //180 SPELL_EFFECT_UPDATE_AREATRIGGER
272 &Spell::EffectRemoveTalent, //181 SPELL_EFFECT_REMOVE_TALENT
273 &Spell::EffectNULL, //182 SPELL_EFFECT_DESPAWN_AREATRIGGER
274 &Spell::EffectNULL, //183 SPELL_EFFECT_183
275 &Spell::EffectNULL, //184 SPELL_EFFECT_REPUTATION
276 &Spell::EffectNULL, //185 SPELL_EFFECT_185
277 &Spell::EffectNULL, //186 SPELL_EFFECT_186
278 &Spell::EffectNULL, //187 SPELL_EFFECT_RANDOMIZE_ARCHAEOLOGY_DIGSITES
279 &Spell::EffectNULL, //188 SPELL_EFFECT_SUMMON_STABLED_PET_AS_GUARDIAN
280 &Spell::EffectNULL, //189 SPELL_EFFECT_LOOT
281 &Spell::EffectNULL, //190 SPELL_EFFECT_CHANGE_PARTY_MEMBERS
282 &Spell::EffectNULL, //191 SPELL_EFFECT_TELEPORT_TO_DIGSITE
283 &Spell::EffectUncageBattlePet, //192 SPELL_EFFECT_UNCAGE_BATTLEPET
284 &Spell::EffectNULL, //193 SPELL_EFFECT_START_PET_BATTLE
285 &Spell::EffectUnused, //194 SPELL_EFFECT_194
286 &Spell::EffectPlaySceneScriptPackage, //195 SPELL_EFFECT_PLAY_SCENE_SCRIPT_PACKAGE
287 &Spell::EffectCreateSceneObject, //196 SPELL_EFFECT_CREATE_SCENE_OBJECT
288 &Spell::EffectCreatePrivateSceneObject, //197 SPELL_EFFECT_CREATE_PERSONAL_SCENE_OBJECT
289 &Spell::EffectPlayScene, //198 SPELL_EFFECT_PLAY_SCENE
290 &Spell::EffectNULL, //199 SPELL_EFFECT_DESPAWN_SUMMON
291 &Spell::EffectHealBattlePetPct, //200 SPELL_EFFECT_HEAL_BATTLEPET_PCT
292 &Spell::EffectEnableBattlePets, //201 SPELL_EFFECT_ENABLE_BATTLE_PETS
293 &Spell::EffectUnused, //202 SPELL_EFFECT_APPLY_AREA_AURA_SUMMONS
294 &Spell::EffectRemoveAura, //203 SPELL_EFFECT_REMOVE_AURA_2
295 &Spell::EffectChangeBattlePetQuality, //204 SPELL_EFFECT_CHANGE_BATTLEPET_QUALITY
296 &Spell::EffectLaunchQuestChoice, //205 SPELL_EFFECT_LAUNCH_QUEST_CHOICE
297 &Spell::EffectNULL, //206 SPELL_EFFECT_ALTER_ITEM
298 &Spell::EffectNULL, //207 SPELL_EFFECT_LAUNCH_QUEST_TASK
299 &Spell::EffectNULL, //208 SPELL_EFFECT_SET_REPUTATION
300 &Spell::EffectUnused, //209 SPELL_EFFECT_209
301 &Spell::EffectLearnGarrisonBuilding, //210 SPELL_EFFECT_LEARN_GARRISON_BUILDING
302 &Spell::EffectNULL, //211 SPELL_EFFECT_LEARN_GARRISON_SPECIALIZATION
303 &Spell::EffectRemoveAuraBySpellLabel, //212 SPELL_EFFECT_REMOVE_AURA_BY_SPELL_LABEL
304 &Spell::EffectJumpDest, //213 SPELL_EFFECT_JUMP_DEST_2
305 &Spell::EffectCreateGarrison, //214 SPELL_EFFECT_CREATE_GARRISON
306 &Spell::EffectNULL, //215 SPELL_EFFECT_UPGRADE_CHARACTER_SPELLS
307 &Spell::EffectNULL, //216 SPELL_EFFECT_CREATE_SHIPMENT
308 &Spell::EffectNULL, //217 SPELL_EFFECT_UPGRADE_GARRISON
309 &Spell::EffectNULL, //218 SPELL_EFFECT_218
310 &Spell::EffectCreateConversation, //219 SPELL_EFFECT_CREATE_CONVERSATION
311 &Spell::EffectAddGarrisonFollower, //220 SPELL_EFFECT_ADD_GARRISON_FOLLOWER
312 &Spell::EffectNULL, //221 SPELL_EFFECT_ADD_GARRISON_MISSION
313 &Spell::EffectCreateHeirloomItem, //222 SPELL_EFFECT_CREATE_HEIRLOOM_ITEM
314 &Spell::EffectNULL, //223 SPELL_EFFECT_CHANGE_ITEM_BONUSES
315 &Spell::EffectActivateGarrisonBuilding, //224 SPELL_EFFECT_ACTIVATE_GARRISON_BUILDING
316 &Spell::EffectGrantBattlePetLevel, //225 SPELL_EFFECT_GRANT_BATTLEPET_LEVEL
317 &Spell::EffectNULL, //226 SPELL_EFFECT_TRIGGER_ACTION_SET
318 &Spell::EffectNULL, //227 SPELL_EFFECT_TELEPORT_TO_LFG_DUNGEON
319 &Spell::EffectNULL, //228 SPELL_EFFECT_228
320 &Spell::EffectNULL, //229 SPELL_EFFECT_SET_FOLLOWER_QUALITY
321 &Spell::EffectNULL, //230 SPELL_EFFECT_230
322 &Spell::EffectNULL, //231 SPELL_EFFECT_INCREASE_FOLLOWER_EXPERIENCE
323 &Spell::EffectNULL, //232 SPELL_EFFECT_REMOVE_PHASE
324 &Spell::EffectNULL, //233 SPELL_EFFECT_RANDOMIZE_FOLLOWER_ABILITIES
325 &Spell::EffectNULL, //234 SPELL_EFFECT_234
326 &Spell::EffectUnused, //235 SPELL_EFFECT_235
327 &Spell::EffectGiveExperience, //236 SPELL_EFFECT_GIVE_EXPERIENCE
328 &Spell::EffectGiveRestedExperience, //237 SPELL_EFFECT_GIVE_RESTED_EXPERIENCE_BONUS
329 &Spell::EffectNULL, //238 SPELL_EFFECT_INCREASE_SKILL
330 &Spell::EffectNULL, //239 SPELL_EFFECT_END_GARRISON_BUILDING_CONSTRUCTION
331 &Spell::EffectGiveArtifactPower, //240 SPELL_EFFECT_GIVE_ARTIFACT_POWER
332 &Spell::EffectUnused, //241 SPELL_EFFECT_241
333 &Spell::EffectGiveArtifactPowerNoBonus, //242 SPELL_EFFECT_GIVE_ARTIFACT_POWER_NO_BONUS
334 &Spell::EffectApplyEnchantIllusion, //243 SPELL_EFFECT_APPLY_ENCHANT_ILLUSION
335 &Spell::EffectNULL, //244 SPELL_EFFECT_LEARN_FOLLOWER_ABILITY
336 &Spell::EffectUpgradeHeirloom, //245 SPELL_EFFECT_UPGRADE_HEIRLOOM
337 &Spell::EffectNULL, //246 SPELL_EFFECT_FINISH_GARRISON_MISSION
338 &Spell::EffectNULL, //247 SPELL_EFFECT_ADD_GARRISON_MISSION_SET
339 &Spell::EffectNULL, //248 SPELL_EFFECT_FINISH_SHIPMENT
340 &Spell::EffectNULL, //249 SPELL_EFFECT_FORCE_EQUIP_ITEM
341 &Spell::EffectNULL, //250 SPELL_EFFECT_TAKE_SCREENSHOT
342 &Spell::EffectNULL, //251 SPELL_EFFECT_SET_GARRISON_CACHE_SIZE
343 &Spell::EffectTeleportUnits, //252 SPELL_EFFECT_TELEPORT_UNITS
344 &Spell::EffectGiveHonor, //253 SPELL_EFFECT_GIVE_HONOR
345 &Spell::EffectJumpCharge, //254 SPELL_EFFECT_JUMP_CHARGE
346 &Spell::EffectLearnTransmogSet, //255 SPELL_EFFECT_LEARN_TRANSMOG_SET
347 &Spell::EffectUnused, //256 SPELL_EFFECT_256
348 &Spell::EffectUnused, //257 SPELL_EFFECT_257
349 &Spell::EffectNULL, //258 SPELL_EFFECT_MODIFY_KEYSTONE
350 &Spell::EffectRespecAzeriteEmpoweredItem, //259 SPELL_EFFECT_RESPEC_AZERITE_EMPOWERED_ITEM
351 &Spell::EffectNULL, //260 SPELL_EFFECT_SUMMON_STABLED_PET
352 &Spell::EffectNULL, //261 SPELL_EFFECT_SCRAP_ITEM
353 &Spell::EffectUnused, //262 SPELL_EFFECT_262
354 &Spell::EffectNULL, //263 SPELL_EFFECT_REPAIR_ITEM
355 &Spell::EffectNULL, //264 SPELL_EFFECT_REMOVE_GEM
356 &Spell::EffectLearnAzeriteEssencePower, //265 SPELL_EFFECT_LEARN_AZERITE_ESSENCE_POWER
357 &Spell::EffectNULL, //266 SPELL_EFFECT_SET_ITEM_BONUS_LIST_GROUP_ENTRY
358 &Spell::EffectCreatePrivateConversation, //267 SPELL_EFFECT_CREATE_PRIVATE_CONVERSATION
359 &Spell::EffectNULL, //268 SPELL_EFFECT_APPLY_MOUNT_EQUIPMENT
360 &Spell::EffectNULL, //269 SPELL_EFFECT_INCREASE_ITEM_BONUS_LIST_GROUP_STEP
361 &Spell::EffectNULL, //270 SPELL_EFFECT_270
362 &Spell::EffectUnused, //271 SPELL_EFFECT_APPLY_AREA_AURA_PARTY_NONRANDOM
363 &Spell::EffectNULL, //272 SPELL_EFFECT_SET_COVENANT
364 &Spell::EffectNULL, //273 SPELL_EFFECT_CRAFT_RUNEFORGE_LEGENDARY
365 &Spell::EffectUnused, //274 SPELL_EFFECT_274
366 &Spell::EffectUnused, //275 SPELL_EFFECT_275
367 &Spell::EffectLearnTransmogIllusion, //276 SPELL_EFFECT_LEARN_TRANSMOG_ILLUSION
368 &Spell::EffectNULL, //277 SPELL_EFFECT_SET_CHROMIE_TIME
369 &Spell::EffectNULL, //278 SPELL_EFFECT_278
370 &Spell::EffectNULL, //279 SPELL_EFFECT_LEARN_GARR_TALENT
371 &Spell::EffectUnused, //280 SPELL_EFFECT_280
372 &Spell::EffectNULL, //281 SPELL_EFFECT_LEARN_SOULBIND_CONDUIT
373 &Spell::EffectNULL, //282 SPELL_EFFECT_CONVERT_ITEMS_TO_CURRENCY
374 &Spell::EffectNULL, //283 SPELL_EFFECT_COMPLETE_CAMPAIGN
375 &Spell::EffectSendChatMessage, //284 SPELL_EFFECT_SEND_CHAT_MESSAGE
376 &Spell::EffectNULL, //285 SPELL_EFFECT_MODIFY_KEYSTONE_2
377 &Spell::EffectGrantBattlePetExperience, //286 SPELL_EFFECT_GRANT_BATTLEPET_EXPERIENCE
378 &Spell::EffectNULL, //287 SPELL_EFFECT_SET_GARRISON_FOLLOWER_LEVEL
379 &Spell::EffectNULL, //288 SPELL_EFFECT_CRAFT_ITEM
380 &Spell::EffectModifyAuraStacks, //289 SPELL_EFFECT_MODIFY_AURA_STACKS
381 &Spell::EffectModifyCooldown, //290 SPELL_EFFECT_MODIFY_COOLDOWN
382 &Spell::EffectModifyCooldowns, //291 SPELL_EFFECT_MODIFY_COOLDOWNS
383 &Spell::EffectModifyCooldownsByCategory, //292 SPELL_EFFECT_MODIFY_COOLDOWNS_BY_CATEGORY
384 &Spell::EffectModifySpellCharges, //293 SPELL_EFFECT_MODIFY_CHARGES
385 &Spell::EffectNULL, //294 SPELL_EFFECT_CRAFT_LOOT
386 &Spell::EffectNULL, //295 SPELL_EFFECT_SALVAGE_ITEM
387 &Spell::EffectNULL, //296 SPELL_EFFECT_CRAFT_SALVAGE_ITEM
388 &Spell::EffectNULL, //297 SPELL_EFFECT_RECRAFT_ITEM
389 &Spell::EffectNULL, //298 SPELL_EFFECT_CANCEL_ALL_PRIVATE_CONVERSATIONS
390 &Spell::EffectNULL, //299 SPELL_EFFECT_299
391 &Spell::EffectUnused, //300 SPELL_EFFECT_300
392 &Spell::EffectNULL, //301 SPELL_EFFECT_CRAFT_ENCHANT
393 &Spell::EffectNULL, //302 SPELL_EFFECT_GATHERING
394 &Spell::EffectCreateTraitTreeConfig, //303 SPELL_EFFECT_CREATE_TRAIT_TREE_CONFIG
395 &Spell::EffectChangeActiveCombatTraitConfig, //304 SPELL_EFFECT_CHANGE_ACTIVE_COMBAT_TRAIT_CONFIG
396 &Spell::EffectNULL, //305 SPELL_EFFECT_305
397 &Spell::EffectNULL, //306 SPELL_EFFECT_UPDATE_INTERACTIONS
398 &Spell::EffectNULL, //307 SPELL_EFFECT_307
399 &Spell::EffectNULL, //308 SPELL_EFFECT_CANCEL_PRELOAD_WORLD
400 &Spell::EffectNULL, //309 SPELL_EFFECT_PRELOAD_WORLD
401 &Spell::EffectNULL, //310 SPELL_EFFECT_310
402 &Spell::EffectNULL, //311 SPELL_EFFECT_ENSURE_WORLD_LOADED
403 &Spell::EffectNULL, //312 SPELL_EFFECT_312
404 &Spell::EffectNULL, //313 SPELL_EFFECT_CHANGE_ITEM_BONUSES_2
405 &Spell::EffectNULL, //314 SPELL_EFFECT_ADD_SOCKET_BONUS
406 &Spell::EffectNULL, //315 SPELL_EFFECT_LEARN_TRANSMOG_APPEARANCE_FROM_ITEM_MOD_APPEARANCE_GROUP
407};
408
410{
411 TC_LOG_DEBUG("spells", "WORLD: Spell Effect DUMMY");
412}
413
415{
416 // NOT USED BY ANY SPELL OR USELESS OR IMPLEMENTED IN DIFFERENT WAY IN TRINITY
417}
418
420{
422 return;
423
424 if (!m_corpseTarget && !unitTarget)
425 return;
426
427 Player* player = nullptr;
428
429 if (m_corpseTarget)
431 else if (unitTarget)
432 player = unitTarget->ToPlayer();
433
434 if (!player || player->IsAlive() || !player->IsInWorld())
435 return;
436
437 if (player->IsResurrectRequested()) // already have one active request
438 return;
439
440 uint32 health = damage;
443 player->SetResurrectRequestData(m_caster, health, mana, 0);
444 SendResurrectRequest(player);
445}
446
448{
450 return;
451
452 if (!unitTarget || !unitTarget->IsAlive())
453 return;
454
457 return;
458
459 if (m_caster == unitTarget) // prevent interrupt message
460 finish();
461
463 data.Target = unitTarget->GetGUID();
464 data.Caster = m_caster->GetGUID();
465 data.SpellID = m_spellInfo->Id;
466 m_caster->SendMessageToSet(data.Write(), true);
467
469}
470
472{
474 return;
475
476 if (!unitTarget || !unitTarget->IsAlive())
477 return;
478
479 // CalcAbsorbResist already in Player::EnvironmentalDamage
482 else
483 {
484 Unit* unitCaster = GetUnitCasterForEffectHandlers();
486 Unit::CalcAbsorbResist(damageInfo);
487
489 log.damage = damageInfo.GetDamage();
491 log.absorb = damageInfo.GetAbsorb();
492 log.resist = damageInfo.GetResist();
493
494 if (unitCaster)
495 unitCaster->SendSpellNonMeleeDamageLog(&log);
496 }
497}
498
500{
502 return;
503
504 if (unitTarget && unitTarget->IsAlive())
505 {
506 bool apply_direct_bonus = true;
507
508 // Meteor like spells (divided damage to targets)
510 {
511 // divide to all targets
513 damage /= count;
514 }
515
516 Unit* unitCaster = GetUnitCasterForEffectHandlers();
518 {
520 {
521 break;
522 }
524 {
525 break;
526 }
528 {
529 break;
530 }
532 {
533 break;
534 }
536 {
537 break;
538 }
540 {
541 break;
542 }
543 }
544
545 if (unitCaster && apply_direct_bonus)
546 {
548 damage = bonus + uint32(bonus * variance);
550 }
551
552 m_damage += damage;
553 }
554}
555
557{
559 return;
560
562 return;
563
564 // pet auras
566 {
567 if (PetAura const* petSpell = sSpellMgr->GetPetAura(m_spellInfo->Id, effectInfo->EffectIndex))
568 {
569 m_caster->ToPlayer()->AddPetAura(petSpell);
570 return;
571 }
572 }
573
574 // normal DB scripted effect
575 TC_LOG_DEBUG("spells", "Spell ScriptStart spellid {} in EffectDummy({})", m_spellInfo->Id, effectInfo->EffectIndex);
577}
578
580{
583 return;
584
585 uint32 triggered_spell_id = effectInfo->TriggerSpell;
586
590 {
591 // special cases
592 switch (triggered_spell_id)
593 {
594 // Demonic Empowerment -- succubus
595 case 54437:
596 {
600
601 // Cast Lesser Invisibility
602 unitTarget->CastSpell(unitTarget, 7870, this);
603 return;
604 }
605 // Brittle Armor - (need add max stack of 24575 Brittle Armor)
606 case 29284:
607 {
608 // Brittle Armor
609 SpellInfo const* spell = sSpellMgr->GetSpellInfo(24575, GetCastDifficulty());
610 if (!spell)
611 return;
612
613 for (uint32 j = 0; j < spell->StackAmount; ++j)
614 m_caster->CastSpell(unitTarget, spell->Id, this);
615 return;
616 }
617 // Mercurial Shield - (need add max stack of 26464 Mercurial Shield)
618 case 29286:
619 {
620 // Mercurial Shield
621 SpellInfo const* spell = sSpellMgr->GetSpellInfo(26464, GetCastDifficulty());
622 if (!spell)
623 return;
624
625 for (uint32 j = 0; j < spell->StackAmount; ++j)
626 m_caster->CastSpell(unitTarget, spell->Id, this);
627 return;
628 }
629 }
630 }
631
632 if (triggered_spell_id == 0)
633 {
634 TC_LOG_WARN("spells.effect.nospell", "Spell::EffectTriggerSpell: Spell {} [EffectIndex: {}] does not have triggered spell.", m_spellInfo->Id, effectInfo->EffectIndex);
635 return;
636 }
637
638 // normal case
639 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id, GetCastDifficulty());
640 if (!spellInfo)
641 {
642 TC_LOG_ERROR("spells.effect.nospell", "Spell::EffectTriggerSpell spell {} tried to trigger unknown spell {}", m_spellInfo->Id, triggered_spell_id);
643 return;
644 }
645
646 SpellCastTargets targets;
647 Optional<int32> targetCount;
648 Optional<int32> targetIndex;
650 {
652 return;
653 targets.SetUnitTarget(unitTarget);
656 }
657 else //if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH)
658 {
660 return;
661
663 targets.SetDst(m_targets);
664
665 if (Unit* target = m_targets.GetUnitTarget())
666 targets.SetUnitTarget(target);
667 else
668 {
669 if (Unit* unit = m_caster->ToUnit())
670 targets.SetUnitTarget(unit);
671 else if (GameObject* go = m_caster->ToGameObject())
672 targets.SetGOTarget(go);
673 }
674 }
675
676 Milliseconds delay = 0ms;
679
680 m_caster->m_Events.AddEventAtOffset([caster = m_caster, targets, originalCaster = m_originalCasterGUID, castItemGuid = m_castItemGUID, originalCastId = m_castId,
681 spellEffectInfo = effectInfo, value = damage, itemLevel = m_castItemLevel, targetCount, targetIndex]() mutable
682 {
683 targets.Update(caster); // refresh pointers stored in targets
684
685 // original caster guid only for GO cast
687 args.SetOriginalCaster(originalCaster);
688 args.OriginalCastId = originalCastId;
689 args.OriginalCastItemLevel = itemLevel;
690 if (!castItemGuid.IsEmpty() && sSpellMgr->AssertSpellInfo(spellEffectInfo->TriggerSpell, caster->GetMap()->GetDifficultyID())->HasAttribute(SPELL_ATTR2_RETAIN_ITEM_CAST))
691 if (Player const* triggeringAuraCaster = Object::ToPlayer(caster))
692 args.CastItem = triggeringAuraCaster->GetItemByGuid(castItemGuid);
693
694 // set basepoints for trigger with value effect
695 if (spellEffectInfo->Effect == SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE)
696 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
698
699 if (targetCount)
701
702 if (targetIndex)
704
705 caster->CastSpell(std::move(targets), spellEffectInfo->TriggerSpell, args);
706 }, delay);
707}
708
710{
713 return;
714
715 uint32 triggered_spell_id = effectInfo->TriggerSpell;
716 if (triggered_spell_id == 0)
717 {
718 TC_LOG_WARN("spells.effect.nospell", "Spell::EffectTriggerMissileSpell: Spell {} [EffectIndex: {}] does not have triggered spell.", m_spellInfo->Id, effectInfo->EffectIndex);
719 return;
720 }
721
722 // normal case
723 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id, GetCastDifficulty());
724 if (!spellInfo)
725 {
726 TC_LOG_ERROR("spells.effect.nospell", "Spell::EffectTriggerMissileSpell spell {} tried to trigger unknown spell {}.", m_spellInfo->Id, triggered_spell_id);
727 return;
728 }
729
730 SpellCastTargets targets;
731 Optional<int32> targetCount;
732 Optional<int32> targetIndex;
734 {
736 return;
737 targets.SetUnitTarget(unitTarget);
740 }
741 else //if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT)
742 {
744 return;
745
747 targets.SetDst(m_targets);
748
749 if (Unit* unit = m_caster->ToUnit())
750 targets.SetUnitTarget(unit);
751 else if (GameObject* go = m_caster->ToGameObject())
752 targets.SetGOTarget(go);
753 }
754
757 args.SetTriggeringSpell(this);
759
760 // set basepoints for trigger with value effect
762 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
764
765 if (targetCount)
767
768 if (targetIndex)
770
771 // original caster guid only for GO cast
772 m_caster->CastSpell(std::move(targets), spellInfo->Id, args);
773}
774
776{
778 return;
779
780 if (!unitTarget)
781 return;
782
783 uint32 triggered_spell_id = effectInfo->TriggerSpell;
784 if (triggered_spell_id == 0)
785 {
786 TC_LOG_WARN("spells.effect.nospell", "Spell::EffectForceCast: Spell {} [EffectIndex: {}] does not have triggered spell.", m_spellInfo->Id, effectInfo->EffectIndex);
787 return;
788 }
789
790 // normal case
791 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id, GetCastDifficulty());
792
793 if (!spellInfo)
794 {
795 TC_LOG_ERROR("spells.effect.nospell", "Spell::EffectForceCast of spell {}: triggering unknown spell id {}.", m_spellInfo->Id, triggered_spell_id);
796 return;
797 }
798
800 {
801 switch (m_spellInfo->Id)
802 {
803 case 52588: // Skeletal Gryphon Escape
804 case 48598: // Ride Flamebringer Cue
806 break;
807 case 52463: // Hide In Mine Car
808 case 52349: // Overtake
809 {
812 args.SetTriggeringSpell(this);
814 unitTarget->CastSpell(unitTarget, spellInfo->Id, args);
815 return;
816 }
817 }
818 }
819
820 switch (spellInfo->Id)
821 {
822 case 72298: // Malleable Goo Summon
824 .SetOriginalCaster(m_originalCasterGUID)
825 .SetTriggeringSpell(this));
826 return;
827 }
828
830 args.SetTriggeringSpell(this);
832 for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
834
835 unitTarget->CastSpell(m_caster, spellInfo->Id, args);
836}
837
839{
841 return;
842
843 uint32 triggered_spell_id = effectInfo->TriggerSpell;
844 if (triggered_spell_id == 0)
845 {
846 TC_LOG_WARN("spells.effect.nospell", "Spell::EffectTriggerRitualOfSummoning: Spell {} [EffectIndex: {}] does not have triggered spell.", m_spellInfo->Id, effectInfo->EffectIndex);
847 return;
848 }
849
850 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id, GetCastDifficulty());
851
852 if (!spellInfo)
853 {
854 TC_LOG_ERROR("spells.effect.nospell", "EffectTriggerRitualOfSummoning of spell {}: triggering unknown spell id {}.", m_spellInfo->Id, triggered_spell_id);
855 return;
856 }
857
858 finish();
859
860 m_caster->CastSpell(nullptr, spellInfo->Id, CastSpellExtraArgs()
861 .SetTriggeringSpell(this));
862}
863
864void Spell::CalculateJumpSpeeds(SpellEffectInfo const* effInfo, float dist, float& speedXY, float& speedZ)
865{
866 Unit* unitCaster = GetUnitCasterForEffectHandlers();
867 ASSERT(unitCaster);
868
869 float multiplier = effInfo->Amplitude;
870 if (multiplier <= 0.0f)
871 multiplier = 1.0f;
872
873 float minHeight = effInfo->MiscValue ? effInfo->MiscValue / 10.0f : 0.5f; // Lower bound is blizzlike
874 float maxHeight = effInfo->MiscValueB ? effInfo->MiscValueB / 10.0f : 1000.0f; // Upper bound is unknown
875
876 unitCaster->GetMotionMaster()->CalculateJumpSpeeds(dist, MOVE_RUN, multiplier, minHeight, maxHeight, speedXY, speedZ);
877}
878
880{
882 return;
883
884 Unit* unitCaster = GetUnitCasterForEffectHandlers();
885 if (!unitCaster)
886 return;
887
888 if (unitCaster->IsInFlight())
889 return;
890
891 if (!unitTarget)
892 return;
893
894 float speedXY, speedZ;
895 CalculateJumpSpeeds(effectInfo, unitCaster->GetExactDist2d(unitTarget), speedXY, speedZ);
896 JumpArrivalCastArgs arrivalCast;
897 arrivalCast.SpellId = effectInfo->TriggerSpell;
898 arrivalCast.Target = unitTarget->GetGUID();
899 unitCaster->GetMotionMaster()->MoveJump(*unitTarget, speedXY, speedZ, EVENT_JUMP, false, &arrivalCast);
900}
901
903{
905 return;
906
907 Unit* unitCaster = GetUnitCasterForEffectHandlers();
908 if (!unitCaster)
909 return;
910
911 if (unitCaster->IsInFlight())
912 return;
913
914 if (!m_targets.HasDst())
915 return;
916
917 float speedXY, speedZ;
918 CalculateJumpSpeeds(effectInfo, unitCaster->GetExactDist2d(destTarget), speedXY, speedZ);
919 JumpArrivalCastArgs arrivalCast;
920 arrivalCast.SpellId = effectInfo->TriggerSpell;
921 unitCaster->GetMotionMaster()->MoveJump(*destTarget, speedXY, speedZ, EVENT_JUMP, !m_targets.GetObjectTargetGUID().IsEmpty(), &arrivalCast);
922}
923
924TeleportToOptions GetTeleportOptions(WorldObject const* caster, Unit const* unitTarget, SpellDestination const& targetDest)
925{
927 if (caster == unitTarget)
928 options |= TELE_TO_SPELL;
929
930 if (targetDest._position.GetMapId() == unitTarget->GetMapId())
931 {
933
934 if (unitTarget->GetTransGUID() == targetDest._transportGUID)
936 }
937
938 return options;
939}
940
942{
944 return;
945
947 return;
948
949 // If not exist data for dest location - return
950 if (!m_targets.HasDst())
951 {
952 TC_LOG_ERROR("spells", "Spell::EffectTeleportUnits - does not have a destination for spellId {}.", m_spellInfo->Id);
953 return;
954 }
955
956 // Init dest coordinates
957 WorldLocation targetDest(*destTarget);
958 if (targetDest.GetMapId() == MAPID_INVALID)
959 targetDest.m_mapId = unitTarget->GetMapId();
960
961 if (!targetDest.GetOrientation() && m_targets.GetUnitTarget())
963
964 Player* player = unitTarget->ToPlayer();
965
966 // Custom loading screen
967 if (player)
968 {
969 if (uint32 customLoadingScreenId = effectInfo->MiscValue)
971
973
974 player->TeleportTo(targetDest, options);
975
976 }
977 else if (targetDest.GetMapId() == unitTarget->GetMapId())
979 else
980 TC_LOG_ERROR("spells", "Spell::EffectTeleportUnits - spellId {} attempted to teleport creature to a different map.", m_spellInfo->Id);
981}
982
984{
985public:
986 explicit DelayedSpellTeleportEvent(Unit* target, WorldLocation const& targetDest, TeleportToOptions options, uint32 spellId)
987 : _target(target), _targetDest(targetDest), _options(options), _spellId(spellId){ }
988
989 bool Execute(uint64 /*e_time*/, uint32 /*p_time*/) override
990 {
991 if (Player* player = _target->ToPlayer())
992 player->TeleportTo(_targetDest, _options);
993 else if (_targetDest.GetMapId() == _target->GetMapId())
995 else
996 TC_LOG_ERROR("spells", "Spell::EffectTeleportUnitsWithVisualLoadingScreen - spellId {} attempted to teleport creature to a different map.", _spellId);
997
998 return true;
999 }
1000
1001private:
1006};
1007
1009{
1011 return;
1012
1013 if (!unitTarget)
1014 return;
1015
1016 // If not exist data for dest location - return
1017 if (!m_targets.HasDst())
1018 {
1019 TC_LOG_ERROR("spells", "Spell::EffectTeleportUnitsWithVisualLoadingScreen - does not have a destination for spellId {}.", m_spellInfo->Id);
1020 return;
1021 }
1022
1023 // Init dest coordinates
1024 WorldLocation targetDest(*destTarget);
1025 if (targetDest.GetMapId() == MAPID_INVALID)
1026 targetDest.m_mapId = unitTarget->GetMapId();
1027
1028 if (!targetDest.GetOrientation() && m_targets.GetUnitTarget())
1030
1032 if (Player* playerTarget = unitTarget->ToPlayer())
1034
1038}
1039
1041{
1043 return;
1044
1045 if (!_spellAura || !unitTarget)
1046 return;
1047
1048 // register target/effect on aura
1050 if (!aurApp)
1052 else
1053 aurApp->UpdateApplyEffectMask(aurApp->GetEffectsToApply() | 1 << effectInfo->EffectIndex, false);
1054}
1055
1057{
1059 return;
1060
1062 return;
1063
1064 Player* player = unitTarget->ToPlayer();
1065 uint32 spellToUnlearn = effectInfo->TriggerSpell;
1066
1067 player->RemoveSpell(spellToUnlearn);
1068
1069 TC_LOG_DEBUG("spells", "Spell: Player {} has unlearned spell {} from Npc {}", player->GetGUID().ToString(), spellToUnlearn, m_caster->GetGUID().ToString());
1070}
1071
1073{
1075 return;
1076
1078 return;
1079
1080 Powers powerType = Powers(effectInfo->MiscValue);
1081 if (!unitTarget || !unitTarget->IsAlive() || unitTarget->GetPowerType() != powerType || damage < 0)
1082 return;
1083
1084 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1085 // add spell damage bonus
1086 if (unitCaster)
1087 {
1089 damage = bonus + uint32(bonus * variance);
1091 }
1092
1093 int32 newDamage = -(unitTarget->ModifyPower(powerType, -damage));
1094
1095 // Don't restore from self drain
1096 float gainMultiplier = 0.f;
1097 if (unitCaster && unitCaster != unitTarget)
1098 {
1099 gainMultiplier = effectInfo->CalcValueMultiplier(unitCaster, this);
1100 int32 const gain = int32(newDamage * gainMultiplier);
1101
1102 unitCaster->EnergizeBySpell(unitCaster, m_spellInfo, gain, powerType);
1103 }
1104 ExecuteLogEffectTakeTargetPower(SpellEffectName(effectInfo->Effect), unitTarget, powerType, newDamage, gainMultiplier);
1105}
1106
1108{
1109 // we do not handle a flag dropping or clicking on flag in battleground by sendevent system
1112 return;
1113
1114 WorldObject* target = nullptr;
1115
1116 // call events for object target if present
1118 {
1119 if (unitTarget)
1120 target = unitTarget;
1121 else if (gameObjTarget)
1122 target = gameObjTarget;
1123 else if (m_corpseTarget)
1124 target = m_corpseTarget;
1125 }
1126 else // if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT)
1127 {
1128 // let's prevent executing effect handler twice in case when spell effect is capable of targeting an object
1129 // this check was requested by scripters, but it has some downsides:
1130 // now it's impossible to script (using sEventScripts) a cast which misses all targets
1131 // or to have an ability to script the moment spell hits dest (in a case when there are object targets present)
1133 return;
1134 // some spells have no target entries in dbc and they use focus target
1135 if (focusObject)
1136 target = focusObject;
1138 }
1139
1140 TC_LOG_DEBUG("spells", "Spell ScriptStart {} for spellid {} in EffectSendEvent ", effectInfo->MiscValue, m_spellInfo->Id);
1141
1143}
1144
1146{
1148 return;
1149
1151 return;
1152
1153 Powers powerType = Powers(effectInfo->MiscValue);
1154 if (!unitTarget || !unitTarget->IsAlive() || unitTarget->GetPowerType() != powerType || damage < 0)
1155 return;
1156
1157 int32 newDamage = -(unitTarget->ModifyPower(powerType, -damage));
1158
1159 // NO - Not a typo - EffectPowerBurn uses effect value multiplier - not effect damage multiplier
1160 float dmgMultiplier = effectInfo->CalcValueMultiplier(GetUnitCasterForEffectHandlers(), this);
1161
1162 // add log data before multiplication (need power amount, not damage)
1164
1165 newDamage = int32(newDamage * dmgMultiplier);
1166
1167 m_damage += newDamage;
1168}
1169
1171{
1173 return;
1174
1175 if (!unitTarget || !unitTarget->IsAlive() || damage < 0)
1176 return;
1177
1178 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1179
1180 // Skip if m_originalCaster not available
1181 if (!unitCaster)
1182 return;
1183
1184 int32 addhealth = damage;
1185
1186 // Vessel of the Naaru (Vial of the Sunwell trinket)
1188 if (m_spellInfo->Id == 45064)
1189 {
1190 // Amount of heal - depends from stacked Holy Energy
1191 int32 damageAmount = 0;
1192 if (AuraEffect const* aurEff = unitCaster->GetAuraEffect(45062, 0))
1193 {
1194 damageAmount += aurEff->GetAmount();
1195 unitCaster->RemoveAurasDueToSpell(45062);
1196 }
1197
1198 addhealth += damageAmount;
1199 }
1200 // Death Pact - return pct of max health to caster
1202 addhealth = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, int32(unitCaster->CountPctFromMaxHealth(damage)), HEAL, *effectInfo, 1, this);
1203 else
1204 {
1205 uint32 bonus = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL, *effectInfo, 1, this);
1206 addhealth = bonus + uint32(bonus * variance);
1207 }
1208
1209 addhealth = unitTarget->SpellHealingBonusTaken(unitCaster, m_spellInfo, addhealth, HEAL);
1210
1211 // Remove Grievious bite if fully healed
1212 if (unitTarget->HasAura(48920) && (unitTarget->GetHealth() + addhealth >= unitTarget->GetMaxHealth()))
1213 unitTarget->RemoveAura(48920);
1214
1215 m_healing += addhealth;
1216}
1217
1219{
1221 return;
1222
1223 if (!unitTarget || !unitTarget->IsAlive() || damage < 0)
1224 return;
1225
1227 if (Unit* unitCaster = GetUnitCasterForEffectHandlers())
1228 {
1229 heal = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, heal, HEAL, *effectInfo, 1, this);
1230 heal = unitTarget->SpellHealingBonusTaken(unitCaster, m_spellInfo, heal, HEAL);
1231 }
1232
1233 m_healing += heal;
1234}
1235
1237{
1239 return;
1240
1241 if (!unitTarget || !unitTarget->IsAlive() || damage < 0)
1242 return;
1243
1244 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1245 uint32 heal = damage;
1246 if (unitCaster)
1247 heal = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, heal, HEAL, *effectInfo, 1, this);
1248
1249 heal += uint32(heal * variance);
1250 if (unitCaster)
1251 heal = unitTarget->SpellHealingBonusTaken(unitCaster, m_spellInfo, heal, HEAL);
1252
1253 m_healing += heal;
1254}
1255
1257{
1259 return;
1260
1261 if (!unitTarget || !unitTarget->IsAlive() || damage < 0)
1262 return;
1263
1264 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1265 uint32 bonus = 0;
1266 if (unitCaster)
1268
1269 damage = bonus + uint32(bonus * variance);
1270
1271 if (unitCaster)
1273
1274 TC_LOG_DEBUG("spells", "HealthLeech :{}", damage);
1275
1276 float healMultiplier = effectInfo->CalcValueMultiplier(unitCaster, this);
1277
1278 m_damage += damage;
1279
1281 Unit::CalcAbsorbResist(damageInfo);
1282 uint32 const absorb = damageInfo.GetAbsorb();
1283 damage -= absorb;
1284
1285 // get max possible damage, don't count overkill for heal
1286 uint32 healthGain = uint32(-unitTarget->GetHealthGain(-damage) * healMultiplier);
1287
1288 if (unitCaster && unitCaster->IsAlive())
1289 {
1290 healthGain = unitCaster->SpellHealingBonusDone(unitCaster, m_spellInfo, healthGain, HEAL, *effectInfo, 1, this);
1291 healthGain = unitCaster->SpellHealingBonusTaken(unitCaster, m_spellInfo, healthGain, HEAL);
1292
1293 HealInfo healInfo(unitCaster, unitCaster, healthGain, m_spellInfo, m_spellSchoolMask);
1294 unitCaster->HealBySpell(healInfo);
1295 }
1296}
1297
1298void Spell::DoCreateItem(uint32 itemId, ItemContext context /*= ItemContext::NONE*/, std::vector<int32> const* bonusListIDs /*= nullptr*/)
1299{
1301 return;
1302
1303 Player* player = unitTarget->ToPlayer();
1304
1305 uint32 newitemid = itemId;
1306 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(newitemid);
1307 if (!pProto)
1308 {
1309 player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
1310 return;
1311 }
1312
1313 uint32 num_to_add = damage;
1314
1315 if (num_to_add < 1)
1316 num_to_add = 1;
1317 if (num_to_add > pProto->GetMaxStackSize())
1318 num_to_add = pProto->GetMaxStackSize();
1319
1320 /* == gem perfection handling == */
1321 // this is bad, should be done using spell_loot_template (and conditions)
1322
1323 // the chance of getting a perfect result
1324 float perfectCreateChance = 0.0f;
1325 // the resulting perfect item if successful
1326 uint32 perfectItemType = itemId;
1327 // get perfection capability and chance
1328 if (CanCreatePerfectItem(player, m_spellInfo->Id, perfectCreateChance, perfectItemType))
1329 if (roll_chance_f(perfectCreateChance)) // if the roll succeeds...
1330 newitemid = perfectItemType; // the perfect item replaces the regular one
1331
1332 /* == gem perfection handling over == */
1333
1334 /* == profession specialization handling == */
1335
1336 // init items_count to 1, since 1 item will be created regardless of specialization
1337 int items_count=1;
1338 // the chance to create additional items
1339 float additionalCreateChance=0.0f;
1340 // the maximum number of created additional items
1341 uint8 additionalMaxNum=0;
1342 // get the chance and maximum number for creating extra items
1343 if (CanCreateExtraItems(player, m_spellInfo->Id, additionalCreateChance, additionalMaxNum))
1344 // roll with this chance till we roll not to create or we create the max num
1345 while (roll_chance_f(additionalCreateChance) && items_count <= additionalMaxNum)
1346 ++items_count;
1347
1348 // really will be created more items
1349 num_to_add *= items_count;
1350
1351 /* == profession specialization handling over == */
1352
1353 // can the player store the new item?
1354 ItemPosCountVec dest;
1355 uint32 no_space = 0;
1356 InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, newitemid, num_to_add, &no_space);
1357 if (msg != EQUIP_ERR_OK)
1358 {
1359 // convert to possible store amount
1360 if (msg == EQUIP_ERR_INV_FULL || msg == EQUIP_ERR_ITEM_MAX_COUNT)
1361 num_to_add -= no_space;
1362 else
1363 {
1364 // if not created by another reason from full inventory or unique items amount limitation
1365 player->SendEquipError(msg, nullptr, nullptr, newitemid);
1366 return;
1367 }
1368 }
1369
1370 if (num_to_add)
1371 {
1372 // create the new item and store it
1373 if (Item* pItem = player->StoreNewItem(dest, newitemid, true, GenerateItemRandomBonusListId(newitemid), GuidSet(), context, bonusListIDs))
1374 {
1375 // set the "Crafted by ..." property of the item
1376 if (pItem->GetTemplate()->HasSignature())
1377 pItem->SetCreator(player->GetGUID());
1378
1379 // send info to the client
1380 player->SendNewItem(pItem, num_to_add, true, true);
1381
1382 if (pItem->GetQuality() > ITEM_QUALITY_EPIC || (pItem->GetQuality() == ITEM_QUALITY_EPIC && pItem->GetItemLevel(player) >= MinNewsItemLevel))
1383 if (Guild* guild = player->GetGuild())
1384 guild->AddGuildNews(GUILD_NEWS_ITEM_CRAFTED, player->GetGUID(), 0, pProto->GetId());
1385 }
1386
1387 // we succeeded in creating at least one item, so a levelup is possible
1389 }
1390}
1391
1393{
1395 return;
1396
1399}
1400
1402{
1404 return;
1405
1407 return;
1408
1409 Player* player = unitTarget->ToPlayer();
1410
1412
1413 // Pick a random item from spell_loot_template
1415 {
1416 player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell, context, false, true);
1418 }
1419 else // If there's no random loot entries for this spell, pick the item associated with this spell
1420 {
1421 uint32 item_id = effectInfo->ItemType;
1422
1423 if (item_id)
1424 DoCreateItem(item_id, context);
1425 }
1426
1428}
1429
1431{
1433 return;
1434
1436 return;
1437 Player* player = unitTarget->ToPlayer();
1438
1439 // create some random items
1442}
1443
1445{
1447 return;
1448
1449 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1450 if (!unitCaster)
1451 return;
1452
1453 // only handle at last effect
1454 for (size_t i = effectInfo->EffectIndex + 1; i < m_spellInfo->GetEffects().size(); ++i)
1456 return;
1457
1459
1460 float radius = effectInfo->CalcRadius(unitCaster);
1461
1462 // Caster not in world, might be spell triggered from aura removal
1463 if (!unitCaster->IsInWorld())
1464 return;
1465
1466 DynamicObject* dynObj = new DynamicObject(false);
1468 {
1469 delete dynObj;
1470 return;
1471 }
1472
1474 createInfo
1475 .SetCaster(unitCaster)
1478
1479 if (Aura* aura = Aura::TryCreate(createInfo))
1480 {
1481 _dynObjAura = aura->ToDynObjAura();
1483 }
1484 else
1485 return;
1486
1489}
1490
1492{
1494 return;
1495
1496 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1497 if (!unitCaster || !unitTarget)
1498 return;
1499
1500 if (!unitTarget->IsAlive())
1501 return;
1502
1504 return;
1505
1507 if (unitTarget->GetMaxPower(power) == 0)
1508 return;
1509
1510 // Some level depends spells
1511 switch (m_spellInfo->Id)
1512 {
1513 case 24571: // Blood Fury
1514 // Instantly increases your rage by ${(300-10*$max(0,$PL-60))/10}.
1515 damage -= 10 * std::max(0, std::min(30, unitCaster->GetLevel() - 60));
1516 break;
1517 case 24532: // Burst of Energy
1518 // Instantly increases your energy by ${60-4*$max(0,$min(15,$PL-60))}.
1519 damage -= 4 * std::max(0, std::min(15, unitCaster->GetLevel() - 60));
1520 break;
1521 case 67490: // Runic Mana Injector (mana gain increased by 25% for engineers - 3.2.0 patch change)
1522 {
1523 if (Player* player = unitCaster->ToPlayer())
1524 if (player->HasSkill(SKILL_ENGINEERING))
1525 AddPct(damage, 25);
1526 break;
1527 }
1528 default:
1529 break;
1530 }
1531
1532 unitCaster->EnergizeBySpell(unitTarget, m_spellInfo, damage, power);
1533}
1534
1536{
1538 return;
1539
1540 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1541 if (!unitCaster || !unitTarget)
1542 return;
1543
1544 if (!unitTarget->IsAlive())
1545 return;
1546
1548 return;
1549
1551 uint32 maxPower = unitTarget->GetMaxPower(power);
1552 if (!maxPower)
1553 return;
1554
1555 uint32 const gain = CalculatePct(maxPower, damage);
1556 unitCaster->EnergizeBySpell(unitTarget, m_spellInfo, gain, power);
1557}
1558
1560{
1562 return;
1563
1565 {
1566 TC_LOG_DEBUG("spells", "WORLD: Open Lock - No Player Caster!");
1567 return;
1568 }
1569
1570 Player* player = m_caster->ToPlayer();
1571
1572 uint32 lockId = 0;
1573 ObjectGuid guid;
1574
1575 // Get lockId
1576 if (gameObjTarget)
1577 {
1578 GameObjectTemplate const* goInfo = gameObjTarget->GetGOInfo();
1579
1580 if (goInfo->GetNoDamageImmune() && player->HasUnitFlag(UNIT_FLAG_IMMUNE))
1581 return;
1582
1583 if (goInfo->type == GAMEOBJECT_TYPE_FLAGSTAND)
1584 {
1585 //CanUseBattlegroundObject() already called in CheckCast()
1586 // in battleground check
1587 if (Battleground* bg = player->GetBattleground())
1588 {
1589 if (bg->GetTypeID() == BATTLEGROUND_EY)
1590 bg->EventPlayerClickedOnFlag(player, gameObjTarget);
1591 return;
1592 }
1593 }
1595 {
1597 return;
1598 }
1600 // handle outdoor pvp object opening, return true if go was registered for handling
1601 // these objects must have been spawned by outdoorpvp!
1602 else if (gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_GOOBER && sOutdoorPvPMgr->HandleOpenGo(player, gameObjTarget))
1603 return;
1604 lockId = goInfo->GetLockId();
1605 guid = gameObjTarget->GetGUID();
1606 }
1607 else if (itemTarget)
1608 {
1609 lockId = itemTarget->GetTemplate()->GetLockID();
1610 guid = itemTarget->GetGUID();
1611 }
1612 else
1613 {
1614 TC_LOG_DEBUG("spells", "WORLD: Open Lock - No GameObject/Item Target!");
1615 return;
1616 }
1617
1618 SkillType skillId = SKILL_NONE;
1619 int32 reqSkillValue = 0;
1620 int32 skillValue;
1621
1622 SpellCastResult res = CanOpenLock(*effectInfo, lockId, skillId, reqSkillValue, skillValue);
1623 if (res != SPELL_CAST_OK)
1624 {
1625 SendCastResult(res);
1626 return;
1627 }
1628
1629 if (gameObjTarget)
1630 gameObjTarget->Use(player);
1631 else if (itemTarget)
1632 {
1635 }
1636
1637 // not allow use skill grow at item base open
1638 if (!m_CastItem && skillId != SKILL_NONE)
1639 {
1640 // update skill if really known
1641 if (uint32 pureSkillValue = player->GetPureSkillValue(skillId))
1642 {
1643 if (gameObjTarget)
1644 {
1645 // Allow one skill-up until respawned
1646 if (!gameObjTarget->IsInSkillupList(player->GetGUID()))
1647 {
1648 player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue, 1, gameObjTarget);
1650 }
1651 }
1652 else if (itemTarget)
1653 {
1654 // Do one skill-up
1655 player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue);
1656 }
1657 }
1658 }
1660}
1661
1663{
1665 return;
1666
1668 return;
1669
1670 Player* player = m_caster->ToPlayer();
1671
1672 // applied only to using item
1673 if (!m_CastItem)
1674 return;
1675
1676 // ... only to item in own inventory/bank/equip_slot
1677 if (m_CastItem->GetOwnerGUID() != player->GetGUID())
1678 return;
1679
1680 uint32 newitemid = effectInfo->ItemType;
1681 if (!newitemid)
1682 return;
1683
1684 uint16 pos = m_CastItem->GetPos();
1685
1686 Item* pNewItem = Item::CreateItem(newitemid, 1, m_CastItem->GetContext(), player);
1687 if (!pNewItem)
1688 return;
1689
1693
1694 if (*m_CastItem->m_itemData->Durability < *m_CastItem->m_itemData->MaxDurability)
1695 {
1696 double lossPercent = 1 - *m_CastItem->m_itemData->Durability / double(m_CastItem->m_itemData->MaxDurability);
1697 player->DurabilityLoss(pNewItem, lossPercent);
1698 }
1699
1700 if (player->IsInventoryPos(pos))
1701 {
1702 ItemPosCountVec dest;
1703 InventoryResult msg = player->CanStoreItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true);
1704 if (msg == EQUIP_ERR_OK)
1705 {
1706 player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
1707
1708 // prevent crash at access and unexpected charges counting with item update queue corrupt
1710 m_targets.SetItemTarget(nullptr);
1711
1712 m_CastItem = nullptr;
1714 m_castItemEntry = 0;
1715 m_castItemLevel = -1;
1716
1717 player->StoreItem(dest, pNewItem, true);
1718 player->SendNewItem(pNewItem, 1, true, false);
1719 player->ItemAddedQuestCheck(newitemid, 1);
1720 return;
1721 }
1722 }
1723 else if (player->IsBankPos(pos))
1724 {
1725 ItemPosCountVec dest;
1726 if (player->CanBankItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true) == EQUIP_ERR_OK)
1727 {
1728 player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
1729
1730 // prevent crash at access and unexpected charges counting with item update queue corrupt
1732 m_targets.SetItemTarget(nullptr);
1733
1734 m_CastItem = nullptr;
1736 m_castItemEntry = 0;
1737 m_castItemLevel = -1;
1738
1739 player->BankItem(dest, pNewItem, true);
1740 return;
1741 }
1742 }
1743 else if (player->IsEquipmentPos(pos))
1744 {
1745 uint16 dest;
1746
1747 player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
1748
1749 InventoryResult msg = player->CanEquipItem(m_CastItem->GetSlot(), dest, pNewItem, true);
1750
1751 if (msg == EQUIP_ERR_OK || msg == EQUIP_ERR_CLIENT_LOCKED_OUT)
1752 {
1754
1755 // prevent crash at access and unexpected charges counting with item update queue corrupt
1757 m_targets.SetItemTarget(nullptr);
1758
1759 m_CastItem = nullptr;
1761 m_castItemEntry = 0;
1762 m_castItemLevel = -1;
1763
1764 player->EquipItem(dest, pNewItem, true);
1765 player->AutoUnequipOffhandIfNeed();
1766 player->SendNewItem(pNewItem, 1, true, false);
1767 player->ItemAddedQuestCheck(newitemid, 1);
1768 return;
1769 }
1770 }
1771
1772 // fail
1773 delete pNewItem;
1774}
1775
1777{
1779 return;
1780
1782 return;
1783 Player* p_target = m_caster->ToPlayer();
1784
1786 if (m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && !(p_target->GetWeaponProficiency() & subClassMask))
1787 {
1788 p_target->AddWeaponProficiency(subClassMask);
1790 }
1791 if (m_spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR && !(p_target->GetArmorProficiency() & subClassMask))
1792 {
1793 p_target->AddArmorProficiency(subClassMask);
1795 }
1796}
1797
1799{
1801 return;
1802
1803 uint32 entry = effectInfo->MiscValue;
1804 if (!entry)
1805 return;
1806
1807 SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(effectInfo->MiscValueB);
1808 if (!properties)
1809 {
1810 TC_LOG_ERROR("spells", "EffectSummonType: Unhandled summon type {}.", effectInfo->MiscValueB);
1811 return;
1812 }
1813
1814 WorldObject* caster = m_caster;
1815 if (m_originalCaster)
1816 caster = m_originalCaster;
1817
1818 ObjectGuid privateObjectOwner = [&]()
1819 {
1821 return ObjectGuid::Empty;
1822
1823 if (caster->IsPrivateObject())
1824 return caster->GetPrivateObjectOwner();
1825
1827 if (caster->IsPlayer() && m_originalCaster->ToPlayer()->GetGroup())
1828 return caster->ToPlayer()->GetGroup()->GetGUID();
1829
1830 return caster->GetGUID();
1831 }();
1832
1834
1835 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1836
1837 TempSummon* summon = nullptr;
1838
1839 // determine how many units should be summoned
1840 uint32 numSummons;
1841
1842 // some spells need to summon many units, for those spells number of summons is stored in effect value
1843 // however so far noone found a generic check to find all of those (there's no related data in summonproperties.dbc
1844 // and in spell attributes, possibly we need to add a table for those)
1845 // so here's a list of MiscValueB values, which is currently most generic check
1846 switch (effectInfo->MiscValueB)
1847 {
1848 case 64:
1849 case 61:
1850 case 1101:
1851 case 66:
1852 case 648:
1853 case 2301:
1854 case 1061:
1855 case 1261:
1856 case 629:
1857 case 181:
1858 case 715:
1859 case 1562:
1860 case 833:
1861 case 1161:
1862 case 713:
1863 numSummons = (damage > 0) ? damage : 1;
1864 break;
1865 default:
1866 numSummons = 1;
1867 break;
1868 }
1869
1870 switch (properties->Control)
1871 {
1875 {
1877 {
1878 SummonGuardian(effectInfo, entry, properties, numSummons, privateObjectOwner);
1879 break;
1880 }
1881
1882 switch (SummonTitle(properties->Title))
1883 {
1884 case SummonTitle::Pet:
1888 SummonGuardian(effectInfo, entry, properties, numSummons, privateObjectOwner);
1889 break;
1890 // Summons a vehicle, but doesn't force anyone to enter it (see SUMMON_CATEGORY_VEHICLE)
1892 case SummonTitle::Mount:
1893 {
1894 if (!unitCaster)
1895 return;
1896
1897 summon = unitCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, unitCaster, m_spellInfo->Id);
1898 break;
1899 }
1901 case SummonTitle::Totem:
1902 {
1903 if (!unitCaster)
1904 return;
1905
1906 summon = unitCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, unitCaster, m_spellInfo->Id, 0, privateObjectOwner);
1907 if (!summon || !summon->IsTotem())
1908 return;
1909
1910 if (damage) // if not spell info, DB values used
1911 {
1912 summon->SetMaxHealth(damage);
1913 summon->SetHealth(damage);
1914 }
1915 break;
1916 }
1918 {
1919 if (!unitCaster)
1920 return;
1921
1922 summon = unitCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, unitCaster, m_spellInfo->Id, 0, privateObjectOwner);
1923 if (!summon || !summon->HasUnitTypeMask(UNIT_MASK_MINION))
1924 return;
1925
1926 summon->SetImmuneToAll(true);
1927 break;
1928 }
1929 default:
1930 {
1931 float radius = effectInfo->CalcRadius();
1932
1934 if (duration == 0ms)
1935 summonType = TEMPSUMMON_DEAD_DESPAWN;
1936 else if (duration == -1ms)
1937 summonType = TEMPSUMMON_MANUAL_DESPAWN;
1938
1939 for (uint32 count = 0; count < numSummons; ++count)
1940 {
1941 Position pos;
1942 if (count == 0)
1943 pos = *destTarget;
1944 else
1945 // randomize position for multiple summons
1946 pos = caster->GetRandomPoint(*destTarget, radius);
1947
1948 summon = caster->GetMap()->SummonCreature(entry, pos, properties, duration, unitCaster, m_spellInfo->Id, 0, privateObjectOwner);
1949 if (!summon)
1950 continue;
1951
1952 summon->SetTempSummonType(summonType);
1953 if (properties->Control == SUMMON_CATEGORY_ALLY)
1954 summon->SetOwnerGUID(caster->GetGUID());
1955 else if (properties->Control == SUMMON_CATEGORY_WILD && caster->IsPlayer()) // there might be more conditions involved
1956 summon->SetDemonCreatorGUID(caster->GetGUID());
1957
1959 }
1960 return;
1961 }
1962 }
1963 break;
1964 }
1966 SummonGuardian(effectInfo, entry, properties, numSummons, privateObjectOwner);
1967 break;
1969 {
1970 if (!unitCaster)
1971 return;
1972
1973 summon = unitCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, unitCaster, m_spellInfo->Id, 0, privateObjectOwner);
1974 break;
1975 }
1977 {
1978 if (!unitCaster)
1979 return;
1980
1981 // Summoning spells (usually triggered by npc_spellclick) that spawn a vehicle and that cause the clicker
1982 // to cast a ride vehicle spell on the summoned unit.
1983 summon = unitCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, unitCaster, m_spellInfo->Id);
1984 if (!summon || !summon->IsVehicle())
1985 return;
1986
1987 // The spell that this effect will trigger. It has SPELL_AURA_CONTROL_VEHICLE
1989 int32 basePoints = effectInfo->CalcValue();
1990 if (basePoints > MAX_VEHICLE_SEATS)
1991 {
1992 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(basePoints, GetCastDifficulty());
1993 if (spellInfo && spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE))
1994 spellId = spellInfo->Id;
1995 }
1996
1998 args.SetTriggeringSpell(this);
1999
2000 // if we have small value, it indicates seat position
2001 if (basePoints > 0 && basePoints < MAX_VEHICLE_SEATS)
2002 args.AddSpellMod(SPELLVALUE_BASE_POINT0, basePoints);
2003
2004 unitCaster->CastSpell(summon, spellId, args);
2005 break;
2006 }
2007 }
2008
2009 if (summon)
2010 {
2011 summon->SetCreatorGUID(caster->GetGUID());
2013 }
2014}
2015
2017{
2019 return;
2020
2021 if (!unitTarget)
2022 return;
2023
2025 {
2026 if (unitTarget->ToPet())
2028 return;
2029 }
2030
2031 Player* player = unitTarget->ToPlayer();
2032
2034 {
2035 for (ItemEffectEntry const* itemEffect : m_CastItem->GetEffects())
2036 {
2037 if (itemEffect->TriggerType != ITEM_SPELLTRIGGER_ON_LEARN)
2038 continue;
2039
2040 bool dependent = false;
2041
2042 if (BattlePetSpeciesEntry const* speciesEntry = BattlePets::BattlePetMgr::GetBattlePetSpeciesBySpell(uint32(itemEffect->SpellID)))
2043 {
2044 player->GetSession()->GetBattlePetMgr()->AddPet(speciesEntry->ID, BattlePets::BattlePetMgr::SelectPetDisplay(speciesEntry),
2046 // If the spell summons a battle pet, we fake that it has been learned and the battle pet is added
2047 // marking as dependent prevents saving the spell to database (intended)
2048 dependent = true;
2049 }
2050
2051 player->LearnSpell(itemEffect->SpellID, dependent);
2052 }
2053 }
2054
2056 {
2057 player->LearnSpell(effectInfo->TriggerSpell, false);
2058 TC_LOG_DEBUG("spells", "Spell: Player {} has learned spell {} from Npc {}", player->GetGUID().ToString(), effectInfo->TriggerSpell, m_caster->GetGUID().ToString());
2059 }
2060}
2061
2063{
2065 return;
2066
2067 if (!unitTarget)
2068 return;
2069
2070 // Create dispel mask by dispel type
2071 uint32 dispel_type = effectInfo->MiscValue;
2072 uint32 dispelMask = SpellInfo::GetDispelMask(DispelType(dispel_type));
2073
2074 DispelChargesList dispelList;
2076 if (dispelList.empty())
2077 return;
2078
2079 size_t remaining = dispelList.size();
2080
2081 // Ok if exist some buffs for dispel try dispel it
2082 DispelChargesList successList;
2083 successList.reserve(damage);
2084
2086 dispelFailed.CasterGUID = m_caster->GetGUID();
2087 dispelFailed.VictimGUID = unitTarget->GetGUID();
2088 dispelFailed.SpellID = m_spellInfo->Id;
2089
2090 // dispel N = damage buffs (or while exist buffs for dispel)
2091 for (int32 count = 0; count < damage && remaining > 0;)
2092 {
2093 // Random select buff for dispel
2094 auto itr = dispelList.begin();
2095 std::advance(itr, urand(0, remaining - 1));
2096
2097 if (itr->RollDispel())
2098 {
2099 auto successItr = std::find_if(successList.begin(), successList.end(), [&itr](DispelableAura& dispelAura) -> bool
2100 {
2101 if (dispelAura.GetAura()->GetId() == itr->GetAura()->GetId() && dispelAura.GetAura()->GetCaster() == itr->GetAura()->GetCaster())
2102 return true;
2103
2104 return false;
2105 });
2106
2107 uint8 dispelledCharges = 1;
2108 if (itr->GetAura()->GetSpellInfo()->HasAttribute(SPELL_ATTR1_DISPEL_ALL_STACKS))
2109 dispelledCharges = itr->GetDispelCharges();
2110
2111 if (successItr == successList.end())
2112 successList.emplace_back(itr->GetAura(), 0, dispelledCharges);
2113 else
2114 successItr->IncrementCharges();
2115
2116 if (!itr->DecrementCharge(dispelledCharges))
2117 {
2118 --remaining;
2119 std::swap(*itr, dispelList[remaining]);
2120 }
2121 }
2122 else
2123 {
2124 dispelFailed.FailedSpells.push_back(int32(itr->GetAura()->GetId()));
2125 }
2126 ++count;
2127 }
2128
2129 if (!dispelFailed.FailedSpells.empty())
2130 m_caster->SendMessageToSet(dispelFailed.Write(), true);
2131
2132 if (successList.empty())
2133 return;
2134
2136 spellDispellLog.IsBreak = false; // TODO: use me
2137 spellDispellLog.IsSteal = false;
2138
2139 spellDispellLog.TargetGUID = unitTarget->GetGUID();
2140 spellDispellLog.CasterGUID = m_caster->GetGUID();
2141 spellDispellLog.DispelledBySpellID = m_spellInfo->Id;
2142
2143 for (DispelableAura const& dispelableAura : successList)
2144 {
2146 dispellData.SpellID = dispelableAura.GetAura()->GetId();
2147 dispellData.Harmful = false; // TODO: use me
2148
2149 unitTarget->RemoveAurasDueToSpellByDispel(dispelableAura.GetAura()->GetId(), m_spellInfo->Id, dispelableAura.GetAura()->GetCasterGUID(), m_caster, dispelableAura.GetDispelCharges());
2150
2151 spellDispellLog.DispellData.emplace_back(dispellData);
2152 }
2153
2154 m_caster->SendMessageToSet(spellDispellLog.Write(), true);
2155
2157
2159}
2160
2162{
2164 return;
2165
2167}
2168
2170{
2172 return;
2173
2174 // Check for possible target
2175 if (!unitTarget || unitTarget->IsEngaged())
2176 return;
2177
2178 // target must be OK to do this
2180 return;
2181
2183}
2184
2186{
2188 return;
2189
2190 Player* player = m_caster->ToPlayer();
2192 return;
2193
2195 if (!creature)
2196 return;
2197
2198 if (creature->CanGeneratePickPocketLoot())
2199 {
2200 creature->StartPickPocketRefillTimer();
2201
2202 creature->m_loot.reset(new Loot(creature->GetMap(), creature->GetGUID(), LOOT_PICKPOCKETING, nullptr));
2203 if (uint32 lootid = creature->GetCreatureDifficulty()->PickPocketLootID)
2204 creature->m_loot->FillLoot(lootid, LootTemplates_Pickpocketing, player, true);
2205
2206 // Generate extra money for pick pocket loot
2207 const uint32 a = urand(0, creature->GetLevel() / 2);
2208 const uint32 b = urand(0, player->GetLevel() / 2);
2209 creature->m_loot->gold = uint32(10 * (a + b) * sWorld->getRate(RATE_DROP_MONEY));
2210 }
2211 else if (creature->m_loot)
2212 {
2213 if (creature->m_loot->loot_type == LOOT_PICKPOCKETING && creature->m_loot->isLooted())
2214 player->SendLootError(creature->m_loot->GetGUID(), creature->GetGUID(), LOOT_ERROR_ALREADY_PICKPOCKETED);
2215
2216 return;
2217 }
2218
2219 player->SendLoot(*creature->m_loot);
2220}
2221
2223{
2225 return;
2226
2227 Player* player = m_caster->ToPlayer();
2228 if (!player)
2229 return;
2230
2231 float radius = effectInfo->CalcRadius();
2233 // Caster not in world, might be spell triggered from aura removal
2234 if (!player->IsInWorld())
2235 return;
2236
2237 DynamicObject* dynObj = new DynamicObject(true);
2239 {
2240 delete dynObj;
2241 return;
2242 }
2243
2244 dynObj->SetDuration(duration);
2245 dynObj->SetCasterViewpoint();
2246}
2247
2249{
2251 return;
2252
2254 return;
2255
2257}
2258
2260{
2262 return;
2263
2264 if (!unitTarget)
2265 return;
2266
2267 if (unitTarget->IsInFlight())
2268 return;
2269
2270 if (m_targets.HasDst())
2272}
2273
2275{
2277 return;
2278
2279 Player* playerTarget = Object::ToPlayer(unitTarget);
2280 if (!playerTarget)
2281 return;
2282
2283 if (damage < 1)
2284 return;
2285
2286 uint32 skillid = effectInfo->MiscValue;
2287 SkillRaceClassInfoEntry const* rcEntry = sDB2Manager.GetSkillRaceClassInfo(skillid, playerTarget->GetRace(), playerTarget->GetClass());
2288 if (!rcEntry)
2289 return;
2290
2291 SkillTiersEntry const* tier = sObjectMgr->GetSkillTier(rcEntry->SkillTierID);
2292 if (!tier)
2293 return;
2294
2295 uint16 skillval = std::max<uint16>(1, playerTarget->GetPureSkillValue(skillid));
2296 uint16 maxSkillVal = tier->GetValueForTierIndex(damage - 1);
2297
2298 if (rcEntry->Flags & SKILL_FLAG_ALWAYS_MAX_VALUE)
2299 skillval = maxSkillVal;
2300
2301 playerTarget->SetSkill(skillid, damage, skillval, maxSkillVal);
2302}
2303
2305{
2307 return;
2308
2310 return;
2311
2312 uint32 movieId = effectInfo->MiscValue;
2313 if (!sMovieStore.LookupEntry(movieId))
2314 return;
2315
2316 unitTarget->ToPlayer()->SendMovieStart(movieId);
2317}
2318
2320{
2322 return;
2323
2325 return;
2326 // uint32 skillid = m_spellInfo->Effects[i].MiscValue;
2327 // uint16 skillmax = unitTarget->ToPlayer()->(skillid);
2328 // m_caster->ToPlayer()->SetSkill(skillid, skillval?skillval:1, skillmax+75);
2329}
2330
2332{
2334 return;
2335
2336 if (!itemTarget)
2337 return;
2338
2339 Player* player = m_caster->ToPlayer();
2340 if (!player)
2341 return;
2342
2343 // Handle vellums
2344 if (itemTarget->IsVellum())
2345 {
2346 // destroy one vellum from stack
2347 uint32 count = 1;
2348 player->DestroyItemCount(itemTarget, count, true);
2349 unitTarget = player;
2350 // and add a scroll
2351 damage = 1;
2353 itemTarget = nullptr;
2354 m_targets.SetItemTarget(nullptr);
2355 }
2356 else
2357 {
2358 // do not increase skill if vellum used
2361
2362 uint32 enchant_id = effectInfo->MiscValue;
2363 if (!enchant_id)
2364 return;
2365
2366 SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
2367 if (!pEnchant)
2368 return;
2369
2370 // item can be in trade slot and have owner diff. from caster
2371 Player* item_owner = itemTarget->GetOwner();
2372 if (!item_owner)
2373 return;
2374
2375 if (item_owner != player && player->GetSession()->HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE))
2376 {
2377 sLog->OutCommand(player->GetSession()->GetAccountId(), "GM {} (Account: {}) enchanting(perm): {} (Entry: {}) for player: {} (Account: {})",
2378 player->GetName(), player->GetSession()->GetAccountId(),
2380 item_owner->GetName(), item_owner->GetSession()->GetAccountId());
2381 }
2382
2383 // remove old enchanting before applying new if equipped
2385
2387
2388 // add new enchanting if equipped
2390
2391 item_owner->RemoveTradeableItem(itemTarget);
2393 }
2394}
2395
2397{
2399 return;
2400
2401 if (!itemTarget)
2402 return;
2403
2404 Player* player = m_caster->ToPlayer();
2405 if (!player)
2406 return;
2407
2408 uint32 enchantId = effectInfo->MiscValue;
2409 if (!enchantId)
2410 return;
2411
2412 SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId);
2413 if (!enchant)
2414 return;
2415
2416 // support only enchantings with add socket in this slot
2417 {
2418 bool add_socket = false;
2419 for (uint8 i = 0; i < MAX_ITEM_ENCHANTMENT_EFFECTS; ++i)
2420 {
2422 {
2423 add_socket = true;
2424 break;
2425 }
2426 }
2427 if (!add_socket)
2428 {
2429 TC_LOG_ERROR("spells", "Spell::EffectEnchantItemPrismatic: attempt to apply the enchant spell {} with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC ({}), but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET ({}), not supported yet.",
2431 return;
2432 }
2433 }
2434
2435 // item can be in trade slot and have owner diff. from caster
2436 Player* item_owner = itemTarget->GetOwner();
2437 if (!item_owner)
2438 return;
2439
2440 if (item_owner != player && player->GetSession()->HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE))
2441 {
2442 sLog->OutCommand(player->GetSession()->GetAccountId(), "GM {} (Account: {}) enchanting(perm): {} (Entry: {}) for player: {} (Account: {})",
2443 player->GetName(), player->GetSession()->GetAccountId(),
2445 item_owner->GetName(), item_owner->GetSession()->GetAccountId());
2446 }
2447
2448 // remove old enchanting before applying new if equipped
2450
2452
2453 // add new enchanting if equipped
2455
2456 item_owner->RemoveTradeableItem(itemTarget);
2458}
2459
2461{
2463 return;
2464
2465 if (!itemTarget)
2466 return;
2467
2468 Player* player = m_caster->ToPlayer();
2469 if (!player)
2470 return;
2471
2472 uint32 enchant_id = effectInfo->MiscValue;
2473
2474 if (!enchant_id)
2475 {
2476 TC_LOG_ERROR("spells", "Spell {} Effect {} (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) has enchanting id 0.", m_spellInfo->Id, effectInfo->EffectIndex);
2477 return;
2478 }
2479
2480 SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
2481 if (!pEnchant)
2482 {
2483 TC_LOG_ERROR("spells", "Spell {} Effect {} (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) has a non-existing enchanting id {} ", m_spellInfo->Id, effectInfo->EffectIndex, enchant_id);
2484 return;
2485 }
2486
2487 // select enchantment duration
2488 uint32 duration = pEnchant->Duration;
2489
2490 // item can be in trade slot and have owner diff. from caster
2491 Player* item_owner = itemTarget->GetOwner();
2492 if (!item_owner)
2493 return;
2494
2495 if (item_owner != player && player->GetSession()->HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE))
2496 {
2497 sLog->OutCommand(player->GetSession()->GetAccountId(), "GM {} (Account: {}) enchanting(temp): {} (Entry: {}) for player: {} (Account: {})",
2498 player->GetName(), player->GetSession()->GetAccountId(),
2500 item_owner->GetName(), item_owner->GetSession()->GetAccountId());
2501 }
2502
2503 // remove old enchanting before applying new if equipped
2505
2506 itemTarget->SetEnchantment(TEMP_ENCHANTMENT_SLOT, enchant_id, duration * 1000, 0, m_caster->GetGUID());
2507
2508 // add new enchanting if equipped
2510}
2511
2513{
2515 return;
2516
2517 Unit* unitCaster = GetUnitCasterForEffectHandlers();
2518 if (!unitCaster || !unitCaster->GetPetGUID().IsEmpty())
2519 return;
2520
2521 if (!unitTarget)
2522 return;
2523
2525 return;
2526
2527 Creature* creatureTarget = unitTarget->ToCreature();
2528
2529 if (creatureTarget->IsPet())
2530 return;
2531
2532 if (unitCaster->GetClass() != CLASS_HUNTER)
2533 return;
2534
2535 // cast finish successfully
2536 //SendChannelUpdate(0);
2537 finish();
2538
2539 Pet* pet = unitCaster->CreateTamedPetFrom(creatureTarget, m_spellInfo->Id);
2540 if (!pet) // in very specific state like near world end/etc.
2541 return;
2542
2543 // "kill" original creature
2544 creatureTarget->DespawnOrUnsummon();
2545
2546 uint8 level = (creatureTarget->GetLevelForTarget(m_caster) < (m_caster->GetLevelForTarget(creatureTarget) - 5)) ? (m_caster->GetLevelForTarget(creatureTarget) - 5) : creatureTarget->GetLevelForTarget(m_caster);
2547
2548 // prepare visual effect for levelup
2549 pet->SetLevel(level - 1);
2550
2551 // add to world
2552 pet->GetMap()->AddToMap(pet->ToCreature());
2553
2554 // visual effect for levelup
2555 pet->SetLevel(level);
2556
2557 // caster have pet now
2558 unitCaster->SetMinion(pet, true);
2559
2560 if (unitCaster->GetTypeId() == TYPEID_PLAYER)
2561 {
2563 unitCaster->ToPlayer()->PetSpellInitialize();
2564 }
2565}
2566
2568{
2570 return;
2571
2572 Player* owner = nullptr;
2573 if (Unit* unitCaster = GetUnitCasterForEffectHandlers())
2574 {
2575 owner = unitCaster->ToPlayer();
2576 if (!owner && unitCaster->IsTotem())
2577 owner = unitCaster->GetCharmerOrOwnerPlayerOrPlayerItself();
2578 }
2579
2580 uint32 petentry = effectInfo->MiscValue;
2581
2582 if (!owner)
2583 {
2584 SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(67);
2585 if (properties)
2586 SummonGuardian(effectInfo, petentry, properties, 1, ObjectGuid::Empty);
2587 return;
2588 }
2589
2590 Pet* OldSummon = owner->GetPet();
2591
2592 // if pet requested type already exist
2593 if (OldSummon)
2594 {
2595 if (petentry == 0 || OldSummon->GetEntry() == petentry)
2596 {
2597 // pet in corpse state can't be summoned
2598 if (OldSummon->isDead())
2599 return;
2600
2601 ASSERT(OldSummon->GetMap() == owner->GetMap());
2602
2603 //OldSummon->GetMap()->Remove(OldSummon->ToCreature(), false);
2604
2605 float px, py, pz;
2606 owner->GetClosePoint(px, py, pz, OldSummon->GetCombatReach());
2607
2608 OldSummon->NearTeleportTo(px, py, pz, OldSummon->GetOrientation());
2609 //OldSummon->Relocate(px, py, pz, OldSummon->GetOrientation());
2610 //OldSummon->SetMap(owner->GetMap());
2611 //owner->GetMap()->Add(OldSummon->ToCreature());
2612
2613 if (owner->GetTypeId() == TYPEID_PLAYER && OldSummon->isControlled())
2614 owner->ToPlayer()->PetSpellInitialize();
2615
2616 return;
2617 }
2618
2619 if (owner->GetTypeId() == TYPEID_PLAYER)
2620 owner->ToPlayer()->RemovePet(OldSummon, PET_SAVE_NOT_IN_SLOT, false);
2621 else
2622 return;
2623 }
2624
2625 Optional<PetSaveMode> petSlot;
2626 if (!petentry)
2627 petSlot = PetSaveMode(damage);
2628
2629 float x, y, z;
2630 owner->GetClosePoint(x, y, z, owner->GetCombatReach());
2631 bool isNew = false;
2632 Pet* pet = owner->SummonPet(petentry, petSlot, x, y, z, owner->GetOrientation(), 0, &isNew);
2633 if (!pet)
2634 return;
2635
2636 if (isNew)
2637 {
2638 if (m_caster->GetTypeId() == TYPEID_UNIT)
2639 {
2640 if (m_caster->ToCreature()->IsTotem())
2642 else
2644 }
2645
2647
2648 // generate new name for summon pet
2649 std::string new_name = sObjectMgr->GeneratePetName(petentry);
2650 if (!new_name.empty())
2651 pet->SetName(new_name);
2652 }
2653
2655}
2656
2658{
2660 return;
2661
2662 if (!unitTarget)
2663 return;
2664
2665 if (unitTarget->ToPlayer())
2666 {
2668 return;
2669 }
2670 Pet* pet = unitTarget->ToPet();
2671 if (!pet)
2672 return;
2673
2674 SpellInfo const* learn_spellproto = sSpellMgr->GetSpellInfo(effectInfo->TriggerSpell, DIFFICULTY_NONE);
2675 if (!learn_spellproto)
2676 return;
2677
2678 pet->learnSpell(learn_spellproto->Id);
2680 pet->GetOwner()->PetSpellInitialize();
2681}
2682
2684{
2686 return;
2687
2688 Unit* unitCaster = GetUnitCasterForEffectHandlers();
2689 if (!unitCaster)
2690 return;
2691
2692 // this effect use before aura Taunt apply for prevent taunt already attacking target
2693 // for spell as marked "non effective at already attacking target"
2694 if (!unitTarget || unitTarget->IsTotem())
2695 {
2697 return;
2698 }
2699
2700 // Hand of Reckoning can hit some entities that can't have a threat list (including players' pets)
2701 if (m_spellInfo->Id == 62124)
2702 if (unitTarget->GetTypeId() != TYPEID_PLAYER && unitTarget->GetTarget() != unitCaster->GetGUID())
2703 unitCaster->CastSpell(unitTarget, 67485, true);
2704
2706 {
2708 return;
2709 }
2710
2712 if (mgr.GetCurrentVictim() == unitCaster)
2713 {
2715 return;
2716 }
2717
2718 if (!mgr.IsThreatListEmpty())
2719 // Set threat equal to highest threat currently on target
2720 mgr.MatchUnitThreatToHighestThreat(unitCaster);
2721}
2722
2724{
2726 return;
2727
2728 Unit* unitCaster = GetUnitCasterForEffectHandlers();
2729 if (!unitCaster)
2730 return;
2731
2732 if (!unitTarget || !unitTarget->IsAlive())
2733 return;
2734
2735 // multiple weapon dmg effect workaround
2736 // execute only the last weapon damage
2737 // and handle all effects at once
2738 for (size_t j = effectInfo->EffectIndex + 1; j < m_spellInfo->GetEffects().size(); ++j)
2739 {
2740 switch (m_spellInfo->GetEffect(SpellEffIndex(j)).Effect)
2741 {
2746 return; // we must calculate only at last weapon effect
2747 default:
2748 break;
2749 }
2750 }
2751
2752 // some spell specific modifiers
2753 float totalDamagePercentMod = 1.0f; // applied to final bonus+weapon damage
2754 int32 fixed_bonus = 0;
2755 int32 spell_bonus = 0; // bonus specific for spell
2756
2758 {
2759 case SPELLFAMILY_SHAMAN:
2760 {
2761 // Skyshatter Harness item set bonus
2762 // Stormstrike
2763 if (AuraEffect* aurEff = unitCaster->IsScriptOverriden(m_spellInfo, 5634))
2764 unitCaster->CastSpell(nullptr, 38430, aurEff);
2765 break;
2766 }
2767 }
2768
2769 bool normalized = false;
2770 float weaponDamagePercentMod = 1.0f;
2771 for (SpellEffectInfo const& spellEffectInfo : m_spellInfo->GetEffects())
2772 {
2773 switch (spellEffectInfo.Effect)
2774 {
2777 fixed_bonus += CalculateDamage(spellEffectInfo, unitTarget);
2778 break;
2780 fixed_bonus += CalculateDamage(spellEffectInfo, unitTarget);
2781 normalized = true;
2782 break;
2784 ApplyPct(weaponDamagePercentMod, CalculateDamage(spellEffectInfo, unitTarget));
2785 break;
2786 default:
2787 break; // not weapon damage effect, just skip
2788 }
2789 }
2790
2791 // if (addPctMods) { percent mods are added in Unit::CalculateDamage } else { percent mods are added in Unit::MeleeDamageBonusDone }
2792 // this distinction is neccessary to properly inform the client about his autoattack damage values from Script_UnitDamage
2794 if (addPctMods)
2795 {
2796 UnitMods unitMod;
2797 switch (m_attackType)
2798 {
2799 default:
2800 case BASE_ATTACK: unitMod = UNIT_MOD_DAMAGE_MAINHAND; break;
2801 case OFF_ATTACK: unitMod = UNIT_MOD_DAMAGE_OFFHAND; break;
2802 case RANGED_ATTACK: unitMod = UNIT_MOD_DAMAGE_RANGED; break;
2803 }
2804
2805 float weapon_total_pct = unitCaster->GetPctModifierValue(unitMod, TOTAL_PCT);
2806 if (fixed_bonus)
2807 fixed_bonus = int32(fixed_bonus * weapon_total_pct);
2808 if (spell_bonus)
2809 spell_bonus = int32(spell_bonus * weapon_total_pct);
2810 }
2811
2812 int32 weaponDamage = unitCaster->CalculateDamage(m_attackType, normalized, addPctMods);
2813 Mechanics mechanic = MECHANIC_NONE;
2814
2815 // Sequence is important
2816 for (SpellEffectInfo const& spellEffectInfo : m_spellInfo->GetEffects())
2817 {
2818 // We assume that a spell have at most one fixed_bonus
2819 // and at most one weaponDamagePercentMod
2820 switch (spellEffectInfo.Effect)
2821 {
2825 weaponDamage += fixed_bonus;
2826 break;
2828 weaponDamage = int32(weaponDamage * weaponDamagePercentMod);
2829 break;
2830 default:
2831 continue; // not weapon damage effect, just skip
2832 }
2833
2834 if (spellEffectInfo.Mechanic != MECHANIC_NONE && mechanic == MECHANIC_NONE)
2835 mechanic = spellEffectInfo.Mechanic;
2836 }
2837
2838 weaponDamage += spell_bonus;
2839 weaponDamage = int32(weaponDamage * totalDamagePercentMod);
2840
2841 // prevent negative damage
2842 weaponDamage = std::max(weaponDamage, 0);
2843
2844 // Add melee damage bonuses (also check for negative)
2845 weaponDamage = unitCaster->MeleeDamageBonusDone(unitTarget, weaponDamage, m_attackType, SPELL_DIRECT_DAMAGE, m_spellInfo, mechanic, m_spellSchoolMask, this);
2847}
2848
2850{
2852 return;
2853
2854 Unit* unitCaster = GetUnitCasterForEffectHandlers();
2855 if (!unitCaster || !unitCaster->IsAlive())
2856 return;
2857
2858 if (!unitTarget)
2859 return;
2860
2862 return;
2863
2864 unitTarget->GetThreatManager().AddThreat(unitCaster, float(damage), m_spellInfo, true);
2865}
2866
2868{
2870 return;
2871
2872 Unit* unitCaster = GetUnitCasterForEffectHandlers();
2873 if (!unitCaster)
2874 return;
2875
2876 if (!unitTarget || !unitTarget->IsAlive())
2877 return;
2878
2879 int32 addhealth = 0;
2880
2881 // damage == 0 - heal for caster max health
2882 if (damage == 0)
2883 addhealth = unitCaster->GetMaxHealth();
2884 else
2885 addhealth = unitTarget->GetMaxHealth() - unitTarget->GetHealth();
2886
2887 m_healing += addhealth;
2888}
2889
2891{
2893 return;
2894
2895 if (!unitTarget || !unitTarget->IsAlive())
2896 return;
2897
2899 // also exist case: apply cooldown to interrupted cast only and to all spells
2900 // there is no CURRENT_AUTOREPEAT_SPELL spells that can be interrupted
2902 {
2904 {
2905 SpellInfo const* curSpellInfo = spell->m_spellInfo;
2906 // check if we can interrupt spell
2907 if ((spell->getState() == SPELL_STATE_CASTING
2908 || (spell->getState() == SPELL_STATE_PREPARING && spell->GetCastTime() > 0.0f))
2909 && curSpellInfo->CanBeInterrupted(m_caster, unitTarget))
2910 {
2911 int32 duration = m_spellInfo->GetDuration();
2912 duration = unitTarget->ModSpellDuration(m_spellInfo, unitTarget, duration, false, 1 << effectInfo->EffectIndex);
2915 SendSpellInterruptLog(unitTarget, curSpellInfo->Id);
2917 }
2918 }
2919 }
2920}
2921
2923{
2925 return;
2926
2927 WorldObject* target = focusObject;
2928 if (!target)
2929 target = m_caster;
2930
2931 float x, y, z, o;
2932 if (m_targets.HasDst())
2933 destTarget->GetPosition(x, y, z, o);
2934 else
2935 {
2937 o = target->GetOrientation();
2938 }
2939
2940 Map* map = target->GetMap();
2941 Position pos = Position(x, y, z, o);
2944 if (!go)
2945 return;
2946
2948
2950
2951 go->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
2953
2955
2956 // Wild object not have owner and check clickable by players
2957 map->AddToMap(go);
2958
2960 if (Player* player = m_caster->ToPlayer())
2961 if (Battleground* bg = player->GetBattleground())
2962 bg->SetDroppedFlagGUID(go->GetGUID(), bg->GetPlayerTeam(player->GetGUID()) == ALLIANCE ? TEAM_HORDE: TEAM_ALLIANCE);
2963
2964 if (GameObject* linkedTrap = go->GetLinkedTrap())
2965 {
2967
2968 linkedTrap->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
2969 linkedTrap->SetSpellId(m_spellInfo->Id);
2970
2972 }
2973}
2974
2976{
2978 return;
2979
2980 Unit* unitCaster = GetUnitCasterForEffectHandlers();
2981
2985 {
2987 {
2988 switch (m_spellInfo->Id)
2989 {
2990 // Shadow Flame (All script effects, not just end ones to prevent player from dodging the last triggered spell)
2991 case 22539:
2992 case 22972:
2993 case 22975:
2994 case 22976:
2995 case 22977:
2996 case 22978:
2997 case 22979:
2998 case 22980:
2999 case 22981:
3000 case 22982:
3001 case 22983:
3002 case 22984:
3003 case 22985:
3004 {
3005 if (!unitTarget || !unitTarget->IsAlive())
3006 return;
3007
3008 // Onyxia Scale Cloak
3009 if (unitTarget->HasAura(22683))
3010 return;
3011
3012 // Shadow Flame
3013 m_caster->CastSpell(unitTarget, 22682, this);
3014 return;
3015 }
3016 // Mug Transformation
3017 case 41931:
3018 {
3020 return;
3021
3022 uint8 bag = 19;
3023 uint8 slot = 0;
3024 Item* item = nullptr;
3025
3026 while (bag) // 256 = 0 due to var type
3027 {
3028 item = m_caster->ToPlayer()->GetItemByPos(bag, slot);
3029 if (item && item->GetEntry() == 38587)
3030 break;
3031
3032 ++slot;
3033 if (slot == 39)
3034 {
3035 slot = 0;
3036 ++bag;
3037 }
3038 }
3039 if (bag)
3040 {
3041 if (m_caster->ToPlayer()->GetItemByPos(bag, slot)->GetCount() == 1) m_caster->ToPlayer()->RemoveItem(bag, slot, true);
3042 else m_caster->ToPlayer()->GetItemByPos(bag, slot)->SetCount(m_caster->ToPlayer()->GetItemByPos(bag, slot)->GetCount()-1);
3043 // Spell 42518 (Braufest - Gratisprobe des Braufest herstellen)
3044 m_caster->CastSpell(m_caster, 42518, this);
3045 return;
3046 }
3047 break;
3048 }
3049 // Brutallus - Burn
3050 case 45141:
3051 case 45151:
3052 {
3053 //Workaround for Range ... should be global for every ScriptEffect
3054 float radius = effectInfo->CalcRadius(nullptr, SpellTargetIndex::TargetB);
3056 unitTarget->CastSpell(unitTarget, 46394, this);
3057
3058 break;
3059 }
3060 // Summon Ghouls On Scarlet Crusade
3061 case 51904:
3062 {
3063 if (!m_targets.HasDst())
3064 return;
3065
3066 float radius = effectInfo->CalcRadius();
3067 for (uint8 i = 0; i < 15; ++i)
3068 m_caster->CastSpell(m_caster->GetRandomPoint(*destTarget, radius), 54522, this);
3069 break;
3070 }
3071 case 52173: // Coyote Spirit Despawn
3072 case 60243: // Blood Parrot Despawn
3075 return;
3076 case 57347: // Retrieving (Wintergrasp RP-GG pickup spell)
3077 {
3079 return;
3080
3082
3083 return;
3084 }
3085 case 57349: // Drop RP-GG (Wintergrasp RP-GG at death drop spell)
3086 {
3088 return;
3089
3090 // Delete item from inventory at death
3092
3093 return;
3094 }
3095 case 62482: // Grab Crate
3096 {
3097 if (!unitCaster)
3098 return;
3099
3100 if (unitTarget)
3101 {
3102 if (Unit* seat = unitCaster->GetVehicleBase())
3103 {
3104 if (Unit* parent = seat->GetVehicleBase())
3105 {
3107 unitCaster->CastSpell(parent, 62496, this);
3109 .SetTriggeringSpell(this)); // DIFFICULTY_NONE, so effect always valid
3110 }
3111 }
3112 }
3113 return;
3114 }
3115 }
3116 break;
3117 }
3118 }
3119
3120 // normal DB scripted effect
3121 TC_LOG_DEBUG("spells", "Spell ScriptStart spellid {} in EffectScriptEffect({})", m_spellInfo->Id, effectInfo->EffectIndex);
3123}
3124
3126{
3128 return;
3129
3130 if (!unitTarget)
3131 return;
3132
3133 auto isAffectedBySanctuary = [](Unit const* attacker)
3134 {
3135 Creature const* attackerCreature = attacker->ToCreature();
3136 return !attackerCreature || !attackerCreature->IsIgnoringSanctuarySpellEffect();
3137 };
3138
3140 {
3141 // stop all pve combat for players outside dungeons, suppress pvp combat
3142 unitTarget->CombatStop(false, false, isAffectedBySanctuary);
3143 }
3144 else
3145 {
3146 // in dungeons (or for nonplayers), reset this unit on all enemies' threat lists
3147 for (auto const& [guid, ref] : unitTarget->GetThreatManager().GetThreatenedByMeList())
3148 if (isAffectedBySanctuary(ref->GetOwner()))
3149 ref->ScaleThreat(0.0f);
3150 }
3151
3152 // makes spells cast before this time fizzle
3154}
3155
3157{
3159 return;
3160
3162 return;
3163
3164 Player* caster = m_caster->ToPlayer();
3165 Player* target = unitTarget->ToPlayer();
3166
3167 // caster or target already have requested duel
3168 if (caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetGUID(), caster->GetSession()->GetAccountGUID()))
3169 return;
3170
3171 // Players can only fight a duel in zones with this flag
3172 AreaTableEntry const* casterAreaEntry = sAreaTableStore.LookupEntry(caster->GetAreaId());
3173 if (casterAreaEntry && !(casterAreaEntry->GetFlags().HasFlag(AreaFlags::AllowDueling)))
3174 {
3175 SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here
3176 return;
3177 }
3178
3179 AreaTableEntry const* targetAreaEntry = sAreaTableStore.LookupEntry(target->GetAreaId());
3180 if (targetAreaEntry && !(targetAreaEntry->GetFlags().HasFlag(AreaFlags::AllowDueling)))
3181 {
3182 SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here
3183 return;
3184 }
3185
3186 //CREATE DUEL FLAG OBJECT
3187 Map* map = caster->GetMap();
3188 Position const pos =
3189 {
3190 caster->GetPositionX() + (unitTarget->GetPositionX() - caster->GetPositionX()) / 2,
3191 caster->GetPositionY() + (unitTarget->GetPositionY() - caster->GetPositionY()) / 2,
3192 caster->GetPositionZ(),
3193 caster->GetOrientation()
3194 };
3196
3198 if (!go)
3199 return;
3200
3202
3203 go->SetFaction(caster->GetFaction());
3204 go->SetLevel(caster->GetLevel() + 1);
3205 int32 duration = m_spellInfo->CalcDuration(caster);
3206 go->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
3208
3210
3211 caster->AddGameObject(go);
3212 map->AddToMap(go);
3213 //END
3214
3215 // Send request
3217 packet.ArbiterGUID = go->GetGUID();
3218 packet.RequestedByGUID = caster->GetGUID();
3219 packet.RequestedByWowAccount = caster->GetSession()->GetAccountGUID();
3220
3221 WorldPacket const* worldPacket = packet.Write();
3222 caster->SendDirectMessage(worldPacket);
3223 target->SendDirectMessage(worldPacket);
3224
3225 // create duel-info
3226 bool isMounted = (GetSpellInfo()->Id == 62875);
3227 caster->duel = std::make_unique<DuelInfo>(target, caster, isMounted);
3228 target->duel = std::make_unique<DuelInfo>(caster, caster, isMounted);
3229
3230 caster->SetDuelArbiter(go->GetGUID());
3231 target->SetDuelArbiter(go->GetGUID());
3232
3233 sScriptMgr->OnPlayerDuelRequest(target, caster);
3234}
3235
3237{
3239 return;
3240
3241 if (!sWorld->getBoolConfig(CONFIG_CAST_UNSTUCK))
3242 return;
3243
3244 Player* player = m_caster->ToPlayer();
3245 if (!player)
3246 return;
3247
3248 TC_LOG_DEBUG("spells", "Spell Effect: Stuck");
3249 TC_LOG_DEBUG("spells", "Player {} {} used the auto-unstuck feature at map {} ({}, {}, {}).", player->GetName(), player->GetGUID().ToString(), player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());
3250
3251 if (player->IsInFlight())
3252 return;
3253
3254 // if player is dead without death timer is teleported to graveyard, otherwise not apply the effect
3255 if (player->isDead())
3256 {
3257 if (!player->GetDeathTimer())
3258 player->RepopAtGraveyard();
3259
3260 return;
3261 }
3262
3263 // the player dies if hearthstone is in cooldown, else the player is teleported to home
3264 if (player->GetSpellHistory()->HasCooldown(8690))
3265 {
3266 player->KillSelf();
3267 return;
3268 }
3269
3270 player->TeleportTo(player->m_homebind, TELE_TO_SPELL);
3271
3272 // Stuck spell trigger Hearthstone cooldown
3273 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(8690, GetCastDifficulty());
3274 if (!spellInfo)
3275 return;
3276 Spell spell(player, spellInfo, TRIGGERED_FULL_MASK);
3277 spell.SendSpellCooldown();
3278}
3279
3281{
3282 // workaround - this effect should not use target map
3284 return;
3285
3286 Unit* unitCaster = GetUnitCasterForEffectHandlers();
3287 if (!unitCaster)
3288 return;
3289
3291 return;
3292
3294}
3295
3297{
3299 return;
3300
3301 if (!gameObjTarget)
3302 return;
3303
3305
3307}
3308
3310{
3312 return;
3313
3314 Player* player = m_caster->ToPlayer();
3315 if (!player)
3316 return;
3317
3318 std::vector<uint32>& glyphs = player->GetGlyphs(player->GetActiveTalentGroup());
3319 std::size_t replacedGlyph = glyphs.size();
3320 for (std::size_t i = 0; i < glyphs.size(); ++i)
3321 {
3322 if (std::vector<uint32> const* activeGlyphBindableSpells = sDB2Manager.GetGlyphBindableSpells(glyphs[i]))
3323 {
3324 if (std::find(activeGlyphBindableSpells->begin(), activeGlyphBindableSpells->end(), m_misc.SpellId) != activeGlyphBindableSpells->end())
3325 {
3326 replacedGlyph = i;
3327 player->RemoveAurasDueToSpell(sGlyphPropertiesStore.AssertEntry(glyphs[i])->SpellID);
3328 break;
3329 }
3330 }
3331 }
3332
3333 uint32 glyphId = effectInfo->MiscValue;
3334 if (replacedGlyph < glyphs.size())
3335 {
3336 if (glyphId)
3337 glyphs[replacedGlyph] = glyphId;
3338 else
3339 glyphs.erase(glyphs.begin() + replacedGlyph);
3340 }
3341 else if (glyphId)
3342 glyphs.push_back(glyphId);
3343
3345
3346 if (GlyphPropertiesEntry const* glyphProperties = sGlyphPropertiesStore.LookupEntry(glyphId))
3347 player->CastSpell(player, glyphProperties->SpellID, this);
3348
3350 activeGlyphs.Glyphs.emplace_back(m_misc.SpellId, uint16(glyphId));
3351 activeGlyphs.IsFullUpdate = false;
3352 player->SendDirectMessage(activeGlyphs.Write());
3353}
3354
3356{
3358 return;
3359
3360 // this is only item spell effect applied to main-hand weapon of target player (players in area)
3362 return;
3363
3364 Player* item_owner = unitTarget->ToPlayer();
3366
3367 if (!item)
3368 return;
3369
3370 // must be equipped
3371 if (!item->IsEquipped())
3372 return;
3373
3374 if (effectInfo->MiscValue)
3375 {
3376 uint32 enchant_id = effectInfo->MiscValue;
3377 int32 duration = m_spellInfo->GetDuration(); //Try duration index first ..
3378 if (!duration)
3379 duration = damage;//+1; //Base points after ..
3380 if (!duration)
3381 duration = 10 * IN_MILLISECONDS; //10 seconds for enchants which don't have listed duration
3382
3383 if (m_spellInfo->Id == 14792) // Venomhide Poison
3384 duration = 5 * MINUTE * IN_MILLISECONDS;
3385
3386 SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
3387 if (!pEnchant)
3388 return;
3389
3390 // Always go to temp enchantment slot
3392
3393 // Enchantment will not be applied if a different one already exists
3394 if (item->GetEnchantmentId(slot) && item->GetEnchantmentId(slot) != enchant_id)
3395 return;
3396
3397 // Apply the temporary enchantment
3398 item->SetEnchantment(slot, enchant_id, duration, 0, m_caster->GetGUID());
3399 item_owner->ApplyEnchantment(item, slot, true);
3400 }
3401}
3402
3404{
3406 return;
3407
3408 if (Player* caster = m_caster->ToPlayer())
3409 {
3410 caster->UpdateCraftSkill(m_spellInfo);
3411 itemTarget->m_loot.reset(new Loot(caster->GetMap(), itemTarget->GetGUID(), LOOT_DISENCHANTING, nullptr));
3413 caster->SendLoot(*itemTarget->m_loot);
3414 }
3415
3416 // item will be removed at disenchanting end
3417}
3418
3420{
3422 return;
3423
3424 if (!unitTarget || !unitTarget->IsPlayer())
3425 return;
3426
3427 Player* player = unitTarget->ToPlayer();
3428
3429 uint8 currentDrunkValue = player->GetDrunkValue();
3430 uint8 drunkValue = std::clamp<int32>(damage + currentDrunkValue, 0, 100);
3431 if (currentDrunkValue == 100 && currentDrunkValue == drunkValue)
3432 if (roll_chance_f(25.0f))
3433 player->CastSpell(player, 67468, CastSpellExtraArgs()
3434 .SetTriggeringSpell(this)); // Drunken Vomit
3435
3436 player->SetDrunkValue(drunkValue, m_CastItem ? m_CastItem->GetEntry() : 0);
3437}
3438
3440{
3442 return;
3443
3444 Player* player = m_caster->ToPlayer();
3445 if (!player)
3446 return;
3447
3448 Item* foodItem = itemTarget;
3449 if (!foodItem)
3450 return;
3451
3452 Pet* pet = player->GetPet();
3453 if (!pet)
3454 return;
3455
3456 if (!pet->IsAlive())
3457 return;
3458
3460
3461 int32 pct;
3462 int32 levelDiff = int32(pet->GetLevel()) - int32(foodItem->GetTemplate()->GetBaseItemLevel());
3463 if (levelDiff >= 30)
3464 return;
3465 else if (levelDiff >= 20)
3466 pct = int32(12.5); // we can't pass double so keeping the cast here for future references
3467 else if (levelDiff >= 10)
3468 pct = 25;
3469 else
3470 pct = 50;
3471
3472 uint32 count = 1;
3473 player->DestroyItemCount(foodItem, count, true);
3475
3477 args.SetTriggeringSpell(this);
3480}
3481
3483{
3485 return;
3486
3487 if (!unitTarget || !unitTarget->IsPet())
3488 return;
3489
3490 Pet* pet = unitTarget->ToPet();
3491
3494}
3495
3497{
3499 return;
3500
3501 Unit* unitCaster = GetUnitCasterForEffectHandlers();
3502 if (!unitCaster)
3503 return;
3504
3506 ObjectGuid guid = unitCaster->m_ObjectSlot[slot];
3507 if (!guid.IsEmpty())
3508 {
3509 if (GameObject* obj = unitCaster->GetMap()->GetGameObject(guid))
3510 {
3511 // Recast case - null spell id to make auras not be removed on object remove from world
3512 if (m_spellInfo->Id == obj->GetSpellId())
3513 obj->SetSpellId(0);
3514 unitCaster->RemoveGameObject(obj, true);
3515 }
3516 unitCaster->m_ObjectSlot[slot].Clear();
3517 }
3518
3519 float x, y, z, o;
3520 // If dest location if present
3521 if (m_targets.HasDst())
3522 destTarget->GetPosition(x, y, z, o);
3523 // Summon in random point all other units if location present
3524 else
3525 {
3526 unitCaster->GetClosePoint(x, y, z, DEFAULT_PLAYER_BOUNDING_RADIUS);
3527 o = unitCaster->GetOrientation();
3528 }
3529
3530 Map* map = m_caster->GetMap();
3531 Position pos = Position(x, y, z, o);
3533
3535 if (!go)
3536 return;
3537
3539
3540 go->SetFaction(unitCaster->GetFaction());
3541 go->SetLevel(unitCaster->GetLevel());
3543 go->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
3545 unitCaster->AddGameObject(go);
3546
3548
3549 map->AddToMap(go);
3550
3551 unitCaster->m_ObjectSlot[slot] = go->GetGUID();
3552}
3553
3555{
3557 return;
3558
3559 if (!m_corpseTarget && !unitTarget)
3560 return;
3561
3562 Player* player = nullptr;
3563
3564 if (m_corpseTarget)
3566 else if (unitTarget)
3567 player = unitTarget->ToPlayer();
3568
3569 if (!player || player->IsAlive() || !player->IsInWorld())
3570 return;
3571
3572 if (player->IsResurrectRequested()) // already have one active request
3573 return;
3574
3575 uint32 health = player->CountPctFromMaxHealth(damage);
3577
3579
3580 player->SetResurrectRequestData(m_caster, health, mana, 0);
3581 SendResurrectRequest(player);
3582}
3583
3585{
3587 return;
3588
3589 if (!unitTarget || !unitTarget->IsAlive())
3590 return;
3591
3593
3595}
3596
3598{
3600 return;
3601
3603 m_caster->ToPlayer()->SetCanParry(true);
3604}
3605
3607{
3609 return;
3610
3612 m_caster->ToPlayer()->SetCanBlock(true);
3613}
3614
3616{
3618 return;
3619
3620 if (!unitTarget || unitTarget->IsInFlight())
3621 return;
3622
3623 if (!m_targets.HasDst())
3624 return;
3625
3628}
3629
3631{
3633 return;
3634
3636 return;
3637
3638 Player* player = unitTarget->ToPlayer();
3639
3640 int32 repChange = damage;
3641
3642 uint32 factionId = effectInfo->MiscValue;
3643
3644 FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId);
3645 if (!factionEntry)
3646 return;
3647
3648 repChange = player->CalculateReputationGain(REPUTATION_SOURCE_SPELL, 0, repChange, factionId);
3649
3650 player->GetReputationMgr().ModifyReputation(factionEntry, repChange);
3651}
3652
3654{
3656 return;
3657
3659 return;
3660 Player* player = unitTarget->ToPlayer();
3661
3662 uint32 questId = effectInfo->MiscValue;
3663 if (questId)
3664 {
3665 Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
3666 if (!quest)
3667 return;
3668
3669 uint16 logSlot = player->FindQuestSlot(questId);
3670 if (logSlot < MAX_QUEST_LOG_SIZE)
3671 player->AreaExploredOrEventHappens(questId);
3672 else if (quest->HasFlag(QUEST_FLAGS_TRACKING_EVENT)) // Check if the quest is used as a serverside flag.
3673 player->SetRewardedQuest(questId); // If so, set status to rewarded without broadcasting it to client.
3674 }
3675}
3676
3678{
3680 return;
3681
3682 Unit* unitCaster = GetUnitCasterForEffectHandlers();
3683 if (!unitCaster)
3684 return;
3685
3686 float dist = unitCaster->GetVisibilityRange();
3687
3688 // clear focus
3690 breakTarget.Data.UnitGUID = m_caster->GetGUID();
3691 breakTarget.Data.Write();
3693 Cell::VisitWorldObjects(m_caster, notifierBreak, dist);
3694
3695 // and selection
3697 clearTarget.Data.Guid = m_caster->GetGUID();
3698 clearTarget.Data.Write();
3700 Cell::VisitWorldObjects(m_caster, notifierClear, dist);
3701
3702 // we should also force pets to remove us from current target
3703 Unit::AttackerSet attackerSet;
3704 for (Unit::AttackerSet::const_iterator itr = unitCaster->getAttackers().begin(); itr != unitCaster->getAttackers().end(); ++itr)
3705 if ((*itr)->GetTypeId() == TYPEID_UNIT && !(*itr)->CanHaveThreatList())
3706 attackerSet.insert(*itr);
3707
3708 for (Unit::AttackerSet::const_iterator itr = attackerSet.begin(); itr != attackerSet.end(); ++itr)
3709 (*itr)->AttackStop();
3710}
3711
3713{
3715 return;
3716
3717 Player* player = m_caster->ToPlayer();
3718 if (!player || !player->IsInWorld() || player->IsAlive())
3719 return;
3720
3721 uint32 health = 0;
3722 uint32 mana = 0;
3723
3724 // flat case
3725 if (damage < 0)
3726 {
3727 health = uint32(-damage);
3728 mana = effectInfo->MiscValue;
3729 }
3730 // percent case
3731 else
3732 {
3733 health = player->CountPctFromMaxHealth(damage);
3734 if (player->GetMaxPower(POWER_MANA) > 0)
3735 mana = CalculatePct(player->GetMaxPower(POWER_MANA), damage);
3736 }
3737
3738 player->ResurrectPlayer(0.0f);
3739
3740 player->SetHealth(health);
3741 player->SetPower(POWER_MANA, mana);
3742 player->SetPower(POWER_RAGE, 0);
3743 player->SetFullPower(POWER_ENERGY);
3744 player->SetPower(POWER_FOCUS, 0);
3745
3746 player->SpawnCorpseBones();
3747}
3748
3750{
3752 return;
3753
3755 return;
3756
3757 Player* player = m_caster->ToPlayer();
3758 if (!player)
3759 return;
3760
3761 Creature* creature = unitTarget->ToCreature();
3762 int32 targetLevel = creature->GetLevelForTarget(m_caster);
3763
3764 uint32 skill = creature->GetCreatureDifficulty()->GetRequiredLootSkill();
3765
3768 Loot* loot = new Loot(creature->GetMap(), creature->GetGUID(), LOOT_SKINNING, nullptr);
3769 creature->m_personalLoot[player->GetGUID()].reset(loot);
3770 loot->FillLoot(creature->GetCreatureDifficulty()->SkinLootID, LootTemplates_Skinning, player, true);
3771 player->SendLoot(*loot);
3772
3773 if (!IsPartOfSkillLine(skill, m_spellInfo->Id))
3774 return;
3775
3776 // Skill gain for skinning
3777 // This formula is still used (10.0.5.48526)
3778 if (skill == SKILL_SKINNING)
3779 {
3780 int32 reqValue;
3781 if (targetLevel <= 10)
3782 reqValue = 1;
3783 else if (targetLevel < 20)
3784 reqValue = (targetLevel - 10) * 10;
3785 else if (targetLevel <= 73)
3786 reqValue = targetLevel * 5;
3787 else if (targetLevel < 80)
3788 reqValue = targetLevel * 10 - 365;
3789 else if (targetLevel <= 84)
3790 reqValue = targetLevel * 5 + 35;
3791 else if (targetLevel <= 87)
3792 reqValue = targetLevel * 15 - 805;
3793 else if (targetLevel <= 92)
3794 reqValue = (targetLevel - 62) * 20;
3795 else if (targetLevel <= 104)
3796 reqValue = targetLevel * 5 + 175;
3797 else if (targetLevel <= 107)
3798 reqValue = targetLevel * 15 - 905;
3799 else if (targetLevel <= 112)
3800 reqValue = (targetLevel - 72) * 20;
3801 else if (targetLevel <= 122)
3802 reqValue = (targetLevel - 32) * 10;
3803 else
3804 reqValue = 900;
3805
3806 ContentTuningEntry const* contentTuning = sContentTuningStore.LookupEntry(creature->GetContentTuning());
3807 if (!contentTuning)
3808 return;
3809
3810 uint32 skinningSkill = player->GetProfessionSkillForExp(skill, contentTuning->ExpansionID);
3811 if (!skinningSkill)
3812 return;
3813
3814 if (uint32 pureSkillValue = player->GetPureSkillValue(skinningSkill))
3815 {
3816 // Double chances for elites
3817 player->UpdateGatherSkill(skinningSkill, pureSkillValue, reqValue, creature->IsElite() ? 2 : 1);
3818 }
3819 }
3820}
3821
3823{
3824 if (!unitTarget)
3825 return;
3826
3827 Unit* unitCaster = GetUnitCasterForEffectHandlers();
3828 if (!unitCaster)
3829 return;
3830
3832 {
3833 // charge changes fall time
3834 if (unitCaster->GetTypeId() == TYPEID_PLAYER)
3835 unitCaster->ToPlayer()->SetFallInformation(0, unitCaster->GetPositionZ());
3836
3837 float speed = G3D::fuzzyGt(m_spellInfo->Speed, 0.0f) ? m_spellInfo->Speed : SPEED_CHARGE;
3838
3839 Optional<Movement::SpellEffectExtraData> spellEffectExtraData;
3841 {
3842 spellEffectExtraData.emplace();
3843 spellEffectExtraData->Target = unitTarget->GetGUID();
3844 spellEffectExtraData->SpellVisualId = effectInfo->MiscValueB;
3845 }
3846 // Spell is not using explicit target - no generated path
3847 if (!m_preGeneratedPath)
3848 {
3850
3851 m_preGeneratedPath = std::make_unique<PathGenerator>(unitCaster);
3852 m_preGeneratedPath->CalculatePath(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), false);
3853 }
3854
3856 speed = m_preGeneratedPath->GetPathLength() / speed;
3857
3858 unitCaster->GetMotionMaster()->MoveCharge(*m_preGeneratedPath, speed, unitTarget, spellEffectExtraData ? &*spellEffectExtraData : nullptr);
3859
3860 // abuse implementation detail of MoveCharge accepting PathGenerator argument (instantly started spline)
3861 UpdateDelayMomentForUnitTarget(unitTarget, unitCaster->movespline->Duration());
3862 }
3863
3865 {
3866 // not all charge effects used in negative spells
3868 unitCaster->Attack(unitTarget, true);
3869
3872 .SetOriginalCaster(m_originalCasterGUID)
3873 .SetTriggeringSpell(this));
3874 }
3875}
3876
3878{
3879 if (!destTarget)
3880 return;
3881
3882 Unit* unitCaster = GetUnitCasterForEffectHandlers();
3883 if (!unitCaster)
3884 return;
3885
3887 {
3889
3890 if (!unitCaster->IsWithinLOS(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()))
3891 {
3892 float angle = unitCaster->GetRelativeAngle(pos.GetPositionX(), pos.GetPositionY());
3893 float dist = unitCaster->GetDistance(pos);
3894 pos = unitCaster->GetFirstCollisionPosition(dist, angle);
3895 }
3896
3897 PathGenerator path(unitCaster);
3898 path.CalculatePath(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), false);
3899
3900 float speed = G3D::fuzzyGt(m_spellInfo->Speed, 0.0f) ? m_spellInfo->Speed : SPEED_CHARGE;
3901
3903 speed = path.GetPathLength() / speed;
3904
3905 unitCaster->GetMotionMaster()->MoveCharge(path, speed);
3906
3907 // abuse implementation detail of MoveCharge accepting PathGenerator argument (instantly started spline)
3908 UpdateDelayMomentForDst(unitCaster->movespline->Duration());
3909 }
3911 {
3914 .SetOriginalCaster(m_originalCasterGUID)
3915 .SetTriggeringSpell(this));
3916 }
3917}
3918
3920{
3922 return;
3923
3924 if (!unitTarget)
3925 return;
3926
3928 if (Creature* creatureTarget = unitTarget->ToCreature())
3929 if (creatureTarget->isWorldBoss() || creatureTarget->IsDungeonBoss())
3930 return;
3931
3932 // Spells with SPELL_EFFECT_KNOCK_BACK (like Thunderstorm) can't knockback target if target has ROOT/STUN
3934 return;
3935
3936 // Instantly interrupt non melee spells being cast
3939
3940 float ratio = 0.1f;
3941 float speedxy = float(effectInfo->MiscValue) * ratio;
3942 float speedz = float(damage) * ratio;
3943 if (speedxy < 0.01f && speedz < 0.01f)
3944 return;
3945
3946 Position origin;
3948 {
3949 if (m_targets.HasDst())
3950 origin = destTarget->GetPosition();
3951 else
3952 return;
3953 }
3954 else //if (effectInfo->Effect == SPELL_EFFECT_KNOCK_BACK)
3955 origin = m_caster->GetPosition();
3956
3957 unitTarget->KnockbackFrom(origin, speedxy, speedz);
3958
3960 PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_PHASE_HIT, PROC_HIT_NONE, nullptr, nullptr, nullptr);
3961}
3962
3964{
3966 return;
3967
3968 if (!unitTarget)
3969 return;
3970
3971 float speedxy = effectInfo->MiscValue / 10.f;
3972 float speedz = damage / 10.f;
3973 // Disengage
3974 unitTarget->JumpTo(speedxy, speedz, effectInfo->PositionFacing);
3975
3976 // changes fall time
3979}
3980
3982{
3984 return;
3985
3987 return;
3988 Player* player = unitTarget->ToPlayer();
3989
3990 uint32 quest_id = effectInfo->MiscValue;
3991
3992 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
3993
3994 if (!quest)
3995 return;
3996
3997 QuestStatus oldStatus = player->GetQuestStatus(quest_id);
3998
3999 // Player has never done this quest
4000 if (oldStatus == QUEST_STATUS_NONE)
4001 return;
4002
4003 // remove all quest entries for 'entry' from quest log
4004 for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot)
4005 {
4006 uint32 logQuest = player->GetQuestSlotQuestId(slot);
4007 if (logQuest == quest_id)
4008 {
4009 player->SetQuestSlot(slot, 0);
4010
4011 // we ignore unequippable quest items in this case, it's still be equipped
4012 player->TakeQuestSourceItem(logQuest, false);
4013
4014 if (quest->HasFlag(QUEST_FLAGS_FLAGS_PVP))
4015 {
4016 player->pvpInfo.IsHostile = player->pvpInfo.IsInHostileArea || player->HasPvPForcingQuest();
4017 player->UpdatePvPState();
4018 }
4019 }
4020 }
4021
4022 player->RemoveActiveQuest(quest_id, false);
4023 player->RemoveRewardedQuest(quest_id);
4024 player->DespawnPersonalSummonsForQuest(quest_id);
4025
4026 sScriptMgr->OnQuestStatusChange(player, quest_id);
4027 sScriptMgr->OnQuestStatusChange(player, quest, oldStatus, QUEST_STATUS_NONE);
4028}
4029
4031{
4033 return;
4034
4036 return;
4037
4039}
4040
4042{
4044 return;
4045
4046 if (!unitTarget)
4047 return;
4048
4050
4051 // This is a blizzlike mistake: this should be 2D distance according to projectile motion formulas, but Blizzard erroneously used 3D distance.
4052 float distXY = unitTarget->GetExactDist(pos);
4053
4054 // Avoid division by 0
4055 if (distXY < 0.001)
4056 return;
4057
4058 float distZ = pos.GetPositionZ() - unitTarget->GetPositionZ();
4059 float speedXY = effectInfo->MiscValue ? effectInfo->MiscValue / 10.0f : 30.0f;
4060 float speedZ = (2 * speedXY * speedXY * distZ + Movement::gravity * distXY * distXY) / (2 * speedXY * distXY);
4061
4062 if (!std::isfinite(speedZ))
4063 {
4064 TC_LOG_ERROR("spells", "Spell {} with SPELL_EFFECT_PULL_TOWARDS called with invalid speedZ. {}", m_spellInfo->Id, GetDebugInfo());
4065 return;
4066 }
4067
4068 unitTarget->JumpTo(speedXY, speedZ, 0.0f, pos);
4069}
4070
4072{
4074 return;
4075
4076 if (!unitTarget)
4077 return;
4078
4079 if (!m_targets.HasDst())
4080 {
4081 TC_LOG_ERROR("spells", "Spell {} with SPELL_EFFECT_PULL_TOWARDS_DEST has no dest target", m_spellInfo->Id);
4082 return;
4083 }
4084
4085 Position const* pos = m_targets.GetDstPos();
4086 // This is a blizzlike mistake: this should be 2D distance according to projectile motion formulas, but Blizzard erroneously used 3D distance
4087 float distXY = unitTarget->GetExactDist(pos);
4088
4089 // Avoid division by 0
4090 if (distXY < 0.001)
4091 return;
4092
4093 float distZ = pos->GetPositionZ() - unitTarget->GetPositionZ();
4094
4095 float speedXY = effectInfo->MiscValue ? effectInfo->MiscValue / 10.0f : 30.0f;
4096 float speedZ = (2 * speedXY * speedXY * distZ + Movement::gravity * distXY * distXY) / (2 * speedXY * distXY);
4097
4098 if (!std::isfinite(speedZ))
4099 {
4100 TC_LOG_ERROR("spells", "Spell {} with SPELL_EFFECT_PULL_TOWARDS_DEST called with invalid speedZ. {}", m_spellInfo->Id, GetDebugInfo());
4101 return;
4102 }
4103
4104 unitTarget->JumpTo(speedXY, speedZ, 0.0f, *pos);
4105}
4106
4108{
4110 return;
4111
4112 Player* player = m_caster->ToPlayer();
4113 if (!player || !m_targets.HasDst())
4114 return;
4115
4116 Group* group = player->GetGroup();
4117 if (!group || (group->isRaidGroup() && !group->IsLeader(player->GetGUID()) && !group->IsAssistant(player->GetGUID())))
4118 return;
4119
4120 float x, y, z;
4121 destTarget->GetPosition(x, y, z);
4122
4123 group->AddRaidMarker(damage, player->GetMapId(), x, y, z);
4124}
4125
4127{
4129 return;
4130
4131 if (!unitTarget)
4132 return;
4133
4134 uint32 mechanic = effectInfo->MiscValue;
4135 DispelList dispel_list;
4136 Unit::AuraMap const& auras = unitTarget->GetOwnedAuras();
4137 for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
4138 {
4139 Aura* aura = itr->second;
4141 continue;
4143 if ((aura->GetSpellInfo()->GetAllEffectsMechanicMask() & (UI64LIT(1) << mechanic)))
4144 dispel_list.emplace_back(aura->GetId(), aura->GetCasterGUID());
4145 }
4146
4147 if (dispel_list.empty())
4148 return;
4149
4150 for (auto itr = dispel_list.begin(); itr != dispel_list.end(); ++itr)
4151 unitTarget->RemoveAura(itr->first, itr->second, 0, AURA_REMOVE_BY_ENEMY_SPELL);
4152
4154}
4155
4157{
4159 return;
4160
4161 if (damage < 0)
4162 return;
4163
4164 Player* player = m_caster->ToPlayer();
4165 if (!player)
4166 return;
4167
4168 // Maybe player dismissed dead pet or pet despawned?
4169 bool hadPet = true;
4170
4171 if (!player->GetPet())
4172 {
4173 PetStable const* petStable = player->GetPetStable();
4174 auto deadPetItr = std::find_if(petStable->ActivePets.begin(), petStable->ActivePets.end(), [](Optional<PetStable::PetInfo> const& petInfo)
4175 {
4176 return petInfo && !petInfo->Health;
4177 });
4178
4179 PetSaveMode slot = PetSaveMode(std::distance(petStable->ActivePets.begin(), deadPetItr));
4180
4181 // Position passed to SummonPet is irrelevant with current implementation,
4182 // pet will be relocated without using these coords in Pet::LoadPetFromDB
4183 player->SummonPet(0, slot, 0.0f, 0.0f, 0.0f, 0.0f, 0);
4184 hadPet = false;
4185 }
4186
4187 // TODO: Better to fail Hunter's "Revive Pet" at cast instead of here when casting ends
4188 Pet* pet = player->GetPet(); // Attempt to get current pet
4189 if (!pet || pet->IsAlive())
4190 return;
4191
4192 // If player did have a pet before reviving, teleport it
4193 if (hadPet)
4194 {
4195 // Reposition the pet's corpse before reviving so as not to grab aggro
4196 // We can use a different, more accurate version of GetClosePoint() since we have a pet
4197 float x, y, z; // Will be used later to reposition the pet if we have one
4198 player->GetClosePoint(x, y, z, pet->GetCombatReach(), PET_FOLLOW_DIST, pet->GetFollowAngle());
4199 pet->NearTeleportTo(x, y, z, player->GetOrientation());
4200 pet->Relocate(x, y, z, player->GetOrientation()); // This is needed so SaveStayPosition() will get the proper coords.
4201 }
4202
4205 pet->setDeathState(ALIVE);
4208
4209 // Reset things for when the AI to takes over
4210 CharmInfo *ci = pet->GetCharmInfo();
4211 if (ci)
4212 {
4213 // In case the pet was at stay, we don't want it running back
4214 ci->SaveStayPosition();
4216
4217 ci->SetIsFollowing(false);
4218 ci->SetIsCommandAttack(false);
4219 ci->SetIsCommandFollow(false);
4220 ci->SetIsReturning(false);
4221 }
4222
4224}
4225
4227{
4229 return;
4230
4231 Unit* unitCaster = GetUnitCasterForEffectHandlers();
4232 if (!unitCaster)
4233 return;
4234
4235 int32 mana = 0;
4236 for (uint8 slot = SUMMON_SLOT_TOTEM; slot < MAX_TOTEM_SLOT; ++slot)
4237 {
4238 if (!unitCaster->m_SummonSlot[slot])
4239 continue;
4240
4241 Creature* totem = unitCaster->GetMap()->GetCreature(unitCaster->m_SummonSlot[slot]);
4242 if (totem && totem->IsTotem())
4243 {
4244 uint32 spell_id = totem->m_unitData->CreatedBySpell;
4245 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id, GetCastDifficulty());
4246 if (spellInfo)
4247 {
4248 std::vector<SpellPowerCost> costs = spellInfo->CalcPowerCost(unitCaster, spellInfo->GetSchoolMask());
4249 auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_MANA; });
4250 if (m != costs.end())
4251 mana += m->Amount;
4252 }
4253
4254 totem->ToTotem()->UnSummon();
4255 }
4256 }
4257
4258 ApplyPct(mana, damage);
4259
4260 if (mana)
4261 {
4263 args.SetTriggeringSpell(this);
4265 unitCaster->CastSpell(unitCaster, 39104, args);
4266 }
4267}
4268
4270{
4272 return;
4273
4275 return;
4276
4277 int32 slot = effectInfo->MiscValue;
4278
4279 // -1 means all player equipped items and -2 all items
4280 if (slot < 0)
4281 {
4284 return;
4285 }
4286
4287 // invalid slot value
4288 if (slot >= INVENTORY_SLOT_BAG_END)
4289 return;
4290
4292 {
4295 }
4296}
4297
4299{
4301 return;
4302
4304 return;
4305
4306 int32 slot = effectInfo->MiscValue;
4307
4308 // FIXME: some spells effects have value -1/-2
4309 // Possibly its mean -1 all player equipped items and -2 all items
4310 if (slot < 0)
4311 {
4312 unitTarget->ToPlayer()->DurabilityLossAll(float(damage) / 100.0f, (slot < -1));
4313 return;
4314 }
4315
4316 // invalid slot value
4317 if (slot >= INVENTORY_SLOT_BAG_END)
4318 return;
4319
4320 if (damage <= 0)
4321 return;
4322
4324 unitTarget->ToPlayer()->DurabilityLoss(item, float(damage) / 100.0f);
4325}
4326
4328{
4330 return;
4331
4332 Unit* unitCaster = GetUnitCasterForEffectHandlers();
4333 if (!unitCaster || !unitTarget)
4334 return;
4335
4337}
4338
4340{
4342 return;
4343
4344 Unit* unitCaster = GetUnitCasterForEffectHandlers();
4345 if (!unitCaster)
4346 return;
4347
4348 uint32 name_id = effectInfo->MiscValue;
4349 Unit::AuraEffectList const& overrideSummonedGameObjects = unitCaster->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_SUMMONED_OBJECT);
4350 for (AuraEffect const* aurEff : overrideSummonedGameObjects)
4351 {
4352 if (uint32(aurEff->GetMiscValue()) == name_id)
4353 {
4354 name_id = uint32(aurEff->GetMiscValueB());
4355 break;
4356 }
4357 }
4358
4359 GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id);
4360 if (!goinfo)
4361 {
4362 TC_LOG_ERROR("sql.sql", "Gameobject (Entry: {}) does not exist and is not created by spell (ID: {}) cast.", name_id, m_spellInfo->Id);
4363 return;
4364 }
4365
4366 float fx, fy, fz, fo;
4367
4368 if (m_targets.HasDst())
4369 destTarget->GetPosition(fx, fy, fz, fo);
4370 //FIXME: this can be better check for most objects but still hack
4372 {
4373 float dis = effectInfo->CalcRadius(unitCaster);
4374 unitCaster->GetClosePoint(fx, fy, fz, DEFAULT_PLAYER_BOUNDING_RADIUS, dis);
4375 fo = unitCaster->GetOrientation();
4376 }
4377 else
4378 {
4379 //GO is always friendly to it's creator, get range for friends
4380 float min_dis = m_spellInfo->GetMinRange(true);
4381 float max_dis = m_spellInfo->GetMaxRange(true);
4382 float dis = rand_norm() * (max_dis - min_dis) + min_dis;
4383
4384 unitCaster->GetClosePoint(fx, fy, fz, DEFAULT_PLAYER_BOUNDING_RADIUS, dis);
4385 fo = unitCaster->GetOrientation();
4386 }
4387
4388 Map* cMap = unitCaster->GetMap();
4389 // if gameobject is summoning object, it should be spawned right on caster's position
4390 if (goinfo->type == GAMEOBJECT_TYPE_RITUAL)
4391 unitCaster->GetPosition(fx, fy, fz, fo);
4392
4393 Position pos = { fx, fy, fz, fo };
4395
4396 GameObject* go = GameObject::CreateGameObject(name_id, cMap, pos, rot, 255, GO_STATE_READY);
4397 if (!go)
4398 return;
4399
4402
4403 switch (goinfo->type)
4404 {
4406 {
4407 go->SetFaction(unitCaster->GetFaction());
4408 ObjectGuid bobberGuid = go->GetGUID();
4409 // client requires fishing bobber guid in channel object slot 0 to be usable
4410 unitCaster->SetChannelObject(0, bobberGuid);
4411 unitCaster->AddGameObject(go); // will removed at spell cancel
4412
4413 // end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo))
4414 // start time == fish-FISHING_BOBBER_READY_TIME (0..GetDuration(m_spellInfo)-FISHING_BOBBER_READY_TIME)
4415 int32 lastSec = 0;
4416 switch (urand(0, 2))
4417 {
4418 case 0: lastSec = 3; break;
4419 case 1: lastSec = 7; break;
4420 case 2: lastSec = 13; break;
4421 }
4422
4423 // Duration of the fishing bobber can't be higher than the Fishing channeling duration
4424 duration = std::min(duration, duration - lastSec*IN_MILLISECONDS + FISHING_BOBBER_READY_TIME*IN_MILLISECONDS);
4425 break;
4426 }
4428 {
4429 if (unitCaster->GetTypeId() == TYPEID_PLAYER)
4430 {
4431 go->AddUniqueUse(unitCaster->ToPlayer());
4432 unitCaster->AddGameObject(go); // will be removed at spell cancel
4433 }
4434 break;
4435 }
4436 case GAMEOBJECT_TYPE_DUEL_ARBITER: // 52991
4437 unitCaster->AddGameObject(go);
4438 break;
4441 default:
4442 break;
4443 }
4444
4445 go->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
4446
4447 go->SetOwnerGUID(unitCaster->GetGUID());
4448
4449 //go->SetLevel(unitCaster->getLevel());
4451
4453
4454 TC_LOG_DEBUG("spells", "AddObject at SpellEfects.cpp EffectTransmitted");
4455 //unitCaster->AddGameObject(go);
4456 //m_ObjToDel.push_back(go);
4457
4458 cMap->AddToMap(go);
4459
4460 if (GameObject* linkedTrap = go->GetLinkedTrap())
4461 {
4463
4464 linkedTrap->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
4465 //linkedTrap->SetLevel(unitCaster->getLevel());
4466 linkedTrap->SetSpellId(m_spellInfo->Id);
4467 linkedTrap->SetOwnerGUID(unitCaster->GetGUID());
4468
4470 }
4471}
4472
4474{
4476 return;
4477
4478 Player* player = m_caster->ToPlayer();
4479 if (!player)
4480 return;
4481
4483 return;
4484
4485 if (itemTarget->GetCount() < 5)
4486 return;
4487
4488 if (sWorld->getBoolConfig(CONFIG_SKILL_PROSPECTING))
4489 {
4490 uint32 SkillValue = player->GetPureSkillValue(SKILL_JEWELCRAFTING);
4491 uint32 reqSkillValue = itemTarget->GetTemplate()->GetRequiredSkillRank();
4492 player->UpdateGatherSkill(SKILL_JEWELCRAFTING, SkillValue, reqSkillValue);
4493 }
4494
4495 itemTarget->m_loot.reset(new Loot(player->GetMap(), itemTarget->GetGUID(), LOOT_PROSPECTING, nullptr));
4496 itemTarget->m_loot->FillLoot(itemTarget->GetEntry(), LootTemplates_Prospecting, player, true);
4497 player->SendLoot(*itemTarget->m_loot);
4498}
4499
4501{
4503 return;
4504
4505 Player* player = m_caster->ToPlayer();
4506 if (!player)
4507 return;
4508
4510 return;
4511
4512 if (itemTarget->GetCount() < 5)
4513 return;
4514
4515 if (sWorld->getBoolConfig(CONFIG_SKILL_MILLING))
4516 {
4517 uint32 SkillValue = player->GetPureSkillValue(SKILL_INSCRIPTION);
4518 uint32 reqSkillValue = itemTarget->GetTemplate()->GetRequiredSkillRank();
4519 player->UpdateGatherSkill(SKILL_INSCRIPTION, SkillValue, reqSkillValue);
4520 }
4521
4522 itemTarget->m_loot.reset(new Loot(player->GetMap(), itemTarget->GetGUID(), LOOT_MILLING, nullptr));
4523 itemTarget->m_loot->FillLoot(itemTarget->GetEntry(), LootTemplates_Milling, player, true);
4524 player->SendLoot(*itemTarget->m_loot);
4525}
4526
4528{
4530 return;
4531
4533 if (!playerTarget)
4534 return;
4535
4536 if (damage < 1)
4537 return;
4538
4539 uint32 skillid = effectInfo->MiscValue;
4540 if (playerTarget->GetSkillStep(skillid) >= damage)
4541 return;
4542
4543 SkillRaceClassInfoEntry const* rcEntry = sDB2Manager.GetSkillRaceClassInfo(skillid, playerTarget->GetRace(), playerTarget->GetClass());
4544 if (!rcEntry)
4545 return;
4546
4547 SkillTiersEntry const* tier = sObjectMgr->GetSkillTier(rcEntry->SkillTierID);
4548 if (!tier)
4549 return;
4550
4551 uint16 skillval = std::max<uint16>(1, playerTarget->GetPureSkillValue(skillid));
4552 uint16 maxSkillVal = tier->GetValueForTierIndex(damage - 1);
4553
4554 if (rcEntry->Flags & SKILL_FLAG_ALWAYS_MAX_VALUE)
4555 skillval = maxSkillVal;
4556
4557 playerTarget->SetSkill(skillid, damage, skillval, maxSkillVal);
4558}
4559
4561{
4562 Unit* caster = GetCaster()->ToUnit();
4564 caster->CastSpell(nullptr, SPELL_RESURRECTION_VISUAL, true);
4565
4567 return;
4568
4569 if (Player* playerTarget = unitTarget->ToPlayer())
4570 {
4571 if (!playerTarget->IsInWorld())
4572 return;
4573
4574 // skip if player does not want to live
4575 if (!playerTarget->CanAcceptAreaSpiritHealFrom(caster))
4576 return;
4577
4578 playerTarget->ResurrectPlayer(1.0f);
4579 playerTarget->CastSpell(playerTarget, SPELL_PET_SUMMONED, true);
4580 playerTarget->CastSpell(playerTarget, SPELL_SPIRIT_HEAL_MANA, true);
4581 playerTarget->SpawnCorpseBones(false);
4582 }
4583}
4584
4585// remove insignia spell effect
4587{
4589 return;
4590
4591 TC_LOG_DEBUG("spells", "Effect: SkinPlayerCorpse");
4592
4593 Player* player = m_caster->ToPlayer();
4594
4595 Player* target = nullptr;
4596 if (unitTarget)
4597 target = unitTarget->ToPlayer();
4598 else if (m_corpseTarget)
4600
4601 if (!player || !target || target->IsAlive())
4602 return;
4603
4604 target->RemovedInsignia(player);
4605}
4606
4608{
4610 return;
4611
4612 TC_LOG_DEBUG("spells", "Effect: StealBeneficialBuff");
4613
4614 if (!unitTarget || unitTarget == m_caster) // can't steal from self
4615 return;
4616
4617 DispelChargesList stealList;
4618
4619 // Create dispel mask by dispel type
4621 Unit::AuraMap const& auras = unitTarget->GetOwnedAuras();
4622 for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
4623 {
4624 Aura* aura = itr->second;
4625 AuraApplication const* aurApp = aura->GetApplicationOfTarget(unitTarget->GetGUID());
4626 if (!aurApp)
4627 continue;
4628
4629 if ((aura->GetSpellInfo()->GetDispelMask()) & dispelMask)
4630 {
4631 // Need check for passive? this
4632 if (!aurApp->IsPositive() || aura->IsPassive() || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR4_CANNOT_BE_STOLEN))
4633 continue;
4634
4635 // 2.4.3 Patch Notes: "Dispel effects will no longer attempt to remove effects that have 100% dispel resistance."
4637 if (!chance)
4638 continue;
4639
4640 // The charges / stack amounts don't count towards the total number of auras that can be dispelled.
4641 // Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell
4642 // Polymorph instead of 1 / (5 + 1) -> 16%.
4643 bool dispelCharges = aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISPEL_REMOVES_CHARGES);
4644 uint8 charges = dispelCharges ? aura->GetCharges() : aura->GetStackAmount();
4645 if (charges > 0)
4646 stealList.emplace_back(aura, chance, charges);
4647 }
4648 }
4649
4650 if (stealList.empty())
4651 return;
4652
4653 size_t remaining = stealList.size();
4654
4655 // Ok if exist some buffs for dispel try dispel it
4656 std::vector<std::tuple<uint32, ObjectGuid, int32>> successList;
4657 successList.reserve(damage);
4658
4660 dispelFailed.CasterGUID = m_caster->GetGUID();
4661 dispelFailed.VictimGUID = unitTarget->GetGUID();
4662 dispelFailed.SpellID = m_spellInfo->Id;
4663
4664 // dispel N = damage buffs (or while exist buffs for dispel)
4665 for (int32 count = 0; count < damage && remaining > 0;)
4666 {
4667 // Random select buff for dispel
4668 DispelChargesList::iterator itr = stealList.begin();
4669 std::advance(itr, urand(0, remaining - 1));
4670
4671 if (itr->RollDispel())
4672 {
4673 uint8 stolenCharges = 1;
4674 if (itr->GetAura()->GetSpellInfo()->HasAttribute(SPELL_ATTR1_DISPEL_ALL_STACKS))
4675 stolenCharges = itr->GetDispelCharges();
4676
4677 successList.emplace_back(itr->GetAura()->GetId(), itr->GetAura()->GetCasterGUID(), int32(stolenCharges));
4678 if (!itr->DecrementCharge(stolenCharges))
4679 {
4680 --remaining;
4681 std::swap(*itr, stealList[remaining]);
4682 }
4683 }
4684 else
4685 {
4686 dispelFailed.FailedSpells.push_back(int32(itr->GetAura()->GetId()));
4687 }
4688 ++count;
4689 }
4690
4691 if (!dispelFailed.FailedSpells.empty())
4692 m_caster->SendMessageToSet(dispelFailed.Write(), true);
4693
4694 if (successList.empty())
4695 return;
4696
4698 spellDispellLog.IsBreak = false; // TODO: use me
4699 spellDispellLog.IsSteal = true;
4700
4701 spellDispellLog.TargetGUID = unitTarget->GetGUID();
4702 spellDispellLog.CasterGUID = m_caster->GetGUID();
4703 spellDispellLog.DispelledBySpellID = m_spellInfo->Id;
4704
4705 for (auto const& [spellId, auraCaster, stolenCharges] : successList)
4706 {
4708 dispellData.SpellID = spellId;
4709 dispellData.Harmful = false; // TODO: use me
4710
4711 unitTarget->RemoveAurasDueToSpellBySteal(spellId, auraCaster, m_caster, stolenCharges);
4712
4713 spellDispellLog.DispellData.emplace_back(dispellData);
4714 }
4715
4716 m_caster->SendMessageToSet(spellDispellLog.Write(), true);
4717
4719}
4720
4722{
4724 return;
4725
4727 return;
4728
4730}
4731
4733{
4735 return;
4736
4738 return;
4739
4740 if (int32 creatureEntry = effectInfo->MiscValue)
4742}
4743
4745{
4747 return;
4748
4750 return;
4751
4753}
4754
4756{
4758 return;
4759
4760 if (!unitTarget)
4761 return;
4762
4763 Player* player = unitTarget->ToPlayer();
4764 if (!player)
4765 return;
4766
4767 if (Quest const* quest = sObjectMgr->GetQuestTemplate(effectInfo->MiscValue))
4768 {
4769 if (!player->CanTakeQuest(quest, false))
4770 return;
4771
4772 if (quest->IsAutoAccept() && player->CanAddQuest(quest, false))
4773 {
4774 player->AddQuestAndCheckCompletion(quest, player);
4775 player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GetGUID(), true, true);
4776 }
4777 else
4778 player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GetGUID(), true, false);
4779 }
4780}
4781
4783{
4785 return;
4786
4788 return;
4789
4790 uint32 creatureEntry = effectInfo->MiscValue;
4791 Pet* pet = unitTarget->CreateTamedPetFrom(creatureEntry, m_spellInfo->Id);
4792 if (!pet)
4793 return;
4794
4795 // relocate
4796 float px, py, pz;
4798 pet->Relocate(px, py, pz, unitTarget->GetOrientation());
4799
4800 // add to world
4801 pet->GetMap()->AddToMap(pet->ToCreature());
4802
4803 // unitTarget has pet now
4804 unitTarget->SetMinion(pet, true);
4805
4807 {
4810 }
4811}
4812
4814{
4816 return;
4817
4819 return;
4820 uint32 nodeid = effectInfo->MiscValue;
4821 if (sTaxiNodesStore.LookupEntry(nodeid))
4823}
4824
4826{
4828 return;
4829
4832}
4833
4835{
4837 return;
4838
4839 Unit* unitCaster = GetUnitCasterForEffectHandlers();
4840 if (!unitCaster)
4841 return;
4842
4843 if (unitTarget)
4845}
4846
4848{
4850 return;
4851
4852 if (!gameObjTarget)
4853 return;
4854
4855 FactionTemplateEntry const* casterFaction = m_caster->GetFactionTemplateEntry();
4856 FactionTemplateEntry const* targetFaction = sFactionTemplateStore.LookupEntry(gameObjTarget->GetFaction());
4857 // Do not allow to damage GO's of friendly factions (ie: Wintergrasp Walls/Ulduar Storm Beacons)
4858 if (!targetFaction || (casterFaction && !casterFaction->IsFriendlyTo(targetFaction)))
4860}
4861
4863{
4865 return;
4866
4867 if (!gameObjTarget)
4868 return;
4869
4871}
4872
4874{
4876 return;
4877
4878 if (!gameObjTarget)
4879 return;
4880
4882}
4883
4884void Spell::SummonGuardian(SpellEffectInfo const* effect, uint32 entry, SummonPropertiesEntry const* properties, uint32 numGuardians, ObjectGuid privateObjectOwner)
4885{
4886 Unit* unitCaster = GetUnitCasterForEffectHandlers();
4887 if (!unitCaster)
4888 return;
4889
4890 if (unitCaster->IsTotem())
4891 unitCaster = unitCaster->ToTotem()->GetOwner();
4892
4893 // in another case summon new
4894 float radius = 5.0f;
4896
4897 //TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
4898 Map* map = unitCaster->GetMap();
4899 for (uint32 count = 0; count < numGuardians; ++count)
4900 {
4901 Position pos;
4902 if (count == 0)
4903 pos = destTarget->GetPosition();
4904 else
4905 // randomize position for multiple summons
4906 pos = unitCaster->GetRandomPoint(*destTarget, radius);
4907
4908 TempSummon* summon = map->SummonCreature(entry, pos, properties, duration, unitCaster, m_spellInfo->Id, 0, privateObjectOwner);
4909 if (!summon)
4910 return;
4911
4912 if (summon->IsGuardian())
4913 {
4914 // level of pet summoned using engineering item based at engineering skill level
4915 if (m_CastItem && unitCaster->GetTypeId() == TYPEID_PLAYER)
4916 if (ItemTemplate const* proto = m_CastItem->GetTemplate())
4917 if (proto->GetRequiredSkill() == SKILL_ENGINEERING)
4918 if (uint16 skill202 = unitCaster->ToPlayer()->GetSkillValue(SKILL_ENGINEERING))
4919 static_cast<Guardian*>(summon)->InitStatsForLevel(skill202 / 5);
4920 }
4921
4923 ((Minion*)summon)->SetFollowAngle(unitCaster->GetAbsoluteAngle(summon));
4924
4925 if (summon->GetEntry() == 27893)
4926 {
4927 UF::VisibleItem const& weapon = m_caster->ToPlayer()->m_playerData->VisibleItems[EQUIPMENT_SLOT_MAINHAND];
4928 if (weapon.ItemID)
4929 {
4930 summon->SetDisplayId(11686); // modelid2
4931 summon->SetVirtualItem(0, weapon.ItemID, weapon.ItemAppearanceModID, weapon.ItemVisual);
4932 }
4933 else
4934 summon->SetDisplayId(1126); // modelid1
4935 }
4936
4938 }
4939}
4940
4942{
4944 return;
4945
4947 !unitTarget->IsPet() || ((Pet*)unitTarget)->getPetType() != HUNTER_PET)
4948 return;
4949
4951}
4952
4954{
4956 return;
4957
4959 return;
4960
4961 uint32 soundid = effectInfo->MiscValue;
4962
4963 if (!sSoundKitStore.LookupEntry(soundid))
4964 {
4965 TC_LOG_ERROR("spells", "EffectPlayMusic: Sound (Id: {}) does not exist in spell {}.", soundid, m_spellInfo->Id);
4966 return;
4967 }
4968
4970}
4971
4973{
4975 return;
4976
4978 return;
4979
4980 Player* player = unitTarget->ToPlayer();
4981 uint32 specID = m_misc.SpecializationId;
4982 ChrSpecializationEntry const* spec = sChrSpecializationStore.AssertEntry(specID);
4983
4984 // Safety checks done in Spell::CheckCast
4985 if (!spec->IsPetSpecialization())
4986 player->ActivateTalentGroup(spec);
4987 else
4988 player->GetPet()->SetSpecialization(specID);
4989}
4990
4992{
4994 return;
4995
4996 if (!unitTarget)
4997 return;
4998
4999 Player* player = unitTarget->ToPlayer();
5000 if (!player)
5001 return;
5002
5003 switch (m_spellInfo->Id)
5004 {
5005 case 91604: // Restricted Flight Area
5007 break;
5008 default:
5009 break;
5010 }
5011
5012 uint32 soundId = effectInfo->MiscValue;
5013
5014 if (!sSoundKitStore.LookupEntry(soundId))
5015 {
5016 TC_LOG_ERROR("spells", "EffectPlaySound: Sound (Id: {}) does not exist in spell {}.", soundId, m_spellInfo->Id);
5017 return;
5018 }
5019
5020 player->PlayDirectSound(soundId, player);
5021}
5022
5024{
5026 return;
5027
5028 if (!unitTarget)
5029 return;
5030 // there may be need of specifying casterguid of removed auras
5032}
5033
5035{
5037 return;
5038
5039 if (!unitTarget)
5040 return;
5041
5043}
5044
5046{
5048 return;
5049
5051 return;
5052
5053 if (!sCurrencyTypesStore.LookupEntry(effectInfo->MiscValue))
5054 return;
5055
5057}
5058
5060{
5062 return;
5063
5064 Player* player = m_caster->ToPlayer();
5065 if (!player)
5066 return;
5067
5068 uint32 button_id = effectInfo->MiscValue + 132;
5069 uint32 n_buttons = effectInfo->MiscValueB;
5070
5071 for (; n_buttons; --n_buttons, ++button_id)
5072 {
5073 ActionButton const* ab = player->GetActionButton(button_id);
5074 if (!ab || ab->GetType() != ACTION_BUTTON_SPELL)
5075 continue;
5076
5079 uint32 spell_id = ab->GetAction();
5080 if (!spell_id)
5081 continue;
5082
5083 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id, GetCastDifficulty());
5084 if (!spellInfo)
5085 continue;
5086
5087 if (!player->HasSpell(spell_id) || player->GetSpellHistory()->HasCooldown(spell_id))
5088 continue;
5089
5091 continue;
5092
5093 CastSpellExtraArgs args;
5095 args.OriginalCastId = m_castId;
5097 m_caster->CastSpell(m_caster, spellInfo->Id, args);
5098 }
5099}
5100
5102{
5104 return;
5105
5106 if (!unitTarget)
5107 return;
5108
5109 Player* player = unitTarget->ToPlayer();
5110 if (!player)
5111 return;
5112
5113 if (Item* item = player->GetItemByEntry(effectInfo->ItemType))
5114 {
5115 for (ItemEffectEntry const* itemEffect : item->GetEffects())
5116 if (itemEffect->LegacySlotIndex <= item->m_itemData->SpellCharges.size())
5117 item->SetSpellCharges(itemEffect->LegacySlotIndex, itemEffect->Charges);
5118
5119 item->SetState(ITEM_CHANGED, player);
5120 }
5121}
5122
5124{
5126 return;
5127
5129 return;
5130
5131 Player* player = unitTarget->ToPlayer();
5132
5133 WorldLocation homeLoc;
5134 uint32 areaId = player->GetAreaId();
5135
5136 if (effectInfo->MiscValue)
5137 areaId = effectInfo->MiscValue;
5138
5139 if (m_targets.HasDst())
5140 homeLoc.WorldRelocate(*destTarget);
5141 else
5142 homeLoc = player->GetWorldLocation();
5143
5144 player->SetHomebind(homeLoc, areaId);
5145 player->SendBindPointUpdate();
5146
5147 TC_LOG_DEBUG("spells", "EffectBind: New homebind X: {}, Y: {}, Z: {} O: {}, MapId: {}, AreaId: {}",
5148 homeLoc.GetPositionX(), homeLoc.GetPositionY(), homeLoc.GetPositionZ(), homeLoc.GetOrientation(), homeLoc.GetMapId(), areaId);
5149
5150 // zone update
5151 player->SendPlayerBound(m_caster->GetGUID(), areaId);
5152}
5153
5155{
5157 return;
5158
5159 if (Player* player = unitTarget->ToPlayer())
5160 if (WorldLocation const* dest = player->GetStoredAuraTeleportLocation(effectInfo->MiscValue))
5161 player->TeleportTo(*dest, unitTarget == m_caster ? TELE_TO_SPELL | TELE_TO_NOT_LEAVE_COMBAT : TELE_TO_NONE);
5162}
5163
5165{
5167 return;
5168
5169 if (damage <= 0)
5170 return;
5171
5172 if (Player* player = unitTarget->ToPlayer())
5173 player->IncreaseCurrencyCap(effectInfo->MiscValue, damage);
5174}
5175
5177{
5179 return;
5180
5182 return;
5183
5185}
5186
5188{
5190 return;
5191
5192 // Safety checks done in Spell::CheckCast
5193 Player* caster = m_caster->ToPlayer();
5194 if (Guild* guild = caster->GetGuild())
5195 guild->HandleBuyBankTab(caster->GetSession(), damage - 1); // Bank tabs start at zero internally
5196}
5197
5199{
5201 return;
5202
5203 uint32 goId = effectInfo->MiscValue;
5204 if (!goId)
5205 return;
5206
5207 float x, y, z, o;
5208 if (m_targets.HasDst())
5209 destTarget->GetPosition(x, y, z, o);
5210 else
5211 {
5213 o = m_caster->GetOrientation();
5214 }
5215
5216 Map* map = m_caster->GetMap();
5217 Position pos = Position(x, y, z, o);
5219 GameObject* go = GameObject::CreateGameObject(goId, map, pos, rot, 255, GO_STATE_READY);
5220
5221 if (!go)
5222 {
5223 TC_LOG_WARN("spells", "SpellEffect Failed to summon personal gameobject. SpellId {}, effect {}", m_spellInfo->Id, effectInfo->EffectIndex);
5224 return;
5225 }
5226
5228
5230
5231 go->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
5234
5236
5237 map->AddToMap(go);
5238
5239 if (GameObject* linkedTrap = go->GetLinkedTrap())
5240 {
5242
5243 linkedTrap->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
5244 linkedTrap->SetSpellId(m_spellInfo->Id);
5245
5247 }
5248}
5249
5251{
5253 return;
5254
5255 if (!unitTarget || !unitTarget->IsInWorld())
5256 return;
5257
5258 Player* target = unitTarget->ToPlayer();
5259 if (!target)
5260 return;
5261
5262 if (unitTarget->IsAlive())
5263 return;
5264
5265 if (target->IsResurrectRequested()) // already have one active request
5266 return;
5267
5268 uint32 health = target->CountPctFromMaxHealth(damage);
5270 uint32 resurrectAura = 0;
5271 if (sSpellMgr->GetSpellInfo(effectInfo->TriggerSpell, DIFFICULTY_NONE))
5272 resurrectAura = effectInfo->TriggerSpell;
5273
5274 if (resurrectAura && target->HasAura(resurrectAura))
5275 return;
5276
5278 target->SetResurrectRequestData(m_caster, health, mana, resurrectAura);
5279 SendResurrectRequest(target);
5280}
5281
5283{
5285 return;
5286
5287 Unit* unitCaster = GetUnitCasterForEffectHandlers();
5288 if (!unitCaster || !m_targets.HasDst())
5289 return;
5290
5291 AreaTriggerCreatePropertiesId createPropertiesId = { uint32(effectInfo->MiscValue), false };
5292 int32 duration = GetSpellInfo()->CalcDuration(GetCaster());
5293
5294 AreaTrigger::CreateAreaTrigger(createPropertiesId, destTarget->GetPosition(), duration, unitCaster, nullptr, m_SpellVisual, GetSpellInfo(), this);
5295}
5296
5298{
5300 return;
5301
5302 TalentEntry const* talent = sTalentStore.LookupEntry(m_misc.TalentId);
5303 if (!talent)
5304 return;
5305
5306 Player* player = unitTarget ? unitTarget->ToPlayer() : nullptr;
5307 if (!player)
5308 return;
5309
5310 player->RemoveTalent(talent);
5311 player->SendTalentsInfoData();
5312}
5313
5315{
5317 return;
5318
5320 return;
5321
5322 Player* player = unitTarget->ToPlayer();
5323 if (Item* item = player->GetItemByEntry(effectInfo->ItemType))
5324 player->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
5325}
5326
5328{
5330 return;
5331
5333 return;
5334
5335 if (Garrison* garrison = unitTarget->ToPlayer()->GetGarrison())
5336 garrison->LearnBlueprint(effectInfo->MiscValue);
5337}
5338
5340{
5342 return;
5343
5344 if (!unitTarget)
5345 return;
5346
5348 {
5349 return aurApp->GetBase()->GetSpellInfo()->HasLabel(effectInfo->MiscValue);
5350 });
5351}
5352
5354{
5356 return;
5357
5359 return;
5360
5362}
5363
5365{
5367 return;
5368
5369 Unit* unitCaster = GetUnitCasterForEffectHandlers();
5370 if (!unitCaster || !m_targets.HasDst())
5371 return;
5372
5374}
5375
5377{
5379 return;
5380
5381 if (!unitTarget)
5382 return;
5383
5384 std::vector<WorldObject*> objs;
5387 Cell::VisitGridObjects(unitTarget, checker, 100.0f);
5388
5389 for (WorldObject* obj : objs)
5390 {
5391 if (Conversation* convo = obj->ToConversation())
5392 convo->Remove();
5393 }
5394}
5395
5397{
5399 return;
5400
5402 return;
5403
5404 if (Garrison* garrison = unitTarget->ToPlayer()->GetGarrison())
5405 garrison->AddFollower(effectInfo->MiscValue);
5406}
5407
5409{
5411 return;
5412
5413 Player* player = m_caster->ToPlayer();
5414 if (!player)
5415 return;
5416
5417 CollectionMgr* collectionMgr = player->GetSession()->GetCollectionMgr();
5418 if (!collectionMgr)
5419 return;
5420
5421 std::vector<int32> bonusList;
5422 bonusList.push_back(collectionMgr->GetHeirloomBonus(m_misc.Raw.Data[0]));
5423
5424 DoCreateItem(m_misc.Raw.Data[0], ItemContext::NONE, &bonusList);
5426}
5427
5429{
5431 return;
5432
5434 return;
5435
5436 if (Garrison* garrison = unitTarget->ToPlayer()->GetGarrison())
5437 garrison->ActivateBuilding(effectInfo->MiscValue);
5438}
5439
5441{
5443 return;
5444
5445 Player* playerCaster = m_caster->ToPlayer();
5446 if (!playerCaster)
5447 return;
5448
5449 if (!unitTarget || !unitTarget->IsCreature())
5450 return;
5451
5453}
5454
5456{
5458 return;
5459
5460 Player* playerTarget = Object::ToPlayer(unitTarget);
5461 if (!playerTarget)
5462 return;
5463
5465 playerTarget->GiveXP(xp, nullptr);
5466}
5467
5469{
5471 return;
5472
5473 Player* playerTarget = Object::ToPlayer(unitTarget);
5474 if (!playerTarget)
5475 return;
5476
5477 // effect value is number of resting hours
5478 playerTarget->GetRestMgr().AddRestBonus(REST_TYPE_XP, damage * HOUR * playerTarget->GetRestMgr().CalcExtraPerSec(REST_TYPE_XP, 0.125f));
5479}
5480
5482{
5484 return;
5485
5487 return;
5488
5490 battlePetMgr->HealBattlePetsPct(damage);
5491}
5492
5494{
5496 return;
5497
5498 if (!unitTarget || !unitTarget->IsPlayer())
5499 return;
5500
5501 Player* player = unitTarget->ToPlayer();
5504}
5505
5507{
5509 return;
5510
5511 Player* playerCaster = m_caster->ToPlayer();
5512 if (!playerCaster)
5513 return;
5514
5515 if (!unitTarget || !unitTarget->IsCreature())
5516 return;
5517
5518 auto qualityItr = std::lower_bound(sBattlePetBreedQualityStore.begin(), sBattlePetBreedQualityStore.end(), damage, [](BattlePetBreedQualityEntry const* a1, int32 selector)
5519 {
5520 return a1->MaxQualityRoll < selector;
5521 });
5522
5524 if (qualityItr != sBattlePetBreedQualityStore.end())
5525 quality = BattlePets::BattlePetBreedQuality(qualityItr->QualityEnum);
5526
5528}
5529
5531{
5533 return;
5534
5535 if (!unitTarget || !unitTarget->IsPlayer())
5536 return;
5537
5539}
5540
5542{
5544 return;
5545
5547 return;
5548
5554
5555 BattlePetSpeciesEntry const* speciesEntry = sBattlePetSpeciesStore.LookupEntry(speciesId);
5556 if (!speciesEntry)
5557 return;
5558
5559 Player* player = m_caster->ToPlayer();
5560 BattlePets::BattlePetMgr* battlePetMgr = player->GetSession()->GetBattlePetMgr();
5561 if (!battlePetMgr)
5562 return;
5563
5564 if (battlePetMgr->GetMaxPetLevel() < level)
5565 {
5568 return;
5569 }
5570
5571 if (battlePetMgr->HasMaxPetCount(speciesEntry, player->GetGUID()))
5572 {
5575 return;
5576 }
5577
5578 battlePetMgr->AddPet(speciesId, displayId, breed, BattlePets::BattlePetBreedQuality(quality), level);
5579
5580 player->SendPlaySpellVisual(player, BattlePets::SPELL_VISUAL_UNCAGE_PET, 0, 0, 0.f, false);
5581
5582 player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
5583 m_CastItem = nullptr;
5584}
5585
5587{
5589 return;
5590
5591 if (Player* player = m_caster->ToPlayer())
5592 if (CollectionMgr* collectionMgr = player->GetSession()->GetCollectionMgr())
5593 collectionMgr->UpgradeHeirloom(m_misc.Raw.Data[0], int32(m_castItemEntry));
5594}
5595
5597{
5599 return;
5600
5601 if (!itemTarget)
5602 return;
5603
5604 Player* player = m_caster->ToPlayer();
5605 if (!player || player->GetGUID() != itemTarget->GetOwnerGUID())
5606 return;
5607
5610 if (itemTarget->IsEquipped())
5612
5615}
5616
5618{
5620 return;
5621
5623 return;
5624
5626}
5627
5629{
5631 return;
5632
5634 return;
5635
5637}
5638
5640{
5642 return;
5643
5644 Player* playerCaster = m_caster->ToPlayer();
5645 if (!playerCaster)
5646 return;
5647
5648 if (Aura* artifactAura = playerCaster->GetAura(ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE))
5649 if (Item* artifact = playerCaster->GetItemByGuid(artifactAura->GetCastItemGUID()))
5650 artifact->GiveArtifactXp(damage, m_CastItem, uint32(effectInfo->MiscValue));
5651}
5652
5654{
5656 return;
5657
5659 return;
5660
5662 if (Item* artifact = unitTarget->ToPlayer()->GetItemByGuid(artifactAura->GetCastItemGUID()))
5663 artifact->GiveArtifactXp(damage, m_CastItem, 0);
5664}
5665
5667{
5669 return;
5670
5672 return;
5673
5675}
5676
5677template<typename TargetInfo>
5678bool IsUnitTargetSceneObjectAura(Spell const* spell, TargetInfo const& target)
5679{
5680 if (target.TargetGUID != spell->GetCaster()->GetGUID())
5681 return false;
5682
5683 for (SpellEffectInfo const& spellEffectInfo : spell->GetSpellInfo()->GetEffects())
5684 if (target.EffectMask & (1 << spellEffectInfo.EffectIndex) && spellEffectInfo.IsUnitOwnedAuraEffect())
5685 return true;
5686
5687 return false;
5688}
5689
5691{
5693 return;
5694
5695 Unit* unitCaster = GetUnitCasterForEffectHandlers();
5696 if (!unitCaster || !m_targets.HasDst())
5697 return;
5698
5700 {
5701 bool hasAuraTargetingCaster = std::find_if(m_UniqueTargetInfo.begin(), m_UniqueTargetInfo.end(), [this](TargetInfo const& target)
5702 {
5703 return IsUnitTargetSceneObjectAura(this, target);
5704 }) != m_UniqueTargetInfo.end();
5705
5706 if (hasAuraTargetingCaster)
5707 sceneObject->SetCreatedBySpellCast(m_castId);
5708 }
5709}
5710
5712{
5714 return;
5715
5716 Unit* unitCaster = GetUnitCasterForEffectHandlers();
5717 if (!unitCaster || !m_targets.HasDst())
5718 return;
5719
5720 if (SceneObject* sceneObject = SceneObject::CreateSceneObject(effectInfo->MiscValue, unitCaster, destTarget->GetPosition(), unitCaster->GetGUID()))
5721 {
5722 bool hasAuraTargetingCaster = std::find_if(m_UniqueTargetInfo.begin(), m_UniqueTargetInfo.end(), [this](TargetInfo const& target)
5723 {
5724 return IsUnitTargetSceneObjectAura(this, target);
5725 }) != m_UniqueTargetInfo.end();
5726
5727 if (hasAuraTargetingCaster)
5728 sceneObject->SetCreatedBySpellCast(m_castId);
5729 }
5730}
5731
5733{
5735 return;
5736
5738 return;
5739
5741}
5742
5744{
5746 return;
5747
5749 return;
5750
5752 packet.Honor = damage;
5753 packet.OriginalHonor = damage;
5754
5755 Player* playerTarget = unitTarget->ToPlayer();
5756 playerTarget->AddHonorXP(damage);
5757 playerTarget->SendDirectMessage(packet.Write());
5758}
5759
5761{
5763 return;
5764
5765 Unit* unitCaster = GetUnitCasterForEffectHandlers();
5766 if (!unitCaster)
5767 return;
5768
5769 if (unitCaster->IsInFlight())
5770 return;
5771
5772 JumpChargeParams const* params = sObjectMgr->GetJumpChargeParams(effectInfo->MiscValue);
5773 if (!params)
5774 return;
5775
5776 float speed = params->Speed;
5777 if (params->TreatSpeedAsMoveTimeSeconds)
5778 speed = unitCaster->GetExactDist(destTarget) / params->MoveTimeInSec;
5779
5782 {
5783 arrivalCast.emplace();
5784 arrivalCast->SpellId = effectInfo->TriggerSpell;
5785 }
5786
5788 if (params->SpellVisualId || params->ProgressCurveId || params->ParabolicCurveId)
5789 {
5790 effectExtra.emplace();
5791 if (params->SpellVisualId)
5792 effectExtra->SpellVisualId = *params->SpellVisualId;
5793
5794 if (params->ProgressCurveId)
5795 effectExtra->ProgressCurveId = *params->ProgressCurveId;
5796
5797 if (params->ParabolicCurveId)
5798 effectExtra->ParabolicCurveId = *params->ParabolicCurveId;
5799 }
5800
5801 unitCaster->GetMotionMaster()->MoveJumpWithGravity(*destTarget, speed, params->JumpGravity, EVENT_JUMP, false,
5802 arrivalCast ? &*arrivalCast : nullptr,
5803 effectExtra ? &*effectExtra : nullptr);
5804}
5805
5807{
5809 return;
5810
5812 return;
5813
5815}
5816
5818{
5820 return;
5821
5823 return;
5824
5825 Player* owner = m_caster->ToPlayer();
5826 if (!owner)
5827 return;
5828
5829 AzeriteEmpoweredItem* azeriteEmpoweredItem = itemTarget->ToAzeriteEmpoweredItem();
5830 owner->ModifyMoney(-azeriteEmpoweredItem->GetRespecCost());
5831
5832 // reapply all item mods - item level change affects stats and auras
5833 if (azeriteEmpoweredItem->IsEquipped())
5834 owner->_ApplyItemMods(azeriteEmpoweredItem, azeriteEmpoweredItem->GetSlot(), false);
5835
5836 azeriteEmpoweredItem->ClearSelectedAzeritePowers();
5837
5838 if (azeriteEmpoweredItem->IsEquipped())
5839 owner->_ApplyItemMods(azeriteEmpoweredItem, azeriteEmpoweredItem->GetSlot(), true);
5840
5841 azeriteEmpoweredItem->SetState(ITEM_CHANGED, owner);
5842 owner->SetNumRespecs(owner->GetNumRespecs() + 1);
5843}
5844
5846{
5848 return;
5849
5850 Player* playerTarget = unitTarget ? unitTarget->ToPlayer() : nullptr;
5851 if (!playerTarget)
5852 return;
5853
5855 if (!heartOfAzeroth)
5856 return;
5857
5858 AzeriteItem* azeriteItem = heartOfAzeroth->ToAzeriteItem();
5859 if (!azeriteItem)
5860 return;
5861
5862 // remove old rank and apply new one
5863 if (azeriteItem->IsEquipped())
5864 {
5865 if (UF::SelectedAzeriteEssences const* selectedEssences = azeriteItem->GetSelectedAzeriteEssences())
5866 {
5867 for (int32 slot = 0; slot < MAX_AZERITE_ESSENCE_SLOT; ++slot)
5868 {
5869 if (selectedEssences->AzeriteEssenceID[slot] == uint32(effectInfo->MiscValue))
5870 {
5871 bool major = AzeriteItemMilestoneType(sDB2Manager.GetAzeriteItemMilestonePower(slot)->Type) == AzeriteItemMilestoneType::MajorEssence;
5872 playerTarget->ApplyAzeriteEssence(azeriteItem, effectInfo->MiscValue, MAX_AZERITE_ESSENCE_RANK, major, false);
5873 playerTarget->ApplyAzeriteEssence(azeriteItem, effectInfo->MiscValue, effectInfo->MiscValueB, major, false);
5874 break;
5875 }
5876 }
5877 }
5878 }
5879
5881 azeriteItem->SetState(ITEM_CHANGED, playerTarget);
5882}
5883
5885{
5887 return;
5888
5890 return;
5891
5893}
5894
5896{
5898 return;
5899
5900 Unit* unitCaster = GetUnitCasterForEffectHandlers();
5901 if (!unitCaster)
5902 return;
5903
5904 uint32 broadcastTextId = effectInfo->MiscValue;
5905 if (!sBroadcastTextStore.LookupEntry(broadcastTextId))
5906 return;
5907
5908 ChatMsg chatType = ChatMsg(effectInfo->MiscValueB);
5909 unitCaster->Talk(broadcastTextId, chatType, CreatureTextMgr::GetRangeForChatType(chatType), unitTarget);
5910}
5911
5913{
5915 return;
5916
5917 Player* playerCaster = m_caster->ToPlayer();
5918 if (!playerCaster)
5919 return;
5920
5921 if (!unitTarget || !unitTarget->IsCreature())
5922 return;
5923
5925}
5926
5928{
5930 return;
5931
5933 if (!player)
5934 return;
5935
5936 uint32 illusionId = effectInfo->MiscValue;
5937 if (!sTransmogIllusionStore.LookupEntry(illusionId))
5938 return;
5939
5940 player->GetSession()->GetCollectionMgr()->AddTransmogIllusion(illusionId);
5941}
5942
5944{
5946 return;
5947
5949 if (!targetAura)
5950 return;
5951
5952 switch (effectInfo->MiscValue)
5953 {
5954 case 0:
5955 targetAura->ModStackAmount(damage);
5956 break;
5957 case 1:
5958 targetAura->SetStackAmount(damage);
5959 break;
5960 default:
5961 break;
5962 }
5963}
5964
5966{
5968 return;
5969
5971}
5972
5974{
5976 return;
5977
5978 unitTarget->GetSpellHistory()->ModifyCoooldowns([this](SpellHistory::CooldownStorageType::iterator itr)
5979 {
5980 SpellInfo const* spellOnCooldown = sSpellMgr->AssertSpellInfo(itr->first, DIFFICULTY_NONE);
5981 if (spellOnCooldown->SpellFamilyName != uint32(effectInfo->MiscValue))
5982 return false;
5983
5984 int32 bitIndex = effectInfo->MiscValueB - 1;
5985 if (bitIndex < 0 || uint32(bitIndex) >= sizeof(flag128) * 8)
5986 return false;
5987
5988 flag128 reqFlag;
5989 reqFlag[bitIndex / 32] = 1u << (bitIndex % 32);
5990 return bool(spellOnCooldown->SpellFamilyFlags & reqFlag);
5991 }, Milliseconds(damage));
5992}
5993
5995{
5997 return;
5998
5999 unitTarget->GetSpellHistory()->ModifyCoooldowns([this](SpellHistory::CooldownStorageType::iterator itr)
6000 {
6001 return sSpellMgr->AssertSpellInfo(itr->first, DIFFICULTY_NONE)->CategoryId == uint32(effectInfo->MiscValue);
6002 }, Milliseconds(damage));
6003}
6004
6006{
6008 return;
6009
6010 for (int32 i = 0; i < damage; ++i)
6012}
6013
6015{
6017 return;
6018
6020 if (!target)
6021 return;
6022
6025 if (newConfig.Type != TraitConfigType::Generic)
6026 return;
6027
6028 newConfig.TraitSystemID = sTraitTreeStore.AssertEntry(effectInfo->MiscValue)->TraitSystemID;
6029 int32 existingConfigForSystem = target->m_activePlayerData->TraitConfigs.FindIndexIf([&](UF::TraitConfig const& config)
6030 {
6031 return static_cast<TraitConfigType>(*config.Type) == TraitConfigType::Generic
6032 && config.TraitSystemID == newConfig.TraitSystemID;
6033 });
6034
6035 if (existingConfigForSystem < 0)
6036 target->CreateTraitConfig(newConfig);
6037}
6038
6040{
6042 return;
6043
6045 if (!target)
6046 return;
6047
6048 WorldPackets::Traits::TraitConfig* traitConfig = std::any_cast<WorldPackets::Traits::TraitConfig>(&m_customArg);
6049 if (!traitConfig)
6050 return;
6051
6052 target->UpdateTraitConfig(std::move(*traitConfig), damage, false);
6053}
6054
6056{
6058 return;
6059
6061 if (!target)
6062 return;
6063
6064 target->RepopAtGraveyard();
6065}
constexpr uint32 ITEM_ID_HEART_OF_AZEROTH
Definition: AzeriteItem.h:23
@ SPELL_PET_SUMMONED
Definition: Battleground.h:124
@ SPELL_SPIRIT_HEAL_MANA
Definition: Battleground.h:110
@ SPELL_RESURRECTION_VISUAL
Definition: Battleground.h:107
@ IN_MILLISECONDS
Definition: Common.h:35
@ MINUTE
Definition: Common.h:29
@ HOUR
Definition: Common.h:30
DB2Storage< BattlePetBreedQualityEntry > sBattlePetBreedQualityStore("BattlePetBreedQuality.db2", &BattlePetBreedQualityLoadInfo::Instance)
DB2Storage< TaxiNodesEntry > sTaxiNodesStore("TaxiNodes.db2", &TaxiNodesLoadInfo::Instance)
DB2Storage< TransmogIllusionEntry > sTransmogIllusionStore("TransmogIllusion.db2", &TransmogIllusionLoadInfo::Instance)
DB2Storage< TraitTreeEntry > sTraitTreeStore("TraitTree.db2", &TraitTreeLoadInfo::Instance)
DB2Storage< ChrSpecializationEntry > sChrSpecializationStore("ChrSpecialization.db2", &ChrSpecializationLoadInfo::Instance)
DB2Storage< BattlePetSpeciesEntry > sBattlePetSpeciesStore("BattlePetSpecies.db2", &BattlePetSpeciesLoadInfo::Instance)
DB2Storage< SummonPropertiesEntry > sSummonPropertiesStore("SummonProperties.db2", &SummonPropertiesLoadInfo::Instance)
DB2Storage< BroadcastTextEntry > sBroadcastTextStore("BroadcastText.db2", &BroadcastTextLoadInfo::Instance)
DB2Storage< CurrencyTypesEntry > sCurrencyTypesStore("CurrencyTypes.db2", &CurrencyTypesLoadInfo::Instance)
DB2Storage< GlyphPropertiesEntry > sGlyphPropertiesStore("GlyphProperties.db2", &GlyphPropertiesLoadInfo::Instance)
DB2Storage< ContentTuningEntry > sContentTuningStore("ContentTuning.db2", &ContentTuningLoadInfo::Instance)
DB2Storage< SpellItemEnchantmentEntry > sSpellItemEnchantmentStore("SpellItemEnchantment.db2", &SpellItemEnchantmentLoadInfo::Instance)
DB2Storage< TalentEntry > sTalentStore("Talent.db2", &TalentLoadInfo::Instance)
DB2Storage< MovieEntry > sMovieStore("Movie.db2", &MovieLoadInfo::Instance)
DB2Storage< FactionTemplateEntry > sFactionTemplateStore("FactionTemplate.db2", &FactionTemplateLoadInfo::Instance)
DB2Storage< SoundKitEntry > sSoundKitStore("SoundKit.db2", &SoundKitLoadInfo::Instance)
DB2Storage< AreaTableEntry > sAreaTableStore("AreaTable.db2", &AreaTableLoadInfo::Instance)
DB2Storage< FactionEntry > sFactionStore("Faction.db2", &FactionLoadInfo::Instance)
#define sDB2Manager
Definition: DB2Stores.h:538
#define MAX_VEHICLE_SEATS
#define MAX_ITEM_ENCHANTMENT_EFFECTS
TraitConfigType
Definition: DBCEnums.h:2185
@ SKILL_FLAG_ALWAYS_MAX_VALUE
Definition: DBCEnums.h:1910
@ ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET
Definition: DBCEnums.h:1009
@ DIFFICULTY_NONE
Definition: DBCEnums.h:874
#define MAX_EFFECT_MASK
Definition: DBCEnums.h:1954
AzeriteItemMilestoneType
Definition: DBCEnums.h:206
ItemContext
Definition: DBCEnums.h:1063
#define MAX_AZERITE_ESSENCE_RANK
Definition: DBCEnums.h:203
#define MAX_SPELL_EFFECTS
Definition: DBCEnums.h:1953
#define MAX_AZERITE_ESSENCE_SLOT
Definition: DBCEnums.h:202
uint8_t uint8
Definition: Define.h:144
int64_t int64
Definition: Define.h:137
int8_t int8
Definition: Define.h:140
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
#define UI64LIT(N)
Definition: Define.h:127
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
std::unordered_set< uint32 > params[2]
Definition: DisableMgr.cpp:50
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:29
@ DYNAMIC_OBJECT_FARSIGHT_FOCUS
Definition: DynamicObject.h:33
@ DYNAMIC_OBJECT_AREA_SPELL
Definition: DynamicObject.h:32
#define ASSERT_NOTNULL(pointer)
Definition: Errors.h:84
#define ASSERT
Definition: Errors.h:68
GameObjectActions
@ GO_JUST_DEACTIVATED
Definition: GameObject.h:159
#define FISHING_BOBBER_READY_TIME
Definition: GameObject.h:163
@ GRID_MAP_TYPE_MASK_CONVERSATION
Definition: GridDefines.h:88
uint32 const MinNewsItemLevel
Definition: Guild.h:260
@ GUILD_NEWS_ITEM_CRAFTED
Definition: Guild.h:244
EnchantmentSlot
Definition: ItemDefines.h:178
@ PERM_ENCHANTMENT_SLOT
Definition: ItemDefines.h:179
@ TEMP_ENCHANTMENT_SLOT
Definition: ItemDefines.h:180
@ PRISMATIC_ENCHANTMENT_SLOT
Definition: ItemDefines.h:185
InventoryResult
Definition: ItemDefines.h:25
@ EQUIP_ERR_CLIENT_LOCKED_OUT
Definition: ItemDefines.h:66
@ EQUIP_ERR_ITEM_NOT_FOUND
Definition: ItemDefines.h:49
@ EQUIP_ERR_OK
Definition: ItemDefines.h:26
@ EQUIP_ERR_INV_FULL
Definition: ItemDefines.h:77
@ EQUIP_ERR_ITEM_MAX_COUNT
Definition: ItemDefines.h:43
@ ITEM_MODIFIER_ENCHANT_ILLUSION_ALL_SPECS
Definition: ItemDefines.h:218
@ ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID
Definition: ItemDefines.h:217
@ ITEM_MODIFIER_BATTLE_PET_BREED_DATA
Definition: ItemDefines.h:215
@ ITEM_MODIFIER_BATTLE_PET_SPECIES_ID
Definition: ItemDefines.h:214
@ ITEM_MODIFIER_BATTLE_PET_LEVEL
Definition: ItemDefines.h:216
ItemRandomBonusListId GenerateItemRandomBonusListId(uint32 item_id)
@ ITEM_CLASS_ARMOR
Definition: ItemTemplate.h:424
@ ITEM_CLASS_WEAPON
Definition: ItemTemplate.h:422
@ ITEM_FIELD_FLAG_UNLOCKED
Definition: ItemTemplate.h:133
@ ITEM_SPELLTRIGGER_ON_LEARN
Definition: ItemTemplate.h:110
@ ITEM_FLAG_IS_MILLABLE
Definition: ItemTemplate.h:205
@ ITEM_FLAG_NO_REAGENT_COST
Definition: ItemTemplate.h:204
@ ITEM_FLAG_IS_PROSPECTABLE
Definition: ItemTemplate.h:194
@ ITEM_CHANGED
Definition: Item.h:55
@ LANG_ZONE_NOFLYZONE
Definition: Language.h:768
#define TC_LOG_WARN(filterType__,...)
Definition: Log.h:162
#define TC_LOG_DEBUG(filterType__,...)
Definition: Log.h:156
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:165
#define sLog
Definition: Log.h:130
LootStore LootTemplates_Spell("spell_loot_template", "spell id (random item creating)", false)
LootStore LootTemplates_Skinning("skinning_loot_template", "creature skinning id", true)
LootStore LootTemplates_Milling("milling_loot_template", "item entry (herb)", true)
LootStore LootTemplates_Disenchant("disenchant_loot_template", "item disenchant id", true)
LootStore LootTemplates_Prospecting("prospecting_loot_template", "item entry (ore)", true)
LootStore LootTemplates_Pickpocketing("pickpocketing_loot_template", "creature pickpocket lootid", true)
@ LOOT_PICKPOCKETING
Definition: Loot.h:102
@ LOOT_MILLING
Definition: Loot.h:115
@ LOOT_DISENCHANTING
Definition: Loot.h:104
@ LOOT_SKINNING
Definition: Loot.h:106
@ LOOT_PROSPECTING
Definition: Loot.h:114
@ LOOT_ERROR_ALREADY_PICKPOCKETED
Definition: Loot.h:149
#define SPEED_CHARGE
TempSummonType
Definition: ObjectDefines.h:62
@ TEMPSUMMON_DEAD_DESPAWN
Definition: ObjectDefines.h:69
@ TEMPSUMMON_MANUAL_DESPAWN
Definition: ObjectDefines.h:70
@ TEMPSUMMON_TIMED_DESPAWN
Definition: ObjectDefines.h:65
#define DEFAULT_PLAYER_BOUNDING_RADIUS
Definition: ObjectDefines.h:39
@ TYPEID_UNIT
Definition: ObjectGuid.h:40
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
std::set< ObjectGuid > GuidSet
Definition: ObjectGuid.h:393
ScriptMapMap sSpellScripts
Definition: ObjectMgr.cpp:78
#define sObjectMgr
Definition: ObjectMgr.h:1946
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
#define sOutdoorPvPMgr
#define PET_FOLLOW_DIST
Definition: PetDefines.h:97
@ HUNTER_PET
Definition: PetDefines.h:32
PetSaveMode
Definition: PetDefines.h:41
@ PET_SAVE_NOT_IN_SLOT
Definition: PetDefines.h:48
@ PET_SAVE_AS_CURRENT
Definition: PetDefines.h:43
@ EQUIPMENT_SLOT_MAINHAND
Definition: Player.h:646
std::vector< ItemPosCount > ItemPosCountVec
Definition: Player.h:750
@ DAMAGE_FIRE
Definition: Player.h:822
@ INVENTORY_SLOT_BAG_END
Definition: Player.h:676
TeleportToOptions
Definition: Player.h:800
@ TELE_TO_SPELL
Definition: Player.h:806
@ TELE_TO_NOT_LEAVE_COMBAT
Definition: Player.h:804
@ TELE_TO_NOT_UNSUMMON_PET
Definition: Player.h:805
@ TELE_TO_NONE
Definition: Player.h:801
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition: Player.h:803
@ PLAYER_FLAGS_PET_BATTLES_UNLOCKED
Definition: Player.h:452
@ CHEAT_GOD
Definition: Player.h:949
@ ACTION_BUTTON_SPELL
Definition: Player.h:292
@ SPEC_RESET_TALENTS
Definition: Player.h:217
#define INVENTORY_SLOT_BAG_0
Definition: Player.h:625
@ REPUTATION_SOURCE_SPELL
Definition: Player.h:311
#define MAPID_INVALID
Definition: Position.h:176
#define MAX_QUEST_LOG_SIZE
Definition: QuestDef.h:44
QuestStatus
Definition: QuestDef.h:141
@ QUEST_STATUS_NONE
Definition: QuestDef.h:142
@ QUEST_FLAGS_FLAGS_PVP
Definition: QuestDef.h:207
@ QUEST_FLAGS_TRACKING_EVENT
Definition: QuestDef.h:204
float rand_norm()
Definition: Random.cpp:75
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
bool roll_chance_f(float chance)
Definition: Random.h:53
bool roll_chance_i(int chance)
Definition: Random.h:59
@ REST_TYPE_XP
Definition: RestMgr.h:28
if(posix_memalign(&__mallocedMemory, __align, __size)) return NULL
@ PlayerNonInteractablePhased
#define sScriptMgr
Definition: ScriptMgr.h:1418
SpellEffIndex
Definition: SharedDefines.h:29
@ SPELL_ATTR9_SPECIAL_DELAY_CALCULATION
@ SPELL_ATTR7_DISPEL_REMOVES_CHARGES
@ SPELL_ATTR7_CAN_BE_MULTI_CAST
@ SPELL_ATTR7_ATTACK_ON_CHARGE_TO_UNIT
@ CLASS_HUNTER
@ GAMEOBJECT_TYPE_DUEL_ARBITER
@ GAMEOBJECT_TYPE_TRAP
@ GAMEOBJECT_TYPE_CHEST
@ GAMEOBJECT_TYPE_FISHINGHOLE
@ GAMEOBJECT_TYPE_FLAGDROP
@ GAMEOBJECT_TYPE_FLAGSTAND
@ GAMEOBJECT_TYPE_GOOBER
@ GAMEOBJECT_TYPE_FISHINGNODE
@ GAMEOBJECT_TYPE_RITUAL
@ SPELL_MISS_REFLECT
@ SPELL_SCHOOL_MASK_NORMAL
@ EVENT_JUMP
@ SPELL_ATTR2_RETAIN_ITEM_CAST
SummonTitle
@ SPELL_ATTR1_DISPEL_ALL_STACKS
@ UNIT_DYNFLAG_LOOTABLE
@ UNIT_DYNFLAG_NONE
@ ITEM_QUALITY_EPIC
@ TEAM_ALLIANCE
@ TEAM_HORDE
SpellEffectName
@ SPELL_EFFECT_TRIGGER_MISSILE_SPELL_WITH_VALUE
@ SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE
@ SPELL_EFFECT_SUMMON_OBJECT_SLOT1
@ SPELL_EFFECT_WEAPON_DAMAGE
@ SPELL_EFFECT_NORMALIZED_WEAPON_DMG
@ SPELL_EFFECT_TRIGGER_SPELL
@ SPELL_EFFECT_WEAPON_PERCENT_DAMAGE
@ SPELL_EFFECT_KNOCK_BACK_DEST
@ SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL
@ SPELL_EFFECT_PERSISTENT_AREA_AURA
@ TOTAL_SPELL_EFFECTS
@ SPELL_EFFECT_FORCE_CAST
@ SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC
@ SPELL_EFFECT_FORCE_CAST_WITH_VALUE
@ SUMMON_SLOT_TOTEM
@ OFF_ATTACK
@ BASE_ATTACK
@ RANGED_ATTACK
Mechanics
@ MECHANIC_NONE
GameObjectDestructibleState
@ ALLIANCE
Powers
@ MAX_POWERS
@ POWER_RAGE
@ POWER_ENERGY
@ POWER_MANA
@ POWER_FOCUS
@ SPELL_ATTR0_IS_TRADESKILL
#define MAX_TOTEM_SLOT
@ BATTLEGROUND_EY
SpellCastResult
@ SPELL_FAILED_DONT_REPORT
@ SPELL_FAILED_NO_DUELING
@ SPELL_CAST_OK
@ SPELL_FAILED_CANT_ADD_BATTLE_PET
@ SPELLFAMILY_PRIEST
@ SPELLFAMILY_WARLOCK
@ SPELLFAMILY_GENERIC
@ SPELLFAMILY_WARRIOR
@ SPELLFAMILY_SHAMAN
@ SPELLFAMILY_DRUID
@ SPELLFAMILY_DEATHKNIGHT
DispelType
ChatMsg
@ GO_STATE_READY
@ SPELL_ATTR4_CANNOT_BE_STOLEN
@ SUMMON_CATEGORY_PET
@ SUMMON_CATEGORY_VEHICLE
@ SUMMON_CATEGORY_ALLY
@ SUMMON_CATEGORY_PUPPET
@ SUMMON_CATEGORY_WILD
@ SUMMON_CATEGORY_UNK
SkillType
@ SKILL_INSCRIPTION
@ SKILL_ENGINEERING
@ SKILL_NONE
@ SKILL_SKINNING
@ SKILL_JEWELCRAFTING
@ SPELL_ATTR6_IGNORE_CASTER_DAMAGE_MODIFIERS
bool CanCreateExtraItems(Player *player, uint32 spellId, float &additionalChance, uint8 &additionalMax)
bool CanCreatePerfectItem(Player *player, uint32 spellId, float &perfectCreateChance, uint32 &perfectItemType)
@ AURA_REMOVE_BY_ENEMY_SPELL
@ SPELL_AURA_CONTROL_VEHICLE
@ SPELL_AURA_MOD_STALKED
@ SPELL_AURA_OVERRIDE_SUMMONED_OBJECT
@ SPELL_AURA_MOD_STUN
@ TARGET_FLAG_DEST_LOCATION
Definition: SpellDefines.h:286
@ TARGET_FLAG_UNIT_MASK
Definition: SpellDefines.h:307
@ TARGET_FLAG_GAMEOBJECT_MASK
Definition: SpellDefines.h:309
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
Definition: SpellDefines.h:266
@ TRIGGERED_CAST_DIRECTLY
In Spell::prepare, will be cast directly without setting containers for executed spell.
Definition: SpellDefines.h:254
@ TRIGGERED_IGNORE_CAST_IN_PROGRESS
Will not check if a current cast is in progress.
Definition: SpellDefines.h:252
@ TRIGGERED_IGNORE_GCD
Will ignore GCD.
Definition: SpellDefines.h:247
@ TRIGGERED_DONT_REPORT_CAST_ERROR
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
Definition: SpellDefines.h:265
SpellValueMod
Definition: SpellDefines.h:195
@ SPELLVALUE_PARENT_SPELL_TARGET_COUNT
Definition: SpellDefines.h:235
@ SPELLVALUE_PARENT_SPELL_TARGET_INDEX
Definition: SpellDefines.h:236
@ SPELLVALUE_BASE_POINT0
Definition: SpellDefines.h:196
TeleportToOptions GetTeleportOptions(WorldObject const *caster, Unit const *unitTarget, SpellDestination const &targetDest)
bool IsUnitTargetSceneObjectAura(Spell const *spell, TargetInfo const &target)
NonDefaultConstructible< SpellEffectHandlerFn > SpellEffectHandlers[TOTAL_SPELL_EFFECTS]
@ SPELL_ATTR0_CU_SHARE_DAMAGE
Definition: SpellInfo.h:151
bool IsPartOfSkillLine(uint32 skillId, uint32 spellId)
Definition: SpellMgr.cpp:118
@ PROC_SPELL_PHASE_HIT
Definition: SpellMgr.h:264
#define sSpellMgr
Definition: SpellMgr.h:849
@ PROC_SPELL_TYPE_MASK_ALL
Definition: SpellMgr.h:255
@ PROC_FLAG_NONE
Definition: SpellMgr.h:135
@ PROC_FLAG_2_KNOCKBACK
Definition: SpellMgr.h:234
@ PROC_HIT_DISPEL
Definition: SpellMgr.h:288
@ PROC_HIT_INTERRUPT
Definition: SpellMgr.h:286
@ PROC_HIT_NONE
Definition: SpellMgr.h:273
std::vector< std::pair< uint32, ObjectGuid > > DispelList
Definition: Spell.h:250
@ SPELL_EFFECT_HANDLE_LAUNCH_TARGET
Definition: Spell.h:245
@ SPELL_EFFECT_HANDLE_LAUNCH
Definition: Spell.h:244
@ SPELL_EFFECT_HANDLE_HIT
Definition: Spell.h:246
@ SPELL_EFFECT_HANDLE_HIT_TARGET
Definition: Spell.h:247
@ SPELL_STATE_PREPARING
Definition: Spell.h:235
@ SPELL_STATE_CASTING
Definition: Spell.h:236
@ MOVE_RUN
Definition: UnitDefines.h:118
@ UNIT_PET_FLAG_CAN_BE_RENAMED
Definition: UnitDefines.h:109
@ REACT_DEFENSIVE
Definition: UnitDefines.h:507
@ REACT_AGGRESSIVE
Definition: UnitDefines.h:508
@ SPELL_DIRECT_DAMAGE
Definition: UnitDefines.h:133
@ HEAL
Definition: UnitDefines.h:135
@ UNIT_FLAG3_ALREADY_SKINNED
Definition: UnitDefines.h:263
@ COMMAND_STAY
Definition: UnitDefines.h:526
@ UNIT_FLAG_IMMUNE
Definition: UnitDefines.h:175
@ UNIT_FLAG_SKINNABLE
Definition: UnitDefines.h:170
@ UNIT_MASK_MINION
Definition: Unit.h:351
UnitMods
Definition: Unit.h:172
@ UNIT_MOD_DAMAGE_OFFHAND
Definition: Unit.h:214
@ UNIT_MOD_DAMAGE_RANGED
Definition: Unit.h:215
@ UNIT_MOD_DAMAGE_MAINHAND
Definition: Unit.h:213
@ ALIVE
Definition: Unit.h:246
#define CURRENT_FIRST_NON_MELEE_SPELL
Definition: Unit.h:595
CurrentSpellTypes
Definition: Unit.h:588
@ CURRENT_AUTOREPEAT_SPELL
Definition: Unit.h:592
@ UNIT_STATE_CONFUSED
Definition: Unit.h:266
@ UNIT_STATE_ROOT
Definition: Unit.h:265
@ UNIT_STATE_FLEEING
Definition: Unit.h:262
@ UNIT_STATE_ALL_ERASABLE
Definition: Unit.h:302
@ UNIT_STATE_STUNNED
Definition: Unit.h:258
std::vector< DispelableAura > DispelChargesList
Definition: Unit.h:146
@ NULL_BAG
Definition: Unit.h:62
@ NULL_SLOT
Definition: Unit.h:63
#define ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE
Definition: Unit.h:37
@ TOTAL_PCT
Definition: Unit.h:161
T AddPct(T &base, U pct)
Definition: Util.h:85
T ApplyPct(T &base, U pct)
Definition: Util.h:91
T CalculatePct(T base, U pct)
Definition: Util.h:72
@ VEHICLE_SPELL_RIDE_HARDCODED
static AreaTrigger * CreateAreaTrigger(AreaTriggerCreatePropertiesId areaTriggerCreatePropertiesId, Position const &pos, int32 duration, Unit *caster, Unit *target, SpellCastVisual spellVisual={ 0, 0 }, SpellInfo const *spellInfo=nullptr, Spell *spell=nullptr, AuraEffect const *aurEff=nullptr)
bool IsPositive() const
Definition: SpellAuras.h:84
Aura * GetBase() const
Definition: SpellAuras.h:78
uint32 GetEffectsToApply() const
Definition: SpellAuras.h:87
void UpdateApplyEffectMask(uint32 newEffMask, bool canHandleNewEffects)
Definition: SpellAuras.cpp:185
static Aura * TryCreate(AuraCreateInfo &createInfo)
Definition: SpellAuras.cpp:377
void SetStackAmount(uint8 num)
AuraApplication const * GetApplicationOfTarget(ObjectGuid guid) const
DynamicObject * GetDynobjOwner() const
Definition: SpellAuras.h:148
void _RegisterForTargets()
Definition: SpellAuras.h:160
ObjectGuid GetCasterGUID() const
Definition: SpellAuras.h:139
uint32 GetId() const
Definition: SpellAuras.h:135
int32 CalcDispelChance(Unit const *auraTarget, bool offensive) const
DynObjAura * ToDynObjAura()
Definition: SpellAuras.h:297
bool ModStackAmount(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT, bool resetPeriodicTimer=true)
uint8 GetStackAmount() const
Definition: SpellAuras.h:189
void _ApplyEffectForTargets(uint8 effIndex)
Definition: SpellAuras.cpp:752
uint8 GetCharges() const
Definition: SpellAuras.h:180
SpellInfo const * GetSpellInfo() const
Definition: SpellAuras.h:134
bool IsPassive() const
UF::SelectedAzeriteEssences const * GetSelectedAzeriteEssences() const
void SetEssenceRank(uint32 azeriteEssenceId, uint32 rank)
void GrantBattlePetExperience(ObjectGuid guid, uint16 xp, BattlePetXpSource xpSource)
static uint16 RollPetBreed(uint32 species)
uint16 GetMaxPetLevel() const
static uint32 SelectPetDisplay(BattlePetSpeciesEntry const *speciesEntry)
void UnlockSlot(BattlePetSlot slot)
static BattlePetSpeciesEntry const * GetBattlePetSpeciesBySpell(uint32 spellId)
void AddPet(uint32 species, uint32 display, uint16 breed, BattlePetBreedQuality quality, uint16 level=1)
void GrantBattlePetLevel(ObjectGuid guid, uint16 grantedLevels)
bool HasMaxPetCount(BattlePetSpeciesEntry const *battlePetSpecies, ObjectGuid ownerGuid) const
void SendError(BattlePetError error, uint32 creatureId)
void ChangeBattlePetQuality(ObjectGuid guid, BattlePetBreedQuality quality)
static BattlePetBreedQuality GetDefaultPetQuality(uint32 species)
void AddTransmogSet(uint32 transmogSetId)
uint32 GetHeirloomBonus(uint32 itemId) const
void AddTransmogIllusion(uint32 transmogIllusionId)
static Conversation * CreateConversation(uint32 conversationEntry, Unit *creator, Position const &pos, ObjectGuid privateObjectOwner, SpellInfo const *spellInfo=nullptr, bool autoStart=true)
ObjectGuid GetOwnerGUID() const override
Definition: Corpse.h:98
static float GetRangeForChatType(ChatMsg msgType)
std::unique_ptr< Loot > m_loot
Definition: Creature.h:277
CreatureDifficulty const * GetCreatureDifficulty() const
Definition: Creature.h:252
std::unordered_map< ObjectGuid, std::unique_ptr< Loot > > m_personalLoot
Definition: Creature.h:278
uint8 GetLevelForTarget(WorldObject const *target) const override
Definition: Creature.cpp:3104
void StartPickPocketRefillTimer()
Definition: Creature.cpp:3559
void SetReactState(ReactStates st)
Definition: Creature.h:160
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
bool CanGeneratePickPocketLoot() const
Definition: Creature.cpp:3564
bool IsElite() const
Definition: Creature.cpp:2476
void SetImmuneToAll(bool apply) override
Definition: Creature.h:167
bool IsIgnoringSanctuarySpellEffect() const
Definition: Creature.h:324
void SetDisplayId(uint32 displayId, bool setNative=false) override
Definition: Creature.cpp:3402
uint32 GetResist() const
Definition: Unit.h:449
uint32 GetDamage() const
Definition: Unit.h:446
uint32 GetAbsorb() const
Definition: Unit.h:448
TeleportToOptions _options
DelayedSpellTeleportEvent(Unit *target, WorldLocation const &targetDest, TeleportToOptions options, uint32 spellId)
bool Execute(uint64, uint32) override
void SetCasterViewpoint()
void SetDuration(int32 newDuration)
bool CreateDynamicObject(ObjectGuid::LowType guidlow, Unit *caster, SpellInfo const *spell, Position const &pos, float radius, DynamicObjectType type, SpellCastVisual spellVisual)
void AddEventAtOffset(BasicEvent *event, Milliseconds offset)
GameObjectTemplate const * GetGOInfo() const
Definition: GameObject.h:202
uint32 GetFaction() const override
Definition: GameObject.h:388
static GameObject * CreateGameObject(uint32 entry, Map *map, Position const &pos, QuaternionData const &rotation, uint32 animProgress, GOState goState, uint32 artKit=0)
void SetOwnerGUID(ObjectGuid owner)
Definition: GameObject.h:232
void SetDestructibleState(GameObjectDestructibleState state, WorldObject *attackerOrHealer=nullptr, bool setHealth=false)
void AddToSkillupList(ObjectGuid const &PlayerGuidLow)
Definition: GameObject.h:312
void SetLootState(LootState s, Unit *unit=nullptr)
GameObject * GetLinkedTrap()
void SetRespawnTime(int32 respawn)
bool IsInSkillupList(ObjectGuid const &playerGuid) const
Definition: GameObject.h:313
GameobjectTypes GetGoType() const
Definition: GameObject.h:279
void SetLevel(uint32 level)
Definition: GameObject.h:278
void ModifyHealth(int32 change, WorldObject *attackerOrHealer=nullptr, uint32 spellId=0)
void Use(Unit *user)
void ActivateObject(GameObjectActions action, int32 param, WorldObject *spellCaster=nullptr, uint32 spellId=0, int32 effectIndex=-1)
void AddUniqueUse(Player *player)
void SetSpellId(uint32 id)
Definition: GameObject.h:244
void SetFaction(uint32 faction) override
Definition: GameObject.h:389
Definition: Group.h:197
bool IsAssistant(ObjectGuid guid) const
Definition: Group.h:311
void AddRaidMarker(uint8 markerId, uint32 mapId, float positionX, float positionY, float positionZ, ObjectGuid transportGuid=ObjectGuid::Empty)
Definition: Group.cpp:1586
bool IsLeader(ObjectGuid guid) const
Definition: Group.cpp:1700
ObjectGuid GetGUID() const
Definition: Group.cpp:1663
bool isRaidGroup() const
Definition: Group.cpp:1638
Definition: Guild.h:329
Definition: Unit.h:456
Definition: Item.h:170
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition: Item.cpp:1166
uint8 GetSlot() const
Definition: Item.h:280
void SetItemFlag(ItemFieldFlags flags)
Definition: Item.h:209
Trinity::IteratorPair< ItemEffectEntry const *const * > GetEffects() const
Definition: Item.h:354
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition: Item.h:298
bool IsVellum() const
Definition: Item.h:334
bool IsAzeriteEmpoweredItem() const
Definition: Item.h:254
AzeriteItem * ToAzeriteItem()
Definition: Item.h:243
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
Definition: Item.h:299
void SetCount(uint32 value)
Definition: Item.cpp:1275
void SetModifier(ItemModifier modifier, uint32 value)
Definition: Item.cpp:2436
ItemTemplate const * GetTemplate() const
Definition: Item.cpp:1141
ItemContext GetContext() const
Definition: Item.h:441
bool IsEquipped() const
Definition: Item.cpp:1244
Player * GetOwner() const
Definition: Item.cpp:1146
ObjectGuid GetOwnerGUID() const
Definition: Item.h:188
uint16 GetPos() const
Definition: Item.h:284
ItemDisenchantLootEntry const * GetDisenchantLoot(Player const *owner) const
Definition: Item.cpp:2360
std::unique_ptr< Loot > m_loot
Definition: Item.h:317
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
Definition: Item.h:300
void ClearSoulboundTradeable(Player *currentOwner)
Definition: Item.cpp:1913
uint32 GetCount() const
Definition: Item.h:273
AzeriteEmpoweredItem * ToAzeriteEmpoweredItem()
Definition: Item.h:245
uint8 GetBagSlot() const
Definition: Item.cpp:1239
uint32 GetModifier(ItemModifier modifier) const
Definition: Item.cpp:2423
void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster=ObjectGuid::Empty)
Definition: Item.cpp:1421
UF::UpdateField< UF::ItemData, 0, TYPEID_ITEM > m_itemData
Definition: Item.h:449
static Item * CreateItem(uint32 itemEntry, uint32 count, ItemContext context, Player const *player=nullptr, bool addDefaultBonuses=true)
Definition: Item.cpp:1625
Definition: Map.h:189
bool IsDungeon() const
Definition: Map.cpp:3238
void ScriptsStart(std::map< uint32, std::multimap< uint32, ScriptInfo > > const &scripts, uint32 id, Object *source, Object *target)
Put scripts in the execution queue.
Definition: MapScripts.cpp:34
bool AddToMap(T *)
Definition: Map.cpp:550
TempSummon * SummonCreature(uint32 entry, Position const &pos, SummonPropertiesEntry const *properties=nullptr, Milliseconds duration=0ms, WorldObject *summoner=nullptr, uint32 spellId=0, uint32 vehId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty, SmoothPhasingInfo const *smoothPhasingInfo=nullptr)
Definition: Object.cpp:1836
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:519
GameObject * GetGameObject(ObjectGuid const &guid)
Definition: Map.cpp:3489
Creature * GetCreature(ObjectGuid const &guid)
Definition: Map.cpp:3479
Unit * GetOwner() const
float GetFollowAngle() const override
void MoveJumpWithGravity(Position const &pos, float speedXY, float gravity, uint32 id=EVENT_JUMP, bool hasOrientation=false, JumpArrivalCastArgs const *arrivalCast=nullptr, Movement::SpellEffectExtraData const *spellEffectExtraData=nullptr)
void MoveJump(Position const &pos, float speedXY, float speedZ, uint32 id=EVENT_JUMP, bool hasOrientation=false, JumpArrivalCastArgs const *arrivalCast=nullptr, Movement::SpellEffectExtraData const *spellEffectExtraData=nullptr)
void CalculateJumpSpeeds(float dist, UnitMoveType moveType, float speedMultiplier, float minHeight, float maxHeight, float &speedXY, float &speedZ) const
void MoveCharge(float x, float y, float z, float speed=SPEED_CHARGE, uint32 id=EVENT_CHARGE, bool generatePath=false, Unit const *target=nullptr, Movement::SpellEffectExtraData const *spellEffectExtraData=nullptr)
void MoveDistract(uint32 time, float orientation)
static ObjectGuid const Empty
Definition: ObjectGuid.h:274
bool IsEmpty() const
Definition: ObjectGuid.h:319
std::string ToString() const
Definition: ObjectGuid.cpp:554
void Clear()
Definition: ObjectGuid.h:286
Definition: Object.h:150
void SetDynamicFlag(uint32 flag)
Definition: Object.h:169
static Creature * ToCreature(Object *o)
Definition: Object.h:219
bool IsPlayer() const
Definition: Object.h:212
static Unit * ToUnit(Object *o)
Definition: Object.h:225
Player * ToPlayer()
Definition: Object.h:215
static GameObject * ToGameObject(Object *o)
Definition: Object.h:231
bool IsInWorld() const
Definition: Object.h:154
static Conversation * ToConversation(Object *o)
Definition: Object.h:261
TypeID GetTypeId() const
Definition: Object.h:173
void ReplaceAllDynamicFlags(uint32 flag)
Definition: Object.h:171
uint32 GetEntry() const
Definition: Object.h:161
bool IsCreature() const
Definition: Object.h:218
Creature * ToCreature()
Definition: Object.h:221
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
static Player * ToPlayer(Object *o)
Definition: Object.h:213
float GetPathLength() const
bool CalculatePath(float destX, float destY, float destZ, bool forceDest=false)
std::array< Optional< PetInfo >, MAX_ACTIVE_PETS > ActivePets
Definition: PetDefines.h:158
Definition: Pet.h:40
void SetSpecialization(uint16 spec)
Definition: Pet.cpp:1898
Player * GetOwner() const
Definition: Pet.cpp:1794
void SavePetToDB(PetSaveMode mode)
Definition: Pet.cpp:452
bool isControlled() const
Definition: Pet.h:53
void setDeathState(DeathState s) override
Definition: Pet.cpp:599
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition: Pet.cpp:712
bool learnSpell(uint32 spell_id)
Definition: Pet.cpp:1446
static void InheritPhaseShift(WorldObject *target, WorldObject const *source)
static bool OnConditionChange(WorldObject *object, bool updateVisibility=true)
bool HasIgnore(ObjectGuid const &ignoreGuid, ObjectGuid const &ignoreAccountGuid)
Definition: SocialMgr.cpp:189
void LearnSpell(uint32 spell_id, bool dependent, int32 fromSkill=0, bool suppressMessaging=false, Optional< int32 > traitDefinitionId={})
Definition: Player.cpp:3216
void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const &store, ItemContext context=ItemContext::NONE, bool broadcast=false, bool createdByPlayer=false)
Definition: Player.cpp:26395
void SendMovieStart(uint32 movieId)
Definition: Player.cpp:6338
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 KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition: Player.cpp:16680
void SendPlayerBound(ObjectGuid const &binderGuid, uint32 areaId) const
Definition: Player.cpp:17607
uint32 GetArmorProficiency() const
Definition: Player.h:1485
static bool IsEquipmentPos(uint16 pos)
Definition: Player.h:1365
void ApplyAzeriteEssence(AzeriteItem *item, uint32 azeriteEssenceId, uint32 rank, bool major, bool apply)
Definition: Player.cpp:8557
uint8 GetNumRespecs() const
Definition: Player.h:2837
Item * StoreNewItem(ItemPosCountVec const &pos, uint32 itemId, bool update, ItemRandomBonusListId randomBonusListId=0, GuidSet const &allowedLooters=GuidSet(), ItemContext context=ItemContext::NONE, std::vector< int32 > const *bonusListIDs=nullptr, bool addToCollection=true)
Definition: Player.cpp:11537
bool HasPvPForcingQuest() const
Definition: Player.cpp:17391
uint32 GetNextResetTalentsCost() const
Definition: Player.cpp:3496
bool ModifyMoney(int64 amount, bool sendError=true)
Definition: Player.cpp:24098
InventoryResult CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading=true) const
Definition: Player.cpp:10896
void SetPlayerFlag(PlayerFlags flags)
Definition: Player.h:2738
PlayerSocial * GetSocial() const
Definition: Player.h:1163
UF::UpdateField< UF::PlayerData, 0, TYPEID_PLAYER > m_playerData
Definition: Player.h:2863
void SendBindPointUpdate() const
Definition: Player.cpp:17598
uint32 EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
Definition: Player.cpp:634
uint8 GetDrunkValue() const
Definition: Player.h:2288
void SendDirectMessage(WorldPacket const *data) const
Definition: Player.cpp:6324
uint16 GetSkillValue(uint32 skill) const
Definition: Player.cpp:6052
Item * BankItem(ItemPosCountVec const &dest, Item *pItem, bool update)
Definition: Player.cpp:12043
void RemoveTalent(TalentEntry const *talent)
Definition: Player.cpp:2722
void DespawnPersonalSummonsForQuest(uint32 questId)
Definition: Player.cpp:16363
uint16 FindQuestSlot(uint32 quest_id) const
Definition: Player.cpp:16432
void SetCanParry(bool value)
Definition: Player.cpp:26103
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap=false) const
Definition: Player.cpp:10037
void CreateGarrison(uint32 garrSiteId)
Definition: Player.cpp:29216
Pet * SummonPet(uint32 entry, Optional< PetSaveMode > slot, float x, float y, float z, float ang, uint32 despwtime, bool *isNew=nullptr)
Definition: Player.cpp:29444
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options=TELE_TO_NONE, Optional< uint32 > instanceId={})
Definition: Player.cpp:1250
void SetCanTitanGrip(bool value, uint32 penaltySpellId=0)
Definition: Player.cpp:13324
void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask) const
Definition: Player.cpp:22444
void SendTalentsInfoData()
Definition: Player.cpp:27287
void UpdatePvPState(bool onlyFFA=false)
Definition: Player.cpp:23317
void DurabilityLossAll(double percent, bool inventory)
Definition: Player.cpp:4611
void AddHonorXP(uint32 xp)
Definition: Player.cpp:6921
uint32 GetDeathTimer() const
Definition: Player.h:2291
void SendPlayerChoice(ObjectGuid sender, int32 choiceId)
Definition: Player.cpp:29251
void _ApplyItemMods(Item *item, uint8 slot, bool apply, bool updateItemAuras=true)
Definition: Player.cpp:7865
void GiveXP(uint32 xp, Unit *victim, float group_rate=1.0f)
Definition: Player.cpp:2210
void SetResurrectRequestData(WorldObject const *caster, uint32 health, uint32 mana, uint32 appliedAura)
Definition: Player.cpp:23402
Item * GetItemByEntry(uint32 entry, ItemSearchLocation where=ItemSearchLocation::Default) const
Definition: Player.cpp:12589
void SpawnCorpseBones(bool triggerSave=true)
Definition: Player.cpp:4598
void SetDrunkValue(uint8 newDrunkValue, uint32 itemId=0)
Definition: Player.cpp:887
std::vector< uint32 > const & GetGlyphs(uint8 spec) const
Definition: Player.h:1877
PetStable * GetPetStable()
Definition: Player.h:1222
void PetSpellInitialize()
Definition: Player.cpp:21879
SceneMgr & GetSceneMgr()
Definition: Player.h:2715
void SetFallInformation(uint32 time, float z)
Definition: Player.cpp:26672
void ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool apply_dur=true, bool ignore_condition=false)
Definition: Player.cpp:13577
void ActivateTalentGroup(ChrSpecializationEntry const *spec)
Definition: Player.cpp:27923
bool UpdateCraftSkill(SpellInfo const *spellInfo)
Definition: Player.cpp:5541
bool CanAddQuest(Quest const *quest, bool msg) const
Definition: Player.cpp:14632
InventoryResult CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap, bool not_loading=true, bool reagentBankOnly=false) const
Definition: Player.cpp:11172
void SetSkill(uint32 id, uint16 step, uint16 newVal, uint16 maxVal)
Definition: Player.cpp:5786
Pet * GetPet() const
Definition: Player.cpp:21513
WorldLocation m_homebind
Definition: Player.h:2503
Guild * GetGuild()
Definition: Player.cpp:29432
void SetNumRespecs(uint8 numRespecs)
Definition: Player.h:2838
uint16 GetPureSkillValue(uint32 skill) const
Definition: Player.cpp:6108
void RemoveTradeableItem(Item *item)
Definition: Player.cpp:13414
void SetCanBlock(bool value)
Definition: Player.cpp:26112
bool GetCommandStatus(uint32 command) const
Definition: Player.h:1206
Item * StoreItem(ItemPosCountVec const &pos, Item *pItem, bool update)
Definition: Player.cpp:11612
WorldSession * GetSession() const
Definition: Player.h:2101
void UpdateAreaDependentAuras(uint32 area_id)
Definition: Player.cpp:25785
Item * GetItemByPos(uint16 pos) const
Definition: Player.cpp:9582
RestMgr & GetRestMgr() const
Definition: Player.h:2717
void RepopAtGraveyard()
Definition: Player.cpp:4832
uint32 GetQuestSlotQuestId(uint16 slot) const
Definition: Player.cpp:16441
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition: Player.cpp:12180
bool IsResurrectRequested() const
Definition: Player.h:1933
static bool IsInventoryPos(uint16 pos)
Definition: Player.h:1363
bool ActivateTaxiPathTo(std::vector< uint32 > const &nodes, Creature *npc=nullptr, uint32 spellid=0, uint32 preferredMountDisplay=0)
Definition: Player.cpp:22506
void SendLoot(Loot &loot, bool aeLooting=false)
Definition: Player.cpp:9119
void UpdateTraitConfig(WorldPackets::Traits::TraitConfig &&newConfig, int32 savedConfigId, bool withCastTime)
Definition: Player.cpp:28256
uint32 DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check=false)
Definition: Player.cpp:12281
void RemovePet(Pet *pet, PetSaveMode mode, bool returnreagent=false)
Definition: Player.cpp:21537
int32 CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool noQuestBonus=false)
Definition: Player.cpp:6504
ActionButton const * GetActionButton(uint8 button)
Definition: Player.cpp:6264
void DurabilityLoss(Item *item, double percent)
Definition: Player.cpp:4635
uint32 GetWeaponProficiency() const
Definition: Player.h:1484
void SendRespecWipeConfirm(ObjectGuid const &guid, uint32 cost, SpecResetType respecType) const
Definition: Player.cpp:9210
Battleground * GetBattleground() const
Definition: Player.cpp:24976
void SetRewardedQuest(uint32 quest_id)
Definition: Player.cpp:15437
uint16 GetSkillStep(uint32 skill) const
Definition: Player.cpp:6040
void AutoUnequipOffhandIfNeed(bool force=false)
Definition: Player.cpp:25403
void ItemAddedQuestCheck(uint32 entry, uint32 count, Optional< bool > boundItemFlagRequirement={}, bool *hadBoundItemObjective=nullptr)
Definition: Player.cpp:16624
Item * EquipItem(uint16 pos, Item *pItem, bool update)
Definition: Player.cpp:11754
void SetDuelArbiter(ObjectGuid guid)
Definition: Player.h:1976
PvPInfo pvpInfo
Definition: Player.h:1953
void SetQuestSlot(uint16 slot, uint32 quest_id)
Definition: Player.cpp:16505
void AddQuestAndCheckCompletion(Quest const *quest, Object *questGiver)
Definition: Player.cpp:14774
void DurabilityPointsLossAll(int32 points, bool inventory)
Definition: Player.cpp:4655
bool CanTakeQuest(Quest const *quest, bool msg) const
Definition: Player.cpp:14620
uint32 GetProfessionSkillForExp(uint32 skill, int32 expansion) const
Definition: Player.cpp:6005
uint8 GetActiveTalentGroup() const
Definition: Player.h:1843
void RemoveSpell(uint32 spell_id, bool disabled=false, bool learn_low_rank=true, bool suppressMessaging=false)
Definition: Player.cpp:3260
void SendSummonRequestFrom(Unit *summoner)
Definition: Player.cpp:25306
void AreaExploredOrEventHappens(uint32 questId)
Definition: Player.cpp:16577
bool TakeQuestSourceItem(uint32 questId, bool msg)
Definition: Player.cpp:15999
void RemoveActiveQuest(uint32 questId, bool update=true)
Definition: Player.cpp:16093
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition: Player.cpp:16050
UF::UpdateField< UF::ActivePlayerData, 0, TYPEID_ACTIVE_PLAYER > m_activePlayerData
Definition: Player.h:2864
Garrison * GetGarrison() const
Definition: Player.h:2710
void CreateTraitConfig(WorldPackets::Traits::TraitConfig &traitConfig)
Definition: Player.cpp:28195
void AddArmorProficiency(uint32 newflag)
Definition: Player.h:1483
void SetHomebind(WorldLocation const &loc, uint32 areaId)
Definition: Player.cpp:17581
void FailQuest(uint32 quest_id)
Definition: Player.cpp:15446
static bool IsBankPos(uint16 pos)
Definition: Player.h:1368
void RemoveItem(uint8 bag, uint8 slot, bool update)
Definition: Player.cpp:12048
bool HasSpell(uint32 spell) const override
Definition: Player.cpp:3792
Group * GetGroup(Optional< uint8 > partyIndex)
Definition: Player.h:2606
std::unique_ptr< DuelInfo > duel
Definition: Player.h:1972
void RemoveRewardedQuest(uint32 questId, bool update=true)
Definition: Player.cpp:16113
void DurabilityPointsLoss(Item *item, int32 points)
Definition: Player.cpp:4679
void SetVisibleItemSlot(uint8 slot, Item *pItem)
Definition: Player.cpp:11995
Item * GetItemByGuid(ObjectGuid guid) const
Definition: Player.cpp:9566
void RemovedInsignia(Player *looterPlr)
Definition: Player.cpp:9062
bool UpdateGatherSkill(uint32 skillId, uint32 skillValue, uint32 redLevel, uint32 multiplicator=1, WorldObject const *object=nullptr)
Definition: Player.cpp:5576
void AddWeaponProficiency(uint32 newflag)
Definition: Player.h:1482
void ModifyCurrency(uint32 id, int32 amount, CurrencyGainSource gainSource=CurrencyGainSource::Cheat, CurrencyDestroyReason destroyReason=CurrencyDestroyReason::Cheat)
Modify currency amount.
Definition: Player.cpp:7110
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition: Player.cpp:10032
std::unique_ptr< PlayerMenu > PlayerTalkClass
Definition: Player.h:2380
ReputationMgr & GetReputationMgr()
Definition: Player.h:2251
void AddPetAura(PetAura const *petSpell)
Definition: Player.cpp:21636
void RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject *pRewardSource)
Definition: Player.cpp:25645
void SendNewItem(Item *item, uint32 quantity, bool received, bool created, bool broadcast=false, uint32 dungeonEncounterId=0)
Definition: Player.cpp:13990
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition: Player.cpp:4408
uint32 XPValue(Player const *player) const
Definition: QuestDef.cpp:386
bool HasFlag(QuestFlags flag) const
Definition: QuestDef.h:569
bool ModifyReputation(FactionEntry const *factionEntry, int32 standing, bool spillOverOnly=false, bool noSpillover=false)
void AddRestBonus(RestTypes restType, float restBonus)
Definition: RestMgr.cpp:85
float CalcExtraPerSec(RestTypes restType, float bubble) const
Definition: RestMgr.cpp:161
uint32 PlaySceneByPackageId(uint32 sceneScriptPackageId, EnumFlag< SceneFlag > playbackflags, Position const *position=nullptr)
Definition: SceneMgr.cpp:83
uint32 PlayScene(uint32 sceneId, Position const *position=nullptr)
Definition: SceneMgr.cpp:36
static SceneObject * CreateSceneObject(uint32 sceneId, Unit *creator, Position const &pos, ObjectGuid privateObjectOwner)
Definition: SceneObject.cpp:92
void SetItemTarget(Item *item)
Definition: Spell.cpp:295
void SetDst(float x, float y, float z, float orientation, uint32 mapId=MAPID_INVALID)
Definition: Spell.cpp:373
void SetGOTarget(GameObject *target)
Definition: Spell.cpp:252
ObjectGuid GetObjectTargetGUID() const
Definition: Spell.cpp:283
void SetUnitTarget(Unit *target)
Definition: Spell.cpp:226
bool HasDst() const
Definition: Spell.cpp:425
Item * GetItemTarget() const
Definition: SpellDefines.h:360
Unit * GetUnitTarget() const
Definition: Spell.cpp:218
void Update(WorldObject *caster)
Definition: Spell.cpp:430
WorldLocation const * GetDstPos() const
Definition: Spell.cpp:368
float PositionFacing
Definition: SpellInfo.h:230
bool HasRadius(SpellTargetIndex targetIndex) const
Definition: SpellInfo.cpp:660
int32 CalcValue(WorldObject const *caster=nullptr, int32 const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
Definition: SpellInfo.cpp:495
int32 MiscValueB
Definition: SpellInfo.h:228
float CalcValueMultiplier(WorldObject *caster, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:644
uint32 TriggerSpell
Definition: SpellInfo.h:237
SpellEffectName Effect
Definition: SpellInfo.h:218
uint32 ItemType
Definition: SpellInfo.h:236
SpellEffIndex EffectIndex
Definition: SpellInfo.h:217
uint32 GetProvidedTargetMask() const
Definition: SpellInfo.cpp:714
float CalcRadius(WorldObject *caster=nullptr, SpellTargetIndex targetIndex=SpellTargetIndex::TargetA, Spell *=nullptr) const
Definition: SpellInfo.cpp:673
void RestoreCharge(uint32 chargeCategoryId)
void LockSpellSchool(SpellSchoolMask schoolMask, Duration lockoutTime)
void ModifyCoooldowns(Predicate &&predicate, Duration cooldownMod, bool withoutCategoryCooldown=false)
Definition: SpellHistory.h:118
void ModifyCooldown(uint32 spellId, Duration cooldownMod, bool withoutCategoryCooldown=false)
bool HasCooldown(SpellInfo const *spellInfo, uint32 itemId=0) const
Optional< SpellPowerCost > CalcPowerCost(Powers powerType, bool optionalCost, WorldObject const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:3870
float GetMaxRange(bool positive=false, WorldObject *caster=nullptr, Spell *spell=nullptr) const
Definition: SpellInfo.cpp:3768
uint64 GetAllEffectsMechanicMask() const
Definition: SpellInfo.cpp:2470
uint32 const Id
Definition: SpellInfo.h:325
uint32 StackAmount
Definition: SpellInfo.h:390
bool IsLootCrafting() const
Definition: SpellInfo.cpp:1481
uint32 GetDispelMask() const
Definition: SpellInfo.cpp:2519
bool NeedsToBeTriggeredByCaster(SpellInfo const *triggeringSpell) const
Definition: SpellInfo.cpp:1556
float Speed
Definition: SpellInfo.h:388
float GetMinRange(bool positive=false) const
Definition: SpellInfo.cpp:3761
int32 EquippedItemClass
Definition: SpellInfo.h:396
flag128 SpellFamilyFlags
Definition: SpellInfo.h:409
SpellSchoolMask GetSchoolMask() const
Definition: SpellInfo.cpp:2465
bool HasAttribute(SpellAttr0 attribute) const
Definition: SpellInfo.h:449
int32 GetDuration() const
Definition: SpellInfo.cpp:3791
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition: SpellInfo.h:577
std::vector< SpellEffectInfo > const & GetEffects() const
Definition: SpellInfo.h:576
int32 EquippedItemSubClassMask
Definition: SpellInfo.h:397
uint32 GetExplicitTargetMask() const
Definition: SpellInfo.cpp:2533
int32 CalcDuration(WorldObject const *caster=nullptr) const
Definition: SpellInfo.cpp:3780
bool HasAura(AuraType aura) const
Definition: SpellInfo.cpp:1400
uint32 SpellFamilyName
Definition: SpellInfo.h:408
bool CanBeInterrupted(WorldObject const *interruptCaster, Unit const *interruptTarget, bool ignoreImmunity=false) const
Definition: SpellInfo.cpp:1453
Definition: Spell.h:255
int32 CalculateDamage(SpellEffectInfo const &spellEffectInfo, Unit const *target, float *var=nullptr) const
Definition: Spell.cpp:7085
void EffectSummonRaFFriend()
SpellInfo const * GetSpellInfo() const
Definition: Spell.h:650
void ExecuteLogEffectTakeTargetPower(SpellEffectName effect, Unit *target, uint32 powerType, uint32 points, float amplitude)
Definition: Spell.cpp:5086
void EffectSendEvent()
void EffectTransmitted()
void EffectUpgradeHeirloom()
void ExecuteLogEffectSummonObject(SpellEffectName effect, WorldObject *obj)
Definition: Spell.cpp:5152
void EffectSpiritHeal()
void EffectRemoveAuraBySpellLabel()
void EffectBlock()
void EffectPlayMusic()
void EffectChangeBattlePetQuality()
GameObject * gameObjTarget
Definition: Spell.h:734
void EffectGrantBattlePetExperience()
SpellMissInfo targetMissInfo
Definition: Spell.h:738
void UpdateDelayMomentForUnitTarget(Unit *unit, uint64 hitDelay)
Definition: Spell.cpp:887
void EffectCreateItem2()
void EffectEnchantHeldItem()
Unit * m_originalCaster
Definition: Spell.h:696
void EffectHealMaxHealth()
void EffectProspecting()
DynObjAura * _dynObjAura
Definition: Spell.h:745
void ExecuteLogEffectUnsummonObject(SpellEffectName effect, WorldObject *obj)
Definition: Spell.cpp:5160
void EffectCharge()
void EffectSummonObject()
void ExecuteLogEffectResurrect(SpellEffectName effect, Unit *target)
Definition: Spell.cpp:5168
void EffectSendTaxi()
void EffectCreateItem()
void ExecuteLogEffectDestroyItem(SpellEffectName effect, uint32 entry)
Definition: Spell.cpp:5144
void EffectTameCreature()
void ExecuteLogEffectOpenLock(SpellEffectName effect, Object *obj)
Definition: Spell.cpp:5128
void EffectGameObjectDamage()
SpellCastTargets m_targets
Definition: Spell.h:607
void EffectSummonChangeItem()
void EffectDummy()
std::unique_ptr< PathGenerator > m_preGeneratedPath
Definition: Spell.h:927
Difficulty GetCastDifficulty() const
Definition: Spell.cpp:8038
void EffectLearnAzeriteEssencePower()
void EffectHealthLeech()
void EffectActivateGarrisonBuilding()
void EffectStealBeneficialBuff()
void EffectCancelConversation()
void EffectStuck()
void EffectInterruptCast()
void EffectSummonPlayer()
void EffectWeaponDmg()
SpellCastResult CanOpenLock(SpellEffectInfo const &effect, uint32 lockid, SkillType &skillid, int32 &reqSkillValue, int32 &skillValue)
Definition: Spell.cpp:8492
int32 damage
Definition: Spell.h:737
void EffectEnchantItemPrismatic()
void EffectSummonType()
void EffectSkinPlayerCorpse()
SpellEffectHandleMode effectHandleMode
Definition: Spell.h:740
void SummonGuardian(SpellEffectInfo const *effect, uint32 entry, SummonPropertiesEntry const *properties, uint32 numSummons, ObjectGuid privateObjectOwner)
void EffectHealMechanical()
void EffectGameObjectRepair()
void EffectCreateGarrison()
void EffectSummonObjectWild()
void EffectSendChatMessage()
uint32 Id
Definition: Spell.h:590
void EffectActivateObject()
std::vector< TargetInfo > m_UniqueTargetInfo
Definition: Spell.h:808
void EffectSkill()
SpellDestination m_destTargets[MAX_SPELL_EFFECTS]
Definition: Spell.h:840
void EffectLeap()
void UpdateDelayMomentForDst(uint64 hitDelay)
Definition: Spell.cpp:879
void EffectTradeSkill()
void EffectPersistentAA()
void EffectQuestClear()
void EffectModifyThreatPercent()
void EffectForceDeselect()
void EffectParry()
void EffectRenamePet()
void ExecuteLogEffectExtraAttacks(SpellEffectName effect, Unit *victim, uint32 numAttacks)
Definition: Spell.cpp:5098
void EffectResurrect()
void EffectDestroyAllTotems()
WeaponAttackType m_attackType
Definition: Spell.h:700
void EffectCreateTraitTreeConfig()
void EffectResurrectPet()
void EffectApplyEnchantIllusion()
void EffectTriggerSpell()
void EffectGiveHonor()
void SendSpellInterruptLog(Unit *victim, uint32 spellId)
Definition: Spell.cpp:5107
std::any m_customArg
Definition: Spell.h:605
void EffectPullTowards()
ObjectGuid m_originalCasterGUID
Definition: Spell.h:694
WorldObject *const m_caster
Definition: Spell.h:690
void EffectCreatePrivateSceneObject()
void EffectRechargeItem()
void EffectLearnGarrisonBuilding()
void EffectPowerBurn()
std::string GetDebugInfo() const
Definition: Spell.cpp:9034
void EffectDurabilityDamage()
void ExecuteLogEffectDurabilityDamage(SpellEffectName effect, Unit *victim, int32 itemId, int32 amount)
Definition: Spell.cpp:5118
void EffectSanctuary()
void EffectHealBattlePetPct()
void EffectCastButtons()
Item * itemTarget
Definition: Spell.h:733
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
float variance
Definition: Spell.h:739
int32 m_damage
Definition: Spell.h:751
void EffectGiveArtifactPower()
void EffectKnockBack()
void EffectReputation()
void EffectDistract()
void EffectKillCredit()
void DoCreateItem(uint32 itemId, ItemContext context=ItemContext::NONE, std::vector< int32 > const *bonusListIDs=nullptr)
void EffectRespecAzeriteEmpoweredItem()
void EffectSummonPet()
void EffectModifyCooldownsByCategory()
void EffectEnergizePct()
void EffectDispelMechanic()
void EffectSelfResurrect()
void EffectGiveRestedExperience()
void EffectDispel()
void EffectBind()
void SendSpellCooldown()
Definition: Spell.cpp:4210
void EffectLearnTransmogIllusion()
void EffectPlayMovie()
void EffectFeedPet()
void EffectNULL()
void EffectApplyAura()
void EffectUncageBattlePet()
void EffectTriggerRitualOfSummoning()
void EffectInstaKill()
void EffectCreateAreaTrigger()
void EffectInebriate()
void EffectOpenLock()
void EffectEnvironmentalDMG()
void EffectRedirectThreat()
void EffectChangeActiveCombatTraitConfig()
void EffectLearnTransmogSet()
void EffectRemoveAura()
void EffectDualWield()
void EffectUpdatePlayerPhase()
int32 m_healing
Definition: Spell.h:752
void EffectPickPocket()
void EffectTeleportUnitsWithVisualLoadingScreen()
void EffectModifyAuraStacks()
void EffectProficiency()
void EffectSummonPersonalGameObject()
SpellEffectInfo const * effectInfo
Definition: Spell.h:741
void EffectDisEnchant()
void EffectEnableBattlePets()
void EffectGiveArtifactPowerNoBonus()
Unit * GetUnitCasterForEffectHandlers() const
Definition: Spell.cpp:8201
void EffectTeleportToReturnPoint()
void EffectAddExtraAttacks()
int32 m_castItemLevel
Definition: Spell.h:567
void EffectTriggerMissileSpell()
UnitAura * _spellAura
Definition: Spell.h:744
void EffectModifyCooldown()
Unit * unitTarget
Definition: Spell.h:732
void EffectEnchantItemTmp()
SpellSchoolMask m_spellSchoolMask
Definition: Spell.h:699
void EffectCreateRandomItem()
void EffectTeleUnitsFaceCaster()
void EffectDamageFromMaxHealthPCT()
void EffectCreateHeirloomItem()
WorldObject * GetCaster() const
Definition: Spell.h:647
void EffectPullTowardsDest()
void EffectKillCreditPersonal()
void CalculateJumpSpeeds(SpellEffectInfo const *effInfo, float dist, float &speedXY, float &speedZ)
void EffectLaunchQuestChoice()
void EffectSchoolDMG()
void EffectChangeRaidMarker()
void EffectGrantBattlePetLevel()
void EffectThreat()
Corpse * m_corpseTarget
Definition: Spell.h:735
void EffectResurrectNew()
void EffectChargeDest()
void EffectUntrainTalents()
void EffectUnlockGuildVaultTab()
void EffectLearnSpell()
void ExecuteLogEffectCreateItem(SpellEffectName effect, uint32 entry)
Definition: Spell.cpp:5136
void EffectMilling()
void EffectHealPct()
void EffectJumpCharge()
void EffectJumpDest()
void EffectScriptEffect()
void EffectAddFarsight()
void EffectEnergize()
union Spell::@333 m_misc
void EffectCreateSceneObject()
WorldLocation * destTarget
Definition: Spell.h:736
void EffectGameObjectSetDestructionState()
void EffectIncreaseCurrencyCap()
void EffectApplyGlyph()
void EffectResurrectWithAura()
void EffectGiveCurrency()
void EffectModifyCooldowns()
void EffectQuestComplete()
void EffectDiscoverTaxi()
void EffectModifySpellCharges()
void EffectTeleportUnits()
void EffectGiveExperience()
void EffectCreatePrivateConversation()
void EffectPlaySceneScriptPackage()
void EffectPlaySound()
void EffectLearnPetSpell()
void EffectTeleportGraveyard()
void EffectPowerDrain()
Item * m_CastItem
Definition: Spell.h:564
void CallScriptSuccessfulDispel(SpellEffIndex effIndex)
Definition: Spell.cpp:8746
uint32 m_castItemEntry
Definition: Spell.h:566
int32 GetUnitTargetIndexForEffect(ObjectGuid const &target, SpellEffIndex effect) const
Definition: Spell.cpp:2650
void EffectTaunt()
void EffectLeapBack()
void EffectDurabilityDamagePCT()
SpellValue *const m_spellValue
Definition: Spell.h:692
void EffectLearnSkill()
void finish(SpellCastResult result=SPELL_CAST_OK)
Definition: Spell.cpp:4311
void SendResurrectRequest(Player *target)
Definition: Spell.cpp:5298
void EffectActivateSpec()
void EffectForceCast()
void EffectDismissPet()
void EffectPlayScene()
void EffectEnchantItemPerm()
void EffectQuestFail()
void EffectCreateTamedPet()
void EffectAddGarrisonFollower()
void EffectJump()
void EffectDestroyItem()
ObjectGuid m_castItemGUID
Definition: Spell.h:565
void EffectRemoveTalent()
SpellCastVisual m_SpellVisual
Definition: Spell.h:606
int64 GetUnitTargetCountForEffect(SpellEffIndex effect) const
Definition: Spell.cpp:2667
GameObject * focusObject
Definition: Spell.h:748
void EffectTitanGrip()
ProcFlagsHit m_hitMask
Definition: Spell.h:759
ObjectGuid m_castId
Definition: Spell.h:568
SpellInfo const *const m_spellInfo
Definition: Spell.h:563
void EffectUnlearnSpecialization()
void EffectUpdateZoneAurasAndPhases()
void EffectQuestStart()
void EffectDuel()
void EffectUnused()
void EffectCreateConversation()
void EffectSkinning()
void EffectHeal()
virtual void UnSummon(uint32 msTime=0)
void SetTempSummonType(TempSummonType type)
void ModifyThreatByPercent(Unit *target, int32 percent)
Unit * GetCurrentVictim()
auto const & GetThreatenedByMeList() const
bool IsThreatListEmpty(bool includeOffline=false) const
void AddThreat(Unit *target, float amount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false, bool ignoreRedirects=false)
== AFFECT MY THREAT LIST ==
void RegisterRedirectThreat(uint32 spellId, ObjectGuid const &victim, uint32 pct)
== REDIRECT SYSTEM ==
void MatchUnitThreatToHighestThreat(Unit *target)
void UnSummon(uint32 msTime=0) override
Definition: Totem.cpp:100
Definition: Unit.h:627
float GetPctModifierValue(UnitMods unitMod, UnitModifierPctType modifierType) const
Definition: Unit.cpp:9041
void ClearUnitState(uint32 f)
Definition: Unit.h:733
bool IsVehicle() const
Definition: Unit.h:743
int32 GetContentTuning() const
Definition: Unit.h:745
void SetMinion(Minion *minion, bool apply)
Definition: Unit.cpp:6062
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:8280
void KnockbackFrom(Position const &origin, float speedXY, float speedZ, Movement::SpellEffectExtraData const *spellEffectExtraData=nullptr)
Definition: Unit.cpp:11860
int32 SpellDamageBonusDone(Unit *victim, SpellInfo const *spellProto, int32 pdamage, DamageEffectType damagetype, SpellEffectInfo const &spellEffectInfo, uint32 stack=1, Spell *spell=nullptr, AuraEffect const *aurEff=nullptr) const
Definition: Unit.cpp:6626
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3812
void RemoveGameObject(GameObject *gameObj, bool del)
Definition: Unit.cpp:5238
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1321
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool(*unitFilter)(Unit const *otherUnit)=nullptr)
Definition: Unit.cpp:5827
uint32 m_lastSanctuaryTime
Definition: Unit.h:1547
int32 MeleeDamageBonusTaken(Unit *attacker, int32 pdamage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
Definition: Unit.cpp:7736
void JumpTo(float speedXY, float speedZ, float angle, Optional< Position > dest={})
Definition: Unit.cpp:12004
void SetHealth(uint64 val)
Definition: Unit.cpp:9346
void SetVirtualItem(uint32 slot, uint32 itemId, uint16 appearanceModId=0, uint16 itemVisual=0)
Definition: Unit.cpp:13604
int32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, int32 healamount, DamageEffectType damagetype) const
Definition: Unit.cpp:7285
Pet * ToPet()
Definition: Unit.h:1750
bool CanHaveThreatList() const
====================== THREAT & COMBAT ====================
Definition: Unit.h:1015
void SetUnitFlag3(UnitFlags3 flags)
Definition: Unit.h:843
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3685
void EnergizeBySpell(Unit *victim, SpellInfo const *spellInfo, int32 damage, Powers powerType)
Definition: Unit.cpp:6613
ThreatManager & GetThreatManager()
Definition: Unit.h:1063
virtual void SetCanDualWield(bool value)
Definition: Unit.h:693
UF::UpdateField< UF::UnitData, 0, TYPEID_UNIT > m_unitData
Definition: Unit.h:1814
uint8 GetClass() const
Definition: Unit.h:752
std::array< ObjectGuid, MAX_SUMMON_SLOT > m_SummonSlot
Definition: Unit.h:1460
Totem * ToTotem()
Definition: Unit.h:1753
int64 GetHealthGain(int64 dVal)
Definition: Unit.cpp:8224
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, WorldObject *dispeller, uint8 chargesRemoved=1)
Definition: Unit.cpp:3864
std::forward_list< AuraEffect * > AuraEffectList
Definition: Unit.h:644
void SetPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition: Unit.cpp:9419
Pet * CreateTamedPetFrom(Creature *creatureTarget, uint32 spell_id=0)
Definition: Unit.cpp:10441
uint32 CalculateDamage(WeaponAttackType attType, bool normalized, bool addTotalPct) const
Definition: Unit.cpp:2392
static void CalcAbsorbResist(DamageInfo &damageInfo, Spell *spell=nullptr)
Definition: Unit.cpp:1797
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition: Unit.cpp:3089
Unit * GetVehicleBase() const
Definition: Unit.cpp:11480
MotionMaster * GetMotionMaster()
Definition: Unit.h:1652
bool IsPet() const
Definition: Unit.h:740
Powers GetPowerType() const
Definition: Unit.h:799
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:832
std::array< ObjectGuid, MAX_GAMEOBJECT_SLOT > m_ObjectSlot
Definition: Unit.h:1461
void SetCreatedBySpell(int32 spellId)
Definition: Unit.h:847
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition: Unit.cpp:3059
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition: Unit.cpp:4464
void SetDemonCreatorGUID(ObjectGuid guid)
Definition: Unit.h:1183
int32 MeleeDamageBonusDone(Unit *pVictim, int32 damage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const *spellProto=nullptr, Mechanics mechanic=MECHANIC_NONE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, Spell *spell=nullptr, AuraEffect const *aurEff=nullptr)
Definition: Unit.cpp:7624
bool IsAlive() const
Definition: Unit.h:1164
AuraEffect * IsScriptOverriden(SpellInfo const *spell, int32 script) const
Definition: Unit.cpp:4776
float GetCombatReach() const override
Definition: Unit.h:694
int32 GetMaxPower(Powers power) const
Definition: Unit.cpp:9410
int32 HealBySpell(HealInfo &healInfo, bool critical=false)
Definition: Unit.cpp:6591
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const *log)
Definition: Unit.cpp:5378
void SetPetFlag(UnitPetFlag flags)
Definition: Unit.h:879
TempSummon * ToTempSummon()
Definition: Unit.h:1756
CharmInfo * GetCharmInfo()
Definition: Unit.h:1221
void SendPlaySpellVisual(Unit *target, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime=false, float launchDelay=0.0f)
Definition: Unit.cpp:11674
void AddGameObject(GameObject *gameObj)
Definition: Unit.cpp:5217
bool IsInFlight() const
Definition: Unit.h:1012
void SetChannelObject(uint32 slot, ObjectGuid guid)
Definition: Unit.h:1420
uint64 GetMaxHealth() const
Definition: Unit.h:777
bool Attack(Unit *victim, bool meleeAttack)
Definition: Unit.cpp:5670
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4560
uint64 GetHealth() const
Definition: Unit.h:776
bool IsSummon() const
Definition: Unit.h:738
uint32 GetFaction() const override
Definition: Unit.h:858
void GetDispellableAuraList(WorldObject const *caster, uint32 dispelMask, DispelChargesList &dispelList, bool isReflect=false) const
Definition: Unit.cpp:4596
AttackerSet const & getAttackers() const
Definition: Unit.h:713
std::multimap< uint32, Aura * > AuraMap
Definition: Unit.h:633
void NearTeleportTo(Position const &pos, bool casting=false)
Definition: Unit.cpp:12327
void SetFullPower(Powers power)
Definition: Unit.h:812
void RemoveAurasWithInterruptFlags(InterruptFlags flag, SpellInfo const *source=nullptr)
Definition: Unit.cpp:4101
void SetMaxHealth(uint64 val)
Definition: Unit.cpp:9377
std::set< Unit * > AttackerSet
Definition: Unit.h:629
void RemoveAppliedAuras(std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3758
bool IsGuardian() const
Definition: Unit.h:739
uint64 CountPctFromMaxHealth(int32 pct) const
Definition: Unit.h:785
void AddExtraAttacks(uint32 count)
Definition: Unit.cpp:2265
void SetOwnerGUID(ObjectGuid owner)
Definition: Unit.cpp:5986
ObjectGuid GetTransGUID() const override
Definition: Unit.cpp:11510
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
AuraApplication * _CreateAuraApplication(Aura *aura, uint32 effMask)
Definition: Unit.cpp:3348
int32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, int32 pdamage, DamageEffectType damagetype) const
Definition: Unit.cpp:6809
void SetLevel(uint8 lvl, bool sendUpdate=true)
Definition: Unit.cpp:9329
std::unique_ptr< Movement::MoveSpline > movespline
Definition: Unit.h:1766
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition: Unit.cpp:4664
uint32 HasUnitTypeMask(uint32 mask) const
Definition: Unit.h:736
SpellHistory * GetSpellHistory()
Definition: Unit.h:1457
void SetCreatorGUID(ObjectGuid creator)
Definition: Unit.h:1173
void RemoveMovementImpairingAuras(bool withRoot)
Definition: Unit.cpp:4154
bool IsTotem() const
Definition: Unit.h:742
ObjectGuid GetBattlePetCompanionGUID() const
Definition: Unit.h:1180
void KillSelf(bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition: Unit.h:921
virtual void Talk(std::string_view text, ChatMsg msgType, Language language, float textRange, WorldObject const *target)
Definition: Unit.cpp:13554
static void ProcSkillsAndAuras(Unit *actor, Unit *actionTarget, ProcFlagsInit const &typeMaskActor, ProcFlagsInit const &typeMaskActionTarget, ProcFlagsSpellType spellTypeMask, ProcFlagsSpellPhase spellPhaseMask, ProcFlagsHit hitMask, Spell *spell, DamageInfo *damageInfo, HealInfo *healInfo)
Definition: Unit.cpp:5407
virtual bool IsEngaged() const
Definition: Unit.h:1019
AuraMap & GetOwnedAuras()
Definition: Unit.h:1264
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
static void Kill(Unit *attacker, Unit *victim, bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition: Unit.cpp:10591
int32 SpellHealingBonusDone(Unit *victim, SpellInfo const *spellProto, int32 healamount, DamageEffectType damagetype, SpellEffectInfo const &spellEffectInfo, uint32 stack=1, Spell *spell=nullptr, AuraEffect const *aurEff=nullptr) const
Definition: Unit.cpp:7138
ObjectGuid GetTarget() const
Definition: Unit.h:1759
uint8 GetLevel() const
Definition: Unit.h:746
uint8 GetRace() const
Definition: Unit.h:749
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true)
Definition: Unit.cpp:3017
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:834
void RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, WorldObject *stealer, int32 stolenCharges=1)
Definition: Unit.cpp:3892
ObjectGuid GetPetGUID() const
Definition: Unit.h:1176
bool isDead() const
Definition: Unit.h:1166
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition: Unit.h:1442
constexpr void WorldRelocate(WorldLocation const &loc)
Definition: Position.h:187
constexpr uint32 GetMapId() const
Definition: Position.h:201
uint32 m_mapId
Definition: Position.h:203
constexpr WorldLocation GetWorldLocation() const
Definition: Position.h:196
void PlayDirectSound(uint32 soundId, Player const *target=nullptr, uint32 broadcastTextId=0) const
Definition: Object.cpp:3592
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition: Object.cpp:1744
Map * GetMap() const
Definition: Object.h:624
virtual uint8 GetLevelForTarget(WorldObject const *) const
Definition: Object.h:598
bool IsWithinLOS(float x, float y, float z, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
Definition: Object.cpp:1161
ObjectGuid GetPrivateObjectOwner() const
Definition: Object.h:785
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0) const
Definition: Object.cpp:3403
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
Unit * GetOwner() const
Definition: Object.cpp:2229
bool IsPrivateObject() const
Definition: Object.h:784
void SetPrivateObjectOwner(ObjectGuid const &owner)
Definition: Object.h:786
int32 ModSpellDuration(SpellInfo const *spellInfo, WorldObject const *target, int32 duration, bool positive, uint32 effectMask) const
Definition: Object.cpp:2401
std::string const & GetName() const
Definition: Object.h:555
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Object.cpp:2252
void SetName(std::string newname)
Definition: Object.h:556
EventProcessor m_Events
Definition: Object.h:777
float GetVisibilityRange() const
Definition: Object.cpp:1447
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1078
uint32 GetAreaId() const
Definition: Object.h:546
Position GetFirstCollisionPosition(float dist, float angle)
Definition: Object.cpp:3416
bool IsFriendlyTo(WorldObject const *target) const
Definition: Object.cpp:2865
virtual float GetCombatReach() const
Definition: Object.h:514
Player * GetAffectingPlayer() const
Definition: Object.cpp:2261
void GetRandomPoint(Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
Definition: Object.cpp:1331
FactionTemplateEntry const * GetFactionTemplateEntry() const
Definition: Object.cpp:2679
WorldPacket const * Write() override
std::vector< SpellDispellData > DispellData
WorldPacket const * Write() override
WorldPacket const * Write() override
Definition: DuelPackets.cpp:50
WorldPacket const * Write() override
std::vector< int32 > FailedSpells
WorldPacket const * Write() override
WorldPacket const * Write() override
std::vector< GlyphBinding > Glyphs
WorldPacket const * Write() override
void SendNotification(char const *format,...) ATTR_PRINTF(2
ObjectGuid GetAccountGUID() const
bool HasPermission(uint32 permissionId)
uint32 GetAccountId() const
CollectionMgr * GetCollectionMgr() const
void SendDiscoverNewTaxiNode(uint32 nodeid)
BattlePets::BattlePetMgr * GetBattlePetMgr() const
#define sWorld
Definition: World.h:931
@ CONFIG_SKILL_MILLING
Definition: World.h:123
@ CONFIG_SKILL_PROSPECTING
Definition: World.h:122
@ CONFIG_NO_RESET_TALENT_COST
Definition: World.h:150
@ CONFIG_CAST_UNSTUCK
Definition: World.h:119
@ RATE_DROP_MONEY
Definition: World.h:482
@ SPELL_VISUAL_UNCAGE_PET
Definition: BattlePetMgr.h:34
TC_GAME_API void Trigger(uint32 gameEventId, WorldObject *source, WorldObject *target)
uint32 GetGameTimeMS()
Definition: GameTime.cpp:49
float constexpr gravity
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
TraitConfigType GetConfigTypeForTree(int32 traitTreeId)
Definition: TraitMgr.cpp:277
constexpr std::size_t size()
Definition: UpdateField.h:796
@ RBAC_PERM_LOG_GM_TRADE
Definition: RBAC.h:64
uint64 GetAction() const
Definition: Player.h:327
ActionButtonType GetType() const
Definition: Player.h:326
EnumFlag< AreaFlags > GetFlags() const
Definition: DB2Structure.h:153
AuraCreateInfo & SetBaseAmount(int32 const *bp)
AuraCreateInfo & SetCaster(Unit *caster)
AuraCreateInfo & SetCastItem(ObjectGuid const &guid, uint32 itemId, int32 itemLevel)
CastSpellExtraArgs & SetTriggeringSpell(Spell const *triggeringSpell)
Definition: Spell.cpp:9403
Difficulty CastDifficulty
Definition: SpellDefines.h:483
TriggerCastFlags TriggerFlags
Definition: SpellDefines.h:478
CastSpellExtraArgs & SetOriginalCaster(ObjectGuid const &guid)
Definition: SpellDefines.h:471
CastSpellExtraArgs & SetCustomArg(std::any customArg)
Definition: SpellDefines.h:476
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
Definition: SpellDefines.h:474
ObjectGuid OriginalCastId
Definition: SpellDefines.h:484
Optional< int32 > OriginalCastItemLevel
Definition: SpellDefines.h:485
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:179
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius, bool dont_load=true)
Definition: CellImpl.h:191
void SaveStayPosition()
Definition: Unit.cpp:12596
void SetIsCommandFollow(bool val)
Definition: Unit.cpp:12586
void SetIsAtStay(bool val)
Definition: Unit.cpp:12617
void SetIsFollowing(bool val)
Definition: Unit.cpp:12627
void SetIsReturning(bool val)
Definition: Unit.cpp:12637
bool HasCommandState(CommandStates state) const
Definition: CharmInfo.h:99
void SetIsCommandAttack(bool val)
Definition: Unit.cpp:12576
bool IsPetSpecialization() const
Definition: DB2Structure.h:875
SkillType GetRequiredLootSkill() const
Definition: CreatureData.h:464
bool IsFriendlyTo(FactionTemplateEntry const *entry) const
uint32 GetNoDamageImmune() const
uint32 GetLockId() const
uint32 GetRequiredSkillRank() const
Definition: ItemTemplate.h:792
uint32 GetBaseItemLevel() const
Definition: ItemTemplate.h:789
uint32 GetId() const
Definition: ItemTemplate.h:776
uint32 GetMaxStackSize() const
Definition: ItemTemplate.h:847
bool HasFlag(ItemFlags flag) const
Definition: ItemTemplate.h:871
char const * GetDefaultLocaleName() const
uint32 GetLockID() const
Definition: ItemTemplate.h:810
Definition: Loot.h:281
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 SetOrientation(float orientation)
Definition: Position.h:71
constexpr float GetPositionX() const
Definition: Position.h:76
constexpr float GetPositionY() const
Definition: Position.h:77
float GetExactDist2d(const float x, const float y) const
Definition: Position.h:106
float GetRelativeAngle(float x, float y) const
Definition: Position.h:136
float GetExactDist(float x, float y, float z) const
Definition: Position.h:118
float GetAbsoluteAngle(float x, float y) const
Definition: Position.h:125
constexpr void GetPosition(float &x, float &y) const
Definition: Position.h:81
constexpr void Relocate(float x, float y)
Definition: Position.h:63
constexpr float GetOrientation() const
Definition: Position.h:79
constexpr float GetPositionZ() const
Definition: Position.h:78
bool IsHostile
Definition: Player.h:348
bool IsInHostileArea
Definition: Player.h:349
static QuaternionData fromEulerAnglesZYX(float Z, float Y, float X)
Definition: GameObject.cpp:118
uint32 GetValueForTierIndex(uint32 tierIndex) const
Definition: ObjectMgr.cpp:7938
WorldLocation _position
Definition: SpellDefines.h:325
ObjectGuid _transportGUID
Definition: SpellDefines.h:326
std::array< uint8, MAX_ITEM_ENCHANTMENT_EFFECTS > Effect
uint32 damage
Definition: Unit.h:556
uint32 absorb
Definition: Unit.h:559
uint32 originalDamage
Definition: Unit.h:557
uint32 resist
Definition: Unit.h:560
int32 EffectBasePoints[MAX_SPELL_EFFECTS]
Definition: Spell.h:220
EnumFlag< SummonPropertiesFlags > GetFlags() const
UpdateField< int32, 4, 5 > Type
Definition: UpdateFields.h:736
UpdateField< int32, 8, 11 > TraitSystemID
Definition: UpdateFields.h:741
UpdateField< uint16, 0, 4 > ItemAppearanceModID
Definition: UpdateFields.h:241
UpdateField< uint16, 0, 5 > ItemVisual
Definition: UpdateFields.h:242
UpdateField< int32, 0, 1 > ItemID
Definition: UpdateFields.h:238