TrinityCore
Loading...
Searching...
No Matches
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 "QuestMgr.h"
67#include "ReputationMgr.h"
68#include "RestMgr.h"
69#include "SceneObject.h"
70#include "ScriptMgr.h"
71#include "SharedDefines.h"
72#include "SkillExtraItems.h"
73#include "SocialMgr.h"
74#include "SpellAuraEffects.h"
75#include "SpellAuras.h"
76#include "SpellHistory.h"
77#include "SpellMgr.h"
78#include "SpellPackets.h"
79#include "TalentPackets.h"
80#include "TemporarySummon.h"
81#include "Totem.h"
82#include "TraitMgr.h"
83#include "TraitPacketsCommon.h"
84#include "Unit.h"
85#include "Util.h"
86#include "World.h"
87#include "WorldPacket.h"
88#include "WorldSession.h"
89
91{
93 &Spell::EffectInstaKill, // 1 SPELL_EFFECT_INSTAKILL
94 &Spell::EffectSchoolDMG, // 2 SPELL_EFFECT_SCHOOL_DAMAGE
95 &Spell::EffectDummy, // 3 SPELL_EFFECT_DUMMY
96 &Spell::EffectUnused, // 4 SPELL_EFFECT_PORTAL_TELEPORT unused
97 &Spell::EffectNULL, // 5 SPELL_EFFECT_5
98 &Spell::EffectApplyAura, // 6 SPELL_EFFECT_APPLY_AURA
99 &Spell::EffectEnvironmentalDMG, // 7 SPELL_EFFECT_ENVIRONMENTAL_DAMAGE
100 &Spell::EffectPowerDrain, // 8 SPELL_EFFECT_POWER_DRAIN
101 &Spell::EffectHealthLeech, // 9 SPELL_EFFECT_HEALTH_LEECH
102 &Spell::EffectHeal, // 10 SPELL_EFFECT_HEAL
103 &Spell::EffectBind, // 11 SPELL_EFFECT_BIND
104 &Spell::EffectNULL, // 12 SPELL_EFFECT_PORTAL
105 &Spell::EffectTeleportToReturnPoint, // 13 SPELL_EFFECT_TELEPORT_TO_RETURN_POINT
106 &Spell::EffectIncreaseCurrencyCap, // 14 SPELL_EFFECT_INCREASE_CURRENCY_CAP
107 &Spell::EffectTeleportUnitsWithVisualLoadingScreen, // 15 SPELL_EFFECT_TELEPORT_WITH_SPELL_VISUAL_KIT_LOADING_SCREEN
108 &Spell::EffectQuestComplete, // 16 SPELL_EFFECT_QUEST_COMPLETE
109 &Spell::EffectWeaponDmg, // 17 SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL
110 &Spell::EffectResurrect, // 18 SPELL_EFFECT_RESURRECT
111 &Spell::EffectAddExtraAttacks, // 19 SPELL_EFFECT_ADD_EXTRA_ATTACKS
112 &Spell::EffectUnused, // 20 SPELL_EFFECT_DODGE one spell: Dodge
113 &Spell::EffectUnused, // 21 SPELL_EFFECT_EVADE one spell: Evade (DND)
114 &Spell::EffectParry, // 22 SPELL_EFFECT_PARRY
115 &Spell::EffectBlock, // 23 SPELL_EFFECT_BLOCK one spell: Block
116 &Spell::EffectCreateItem, // 24 SPELL_EFFECT_CREATE_ITEM
117 &Spell::EffectUnused, // 25 SPELL_EFFECT_WEAPON
118 &Spell::EffectUnused, // 26 SPELL_EFFECT_DEFENSE one spell: Defense
119 &Spell::EffectPersistentAA, // 27 SPELL_EFFECT_PERSISTENT_AREA_AURA
120 &Spell::EffectSummonType, // 28 SPELL_EFFECT_SUMMON
121 &Spell::EffectLeap, // 29 SPELL_EFFECT_LEAP
122 &Spell::EffectEnergize, // 30 SPELL_EFFECT_ENERGIZE
123 &Spell::EffectWeaponDmg, // 31 SPELL_EFFECT_WEAPON_PERCENT_DAMAGE
124 &Spell::EffectTriggerMissileSpell, // 32 SPELL_EFFECT_TRIGGER_MISSILE
125 &Spell::EffectOpenLock, // 33 SPELL_EFFECT_OPEN_LOCK
126 &Spell::EffectSummonChangeItem, // 34 SPELL_EFFECT_SUMMON_CHANGE_ITEM
127 &Spell::EffectUnused, // 35 SPELL_EFFECT_APPLY_AREA_AURA_PARTY
128 &Spell::EffectLearnSpell, // 36 SPELL_EFFECT_LEARN_SPELL
129 &Spell::EffectUnused, // 37 SPELL_EFFECT_SPELL_DEFENSE one spell: SPELLDEFENSE (DND)
130 &Spell::EffectDispel, // 38 SPELL_EFFECT_DISPEL
131 &Spell::EffectUnused, // 39 SPELL_EFFECT_LANGUAGE
132 &Spell::EffectDualWield, // 40 SPELL_EFFECT_DUAL_WIELD
133 &Spell::EffectJump, // 41 SPELL_EFFECT_JUMP
134 &Spell::EffectJumpDest, // 42 SPELL_EFFECT_JUMP_DEST
135 &Spell::EffectTeleUnitsFaceCaster, // 43 SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER
136 &Spell::EffectLearnSkill, // 44 SPELL_EFFECT_SKILL_STEP
137 &Spell::EffectPlayMovie, // 45 SPELL_EFFECT_PLAY_MOVIE
138 &Spell::EffectUnused, // 46 SPELL_EFFECT_SPAWN clientside, unit appears as if it was just spawned
139 &Spell::EffectTradeSkill, // 47 SPELL_EFFECT_TRADE_SKILL
140 &Spell::EffectUnused, // 48 SPELL_EFFECT_STEALTH one spell: Base Stealth
141 &Spell::EffectUnused, // 49 SPELL_EFFECT_DETECT one spell: Detect
142 &Spell::EffectTransmitted, // 50 SPELL_EFFECT_TRANS_DOOR
143 &Spell::EffectUnused, // 51 SPELL_EFFECT_FORCE_CRITICAL_HIT unused
144 &Spell::EffectNULL, // 52 SPELL_EFFECT_SET_MAX_BATTLE_PET_COUNT
145 &Spell::EffectEnchantItemPerm, // 53 SPELL_EFFECT_ENCHANT_ITEM
146 &Spell::EffectEnchantItemTmp, // 54 SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY
147 &Spell::EffectTameCreature, // 55 SPELL_EFFECT_TAMECREATURE
148 &Spell::EffectSummonPet, // 56 SPELL_EFFECT_SUMMON_PET
149 &Spell::EffectLearnPetSpell, // 57 SPELL_EFFECT_LEARN_PET_SPELL
150 &Spell::EffectWeaponDmg, // 58 SPELL_EFFECT_WEAPON_DAMAGE
151 &Spell::EffectCreateRandomItem, // 59 SPELL_EFFECT_CREATE_RANDOM_ITEM create item base at spell specific loot
152 &Spell::EffectProficiency, // 60 SPELL_EFFECT_PROFICIENCY
153 &Spell::EffectSendEvent, // 61 SPELL_EFFECT_SEND_EVENT
154 &Spell::EffectPowerBurn, // 62 SPELL_EFFECT_POWER_BURN
155 &Spell::EffectThreat, // 63 SPELL_EFFECT_THREAT
156 &Spell::EffectTriggerSpell, // 64 SPELL_EFFECT_TRIGGER_SPELL
157 &Spell::EffectUnused, // 65 SPELL_EFFECT_APPLY_AREA_AURA_RAID
158 &Spell::EffectRechargeItem, // 66 SPELL_EFFECT_RECHARGE_ITEM
159 &Spell::EffectHealMaxHealth, // 67 SPELL_EFFECT_HEAL_MAX_HEALTH
160 &Spell::EffectInterruptCast, // 68 SPELL_EFFECT_INTERRUPT_CAST
161 &Spell::EffectDistract, // 69 SPELL_EFFECT_DISTRACT
162 &Spell::EffectNULL, // 70 SPELL_EFFECT_COMPLETE_AND_REWARD_WORLD_QUEST
163 &Spell::EffectPickPocket, // 71 SPELL_EFFECT_PICKPOCKET
164 &Spell::EffectAddFarsight, // 72 SPELL_EFFECT_ADD_FARSIGHT
165 &Spell::EffectUntrainTalents, // 73 SPELL_EFFECT_UNTRAIN_TALENTS
166 &Spell::EffectApplyGlyph, // 74 SPELL_EFFECT_APPLY_GLYPH
167 &Spell::EffectHealMechanical, // 75 SPELL_EFFECT_HEAL_MECHANICAL one spell: Mechanical Patch Kit
168 &Spell::EffectSummonObjectWild, // 76 SPELL_EFFECT_SUMMON_OBJECT_WILD
169 &Spell::EffectScriptEffect, // 77 SPELL_EFFECT_SCRIPT_EFFECT
170 &Spell::EffectUnused, // 78 SPELL_EFFECT_ATTACK
171 &Spell::EffectSanctuary, // 79 SPELL_EFFECT_SANCTUARY
172 &Spell::EffectNULL, // 80 SPELL_EFFECT_MODIFY_FOLLOWER_ITEM_LEVEL
173 &Spell::EffectNULL, // 81 SPELL_EFFECT_PUSH_ABILITY_TO_ACTION_BAR
174 &Spell::EffectNULL, // 82 SPELL_EFFECT_BIND_SIGHT
175 &Spell::EffectDuel, // 83 SPELL_EFFECT_DUEL
176 &Spell::EffectStuck, // 84 SPELL_EFFECT_STUCK
177 &Spell::EffectSummonPlayer, // 85 SPELL_EFFECT_SUMMON_PLAYER
178 &Spell::EffectActivateObject, // 86 SPELL_EFFECT_ACTIVATE_OBJECT
179 &Spell::EffectGameObjectDamage, // 87 SPELL_EFFECT_GAMEOBJECT_DAMAGE
180 &Spell::EffectGameObjectRepair, // 88 SPELL_EFFECT_GAMEOBJECT_REPAIR
181 &Spell::EffectGameObjectSetDestructionState, // 89 SPELL_EFFECT_GAMEOBJECT_SET_DESTRUCTION_STATE
182 &Spell::EffectKillCreditPersonal, // 90 SPELL_EFFECT_KILL_CREDIT Kill credit but only for single person
183 &Spell::EffectNULL, // 91 SPELL_EFFECT_THREAT_ALL
184 &Spell::EffectEnchantHeldItem, // 92 SPELL_EFFECT_ENCHANT_HELD_ITEM
185 &Spell::EffectForceDeselect, // 93 SPELL_EFFECT_FORCE_DESELECT
186 &Spell::EffectSelfResurrect, // 94 SPELL_EFFECT_SELF_RESURRECT
187 &Spell::EffectSkinning, // 95 SPELL_EFFECT_SKINNING
188 &Spell::EffectCharge, // 96 SPELL_EFFECT_CHARGE
189 &Spell::EffectCastButtons, // 97 SPELL_EFFECT_CAST_BUTTON (totem bar since 3.2.2a)
190 &Spell::EffectKnockBack, // 98 SPELL_EFFECT_KNOCK_BACK
191 &Spell::EffectDisEnchant, // 99 SPELL_EFFECT_DISENCHANT
192 &Spell::EffectInebriate, //100 SPELL_EFFECT_INEBRIATE
193 &Spell::EffectFeedPet, //101 SPELL_EFFECT_FEED_PET
194 &Spell::EffectDismissPet, //102 SPELL_EFFECT_DISMISS_PET
195 &Spell::EffectReputation, //103 SPELL_EFFECT_REPUTATION
196 &Spell::EffectSummonObject, //104 SPELL_EFFECT_SUMMON_OBJECT_SLOT1
197 &Spell::EffectNULL, //105 SPELL_EFFECT_SURVEY
198 &Spell::EffectChangeRaidMarker, //106 SPELL_EFFECT_CHANGE_RAID_MARKER
199 &Spell::EffectNULL, //107 SPELL_EFFECT_SHOW_CORPSE_LOOT
200 &Spell::EffectDispelMechanic, //108 SPELL_EFFECT_DISPEL_MECHANIC
201 &Spell::EffectResurrectPet, //109 SPELL_EFFECT_RESURRECT_PET
202 &Spell::EffectDestroyAllTotems, //110 SPELL_EFFECT_DESTROY_ALL_TOTEMS
203 &Spell::EffectDurabilityDamage, //111 SPELL_EFFECT_DURABILITY_DAMAGE
204 &Spell::EffectNULL, //112 SPELL_EFFECT_112
205 &Spell::EffectCancelConversation, //113 SPELL_EFFECT_CANCEL_CONVERSATION
206 &Spell::EffectTaunt, //114 SPELL_EFFECT_ATTACK_ME
207 &Spell::EffectDurabilityDamagePCT, //115 SPELL_EFFECT_DURABILITY_DAMAGE_PCT
208 &Spell::EffectSkinPlayerCorpse, //116 SPELL_EFFECT_SKIN_PLAYER_CORPSE one spell: Remove Insignia, bg usage, required special corpse flags...
209 &Spell::EffectSpiritHeal, //117 SPELL_EFFECT_SPIRIT_HEAL one spell: Spirit Heal
210 &Spell::EffectSkill, //118 SPELL_EFFECT_SKILL professions and more
211 &Spell::EffectUnused, //119 SPELL_EFFECT_APPLY_AREA_AURA_PET
212 &Spell::EffectTeleportGraveyard, //120 SPELL_EFFECT_TELEPORT_GRAVEYARD
213 &Spell::EffectWeaponDmg, //121 SPELL_EFFECT_NORMALIZED_WEAPON_DMG
214 &Spell::EffectUnused, //122 SPELL_EFFECT_122 unused
215 &Spell::EffectSendTaxi, //123 SPELL_EFFECT_SEND_TAXI taxi/flight related (misc value is taxi path id)
216 &Spell::EffectPullTowards, //124 SPELL_EFFECT_PULL_TOWARDS
217 &Spell::EffectModifyThreatPercent, //125 SPELL_EFFECT_MODIFY_THREAT_PERCENT
218 &Spell::EffectStealBeneficialBuff, //126 SPELL_EFFECT_STEAL_BENEFICIAL_BUFF spell steal effect?
219 &Spell::EffectProspecting, //127 SPELL_EFFECT_PROSPECTING Prospecting spell
220 &Spell::EffectUnused, //128 SPELL_EFFECT_APPLY_AREA_AURA_FRIEND
221 &Spell::EffectUnused, //129 SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
222 &Spell::EffectRedirectThreat, //130 SPELL_EFFECT_REDIRECT_THREAT
223 &Spell::EffectPlaySound, //131 SPELL_EFFECT_PLAY_SOUND sound id in misc value (SoundEntries.dbc)
224 &Spell::EffectPlayMusic, //132 SPELL_EFFECT_PLAY_MUSIC sound id in misc value (SoundEntries.dbc)
225 &Spell::EffectUnlearnSpecialization, //133 SPELL_EFFECT_UNLEARN_SPECIALIZATION unlearn profession specialization
226 &Spell::EffectKillCredit, //134 SPELL_EFFECT_KILL_CREDIT misc value is creature entry
227 &Spell::EffectNULL, //135 SPELL_EFFECT_CALL_PET
228 &Spell::EffectHealPct, //136 SPELL_EFFECT_HEAL_PCT
229 &Spell::EffectEnergizePct, //137 SPELL_EFFECT_ENERGIZE_PCT
230 &Spell::EffectLeapBack, //138 SPELL_EFFECT_LEAP_BACK Leap back
231 &Spell::EffectQuestClear, //139 SPELL_EFFECT_CLEAR_QUEST Reset quest status (miscValue - quest ID)
232 &Spell::EffectForceCast, //140 SPELL_EFFECT_FORCE_CAST
233 &Spell::EffectForceCast, //141 SPELL_EFFECT_FORCE_CAST_WITH_VALUE
234 &Spell::EffectTriggerSpell, //142 SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE
235 &Spell::EffectUnused, //143 SPELL_EFFECT_APPLY_AREA_AURA_OWNER
236 &Spell::EffectKnockBack, //144 SPELL_EFFECT_KNOCK_BACK_DEST
237 &Spell::EffectPullTowardsDest, //145 SPELL_EFFECT_PULL_TOWARDS_DEST Black Hole Effect
238 &Spell::EffectNULL, //146 SPELL_EFFECT_RESTORE_GARRISON_TROOP_VITALITY
239 &Spell::EffectQuestFail, //147 SPELL_EFFECT_QUEST_FAIL quest fail
240 &Spell::EffectTriggerMissileSpell, //148 SPELL_EFFECT_TRIGGER_MISSILE_SPELL_WITH_VALUE
241 &Spell::EffectChargeDest, //149 SPELL_EFFECT_CHARGE_DEST
242 &Spell::EffectQuestStart, //150 SPELL_EFFECT_QUEST_START
243 &Spell::EffectTriggerRitualOfSummoning, //151 SPELL_EFFECT_TRIGGER_SPELL_2
244 &Spell::EffectSummonRaFFriend, //152 SPELL_EFFECT_SUMMON_RAF_FRIEND summon Refer-a-Friend
245 &Spell::EffectCreateTamedPet, //153 SPELL_EFFECT_CREATE_TAMED_PET misc value is creature entry
246 &Spell::EffectDiscoverTaxi, //154 SPELL_EFFECT_DISCOVER_TAXI
247 &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.
248 &Spell::EffectEnchantItemPrismatic, //156 SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC
249 &Spell::EffectCreateItem2, //157 SPELL_EFFECT_CREATE_ITEM_2 create item or create item template and replace by some randon spell loot item
250 &Spell::EffectMilling, //158 SPELL_EFFECT_MILLING milling
251 &Spell::EffectRenamePet, //159 SPELL_EFFECT_ALLOW_RENAME_PET allow rename pet once again
252 &Spell::EffectForceCast2, //160 SPELL_EFFECT_FORCE_CAST_2
253 &Spell::EffectNULL, //161 SPELL_EFFECT_TALENT_SPEC_COUNT second talent spec (learn/revert)
254 &Spell::EffectActivateSpec, //162 SPELL_EFFECT_TALENT_SPEC_SELECT activate primary/secondary spec
255 &Spell::EffectNULL, //163 SPELL_EFFECT_OBLITERATE_ITEM
256 &Spell::EffectRemoveAura, //164 SPELL_EFFECT_REMOVE_AURA
257 &Spell::EffectDamageFromMaxHealthPCT, //165 SPELL_EFFECT_DAMAGE_FROM_MAX_HEALTH_PCT
258 &Spell::EffectGiveCurrency, //166 SPELL_EFFECT_GIVE_CURRENCY
259 &Spell::EffectUpdatePlayerPhase, //167 SPELL_EFFECT_UPDATE_PLAYER_PHASE
260 &Spell::EffectNULL, //168 SPELL_EFFECT_ALLOW_CONTROL_PET
261 &Spell::EffectDestroyItem, //169 SPELL_EFFECT_DESTROY_ITEM
262 &Spell::EffectUpdateZoneAurasAndPhases, //170 SPELL_EFFECT_UPDATE_ZONE_AURAS_AND_PHASES
263 &Spell::EffectSummonPersonalGameObject, //171 SPELL_EFFECT_SUMMON_PERSONAL_GAMEOBJECT
264 &Spell::EffectResurrectWithAura, //172 SPELL_EFFECT_RESURRECT_WITH_AURA
265 &Spell::EffectUnlockGuildVaultTab, //173 SPELL_EFFECT_UNLOCK_GUILD_VAULT_TAB
266 &Spell::EffectApplyAura, //174 SPELL_EFFECT_APPLY_AURA_ON_PET
267 &Spell::EffectNULL, //175 SPELL_EFFECT_175
268 &Spell::EffectSanctuary, //176 SPELL_EFFECT_SANCTUARY_2
269 &Spell::EffectNULL, //177 SPELL_EFFECT_DESPAWN_PERSISTENT_AREA_AURA
270 &Spell::EffectUnused, //178 SPELL_EFFECT_178 unused
271 &Spell::EffectCreateAreaTrigger, //179 SPELL_EFFECT_CREATE_AREATRIGGER
272 &Spell::EffectNULL, //180 SPELL_EFFECT_UPDATE_AREATRIGGER
273 &Spell::EffectRemoveTalent, //181 SPELL_EFFECT_REMOVE_TALENT
274 &Spell::EffectNULL, //182 SPELL_EFFECT_DESPAWN_AREATRIGGER
275 &Spell::EffectNULL, //183 SPELL_EFFECT_183
276 &Spell::EffectReputation, //184 SPELL_EFFECT_REPUTATION_2
277 &Spell::EffectNULL, //185 SPELL_EFFECT_185
278 &Spell::EffectNULL, //186 SPELL_EFFECT_186
279 &Spell::EffectNULL, //187 SPELL_EFFECT_RANDOMIZE_ARCHAEOLOGY_DIGSITES
280 &Spell::EffectNULL, //188 SPELL_EFFECT_SUMMON_STABLED_PET_AS_GUARDIAN
281 &Spell::EffectNULL, //189 SPELL_EFFECT_LOOT
282 &Spell::EffectNULL, //190 SPELL_EFFECT_CHANGE_PARTY_MEMBERS
283 &Spell::EffectNULL, //191 SPELL_EFFECT_TELEPORT_TO_DIGSITE
284 &Spell::EffectUncageBattlePet, //192 SPELL_EFFECT_UNCAGE_BATTLEPET
285 &Spell::EffectNULL, //193 SPELL_EFFECT_START_PET_BATTLE
286 &Spell::EffectUnused, //194 SPELL_EFFECT_194
287 &Spell::EffectPlaySceneScriptPackage, //195 SPELL_EFFECT_PLAY_SCENE_SCRIPT_PACKAGE
288 &Spell::EffectCreateSceneObject, //196 SPELL_EFFECT_CREATE_SCENE_OBJECT
289 &Spell::EffectCreatePrivateSceneObject, //197 SPELL_EFFECT_CREATE_PERSONAL_SCENE_OBJECT
290 &Spell::EffectPlayScene, //198 SPELL_EFFECT_PLAY_SCENE
291 &Spell::EffectNULL, //199 SPELL_EFFECT_DESPAWN_SUMMON
292 &Spell::EffectHealBattlePetPct, //200 SPELL_EFFECT_HEAL_BATTLEPET_PCT
293 &Spell::EffectEnableBattlePets, //201 SPELL_EFFECT_ENABLE_BATTLE_PETS
294 &Spell::EffectUnused, //202 SPELL_EFFECT_APPLY_AREA_AURA_SUMMONS
295 &Spell::EffectRemoveAura, //203 SPELL_EFFECT_REMOVE_AURA_2
296 &Spell::EffectChangeBattlePetQuality, //204 SPELL_EFFECT_CHANGE_BATTLEPET_QUALITY
297 &Spell::EffectLaunchQuestChoice, //205 SPELL_EFFECT_LAUNCH_QUEST_CHOICE
298 &Spell::EffectNULL, //206 SPELL_EFFECT_ALTER_ITEM
299 &Spell::EffectNULL, //207 SPELL_EFFECT_LAUNCH_QUEST_TASK
300 &Spell::EffectNULL, //208 SPELL_EFFECT_SET_REPUTATION
301 &Spell::EffectUnused, //209 SPELL_EFFECT_209
302 &Spell::EffectLearnGarrisonBuilding, //210 SPELL_EFFECT_LEARN_GARRISON_BUILDING
303 &Spell::EffectNULL, //211 SPELL_EFFECT_LEARN_GARRISON_SPECIALIZATION
304 &Spell::EffectRemoveAuraBySpellLabel, //212 SPELL_EFFECT_REMOVE_AURA_BY_SPELL_LABEL
305 &Spell::EffectJumpDest, //213 SPELL_EFFECT_JUMP_DEST_2
306 &Spell::EffectCreateGarrison, //214 SPELL_EFFECT_CREATE_GARRISON
307 &Spell::EffectNULL, //215 SPELL_EFFECT_UPGRADE_CHARACTER_SPELLS
308 &Spell::EffectNULL, //216 SPELL_EFFECT_CREATE_SHIPMENT
309 &Spell::EffectNULL, //217 SPELL_EFFECT_UPGRADE_GARRISON
310 &Spell::EffectNULL, //218 SPELL_EFFECT_218
311 &Spell::EffectCreateConversation, //219 SPELL_EFFECT_CREATE_CONVERSATION
312 &Spell::EffectAddGarrisonFollower, //220 SPELL_EFFECT_ADD_GARRISON_FOLLOWER
313 &Spell::EffectNULL, //221 SPELL_EFFECT_ADD_GARRISON_MISSION
314 &Spell::EffectCreateHeirloomItem, //222 SPELL_EFFECT_CREATE_HEIRLOOM_ITEM
315 &Spell::EffectNULL, //223 SPELL_EFFECT_CHANGE_ITEM_BONUSES
316 &Spell::EffectActivateGarrisonBuilding, //224 SPELL_EFFECT_ACTIVATE_GARRISON_BUILDING
317 &Spell::EffectGrantBattlePetLevel, //225 SPELL_EFFECT_GRANT_BATTLEPET_LEVEL
318 &Spell::EffectNULL, //226 SPELL_EFFECT_TRIGGER_ACTION_SET
319 &Spell::EffectNULL, //227 SPELL_EFFECT_TELEPORT_TO_LFG_DUNGEON
320 &Spell::EffectNULL, //228 SPELL_EFFECT_228
321 &Spell::EffectNULL, //229 SPELL_EFFECT_SET_FOLLOWER_QUALITY
322 &Spell::EffectNULL, //230 SPELL_EFFECT_230
323 &Spell::EffectNULL, //231 SPELL_EFFECT_INCREASE_FOLLOWER_EXPERIENCE
324 &Spell::EffectNULL, //232 SPELL_EFFECT_REMOVE_PHASE
325 &Spell::EffectNULL, //233 SPELL_EFFECT_RANDOMIZE_FOLLOWER_ABILITIES
326 &Spell::EffectNULL, //234 SPELL_EFFECT_234
327 &Spell::EffectUnused, //235 SPELL_EFFECT_235
328 &Spell::EffectGiveExperience, //236 SPELL_EFFECT_GIVE_EXPERIENCE
329 &Spell::EffectGiveRestedExperience, //237 SPELL_EFFECT_GIVE_RESTED_EXPERIENCE_BONUS
330 &Spell::EffectNULL, //238 SPELL_EFFECT_INCREASE_SKILL
331 &Spell::EffectNULL, //239 SPELL_EFFECT_END_GARRISON_BUILDING_CONSTRUCTION
332 &Spell::EffectGiveArtifactPower, //240 SPELL_EFFECT_GIVE_ARTIFACT_POWER
333 &Spell::EffectUnused, //241 SPELL_EFFECT_241
334 &Spell::EffectGiveArtifactPowerNoBonus, //242 SPELL_EFFECT_GIVE_ARTIFACT_POWER_NO_BONUS
335 &Spell::EffectApplyEnchantIllusion, //243 SPELL_EFFECT_APPLY_ENCHANT_ILLUSION
336 &Spell::EffectNULL, //244 SPELL_EFFECT_LEARN_FOLLOWER_ABILITY
337 &Spell::EffectUpgradeHeirloom, //245 SPELL_EFFECT_UPGRADE_HEIRLOOM
338 &Spell::EffectNULL, //246 SPELL_EFFECT_FINISH_GARRISON_MISSION
339 &Spell::EffectNULL, //247 SPELL_EFFECT_ADD_GARRISON_MISSION_SET
340 &Spell::EffectNULL, //248 SPELL_EFFECT_FINISH_SHIPMENT
341 &Spell::EffectNULL, //249 SPELL_EFFECT_FORCE_EQUIP_ITEM
342 &Spell::EffectNULL, //250 SPELL_EFFECT_TAKE_SCREENSHOT
343 &Spell::EffectNULL, //251 SPELL_EFFECT_SET_GARRISON_CACHE_SIZE
344 &Spell::EffectTeleportUnits, //252 SPELL_EFFECT_TELEPORT_UNITS
345 &Spell::EffectGiveHonor, //253 SPELL_EFFECT_GIVE_HONOR
346 &Spell::EffectJumpCharge, //254 SPELL_EFFECT_JUMP_CHARGE
347 &Spell::EffectLearnTransmogSet, //255 SPELL_EFFECT_LEARN_TRANSMOG_SET
348 &Spell::EffectUnused, //256 SPELL_EFFECT_256
349 &Spell::EffectUnused, //257 SPELL_EFFECT_257
350 &Spell::EffectNULL, //258 SPELL_EFFECT_MODIFY_KEYSTONE
351 &Spell::EffectRespecAzeriteEmpoweredItem, //259 SPELL_EFFECT_RESPEC_AZERITE_EMPOWERED_ITEM
352 &Spell::EffectNULL, //260 SPELL_EFFECT_SUMMON_STABLED_PET
353 &Spell::EffectNULL, //261 SPELL_EFFECT_SCRAP_ITEM
354 &Spell::EffectUnused, //262 SPELL_EFFECT_262
355 &Spell::EffectNULL, //263 SPELL_EFFECT_REPAIR_ITEM
356 &Spell::EffectNULL, //264 SPELL_EFFECT_REMOVE_GEM
357 &Spell::EffectLearnAzeriteEssencePower, //265 SPELL_EFFECT_LEARN_AZERITE_ESSENCE_POWER
358 &Spell::EffectNULL, //266 SPELL_EFFECT_SET_ITEM_BONUS_LIST_GROUP_ENTRY
359 &Spell::EffectCreatePrivateConversation, //267 SPELL_EFFECT_CREATE_PRIVATE_CONVERSATION
360 &Spell::EffectApplyMountEquipment, //268 SPELL_EFFECT_APPLY_MOUNT_EQUIPMENT
361 &Spell::EffectNULL, //269 SPELL_EFFECT_INCREASE_ITEM_BONUS_LIST_GROUP_STEP
362 &Spell::EffectNULL, //270 SPELL_EFFECT_270
363 &Spell::EffectUnused, //271 SPELL_EFFECT_APPLY_AREA_AURA_PARTY_NONRANDOM
364 &Spell::EffectNULL, //272 SPELL_EFFECT_SET_COVENANT
365 &Spell::EffectNULL, //273 SPELL_EFFECT_CRAFT_RUNEFORGE_LEGENDARY
366 &Spell::EffectUnused, //274 SPELL_EFFECT_274
367 &Spell::EffectUnused, //275 SPELL_EFFECT_275
368 &Spell::EffectLearnTransmogIllusion, //276 SPELL_EFFECT_LEARN_TRANSMOG_ILLUSION
369 &Spell::EffectNULL, //277 SPELL_EFFECT_SET_CHROMIE_TIME
370 &Spell::EffectNULL, //278 SPELL_EFFECT_278
371 &Spell::EffectNULL, //279 SPELL_EFFECT_LEARN_GARR_TALENT
372 &Spell::EffectUnused, //280 SPELL_EFFECT_280
373 &Spell::EffectNULL, //281 SPELL_EFFECT_LEARN_SOULBIND_CONDUIT
374 &Spell::EffectNULL, //282 SPELL_EFFECT_CONVERT_ITEMS_TO_CURRENCY
375 &Spell::EffectSkipCampaign, //283 SPELL_EFFECT_COMPLETE_CAMPAIGN
376 &Spell::EffectSendChatMessage, //284 SPELL_EFFECT_SEND_CHAT_MESSAGE
377 &Spell::EffectNULL, //285 SPELL_EFFECT_MODIFY_KEYSTONE_2
378 &Spell::EffectGrantBattlePetExperience, //286 SPELL_EFFECT_GRANT_BATTLEPET_EXPERIENCE
379 &Spell::EffectNULL, //287 SPELL_EFFECT_SET_GARRISON_FOLLOWER_LEVEL
380 &Spell::EffectNULL, //288 SPELL_EFFECT_CRAFT_ITEM
381 &Spell::EffectModifyAuraStacks, //289 SPELL_EFFECT_MODIFY_AURA_STACKS
382 &Spell::EffectModifyCooldown, //290 SPELL_EFFECT_MODIFY_COOLDOWN
383 &Spell::EffectModifyCooldowns, //291 SPELL_EFFECT_MODIFY_COOLDOWNS
384 &Spell::EffectModifyCooldownsByCategory, //292 SPELL_EFFECT_MODIFY_COOLDOWNS_BY_CATEGORY
385 &Spell::EffectModifySpellCharges, //293 SPELL_EFFECT_MODIFY_CHARGES
386 &Spell::EffectNULL, //294 SPELL_EFFECT_CRAFT_LOOT
387 &Spell::EffectNULL, //295 SPELL_EFFECT_SALVAGE_ITEM
388 &Spell::EffectNULL, //296 SPELL_EFFECT_CRAFT_SALVAGE_ITEM
389 &Spell::EffectNULL, //297 SPELL_EFFECT_RECRAFT_ITEM
390 &Spell::EffectNULL, //298 SPELL_EFFECT_CANCEL_ALL_PRIVATE_CONVERSATIONS
391 &Spell::EffectNULL, //299 SPELL_EFFECT_299
392 &Spell::EffectUnused, //300 SPELL_EFFECT_300
393 &Spell::EffectNULL, //301 SPELL_EFFECT_CRAFT_ENCHANT
394 &Spell::EffectNULL, //302 SPELL_EFFECT_GATHERING
395 &Spell::EffectCreateTraitTreeConfig, //303 SPELL_EFFECT_CREATE_TRAIT_TREE_CONFIG
396 &Spell::EffectChangeActiveCombatTraitConfig, //304 SPELL_EFFECT_CHANGE_ACTIVE_COMBAT_TRAIT_CONFIG
397 &Spell::EffectNULL, //305 SPELL_EFFECT_305
398 &Spell::EffectUpdateInteractions, //306 SPELL_EFFECT_UPDATE_INTERACTIONS
399 &Spell::EffectNULL, //307 SPELL_EFFECT_307
400 &Spell::EffectNULL, //308 SPELL_EFFECT_CANCEL_PRELOAD_WORLD
401 &Spell::EffectNULL, //309 SPELL_EFFECT_PRELOAD_WORLD
402 &Spell::EffectNULL, //310 SPELL_EFFECT_310
403 &Spell::EffectSkipQuestLine, //311 SPELL_EFFECT_SKIP_QUESTLINE
404 &Spell::EffectNULL, //312 SPELL_EFFECT_312
405 &Spell::EffectNULL, //313 SPELL_EFFECT_CHANGE_ITEM_BONUSES_2
406 &Spell::EffectNULL, //314 SPELL_EFFECT_ADD_SOCKET_BONUS
407 &Spell::EffectNULL, //315 SPELL_EFFECT_LEARN_TRANSMOG_APPEARANCE_FROM_ITEM_MOD_APPEARANCE_GROUP
408 &Spell::EffectKillCreditLabel, //316 SPELL_EFFECT_KILL_CREDIT_LABEL_1
409 &Spell::EffectKillCreditLabel, //317 SPELL_EFFECT_KILL_CREDIT_LABEL_2
410 &Spell::EffectNULL, //318 SPELL_EFFECT_318
411 &Spell::EffectNULL, //319 SPELL_EFFECT_319
412 &Spell::EffectNULL, //320 SPELL_EFFECT_320
413 &Spell::EffectNULL, //321 SPELL_EFFECT_321
414 &Spell::EffectNULL, //322 SPELL_EFFECT_322
415 &Spell::EffectNULL, //323 SPELL_EFFECT_323
416 &Spell::EffectNULL, //324 SPELL_EFFECT_324
417 &Spell::EffectNULL, //325 SPELL_EFFECT_325
418 &Spell::EffectNULL, //326 SPELL_EFFECT_326
419 &Spell::EffectNULL, //327 SPELL_EFFECT_327
420 &Spell::EffectNULL, //328 SPELL_EFFECT_328
421 &Spell::EffectNULL, //329 SPELL_EFFECT_329
422 &Spell::EffectNULL, //330 SPELL_EFFECT_330
423 &Spell::EffectNULL, //331 SPELL_EFFECT_331
424 &Spell::EffectNULL, //332 SPELL_EFFECT_332
425 &Spell::EffectNULL, //333 SPELL_EFFECT_333
426 &Spell::EffectNULL, //334 SPELL_EFFECT_334
427 &Spell::EffectSetPlayerDataElementAccount, //335 SPELL_EFFECT_SET_PLAYER_DATA_ELEMENT_ACCOUNT
428 &Spell::EffectSetPlayerDataElementCharacter, //336 SPELL_EFFECT_SET_PLAYER_DATA_ELEMENT_CHARACTER
429 &Spell::EffectSetPlayerDataFlagAccount, //337 SPELL_EFFECT_SET_PLAYER_DATA_FLAG_ACCOUNT
430 &Spell::EffectSetPlayerDataFlagCharacter, //338 SPELL_EFFECT_SET_PLAYER_DATA_FLAG_CHARACTER
431 &Spell::EffectNULL, //339 SPELL_EFFECT_UI_ACTION
432 &Spell::EffectNULL, //340 SPELL_EFFECT_340
433 &Spell::EffectLearnWarbandScene, //341 SPELL_EFFECT_LEARN_WARBAND_SCENE
434 &Spell::EffectNULL, //342 SPELL_EFFECT_342
435 &Spell::EffectNULL, //343 SPELL_EFFECT_343
436 &Spell::EffectNULL, //344 SPELL_EFFECT_344
437 &Spell::EffectNULL, //345 SPELL_EFFECT_ASSIST_ACTION
438 &Spell::EffectNULL, //346 SPELL_EFFECT_346
439 &Spell::EffectEquipTransmogOutfit, //347 SPELL_EFFECT_EQUIP_TRANSMOG_OUTFIT
440 &Spell::EffectNULL, //348 SPELL_EFFECT_GIVE_HOUSE_LEVEL
441 &Spell::EffectNULL, //349 SPELL_EFFECT_LEARN_HOUSE_ROOM
442 &Spell::EffectNULL, //350 SPELL_EFFECT_LEARN_HOUSE_EXTERIOR_COMPONENT
443 &Spell::EffectNULL, //351 SPELL_EFFECT_LEARN_HOUSE_THEME
444 &Spell::EffectNULL, //352 SPELL_EFFECT_LEARN_HOUSE_ROOM_COMPONENT_TEXTURE
445 &Spell::EffectCreateAreaTrigger, //353 SPELL_EFFECT_CREATE_AREATRIGGER_2
446 &Spell::EffectNULL, //354 SPELL_EFFECT_SET_NEIGHBORHOOD_INITIATIVE
447 &Spell::EffectNULL, //355 SPELL_EFFECT_LEARN_HOUSE_TYPE
448 &Spell::EffectNULL, //356 SPELL_EFFECT_356
449 &Spell::EffectNULL, //357 SPELL_EFFECT_357
450 &Spell::EffectNULL, //358 SPELL_EFFECT_358
451 &Spell::EffectNULL, //359 SPELL_EFFECT_359
452};
453
455{
456 TC_LOG_DEBUG("spells", "WORLD: Spell Effect DUMMY");
457}
458
460{
461 // NOT USED BY ANY SPELL OR USELESS OR IMPLEMENTED IN DIFFERENT WAY IN TRINITY
462}
463
465{
467 return;
468
469 if (!m_corpseTarget && !unitTarget)
470 return;
471
472 Player* player = nullptr;
473
474 if (m_corpseTarget)
476 else if (unitTarget)
477 player = unitTarget->ToPlayer();
478
479 if (!player || player->IsAlive() || !player->IsInWorld())
480 return;
481
482 if (player->IsResurrectRequested()) // already have one active request
483 return;
484
485 uint32 health = GetEffectValueAsInt();
488 player->SetResurrectRequestData(m_caster, health, mana, 0);
489 SendResurrectRequest(player);
490}
491
493{
495 return;
496
497 if (!unitTarget || !unitTarget->IsAlive())
498 return;
499
502 return;
503
504 if (m_caster == unitTarget) // prevent interrupt message
505 finish();
506
508 data.Target = unitTarget->GetGUID();
509 data.Caster = m_caster->GetGUID();
510 data.SpellID = m_spellInfo->Id;
511 m_caster->SendMessageToSet(data.Write(), true);
512
514}
515
517{
519 return;
520
521 if (!unitTarget || !unitTarget->IsAlive())
522 return;
523
524 uint32 damage = GetEffectValueAsInt();
525 // CalcAbsorbResist already in Player::EnvironmentalDamage
528 else
529 {
530 Unit* unitCaster = GetUnitCasterForEffectHandlers();
532 Unit::CalcAbsorbResist(damageInfo);
533
535 log.damage = damageInfo.GetDamage();
536 log.originalDamage = damage;
537 log.absorb = damageInfo.GetAbsorb();
538 log.resist = damageInfo.GetResist();
539
540 if (unitCaster)
541 unitCaster->SendSpellNonMeleeDamageLog(&log);
542 }
543}
544
546{
548 return;
549
550 if (unitTarget && unitTarget->IsAlive())
551 {
552 int32 damage = GetEffectValueAsInt();
553 bool apply_direct_bonus = true;
554
555 // Meteor like spells (divided damage to targets)
557 {
558 // divide to all targets
560 damage /= count;
561 }
562
563 Unit* unitCaster = GetUnitCasterForEffectHandlers();
564 if (unitCaster && apply_direct_bonus)
565 {
566 int32 bonus = unitCaster->SpellDamageBonusDone(unitTarget, m_spellInfo, damage, SPELL_DIRECT_DAMAGE, *effectInfo, 1, this);
567 damage = bonus + int32(bonus * variance);
568 damage = unitTarget->SpellDamageBonusTaken(unitCaster, m_spellInfo, damage, SPELL_DIRECT_DAMAGE);
569 }
570
571 m_damage += damage;
572 }
573}
574
576{
578 return;
579
581 return;
582
583 // pet auras
585 {
586 if (PetAura const* petSpell = sSpellMgr->GetPetAura(m_spellInfo->Id, effectInfo->EffectIndex))
587 {
588 m_caster->ToPlayer()->AddPetAura(petSpell);
589 return;
590 }
591 }
592}
593
595{
598 return;
599
600 uint32 triggered_spell_id = effectInfo->TriggerSpell;
601
605 {
606 // special cases
607 switch (triggered_spell_id)
608 {
609 // Demonic Empowerment -- succubus
610 case 54437:
611 {
615
616 // Cast Lesser Invisibility
617 unitTarget->CastSpell(unitTarget, 7870, this);
618 return;
619 }
620 // Brittle Armor - (need add max stack of 24575 Brittle Armor)
621 case 29284:
622 {
623 // Brittle Armor
624 SpellInfo const* spell = sSpellMgr->GetSpellInfo(24575, GetCastDifficulty());
625 if (!spell)
626 return;
627
628 for (uint32 j = 0; j < spell->StackAmount; ++j)
629 m_caster->CastSpell(unitTarget, spell->Id, this);
630 return;
631 }
632 // Mercurial Shield - (need add max stack of 26464 Mercurial Shield)
633 case 29286:
634 {
635 // Mercurial Shield
636 SpellInfo const* spell = sSpellMgr->GetSpellInfo(26464, GetCastDifficulty());
637 if (!spell)
638 return;
639
640 for (uint32 j = 0; j < spell->StackAmount; ++j)
641 m_caster->CastSpell(unitTarget, spell->Id, this);
642 return;
643 }
644 }
645 }
646
647 if (triggered_spell_id == 0)
648 {
649 TC_LOG_WARN("spells.effect.nospell", "Spell::EffectTriggerSpell: Spell {} [EffectIndex: {}] does not have triggered spell.", m_spellInfo->Id, effectInfo->EffectIndex);
650 return;
651 }
652
653 // normal case
654 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id, GetCastDifficulty());
655 if (!spellInfo)
656 {
657 TC_LOG_ERROR("spells.effect.nospell", "Spell::EffectTriggerSpell spell {} tried to trigger unknown spell {}", m_spellInfo->Id, triggered_spell_id);
658 return;
659 }
660
661 SpellCastTargets targets;
662 Optional<int32> targetCount;
663 Optional<int32> targetIndex;
665 {
667 return;
668 targets.SetUnitTarget(unitTarget);
671 }
672 else //if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH)
673 {
675 return;
676
678 targets.SetDst(m_targets);
679
680 if (Unit* target = m_targets.GetUnitTarget())
681 targets.SetUnitTarget(target);
682 else
683 {
684 if (Unit* unit = m_caster->ToUnit())
685 targets.SetUnitTarget(unit);
686 else if (GameObject* go = m_caster->ToGameObject())
687 targets.SetGOTarget(go);
688 }
689 }
690
691 Milliseconds delay = 0ms;
694
695 m_caster->m_Events.AddEventAtOffset([caster = m_caster, targets, originalCaster = m_originalCasterGUID, castItemGuid = m_castItemGUID, originalCastId = m_castId,
696 spellEffectInfo = effectInfo, value = effectValue, itemLevel = m_castItemLevel, targetCount, targetIndex]() mutable
697 {
698 targets.Update(caster); // refresh pointers stored in targets
699
700 // original caster guid only for GO cast
702 args.SetOriginalCaster(originalCaster);
703 args.OriginalCastId = originalCastId;
704 args.OriginalCastItemLevel = itemLevel;
705 SpellInfo const* spellInfo = sSpellMgr->AssertSpellInfo(spellEffectInfo->TriggerSpell, caster->GetMap()->GetDifficultyID());
706 if (!castItemGuid.IsEmpty() && spellInfo->HasAttribute(SPELL_ATTR2_RETAIN_ITEM_CAST))
707 if (Player const* triggeringAuraCaster = Object::ToPlayer(caster))
708 args.CastItem = triggeringAuraCaster->GetItemByGuid(castItemGuid);
709
710 // set basepoints for trigger with value effect
711 if (spellEffectInfo->Effect == SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE)
712 for (std::size_t i = 0; i < spellInfo->GetEffects().size(); ++i)
714
715 if (targetCount)
717
718 if (targetIndex)
720
721 caster->CastSpell(std::move(targets), spellEffectInfo->TriggerSpell, args);
722 }, delay);
723}
724
726{
729 return;
730
731 uint32 triggered_spell_id = effectInfo->TriggerSpell;
732 if (triggered_spell_id == 0)
733 {
734 TC_LOG_WARN("spells.effect.nospell", "Spell::EffectTriggerMissileSpell: Spell {} [EffectIndex: {}] does not have triggered spell.", m_spellInfo->Id, effectInfo->EffectIndex);
735 return;
736 }
737
738 // normal case
739 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id, GetCastDifficulty());
740 if (!spellInfo)
741 {
742 TC_LOG_ERROR("spells.effect.nospell", "Spell::EffectTriggerMissileSpell spell {} tried to trigger unknown spell {}.", m_spellInfo->Id, triggered_spell_id);
743 return;
744 }
745
746 SpellCastTargets targets;
747 Optional<int32> targetCount;
748 Optional<int32> targetIndex;
750 {
752 return;
753 targets.SetUnitTarget(unitTarget);
756 }
757 else //if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT)
758 {
760 return;
761
763 targets.SetDst(m_targets);
764
765 if (Unit* unit = m_caster->ToUnit())
766 targets.SetUnitTarget(unit);
767 else if (GameObject* go = m_caster->ToGameObject())
768 targets.SetGOTarget(go);
769 }
770
773 args.SetTriggeringSpell(this);
775
776 // set basepoints for trigger with value effect
778 for (std::size_t i = 0; i < spellInfo->GetEffects().size(); ++i)
780
781 if (targetCount)
783
784 if (targetIndex)
786
787 // original caster guid only for GO cast
788 m_caster->CastSpell(std::move(targets), spellInfo->Id, args);
789}
790
792{
794 return;
795
796 if (!unitTarget)
797 return;
798
799 uint32 triggered_spell_id = effectInfo->TriggerSpell;
800 if (triggered_spell_id == 0)
801 {
802 TC_LOG_WARN("spells.effect.nospell", "Spell::EffectForceCast: Spell {} [EffectIndex: {}] does not have triggered spell.", m_spellInfo->Id, effectInfo->EffectIndex);
803 return;
804 }
805
806 // normal case
807 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id, GetCastDifficulty());
808
809 if (!spellInfo)
810 {
811 TC_LOG_ERROR("spells.effect.nospell", "Spell::EffectForceCast of spell {}: triggering unknown spell id {}.", m_spellInfo->Id, triggered_spell_id);
812 return;
813 }
814
816 {
817 switch (m_spellInfo->Id)
818 {
819 case 52588: // Skeletal Gryphon Escape
820 case 48598: // Ride Flamebringer Cue
822 break;
823 case 52463: // Hide In Mine Car
824 case 52349: // Overtake
825 {
829 unitTarget->CastSpell(unitTarget, spellInfo->Id, args);
830 return;
831 }
832 }
833 }
834
835 switch (spellInfo->Id)
836 {
837 case 72298: // Malleable Goo Summon
839 .SetOriginalCaster(m_originalCasterGUID));
840 return;
841 }
842
845 for (std::size_t i = 0; i < spellInfo->GetEffects().size(); ++i)
847
848 unitTarget->CastSpell(m_caster, spellInfo->Id, args);
849}
850
852{
854 return;
855
856 if (!unitTarget)
857 return;
858
859 uint32 triggered_spell_id = effectInfo->TriggerSpell;
860 if (triggered_spell_id == 0)
861 {
862 TC_LOG_WARN("spells.effect.nospell", "Spell::EffectForceCast2: Spell {} [EffectIndex: {}] does not have triggered spell.", m_spellInfo->Id, effectInfo->EffectIndex);
863 return;
864 }
865
866 // normal case
867 if (!sSpellMgr->GetSpellInfo(triggered_spell_id, GetCastDifficulty()))
868 {
869 TC_LOG_ERROR("spells.effect.nospell", "Spell::EffectForceCast2 of spell {}: triggering unknown spell id {}.", m_spellInfo->Id, triggered_spell_id);
870 return;
871 }
872
873 // Start the cast during next update tick
874 // This is neccessary to preserve proper SMSG_SPELL_START and SMSG_SPELL_GO packet sequence
875 // (if packet sequence is not preserved then client cast bar in UI bugs and doesn't stop when the spell is interrupted)
876 // Triggered spells from effects handled during launch phase (such as SPELL_EFFECT_TRIGGER_SPELL)
877 // normally have their SMSG_SPELL_GO sent before parent spell SMSG_SPELL_GO
878 // SPELL_EFFECT_FORCE_CAST_2 requires these packets to be sent after parent spell
879 // but also needs to be handled during launch phase as well
880 unitTarget->m_Events.AddEventAtOffset([triggered_spell_id, target = CastSpellTargetArg(m_caster), caster = unitTarget]() mutable
881 {
882 if (!target.Targets)
883 return;
884
885 target.Targets->Update(caster);
886
887 caster->CastSpell(target, triggered_spell_id);
888 }, 0ms);
889}
890
892{
894 return;
895
896 uint32 triggered_spell_id = effectInfo->TriggerSpell;
897 if (triggered_spell_id == 0)
898 {
899 TC_LOG_WARN("spells.effect.nospell", "Spell::EffectTriggerRitualOfSummoning: Spell {} [EffectIndex: {}] does not have triggered spell.", m_spellInfo->Id, effectInfo->EffectIndex);
900 return;
901 }
902
903 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id, GetCastDifficulty());
904
905 if (!spellInfo)
906 {
907 TC_LOG_ERROR("spells.effect.nospell", "EffectTriggerRitualOfSummoning of spell {}: triggering unknown spell id {}.", m_spellInfo->Id, triggered_spell_id);
908 return;
909 }
910
911 finish();
912
913 m_caster->CastSpell(nullptr, spellInfo->Id, CastSpellExtraArgs()
914 .SetTriggeringSpell(this));
915}
916
918{
920 return;
921
922 Unit* unitCaster = GetUnitCasterForEffectHandlers();
923 if (!unitCaster)
924 return;
925
926 if (unitCaster->IsInFlight())
927 return;
928
929 if (!unitTarget)
930 return;
931
932 Optional<float> speedMultiplier = effectInfo->Amplitude > 0.0f ? Optional<float>(effectInfo->Amplitude) : std::nullopt;
933 Optional<float> minHeight = effectInfo->MiscValue ? Optional<float>(effectInfo->MiscValue / 10.0f) : std::nullopt;
934 Optional<float> maxHeight = effectInfo->MiscValueB ? Optional<float>(effectInfo->MiscValueB / 10.0f) : std::nullopt;
935
937 if (Unit const* target = m_targets.GetUnitTarget())
938 {
940 facing = target;
941 }
942
943 JumpArrivalCastArgs arrivalCast;
944 arrivalCast.SpellId = effectInfo->TriggerSpell;
945 arrivalCast.Target = unitTarget->GetGUID();
946 unitCaster->GetMotionMaster()->MoveJump(EVENT_JUMP, *unitTarget, {}, minHeight, maxHeight,
948 false, speedMultiplier, &arrivalCast);
949}
950
952{
954 return;
955
956 Unit* unitCaster = GetUnitCasterForEffectHandlers();
957 if (!unitCaster)
958 return;
959
960 if (unitCaster->IsInFlight())
961 return;
962
963 if (!m_targets.HasDst())
964 return;
965
966 Optional<float> speedMultiplier = effectInfo->Amplitude > 0.0f ? Optional<float>(effectInfo->Amplitude) : std::nullopt;
967 Optional<float> minHeight = effectInfo->MiscValue ? Optional<float>(effectInfo->MiscValue / 10.0f) : std::nullopt;
968 Optional<float> maxHeight = effectInfo->MiscValueB ? Optional<float>(effectInfo->MiscValueB / 10.0f) : std::nullopt;
969
971 if (Unit const* target = m_targets.GetUnitTarget())
972 {
974 facing = target;
975 }
976 else
977 facing = destTarget->GetOrientation();
978
979 JumpArrivalCastArgs arrivalCast;
980 arrivalCast.SpellId = effectInfo->TriggerSpell;
981 unitCaster->GetMotionMaster()->MoveJump(EVENT_JUMP, *destTarget, {}, minHeight, maxHeight,
983 false, speedMultiplier, &arrivalCast);
984}
985
986TeleportToOptions GetTeleportOptions(WorldObject const* caster, Unit const* unitTarget, SpellDestination const& targetDest)
987{
989 if (caster == unitTarget)
990 options |= TELE_TO_SPELL;
991
992 if (targetDest._position.GetMapId() == unitTarget->GetMapId())
993 {
994 options |= TELE_TO_NOT_LEAVE_COMBAT;
995
996 if (unitTarget->GetTransGUID() == targetDest._transportGUID)
998 }
999
1000 return options;
1001}
1002
1004{
1006 return;
1007
1008 if (!unitTarget || unitTarget->IsInFlight())
1009 return;
1010
1011 // If not exist data for dest location - return
1012 if (!m_targets.HasDst())
1013 {
1014 TC_LOG_ERROR("spells", "Spell::EffectTeleportUnits - does not have a destination for spellId {}.", m_spellInfo->Id);
1015 return;
1016 }
1017
1018 // Init dest coordinates
1019 TeleportLocation targetDest{ .Location = *destTarget };
1020 if (targetDest.Location.GetMapId() == MAPID_INVALID)
1021 targetDest.Location.m_mapId = unitTarget->GetMapId();
1022
1023 if (!targetDest.Location.GetOrientation() && m_targets.GetUnitTarget())
1024 targetDest.Location.SetOrientation(m_targets.GetUnitTarget()->GetOrientation());
1025
1026 Player* player = unitTarget->ToPlayer();
1027
1028 if (player)
1029 {
1030 // Custom loading screen
1031 if (uint32 customLoadingScreenId = effectInfo->MiscValue)
1032 if (targetDest.Location.GetMapId() != unitTarget->GetMapId() || !unitTarget->IsInDist2d(targetDest.Location, TELEPORT_MIN_LOAD_SCREEN_DISTANCE))
1034
1035 if (ObjectGuid transportGuid = m_destTargets[effectInfo->EffectIndex]._transportGUID; !transportGuid.IsEmpty())
1036 {
1037 targetDest.TransportGuid = transportGuid;
1038 targetDest.Location.Relocate(m_destTargets[effectInfo->EffectIndex]._transportOffset);
1039 }
1040
1042 player->TeleportTo(targetDest, options, m_spellInfo->Id);
1043
1044 }
1045 else if (targetDest.Location.GetMapId() == unitTarget->GetMapId())
1046 unitTarget->NearTeleportTo(targetDest.Location, unitTarget == m_caster);
1047 else
1048 TC_LOG_ERROR("spells", "Spell::EffectTeleportUnits - spellId {} attempted to teleport creature to a different map.", m_spellInfo->Id);
1049}
1050
1052{
1053public:
1054 explicit DelayedSpellTeleportEvent(Unit* target, TeleportLocation const& targetDest, TeleportToOptions options, uint32 spellId)
1055 : _target(target), _targetDest(targetDest), _options(options), _spellId(spellId){ }
1056
1057 bool Execute(uint64 /*e_time*/, uint32 /*p_time*/) override
1058 {
1059 if (Player* player = _target->ToPlayer())
1060 player->TeleportTo(_targetDest, _options);
1061 else if (_targetDest.Location.GetMapId() == _target->GetMapId())
1063 else
1064 TC_LOG_ERROR("spells", "Spell::EffectTeleportUnitsWithVisualLoadingScreen - spellId {} attempted to teleport creature to a different map.", _spellId);
1065
1066 return true;
1067 }
1068
1069private:
1074};
1075
1077{
1079 return;
1080
1081 if (!unitTarget)
1082 return;
1083
1084 // If not exist data for dest location - return
1085 if (!m_targets.HasDst())
1086 {
1087 TC_LOG_ERROR("spells", "Spell::EffectTeleportUnitsWithVisualLoadingScreen - does not have a destination for spellId {}.", m_spellInfo->Id);
1088 return;
1089 }
1090
1091 // Init dest coordinates
1092 TeleportLocation targetDest{ .Location = *destTarget };
1093 if (targetDest.Location.GetMapId() == MAPID_INVALID)
1094 targetDest.Location.m_mapId = unitTarget->GetMapId();
1095
1096 if (!targetDest.Location.GetOrientation() && m_targets.GetUnitTarget())
1097 targetDest.Location.SetOrientation(m_targets.GetUnitTarget()->GetOrientation());
1098
1099 if (ObjectGuid transportGuid = m_destTargets[effectInfo->EffectIndex]._transportGUID; !transportGuid.IsEmpty())
1100 {
1101 targetDest.TransportGuid = transportGuid;
1102 targetDest.Location.Relocate(m_destTargets[effectInfo->EffectIndex]._transportOffset);
1103 }
1104
1106 if (Player* playerTarget = unitTarget->ToPlayer())
1108
1112}
1113
1115{
1117 return;
1118
1120 return;
1121
1122 // register target/effect on aura
1124 if (!aurApp)
1126 else
1128}
1129
1131{
1133 return;
1134
1136 return;
1137
1138 Player* player = unitTarget->ToPlayer();
1139 uint32 spellToUnlearn = effectInfo->TriggerSpell;
1140
1141 player->RemoveSpell(spellToUnlearn);
1142
1143 TC_LOG_DEBUG("spells", "Spell: Player {} has unlearned spell {} from Npc {}", player->GetGUID().ToString(), spellToUnlearn, m_caster->GetGUID().ToString());
1144}
1145
1147{
1149 return;
1150
1152 return;
1153
1154 int32 drainAmount = GetEffectValueAsInt();
1155 Powers powerType = Powers(effectInfo->MiscValue);
1156 if (!unitTarget || !unitTarget->IsAlive() || unitTarget->GetPowerType() != powerType || drainAmount < 0)
1157 return;
1158
1159 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1160 // add spell damage bonus
1161 if (unitCaster)
1162 {
1163 int32 bonus = unitCaster->SpellDamageBonusDone(unitTarget, m_spellInfo, drainAmount, SPELL_DIRECT_DAMAGE, *effectInfo, 1, this);
1164 drainAmount = bonus + int32(bonus * variance);
1165 drainAmount = unitTarget->SpellDamageBonusTaken(unitCaster, m_spellInfo, drainAmount, SPELL_DIRECT_DAMAGE);
1166 }
1167
1168 int32 damage = -unitTarget->ModifyPower(powerType, -drainAmount);
1169
1170 // Don't restore from self drain
1171 float gainMultiplier = 0.f;
1172 if (unitCaster && unitCaster != unitTarget)
1173 {
1174 gainMultiplier = effectInfo->CalcValueMultiplier(unitCaster, this);
1175 int32 const gain = int32(damage * gainMultiplier);
1176
1177 unitCaster->EnergizeBySpell(unitCaster, m_spellInfo, gain, powerType);
1178 }
1179 ExecuteLogEffectTakeTargetPower(effectInfo->Effect, unitTarget, powerType, damage, gainMultiplier);
1180}
1181
1183{
1184 // we do not handle a flag dropping or clicking on flag in battleground by sendevent system
1187 return;
1188
1189 WorldObject* target = nullptr;
1190
1191 // call events for object target if present
1193 {
1194 if (unitTarget)
1195 target = unitTarget;
1196 else if (gameObjTarget)
1197 target = gameObjTarget;
1198 else if (m_corpseTarget)
1199 target = m_corpseTarget;
1200 }
1201 else // if (effectHandleMode == SPELL_EFFECT_HANDLE_HIT)
1202 {
1203 // let's prevent executing effect handler twice in case when spell effect is capable of targeting an object
1204 // this check was requested by scripters, but it has some downsides:
1205 // now it's impossible to script (using sEventScripts) a cast which misses all targets
1206 // or to have an ability to script the moment spell hits dest (in a case when there are object targets present)
1208 return;
1209 // some spells have no target entries in dbc and they use focus target
1210 if (focusObject)
1211 target = focusObject;
1213 }
1214
1215 TC_LOG_DEBUG("spells", "Spell ScriptStart {} for spellid {} in EffectSendEvent ", effectInfo->MiscValue, m_spellInfo->Id);
1216
1218}
1219
1221{
1223 return;
1224
1226 return;
1227
1228 int32 burnAmount = GetEffectValueAsInt();
1229 Powers powerType = Powers(effectInfo->MiscValue);
1230 if (!unitTarget || !unitTarget->IsAlive() || unitTarget->GetPowerType() != powerType || burnAmount < 0)
1231 return;
1232
1233 int32 damage = -unitTarget->ModifyPower(powerType, -burnAmount);
1234
1235 // NO - Not a typo - EffectPowerBurn uses effect value multiplier - not effect damage multiplier
1236 float dmgMultiplier = effectInfo->CalcValueMultiplier(GetUnitCasterForEffectHandlers(), this);
1237
1238 // add log data before multiplication (need power amount, not damage)
1239 ExecuteLogEffectTakeTargetPower(effectInfo->Effect, unitTarget, powerType, damage, 0.0f);
1240
1241 damage = int32(damage * dmgMultiplier);
1242
1243 m_damage += damage;
1244}
1245
1247{
1249 return;
1250
1251 int32 addhealth = GetEffectValueAsInt();
1252
1253 if (!unitTarget || !unitTarget->IsAlive() || addhealth < 0)
1254 return;
1255
1256 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1257
1258 // Skip if m_originalCaster not available
1259 if (!unitCaster)
1260 return;
1261
1262 // Vessel of the Naaru (Vial of the Sunwell trinket)
1264 if (m_spellInfo->Id == 45064)
1265 {
1266 // Amount of heal - depends from stacked Holy Energy
1267 int32 damageAmount = 0;
1268 if (AuraEffect const* aurEff = unitCaster->GetAuraEffect(45062, 0))
1269 {
1270 damageAmount += aurEff->GetAmount();
1271 unitCaster->RemoveAurasDueToSpell(45062);
1272 }
1273
1274 addhealth += damageAmount;
1275 }
1276 // Death Pact - return pct of max health to caster
1278 addhealth = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, int32(unitCaster->CountPctFromMaxHealth(addhealth)), HEAL, *effectInfo, 1, this);
1279 else
1280 {
1281 int32 bonus = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, addhealth, HEAL, *effectInfo, 1, this);
1282 addhealth = bonus + int32(bonus * variance);
1283 }
1284
1285 addhealth = unitTarget->SpellHealingBonusTaken(unitCaster, m_spellInfo, addhealth, HEAL);
1286
1287 // Remove Grievious bite if fully healed
1288 if (unitTarget->HasAura(48920) && (unitTarget->GetHealth() + addhealth >= unitTarget->GetMaxHealth()))
1289 unitTarget->RemoveAura(48920);
1290
1291 m_healing += addhealth;
1292}
1293
1295{
1297 return;
1298
1299 if (!unitTarget || !unitTarget->IsAlive() || effectValue < 0)
1300 return;
1301
1303 if (Unit* unitCaster = GetUnitCasterForEffectHandlers())
1304 {
1305 heal = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, heal, HEAL, *effectInfo, 1, this);
1306 heal = unitTarget->SpellHealingBonusTaken(unitCaster, m_spellInfo, heal, HEAL);
1307 }
1308
1309 m_healing += heal;
1310}
1311
1313{
1315 return;
1316
1317 if (!unitTarget || !unitTarget->IsAlive() || effectValue < 0)
1318 return;
1319
1320 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1321 int32 heal = GetEffectValueAsInt();
1322 if (unitCaster)
1323 heal = unitCaster->SpellHealingBonusDone(unitTarget, m_spellInfo, heal, HEAL, *effectInfo, 1, this);
1324
1325 heal += int32(heal * variance);
1326 if (unitCaster)
1327 heal = unitTarget->SpellHealingBonusTaken(unitCaster, m_spellInfo, heal, HEAL);
1328
1329 m_healing += heal;
1330}
1331
1333{
1335 return;
1336
1337 int32 damage = GetEffectValueAsInt();
1338 if (!unitTarget || !unitTarget->IsAlive() || damage < 0)
1339 return;
1340
1341 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1342 int32 bonus = 0;
1343 if (unitCaster)
1344 bonus = unitCaster->SpellDamageBonusDone(unitTarget, m_spellInfo, damage, SPELL_DIRECT_DAMAGE, *effectInfo, 1, this);
1345
1346 damage = bonus + int32(bonus * variance);
1347
1348 if (unitCaster)
1349 damage = unitTarget->SpellDamageBonusTaken(unitCaster, m_spellInfo, damage, SPELL_DIRECT_DAMAGE);
1350
1351 float healMultiplier = effectInfo->CalcValueMultiplier(unitCaster, this);
1352
1353 m_damage += damage;
1354
1356 Unit::CalcAbsorbResist(damageInfo);
1357 uint32 const absorb = damageInfo.GetAbsorb();
1358 damage -= absorb;
1359
1360 // get max possible damage, don't count overkill for heal
1361 int32 healthGain = int32(-unitTarget->GetHealthGain(-damage) * healMultiplier);
1362
1363 if (unitCaster && unitCaster->IsAlive())
1364 {
1365 healthGain = unitCaster->SpellHealingBonusDone(unitCaster, m_spellInfo, healthGain, HEAL, *effectInfo, 1, this);
1366 healthGain = unitCaster->SpellHealingBonusTaken(unitCaster, m_spellInfo, healthGain, HEAL);
1367
1368 HealInfo healInfo(unitCaster, unitCaster, healthGain, m_spellInfo, m_spellSchoolMask);
1369 unitCaster->HealBySpell(healInfo);
1370 }
1371}
1372
1373void Spell::DoCreateItem(uint32 itemId, ItemContext context /*= ItemContext::NONE*/, std::vector<int32> const* bonusListIDs /*= nullptr*/)
1374{
1376 return;
1377
1378 Player* player = unitTarget->ToPlayer();
1379
1380 uint32 newitemid = itemId;
1381 ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(newitemid);
1382 if (!pProto)
1383 {
1384 player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, nullptr, nullptr);
1385 return;
1386 }
1387
1388 uint32 num_to_add = std::clamp<int32>(GetEffectValueAsInt(), 1, pProto->GetMaxStackSize());
1389
1390 /* == gem perfection handling == */
1391 // this is bad, should be done using spell_loot_template (and conditions)
1392
1393 // the chance of getting a perfect result
1394 float perfectCreateChance = 0.0f;
1395 // the resulting perfect item if successful
1396 uint32 perfectItemType = itemId;
1397 // get perfection capability and chance
1398 if (CanCreatePerfectItem(player, m_spellInfo->Id, perfectCreateChance, perfectItemType))
1399 if (roll_chance(perfectCreateChance)) // if the roll succeeds...
1400 newitemid = perfectItemType; // the perfect item replaces the regular one
1401
1402 /* == gem perfection handling over == */
1403
1404 /* == profession specialization handling == */
1405
1406 // init items_count to 1, since 1 item will be created regardless of specialization
1407 int items_count=1;
1408 // the chance to create additional items
1409 float additionalCreateChance=0.0f;
1410 // the maximum number of created additional items
1411 uint8 additionalMaxNum=0;
1412 // get the chance and maximum number for creating extra items
1413 if (CanCreateExtraItems(player, m_spellInfo->Id, additionalCreateChance, additionalMaxNum))
1414 // roll with this chance till we roll not to create or we create the max num
1415 while (roll_chance(additionalCreateChance) && items_count <= additionalMaxNum)
1416 ++items_count;
1417
1418 // really will be created more items
1419 num_to_add *= items_count;
1420
1421 /* == profession specialization handling over == */
1422
1423 // can the player store the new item?
1424 ItemPosCountVec dest;
1425 uint32 no_space = 0;
1426 InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, newitemid, num_to_add, &no_space);
1427 if (msg != EQUIP_ERR_OK)
1428 {
1429 // convert to possible store amount
1430 if (msg == EQUIP_ERR_INV_FULL || msg == EQUIP_ERR_ITEM_MAX_COUNT)
1431 num_to_add -= no_space;
1432 else
1433 {
1434 // if not created by another reason from full inventory or unique items amount limitation
1435 player->SendEquipError(msg, nullptr, nullptr, newitemid);
1436 return;
1437 }
1438 }
1439
1440 if (num_to_add)
1441 {
1442 // create the new item and store it
1443 if (Item* pItem = player->StoreNewItem(dest, newitemid, true, GenerateItemRandomBonusListId(newitemid), GuidSet(), context, bonusListIDs))
1444 {
1445 // set the "Crafted by ..." property of the item
1446 if (pItem->GetTemplate()->HasSignature())
1447 pItem->SetCreator(player->GetGUID());
1448
1449 // send info to the client
1450 player->SendNewItem(pItem, num_to_add, true, true);
1451
1452 if (pItem->GetQuality() > ITEM_QUALITY_EPIC || (pItem->GetQuality() == ITEM_QUALITY_EPIC && pItem->GetItemLevel(player) >= MinNewsItemLevel))
1453 if (Guild* guild = player->GetGuild())
1454 guild->AddGuildNews(GUILD_NEWS_ITEM_CRAFTED, player->GetGUID(), 0, pProto->GetId());
1455 }
1456
1457 // we succeeded in creating at least one item, so a levelup is possible
1458 if (!m_CastItem)
1460 }
1461}
1462
1471
1473{
1475 return;
1476
1478 return;
1479
1480 Player* player = unitTarget->ToPlayer();
1481
1483
1484 // Pick a random item from spell_loot_template
1486 {
1487 player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell, context, false, false, true);
1488 if (!m_CastItem)
1490 }
1491 else // If there's no random loot entries for this spell, pick the item associated with this spell
1492 {
1493 uint32 item_id = effectInfo->ItemType;
1494
1495 if (item_id)
1496 DoCreateItem(item_id, context);
1497 }
1498
1500}
1501
1515
1517{
1519 return;
1520
1521 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1522 if (!unitCaster)
1523 return;
1524
1525 // Caster not in world, might be spell triggered from aura removal
1526 if (!unitCaster->IsInWorld())
1527 return;
1528
1529 // only handle at last effect
1530 for (size_t i = effectInfo->EffectIndex + 1; i < m_spellInfo->GetEffects().size(); ++i)
1532 return;
1533
1535
1536 float radius = 0.0f;
1537 for (size_t i = 0; i <= effectInfo->EffectIndex; ++i)
1538 {
1539 SpellEffectInfo const& spellEffectInfo = m_spellInfo->GetEffect(SpellEffIndex(i));
1540 if (spellEffectInfo.IsEffect(SPELL_EFFECT_PERSISTENT_AREA_AURA))
1541 radius = std::max(radius, spellEffectInfo.CalcRadius(unitCaster).Max);
1542 }
1543
1544 DynamicObject* dynObj = new DynamicObject(false);
1546 {
1547 delete dynObj;
1548 return;
1549 }
1550
1552 createInfo
1553 .SetCaster(unitCaster)
1556
1557 if (Aura* aura = Aura::TryCreate(createInfo))
1558 {
1559 _dynObjAura = aura->ToDynObjAura();
1561 }
1562 else
1563 return;
1564
1566 for (size_t i = 0; i < m_spellInfo->GetEffects().size(); ++i)
1569
1570 if (m_spellInfo->IsChanneled())
1571 unitCaster->AddChannelObject(dynObj->GetGUID());
1572}
1573
1575{
1577 return;
1578
1579 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1580 if (!unitCaster || !unitTarget)
1581 return;
1582
1583 if (!unitTarget->IsAlive())
1584 return;
1585
1587 return;
1588
1590 if (unitTarget->GetMaxPower(power) == 0)
1591 return;
1592
1593 int32 energizeAmount = GetEffectValueAsInt();
1594 // Some level depends spells
1595 switch (m_spellInfo->Id)
1596 {
1597 case 24571: // Blood Fury
1598 // Instantly increases your rage by ${(300-10*$max(0,$PL-60))/10}.
1599 energizeAmount -= 10 * std::max(0, std::min(30, unitCaster->GetLevel() - 60));
1600 break;
1601 case 24532: // Burst of Energy
1602 // Instantly increases your energy by ${60-4*$max(0,$min(15,$PL-60))}.
1603 energizeAmount -= 4 * std::max(0, std::min(15, unitCaster->GetLevel() - 60));
1604 break;
1605 case 67490: // Runic Mana Injector (mana gain increased by 25% for engineers - 3.2.0 patch change)
1606 {
1607 if (Player* player = unitCaster->ToPlayer())
1608 if (player->HasSkill(SKILL_ENGINEERING))
1609 AddPct(energizeAmount, 25);
1610 break;
1611 }
1612 default:
1613 break;
1614 }
1615
1616 unitCaster->EnergizeBySpell(unitTarget, m_spellInfo, energizeAmount, power);
1617}
1618
1620{
1622 return;
1623
1624 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1625 if (!unitCaster || !unitTarget)
1626 return;
1627
1628 if (!unitTarget->IsAlive())
1629 return;
1630
1632 return;
1633
1635 uint32 maxPower = unitTarget->GetMaxPower(power);
1636 if (!maxPower)
1637 return;
1638
1639 uint32 const gain = CalculatePct(maxPower, effectValue);
1640 unitCaster->EnergizeBySpell(unitTarget, m_spellInfo, gain, power);
1641}
1642
1644{
1646 return;
1647
1649 {
1650 TC_LOG_DEBUG("spells", "WORLD: Open Lock - No Player Caster!");
1651 return;
1652 }
1653
1654 Player* player = m_caster->ToPlayer();
1655
1656 uint32 lockId = 0;
1657 ObjectGuid guid;
1658
1659 // Get lockId
1660 if (gameObjTarget)
1661 {
1662 GameObjectTemplate const* goInfo = gameObjTarget->GetGOInfo();
1663
1664 if (goInfo->GetNoDamageImmune() && player->HasUnitFlag(UNIT_FLAG_IMMUNE))
1665 return;
1666
1668 {
1670 return;
1671 }
1673 // handle outdoor pvp object opening, return true if go was registered for handling
1674 // these objects must have been spawned by outdoorpvp!
1675 else if (gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_GOOBER && sOutdoorPvPMgr->HandleOpenGo(player, gameObjTarget))
1676 return;
1677 lockId = goInfo->GetLockId();
1678 guid = gameObjTarget->GetGUID();
1679 }
1680 else if (itemTarget)
1681 {
1682 lockId = itemTarget->GetTemplate()->GetLockID();
1683 guid = itemTarget->GetGUID();
1684 }
1685 else
1686 {
1687 TC_LOG_DEBUG("spells", "WORLD: Open Lock - No GameObject/Item Target!");
1688 return;
1689 }
1690
1691 SkillType skillId = SKILL_NONE;
1692 int32 reqSkillValue = 0;
1693 int32 skillValue;
1694
1695 SpellCastResult res = CanOpenLock(*effectInfo, lockId, skillId, reqSkillValue, skillValue);
1696 if (res != SPELL_CAST_OK)
1697 {
1698 SendCastResult(res);
1699 return;
1700 }
1701
1702 if (gameObjTarget)
1703 gameObjTarget->Use(player, true);
1704 else if (itemTarget)
1705 {
1708 }
1709
1710 // not allow use skill grow at item base open
1711 if (!m_CastItem && skillId != SKILL_NONE)
1712 {
1713 // update skill if really known
1714 if (uint32 pureSkillValue = player->GetPureSkillValue(skillId))
1715 {
1716 if (gameObjTarget)
1717 {
1718 // Allow one skill-up until respawned
1719 if (!gameObjTarget->IsInSkillupList(player->GetGUID()))
1720 {
1721 player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue, 1, gameObjTarget);
1723 }
1724 }
1725 else if (itemTarget)
1726 {
1727 // Do one skill-up
1728 player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue);
1729 }
1730 }
1731 }
1733}
1734
1736{
1738 return;
1739
1741 return;
1742
1743 Player* player = m_caster->ToPlayer();
1744
1745 // applied only to using item
1746 if (!m_CastItem)
1747 return;
1748
1749 // ... only to item in own inventory/bank/equip_slot
1750 if (m_CastItem->GetOwnerGUID() != player->GetGUID())
1751 return;
1752
1753 uint32 newitemid = effectInfo->ItemType;
1754 if (!newitemid)
1755 return;
1756
1757 uint16 pos = m_CastItem->GetPos();
1758
1759 Item* pNewItem = Item::CreateItem(newitemid, 1, m_CastItem->GetContext(), player);
1760 if (!pNewItem)
1761 return;
1762
1766
1767 if (*m_CastItem->m_itemData->Durability < *m_CastItem->m_itemData->MaxDurability)
1768 {
1769 double lossPercent = 1 - *m_CastItem->m_itemData->Durability / double(m_CastItem->m_itemData->MaxDurability);
1770 player->DurabilityLoss(pNewItem, lossPercent);
1771 }
1772
1773 if (player->IsInventoryPos(pos))
1774 {
1775 ItemPosCountVec dest;
1776 InventoryResult msg = player->CanStoreItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true);
1777 if (msg == EQUIP_ERR_OK)
1778 {
1779 player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
1780
1781 // prevent crash at access and unexpected charges counting with item update queue corrupt
1783 m_targets.SetItemTarget(nullptr);
1784
1785 m_CastItem = nullptr;
1787 m_castItemEntry = 0;
1788 m_castItemLevel = -1;
1789
1790 player->StoreItem(dest, pNewItem, true);
1791 player->SendNewItem(pNewItem, 1, true, false);
1792 player->ItemAddedQuestCheck(newitemid, 1);
1793 return;
1794 }
1795 }
1796 else if (player->IsBankPos(pos))
1797 {
1798 ItemPosCountVec dest;
1799 if (player->CanBankItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true) == EQUIP_ERR_OK)
1800 {
1801 player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
1802
1803 // prevent crash at access and unexpected charges counting with item update queue corrupt
1805 m_targets.SetItemTarget(nullptr);
1806
1807 m_CastItem = nullptr;
1809 m_castItemEntry = 0;
1810 m_castItemLevel = -1;
1811
1812 player->BankItem(dest, pNewItem, true);
1813 return;
1814 }
1815 }
1816 else if (player->IsEquipmentPos(pos))
1817 {
1818 uint16 dest;
1819
1820 player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
1821
1822 InventoryResult msg = player->CanEquipItem(m_CastItem->GetSlot(), dest, pNewItem, true);
1823
1824 if (msg == EQUIP_ERR_OK || msg == EQUIP_ERR_CLIENT_LOCKED_OUT)
1825 {
1827
1828 // prevent crash at access and unexpected charges counting with item update queue corrupt
1830 m_targets.SetItemTarget(nullptr);
1831
1832 m_CastItem = nullptr;
1834 m_castItemEntry = 0;
1835 m_castItemLevel = -1;
1836
1837 player->EquipItem(dest, pNewItem, true);
1838 player->AutoUnequipOffhandIfNeed();
1839 player->SendNewItem(pNewItem, 1, true, false);
1840 player->ItemAddedQuestCheck(newitemid, 1);
1841 return;
1842 }
1843 }
1844
1845 // fail
1846 delete pNewItem;
1847}
1848
1850{
1852 return;
1853
1855 return;
1856 Player* p_target = m_caster->ToPlayer();
1857
1859 if (m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && !(p_target->GetWeaponProficiency() & subClassMask))
1860 {
1861 p_target->AddWeaponProficiency(subClassMask);
1863 }
1864 if (m_spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR && !(p_target->GetArmorProficiency() & subClassMask))
1865 {
1866 p_target->AddArmorProficiency(subClassMask);
1868 }
1869}
1870
1872{
1874 return;
1875
1876 uint32 entry = effectInfo->MiscValue;
1877 if (!entry)
1878 return;
1879
1880 SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(effectInfo->MiscValueB);
1881 if (!properties)
1882 {
1883 TC_LOG_ERROR("spells", "EffectSummonType: Unhandled summon type {}.", effectInfo->MiscValueB);
1884 return;
1885 }
1886
1887 WorldObject* caster = m_caster;
1888 if (m_originalCaster)
1889 caster = m_originalCaster;
1890
1891 ObjectGuid privateObjectOwner = [&]()
1892 {
1894 return ObjectGuid::Empty;
1895
1896 if (caster->IsPrivateObject())
1897 return caster->GetPrivateObjectOwner();
1898
1900 if (caster->IsPlayer() && m_originalCaster->ToPlayer()->GetGroup())
1901 return caster->ToPlayer()->GetGroup()->GetGUID();
1902
1903 return caster->GetGUID();
1904 }();
1905
1907
1908 Unit* unitCaster = GetUnitCasterForEffectHandlers();
1909
1910 TempSummon* summon = nullptr;
1911
1912 // determine how many units should be summoned
1913 uint32 numSummons;
1914
1915 // some spells need to summon many units, for those spells number of summons is stored in effect value
1916 // however so far noone found a generic check to find all of those (there's no related data in summonproperties.dbc
1917 // and in spell attributes, possibly we need to add a table for those)
1918 // so here's a list of MiscValueB values, which is currently most generic check
1919 switch (effectInfo->MiscValueB)
1920 {
1921 case 64:
1922 case 61:
1923 case 1101:
1924 case 66:
1925 case 648:
1926 case 2301:
1927 case 1061:
1928 case 1261:
1929 case 629:
1930 case 181:
1931 case 715:
1932 case 1562:
1933 case 833:
1934 case 1161:
1935 case 713:
1936 numSummons = std::max(GetEffectValueAsInt(), 1);
1937 break;
1938 default:
1939 numSummons = 1;
1940 break;
1941 }
1942
1943 switch (properties->Control)
1944 {
1947 {
1949 {
1950 SummonGuardian(effectInfo, entry, properties, numSummons, privateObjectOwner);
1951 break;
1952 }
1953
1954 switch (SummonTitle(properties->Title))
1955 {
1956 case SummonTitle::Pet:
1960 SummonGuardian(effectInfo, entry, properties, numSummons, privateObjectOwner);
1961 break;
1962 // Summons a vehicle, but doesn't force anyone to enter it (see SUMMON_CATEGORY_VEHICLE)
1964 case SummonTitle::Mount:
1966 {
1967 if (!unitCaster)
1968 return;
1969
1970 summon = unitCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, unitCaster, m_spellInfo->Id, 0, privateObjectOwner);
1971 break;
1972 }
1973 case SummonTitle::Totem:
1974 {
1975 if (!unitCaster)
1976 return;
1977
1978 summon = unitCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, unitCaster, m_spellInfo->Id, 0, privateObjectOwner);
1979 if (!summon || !summon->IsTotem())
1980 return;
1981
1982 if (int32 health = GetEffectValueAsInt()) // if not spell info, DB values used
1983 {
1984 summon->SetMaxHealth(health);
1985 summon->SetHealth(health);
1986 }
1987 break;
1988 }
1990 {
1991 if (!unitCaster)
1992 return;
1993
1994 summon = unitCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, unitCaster, m_spellInfo->Id, 0, privateObjectOwner);
1995 if (!summon || !summon->HasUnitTypeMask(UNIT_MASK_MINION))
1996 return;
1997
1998 summon->SetImmuneToAll(true);
1999 break;
2000 }
2001 default:
2002 {
2003 SpellRange radius = effectInfo->CalcRadius();
2004
2006 if (duration == 0ms)
2007 summonType = TEMPSUMMON_DEAD_DESPAWN;
2008 else if (duration == -1ms)
2009 summonType = TEMPSUMMON_MANUAL_DESPAWN;
2010 else if (properties->GetFlags().HasFlag(SummonPropertiesFlags::UseDemonTimeout))
2012
2013 for (uint32 count = 0; count < numSummons; ++count)
2014 {
2015 Position pos;
2016 if (count == 0)
2017 pos = destTarget->GetPosition();
2018 else
2019 // randomize position for multiple summons
2020 pos = caster->GetRandomPoint(*destTarget, radius.Max, radius.Min);
2021
2022 summon = caster->GetMap()->SummonCreature(entry, pos, properties, duration, unitCaster, m_spellInfo->Id, 0, privateObjectOwner);
2023 if (!summon)
2024 continue;
2025
2026 summon->SetTempSummonType(summonType);
2027 if (properties->Control == SUMMON_CATEGORY_ALLY)
2028 summon->SetOwnerGUID(caster->GetGUID());
2029 else if (properties->Control == SUMMON_CATEGORY_WILD && caster->IsPlayer()) // there might be more conditions involved
2030 summon->SetDemonCreatorGUID(caster->GetGUID());
2031
2033 }
2034 return;
2035 }
2036 }
2037 break;
2038 }
2040 SummonGuardian(effectInfo, entry, properties, numSummons, privateObjectOwner);
2041 break;
2043 {
2044 if (!unitCaster)
2045 return;
2046
2047 summon = unitCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, unitCaster, m_spellInfo->Id, 0, privateObjectOwner);
2048 break;
2049 }
2052 {
2053 if (!unitCaster)
2054 return;
2055
2056 // Summoning spells (usually triggered by npc_spellclick) that spawn a vehicle and that cause the clicker
2057 // to cast a ride vehicle spell on the summoned unit.
2058 summon = unitCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, unitCaster, m_spellInfo->Id, 0, privateObjectOwner);
2059 if (!summon || !summon->IsVehicle())
2060 return;
2061
2062 // The spell that this effect will trigger. It has SPELL_AURA_CONTROL_VEHICLE
2064 SpellEffectValue basePoints = effectInfo->CalcValue();
2065 if (basePoints > MAX_VEHICLE_SEATS)
2066 {
2067 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(basePoints, GetCastDifficulty());
2068 if (spellInfo && spellInfo->HasAura(SPELL_AURA_CONTROL_VEHICLE))
2069 spellId = spellInfo->Id;
2070 }
2071
2073 args.SetTriggeringSpell(this);
2074
2075 // if we have small value, it indicates seat position
2076 if (basePoints > 0 && basePoints < MAX_VEHICLE_SEATS)
2077 args.AddSpellMod(SPELLVALUE_BASE_POINT0, basePoints);
2078
2079 unitCaster->CastSpell(summon, spellId, args);
2080 break;
2081 }
2082 }
2083
2084 if (summon)
2085 {
2086 summon->SetCreatorGUID(caster->GetGUID());
2088 }
2089}
2090
2092{
2094 return;
2095
2096 if (!unitTarget)
2097 return;
2098
2100 {
2101 if (unitTarget->ToPet())
2103 return;
2104 }
2105
2106 Player* player = unitTarget->ToPlayer();
2107
2109 {
2110 for (ItemEffectEntry const* itemEffect : m_CastItem->GetEffects())
2111 {
2112 if (itemEffect->TriggerType != ITEM_SPELLTRIGGER_ON_LEARN)
2113 continue;
2114
2115 bool dependent = false;
2116
2117 if (BattlePetSpeciesEntry const* speciesEntry = BattlePets::BattlePetMgr::GetBattlePetSpeciesBySpell(uint32(itemEffect->SpellID)))
2118 {
2119 player->GetSession()->GetBattlePetMgr()->AddPet(speciesEntry->ID, BattlePets::BattlePetMgr::SelectPetDisplay(speciesEntry),
2121 // If the spell summons a battle pet, we fake that it has been learned and the battle pet is added
2122 // marking as dependent prevents saving the spell to database (intended)
2123 dependent = true;
2124 }
2125
2126 player->LearnSpell(itemEffect->SpellID, dependent);
2127 }
2128 }
2129
2131 {
2132 player->LearnSpell(effectInfo->TriggerSpell, false);
2133 TC_LOG_DEBUG("spells", "Spell: Player {} has learned spell {} from Npc {}", player->GetGUID().ToString(), effectInfo->TriggerSpell, m_caster->GetGUID().ToString());
2134 }
2135}
2136
2138{
2140 return;
2141
2142 if (!unitTarget)
2143 return;
2144
2145 // Create dispel mask by dispel type
2146 uint32 dispel_type = effectInfo->MiscValue;
2147 uint32 dispelMask = SpellInfo::GetDispelMask(DispelType(dispel_type));
2148
2149 DispelChargesList dispelList;
2151 if (dispelList.empty())
2152 return;
2153
2154 size_t remaining = dispelList.size();
2155
2156 int32 dispelAmount = GetEffectValueAsInt();
2157
2158 // Ok if exist some buffs for dispel try dispel it
2159 DispelChargesList successList;
2160 successList.reserve(dispelAmount);
2161
2163 dispelFailed.CasterGUID = m_caster->GetGUID();
2164 dispelFailed.VictimGUID = unitTarget->GetGUID();
2165 dispelFailed.SpellID = m_spellInfo->Id;
2166
2167 // dispel N = damage buffs (or while exist buffs for dispel)
2168 for (int32 count = 0; count < dispelAmount && remaining > 0;)
2169 {
2170 // Random select buff for dispel
2171 auto itr = dispelList.begin();
2172 std::advance(itr, urand(0, remaining - 1));
2173
2174 if (itr->RollDispel())
2175 {
2176 auto successItr = std::find_if(successList.begin(), successList.end(), [&itr](DispelableAura& dispelAura) -> bool
2177 {
2178 if (dispelAura.GetAura()->GetId() == itr->GetAura()->GetId() && dispelAura.GetAura()->GetCaster() == itr->GetAura()->GetCaster())
2179 return true;
2180
2181 return false;
2182 });
2183
2184 uint8 dispelledCharges = 1;
2185 if (itr->GetAura()->GetSpellInfo()->HasAttribute(SPELL_ATTR1_DISPEL_ALL_STACKS))
2186 dispelledCharges = itr->GetDispelCharges();
2187
2188 if (successItr == successList.end())
2189 successList.emplace_back(itr->GetAura(), 0, dispelledCharges);
2190 else
2191 successItr->IncrementCharges();
2192
2193 if (!itr->DecrementCharge(dispelledCharges))
2194 {
2195 --remaining;
2196 std::swap(*itr, dispelList[remaining]);
2197 }
2198 }
2199 else
2200 {
2201 dispelFailed.FailedSpells.push_back(int32(itr->GetAura()->GetId()));
2202 }
2203 ++count;
2204 }
2205
2206 if (!dispelFailed.FailedSpells.empty())
2207 m_caster->SendMessageToSet(dispelFailed.Write(), true);
2208
2209 if (successList.empty())
2210 return;
2211
2213 spellDispellLog.IsBreak = false; // TODO: use me
2214 spellDispellLog.IsSteal = false;
2215
2216 spellDispellLog.TargetGUID = unitTarget->GetGUID();
2217 spellDispellLog.CasterGUID = m_caster->GetGUID();
2218 spellDispellLog.DispelledBySpellID = m_spellInfo->Id;
2219
2220 for (DispelableAura const& dispelableAura : successList)
2221 {
2223 dispellData.SpellID = dispelableAura.GetAura()->GetId();
2224 dispellData.Harmful = false; // TODO: use me
2225
2226 unitTarget->RemoveAurasDueToSpellByDispel(dispelableAura.GetAura()->GetId(), m_spellInfo->Id, dispelableAura.GetAura()->GetCasterGUID(), m_caster, dispelableAura.GetDispelCharges());
2227
2228 spellDispellLog.DispellData.emplace_back(dispellData);
2229 }
2230
2231 m_caster->SendMessageToSet(spellDispellLog.Write(), true);
2232
2234
2236 PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_PHASE_HIT, PROC_HIT_NONE, nullptr, nullptr, nullptr);
2237
2238 std::ranges::find(m_UniqueTargetInfo, unitTarget->GetGUID(), &TargetInfo::TargetGUID)->ProcHitMask |= PROC_HIT_DISPEL;
2239}
2240
2242{
2244 return;
2245
2247}
2248
2250{
2252 return;
2253
2254 // Check for possible target
2255 if (!unitTarget || unitTarget->IsEngaged())
2256 return;
2257
2258 // target must be OK to do this
2260 return;
2261
2263}
2264
2266{
2268 return;
2269
2270 Player* player = m_caster->ToPlayer();
2272 return;
2273
2275 if (!creature)
2276 return;
2277
2278 if (creature->CanGeneratePickPocketLoot())
2279 {
2280 creature->StartPickPocketRefillTimer();
2281
2282 creature->m_loot.reset(new Loot(creature->GetMap(), creature->GetGUID(), LOOT_PICKPOCKETING, nullptr));
2283 if (uint32 lootid = creature->GetCreatureDifficulty()->PickPocketLootID)
2284 creature->m_loot->FillLoot(lootid, LootTemplates_Pickpocketing, player, true);
2285
2286 // Generate extra money for pick pocket loot
2287 const uint32 a = urand(0, creature->GetLevel() / 2);
2288 const uint32 b = urand(0, player->GetLevel() / 2);
2289 creature->m_loot->gold = uint32(10 * (a + b) * sWorld->getRate(RATE_DROP_MONEY));
2290 }
2291 else if (creature->m_loot)
2292 {
2293 if (creature->m_loot->loot_type == LOOT_PICKPOCKETING && creature->m_loot->isLooted())
2294 player->SendLootError(creature->m_loot->GetGUID(), creature->GetGUID(), LOOT_ERROR_ALREADY_PICKPOCKETED);
2295
2296 return;
2297 }
2298
2299 player->SendLoot(*creature->m_loot);
2300}
2301
2303{
2305 return;
2306
2307 Player* player = m_caster->ToPlayer();
2308 if (!player)
2309 return;
2310
2311 float radius = effectInfo->CalcRadius().Max;
2313 // Caster not in world, might be spell triggered from aura removal
2314 if (!player->IsInWorld())
2315 return;
2316
2317 DynamicObject* dynObj = new DynamicObject(true);
2319 {
2320 delete dynObj;
2321 return;
2322 }
2323
2324 dynObj->SetDuration(duration);
2325 dynObj->SetCasterViewpoint();
2326}
2327
2329{
2331 return;
2332
2333 if (!unitTarget->IsPlayer())
2334 return;
2335
2336 Player* playerTarget = unitTarget->ToPlayer();
2338}
2339
2341{
2343 return;
2344
2345 if (!unitTarget)
2346 return;
2347
2348 if (unitTarget->IsInFlight())
2349 return;
2350
2351 if (!m_targets.HasDst())
2352 return;
2353
2354 TeleportLocation targetDest{ .Location = *destTarget };
2355 if (ObjectGuid transportGuid = m_destTargets[effectInfo->EffectIndex]._transportGUID; !transportGuid.IsEmpty())
2356 {
2357 targetDest.TransportGuid = transportGuid;
2359 targetDest.Location.SetOrientation(destTarget->GetAbsoluteAngle(m_caster) - targetDest.Location.GetOrientation());
2360 }
2361 else
2362 targetDest.Location.SetOrientation(destTarget->GetAbsoluteAngle(m_caster));
2363
2365}
2366
2368{
2370 return;
2371
2372 Player* playerTarget = Object::ToPlayer(unitTarget);
2373 if (!playerTarget)
2374 return;
2375
2376 uint16 skillTier = GetEffectValueAsInt();
2377 if (skillTier < 1)
2378 return;
2379
2380 uint32 skillid = effectInfo->MiscValue;
2381 SkillRaceClassInfoEntry const* rcEntry = sDB2Manager.GetSkillRaceClassInfo(skillid, playerTarget->GetRace(), playerTarget->GetClass());
2382 if (!rcEntry)
2383 return;
2384
2385 SkillTiersEntry const* tier = sObjectMgr->GetSkillTier(rcEntry->SkillTierID);
2386 if (!tier)
2387 return;
2388
2389 uint16 skillval = std::max<uint16>(1, playerTarget->GetPureSkillValue(skillid));
2390 uint16 maxSkillVal = tier->GetValueForTierIndex(skillTier - 1);
2391
2392 if (rcEntry->Flags & SKILL_FLAG_ALWAYS_MAX_VALUE)
2393 skillval = maxSkillVal;
2394
2395 playerTarget->SetSkill(skillid, skillTier, skillval, maxSkillVal);
2396}
2397
2399{
2401 return;
2402
2404 return;
2405
2406 uint32 movieId = effectInfo->MiscValue;
2407 if (!sMovieStore.LookupEntry(movieId))
2408 return;
2409
2410 unitTarget->ToPlayer()->SendMovieStart(movieId);
2411}
2412
2414{
2416 return;
2417
2419 return;
2420 // uint32 skillid = m_spellInfo->Effects[i].MiscValue;
2421 // uint16 skillmax = unitTarget->ToPlayer()->(skillid);
2422 // m_caster->ToPlayer()->SetSkill(skillid, skillval?skillval:1, skillmax+75);
2423}
2424
2426{
2428 return;
2429
2430 if (!itemTarget)
2431 return;
2432
2433 Player* player = m_caster->ToPlayer();
2434 if (!player)
2435 return;
2436
2437 // Handle vellums
2438 if (itemTarget->IsVellum())
2439 {
2440 // destroy one vellum from stack
2441 uint32 count = 1;
2442 player->DestroyItemCount(itemTarget, count, true);
2443 unitTarget = player;
2444 // and add a scroll
2445 effectValue = 1.0;
2447 itemTarget = nullptr;
2448 m_targets.SetItemTarget(nullptr);
2449 }
2450 else
2451 {
2452 // do not increase skill if vellum used
2453 if (!m_CastItem)
2455
2456 uint32 enchant_id = effectInfo->MiscValue;
2457 if (!enchant_id)
2458 return;
2459
2460 SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
2461 if (!pEnchant)
2462 return;
2463
2464 // item can be in trade slot and have owner diff. from caster
2465 Player* item_owner = itemTarget->GetOwner();
2466 if (!item_owner)
2467 return;
2468
2469 if (item_owner != player && player->GetSession()->HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE))
2470 {
2471 sLog->OutCommand(player->GetSession()->GetAccountId(), "GM {} (Account: {}) enchanting(perm): {} (Entry: {}) for player: {} (Account: {})",
2472 player->GetName(), player->GetSession()->GetAccountId(),
2474 item_owner->GetName(), item_owner->GetSession()->GetAccountId());
2475 }
2476
2477 // remove old enchanting before applying new if equipped
2479
2481
2482 // add new enchanting if equipped
2484
2485 item_owner->RemoveTradeableItem(itemTarget);
2487 }
2488}
2489
2491{
2493 return;
2494
2495 if (!itemTarget)
2496 return;
2497
2498 Player* player = m_caster->ToPlayer();
2499 if (!player)
2500 return;
2501
2502 uint32 enchantId = effectInfo->MiscValue;
2503 if (!enchantId)
2504 return;
2505
2506 SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(enchantId);
2507 if (!enchant)
2508 return;
2509
2510 // support only enchantings with add socket in this slot
2511 {
2512 bool add_socket = false;
2513 for (uint8 i = 0; i < MAX_ITEM_ENCHANTMENT_EFFECTS; ++i)
2514 {
2516 {
2517 add_socket = true;
2518 break;
2519 }
2520 }
2521 if (!add_socket)
2522 {
2523 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.",
2525 return;
2526 }
2527 }
2528
2529 // item can be in trade slot and have owner diff. from caster
2530 Player* item_owner = itemTarget->GetOwner();
2531 if (!item_owner)
2532 return;
2533
2534 if (item_owner != player && player->GetSession()->HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE))
2535 {
2536 sLog->OutCommand(player->GetSession()->GetAccountId(), "GM {} (Account: {}) enchanting(perm): {} (Entry: {}) for player: {} (Account: {})",
2537 player->GetName(), player->GetSession()->GetAccountId(),
2539 item_owner->GetName(), item_owner->GetSession()->GetAccountId());
2540 }
2541
2542 // remove old enchanting before applying new if equipped
2544
2546
2547 // add new enchanting if equipped
2549
2550 item_owner->RemoveTradeableItem(itemTarget);
2552}
2553
2555{
2557 return;
2558
2559 if (!itemTarget)
2560 return;
2561
2562 Player* player = m_caster->ToPlayer();
2563 if (!player)
2564 return;
2565
2566 uint32 enchant_id = effectInfo->MiscValue;
2567
2568 if (!enchant_id)
2569 {
2570 TC_LOG_ERROR("spells", "Spell {} Effect {} (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) has enchanting id 0.", m_spellInfo->Id, effectInfo->EffectIndex);
2571 return;
2572 }
2573
2574 SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
2575 if (!pEnchant)
2576 {
2577 TC_LOG_ERROR("spells", "Spell {} Effect {} (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) has a non-existing enchanting id {} ", m_spellInfo->Id, effectInfo->EffectIndex, enchant_id);
2578 return;
2579 }
2580
2581 // select enchantment duration
2582 uint32 duration = pEnchant->Duration;
2583
2584 // item can be in trade slot and have owner diff. from caster
2585 Player* item_owner = itemTarget->GetOwner();
2586 if (!item_owner)
2587 return;
2588
2589 if (item_owner != player && player->GetSession()->HasPermission(rbac::RBAC_PERM_LOG_GM_TRADE))
2590 {
2591 sLog->OutCommand(player->GetSession()->GetAccountId(), "GM {} (Account: {}) enchanting(temp): {} (Entry: {}) for player: {} (Account: {})",
2592 player->GetName(), player->GetSession()->GetAccountId(),
2594 item_owner->GetName(), item_owner->GetSession()->GetAccountId());
2595 }
2596
2597 // remove old enchanting before applying new if equipped
2599
2600 itemTarget->SetEnchantment(TEMP_ENCHANTMENT_SLOT, enchant_id, duration * 1000, 0, m_caster->GetGUID());
2601
2602 // add new enchanting if equipped
2604}
2605
2607{
2609 return;
2610
2611 Unit* unitCaster = GetUnitCasterForEffectHandlers();
2612 if (!unitCaster || !unitCaster->GetPetGUID().IsEmpty())
2613 return;
2614
2615 if (!unitTarget)
2616 return;
2617
2619 return;
2620
2621 Creature* creatureTarget = unitTarget->ToCreature();
2622
2623 if (creatureTarget->IsPet())
2624 return;
2625
2626 if (unitCaster->GetClass() != CLASS_HUNTER)
2627 return;
2628
2629 // cast finish successfully
2630 //SendChannelUpdate(0);
2631 finish();
2632
2633 Pet* pet = unitCaster->CreateTamedPetFrom(creatureTarget, m_spellInfo->Id);
2634 if (!pet) // in very specific state like near world end/etc.
2635 return;
2636
2637 // "kill" original creature
2638 creatureTarget->DespawnOrUnsummon();
2639
2640 // add to world
2641 pet->GetMap()->AddToMap(pet->ToCreature());
2642
2643 // visual effect for levelup
2644 pet->SendNewlyTamed();
2645
2646 // caster have pet now
2647 unitCaster->SetMinion(pet, true);
2648
2649 if (unitCaster->GetTypeId() == TYPEID_PLAYER)
2650 {
2652 unitCaster->ToPlayer()->PetSpellInitialize();
2653 }
2654}
2655
2657{
2659 return;
2660
2661 Player* owner = nullptr;
2662 if (Unit* unitCaster = GetUnitCasterForEffectHandlers())
2663 {
2664 owner = unitCaster->ToPlayer();
2665 if (!owner && unitCaster->IsTotem())
2666 owner = unitCaster->GetCharmerOrOwnerPlayerOrPlayerItself();
2667 }
2668
2669 uint32 petentry = effectInfo->MiscValue;
2670
2671 if (!owner)
2672 {
2673 SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(67);
2674 if (properties)
2675 SummonGuardian(effectInfo, petentry, properties, 1, ObjectGuid::Empty);
2676 return;
2677 }
2678
2679 Pet* OldSummon = owner->GetPet();
2680
2681 // if pet requested type already exist
2682 if (OldSummon)
2683 {
2684 if (petentry == 0 || OldSummon->GetEntry() == petentry)
2685 {
2686 // pet in corpse state can't be summoned
2687 if (OldSummon->isDead())
2688 return;
2689
2690 ASSERT(OldSummon->GetMap() == owner->GetMap());
2691
2692 //OldSummon->GetMap()->Remove(OldSummon->ToCreature(), false);
2693
2694 float px, py, pz;
2695 owner->GetClosePoint(px, py, pz, OldSummon->GetCombatReach());
2696
2697 OldSummon->NearTeleportTo(px, py, pz, OldSummon->GetOrientation());
2698 //OldSummon->Relocate(px, py, pz, OldSummon->GetOrientation());
2699 //OldSummon->SetMap(owner->GetMap());
2700 //owner->GetMap()->Add(OldSummon->ToCreature());
2701
2702 if (owner->GetTypeId() == TYPEID_PLAYER && OldSummon->isControlled())
2703 owner->ToPlayer()->PetSpellInitialize();
2704
2705 return;
2706 }
2707
2708 if (owner->GetTypeId() == TYPEID_PLAYER)
2709 owner->ToPlayer()->RemovePet(OldSummon, PET_SAVE_NOT_IN_SLOT, false);
2710 else
2711 return;
2712 }
2713
2714 Optional<PetSaveMode> petSlot;
2715 if (!petentry)
2716 petSlot = PetSaveMode(GetEffectValueAsInt());
2717
2718 float x, y, z;
2719 owner->GetClosePoint(x, y, z, owner->GetCombatReach());
2720 bool isNew = false;
2721 Pet* pet = owner->SummonPet(petentry, petSlot, x, y, z, owner->GetOrientation(), 0, &isNew);
2722 if (!pet)
2723 return;
2724
2725 if (isNew)
2726 {
2727 if (m_caster->GetTypeId() == TYPEID_UNIT)
2728 {
2729 if (m_caster->ToCreature()->IsTotem())
2731 else
2733 }
2734
2736
2737 // generate new name for summon pet
2738 std::string new_name = sObjectMgr->GeneratePetName(petentry);
2739 if (!new_name.empty())
2740 pet->SetName(new_name);
2741 }
2742
2744}
2745
2747{
2749 return;
2750
2751 if (!unitTarget)
2752 return;
2753
2754 if (unitTarget->ToPlayer())
2755 {
2757 return;
2758 }
2759 Pet* pet = unitTarget->ToPet();
2760 if (!pet)
2761 return;
2762
2763 SpellInfo const* learn_spellproto = sSpellMgr->GetSpellInfo(effectInfo->TriggerSpell, DIFFICULTY_NONE);
2764 if (!learn_spellproto)
2765 return;
2766
2767 pet->learnSpell(learn_spellproto->Id);
2769 pet->GetOwner()->PetSpellInitialize();
2770}
2771
2773{
2775 return;
2776
2777 Unit* unitCaster = GetUnitCasterForEffectHandlers();
2778 if (!unitCaster)
2779 return;
2780
2781 // this effect use before aura Taunt apply for prevent taunt already attacking target
2782 // for spell as marked "non effective at already attacking target"
2783 if (!unitTarget || unitTarget->IsTotem())
2784 {
2786 return;
2787 }
2788
2789 // Hand of Reckoning can hit some entities that can't have a threat list (including players' pets)
2790 if (m_spellInfo->Id == 62124)
2791 if (unitTarget->GetTypeId() != TYPEID_PLAYER && unitTarget->GetTarget() != unitCaster->GetGUID())
2792 unitCaster->CastSpell(unitTarget, 67485, true);
2793
2795 {
2797 return;
2798 }
2799
2801 if (mgr.GetCurrentVictim() == unitCaster)
2802 {
2804 return;
2805 }
2806
2807 if (!mgr.IsThreatListEmpty())
2808 // Set threat equal to highest threat currently on target
2809 mgr.MatchUnitThreatToHighestThreat(unitCaster);
2810}
2811
2813{
2815 return;
2816
2817 Unit* unitCaster = GetUnitCasterForEffectHandlers();
2818 if (!unitCaster)
2819 return;
2820
2821 if (!unitTarget || !unitTarget->IsAlive())
2822 return;
2823
2824 // multiple weapon dmg effect workaround
2825 // execute only the last weapon damage
2826 // and handle all effects at once
2827 uint32 effectMask = std::ranges::find(m_UniqueTargetInfo, unitTarget->GetGUID(), &TargetInfo::TargetGUID)->EffectMask;
2828 for (size_t j = effectInfo->EffectIndex + 1; j < m_spellInfo->GetEffects().size(); ++j)
2829 {
2830 if (!(effectMask & (1 << j)))
2831 continue;
2832
2834 {
2839 return; // we must calculate only at last weapon effect
2840 default:
2841 break;
2842 }
2843 }
2844
2845 // some spell specific modifiers
2846 float totalDamagePercentMod = 1.0f; // applied to final bonus+weapon damage
2847 SpellEffectValue fixed_bonus = 0;
2848 SpellEffectValue spell_bonus = 0; // bonus specific for spell
2849
2851 {
2852 case SPELLFAMILY_SHAMAN:
2853 {
2854 // Skyshatter Harness item set bonus
2855 // Stormstrike
2856 if (AuraEffect* aurEff = unitCaster->IsScriptOverriden(m_spellInfo, 5634))
2857 unitCaster->CastSpell(nullptr, 38430, aurEff);
2858 break;
2859 }
2860 }
2861
2862 bool normalized = false;
2863 float weaponDamagePercentMod = 1.0f;
2864 for (SpellEffectInfo const& spellEffectInfo : m_spellInfo->GetEffects())
2865 {
2866 if (!(effectMask & (1 << spellEffectInfo.EffectIndex)))
2867 continue;
2868
2869 switch (spellEffectInfo.Effect)
2870 {
2873 fixed_bonus += CalculateDamage(spellEffectInfo, unitTarget);
2874 break;
2876 fixed_bonus += CalculateDamage(spellEffectInfo, unitTarget);
2877 normalized = true;
2878 break;
2880 ApplyPct(weaponDamagePercentMod, CalculateDamage(spellEffectInfo, unitTarget));
2881 break;
2882 default:
2883 break; // not weapon damage effect, just skip
2884 }
2885 }
2886
2887 // if (addPctMods) { percent mods are added in Unit::CalculateDamage } else { percent mods are added in Unit::MeleeDamageBonusDone }
2888 // this distinction is neccessary to properly inform the client about his autoattack damage values from Script_UnitDamage
2890 if (addPctMods)
2891 {
2892 UnitMods unitMod;
2893 switch (m_attackType)
2894 {
2895 default:
2896 case BASE_ATTACK: unitMod = UNIT_MOD_DAMAGE_MAINHAND; break;
2897 case OFF_ATTACK: unitMod = UNIT_MOD_DAMAGE_OFFHAND; break;
2898 case RANGED_ATTACK: unitMod = UNIT_MOD_DAMAGE_RANGED; break;
2899 }
2900
2901 float weapon_total_pct = unitCaster->GetPctModifierValue(unitMod, TOTAL_PCT);
2902 if (fixed_bonus)
2903 fixed_bonus = fixed_bonus * weapon_total_pct;
2904 if (spell_bonus)
2905 spell_bonus = spell_bonus * weapon_total_pct;
2906 }
2907
2908 SpellEffectValue weaponDamage = unitCaster->CalculateDamage(m_attackType, normalized, addPctMods);
2909 Mechanics mechanic = MECHANIC_NONE;
2910
2911 // Sequence is important
2912 for (SpellEffectInfo const& spellEffectInfo : m_spellInfo->GetEffects())
2913 {
2914 if (!(effectMask & (1 << spellEffectInfo.EffectIndex)))
2915 continue;
2916
2917 // We assume that a spell have at most one fixed_bonus
2918 // and at most one weaponDamagePercentMod
2919 switch (spellEffectInfo.Effect)
2920 {
2924 weaponDamage += fixed_bonus;
2925 break;
2927 weaponDamage = weaponDamage * weaponDamagePercentMod;
2928 break;
2929 default:
2930 continue; // not weapon damage effect, just skip
2931 }
2932
2933 if (spellEffectInfo.Mechanic != MECHANIC_NONE && mechanic == MECHANIC_NONE)
2934 mechanic = spellEffectInfo.Mechanic;
2935 }
2936
2937 weaponDamage += spell_bonus;
2938 weaponDamage = weaponDamage * totalDamagePercentMod;
2939
2940 // prevent negative damage
2941 weaponDamage = std::max(std::round(weaponDamage), 0.0);
2942
2943 // Add melee damage bonuses (also check for negative)
2944 weaponDamage = unitCaster->MeleeDamageBonusDone(unitTarget, weaponDamage, m_attackType, SPELL_DIRECT_DAMAGE, m_spellInfo, effectInfo, mechanic, m_spellSchoolMask, this);
2946}
2947
2949{
2951 return;
2952
2953 Unit* unitCaster = GetUnitCasterForEffectHandlers();
2954 if (!unitCaster || !unitCaster->IsAlive())
2955 return;
2956
2957 if (!unitTarget)
2958 return;
2959
2961 return;
2962
2964}
2965
2967{
2969 return;
2970
2971 Unit* unitCaster = GetUnitCasterForEffectHandlers();
2972 if (!unitCaster)
2973 return;
2974
2975 if (!unitTarget || !unitTarget->IsAlive())
2976 return;
2977
2978 int32 addhealth = 0;
2979
2980 // damage == 0 - heal for caster max health
2981 if (GetEffectValueAsInt() == 0)
2982 addhealth = unitCaster->GetMaxHealth();
2983 else
2984 addhealth = unitTarget->GetMaxHealth() - unitTarget->GetHealth();
2985
2986 m_healing += addhealth;
2987}
2988
2990{
2992 return;
2993
2994 if (!unitTarget || !unitTarget->IsAlive())
2995 return;
2996
2998 // also exist case: apply cooldown to interrupted cast only and to all spells
2999 // there is no CURRENT_AUTOREPEAT_SPELL spells that can be interrupted
3001 {
3003 {
3004 SpellInfo const* curSpellInfo = spell->m_spellInfo;
3005 // check if we can interrupt spell
3006 if ((spell->getState() == SPELL_STATE_CHANNELING
3007 || (spell->getState() == SPELL_STATE_PREPARING && spell->GetCastTime() > 0.0f))
3008 && curSpellInfo->CanBeInterrupted(m_caster, unitTarget))
3009 {
3010 int32 duration = m_spellInfo->GetDuration();
3011 duration = unitTarget->ModSpellDuration(m_spellInfo, unitTarget, duration, false, 1 << effectInfo->EffectIndex);
3013 std::ranges::find(m_UniqueTargetInfo, unitTarget->GetGUID(), &TargetInfo::TargetGUID)->ProcHitMask |= PROC_HIT_INTERRUPT;
3014 SendSpellInterruptLog(unitTarget, curSpellInfo->Id);
3016 }
3017 }
3018 }
3019}
3020
3022{
3024 return;
3025
3026 WorldObject* target = focusObject;
3027 if (!target)
3028 target = m_caster;
3029
3030 float x, y, z, o;
3031 if (m_targets.HasDst())
3032 destTarget->GetPosition(x, y, z, o);
3033 else
3034 {
3036 o = target->GetOrientation();
3037 }
3038
3039 Map* map = target->GetMap();
3040 Position pos = Position(x, y, z, o);
3043 if (!go)
3044 return;
3045
3047
3049
3050 go->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
3052
3054
3055 // Wild object not have owner and check clickable by players
3056 map->AddToMap(go);
3057
3058 if (GameObject* linkedTrap = go->GetLinkedTrap())
3059 {
3061
3062 linkedTrap->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
3063 linkedTrap->SetSpellId(m_spellInfo->Id);
3064
3066 }
3067}
3068
3070{
3072 return;
3073
3074 Unit* unitCaster = GetUnitCasterForEffectHandlers();
3075
3079 {
3081 {
3082 switch (m_spellInfo->Id)
3083 {
3084 // Shadow Flame (All script effects, not just end ones to prevent player from dodging the last triggered spell)
3085 case 22539:
3086 case 22972:
3087 case 22975:
3088 case 22976:
3089 case 22977:
3090 case 22978:
3091 case 22979:
3092 case 22980:
3093 case 22981:
3094 case 22982:
3095 case 22983:
3096 case 22984:
3097 case 22985:
3098 {
3099 if (!unitTarget || !unitTarget->IsAlive())
3100 return;
3101
3102 // Onyxia Scale Cloak
3103 if (unitTarget->HasAura(22683))
3104 return;
3105
3106 // Shadow Flame
3107 m_caster->CastSpell(unitTarget, 22682, this);
3108 return;
3109 }
3110 // Mug Transformation
3111 case 41931:
3112 {
3114 return;
3115
3116 uint8 bag = 19;
3117 uint8 slot = 0;
3118 Item* item = nullptr;
3119
3120 while (bag) // 256 = 0 due to var type
3121 {
3122 item = m_caster->ToPlayer()->GetItemByPos(bag, slot);
3123 if (item && item->GetEntry() == 38587)
3124 break;
3125
3126 ++slot;
3127 if (slot == 39)
3128 {
3129 slot = 0;
3130 ++bag;
3131 }
3132 }
3133 if (bag)
3134 {
3135 if (m_caster->ToPlayer()->GetItemByPos(bag, slot)->GetCount() == 1) m_caster->ToPlayer()->RemoveItem(bag, slot, true);
3136 else m_caster->ToPlayer()->GetItemByPos(bag, slot)->SetCount(m_caster->ToPlayer()->GetItemByPos(bag, slot)->GetCount()-1);
3137 // Spell 42518 (Braufest - Gratisprobe des Braufest herstellen)
3138 m_caster->CastSpell(m_caster, 42518, this);
3139 return;
3140 }
3141 break;
3142 }
3143 // Brutallus - Burn
3144 case 45141:
3145 case 45151:
3146 {
3147 //Workaround for Range ... should be global for every ScriptEffect
3148 float radius = effectInfo->CalcRadius(nullptr, SpellTargetIndex::TargetB).Max;
3150 unitTarget->CastSpell(unitTarget, 46394, this);
3151
3152 break;
3153 }
3154 // Summon Ghouls On Scarlet Crusade
3155 case 51904:
3156 {
3157 if (!m_targets.HasDst())
3158 return;
3159
3160 SpellRange radius = effectInfo->CalcRadius();
3161 for (uint8 i = 0; i < 15; ++i)
3162 m_caster->CastSpell(m_caster->GetRandomPoint(*destTarget, radius.Max, radius.Min), 54522, this);
3163 break;
3164 }
3165 case 52173: // Coyote Spirit Despawn
3166 case 60243: // Blood Parrot Despawn
3169 return;
3170 case 57347: // Retrieving (Wintergrasp RP-GG pickup spell)
3171 {
3173 return;
3174
3176
3177 return;
3178 }
3179 case 57349: // Drop RP-GG (Wintergrasp RP-GG at death drop spell)
3180 {
3182 return;
3183
3184 // Delete item from inventory at death
3186
3187 return;
3188 }
3189 case 62482: // Grab Crate
3190 {
3191 if (!unitCaster)
3192 return;
3193
3194 if (unitTarget)
3195 {
3196 if (Unit* seat = unitCaster->GetVehicleBase())
3197 {
3198 if (Unit* parent = seat->GetVehicleBase())
3199 {
3201 unitCaster->CastSpell(parent, 62496, this);
3203 .SetTriggeringSpell(this)); // DIFFICULTY_NONE, so effect always valid
3204 }
3205 }
3206 }
3207 return;
3208 }
3209 }
3210 break;
3211 }
3212 }
3213}
3214
3216{
3218 return;
3219
3220 if (!unitTarget)
3221 return;
3222
3223 auto isAffectedBySanctuary = [](Unit const* attacker)
3224 {
3225 Creature const* attackerCreature = attacker->ToCreature();
3226 return !attackerCreature || !attackerCreature->IsIgnoringSanctuarySpellEffect();
3227 };
3228
3230 {
3231 // stop all pve combat for players outside dungeons, suppress pvp combat
3232 unitTarget->CombatStop(false, false, isAffectedBySanctuary);
3233 }
3234 else
3235 {
3236 // in dungeons (or for nonplayers), reset this unit on all enemies' threat lists
3237 for (auto const& [guid, ref] : unitTarget->GetThreatManager().GetThreatenedByMeList())
3238 if (isAffectedBySanctuary(ref->GetOwner()))
3239 ref->ScaleThreat(0.0f);
3240 }
3241
3242 // makes spells cast before this time fizzle
3244}
3245
3247{
3249 return;
3250
3252 return;
3253
3254 Player* caster = m_caster->ToPlayer();
3255 Player* target = unitTarget->ToPlayer();
3256
3257 // caster or target already have requested duel
3258 if (caster->duel || target->duel || !target->GetSocial() || target->GetSocial()->HasIgnore(caster->GetGUID(), caster->GetSession()->GetAccountGUID()))
3259 return;
3260
3261 // Players can only fight a duel in zones with this flag
3262 AreaTableEntry const* casterAreaEntry = sAreaTableStore.LookupEntry(caster->GetAreaId());
3263 if (casterAreaEntry && !(casterAreaEntry->GetFlags().HasFlag(AreaFlags::AllowDueling)))
3264 {
3265 SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here
3266 return;
3267 }
3268
3269 AreaTableEntry const* targetAreaEntry = sAreaTableStore.LookupEntry(target->GetAreaId());
3270 if (targetAreaEntry && !(targetAreaEntry->GetFlags().HasFlag(AreaFlags::AllowDueling)))
3271 {
3272 SendCastResult(SPELL_FAILED_NO_DUELING); // Dueling isn't allowed here
3273 return;
3274 }
3275
3276 //CREATE DUEL FLAG OBJECT
3277 Map* map = caster->GetMap();
3278 Position const pos =
3279 {
3280 caster->GetPositionX() + (unitTarget->GetPositionX() - caster->GetPositionX()) / 2,
3281 caster->GetPositionY() + (unitTarget->GetPositionY() - caster->GetPositionY()) / 2,
3282 caster->GetPositionZ(),
3283 caster->GetOrientation()
3284 };
3286
3288 if (!go)
3289 return;
3290
3292
3293 go->SetFaction(caster->GetFaction());
3294 go->SetLevel(caster->GetLevel() + 1);
3295 int32 duration = m_spellInfo->CalcDuration(caster);
3296 go->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
3298
3300
3301 caster->AddGameObject(go);
3302 map->AddToMap(go);
3303 //END
3304
3305 // Send request
3307 packet.ArbiterGUID = go->GetGUID();
3308 packet.RequestedByGUID = caster->GetGUID();
3309 packet.RequestedByWowAccount = caster->GetSession()->GetAccountGUID();
3310
3311 WorldPacket const* worldPacket = packet.Write();
3312 caster->SendDirectMessage(worldPacket);
3313 target->SendDirectMessage(worldPacket);
3314
3315 // create duel-info
3316 bool isMounted = (GetSpellInfo()->Id == 62875);
3317 caster->duel = std::make_unique<DuelInfo>(target, caster, isMounted);
3318 target->duel = std::make_unique<DuelInfo>(caster, caster, isMounted);
3319
3320 caster->SetDuelArbiter(go->GetGUID());
3321 target->SetDuelArbiter(go->GetGUID());
3322
3323 sScriptMgr->OnPlayerDuelRequest(target, caster);
3324}
3325
3327{
3329 return;
3330
3331 if (!sWorld->getBoolConfig(CONFIG_CAST_UNSTUCK))
3332 return;
3333
3334 Player* player = m_caster->ToPlayer();
3335 if (!player)
3336 return;
3337
3338 TC_LOG_DEBUG("spells", "Spell Effect: Stuck");
3339 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());
3340
3341 if (player->IsInFlight())
3342 return;
3343
3344 // if player is dead without death timer is teleported to graveyard, otherwise not apply the effect
3345 if (player->isDead())
3346 {
3347 if (!player->GetDeathTimer())
3348 player->RepopAtGraveyard();
3349
3350 return;
3351 }
3352
3353 // the player dies if hearthstone is in cooldown, else the player is teleported to home
3354 if (player->GetSpellHistory()->HasCooldown(8690))
3355 {
3356 player->KillSelf();
3357 return;
3358 }
3359
3360 player->TeleportTo(player->m_homebind, TELE_TO_SPELL);
3361
3362 // Stuck spell trigger Hearthstone cooldown
3363 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(8690, GetCastDifficulty());
3364 if (!spellInfo)
3365 return;
3366 Spell spell(player, spellInfo, TRIGGERED_FULL_MASK);
3367 spell.SendSpellCooldown();
3368}
3369
3371{
3372 // workaround - this effect should not use target map
3374 return;
3375
3376 Unit* unitCaster = GetUnitCasterForEffectHandlers();
3377 if (!unitCaster)
3378 return;
3379
3381 return;
3382
3384}
3385
3398
3400{
3402 return;
3403
3404 Player* player = m_caster->ToPlayer();
3405 if (!player)
3406 return;
3407
3408 std::vector<uint32>& glyphs = player->GetGlyphs(player->GetActiveTalentGroup());
3409 std::size_t replacedGlyph = glyphs.size();
3410 for (std::size_t i = 0; i < glyphs.size(); ++i)
3411 {
3412 if (std::vector<uint32> const* activeGlyphBindableSpells = sDB2Manager.GetGlyphBindableSpells(glyphs[i]))
3413 {
3414 if (std::find(activeGlyphBindableSpells->begin(), activeGlyphBindableSpells->end(), m_misc.SpellId) != activeGlyphBindableSpells->end())
3415 {
3416 replacedGlyph = i;
3417 player->RemoveAurasDueToSpell(sGlyphPropertiesStore.AssertEntry(glyphs[i])->SpellID);
3418 break;
3419 }
3420 }
3421 }
3422
3423 uint32 glyphId = effectInfo->MiscValue;
3424 if (replacedGlyph < glyphs.size())
3425 {
3426 if (glyphId)
3427 glyphs[replacedGlyph] = glyphId;
3428 else
3429 glyphs.erase(glyphs.begin() + replacedGlyph);
3430 }
3431 else if (glyphId)
3432 glyphs.push_back(glyphId);
3433
3435
3436 if (GlyphPropertiesEntry const* glyphProperties = sGlyphPropertiesStore.LookupEntry(glyphId))
3437 player->CastSpell(player, glyphProperties->SpellID, this);
3438
3440 activeGlyphs.Glyphs.emplace_back(m_misc.SpellId, uint16(glyphId));
3441 activeGlyphs.IsFullUpdate = false;
3442 player->SendDirectMessage(activeGlyphs.Write());
3443}
3444
3446{
3448 return;
3449
3450 // this is only item spell effect applied to main-hand weapon of target player (players in area)
3452 return;
3453
3454 Player* item_owner = unitTarget->ToPlayer();
3456
3457 if (!item)
3458 return;
3459
3460 // must be equipped
3461 if (!item->IsEquipped())
3462 return;
3463
3464 if (effectInfo->MiscValue)
3465 {
3466 uint32 enchant_id = effectInfo->MiscValue;
3467 int32 duration = m_spellInfo->GetDuration(); //Try duration index first ..
3468 if (!duration)
3469 duration = GetEffectValueAsInt();//+1; //Base points after ..
3470 if (!duration)
3471 duration = 10 * IN_MILLISECONDS; //10 seconds for enchants which don't have listed duration
3472
3473 if (m_spellInfo->Id == 14792) // Venomhide Poison
3474 duration = 5 * MINUTE * IN_MILLISECONDS;
3475
3476 SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
3477 if (!pEnchant)
3478 return;
3479
3480 // Always go to temp enchantment slot
3482
3483 // Enchantment will not be applied if a different one already exists
3484 if (item->GetEnchantmentId(slot) && item->GetEnchantmentId(slot) != enchant_id)
3485 return;
3486
3487 // Apply the temporary enchantment
3488 item->SetEnchantment(slot, enchant_id, duration, 0, m_caster->GetGUID());
3489 item_owner->ApplyEnchantment(item, slot, true);
3490 }
3491}
3492
3494{
3496 return;
3497
3498 if (Player* caster = m_caster->ToPlayer())
3499 {
3500 if (!m_CastItem)
3501 caster->UpdateCraftSkill(m_spellInfo);
3502
3503 itemTarget->m_loot.reset(new Loot(caster->GetMap(), itemTarget->GetGUID(), LOOT_DISENCHANTING, nullptr));
3505 caster->SendLoot(*itemTarget->m_loot);
3506 }
3507
3508 // item will be removed at disenchanting end
3509}
3510
3512{
3514 return;
3515
3516 if (!unitTarget || !unitTarget->IsPlayer())
3517 return;
3518
3519 Player* player = unitTarget->ToPlayer();
3520 uint8 currentDrunk = player->GetDrunkValue();
3521 int32 drunkMod = GetEffectValueAsInt();
3522
3523 if (drunkMod == 0)
3524 return;
3525
3526 // drunkMod may contain values that are guaranteed to cause uint8 overflow/underflow (examples: 29690, 46874)
3527 // In addition, we would not want currentDrunk to become more than 100.
3528 // So before adding the values, let's check that everything is fine.
3529 if (drunkMod > static_cast<int32>(100 - currentDrunk))
3530 currentDrunk = 100;
3531 else if (drunkMod < static_cast<int32>(0 - currentDrunk))
3532 currentDrunk = 0;
3533 else
3534 currentDrunk += drunkMod; // Due to previous checks we can be sure that currentDrunk will not go beyond [0-100] range.
3535
3536 player->SetDrunkValue(currentDrunk, m_CastItem ? m_CastItem->GetEntry() : 0);
3537
3538 if (currentDrunk == 100 && drunkMod > 0 && roll_chance(25))
3539 player->CastSpell(player, 67468, CastSpellExtraArgs()
3540 .SetTriggeringSpell(this)); // Drunken Vomit
3541}
3542
3544{
3546 return;
3547
3548 Player* player = m_caster->ToPlayer();
3549 if (!player)
3550 return;
3551
3552 Item* foodItem = itemTarget;
3553 if (!foodItem)
3554 return;
3555
3556 Pet* pet = player->GetPet();
3557 if (!pet)
3558 return;
3559
3560 if (!pet->IsAlive())
3561 return;
3562
3564
3565 int32 pct;
3566 int32 levelDiff = int32(pet->GetLevel()) - int32(foodItem->GetTemplate()->GetBaseItemLevel());
3567 if (levelDiff >= 30)
3568 return;
3569 else if (levelDiff >= 20)
3570 pct = int32(12.5); // we can't pass double so keeping the cast here for future references
3571 else if (levelDiff >= 10)
3572 pct = 25;
3573 else
3574 pct = 50;
3575
3576 uint32 count = 1;
3577 player->DestroyItemCount(foodItem, count, true);
3579
3581 args.SetTriggeringSpell(this);
3584}
3585
3587{
3589 return;
3590
3591 if (!unitTarget || !unitTarget->IsPet())
3592 return;
3593
3594 Pet* pet = unitTarget->ToPet();
3595
3598}
3599
3601{
3603 return;
3604
3605 Unit* unitCaster = GetUnitCasterForEffectHandlers();
3606 if (!unitCaster)
3607 return;
3608
3610 ObjectGuid guid = unitCaster->m_ObjectSlot[slot];
3611 if (!guid.IsEmpty())
3612 {
3613 if (GameObject* obj = unitCaster->GetMap()->GetGameObject(guid))
3614 {
3615 // Recast case - null spell id to make auras not be removed on object remove from world
3616 if (m_spellInfo->Id == obj->GetSpellId())
3617 obj->SetSpellId(0);
3618 unitCaster->RemoveGameObject(obj, true);
3619 }
3620 unitCaster->m_ObjectSlot[slot].Clear();
3621 }
3622
3623 float x, y, z, o;
3624 // If dest location if present
3625 if (m_targets.HasDst())
3626 destTarget->GetPosition(x, y, z, o);
3627 // Summon in random point all other units if location present
3628 else
3629 {
3630 unitCaster->GetClosePoint(x, y, z, DEFAULT_PLAYER_BOUNDING_RADIUS);
3631 o = unitCaster->GetOrientation();
3632 }
3633
3634 Map* map = m_caster->GetMap();
3635 Position pos = Position(x, y, z, o);
3637
3639 if (!go)
3640 return;
3641
3643
3644 go->SetFaction(unitCaster->GetFaction());
3645 go->SetLevel(unitCaster->GetLevel());
3647 go->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
3649 unitCaster->AddGameObject(go);
3650
3652
3653 map->AddToMap(go);
3654
3655 unitCaster->m_ObjectSlot[slot] = go->GetGUID();
3656}
3657
3659{
3661 return;
3662
3663 if (!m_corpseTarget && !unitTarget)
3664 return;
3665
3666 Player* player = nullptr;
3667
3668 if (m_corpseTarget)
3670 else if (unitTarget)
3671 player = unitTarget->ToPlayer();
3672
3673 if (!player || player->IsAlive() || !player->IsInWorld())
3674 return;
3675
3676 if (player->IsResurrectRequested()) // already have one active request
3677 return;
3678
3679 uint32 health = player->CountPctFromMaxHealth(effectValue);
3681
3683
3684 player->SetResurrectRequestData(m_caster, health, mana, 0);
3685 SendResurrectRequest(player);
3686}
3687
3689{
3691 return;
3692
3693 if (!unitTarget || !unitTarget->IsAlive())
3694 return;
3695
3696 int32 extraAttacks = GetEffectValueAsInt();
3697
3698 unitTarget->AddExtraAttacks(extraAttacks);
3699
3701}
3702
3704{
3706 return;
3707
3709 m_caster->ToPlayer()->SetCanParry(true);
3710}
3711
3713{
3715 return;
3716
3718 m_caster->ToPlayer()->SetCanBlock(true);
3719}
3720
3722{
3724 return;
3725
3726 if (!unitTarget || unitTarget->IsInFlight())
3727 return;
3728
3729 if (!m_targets.HasDst())
3730 return;
3731
3732 TeleportLocation targetDest{ .Location = *destTarget };
3733 if (ObjectGuid transportGuid = m_destTargets[effectInfo->EffectIndex]._transportGUID; !transportGuid.IsEmpty())
3734 {
3735 targetDest.TransportGuid = transportGuid;
3737 }
3738
3740}
3741
3743{
3745 return;
3746
3748 return;
3749
3750 Player* player = unitTarget->ToPlayer();
3751
3752 int32 repChange = GetEffectValueAsInt();
3753
3754 uint32 factionId = effectInfo->MiscValue;
3755
3756 FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId);
3757 if (!factionEntry)
3758 return;
3759
3760 repChange = player->CalculateReputationGain(REPUTATION_SOURCE_SPELL, 0, repChange, factionId);
3761
3762 player->GetReputationMgr().ModifyReputation(factionEntry, repChange);
3763}
3764
3766{
3768 return;
3769
3771 return;
3772 Player* player = unitTarget->ToPlayer();
3773
3774 uint32 questId = effectInfo->MiscValue;
3775 if (questId)
3776 {
3777 Quest const* quest = sObjectMgr->GetQuestTemplate(questId);
3778 if (!quest)
3779 return;
3780
3781 QuestStatus questStatus = player->GetQuestStatus(questId);
3782 if (questStatus == QUEST_STATUS_REWARDED)
3783 return;
3784
3786 {
3787 if (questStatus == QUEST_STATUS_INCOMPLETE)
3788 player->AreaExploredOrEventHappens(questId);
3789 }
3790 else if (quest->HasFlag(QUEST_FLAGS_TRACKING_EVENT)) // Check if the quest is used as a serverside flag
3791 player->CompleteQuest(questId);
3792 }
3793}
3794
3796{
3798 return;
3799
3800 Unit* unitCaster = GetUnitCasterForEffectHandlers();
3801 if (!unitCaster)
3802 return;
3803
3804 float dist = unitCaster->GetVisibilityRange();
3805
3806 // clear focus
3808 breakTarget.Data.UnitGUID = m_caster->GetGUID();
3809 breakTarget.Data.Write();
3811 Cell::VisitWorldObjects(m_caster, notifierBreak, dist);
3812
3813 // and selection
3815 clearTarget.Data.Guid = m_caster->GetGUID();
3816 clearTarget.Data.Write();
3818 Cell::VisitWorldObjects(m_caster, notifierClear, dist);
3819
3820 // we should also force pets to remove us from current target
3821 Unit::AttackerSet attackerSet;
3822 for (Unit::AttackerSet::const_iterator itr = unitCaster->getAttackers().begin(); itr != unitCaster->getAttackers().end(); ++itr)
3823 if ((*itr)->GetTypeId() == TYPEID_UNIT && !(*itr)->CanHaveThreatList())
3824 attackerSet.insert(*itr);
3825
3826 for (Unit::AttackerSet::const_iterator itr = attackerSet.begin(); itr != attackerSet.end(); ++itr)
3827 (*itr)->AttackStop();
3828}
3829
3831{
3833 return;
3834
3835 Player* player = m_caster->ToPlayer();
3836 if (!player || !player->IsInWorld() || player->IsAlive())
3837 return;
3838
3839 uint32 health = 0;
3840 uint32 mana = 0;
3841
3842 // flat case
3843 if (effectValue < 0)
3844 {
3845 health = uint32(-GetEffectValueAsInt());
3846 mana = effectInfo->MiscValue;
3847 }
3848 // percent case
3849 else
3850 {
3851 health = player->CountPctFromMaxHealth(effectValue);
3852 if (player->GetMaxPower(POWER_MANA) > 0)
3854 }
3855
3856 player->ResurrectPlayer(0.0f);
3857
3858 player->SetHealth(health);
3859 player->SetPower(POWER_MANA, mana);
3860 player->SetPower(POWER_RAGE, 0);
3861 player->SetFullPower(POWER_ENERGY);
3862 player->SetPower(POWER_FOCUS, 0);
3863
3864 player->SpawnCorpseBones();
3865}
3866
3868{
3870 return;
3871
3873 return;
3874
3875 Player* player = m_caster->ToPlayer();
3876 if (!player)
3877 return;
3878
3879 Creature* creature = unitTarget->ToCreature();
3880 int32 targetLevel = creature->GetLevelForTarget(m_caster);
3881
3882 uint32 skill = creature->GetCreatureDifficulty()->GetRequiredLootSkill();
3883
3886 Loot* loot = new Loot(creature->GetMap(), creature->GetGUID(), LOOT_SKINNING, nullptr);
3887 creature->m_personalLoot[player->GetGUID()].reset(loot);
3888 loot->FillLoot(creature->GetCreatureDifficulty()->SkinLootID, LootTemplates_Skinning, player, true);
3889 player->SendLoot(*loot);
3890
3891 if (!IsPartOfSkillLine(skill, m_spellInfo->Id))
3892 return;
3893
3894 // Skill gain for skinning
3895 // This formula is still used (10.0.5.48526)
3896 if (skill == SKILL_SKINNING)
3897 {
3898 int32 reqValue;
3899 if (targetLevel <= 10)
3900 reqValue = 1;
3901 else if (targetLevel < 20)
3902 reqValue = (targetLevel - 10) * 10;
3903 else if (targetLevel <= 73)
3904 reqValue = targetLevel * 5;
3905 else if (targetLevel < 80)
3906 reqValue = targetLevel * 10 - 365;
3907 else if (targetLevel <= 84)
3908 reqValue = targetLevel * 5 + 35;
3909 else if (targetLevel <= 87)
3910 reqValue = targetLevel * 15 - 805;
3911 else if (targetLevel <= 92)
3912 reqValue = (targetLevel - 62) * 20;
3913 else if (targetLevel <= 104)
3914 reqValue = targetLevel * 5 + 175;
3915 else if (targetLevel <= 107)
3916 reqValue = targetLevel * 15 - 905;
3917 else if (targetLevel <= 112)
3918 reqValue = (targetLevel - 72) * 20;
3919 else if (targetLevel <= 122)
3920 reqValue = (targetLevel - 32) * 10;
3921 else
3922 reqValue = 900;
3923
3924 ContentTuningEntry const* contentTuning = sContentTuningStore.LookupEntry(creature->GetContentTuning());
3925 if (!contentTuning)
3926 return;
3927
3928 uint32 skinningSkill = player->GetProfessionSkillForExp(skill, contentTuning->ExpansionID);
3929 if (!skinningSkill)
3930 return;
3931
3932 if (uint32 pureSkillValue = player->GetPureSkillValue(skinningSkill))
3933 {
3934 // Double chances for elites
3935 player->UpdateGatherSkill(skinningSkill, pureSkillValue, reqValue, creature->IsElite() ? 2 : 1);
3936 }
3937 }
3938}
3939
3941{
3942 if (!unitTarget)
3943 return;
3944
3945 Unit* unitCaster = GetUnitCasterForEffectHandlers();
3946 if (!unitCaster)
3947 return;
3948
3950 {
3951 // charge changes fall time
3952 if (unitCaster->GetTypeId() == TYPEID_PLAYER)
3953 unitCaster->ToPlayer()->SetFallInformation(0, unitCaster->GetPositionZ());
3954
3955 float speed = G3D::fuzzyGt(m_spellInfo->Speed, 0.0f) ? m_spellInfo->Speed : SPEED_CHARGE;
3956
3957 Optional<Movement::SpellEffectExtraData> spellEffectExtraData;
3959 {
3960 spellEffectExtraData.emplace();
3961 spellEffectExtraData->Target = unitTarget->GetGUID();
3962 spellEffectExtraData->SpellVisualId = effectInfo->MiscValueB;
3963 }
3964 // Spell is not using explicit target - no generated path
3965 if (!m_preGeneratedPath)
3966 {
3968
3969 m_preGeneratedPath = std::make_unique<PathGenerator>(unitCaster);
3970 m_preGeneratedPath->CalculatePath(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), false);
3971 }
3972
3974 speed = m_preGeneratedPath->GetPathLength() / speed;
3975
3976 unitCaster->GetMotionMaster()->MoveCharge(*m_preGeneratedPath, speed, unitTarget, spellEffectExtraData ? &*spellEffectExtraData : nullptr);
3977
3978 // abuse implementation detail of MoveCharge accepting PathGenerator argument (instantly started spline)
3979 UpdateDelayMomentForUnitTarget(unitTarget, unitCaster->movespline->Duration());
3980 }
3981
3983 {
3984 // not all charge effects used in negative spells
3986 unitCaster->Attack(unitTarget, true);
3987
3990 .SetOriginalCaster(m_originalCasterGUID)
3991 .SetTriggeringSpell(this));
3992 }
3993}
3994
3996{
3997 if (!destTarget)
3998 return;
3999
4000 Unit* unitCaster = GetUnitCasterForEffectHandlers();
4001 if (!unitCaster)
4002 return;
4003
4005 {
4007
4008 if (!unitCaster->IsWithinLOS(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ()))
4009 {
4010 float angle = unitCaster->GetRelativeAngle(pos.GetPositionX(), pos.GetPositionY());
4011 float dist = unitCaster->GetDistance(pos);
4012 pos = unitCaster->GetFirstCollisionPosition(dist, angle);
4013 }
4014
4015 PathGenerator path(unitCaster);
4016 path.CalculatePath(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), false);
4017
4018 float speed = G3D::fuzzyGt(m_spellInfo->Speed, 0.0f) ? m_spellInfo->Speed : SPEED_CHARGE;
4019
4021 speed = path.GetPathLength() / speed;
4022
4023 unitCaster->GetMotionMaster()->MoveCharge(path, speed);
4024
4025 // abuse implementation detail of MoveCharge accepting PathGenerator argument (instantly started spline)
4026 UpdateDelayMomentForDst(unitCaster->movespline->Duration());
4027 }
4029 {
4032 .SetOriginalCaster(m_originalCasterGUID)
4033 .SetTriggeringSpell(this));
4034 }
4035}
4036
4038{
4040 return;
4041
4042 if (!unitTarget)
4043 return;
4044
4046 if (Creature* creatureTarget = unitTarget->ToCreature())
4047 if (creatureTarget->isWorldBoss() || creatureTarget->IsDungeonBoss())
4048 return;
4049
4050 // Spells with SPELL_EFFECT_KNOCK_BACK (like Thunderstorm) can't knockback target if target has ROOT
4052 return;
4053
4054 float ratio = 0.1f;
4055 float speedXY = float(effectInfo->MiscValue) * ratio;
4056 float speedZ = effectValue * ratio;
4057 if (std::abs(speedXY) < 0.01f && std::abs(speedZ) < 0.01f)
4058 return;
4059
4060 Position origin;
4062 {
4063 if (m_targets.HasDst())
4064 origin = destTarget->GetPosition();
4065 else
4066 return;
4067 }
4068 else //if (effectInfo->Effect == SPELL_EFFECT_KNOCK_BACK)
4069 origin = m_caster->GetPosition();
4070
4071 unitTarget->KnockbackFrom(origin, speedXY, speedZ);
4072
4074 PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_PHASE_HIT, PROC_HIT_NONE, nullptr, nullptr, nullptr);
4075}
4076
4078{
4080 return;
4081
4082 if (!unitTarget)
4083 return;
4084
4085 float speedxy = effectInfo->MiscValue / 10.f;
4086 float speedz = effectValue / 10.f;
4087
4088 // Disengage
4090
4091 // changes fall time
4094}
4095
4097{
4099 return;
4100
4102 return;
4103 Player* player = unitTarget->ToPlayer();
4104
4105 uint32 quest_id = effectInfo->MiscValue;
4106
4107 Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
4108
4109 if (!quest)
4110 return;
4111
4112 QuestStatus oldStatus = player->GetQuestStatus(quest_id);
4113
4114 // Player has never done this quest
4115 if (oldStatus == QUEST_STATUS_NONE)
4116 return;
4117
4118 player->RemoveActiveQuest(quest_id, false);
4119
4120 // remove all quest entries for 'entry' from quest log
4121 if (oldStatus != QUEST_STATUS_REWARDED)
4122 {
4123 // we ignore unequippable quest items in this case, it's still be equipped
4124 player->TakeQuestSourceItem(quest_id, false);
4125
4126 if (quest->HasFlag(QUEST_FLAGS_FLAGS_PVP))
4127 {
4128 player->pvpInfo.IsHostile = player->pvpInfo.IsInHostileArea || player->HasPvPForcingQuest();
4129 player->UpdatePvPState();
4130 }
4131 }
4132
4133 player->RemoveRewardedQuest(quest_id);
4134 player->DespawnPersonalSummonsForQuest(quest_id);
4135
4136 sScriptMgr->OnQuestStatusChange(player, quest_id);
4137 sScriptMgr->OnQuestStatusChange(player, quest, oldStatus, QUEST_STATUS_NONE);
4138}
4139
4150
4152{
4154 return;
4155
4156 if (!unitTarget)
4157 return;
4158
4160
4161 // This is a blizzlike mistake: this should be 2D distance according to projectile motion formulas, but Blizzard erroneously used 3D distance.
4162 float distXY = unitTarget->GetExactDist(pos);
4163
4164 // Avoid division by 0
4165 if (distXY < 0.001)
4166 return;
4167
4168 float distZ = pos.GetPositionZ() - unitTarget->GetPositionZ();
4169 float speedXY = effectInfo->MiscValue ? effectInfo->MiscValue / 10.0f : 30.0f;
4170 float speedZ = (2 * speedXY * speedXY * distZ + Movement::gravity * distXY * distXY) / (2 * speedXY * distXY);
4171
4172 if (!std::isfinite(speedZ))
4173 {
4174 TC_LOG_ERROR("spells", "Spell {} with SPELL_EFFECT_PULL_TOWARDS called with invalid speedZ. {}", m_spellInfo->Id, GetDebugInfo());
4175 return;
4176 }
4177
4179}
4180
4182{
4184 return;
4185
4186 if (!unitTarget)
4187 return;
4188
4189 if (!m_targets.HasDst())
4190 {
4191 TC_LOG_ERROR("spells", "Spell {} with SPELL_EFFECT_PULL_TOWARDS_DEST has no dest target", m_spellInfo->Id);
4192 return;
4193 }
4194
4195 Position const* pos = m_targets.GetDstPos();
4196 // This is a blizzlike mistake: this should be 2D distance according to projectile motion formulas, but Blizzard erroneously used 3D distance
4197 float distXY = unitTarget->GetExactDist(pos);
4198
4199 // Avoid division by 0
4200 if (distXY < 0.001)
4201 return;
4202
4203 float distZ = pos->GetPositionZ() - unitTarget->GetPositionZ();
4204
4205 float speedXY = effectInfo->MiscValue ? effectInfo->MiscValue / 10.0f : 30.0f;
4206 float speedZ = (2 * speedXY * speedXY * distZ + Movement::gravity * distXY * distXY) / (2 * speedXY * distXY);
4207
4208 if (!std::isfinite(speedZ))
4209 {
4210 TC_LOG_ERROR("spells", "Spell {} with SPELL_EFFECT_PULL_TOWARDS_DEST called with invalid speedZ. {}", m_spellInfo->Id, GetDebugInfo());
4211 return;
4212 }
4213
4215}
4216
4218{
4220 return;
4221
4222 Player* player = m_caster->ToPlayer();
4223 if (!player || !m_targets.HasDst())
4224 return;
4225
4226 Group* group = player->GetGroup();
4227 if (!group || (group->isRaidGroup() && !group->IsLeader(player->GetGUID()) && !group->IsAssistant(player->GetGUID())))
4228 return;
4229
4230 float x, y, z;
4231 destTarget->GetPosition(x, y, z);
4232
4233 group->AddRaidMarker(GetEffectValueAsInt(), player->GetMapId(), x, y, z);
4234}
4235
4237{
4239 return;
4240
4241 if (!unitTarget)
4242 return;
4243
4244 uint32 mechanic = effectInfo->MiscValue;
4245 DispelList dispel_list;
4246 Unit::AuraMap const& auras = unitTarget->GetOwnedAuras();
4247 for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
4248 {
4249 Aura* aura = itr->second;
4251 continue;
4253 if ((aura->GetSpellInfo()->GetAllEffectsMechanicMask() & (UI64LIT(1) << mechanic)))
4254 dispel_list.emplace_back(aura->GetId(), aura->GetCasterGUID());
4255 }
4256
4257 if (dispel_list.empty())
4258 return;
4259
4260 for (auto itr = dispel_list.begin(); itr != dispel_list.end(); ++itr)
4261 unitTarget->RemoveAura(itr->first, itr->second, 0, AURA_REMOVE_BY_ENEMY_SPELL);
4262
4264
4266 PROC_SPELL_TYPE_MASK_ALL, PROC_SPELL_PHASE_HIT, PROC_HIT_NONE, nullptr, nullptr, nullptr);
4267
4268 std::ranges::find(m_UniqueTargetInfo, unitTarget->GetGUID(), &TargetInfo::TargetGUID)->ProcHitMask |= PROC_HIT_DISPEL;
4269}
4270
4272{
4274 return;
4275
4276 if (effectValue < 0)
4277 return;
4278
4279 Player* player = m_caster->ToPlayer();
4280 if (!player)
4281 return;
4282
4283 // Maybe player dismissed dead pet or pet despawned?
4284 bool hadPet = true;
4285
4286 if (!player->GetPet())
4287 {
4288 PetStable const* petStable = player->GetPetStable();
4289 auto deadPetItr = std::ranges::find_if(petStable->ActivePets, [](Optional<PetStable::PetInfo> const& petInfo)
4290 {
4291 return petInfo && !petInfo->Health;
4292 });
4293
4294 PetSaveMode slot = PetSaveMode(std::distance(petStable->ActivePets.begin(), deadPetItr));
4295
4296 // Position passed to SummonPet is irrelevant with current implementation,
4297 // pet will be relocated without using these coords in Pet::LoadPetFromDB
4298 player->SummonPet(0, slot, 0.0f, 0.0f, 0.0f, 0.0f, 0);
4299 hadPet = false;
4300 }
4301
4302 // TODO: Better to fail Hunter's "Revive Pet" at cast instead of here when casting ends
4303 Pet* pet = player->GetPet(); // Attempt to get current pet
4304 if (!pet || pet->IsAlive())
4305 return;
4306
4307 // If player did have a pet before reviving, teleport it
4308 if (hadPet)
4309 {
4310 // Reposition the pet's corpse before reviving so as not to grab aggro
4311 // We can use a different, more accurate version of GetClosePoint() since we have a pet
4312 float x, y, z; // Will be used later to reposition the pet if we have one
4313 player->GetClosePoint(x, y, z, pet->GetCombatReach(), PET_FOLLOW_DIST, pet->GetFollowAngle());
4314 pet->NearTeleportTo(x, y, z, player->GetOrientation());
4315 pet->Relocate(x, y, z, player->GetOrientation()); // This is needed so SaveStayPosition() will get the proper coords.
4316 }
4317
4320 pet->setDeathState(ALIVE);
4323
4324 // Reset things for when the AI to takes over
4325 CharmInfo *ci = pet->GetCharmInfo();
4326 if (ci)
4327 {
4328 // In case the pet was at stay, we don't want it running back
4329 ci->SaveStayPosition();
4331
4332 ci->SetIsFollowing(false);
4333 ci->SetIsCommandAttack(false);
4334 ci->SetIsCommandFollow(false);
4335 ci->SetIsReturning(false);
4336 }
4337
4339}
4340
4342{
4344 return;
4345
4346 Unit* unitCaster = GetUnitCasterForEffectHandlers();
4347 if (!unitCaster)
4348 return;
4349
4350 int32 mana = 0;
4351 for (uint8 slot = SUMMON_SLOT_TOTEM; slot < MAX_TOTEM_SLOT; ++slot)
4352 {
4353 if (!unitCaster->m_SummonSlot[slot])
4354 continue;
4355
4356 Creature* totem = unitCaster->GetMap()->GetCreature(unitCaster->m_SummonSlot[slot]);
4357 if (totem && totem->IsTotem())
4358 {
4359 uint32 spell_id = totem->m_unitData->CreatedBySpell;
4360 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id, GetCastDifficulty());
4361 if (spellInfo)
4362 {
4363 std::vector<SpellPowerCost> costs = spellInfo->CalcPowerCost(unitCaster, spellInfo->GetSchoolMask());
4364 auto m = std::find_if(costs.begin(), costs.end(), [](SpellPowerCost const& cost) { return cost.Power == POWER_MANA; });
4365 if (m != costs.end())
4366 mana += m->Amount;
4367 }
4368
4369 totem->ToTotem()->UnSummon();
4370 }
4371 }
4372
4373 ApplyPct(mana, effectValue);
4374
4375 if (mana)
4376 {
4378 args.SetTriggeringSpell(this);
4380 unitCaster->CastSpell(unitCaster, 39104, args);
4381 }
4382}
4383
4385{
4387 return;
4388
4390 return;
4391
4392 int32 slot = effectInfo->MiscValue;
4393
4394 // -1 means all player equipped items and -2 all items
4395 if (slot < 0)
4396 {
4399 return;
4400 }
4401
4402 // invalid slot value
4403 if (slot >= INVENTORY_SLOT_BAG_END)
4404 return;
4405
4407 {
4410 }
4411}
4412
4414{
4416 return;
4417
4419 return;
4420
4421 int32 slot = effectInfo->MiscValue;
4422
4423 // FIXME: some spells effects have value -1/-2
4424 // Possibly its mean -1 all player equipped items and -2 all items
4425 if (slot < 0)
4426 {
4427 unitTarget->ToPlayer()->DurabilityLossAll(effectValue / 100.0, (slot < -1));
4428 return;
4429 }
4430
4431 // invalid slot value
4432 if (slot >= INVENTORY_SLOT_BAG_END)
4433 return;
4434
4435 if (effectValue <= 0)
4436 return;
4437
4439 unitTarget->ToPlayer()->DurabilityLoss(item, effectValue / 100.0);
4440}
4441
4443{
4445 return;
4446
4447 Unit* unitCaster = GetUnitCasterForEffectHandlers();
4448 if (!unitCaster || !unitTarget)
4449 return;
4450
4452}
4453
4455{
4457 return;
4458
4459 Unit* unitCaster = GetUnitCasterForEffectHandlers();
4460 if (!unitCaster)
4461 return;
4462
4463 uint32 name_id = effectInfo->MiscValue;
4464 Unit::AuraEffectList const& overrideSummonedGameObjects = unitCaster->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_SUMMONED_OBJECT);
4465 for (AuraEffect const* aurEff : overrideSummonedGameObjects)
4466 {
4467 if (uint32(aurEff->GetMiscValue()) == name_id)
4468 {
4469 name_id = uint32(aurEff->GetMiscValueB());
4470 break;
4471 }
4472 }
4473
4474 GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(name_id);
4475 if (!goinfo)
4476 {
4477 TC_LOG_ERROR("sql.sql", "Gameobject (Entry: {}) does not exist and is not created by spell (ID: {}) cast.", name_id, m_spellInfo->Id);
4478 return;
4479 }
4480
4481 float fx, fy, fz, fo;
4482
4483 if (m_targets.HasDst())
4484 destTarget->GetPosition(fx, fy, fz, fo);
4485 //FIXME: this can be better check for most objects but still hack
4487 {
4488 float dis = effectInfo->CalcRadius(unitCaster).Min;
4489 unitCaster->GetClosePoint(fx, fy, fz, DEFAULT_PLAYER_BOUNDING_RADIUS, dis);
4490 fo = unitCaster->GetOrientation();
4491 }
4492 else
4493 {
4494 //GO is always friendly to it's creator, get range for friends
4495 auto [min_dis, max_dis] = m_spellInfo->GetMinMaxRange(true);
4496 float dis = rand_norm() * (max_dis - min_dis) + min_dis;
4497
4498 unitCaster->GetClosePoint(fx, fy, fz, DEFAULT_PLAYER_BOUNDING_RADIUS, dis);
4499 fo = unitCaster->GetOrientation();
4500 }
4501
4502 Map* cMap = unitCaster->GetMap();
4503 // if gameobject is summoning object, it should be spawned right on caster's position
4504 if (goinfo->type == GAMEOBJECT_TYPE_RITUAL)
4505 unitCaster->GetPosition(fx, fy, fz, fo);
4506
4507 Position pos = { fx, fy, fz, fo };
4509
4510 GameObject* go = GameObject::CreateGameObject(name_id, cMap, pos, rot, 255, GO_STATE_READY);
4511 if (!go)
4512 return;
4513
4516
4517 switch (goinfo->type)
4518 {
4520 {
4521 go->SetFaction(unitCaster->GetFaction());
4522 ObjectGuid bobberGuid = go->GetGUID();
4523 // client requires fishing bobber guid in channel object slot 0 to be usable
4524 unitCaster->SetChannelObject(0, bobberGuid);
4525 unitCaster->AddGameObject(go); // will removed at spell cancel
4526
4527 // end time of range when possible catch fish (FISHING_BOBBER_READY_TIME..GetDuration(m_spellInfo))
4528 // start time == fish-FISHING_BOBBER_READY_TIME (0..GetDuration(m_spellInfo)-FISHING_BOBBER_READY_TIME)
4529 int32 lastSec = 0;
4530 switch (urand(0, 2))
4531 {
4532 case 0: lastSec = 3; break;
4533 case 1: lastSec = 7; break;
4534 case 2: lastSec = 13; break;
4535 }
4536
4537 // Duration of the fishing bobber can't be higher than the Fishing channeling duration
4538 duration = std::min(duration, duration - lastSec*IN_MILLISECONDS + FISHING_BOBBER_READY_TIME*IN_MILLISECONDS);
4539 break;
4540 }
4542 {
4543 if (unitCaster->GetTypeId() == TYPEID_PLAYER)
4544 {
4545 go->AddUniqueUse(unitCaster->ToPlayer());
4546 unitCaster->AddGameObject(go); // will be removed at spell cancel
4547 }
4548 break;
4549 }
4550 case GAMEOBJECT_TYPE_DUEL_ARBITER: // 52991
4551 unitCaster->AddGameObject(go);
4552 break;
4555 default:
4556 break;
4557 }
4558
4559 go->SetRespawnTime(duration > 0 ? duration/IN_MILLISECONDS : 0);
4560
4561 go->SetOwnerGUID(unitCaster->GetGUID());
4562
4563 //go->SetLevel(unitCaster->getLevel());
4565
4567
4568 TC_LOG_DEBUG("spells", "AddObject at SpellEfects.cpp EffectTransmitted");
4569 //unitCaster->AddGameObject(go);
4570 //m_ObjToDel.push_back(go);
4571
4572 cMap->AddToMap(go);
4573
4574 if (GameObject* linkedTrap = go->GetLinkedTrap())
4575 {
4577
4578 linkedTrap->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
4579 //linkedTrap->SetLevel(unitCaster->getLevel());
4580 linkedTrap->SetSpellId(m_spellInfo->Id);
4581 linkedTrap->SetOwnerGUID(unitCaster->GetGUID());
4582
4584 }
4585}
4586
4588{
4590 return;
4591
4592 Player* player = m_caster->ToPlayer();
4593 if (!player)
4594 return;
4595
4597 return;
4598
4599 if (itemTarget->GetCount() < 5)
4600 return;
4601
4602 if (sWorld->getBoolConfig(CONFIG_SKILL_PROSPECTING))
4603 {
4604 uint32 SkillValue = player->GetPureSkillValue(SKILL_JEWELCRAFTING);
4605 uint32 reqSkillValue = itemTarget->GetTemplate()->GetRequiredSkillRank();
4606 player->UpdateGatherSkill(SKILL_JEWELCRAFTING, SkillValue, reqSkillValue);
4607 }
4608
4609 itemTarget->m_loot.reset(new Loot(player->GetMap(), itemTarget->GetGUID(), LOOT_PROSPECTING, nullptr));
4610 itemTarget->m_loot->FillLoot(itemTarget->GetEntry(), LootTemplates_Prospecting, player, true);
4611 player->SendLoot(*itemTarget->m_loot);
4612}
4613
4615{
4617 return;
4618
4619 Player* player = m_caster->ToPlayer();
4620 if (!player)
4621 return;
4622
4624 return;
4625
4626 if (itemTarget->GetCount() < 5)
4627 return;
4628
4629 if (sWorld->getBoolConfig(CONFIG_SKILL_MILLING))
4630 {
4631 uint32 SkillValue = player->GetPureSkillValue(SKILL_INSCRIPTION);
4632 uint32 reqSkillValue = itemTarget->GetTemplate()->GetRequiredSkillRank();
4633 player->UpdateGatherSkill(SKILL_INSCRIPTION, SkillValue, reqSkillValue);
4634 }
4635
4636 itemTarget->m_loot.reset(new Loot(player->GetMap(), itemTarget->GetGUID(), LOOT_MILLING, nullptr));
4637 itemTarget->m_loot->FillLoot(itemTarget->GetEntry(), LootTemplates_Milling, player, true);
4638 player->SendLoot(*itemTarget->m_loot);
4639}
4640
4642{
4644 return;
4645
4647 if (!playerTarget)
4648 return;
4649
4650 uint16 skillStep = GetEffectValueAsInt();
4651 if (skillStep < 1)
4652 return;
4653
4654 uint32 skillid = effectInfo->MiscValue;
4655 if (playerTarget->GetSkillStep(skillid) >= skillStep)
4656 return;
4657
4658 SkillRaceClassInfoEntry const* rcEntry = sDB2Manager.GetSkillRaceClassInfo(skillid, playerTarget->GetRace(), playerTarget->GetClass());
4659 if (!rcEntry)
4660 return;
4661
4662 SkillTiersEntry const* tier = sObjectMgr->GetSkillTier(rcEntry->SkillTierID);
4663 if (!tier)
4664 return;
4665
4666 uint16 skillval = std::max<uint16>(1, playerTarget->GetPureSkillValue(skillid));
4667 uint16 maxSkillVal = tier->GetValueForTierIndex(skillStep - 1);
4668
4669 if (rcEntry->Flags & SKILL_FLAG_ALWAYS_MAX_VALUE)
4670 skillval = maxSkillVal;
4671
4672 playerTarget->SetSkill(skillid, skillStep, skillval, maxSkillVal);
4673}
4674
4676{
4677 Unit* caster = GetCaster()->ToUnit();
4679 caster->CastSpell(nullptr, SPELL_RESURRECTION_VISUAL, true);
4680
4682 return;
4683
4684 if (Player* playerTarget = unitTarget->ToPlayer())
4685 {
4686 if (!playerTarget->IsInWorld())
4687 return;
4688
4689 // skip if player does not want to live
4690 if (!playerTarget->CanAcceptAreaSpiritHealFrom(caster))
4691 return;
4692
4693 playerTarget->ResurrectPlayer(1.0f);
4694 playerTarget->CastSpell(playerTarget, SPELL_PET_SUMMONED, true);
4695 playerTarget->CastSpell(playerTarget, SPELL_SPIRIT_HEAL_MANA, true);
4696 playerTarget->SpawnCorpseBones(false);
4697 }
4698}
4699
4700// remove insignia spell effect
4702{
4704 return;
4705
4706 TC_LOG_DEBUG("spells", "Effect: SkinPlayerCorpse");
4707
4708 Player* player = m_caster->ToPlayer();
4709
4710 Player* target = nullptr;
4711 if (unitTarget)
4712 target = unitTarget->ToPlayer();
4713 else if (m_corpseTarget)
4715
4716 if (!player || !target || target->IsAlive())
4717 return;
4718
4719 target->RemovedInsignia(player);
4720}
4721
4723{
4725 return;
4726
4727 TC_LOG_DEBUG("spells", "Effect: StealBeneficialBuff");
4728
4729 if (!unitTarget || unitTarget == m_caster) // can't steal from self
4730 return;
4731
4732 DispelChargesList stealList;
4733
4734 // Create dispel mask by dispel type
4736 Unit::AuraMap const& auras = unitTarget->GetOwnedAuras();
4737 for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
4738 {
4739 Aura* aura = itr->second;
4740 AuraApplication const* aurApp = aura->GetApplicationOfTarget(unitTarget->GetGUID());
4741 if (!aurApp)
4742 continue;
4743
4744 if ((aura->GetSpellInfo()->GetDispelMask()) & dispelMask)
4745 {
4746 // Need check for passive? this
4747 if (!aurApp->IsPositive() || aura->IsPassive() || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR4_CANNOT_BE_STOLEN))
4748 continue;
4749
4750 // 2.4.3 Patch Notes: "Dispel effects will no longer attempt to remove effects that have 100% dispel resistance."
4752 if (!chance)
4753 continue;
4754
4755 // The charges / stack amounts don't count towards the total number of auras that can be dispelled.
4756 // Ie: A dispel on a target with 5 stacks of Winters Chill and a Polymorph has 1 / (1 + 1) -> 50% chance to dispell
4757 // Polymorph instead of 1 / (5 + 1) -> 16%.
4758 bool dispelCharges = aura->GetSpellInfo()->HasAttribute(SPELL_ATTR7_DISPEL_REMOVES_CHARGES);
4759 uint8 charges = dispelCharges ? aura->GetCharges() : aura->GetStackAmount();
4760 if (charges > 0)
4761 stealList.emplace_back(aura, chance, charges);
4762 }
4763 }
4764
4765 if (stealList.empty())
4766 return;
4767
4768 size_t remaining = stealList.size();
4769
4770 int32 stealAmount = GetEffectValueAsInt();
4771
4772 // Ok if exist some buffs for dispel try dispel it
4773 std::vector<std::tuple<uint32, ObjectGuid, int32>> successList;
4774 successList.reserve(stealAmount);
4775
4777 dispelFailed.CasterGUID = m_caster->GetGUID();
4778 dispelFailed.VictimGUID = unitTarget->GetGUID();
4779 dispelFailed.SpellID = m_spellInfo->Id;
4780
4781 // dispel N = damage buffs (or while exist buffs for dispel)
4782 for (int32 count = 0; count < stealAmount && remaining > 0;)
4783 {
4784 // Random select buff for dispel
4785 DispelChargesList::iterator itr = stealList.begin();
4786 std::advance(itr, urand(0, remaining - 1));
4787
4788 if (itr->RollDispel())
4789 {
4790 uint8 stolenCharges = 1;
4791 if (itr->GetAura()->GetSpellInfo()->HasAttribute(SPELL_ATTR1_DISPEL_ALL_STACKS))
4792 stolenCharges = itr->GetDispelCharges();
4793
4794 successList.emplace_back(itr->GetAura()->GetId(), itr->GetAura()->GetCasterGUID(), int32(stolenCharges));
4795 if (!itr->DecrementCharge(stolenCharges))
4796 {
4797 --remaining;
4798 std::swap(*itr, stealList[remaining]);
4799 }
4800 }
4801 else
4802 {
4803 dispelFailed.FailedSpells.push_back(int32(itr->GetAura()->GetId()));
4804 }
4805 ++count;
4806 }
4807
4808 if (!dispelFailed.FailedSpells.empty())
4809 m_caster->SendMessageToSet(dispelFailed.Write(), true);
4810
4811 if (successList.empty())
4812 return;
4813
4815 spellDispellLog.IsBreak = false; // TODO: use me
4816 spellDispellLog.IsSteal = true;
4817
4818 spellDispellLog.TargetGUID = unitTarget->GetGUID();
4819 spellDispellLog.CasterGUID = m_caster->GetGUID();
4820 spellDispellLog.DispelledBySpellID = m_spellInfo->Id;
4821
4822 for (auto const& [spellId, auraCaster, stolenCharges] : successList)
4823 {
4825 dispellData.SpellID = spellId;
4826 dispellData.Harmful = false; // TODO: use me
4827
4828 unitTarget->RemoveAurasDueToSpellBySteal(spellId, auraCaster, m_caster, stolenCharges);
4829
4830 spellDispellLog.DispellData.emplace_back(dispellData);
4831 }
4832
4833 m_caster->SendMessageToSet(spellDispellLog.Write(), true);
4834
4835 std::ranges::find(m_UniqueTargetInfo, unitTarget->GetGUID(), &TargetInfo::TargetGUID)->ProcHitMask |= PROC_HIT_DISPEL;
4836}
4837
4848
4850{
4852 return;
4853
4855 return;
4856
4857 if (int32 creatureEntry = effectInfo->MiscValue)
4859}
4860
4862{
4864 return;
4865
4866 Player* playerTarget = Object::ToPlayer(unitTarget);
4867 if (!playerTarget)
4868 return;
4869
4871}
4872
4874{
4876 return;
4877
4879 return;
4880
4882}
4883
4885{
4887 return;
4888
4889 if (!unitTarget)
4890 return;
4891
4892 Player* player = unitTarget->ToPlayer();
4893 if (!player)
4894 return;
4895
4896 if (Quest const* quest = sObjectMgr->GetQuestTemplate(effectInfo->MiscValue))
4897 {
4898 if (!player->CanTakeQuest(quest, false))
4899 return;
4900
4901 if (quest->IsAutoAccept() && player->CanAddQuest(quest, false))
4902 {
4903 player->AddQuestAndCheckCompletion(quest, player);
4904 player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GetGUID(), true, true);
4905 }
4906 else
4907 player->PlayerTalkClass->SendQuestGiverQuestDetails(quest, player->GetGUID(), true, false);
4908 }
4909}
4910
4912{
4914 return;
4915
4917 return;
4918
4919 uint32 creatureEntry = effectInfo->MiscValue;
4920 Pet* pet = unitTarget->CreateTamedPetFrom(creatureEntry, m_spellInfo->Id);
4921 if (!pet)
4922 return;
4923
4924 // relocate
4925 float px, py, pz;
4927 pet->Relocate(px, py, pz, unitTarget->GetOrientation());
4928
4929 // add to world
4930 pet->GetMap()->AddToMap(pet->ToCreature());
4931
4932 pet->SendNewlyTamed();
4933
4934 // unitTarget has pet now
4935 unitTarget->SetMinion(pet, true);
4936
4938 {
4941 }
4942}
4943
4945{
4947 return;
4948
4950 return;
4951 uint32 nodeid = effectInfo->MiscValue;
4952 if (sTaxiNodesStore.LookupEntry(nodeid))
4954}
4955
4964
4966{
4968 return;
4969
4970 Unit* unitCaster = GetUnitCasterForEffectHandlers();
4971 if (!unitCaster)
4972 return;
4973
4974 if (unitTarget)
4976}
4977
4979{
4981 return;
4982
4983 if (!gameObjTarget)
4984 return;
4985
4986 FactionTemplateEntry const* casterFaction = m_caster->GetFactionTemplateEntry();
4987 FactionTemplateEntry const* targetFaction = sFactionTemplateStore.LookupEntry(gameObjTarget->GetFaction());
4988 // Do not allow to damage GO's of friendly factions (ie: Wintergrasp Walls/Ulduar Storm Beacons)
4989 if (!targetFaction || (casterFaction && !casterFaction->IsFriendlyTo(targetFaction)))
4991}
4992
4994{
4996 return;
4997
4998 if (!gameObjTarget)
4999 return;
5000
5002}
5003
5014
5015void Spell::SummonGuardian(SpellEffectInfo const* effect, uint32 entry, SummonPropertiesEntry const* properties, uint32 numGuardians, ObjectGuid privateObjectOwner)
5016{
5017 Unit* unitCaster = GetUnitCasterForEffectHandlers();
5018 if (!unitCaster)
5019 return;
5020
5021 if (unitCaster->IsTotem())
5022 unitCaster = unitCaster->ToTotem()->GetOwner();
5023
5024 // in another case summon new
5025 float radius = 5.0f;
5027
5028 //TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
5029 Map* map = unitCaster->GetMap();
5030 for (uint32 count = 0; count < numGuardians; ++count)
5031 {
5032 Position pos;
5033 if (count == 0)
5034 pos = destTarget->GetPosition();
5035 else
5036 // randomize position for multiple summons
5037 pos = unitCaster->GetRandomPoint(*destTarget, radius);
5038
5039 TempSummon* summon = map->SummonCreature(entry, pos, properties, duration, unitCaster, m_spellInfo->Id, 0, privateObjectOwner);
5040 if (!summon)
5041 return;
5042
5043 if (summon->IsGuardian())
5044 {
5045 // level of pet summoned using engineering item based at engineering skill level
5046 if (m_CastItem && unitCaster->GetTypeId() == TYPEID_PLAYER)
5047 if (ItemTemplate const* proto = m_CastItem->GetTemplate())
5048 if (proto->GetRequiredSkill() == SKILL_ENGINEERING)
5049 if (uint16 skill202 = unitCaster->ToPlayer()->GetSkillValue(SKILL_ENGINEERING))
5050 static_cast<Guardian*>(summon)->InitStatsForLevel(skill202 / 5);
5051 }
5052
5054 ((Minion*)summon)->SetFollowAngle(unitCaster->GetAbsoluteAngle(summon));
5055
5056 if (summon->GetEntry() == 27893)
5057 {
5058 UF::VisibleItem const& weapon = m_caster->ToPlayer()->m_playerData->VisibleItems[EQUIPMENT_SLOT_MAINHAND];
5059 if (weapon.ItemID)
5060 {
5061 summon->SetDisplayId(11686); // modelid2
5062 summon->SetVirtualItem(0, weapon.ItemID, weapon.ItemAppearanceModID, weapon.ItemVisual);
5063 }
5064 else
5065 summon->SetDisplayId(1126); // modelid1
5066 }
5067
5069 }
5070}
5071
5073{
5075 return;
5076
5078 !unitTarget->IsPet() || ((Pet*)unitTarget)->getPetType() != HUNTER_PET)
5079 return;
5080
5082}
5083
5085{
5087 return;
5088
5090 return;
5091
5092 uint32 soundid = effectInfo->MiscValue;
5093
5094 if (!sSoundKitStore.LookupEntry(soundid))
5095 {
5096 TC_LOG_ERROR("spells", "EffectPlayMusic: Sound (Id: {}) does not exist in spell {}.", soundid, m_spellInfo->Id);
5097 return;
5098 }
5099
5101}
5102
5104{
5106 return;
5107
5109 return;
5110
5111 Player* player = unitTarget->ToPlayer();
5112 uint32 specID = m_misc.SpecializationId;
5113 ChrSpecializationEntry const* spec = sChrSpecializationStore.AssertEntry(specID);
5114
5115 // Safety checks done in Spell::CheckCast
5116 if (!spec->IsPetSpecialization())
5117 player->ActivateTalentGroup(spec);
5118 else
5119 player->GetPet()->SetSpecialization(specID);
5120}
5121
5123{
5125 return;
5126
5127 if (!unitTarget)
5128 return;
5129
5130 Player* player = unitTarget->ToPlayer();
5131 if (!player)
5132 return;
5133
5134 switch (m_spellInfo->Id)
5135 {
5136 case 91604: // Restricted Flight Area
5138 break;
5139 default:
5140 break;
5141 }
5142
5143 uint32 soundId = effectInfo->MiscValue;
5144
5145 if (!sSoundKitStore.LookupEntry(soundId))
5146 {
5147 TC_LOG_ERROR("spells", "EffectPlaySound: Sound (Id: {}) does not exist in spell {}.", soundId, m_spellInfo->Id);
5148 return;
5149 }
5150
5151 player->PlayDirectSound(soundId, player);
5152}
5153
5155{
5157 return;
5158
5159 if (!unitTarget)
5160 return;
5161 // there may be need of specifying casterguid of removed auras
5163}
5164
5166{
5168 return;
5169
5170 if (!unitTarget)
5171 return;
5172
5174}
5175
5189
5191{
5193 return;
5194
5195 Player* player = m_caster->ToPlayer();
5196 if (!player)
5197 return;
5198
5199 uint32 button_id = effectInfo->MiscValue + 132;
5200 uint32 n_buttons = effectInfo->MiscValueB;
5201
5202 for (; n_buttons; --n_buttons, ++button_id)
5203 {
5204 ActionButton const* ab = player->GetActionButton(button_id);
5205 if (!ab || ab->GetType() != ACTION_BUTTON_SPELL)
5206 continue;
5207
5210 uint32 spell_id = ab->GetAction();
5211 if (!spell_id)
5212 continue;
5213
5214 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id, GetCastDifficulty());
5215 if (!spellInfo)
5216 continue;
5217
5218 if (!player->HasSpell(spell_id) || player->GetSpellHistory()->HasCooldown(spell_id))
5219 continue;
5220
5222 continue;
5223
5224 CastSpellExtraArgs args;
5226 args.OriginalCastId = m_castId;
5228 m_caster->CastSpell(m_caster, spellInfo->Id, args);
5229 }
5230}
5231
5233{
5235 return;
5236
5237 if (!unitTarget)
5238 return;
5239
5240 Player* player = unitTarget->ToPlayer();
5241 if (!player)
5242 return;
5243
5244 if (Item* item = player->GetItemByEntry(effectInfo->ItemType))
5245 {
5246 for (ItemEffectEntry const* itemEffect : item->GetEffects())
5247 item->SetSpellCharges(itemEffect, itemEffect->Charges);
5248
5249 item->SetState(ITEM_CHANGED, player);
5250 }
5251}
5252
5254{
5256 return;
5257
5259 return;
5260
5261 Player* player = unitTarget->ToPlayer();
5262
5263 WorldLocation homeLoc;
5264 uint32 areaId = player->GetAreaId();
5265
5266 if (effectInfo->MiscValue)
5267 areaId = effectInfo->MiscValue;
5268
5269 if (m_targets.HasDst())
5270 homeLoc.WorldRelocate(*destTarget);
5271 else
5272 homeLoc = player->GetWorldLocation();
5273
5274 player->SetHomebind(homeLoc, areaId);
5275 player->SendBindPointUpdate();
5276
5277 TC_LOG_DEBUG("spells", "EffectBind: New homebind X: {}, Y: {}, Z: {} O: {}, MapId: {}, AreaId: {}",
5278 homeLoc.GetPositionX(), homeLoc.GetPositionY(), homeLoc.GetPositionZ(), homeLoc.GetOrientation(), homeLoc.GetMapId(), areaId);
5279
5280 // zone update
5281 player->SendPlayerBound(m_caster->GetGUID(), areaId);
5282}
5283
5285{
5287 return;
5288
5289 if (Player* player = unitTarget->ToPlayer())
5290 if (WorldLocation const* dest = player->GetStoredAuraTeleportLocation(effectInfo->MiscValue))
5291 player->TeleportTo(*dest, unitTarget == m_caster ? TELE_TO_SPELL | TELE_TO_NOT_LEAVE_COMBAT : TELE_TO_NONE);
5292}
5293
5295{
5297 return;
5298
5299 if (effectValue <= 0)
5300 return;
5301
5302 if (Player* player = unitTarget->ToPlayer())
5303 player->IncreaseCurrencyCap(effectInfo->MiscValue, GetEffectValueAsInt());
5304}
5305
5316
5318{
5320 return;
5321
5322 // Safety checks done in Spell::CheckCast
5323 Player* caster = m_caster->ToPlayer();
5324 if (Guild* guild = caster->GetGuild())
5325 guild->HandleBuyBankTab(caster->GetSession(), GetEffectValueAsInt() - 1); // Bank tabs start at zero internally
5326}
5327
5329{
5331 return;
5332
5333 uint32 goId = effectInfo->MiscValue;
5334 if (!goId)
5335 return;
5336
5337 float x, y, z, o;
5338 if (m_targets.HasDst())
5339 destTarget->GetPosition(x, y, z, o);
5340 else
5341 {
5343 o = m_caster->GetOrientation();
5344 }
5345
5346 Map* map = m_caster->GetMap();
5347 Position pos = Position(x, y, z, o);
5349 GameObject* go = GameObject::CreateGameObject(goId, map, pos, rot, 255, GO_STATE_READY);
5350
5351 if (!go)
5352 {
5353 TC_LOG_WARN("spells", "SpellEffect Failed to summon personal gameobject. SpellId {}, effect {}", m_spellInfo->Id, effectInfo->EffectIndex);
5354 return;
5355 }
5356
5358
5360
5361 go->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
5364
5366
5367 map->AddToMap(go);
5368
5369 if (GameObject* linkedTrap = go->GetLinkedTrap())
5370 {
5372
5373 linkedTrap->SetRespawnTime(duration > 0 ? duration / IN_MILLISECONDS : 0);
5374 linkedTrap->SetSpellId(m_spellInfo->Id);
5375
5377 }
5378}
5379
5381{
5383 return;
5384
5385 if (!unitTarget || !unitTarget->IsInWorld())
5386 return;
5387
5388 Player* target = unitTarget->ToPlayer();
5389 if (!target)
5390 return;
5391
5392 if (unitTarget->IsAlive())
5393 return;
5394
5395 if (target->IsResurrectRequested()) // already have one active request
5396 return;
5397
5398 uint32 health = target->CountPctFromMaxHealth(effectValue);
5400 uint32 resurrectAura = 0;
5401 if (sSpellMgr->GetSpellInfo(effectInfo->TriggerSpell, DIFFICULTY_NONE))
5402 resurrectAura = effectInfo->TriggerSpell;
5403
5404 if (resurrectAura && target->HasAura(resurrectAura))
5405 return;
5406
5408 target->SetResurrectRequestData(m_caster, health, mana, resurrectAura);
5409 SendResurrectRequest(target);
5410}
5411
5413{
5415 return;
5416
5417 Unit* unitCaster = GetUnitCasterForEffectHandlers();
5418 if (!unitCaster || !m_targets.HasDst())
5419 return;
5420
5421 AreaTriggerCreatePropertiesId createPropertiesId = { uint32(effectInfo->MiscValue), false };
5422 int32 duration = GetSpellInfo()->CalcDuration(GetCaster());
5423
5424 AreaTrigger::CreateAreaTrigger(createPropertiesId, destTarget->GetPosition(), duration, unitCaster, nullptr, m_SpellVisual, GetSpellInfo(), this);
5425}
5426
5428{
5430 return;
5431
5432 TalentEntry const* talent = sTalentStore.LookupEntry(m_misc.TalentId);
5433 if (!talent)
5434 return;
5435
5436 Player* player = unitTarget ? unitTarget->ToPlayer() : nullptr;
5437 if (!player)
5438 return;
5439
5440 player->RemoveTalent(talent);
5441 player->SendTalentsInfoData();
5442}
5443
5445{
5447 return;
5448
5450 return;
5451
5452 Player* player = unitTarget->ToPlayer();
5453 if (Item* item = player->GetItemByEntry(effectInfo->ItemType))
5454 player->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
5455}
5456
5458{
5460 return;
5461
5463 return;
5464
5465 if (Garrison* garrison = unitTarget->ToPlayer()->GetGarrison())
5466 garrison->LearnBlueprint(effectInfo->MiscValue);
5467}
5468
5470{
5472 return;
5473
5474 if (!unitTarget)
5475 return;
5476
5478 {
5479 return aurApp->GetBase()->GetSpellInfo()->HasLabel(effectInfo->MiscValue);
5480 });
5481}
5482
5493
5495{
5497 return;
5498
5499 Unit* unitCaster = GetUnitCasterForEffectHandlers();
5500 if (!unitCaster || !m_targets.HasDst())
5501 return;
5502
5504}
5505
5507{
5509 return;
5510
5511 if (!unitTarget)
5512 return;
5513
5515 {
5516 if (check(conversation))
5517 conversation->Remove();
5518 };
5520 Cell::VisitGridObjects(unitTarget, worker, 100.0f);
5521}
5522
5524{
5526 return;
5527
5529 return;
5530
5531 if (Garrison* garrison = unitTarget->ToPlayer()->GetGarrison())
5532 garrison->AddFollower(effectInfo->MiscValue);
5533}
5534
5536{
5538 return;
5539
5540 Player* player = m_caster->ToPlayer();
5541 if (!player)
5542 return;
5543
5544 CollectionMgr* collectionMgr = player->GetSession()->GetCollectionMgr();
5545 if (!collectionMgr)
5546 return;
5547
5548 std::vector<int32> bonusList;
5549 bonusList.push_back(collectionMgr->GetHeirloomBonus(m_misc.Raw.Data[0]));
5550
5551 DoCreateItem(m_misc.Raw.Data[0], ItemContext::NONE, &bonusList);
5553}
5554
5556{
5558 return;
5559
5561 return;
5562
5563 if (Garrison* garrison = unitTarget->ToPlayer()->GetGarrison())
5564 garrison->ActivateBuilding(effectInfo->MiscValue);
5565}
5566
5568{
5570 return;
5571
5572 Player* playerCaster = m_caster->ToPlayer();
5573 if (!playerCaster)
5574 return;
5575
5576 if (!unitTarget || !unitTarget->IsCreature())
5577 return;
5578
5580}
5581
5583{
5585 return;
5586
5587 Player* playerTarget = Object::ToPlayer(unitTarget);
5588 if (!playerTarget)
5589 return;
5590
5592 playerTarget->GiveXP(xp, nullptr);
5593}
5594
5596{
5598 return;
5599
5600 Player* playerTarget = Object::ToPlayer(unitTarget);
5601 if (!playerTarget)
5602 return;
5603
5604 // effect value is number of resting hours
5605 playerTarget->GetRestMgr().AddRestBonus(REST_TYPE_XP, effectValue * float(HOUR) * playerTarget->GetRestMgr().CalcExtraPerSec(REST_TYPE_XP, 0.125f));
5606}
5607
5609{
5611 return;
5612
5614 return;
5615
5617 battlePetMgr->HealBattlePetsPct(GetEffectValueAsInt());
5618}
5619
5632
5634{
5636 return;
5637
5638 Player* playerCaster = m_caster->ToPlayer();
5639 if (!playerCaster)
5640 return;
5641
5642 if (!unitTarget || !unitTarget->IsCreature())
5643 return;
5644
5645 auto qualityItr = std::ranges::lower_bound(sBattlePetBreedQualityStore, GetEffectValueAsInt(), {}, &BattlePetBreedQualityEntry::MaxQualityRoll);
5646
5648 if (qualityItr != sBattlePetBreedQualityStore.end())
5649 quality = BattlePets::BattlePetBreedQuality(qualityItr->QualityEnum);
5650
5652}
5653
5655{
5657 return;
5658
5659 if (!unitTarget || !unitTarget->IsPlayer())
5660 return;
5661
5663}
5664
5666{
5668 return;
5669
5671 return;
5672
5678
5679 BattlePetSpeciesEntry const* speciesEntry = sBattlePetSpeciesStore.LookupEntry(speciesId);
5680 if (!speciesEntry)
5681 return;
5682
5683 Player* player = m_caster->ToPlayer();
5684 BattlePets::BattlePetMgr* battlePetMgr = player->GetSession()->GetBattlePetMgr();
5685 if (!battlePetMgr)
5686 return;
5687
5688 if (battlePetMgr->GetMaxPetLevel() < level)
5689 {
5692 return;
5693 }
5694
5695 if (battlePetMgr->HasMaxPetCount(speciesEntry, player->GetGUID()))
5696 {
5699 return;
5700 }
5701
5702 battlePetMgr->AddPet(speciesId, displayId, breed, BattlePets::BattlePetBreedQuality(quality), level);
5703
5704 player->SendPlaySpellVisual(player, BattlePets::SPELL_VISUAL_UNCAGE_PET, 0, 0, 0.f, false);
5705
5706 player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true);
5707 m_CastItem = nullptr;
5708}
5709
5711{
5713 return;
5714
5715 if (Player* player = m_caster->ToPlayer())
5716 if (CollectionMgr* collectionMgr = player->GetSession()->GetCollectionMgr())
5717 collectionMgr->UpgradeHeirloom(m_misc.Raw.Data[0], int32(m_castItemEntry));
5718}
5719
5721{
5723 return;
5724
5725 if (!itemTarget)
5726 return;
5727
5728 Player* player = m_caster->ToPlayer();
5729 if (!player || player->GetGUID() != itemTarget->GetOwnerGUID())
5730 return;
5731
5734 if (itemTarget->IsEquipped())
5736
5739}
5740
5751
5762
5764{
5766 return;
5767
5768 Player* playerCaster = m_caster->ToPlayer();
5769 if (!playerCaster)
5770 return;
5771
5772 if (Aura* artifactAura = playerCaster->GetAura(ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE))
5773 if (Item* artifact = playerCaster->GetItemByGuid(artifactAura->GetCastItemGUID()))
5774 artifact->GiveArtifactXp(uint64(effectValue), m_CastItem, uint32(effectInfo->MiscValue));
5775}
5776
5778{
5780 return;
5781
5783 return;
5784
5786 if (Item* artifact = unitTarget->ToPlayer()->GetItemByGuid(artifactAura->GetCastItemGUID()))
5787 artifact->GiveArtifactXp(uint64(effectValue), m_CastItem, 0);
5788}
5789
5800
5801template<typename TargetInfo>
5802bool IsUnitTargetSceneObjectAura(Spell const* spell, TargetInfo const& target)
5803{
5804 if (target.TargetGUID != spell->GetCaster()->GetGUID())
5805 return false;
5806
5807 for (SpellEffectInfo const& spellEffectInfo : spell->GetSpellInfo()->GetEffects())
5808 if (target.EffectMask & (1 << spellEffectInfo.EffectIndex) && spellEffectInfo.IsUnitOwnedAuraEffect())
5809 return true;
5810
5811 return false;
5812}
5813
5815{
5817 return;
5818
5819 Unit* unitCaster = GetUnitCasterForEffectHandlers();
5820 if (!unitCaster || !m_targets.HasDst())
5821 return;
5822
5824 {
5825 bool hasAuraTargetingCaster = std::find_if(m_UniqueTargetInfo.begin(), m_UniqueTargetInfo.end(), [this](TargetInfo const& target)
5826 {
5827 return IsUnitTargetSceneObjectAura(this, target);
5828 }) != m_UniqueTargetInfo.end();
5829
5830 if (hasAuraTargetingCaster)
5831 sceneObject->SetCreatedBySpellCast(m_castId);
5832 }
5833}
5834
5836{
5838 return;
5839
5840 Unit* unitCaster = GetUnitCasterForEffectHandlers();
5841 if (!unitCaster || !m_targets.HasDst())
5842 return;
5843
5844 if (SceneObject* sceneObject = SceneObject::CreateSceneObject(effectInfo->MiscValue, unitCaster, destTarget->GetPosition(), unitCaster->GetGUID()))
5845 {
5846 bool hasAuraTargetingCaster = std::find_if(m_UniqueTargetInfo.begin(), m_UniqueTargetInfo.end(), [this](TargetInfo const& target)
5847 {
5848 return IsUnitTargetSceneObjectAura(this, target);
5849 }) != m_UniqueTargetInfo.end();
5850
5851 if (hasAuraTargetingCaster)
5852 sceneObject->SetCreatedBySpellCast(m_castId);
5853 }
5854}
5855
5857{
5859 return;
5860
5862 return;
5863
5865}
5866
5868{
5870 return;
5871
5873 return;
5874
5875 int32 honor = GetEffectValueAsInt();
5876
5878 packet.Honor = honor;
5879 packet.OriginalHonor = honor;
5880
5881 Player* playerTarget = unitTarget->ToPlayer();
5882 playerTarget->AddHonorXP(honor);
5883 playerTarget->SendDirectMessage(packet.Write());
5884}
5885
5887{
5889 return;
5890
5891 Unit* unitCaster = GetUnitCasterForEffectHandlers();
5892 if (!unitCaster)
5893 return;
5894
5895 if (unitCaster->IsInFlight())
5896 return;
5897
5898 JumpChargeParams const* params = sObjectMgr->GetJumpChargeParams(effectInfo->MiscValue);
5899 if (!params)
5900 return;
5901
5902 std::variant<std::monostate, float, Milliseconds> speedOrTime = [params]() -> std::variant<std::monostate, float, Milliseconds>
5903 {
5904 if (params->TreatSpeedAsMoveTimeSeconds)
5905 return duration_cast<Milliseconds>(FloatSeconds(params->MoveTimeInSec));
5906
5907 return params->Speed;
5908 }();
5909
5910 MovementFacingTarget facing;
5911 if (Unit const* target = m_targets.GetUnitTarget())
5912 {
5914 facing = target;
5915 }
5916
5918 if (effectInfo->TriggerSpell || params->TriggerSpellId)
5919 {
5920 arrivalCast.emplace();
5921 arrivalCast->SpellId = params->TriggerSpellId ? *params->TriggerSpellId : effectInfo->TriggerSpell;
5922 arrivalCast->Target = unitTarget ? unitTarget->GetGUID() : ObjectGuid::Empty;
5923 }
5924
5926 if (params->SpellVisualId || params->ProgressCurveId || params->ParabolicCurveId)
5927 {
5928 effectExtra.emplace();
5929 if (params->SpellVisualId)
5930 effectExtra->SpellVisualId = *params->SpellVisualId;
5931
5932 if (params->ProgressCurveId)
5933 effectExtra->ProgressCurveId = *params->ProgressCurveId;
5934
5935 if (params->ParabolicCurveId)
5936 effectExtra->ParabolicCurveId = *params->ParabolicCurveId;
5937 }
5938
5939 unitCaster->GetMotionMaster()->MoveJump(EVENT_JUMP, *destTarget, speedOrTime, params->MinHeight, params->MaxHeight,
5941 arrivalCast ? &*arrivalCast : nullptr,
5942 effectExtra ? &*effectExtra : nullptr);
5943}
5944
5955
5957{
5959 return;
5960
5962 return;
5963
5964 Player* owner = m_caster->ToPlayer();
5965 if (!owner)
5966 return;
5967
5968 AzeriteEmpoweredItem* azeriteEmpoweredItem = itemTarget->ToAzeriteEmpoweredItem();
5969 owner->ModifyMoney(-azeriteEmpoweredItem->GetRespecCost());
5970
5971 // reapply all item mods - item level change affects stats and auras
5972 if (azeriteEmpoweredItem->IsEquipped())
5973 owner->_ApplyItemMods(azeriteEmpoweredItem, azeriteEmpoweredItem->GetSlot(), false);
5974
5975 azeriteEmpoweredItem->ClearSelectedAzeritePowers();
5976
5977 if (azeriteEmpoweredItem->IsEquipped())
5978 owner->_ApplyItemMods(azeriteEmpoweredItem, azeriteEmpoweredItem->GetSlot(), true);
5979
5980 azeriteEmpoweredItem->SetState(ITEM_CHANGED, owner);
5981 owner->SetNumRespecs(owner->GetNumRespecs() + 1);
5982}
5983
5985{
5987 return;
5988
5989 Player* playerTarget = unitTarget ? unitTarget->ToPlayer() : nullptr;
5990 if (!playerTarget)
5991 return;
5992
5994 if (!heartOfAzeroth)
5995 return;
5996
5997 AzeriteItem* azeriteItem = heartOfAzeroth->ToAzeriteItem();
5998 if (!azeriteItem)
5999 return;
6000
6001 // remove old rank and apply new one
6002 if (azeriteItem->IsEquipped())
6003 {
6004 if (UF::SelectedAzeriteEssences const* selectedEssences = azeriteItem->GetSelectedAzeriteEssences())
6005 {
6006 for (int32 slot = 0; slot < MAX_AZERITE_ESSENCE_SLOT; ++slot)
6007 {
6008 if (selectedEssences->AzeriteEssenceID[slot] == uint32(effectInfo->MiscValue))
6009 {
6010 bool major = AzeriteItemMilestoneType(sDB2Manager.GetAzeriteItemMilestonePower(slot)->Type) == AzeriteItemMilestoneType::MajorEssence;
6011 playerTarget->ApplyAzeriteEssence(azeriteItem, effectInfo->MiscValue, MAX_AZERITE_ESSENCE_RANK, major, false);
6012 playerTarget->ApplyAzeriteEssence(azeriteItem, effectInfo->MiscValue, effectInfo->MiscValueB, major, false);
6013 break;
6014 }
6015 }
6016 }
6017 }
6018
6020 azeriteItem->SetState(ITEM_CHANGED, playerTarget);
6021}
6022
6033
6035{
6037 return;
6038
6039 Player* playerTarget = unitTarget->ToPlayer();
6040 if (!playerTarget)
6041 return;
6042
6043 for (MountEquipmentEntry const* mountEquipment : sMountEquipmentStore)
6044 {
6045 if (mountEquipment->LearnedBySpell == effectInfo->TriggerSpell)
6046 {
6047 playerTarget->LearnSpell(mountEquipment->LearnedBySpell, false, 0, true);
6048 Unit::AuraEffectList const& mountAuras = playerTarget->GetAuraEffectsByType(SPELL_AURA_MOUNTED);
6049 if (!mountAuras.empty())
6050 if (MountEntry const* mountEntry = sDB2Manager.GetMount(mountAuras.front()->GetId()))
6051 if (!mountEntry->GetFlags().HasFlag(MountFlags::MountEquipmentEffectsSuppressed))
6052 playerTarget->CastSpell(playerTarget, mountEquipment->BuffSpell, true);
6053 }
6054 else
6055 {
6056 playerTarget->RemoveOwnedAura(mountEquipment->BuffSpell);
6057 playerTarget->RemoveSpell(mountEquipment->LearnedBySpell, false, false, true);
6058 }
6059 }
6060
6061 WorldPackets::Spells::ApplyMountEquipmentResult applyMountEquipmentResult;
6062 applyMountEquipmentResult.ItemGUID = m_castItemGUID;
6063 applyMountEquipmentResult.ItemID = m_castItemEntry;
6065 playerTarget->SendDirectMessage(applyMountEquipmentResult.Write());
6066}
6067
6069{
6071 return;
6072
6074 if (!target)
6075 return;
6076
6078}
6079
6081{
6083 return;
6084
6085 Unit* unitCaster = GetUnitCasterForEffectHandlers();
6086 if (!unitCaster)
6087 return;
6088
6089 uint32 broadcastTextId = effectInfo->MiscValue;
6090 if (!sBroadcastTextStore.LookupEntry(broadcastTextId))
6091 return;
6092
6093 ChatMsg chatType = ChatMsg(effectInfo->MiscValueB);
6094 unitCaster->Talk(broadcastTextId, chatType, CreatureTextMgr::GetRangeForChatType(chatType), unitTarget);
6095}
6096
6098{
6100 return;
6101
6102 Player* playerCaster = m_caster->ToPlayer();
6103 if (!playerCaster)
6104 return;
6105
6106 if (!unitTarget || !unitTarget->IsCreature())
6107 return;
6108
6110}
6111
6113{
6115 return;
6116
6118 if (!player)
6119 return;
6120
6121 uint32 illusionId = effectInfo->MiscValue;
6122 if (!sTransmogIllusionStore.LookupEntry(illusionId))
6123 return;
6124
6125 player->GetSession()->GetCollectionMgr()->AddTransmogIllusion(illusionId);
6126}
6127
6129{
6131 return;
6132
6134 if (!targetAura)
6135 return;
6136
6137 switch (effectInfo->MiscValue)
6138 {
6139 case 0:
6140 targetAura->ModStackAmount(GetEffectValueAsInt());
6141 break;
6142 case 1:
6143 targetAura->SetStackAmount(GetEffectValueAsInt());
6144 break;
6145 default:
6146 break;
6147 }
6148}
6149
6157
6159{
6161 return;
6162
6164 {
6165 SpellInfo const* spellOnCooldown = sSpellMgr->AssertSpellInfo(cooldown.SpellId, DIFFICULTY_NONE);
6166 if (spellOnCooldown->SpellFamilyName != uint32(effectInfo->MiscValue))
6167 return false;
6168
6169 int32 bitIndex = effectInfo->MiscValueB - 1;
6170 if (bitIndex < 0 || uint32(bitIndex) >= sizeof(flag128) * 8)
6171 return false;
6172
6173 return (spellOnCooldown->SpellFamilyFlags[bitIndex / 32] & 1u << (bitIndex % 32)) != 0;
6175}
6176
6178{
6180 return;
6181
6183 {
6184 return sSpellMgr->AssertSpellInfo(cooldown.SpellId, DIFFICULTY_NONE)->CategoryId == uint32(effectInfo->MiscValue);
6186}
6187
6196
6198{
6200 return;
6201
6203 if (!target)
6204 return;
6205
6206 if (target->IsLoading() && target->m_activePlayerData->TraitConfigs.empty())
6207 return; // traits not loaded yet
6208
6211 if (newConfig.Type != TraitConfigType::Generic)
6212 return;
6213
6214 newConfig.TraitSystemID = sTraitTreeStore.AssertEntry(effectInfo->MiscValue)->TraitSystemID;
6215 TraitSystemEntry const* traitSystem = sTraitSystemStore.LookupEntry(newConfig.TraitSystemID);
6216 if (!traitSystem)
6217 return;
6218
6219 switch (traitSystem->GetVariationType())
6220 {
6222 newConfig.VariationID = 0;
6223 break;
6226 break;
6227 default:
6228 return;
6229 }
6230
6231 int32 const* existingConfigIdForSystem = target->m_activePlayerData->TraitConfigs.FindIf([&](UF::TraitConfig const& config)
6232 {
6233 return static_cast<TraitConfigType>(*config.Type) == TraitConfigType::Generic
6234 && config.TraitSystemID == newConfig.TraitSystemID
6235 && config.VariationID == newConfig.VariationID;
6236 }).first;
6237
6238 if (!existingConfigIdForSystem)
6239 target->CreateTraitConfig(newConfig);
6240}
6241
6243{
6245 return;
6246
6248 if (!target)
6249 return;
6250
6251 WorldPackets::Traits::TraitConfig* traitConfig = std::any_cast<WorldPackets::Traits::TraitConfig>(&m_customArg);
6252 if (!traitConfig)
6253 return;
6254
6255 target->UpdateTraitConfig(std::move(*traitConfig), GetEffectValueAsInt(), false);
6256}
6257
6259{
6261 return;
6262
6264 if (!target)
6265 return;
6266
6267 target->RepopAtGraveyard();
6268}
6269
6271{
6273 return;
6274
6276 if (!target)
6277 return;
6278
6279 target->UpdateVisibleObjectInteractions(true, false, true, true);
6280}
6281
6283{
6285 return;
6286
6288 if (!target)
6289 return;
6290
6292}
6293
6295{
6297 return;
6298
6300 if (!target)
6301 return;
6302
6304}
6305
6307{
6309 return;
6310
6312 if (!target)
6313 return;
6314
6316}
6317
6319{
6321 return;
6322
6324 if (!target)
6325 return;
6326
6328}
6329
6331{
6333 return;
6334
6336 if (!target)
6337 return;
6338
6340}
6341
6343{
6345 return;
6346
6348 if (!target)
6349 return;
6350
6352}
6353
6355{
6357 return;
6358
6360 if (!target)
6361 return;
6362
6363 Optional<bool> locked;
6364 switch (static_cast<TransmogOutfitEquipAction>(m_misc.EquipTransmogOutfit.EquipAction))
6365 {
6369 locked = true;
6370 break;
6372 locked = false;
6373 break;
6374 default:
6375 break;
6376 }
6377
6378 target->EquipTransmogOutfit(m_misc.EquipTransmogOutfit.TransmogOutfitId, static_cast<TransmogSituationTrigger>(m_misc.EquipTransmogOutfit.SituationTrigger), locked);
6379}
constexpr uint32 ITEM_ID_HEART_OF_AZEROTH
Definition AzeriteItem.h:23
@ SPELL_PET_SUMMONED
@ SPELL_SPIRIT_HEAL_MANA
@ SPELL_RESURRECTION_VISUAL
@ IN_MILLISECONDS
Definition Common.h:38
@ MINUTE
Definition Common.h:32
@ HOUR
Definition Common.h:33
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< MountEquipmentEntry > sMountEquipmentStore("MountEquipment.db2", &MountEquipmentLoadInfo::Instance)
DB2Storage< ChrSpecializationEntry > sChrSpecializationStore("ChrSpecialization.db2", &ChrSpecializationLoadInfo::Instance)
DB2Storage< TraitSystemEntry > sTraitSystemStore("TraitSystem.db2", &TraitSystemLoadInfo::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:579
#define MAX_VEHICLE_SEATS
#define MAX_ITEM_ENCHANTMENT_EFFECTS
TraitConfigType
Definition DBCEnums.h:2871
@ MountEquipmentEffectsSuppressed
@ SKILL_FLAG_ALWAYS_MAX_VALUE
Definition DBCEnums.h:2399
@ ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET
Definition DBCEnums.h:1233
#define MAX_EFFECT_MASK
Definition DBCEnums.h:2451
AzeriteItemMilestoneType
Definition DBCEnums.h:235
ItemContext
Definition DBCEnums.h:1324
TransmogSituationTrigger
Definition DBCEnums.h:2720
@ DIFFICULTY_NONE
Definition DBCEnums.h:936
#define MAX_AZERITE_ESSENCE_RANK
Definition DBCEnums.h:232
#define MAX_AZERITE_ESSENCE_SLOT
Definition DBCEnums.h:231
TransmogOutfitEquipAction
Definition DBCEnums.h:2574
uint8_t uint8
Definition Define.h:156
int64_t int64
Definition Define.h:149
int8_t int8
Definition Define.h:152
int32_t int32
Definition Define.h:150
uint64_t uint64
Definition Define.h:153
#define UI64LIT(N)
Definition Define.h:139
uint16_t uint16
Definition Define.h:155
uint32_t uint32
Definition Define.h:154
std::unordered_set< uint32 > params[2]
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
std::chrono::duration< double, Seconds::period > FloatSeconds
Definition Duration.h:29
@ DYNAMIC_OBJECT_FARSIGHT_FOCUS
@ DYNAMIC_OBJECT_AREA_SPELL
#define ASSERT
Definition Errors.h:72
GameObjectActions
@ GO_JUST_DEACTIVATED
Definition GameObject.h:165
#define FISHING_BOBBER_READY_TIME
Definition GameObject.h:169
uint32 const MinNewsItemLevel
Definition Guild.h:260
@ GUILD_NEWS_ITEM_CRAFTED
Definition Guild.h:244
EnchantmentSlot
@ PERM_ENCHANTMENT_SLOT
@ TEMP_ENCHANTMENT_SLOT
@ PRISMATIC_ENCHANTMENT_SLOT
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
@ ITEM_MODIFIER_BATTLE_PET_DISPLAY_ID
@ ITEM_MODIFIER_BATTLE_PET_BREED_DATA
@ ITEM_MODIFIER_BATTLE_PET_SPECIES_ID
@ ITEM_MODIFIER_BATTLE_PET_LEVEL
ItemRandomBonusListId GenerateItemRandomBonusListId(uint32 item_id)
@ ITEM_CLASS_ARMOR
@ ITEM_CLASS_WEAPON
@ ITEM_FIELD_FLAG_UNLOCKED
@ ITEM_SPELLTRIGGER_ON_LEARN
@ ITEM_FLAG_IS_MILLABLE
@ ITEM_FLAG_IS_PROSPECTABLE
@ ITEM_CHANGED
Definition Item.h:47
@ LANG_ZONE_NOFLYZONE
Definition Language.h:771
#define TC_LOG_DEBUG(filterType__, message__,...)
Definition Log.h:173
#define TC_LOG_ERROR(filterType__, message__,...)
Definition Log.h:182
#define sLog
Definition Log.h:156
#define TC_LOG_WARN(filterType__, message__,...)
Definition Log.h:179
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:103
@ LOOT_MILLING
Definition Loot.h:116
@ LOOT_DISENCHANTING
Definition Loot.h:105
@ LOOT_SKINNING
Definition Loot.h:107
@ LOOT_PROSPECTING
Definition Loot.h:115
@ LOOT_ERROR_ALREADY_PICKPOCKETED
Definition Loot.h:150
#define SPEED_CHARGE
std::variant< std::monostate, Position, Unit const *, float > MovementFacingTarget
TempSummonType
@ TEMPSUMMON_DEAD_DESPAWN
@ TEMPSUMMON_MANUAL_DESPAWN
@ TEMPSUMMON_TIMED_DESPAWN
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
#define DEFAULT_PLAYER_BOUNDING_RADIUS
@ TYPEID_UNIT
Definition ObjectGuid.h:43
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
std::set< ObjectGuid > GuidSet
Definition ObjectGuid.h:432
#define sObjectMgr
Definition ObjectMgr.h:1873
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:98
@ 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:730
std::vector< ItemPosCount > ItemPosCountVec
Definition Player.h:827
@ DAMAGE_FIRE
Definition Player.h:929
@ INVENTORY_SLOT_BAG_END
Definition Player.h:760
TeleportToOptions
Definition Player.h:907
@ TELE_TO_SPELL
Definition Player.h:913
@ TELE_TO_NOT_LEAVE_COMBAT
Definition Player.h:911
@ TELE_TO_NONE
Definition Player.h:908
@ TELE_TO_NOT_LEAVE_TRANSPORT
Definition Player.h:910
constexpr uint8 INVENTORY_SLOT_BAG_0
Definition Player.h:706
@ PLAYER_FLAGS_PET_BATTLES_UNLOCKED
Definition Player.h:536
@ CHEAT_GOD
Definition Player.h:1060
@ ACTION_BUTTON_SPELL
Definition Player.h:365
@ SPEC_RESET_TALENTS
Definition Player.h:244
float constexpr TELEPORT_MIN_LOAD_SCREEN_DISTANCE
Definition Player.h:1206
@ REPUTATION_SOURCE_SPELL
Definition Player.h:401
#define MAPID_INVALID
Definition Position.h:189
@ QUEST_OBJECTIVE_KILL_WITH_LABEL
Definition QuestDef.h:375
QuestStatus
Definition QuestDef.h:142
@ QUEST_STATUS_REWARDED
Definition QuestDef.h:149
@ QUEST_STATUS_INCOMPLETE
Definition QuestDef.h:146
@ QUEST_STATUS_NONE
Definition QuestDef.h:143
@ QUEST_FLAGS_FLAGS_PVP
Definition QuestDef.h:227
@ QUEST_FLAGS_COMPLETION_AREA_TRIGGER
Definition QuestDef.h:216
@ QUEST_FLAGS_COMPLETION_EVENT
Definition QuestDef.h:215
@ QUEST_FLAGS_TRACKING_EVENT
Definition QuestDef.h:224
float rand_norm()
Definition Random.cpp:76
bool roll_chance(float chance, PseudoRandomDistributionState &state)
Definition Random.cpp:131
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:43
@ REST_TYPE_XP
Definition RestMgr.h:29
@ PlayerNonInteractablePhased
#define sScriptMgr
Definition ScriptMgr.h:1449
SpellEffIndex
@ SPELL_ATTR9_JUMPCHARGE__NO_FACING_CONTROL
@ SPELL_ATTR9_MISSILE_SPEED_IS_DELAY_IN_SEC
@ SPELL_ATTR9_FACE_UNIT_TARGET_UPON_COMPLETION_OF_JUMP_CHARGE
@ SPELL_ATTR7_DISPEL_REMOVES_CHARGES
@ SPELL_ATTR7_CAN_BE_MULTI_CAST
@ SPELL_ATTR7_ATTACK_ON_CHARGE_TO_UNIT
SpellEffects
@ 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
@ CLASS_HUNTER
@ GAMEOBJECT_TYPE_DUEL_ARBITER
@ GAMEOBJECT_TYPE_TRAP
@ GAMEOBJECT_TYPE_CHEST
@ GAMEOBJECT_TYPE_FISHINGHOLE
@ GAMEOBJECT_TYPE_GOOBER
@ GAMEOBJECT_TYPE_FISHINGNODE
@ GAMEOBJECT_TYPE_RITUAL
@ SPELL_MISS_REFLECT
@ ITEM_QUALITY_EPIC
@ SPELL_SCHOOL_MASK_NORMAL
@ EVENT_JUMP
@ SPELL_ATTR2_RETAIN_ITEM_CAST
SummonTitle
@ SPELL_ATTR1_DISPEL_ALL_STACKS
@ UNIT_DYNFLAG_LOOTABLE
@ UNIT_DYNFLAG_NONE
@ SUMMON_SLOT_TOTEM
@ OFF_ATTACK
@ BASE_ATTACK
@ RANGED_ATTACK
Mechanics
@ MECHANIC_NONE
GameObjectDestructibleState
Powers
@ MAX_POWERS
@ POWER_RAGE
@ POWER_ENERGY
@ POWER_MANA
@ POWER_FOCUS
@ SPELL_ATTR0_IS_TRADESKILL
#define MAX_TOTEM_SLOT
SpellCastResult
@ SPELL_FAILED_INTERRUPTED_COMBAT
@ SPELL_FAILED_DONT_REPORT
@ SPELL_FAILED_NO_DUELING
@ SPELL_CAST_OK
@ SPELL_FAILED_CANT_ADD_BATTLE_PET
@ SPELLFAMILY_GENERIC
@ SPELLFAMILY_SHAMAN
@ SPELLFAMILY_DEATHKNIGHT
DispelType
ChatMsg
@ GO_STATE_READY
@ SPELL_ATTR4_CANNOT_BE_STOLEN
@ SUMMON_CATEGORY_POSSESSED_VEHICLE
@ SUMMON_CATEGORY_PET
@ SUMMON_CATEGORY_VEHICLE
@ SUMMON_CATEGORY_ALLY
@ SUMMON_CATEGORY_PUPPET
@ SUMMON_CATEGORY_WILD
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_MOUNTED
@ SPELL_AURA_OVERRIDE_SUMMONED_OBJECT
@ SPELL_AURA_MOD_STUN
@ SPELLVALUE_PARENT_SPELL_TARGET_COUNT
@ SPELLVALUE_PARENT_SPELL_TARGET_INDEX
double SpellEffectValue
This is a double instead of float to be able to store full range of int32.
@ TARGET_FLAG_DEST_LOCATION
@ TARGET_FLAG_UNIT_MASK
@ TARGET_FLAG_GAMEOBJECT_MASK
@ TRIGGERED_FULL_MASK
Used when doing CastSpell with triggered == true.
@ TRIGGERED_CAST_DIRECTLY
In Spell::prepare, will be cast directly without setting containers for executed spell.
@ TRIGGERED_IGNORE_CAST_IN_PROGRESS
Will not check if a current cast is in progress.
@ TRIGGERED_IGNORE_POWER_COST
Will ignore power and reagent cost.
@ TRIGGERED_IGNORE_REAGENT_COST
Will ignore reagent cost.
@ TRIGGERED_IGNORE_GCD
Will ignore GCD.
@ TRIGGERED_DONT_REPORT_CAST_ERROR
Will return SPELL_FAILED_DONT_REPORT in CheckCast functions.
@ TRIGGERED_IGNORE_CAST_TIME
Will always be instantly cast.
SpellValueModFloat
@ SPELLVALUE_BASE_POINT0
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:147
bool IsPartOfSkillLine(uint32 skillId, uint32 spellId)
Definition SpellMgr.cpp:119
@ PROC_SPELL_PHASE_HIT
Definition SpellMgr.h:225
#define sSpellMgr
Definition SpellMgr.h:812
@ PROC_SPELL_TYPE_MASK_ALL
Definition SpellMgr.h:216
@ PROC_FLAG_NONE
Definition SpellMgr.h:92
@ PROC_FLAG_2_KNOCKBACK
Definition SpellMgr.h:191
@ PROC_FLAG_2_SUCCESSFUL_DISPEL
Definition SpellMgr.h:194
@ PROC_HIT_DISPEL
Definition SpellMgr.h:249
@ PROC_HIT_INTERRUPT
Definition SpellMgr.h:247
@ PROC_HIT_NONE
Definition SpellMgr.h:234
std::vector< std::pair< uint32, ObjectGuid > > DispelList
Definition Spell.h:272
@ SPELL_EFFECT_HANDLE_LAUNCH_TARGET
Definition Spell.h:267
@ SPELL_EFFECT_HANDLE_LAUNCH
Definition Spell.h:266
@ SPELL_EFFECT_HANDLE_HIT
Definition Spell.h:268
@ SPELL_EFFECT_HANDLE_HIT_TARGET
Definition Spell.h:269
@ SPELL_STATE_CHANNELING
Definition Spell.h:259
@ SPELL_STATE_PREPARING
Definition Spell.h:257
@ UNIT_PET_FLAG_CAN_BE_RENAMED
@ REACT_DEFENSIVE
@ REACT_AGGRESSIVE
@ SPELL_DIRECT_DAMAGE
@ HEAL
@ UNIT_FLAG3_ALREADY_SKINNED
@ COMMAND_STAY
@ UNIT_FLAG_IMMUNE
@ UNIT_FLAG_SKINNABLE
@ UNIT_MASK_MINION
Definition Unit.h:371
UnitMods
Definition Unit.h:177
@ UNIT_MOD_DAMAGE_OFFHAND
Definition Unit.h:218
@ UNIT_MOD_DAMAGE_RANGED
Definition Unit.h:219
@ UNIT_MOD_DAMAGE_MAINHAND
Definition Unit.h:217
@ ALIVE
Definition Unit.h:266
#define CURRENT_FIRST_NON_MELEE_SPELL
Definition Unit.h:615
CurrentSpellTypes
Definition Unit.h:608
@ CURRENT_AUTOREPEAT_SPELL
Definition Unit.h:612
@ UNIT_STATE_CONFUSED
Definition Unit.h:286
@ UNIT_STATE_ROOT
Definition Unit.h:285
@ UNIT_STATE_FLEEING
Definition Unit.h:282
@ UNIT_STATE_ALL_ERASABLE
Definition Unit.h:322
@ UNIT_STATE_STUNNED
Definition Unit.h:278
std::vector< DispelableAura > DispelChargesList
Definition Unit.h:152
@ NULL_BAG
Definition Unit.h:63
@ NULL_SLOT
Definition Unit.h:64
#define ARTIFACTS_ALL_WEAPONS_GENERAL_WEAPON_EQUIPPED_PASSIVE
Definition Unit.h:38
@ TOTAL_PCT
Definition Unit.h:166
T AddPct(T &base, U pct)
Definition Util.h:85
constexpr std::underlying_type< E >::type AsUnderlyingType(E enumValue)
Definition Util.h:565
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:88
void AddEffectToApplyEffectMask(SpellEffIndex spellEffectIndex)
Aura * GetBase() const
Definition SpellAuras.h:82
static Aura * TryCreate(AuraCreateInfo &createInfo)
void SetStackAmount(uint8 num)
AuraApplication const * GetApplicationOfTarget(ObjectGuid guid) const
DynamicObject * GetDynobjOwner() const
Definition SpellAuras.h:197
void _RegisterForTargets()
Definition SpellAuras.h:209
ObjectGuid GetCasterGUID() const
Definition SpellAuras.h:187
bool IsRemoved() const
Definition SpellAuras.h:254
uint32 GetId() const
Definition SpellAuras.h:183
int32 CalcDispelChance(Unit const *auraTarget, bool offensive) const
DynObjAura * ToDynObjAura()
Definition SpellAuras.h:351
bool ModStackAmount(int32 num, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT, bool resetPeriodicTimer=true)
uint8 GetStackAmount() const
Definition SpellAuras.h:238
void _ApplyEffectForTargets(uint8 effIndex)
uint8 GetCharges() const
Definition SpellAuras.h:229
SpellInfo const * GetSpellInfo() const
Definition SpellAuras.h:182
bool IsPassive() const
UF::SelectedAzeriteEssences const * GetSelectedAzeriteEssences() const
void SetEssenceRank(uint32 azeriteEssenceId, uint32 rank)
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
bool IsInWorld() const
Definition BaseEntity.h:158
bool IsCreature() const
Definition BaseEntity.h:172
bool IsPlayer() const
Definition BaseEntity.h:173
TypeID GetTypeId() const
Definition BaseEntity.h:166
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 AddWarbandScene(uint32 warbandSceneId)
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:108
static float GetRangeForChatType(ChatMsg msgType)
std::unique_ptr< Loot > m_loot
Definition Creature.h:307
CreatureDifficulty const * GetCreatureDifficulty() const
Definition Creature.h:276
std::unordered_map< ObjectGuid, std::unique_ptr< Loot > > m_personalLoot
Definition Creature.h:308
uint8 GetLevelForTarget(WorldObject const *target) const override
void StartPickPocketRefillTimer()
void SetReactState(ReactStates st)
Definition Creature.h:180
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
bool CanGeneratePickPocketLoot() const
bool IsElite() const
void SetImmuneToAll(bool apply) override
Definition Creature.h:187
bool IsIgnoringSanctuarySpellEffect() const
Definition Creature.h:354
void SetDisplayId(uint32 displayId, bool setNative=false) override
uint32 GetResist() const
Definition Unit.h:469
uint32 GetDamage() const
Definition Unit.h:466
uint32 GetAbsorb() const
Definition Unit.h:468
DelayedSpellTeleportEvent(Unit *target, TeleportLocation 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:209
uint32 GetFaction() const override
Definition GameObject.h:403
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:241
void SetDestructibleState(GameObjectDestructibleState state, WorldObject *attackerOrHealer=nullptr, bool setHealth=false)
void AddToSkillupList(ObjectGuid const &PlayerGuidLow)
Definition GameObject.h:322
void SetLootState(LootState s, Unit *unit=nullptr)
GameObject * GetLinkedTrap()
void SetRespawnTime(int32 respawn)
bool IsInSkillupList(ObjectGuid const &playerGuid) const
Definition GameObject.h:323
void Use(Unit *user, bool ignoreCastInProgress=false)
void SetLevel(uint32 level)
Definition GameObject.h:287
void ModifyHealth(int32 change, WorldObject *attackerOrHealer=nullptr, uint32 spellId=0)
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:253
void SetFaction(uint32 faction) override
Definition GameObject.h:404
Definition Group.h:209
bool IsAssistant(ObjectGuid guid) const
Definition Group.h:323
void AddRaidMarker(uint8 markerId, uint32 mapId, float positionX, float positionY, float positionZ, ObjectGuid transportGuid=ObjectGuid::Empty)
Definition Group.cpp:1546
bool IsLeader(ObjectGuid guid) const
Definition Group.cpp:1660
ObjectGuid GetGUID() const
Definition Group.cpp:1623
bool isRaidGroup() const
Definition Group.cpp:1598
Definition Guild.h:329
Definition Item.h:185
void SetState(ItemUpdateState state, Player *forplayer=nullptr)
Definition Item.cpp:1258
uint8 GetSlot() const
Definition Item.h:296
void SetItemFlag(ItemFieldFlags flags)
Definition Item.h:224
std::span< ItemEffectEntry const *const > GetEffects() const
Definition Item.h:370
uint32 GetEnchantmentId(EnchantmentSlot slot) const
Definition Item.h:314
bool IsVellum() const
Definition Item.h:350
bool IsAzeriteEmpoweredItem() const
Definition Item.h:270
AzeriteItem * ToAzeriteItem()
Definition Item.h:259
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const
Definition Item.h:315
void SetCount(uint32 value)
Definition Item.cpp:1367
void SetModifier(ItemModifier modifier, uint32 value)
Definition Item.cpp:2515
ItemTemplate const * GetTemplate() const
Definition Item.cpp:1233
UF::UpdateField< UF::ItemData, uint32(WowCS::EntityFragment::CGObject), TYPEID_ITEM > m_itemData
Definition Item.h:464
ItemContext GetContext() const
Definition Item.h:456
bool IsEquipped() const
Definition Item.cpp:1336
Player * GetOwner() const
Definition Item.cpp:1238
ObjectGuid GetOwnerGUID() const
Definition Item.h:203
uint16 GetPos() const
Definition Item.h:300
Optional< uint32 > GetDisenchantLootId() const
Definition Item.cpp:2410
std::unique_ptr< Loot > m_loot
Definition Item.h:334
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const
Definition Item.h:316
void ClearSoulboundTradeable(Player *currentOwner)
Definition Item.cpp:1969
uint32 GetCount() const
Definition Item.h:289
AzeriteEmpoweredItem * ToAzeriteEmpoweredItem()
Definition Item.h:261
uint8 GetBagSlot() const
Definition Item.cpp:1331
uint32 GetModifier(ItemModifier modifier) const
Definition Item.cpp:2502
void SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges, ObjectGuid caster=ObjectGuid::Empty)
Definition Item.cpp:1511
static Item * CreateItem(uint32 itemEntry, uint32 count, ItemContext context, Player const *player=nullptr, bool addDefaultBonuses=true)
Definition Item.cpp:1721
Definition Map.h:227
bool IsDungeon() const
Definition Map.cpp:3303
bool AddToMap(T *)
Definition Map.cpp:527
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:1191
ObjectGuid::LowType GenerateLowGuid()
Definition Map.h:564
GameObject * GetGameObject(ObjectGuid const &guid)
Definition Map.cpp:3588
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:3578
Unit * GetOwner() const
float GetFollowAngle() const override
void MoveJump(uint32 id, Position const &pos, std::variant< std::monostate, float, Milliseconds > speedOrTime={}, Optional< float > minHeight={}, Optional< float > maxHeight={}, MovementFacingTarget const &facing={}, bool orientationFixed=false, bool unlimitedSpeed=false, Optional< float > speedMultiplier={}, JumpArrivalCastArgs const *arrivalCast=nullptr, Movement::SpellEffectExtraData const *spellEffectExtraData=nullptr, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
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:314
bool IsEmpty() const
Definition ObjectGuid.h:362
std::string ToString() const
void Clear()
Definition ObjectGuid.h:329
void SetDynamicFlag(uint32 flag)
Definition Object.h:97
Player * ToPlayer()
Definition Object.h:126
GameObject * ToGameObject()
Definition Object.h:131
void ReplaceAllDynamicFlags(uint32 flag)
Definition Object.h:99
uint32 GetEntry() const
Definition Object.h:89
Creature * ToCreature()
Definition Object.h:121
Unit * ToUnit()
Definition Object.h:116
float GetPathLength() const
bool CalculatePath(float srcX, float srcY, float srcZ, float destX, float destY, float destZ, bool forceDest=false)
std::array< Optional< PetInfo >, MAX_ACTIVE_PETS > ActivePets
Definition PetDefines.h:169
Definition Pet.h:40
void SetSpecialization(uint16 spec)
Definition Pet.cpp:1913
Player * GetOwner() const
Definition Pet.cpp:1809
void SavePetToDB(PetSaveMode mode)
Definition Pet.cpp:451
bool isControlled() const
Definition Pet.h:53
void setDeathState(DeathState s) override
Definition Pet.cpp:598
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition Pet.cpp:711
void SendNewlyTamed(bool playPingFx=true) const
Definition Pet.cpp:838
bool learnSpell(uint32 spell_id)
Definition Pet.cpp:1462
static void InheritPhaseShift(WorldObject *target, WorldObject const *source)
static bool OnConditionChange(WorldObject *object, bool updateVisibility=true)
bool HasIgnore(ObjectGuid const &ignoreGuid, ObjectGuid const &ignoreAccountGuid)
void SendMovieStart(uint32 movieId)
Definition Player.cpp:6207
void SendLootError(ObjectGuid const &lootObj, ObjectGuid const &owner, LootError error) const
Definition Player.cpp:9104
ChrSpecialization GetPrimarySpecialization() const
Definition Player.h:1993
void SendEquipError(InventoryResult msg, Item const *item1=nullptr, Item const *item2=nullptr, uint32 itemId=0) const
Definition Player.cpp:13048
UF::UpdateField< UF::PlayerData, int32(WowCS::EntityFragment::CGObject), TYPEID_PLAYER > m_playerData
Definition Player.h:3047
void KilledMonsterCredit(uint32 entry, ObjectGuid guid=ObjectGuid::Empty)
Definition Player.cpp:16646
void SetDataFlagCharacter(uint32 dataFlagId, bool on)
Definition Player.cpp:30385
void SendPlayerBound(ObjectGuid const &binderGuid, uint32 areaId) const
Definition Player.cpp:17919
uint32 GetArmorProficiency() const
Definition Player.h:1625
static bool IsEquipmentPos(uint16 pos)
Definition Player.h:1472
void ApplyAzeriteEssence(AzeriteItem *item, uint32 azeriteEssenceId, uint32 rank, bool major, bool apply)
Definition Player.cpp:8526
uint8 GetNumRespecs() const
Definition Player.h:2996
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:11288
bool HasPvPForcingQuest() const
Definition Player.cpp:17487
uint32 GetNextResetTalentsCost() const
Definition Player.cpp:3380
bool ModifyMoney(int64 amount, bool sendError=true)
Definition Player.cpp:24800
InventoryResult CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading=true) const
Definition Player.cpp:10709
void SetPlayerFlag(PlayerFlags flags)
Definition Player.h:2896
void SetCanTitanGrip(bool value, uint32 penaltySpellId=0, int32 allowedItemClass=0, int32 allowedItemSubClassMask=0)
Definition Player.cpp:13144
PlayerSocial * GetSocial() const
Definition Player.h:1274
void SetVisibleItemSlot(uint8 slot, Item const *item)
Definition Player.cpp:11748
void SendBindPointUpdate() const
Definition Player.cpp:17910
uint32 EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
Definition Player.cpp:618
uint8 GetDrunkValue() const
Definition Player.h:2462
void SendDirectMessage(WorldPacket const *data) const
Definition Player.cpp:6193
uint16 GetSkillValue(uint32 skill) const
Definition Player.cpp:5920
Item * BankItem(ItemPosCountVec const &dest, Item *pItem, bool update)
Definition Player.cpp:11902
void RemoveTalent(TalentEntry const *talent)
Definition Player.cpp:2624
void DespawnPersonalSummonsForQuest(uint32 questId)
Definition Player.cpp:16281
UF::UpdateField< UF::ActivePlayerData, int32(WowCS::EntityFragment::CGObject), TYPEID_ACTIVE_PLAYER > m_activePlayerData
Definition Player.h:3048
void SetCanParry(bool value)
Definition Player.cpp:26841
void UpdateQuestObjectiveProgress(QuestObjectiveType objectiveType, int32 objectId, int64 addCount, ObjectGuid victimGuid=ObjectGuid::Empty, std::vector< QuestObjective const * > *updatedObjectives=nullptr, std::function< bool(QuestObjective const *)> const *objectiveFilter=nullptr)
Definition Player.cpp:16704
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap=false) const
Definition Player.cpp:9975
void CreateGarrison(uint32 garrSiteId)
Definition Player.cpp:30062
Pet * SummonPet(uint32 entry, Optional< PetSaveMode > slot, float x, float y, float z, float ang, uint32 despwtime, bool *isNew=nullptr)
Definition Player.cpp:30440
void SendProficiency(ItemClass itemClass, uint32 itemSubclassMask) const
Definition Player.cpp:23044
void SendTalentsInfoData()
Definition Player.cpp:28051
void UpdatePvPState(bool onlyFFA=false)
Definition Player.cpp:24013
void DurabilityLossAll(double percent, bool inventory)
Definition Player.cpp:4466
void AddHonorXP(uint32 xp)
Definition Player.cpp:6849
uint32 GetDeathTimer() const
Definition Player.h:2468
void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const &store, ItemContext context=ItemContext::NONE, bool broadcast=false, bool pushed=false, bool createdByPlayer=false)
Definition Player.cpp:27123
void SendPlayerChoice(ObjectGuid sender, int32 choiceId)
Definition Player.cpp:30097
void _ApplyItemMods(Item *item, uint8 slot, bool apply, bool updateItemAuras=true)
Definition Player.cpp:7807
void GiveXP(uint32 xp, Unit *victim, float group_rate=1.0f)
Definition Player.cpp:2110
void SetResurrectRequestData(WorldObject const *caster, uint32 health, uint32 mana, uint32 appliedAura)
Definition Player.cpp:24070
Item * GetItemByEntry(uint32 entry, ItemSearchLocation where=ItemSearchLocation::Default) const
Definition Player.cpp:12393
void SpawnCorpseBones(bool triggerSave=true)
Definition Player.cpp:4453
void SetDrunkValue(uint8 newDrunkValue, uint32 itemId=0)
Definition Player.cpp:842
std::vector< uint32 > const & GetGlyphs(uint8 spec) const
Definition Player.h:2030
PetStable * GetPetStable()
Definition Player.h:1339
void PetSpellInitialize()
Definition Player.cpp:22418
SceneMgr & GetSceneMgr()
Definition Player.h:2873
void SetFallInformation(uint32 time, float z)
Definition Player.cpp:27437
void ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool apply_dur=true, bool ignore_condition=false)
Definition Player.cpp:13412
bool IsLoading() const override
Definition Player.cpp:17925
void ActivateTalentGroup(ChrSpecializationEntry const *spec)
Definition Player.cpp:28786
bool UpdateCraftSkill(SpellInfo const *spellInfo)
Definition Player.cpp:5409
bool CanAddQuest(Quest const *quest, bool msg) const
Definition Player.cpp:14491
InventoryResult CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap, bool not_loading=true, bool reagentBankOnly=false) const
Definition Player.cpp:10975
void SetSkill(uint32 id, uint16 step, uint16 newVal, uint16 maxVal)
Definition Player.cpp:5654
void UpdateVisibleObjectInteractions(bool allUnits, bool onlySpellClicks, bool gameObjectQuestGiverStatus, bool questObjectiveGameObjects)
Definition Player.cpp:25880
Pet * GetPet() const
Definition Player.cpp:22007
WorldLocation m_homebind
Definition Player.h:2679
Guild * GetGuild()
Definition Player.cpp:30428
void SetNumRespecs(uint8 numRespecs)
Definition Player.h:2997
uint16 GetPureSkillValue(uint32 skill) const
Definition Player.cpp:5976
void RemoveTradeableItem(Item *item)
Definition Player.cpp:13249
void CompleteQuest(uint32 quest_id)
Definition Player.cpp:14893
void SetCanBlock(bool value)
Definition Player.cpp:26850
bool GetCommandStatus(uint32 command) const
Definition Player.h:1323
Item * StoreItem(ItemPosCountVec const &pos, Item *pItem, bool update)
Definition Player.cpp:11365
WorldSession * GetSession() const
Definition Player.h:2256
void LearnSpell(uint32 spell_id, bool dependent, int32 fromSkill=0, bool suppressMessaging=false, Optional< PlayerSpellTrait > trait={})
Definition Player.cpp:3083
void UpdateAreaDependentAuras(uint32 area_id)
Definition Player.cpp:26487
Item * GetItemByPos(uint16 pos) const
Definition Player.cpp:9538
void EquipTransmogOutfit(uint32 id, TransmogSituationTrigger trigger, Optional< bool > locked)
Definition Player.cpp:31176
RestMgr & GetRestMgr() const
Definition Player.h:2875
void RepopAtGraveyard()
Definition Player.cpp:4687
void SendNewItem(Item *item, uint32 quantity, bool pushed, bool created, bool broadcast=false, uint32 dungeonEncounterId=0)
Definition Player.cpp:13835
void SetDataElementCharacter(uint32 dataElementId, std::variant< int64, float > value)
Definition Player.cpp:30308
void DestroyItem(uint8 bag, uint8 slot, bool update)
Definition Player.cpp:12039
bool IsResurrectRequested() const
Definition Player.h:2087
static bool IsInventoryPos(uint16 pos)
Definition Player.h:1470
void SendLoot(Loot &loot, bool aeLooting=false)
Definition Player.cpp:9075
void UpdateTraitConfig(WorldPackets::Traits::TraitConfig &&newConfig, int32 savedConfigId, bool withCastTime)
Definition Player.cpp:29141
uint32 DestroyItemCount(uint32 item, uint32 count, bool update, bool unequip_check=false)
Definition Player.cpp:12140
void RemovePet(Pet *pet, PetSaveMode mode, bool returnreagent=false)
Definition Player.cpp:22031
int32 CalculateReputationGain(ReputationSource source, uint32 creatureOrQuestLevel, int32 rep, int32 faction, bool noQuestBonus=false)
Definition Player.cpp:6422
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, TeleportToOptions options=TELE_TO_NONE, Optional< uint32 > instanceId={}, uint32 teleportSpellId=0)
Definition Player.cpp:1181
ActionButton const * GetActionButton(uint8 button)
Definition Player.cpp:6133
void DurabilityLoss(Item *item, double percent)
Definition Player.cpp:4490
uint32 GetWeaponProficiency() const
Definition Player.h:1624
void SendRespecWipeConfirm(ObjectGuid const &guid, uint32 cost, SpecResetType respecType) const
Definition Player.cpp:9164
uint16 GetSkillStep(uint32 skill) const
Definition Player.cpp:5908
void SetDataElementAccount(uint32 dataElementId, std::variant< int64, float > value)
Definition Player.cpp:30254
void AutoUnequipOffhandIfNeed(bool force=false)
Definition Player.cpp:26101
void ItemAddedQuestCheck(uint32 entry, uint32 count, Optional< bool > boundItemFlagRequirement={}, bool *hadBoundItemObjective=nullptr)
Definition Player.cpp:16566
Item * EquipItem(uint16 pos, Item *pItem, bool update)
Definition Player.cpp:11507
void SetDuelArbiter(ObjectGuid guid)
Definition Player.h:2130
PvPInfo pvpInfo
Definition Player.h:2107
void AddQuestAndCheckCompletion(Quest const *quest, Object *questGiver)
Definition Player.cpp:14633
void DurabilityPointsLossAll(int32 points, bool inventory)
Definition Player.cpp:4510
bool CanTakeQuest(Quest const *quest, bool msg) const
Definition Player.cpp:14479
uint32 GetProfessionSkillForExp(uint32 skill, int32 expansion) const
Definition Player.cpp:5873
uint8 GetActiveTalentGroup() const
Definition Player.h:1995
void RemoveSpell(uint32 spell_id, bool disabled=false, bool learn_low_rank=true, bool suppressMessaging=false)
Definition Player.cpp:3128
void SendSummonRequestFrom(Unit *summoner)
Definition Player.cpp:26005
void AreaExploredOrEventHappens(uint32 questId)
Definition Player.cpp:16519
bool TakeQuestSourceItem(uint32 questId, bool msg)
Definition Player.cpp:15878
void RemoveActiveQuest(uint32 questId, bool update=true)
Definition Player.cpp:15972
QuestStatus GetQuestStatus(uint32 quest_id) const
Definition Player.cpp:15929
Garrison * GetGarrison() const
Definition Player.h:2868
void CreateTraitConfig(WorldPackets::Traits::TraitConfig &traitConfig)
Definition Player.cpp:29068
void AddArmorProficiency(uint32 newflag)
Definition Player.h:1623
void SetHomebind(WorldLocation const &loc, uint32 areaId)
Definition Player.cpp:17893
void FailQuest(uint32 quest_id)
Definition Player.cpp:15314
bool ActivateTaxiPathTo(std::vector< uint32 > const &nodes, Creature *npc=nullptr, uint32 spellid=0, uint32 preferredMountDisplay=0, Optional< float > speed={}, Scripting::v2::ActionResultSetter< MovementStopReason > const &scriptResult={})
Definition Player.cpp:23106
static bool IsBankPos(uint16 pos)
Definition Player.h:1475
void RemoveItem(uint8 bag, uint8 slot, bool update)
Definition Player.cpp:11907
bool HasSpell(uint32 spell) const override
Definition Player.cpp:3626
Group * GetGroup(Optional< uint8 > partyIndex)
Definition Player.h:2781
std::unique_ptr< DuelInfo > duel
Definition Player.h:2126
void RemoveRewardedQuest(uint32 questId, bool update=true)
Definition Player.cpp:16005
void DurabilityPointsLoss(Item *item, int32 points)
Definition Player.cpp:4534
Item * GetItemByGuid(ObjectGuid guid) const
Definition Player.cpp:9522
void SetDataFlagAccount(uint32 dataFlagId, bool on)
Definition Player.cpp:30348
void RemovedInsignia(Player *looterPlr)
Definition Player.cpp:9018
bool UpdateGatherSkill(uint32 skillId, uint32 skillValue, uint32 redLevel, uint32 multiplicator=1, WorldObject const *object=nullptr)
Definition Player.cpp:5444
void AddWeaponProficiency(uint32 newflag)
Definition Player.h:1622
void ModifyCurrency(uint32 id, int32 amount, CurrencyGainSource gainSource=CurrencyGainSource::Cheat, CurrencyDestroyReason destroyReason=CurrencyDestroyReason::Cheat)
Modify currency amount.
Definition Player.cpp:7036
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 item, uint32 count, uint32 *no_space_count=nullptr) const
Definition Player.cpp:9970
std::unique_ptr< PlayerMenu > PlayerTalkClass
Definition Player.h:2556
ReputationMgr & GetReputationMgr()
Definition Player.h:2422
void AddPetAura(PetAura const *petSpell)
Definition Player.cpp:22175
void RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject *pRewardSource)
Definition Player.cpp:26350
void ResurrectPlayer(float restore_percent, bool applySickness=false)
Definition Player.cpp:4269
uint32 XPValue(Player const *player) const
Definition QuestDef.cpp:428
bool HasFlag(QuestFlags flag) const
Definition QuestDef.h:615
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:158
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)
void SetItemTarget(Item *item)
Definition Spell.cpp:263
void SetDst(float x, float y, float z, float orientation, uint32 mapId=MAPID_INVALID)
Definition Spell.cpp:341
void SetGOTarget(GameObject *target)
Definition Spell.cpp:220
void SetUnitTarget(Unit *target)
Definition Spell.cpp:194
bool HasDst() const
Definition Spell.cpp:393
Item * GetItemTarget() const
Unit * GetUnitTarget() const
Definition Spell.cpp:186
void Update(WorldObject *caster)
Definition Spell.cpp:398
WorldLocation const * GetDstPos() const
Definition Spell.cpp:336
float PositionFacing
Definition SpellInfo.h:227
bool HasRadius(SpellTargetIndex targetIndex) const
SpellEffectValue CalcValue(WorldObject const *caster=nullptr, SpellEffectValue const *basePoints=nullptr, Unit const *target=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
float CalcValueMultiplier(WorldObject *caster, Spell *spell=nullptr) const
uint32 TriggerSpell
Definition SpellInfo.h:234
SpellEffects Effect
Definition SpellInfo.h:215
bool IsEffect() const
SpellRange CalcRadius(WorldObject const *caster=nullptr, SpellTargetIndex targetIndex=SpellTargetIndex::TargetA, Spell *spell=nullptr) const
SpellEffIndex EffectIndex
Definition SpellInfo.h:214
uint32 GetProvidedTargetMask() const
void RestoreCharge(uint32 chargeCategoryId)
void LockSpellSchool(SpellSchoolMask schoolMask, Duration lockoutTime)
void ModifyCoooldowns(Predicate &&predicate, Duration cooldownMod, bool withoutCategoryCooldown=false)
void ModifyCooldown(uint32 spellId, Duration cooldownMod, bool withoutCategoryCooldown=false)
bool HasCooldown(SpellInfo const *spellInfo, uint32 itemId=0) const
SpellRange GetMinMaxRange(bool positive=false, WorldObject const *caster=nullptr, Spell *spell=nullptr) const
Optional< SpellPowerCost > CalcPowerCost(Powers powerType, bool optionalCost, WorldObject const *caster, SpellSchoolMask schoolMask, Spell *spell=nullptr) const
uint64 GetAllEffectsMechanicMask() const
uint32 const Id
Definition SpellInfo.h:328
uint32 StackAmount
Definition SpellInfo.h:396
bool IsLootCrafting() const
uint32 GetDispelMask() const
bool NeedsToBeTriggeredByCaster(SpellInfo const *triggeringSpell) const
float Speed
Definition SpellInfo.h:393
int32 EquippedItemClass
Definition SpellInfo.h:402
flag128 SpellFamilyFlags
Definition SpellInfo.h:415
SpellSchoolMask GetSchoolMask() const
bool IsChanneled() const
bool HasAttribute(SpellAttr0 attribute) const
Definition SpellInfo.h:456
int32 GetDuration() const
SpellEffectInfo const & GetEffect(SpellEffIndex index) const
Definition SpellInfo.h:590
std::vector< SpellEffectInfo > const & GetEffects() const
Definition SpellInfo.h:589
int32 EquippedItemSubClassMask
Definition SpellInfo.h:403
uint32 GetExplicitTargetMask() const
int32 CalcDuration(WorldObject const *caster=nullptr) const
bool HasAura(AuraType aura) const
uint32 SpellFamilyName
Definition SpellInfo.h:414
bool CanBeInterrupted(WorldObject const *interruptCaster, Unit const *interruptTarget, bool ignoreImmunity=false) const
Definition Spell.h:277
void EffectSummonRaFFriend()
SpellInfo const * GetSpellInfo() const
Definition Spell.h:702
void EffectSendEvent()
void EffectTransmitted()
void EffectUpgradeHeirloom()
void EffectSpiritHeal()
void EffectRemoveAuraBySpellLabel()
void EffectBlock()
void EffectPlayMusic()
void EffectChangeBattlePetQuality()
GameObject * gameObjTarget
Definition Spell.h:799
void EffectGrantBattlePetExperience()
SpellMissInfo targetMissInfo
Definition Spell.h:804
void ExecuteLogEffectTakeTargetPower(SpellEffects effect, Unit *target, Powers powerType, uint32 points, float amplitude)
Definition Spell.cpp:5087
void UpdateDelayMomentForUnitTarget(Unit *unit, uint64 hitDelay)
Definition Spell.cpp:918
void EffectCreateItem2()
void EffectEnchantHeldItem()
Unit * m_originalCaster
Definition Spell.h:751
void EffectHealMaxHealth()
void EffectProspecting()
DynObjAura * _dynObjAura
Definition Spell.h:811
void EffectSetPlayerDataFlagCharacter()
void EffectCharge()
void EffectSummonObject()
void EffectSendTaxi()
void EffectCreateItem()
void EffectTameCreature()
void EffectGameObjectDamage()
SpellCastTargets m_targets
Definition Spell.h:651
void EffectSummonChangeItem()
void EffectDummy()
std::unique_ptr< PathGenerator > m_preGeneratedPath
Definition Spell.h:1001
Difficulty GetCastDifficulty() const
Definition Spell.cpp:8172
void EffectLearnAzeriteEssencePower()
void ExecuteLogEffectExtraAttacks(SpellEffects effect, Unit *victim, uint32 numAttacks)
Definition Spell.cpp:5099
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:8655
void EffectEnchantItemPrismatic()
void EffectSummonType()
void EffectSkinPlayerCorpse()
SpellEffectHandleMode effectHandleMode
Definition Spell.h:806
void EffectEquipTransmogOutfit()
void SummonGuardian(SpellEffectInfo const *effect, uint32 entry, SummonPropertiesEntry const *properties, uint32 numSummons, ObjectGuid privateObjectOwner)
void EffectHealMechanical()
void EffectGameObjectRepair()
void EffectCreateGarrison()
void EffectSummonObjectWild()
void EffectSendChatMessage()
void ExecuteLogEffectDurabilityDamage(SpellEffects effect, Unit *victim, int32 itemId, int32 amount)
Definition Spell.cpp:5119
uint32 Id
Definition Spell.h:626
void EffectActivateObject()
std::vector< TargetInfo > m_UniqueTargetInfo
Definition Spell.h:878
void EffectSkill()
SpellDestination m_destTargets[MAX_SPELL_EFFECTS]
Definition Spell.h:910
void EffectSetPlayerDataElementCharacter()
void ExecuteLogEffectCreateItem(SpellEffects effect, uint32 entry)
Definition Spell.cpp:5137
void EffectLeap()
void UpdateDelayMomentForDst(uint64 hitDelay)
Definition Spell.cpp:910
void EffectTradeSkill()
void EffectPersistentAA()
void EffectQuestClear()
void EffectModifyThreatPercent()
void EffectForceDeselect()
int32 GetEffectValueAsInt() const
Definition Spell.h:803
void EffectParry()
void EffectRenamePet()
void EffectResurrect()
void EffectDestroyAllTotems()
WeaponAttackType m_attackType
Definition Spell.h:755
void EffectCreateTraitTreeConfig()
void EffectResurrectPet()
void EffectApplyEnchantIllusion()
void EffectTriggerSpell()
SpellEffectValue CalculateDamage(SpellEffectInfo const &spellEffectInfo, Unit const *target, float *var=nullptr) const
Definition Spell.cpp:7199
void EffectGiveHonor()
void SendSpellInterruptLog(Unit *victim, uint32 spellId)
Definition Spell.cpp:5108
std::any m_customArg
Definition Spell.h:649
void EffectPullTowards()
ObjectGuid m_originalCasterGUID
Definition Spell.h:749
WorldObject *const m_caster
Definition Spell.h:745
void EffectCreatePrivateSceneObject()
void EffectRechargeItem()
void EffectLearnGarrisonBuilding()
void EffectPowerBurn()
void EffectUpdateInteractions()
std::string GetDebugInfo() const
Definition Spell.cpp:9245
void EffectDurabilityDamage()
void EffectKillCreditLabel()
void EffectSanctuary()
void ExecuteLogEffectOpenLock(SpellEffects effect, Object *obj)
Definition Spell.cpp:5129
void EffectHealBattlePetPct()
void EffectCastButtons()
Item * itemTarget
Definition Spell.h:798
float variance
Definition Spell.h:805
int32 m_damage
Definition Spell.h:818
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()
SpellEffectValue effectValue
Definition Spell.h:802
void EffectEnergizePct()
void EffectDispelMechanic()
void EffectSelfResurrect()
void EffectGiveRestedExperience()
void EffectDispel()
void EffectBind()
void SendSpellCooldown()
Definition Spell.cpp:4229
void EffectLearnTransmogIllusion()
void EffectPlayMovie()
void EffectFeedPet()
void EffectNULL()
void EffectApplyAura()
void EffectUncageBattlePet()
void EffectTriggerRitualOfSummoning()
void EffectInstaKill()
void EffectCreateAreaTrigger()
void EffectInebriate()
void ExecuteLogEffectDestroyItem(SpellEffects effect, uint32 entry)
Definition Spell.cpp:5145
void EffectOpenLock()
void EffectEnvironmentalDMG()
void EffectRedirectThreat()
void EffectChangeActiveCombatTraitConfig()
void EffectLearnTransmogSet()
void EffectRemoveAura()
void EffectDualWield()
void ExecuteLogEffectSummonObject(SpellEffects effect, WorldObject *obj)
Definition Spell.cpp:5153
void EffectUpdatePlayerPhase()
int32 m_healing
Definition Spell.h:819
void EffectPickPocket()
void EffectTeleportUnitsWithVisualLoadingScreen()
void EffectModifyAuraStacks()
void EffectProficiency()
void EffectSummonPersonalGameObject()
SpellEffectInfo const * effectInfo
Definition Spell.h:807
void EffectDisEnchant()
void EffectEnableBattlePets()
void EffectGiveArtifactPowerNoBonus()
Unit * GetUnitCasterForEffectHandlers() const
Definition Spell.cpp:8356
void EffectTeleportToReturnPoint()
void EffectAddExtraAttacks()
int32 m_castItemLevel
Definition Spell.h:603
void EffectTriggerMissileSpell()
UnitAura * _spellAura
Definition Spell.h:810
void EffectModifyCooldown()
Unit * unitTarget
Definition Spell.h:797
void EffectEnchantItemTmp()
SpellSchoolMask m_spellSchoolMask
Definition Spell.h:754
void EffectCreateRandomItem()
void EffectTeleUnitsFaceCaster()
void EffectDamageFromMaxHealthPCT()
void EffectCreateHeirloomItem()
WorldObject * GetCaster() const
Definition Spell.h:699
void EffectPullTowardsDest()
void EffectSetPlayerDataElementAccount()
union Spell::@323 m_misc
void EffectKillCreditPersonal()
void EffectLaunchQuestChoice()
void EffectSchoolDMG()
void EffectChangeRaidMarker()
void EffectGrantBattlePetLevel()
void EffectThreat()
Corpse * m_corpseTarget
Definition Spell.h:800
void EffectResurrectNew()
void EffectChargeDest()
void EffectUntrainTalents()
void EffectUnlockGuildVaultTab()
void EffectLearnSpell()
void EffectMilling()
void EffectHealPct()
void EffectJumpCharge()
void EffectJumpDest()
void EffectScriptEffect()
void EffectAddFarsight()
void EffectEnergize()
void EffectCreateSceneObject()
WorldLocation * destTarget
Definition Spell.h:801
void EffectGameObjectSetDestructionState()
void EffectIncreaseCurrencyCap()
void EffectApplyGlyph()
void EffectResurrectWithAura()
void EffectGiveCurrency()
void EffectModifyCooldowns()
void EffectQuestComplete()
static void SendCastResult(Player const *caster, SpellInfo const *spellInfo, SpellCastVisual spellVisual, ObjectGuid cast_count, SpellCastResult result, SpellCustomErrors customError=SPELL_CUSTOM_ERROR_NONE, int32 *param1=nullptr, int32 *param2=nullptr)
Definition Spell.cpp:4641
void EffectDiscoverTaxi()
void EffectModifySpellCharges()
void EffectForceCast2()
void EffectTeleportUnits()
void EffectGiveExperience()
void EffectCreatePrivateConversation()
void EffectPlaySceneScriptPackage()
void EffectPlaySound()
void EffectLearnPetSpell()
void EffectTeleportGraveyard()
void EffectPowerDrain()
Item * m_CastItem
Definition Spell.h:600
void CallScriptSuccessfulDispel(SpellEffIndex effIndex)
Definition Spell.cpp:8909
uint32 m_castItemEntry
Definition Spell.h:602
int32 GetUnitTargetIndexForEffect(ObjectGuid const &target, SpellEffIndex effect) const
Definition Spell.cpp:2695
void EffectTaunt()
void EffectLeapBack()
void EffectDurabilityDamagePCT()
SpellValue *const m_spellValue
Definition Spell.h:747
void EffectLearnSkill()
void finish(SpellCastResult result=SPELL_CAST_OK)
Definition Spell.cpp:4359
void SendResurrectRequest(Player *target)
Definition Spell.cpp:5349
void EffectActivateSpec()
void EffectForceCast()
void EffectDismissPet()
void EffectPlayScene()
void EffectEnchantItemPerm()
void EffectQuestFail()
void EffectCreateTamedPet()
void EffectSetPlayerDataFlagAccount()
void EffectAddGarrisonFollower()
void EffectLearnWarbandScene()
void EffectJump()
void EffectSkipQuestLine()
void EffectDestroyItem()
ObjectGuid m_castItemGUID
Definition Spell.h:601
void EffectRemoveTalent()
SpellCastVisual m_SpellVisual
Definition Spell.h:650
int64 GetUnitTargetCountForEffect(SpellEffIndex effect) const
Definition Spell.cpp:2712
void ExecuteLogEffectUnsummonObject(SpellEffects effect, WorldObject *obj)
Definition Spell.cpp:5161
GameObject * focusObject
Definition Spell.h:815
void EffectTitanGrip()
ObjectGuid m_castId
Definition Spell.h:604
void ExecuteLogEffectResurrect(SpellEffects effect, Unit *target)
Definition Spell.cpp:5169
SpellInfo const *const m_spellInfo
Definition Spell.h:599
void EffectUnlearnSpecialization()
void EffectUpdateZoneAurasAndPhases()
void EffectQuestStart()
void EffectApplyMountEquipment()
void EffectSkipCampaign()
void EffectDuel()
void EffectUnused()
void EffectCreateConversation()
void EffectSkinning()
void EffectHeal()
virtual void UnSummon(uint32 msTime=0)
void SetTempSummonType(TempSummonType type)
void RegisterRedirectThreat(uint32 spellId, ObjectGuid const &victim, float pct)
== REDIRECT SYSTEM ==
Unit * GetCurrentVictim()
auto const & GetThreatenedByMeList() const
void ModifyThreatByPercent(Unit *target, float percent)
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 MatchUnitThreatToHighestThreat(Unit *target)
void UnSummon(uint32 msTime=0) override
Definition Totem.cpp:100
Definition Unit.h:647
float GetPctModifierValue(UnitMods unitMod, UnitModifierPctType modifierType) const
Definition Unit.cpp:9695
void ClearUnitState(uint32 f)
Definition Unit.h:756
bool IsVehicle() const
Definition Unit.h:766
int32 GetContentTuning() const
Definition Unit.h:768
void SetMinion(Minion *minion, bool apply)
Definition Unit.cpp:6266
int32 ModifyPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:8716
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:6830
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3769
void RemoveAurasByType(AuraType auraType, std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3973
void RemoveGameObject(GameObject *gameObj, bool del)
Definition Unit.cpp:5436
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition Unit.h:1362
void CombatStop(bool includingCast=false, bool mutualPvP=true, bool(*unitFilter)(Unit const *otherUnit)=nullptr)
Definition Unit.cpp:6031
uint32 m_lastSanctuaryTime
Definition Unit.h:1617
int32 MeleeDamageBonusTaken(Unit *attacker, int32 pdamage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const *spellProto=nullptr, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL)
Definition Unit.cpp:8152
void SetHealth(uint64 val)
Definition Unit.cpp:10041
void SetVirtualItem(uint32 slot, uint32 itemId, uint16 appearanceModId=0, uint16 itemVisual=0)
Definition Unit.cpp:14521
uint64 CountPctFromMaxHealth(float pct) const
Definition Unit.h:809
int32 SpellHealingBonusTaken(Unit *caster, SpellInfo const *spellProto, int32 healamount, DamageEffectType damagetype) const
Definition Unit.cpp:7514
Pet * ToPet()
Definition Unit.h:1838
bool CanHaveThreatList() const
====================== THREAT & COMBAT ====================
Definition Unit.h:1045
void SetUnitFlag3(UnitFlags3 flags)
Definition Unit.h:871
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3846
void EnergizeBySpell(Unit *victim, SpellInfo const *spellInfo, int32 damage, Powers powerType)
Definition Unit.cpp:6817
void SendPlaySpellVisual(Unit *target, uint32 spellVisualId, uint8 missReason, uint8 reflectStatus, float travelSpeed, bool speedAsTime=false, float launchDelay=0.0f)
Definition Unit.cpp:12400
ThreatManager & GetThreatManager()
Definition Unit.h:1093
virtual void SetCanDualWield(bool value)
Definition Unit.h:716
uint8 GetClass() const
Definition Unit.h:776
std::array< ObjectGuid, MAX_SUMMON_SLOT > m_SummonSlot
Definition Unit.h:1524
Totem * ToTotem()
Definition Unit.h:1841
int64 GetHealthGain(int64 dVal)
Definition Unit.cpp:8660
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint32 dispellerSpellId, ObjectGuid casterGUID, WorldObject *dispeller, uint8 chargesRemoved=1)
Definition Unit.cpp:4025
std::forward_list< AuraEffect * > AuraEffectList
Definition Unit.h:664
void SetPower(Powers power, int32 val, bool withPowerUpdate=true)
Definition Unit.cpp:10114
Pet * CreateTamedPetFrom(Creature *creatureTarget, uint32 spell_id=0)
Definition Unit.cpp:11160
uint32 CalculateDamage(WeaponAttackType attType, bool normalized, bool addTotalPct) const
Definition Unit.cpp:2490
static void CalcAbsorbResist(DamageInfo &damageInfo, Spell *spell=nullptr)
Definition Unit.cpp:1866
Unit * GetVehicleBase() const
Definition Unit.cpp:12206
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
bool IsPet() const
Definition Unit.h:763
Powers GetPowerType() const
Definition Unit.h:823
bool HasUnitFlag(UnitFlags flags) const
Definition Unit.h:860
void InterruptSpell(CurrentSpellTypes spellType, bool withDelayed=true, bool withInstant=true, SpellCastResult result=SPELL_FAILED_INTERRUPTED, Optional< SpellCastResult > resultOther={}, ObjectGuid const &interrupter=ObjectGuid::Empty)
Definition Unit.cpp:3158
std::array< ObjectGuid, MAX_GAMEOBJECT_SLOT > m_ObjectSlot
Definition Unit.h:1525
void SetCreatedBySpell(int32 spellId)
Definition Unit.h:875
void AddChannelObject(ObjectGuid guid)
Definition Unit.cpp:3046
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, ObjectGuid casterGUID=ObjectGuid::Empty) const
Definition Unit.cpp:4622
void SetDemonCreatorGUID(ObjectGuid guid)
Definition Unit.h:1224
bool IsAlive() const
Definition Unit.h:1205
AuraEffect * IsScriptOverriden(SpellInfo const *spell, int32 script) const
Definition Unit.cpp:4934
float GetCombatReach() const override
Definition Unit.h:717
int32 GetMaxPower(Powers power) const
Definition Unit.cpp:10105
int32 HealBySpell(HealInfo &healInfo, bool critical=false)
Definition Unit.cpp:6795
void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage const *log)
Definition Unit.cpp:5559
void SetPetFlag(UnitPetFlag flags)
Definition Unit.h:907
TempSummon * ToTempSummon()
Definition Unit.h:1844
CharmInfo * GetCharmInfo()
Definition Unit.h:1262
void AddGameObject(GameObject *gameObj)
Definition Unit.cpp:5385
bool IsInFlight() const
Definition Unit.h:1042
void SetChannelObject(uint32 slot, ObjectGuid guid)
Definition Unit.cpp:3051
uint64 GetMaxHealth() const
Definition Unit.h:801
bool Attack(Unit *victim, bool meleeAttack)
Definition Unit.cpp:5872
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4718
uint64 GetHealth() const
Definition Unit.h:800
bool IsSummon() const
Definition Unit.h:761
uint32 GetFaction() const override
Definition Unit.h:886
void GetDispellableAuraList(WorldObject const *caster, uint32 dispelMask, DispelChargesList &dispelList, bool isReflect=false) const
Definition Unit.cpp:4754
AttackerSet const & getAttackers() const
Definition Unit.h:736
std::multimap< uint32, Aura * > AuraMap
Definition Unit.h:653
void SetFullPower(Powers power)
Definition Unit.h:837
void RemoveAurasWithInterruptFlags(InterruptFlags flag, SpellInfo const *source=nullptr)
Definition Unit.cpp:4259
void SetMaxHealth(uint64 val)
Definition Unit.cpp:10072
std::set< Unit * > AttackerSet
Definition Unit.h:649
void RemoveAppliedAuras(std::function< bool(AuraApplication const *)> const &check, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3919
bool IsGuardian() const
Definition Unit.h:762
UF::UpdateField< UF::UnitData, int32(WowCS::EntityFragment::CGObject), TYPEID_UNIT > m_unitData
Definition Unit.h:1897
void AddExtraAttacks(uint32 count)
Definition Unit.cpp:2363
void SetOwnerGUID(ObjectGuid owner)
Definition Unit.cpp:6190
ObjectGuid GetTransGUID() const override
Definition Unit.cpp:12236
void NearTeleportTo(TeleportLocation const &target, bool casting=false)
Definition Unit.cpp:13054
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
AuraApplication * _CreateAuraApplication(Aura *aura, uint32 effMask)
Definition Unit.cpp:3507
int32 SpellDamageBonusTaken(Unit *caster, SpellInfo const *spellProto, int32 pdamage, DamageEffectType damagetype) const
Definition Unit.cpp:7013
std::unique_ptr< Movement::MoveSpline > movespline
Definition Unit.h:1854
void KnockbackFrom(Position const &origin, float speedXY, float speedZ, float angle=M_PI, Movement::SpellEffectExtraData const *spellEffectExtraData=nullptr)
Definition Unit.cpp:12587
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint32 reqEffMask=0) const
Definition Unit.cpp:4822
uint32 HasUnitTypeMask(uint32 mask) const
Definition Unit.h:759
int32 MeleeDamageBonusDone(Unit *pVictim, int32 damage, WeaponAttackType attType, DamageEffectType damagetype, SpellInfo const *spellProto=nullptr, SpellEffectInfo const *spellEffectInfo=nullptr, Mechanics mechanic=MECHANIC_NONE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, Spell *spell=nullptr, AuraEffect const *aurEff=nullptr)
Definition Unit.cpp:8040
SpellHistory * GetSpellHistory()
Definition Unit.h:1521
void SetCreatorGUID(ObjectGuid creator)
Definition Unit.h:1214
void RemoveMovementImpairingAuras(bool withRoot)
Definition Unit.cpp:4312
bool IsTotem() const
Definition Unit.h:765
ObjectGuid GetBattlePetCompanionGUID() const
Definition Unit.h:1221
void KillSelf(bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition Unit.h:951
virtual void Talk(std::string_view text, ChatMsg msgType, Language language, float textRange, WorldObject const *target)
Definition Unit.cpp:14471
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:5589
virtual bool IsEngaged() const
Definition Unit.h:1049
AuraMap & GetOwnedAuras()
Definition Unit.h:1305
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3992
static void Kill(Unit *attacker, Unit *victim, bool durabilityLoss=true, bool skipSettingDeathState=false)
Definition Unit.cpp:11311
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:7347
ObjectGuid GetTarget() const
Definition Unit.h:1847
uint8 GetLevel() const
Definition Unit.h:769
uint8 GetRace() const
Definition Unit.h:773
void RemoveUnitFlag(UnitFlags flags)
Definition Unit.h:862
void RemoveAurasDueToSpellBySteal(uint32 spellId, ObjectGuid casterGUID, WorldObject *stealer, int32 stolenCharges=1)
Definition Unit.cpp:4053
ObjectGuid GetPetGUID() const
Definition Unit.h:1217
bool isDead() const
Definition Unit.h:1207
Spell * GetCurrentSpell(CurrentSpellTypes spellType) const
Definition Unit.h:1490
constexpr void WorldRelocate(WorldLocation const &loc)
Definition Position.h:202
constexpr uint32 GetMapId() const
Definition Position.h:216
uint32 m_mapId
Definition Position.h:218
constexpr WorldLocation GetWorldLocation() const
Definition Position.h:211
void PlayDirectSound(uint32 soundId, Player const *target=nullptr, uint32 broadcastTextId=0) const
Definition Object.cpp:2941
virtual void SendMessageToSet(WorldPacket const *data, bool self) const
Definition Object.cpp:1099
Map * GetMap() const
Definition Object.h:411
Position GetRandomPoint(Position const &srcPos, float distance, float minDistance=0.0f) const
Definition Object.cpp:678
bool IsWithinLOS(float x, float y, float z, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
Definition Object.cpp:513
ObjectGuid GetPrivateObjectOwner() const
Definition Object.h:569
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0) const
Definition Object.cpp:2754
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
bool IsValidAttackTarget(WorldObject const *target, SpellInfo const *bySpell=nullptr) const
Definition Object.cpp:2329
Unit * GetOwner() const
Definition Object.cpp:1603
bool IsPrivateObject() const
Definition Object.h:568
void SetPrivateObjectOwner(ObjectGuid const &owner)
Definition Object.h:570
int32 ModSpellDuration(SpellInfo const *spellInfo, WorldObject const *target, int32 duration, bool positive, uint32 effectMask) const
Definition Object.cpp:1725
std::string const & GetName() const
Definition Object.h:342
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition Object.cpp:1626
void SetName(std::string newname)
Definition Object.h:343
EventProcessor m_Events
Definition Object.h:561
float GetVisibilityRange() const
Definition Object.cpp:785
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:430
uint32 GetAreaId() const
Definition Object.h:333
Position GetFirstCollisionPosition(float dist, float angle)
Definition Object.cpp:2767
bool IsFriendlyTo(WorldObject const *target) const
Definition Object.cpp:2191
virtual float GetCombatReach() const
Definition Object.h:302
Player * GetAffectingPlayer() const
Definition Object.cpp:1635
FactionTemplateEntry const * GetFactionTemplateEntry() const
Definition Object.cpp:2005
std::vector< SpellDispellData > DispellData
WorldPacket const * Write() override
WorldPacket const * Write() override
WorldPacket const * Write() override
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:919
@ RATE_DROP_MONEY
Definition World.h:481
@ CONFIG_SKILL_MILLING
Definition World.h:124
@ CONFIG_SKILL_PROSPECTING
Definition World.h:123
@ CONFIG_CAST_UNSTUCK
Definition World.h:120
@ SPELL_VISUAL_UNCAGE_PET
TC_GAME_API void Trigger(uint32 gameEventId, WorldObject *source, WorldObject *target)
uint32 GetGameTimeMS()
Definition GameTime.cpp:57
float constexpr gravity
TC_GAME_API Player * FindPlayer(ObjectGuid const &)
TC_GAME_API void SkipCampaignForPlayer(uint32 campaignId, Player *player)
Definition QuestMgr.cpp:205
TC_GAME_API void SkipQuestLineForPlayer(uint32 questLineId, Player *player)
Definition QuestMgr.cpp:148
TraitConfigType GetConfigTypeForTree(int32 traitTreeId)
Definition TraitMgr.cpp:324
@ RBAC_PERM_LOG_GM_TRADE
Definition RBAC.h:64
uint64 GetAction() const
Definition Player.h:417
ActionButtonType GetType() const
Definition Player.h:416
EnumFlag< AreaFlags > GetFlags() const
AuraCreateInfo & SetCaster(Unit *caster)
Definition SpellAuras.h:115
AuraCreateInfo & SetCastItem(ObjectGuid const &guid, uint32 itemId, int32 itemLevel)
Definition SpellAuras.h:117
AuraCreateInfo & SetBaseAmount(SpellEffectValue const *bp)
Definition SpellAuras.h:116
TriggerCastFlags TriggerFlags
Optional< int32 > OriginalCastItemLevel
CastSpellExtraArgs & SetTriggeringSpell(Spell const *triggeringSpell)
Definition Spell.cpp:9646
CastSpellExtraArgs & SetOriginalCaster(ObjectGuid const &guid)
CastSpellExtraArgs & SetCustomArg(std::any customArg)
CastSpellExtraArgs & AddSpellMod(SpellValueMod mod, int32 val)
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:150
static void VisitGridObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:140
void SaveStayPosition()
Definition Unit.cpp:13328
void SetIsCommandFollow(bool val)
Definition Unit.cpp:13318
void SetIsAtStay(bool val)
Definition Unit.cpp:13349
void SetIsFollowing(bool val)
Definition Unit.cpp:13359
void SetIsReturning(bool val)
Definition Unit.cpp:13369
bool HasCommandState(CommandStates state) const
Definition CharmInfo.h:98
void SetIsCommandAttack(bool val)
Definition Unit.cpp:13308
bool IsPetSpecialization() const
SkillType GetRequiredLootSkill() const
bool IsFriendlyTo(FactionTemplateEntry const *entry) const
uint32 GetNoDamageImmune() const
uint32 GetLockId() const
uint32 GetRequiredSkillRank() const
uint32 GetBaseItemLevel() const
uint32 GetId() const
uint32 GetMaxStackSize() const
bool HasFlag(ItemFlags flag) const
char const * GetDefaultLocaleName() const
uint32 GetLockID() const
Definition Loot.h:286
bool FillLoot(uint32 lootId, LootStore const &store, Player *lootOwner, bool personal, bool noEmptyError=false, uint16 lootMode=LOOT_MODE_DEFAULT, ItemContext context=ItemContext::NONE)
Definition Loot.cpp:859
constexpr float GetPositionX() const
Definition Position.h:87
constexpr float GetPositionY() const
Definition Position.h:88
float GetRelativeAngle(float x, float y) const
Definition Position.h:147
constexpr bool IsInDist2d(float x, float y, float dist) const
Definition Position.h:151
float GetExactDist(float x, float y, float z) const
Definition Position.h:129
float GetAbsoluteAngle(float x, float y) const
Definition Position.h:136
constexpr void GetPosition(float &x, float &y) const
Definition Position.h:92
constexpr void Relocate(float x, float y)
Definition Position.h:74
constexpr float GetOrientation() const
Definition Position.h:90
constexpr float GetPositionZ() const
Definition Position.h:89
bool IsHostile
Definition Player.h:438
bool IsInHostileArea
Definition Player.h:439
static QuaternionData fromOrientation(float orientation)
uint32 GetValueForTierIndex(uint32 tierIndex) const
Position _transportOffset
WorldLocation _position
ObjectGuid _transportGUID
std::array< uint8, MAX_ITEM_ENCHANTMENT_EFFECTS > Effect
uint32 originalDamage
Definition Unit.h:576
SpellEffectValue EffectBasePoints[MAX_SPELL_EFFECTS]
Definition Spell.h:242
ObjectGuid TargetGUID
Definition Spell.h:854
EnumFlag< SummonPropertiesFlags > GetFlags() const
WorldLocation Location
Definition Player.h:1210
TraitSystemVariationType GetVariationType() const
UpdateField< int32, 12, 13 > TraitSystemID
UpdateField< int32, 4, 6 > Type
UpdateField< int32, 12, 14 > VariationID
UpdateField< uint16, 0, 7 > ItemVisual
UpdateField< int32, 0, 3 > ItemID
UpdateField< uint16, 0, 6 > ItemAppearanceModID