mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-27 23:56:25 +00:00
First Commit
For Azeroth!
This commit is contained in:
387
src/server/game/Spells/Auras/SpellAuraDefines.h
Normal file
387
src/server/game/Spells/Auras/SpellAuraDefines.h
Normal file
@@ -0,0 +1,387 @@
|
||||
/*
|
||||
* Copyright (C)
|
||||
* Copyright (C)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TRINITY_SPELLAURADEFINES_H
|
||||
#define TRINITY_SPELLAURADEFINES_H
|
||||
|
||||
#define MAX_AURAS 64 // client support up to 255, but it will cause problems with group auras updating
|
||||
|
||||
enum AURA_FLAGS
|
||||
{
|
||||
AFLAG_NONE = 0x00,
|
||||
AFLAG_EFF_INDEX_0 = 0x01,
|
||||
AFLAG_EFF_INDEX_1 = 0x02,
|
||||
AFLAG_EFF_INDEX_2 = 0x04,
|
||||
AFLAG_CASTER = 0x08,
|
||||
AFLAG_POSITIVE = 0x10,
|
||||
AFLAG_DURATION = 0x20,
|
||||
AFLAG_ANY_EFFECT_AMOUNT_SENT = 0x40, // used with AFLAG_EFF_INDEX_0/1/2
|
||||
AFLAG_NEGATIVE = 0x80
|
||||
};
|
||||
|
||||
// these are modes, in which aura effect handler may be called
|
||||
|
||||
enum AuraEffectHandleModes
|
||||
{
|
||||
AURA_EFFECT_HANDLE_DEFAULT = 0x0,
|
||||
AURA_EFFECT_HANDLE_REAL = 0x01, // handler applies/removes effect from unit
|
||||
AURA_EFFECT_HANDLE_SEND_FOR_CLIENT = 0x02, // handler sends apply/remove packet to unit
|
||||
AURA_EFFECT_HANDLE_CHANGE_AMOUNT = 0x04, // handler updates effect on target after effect amount change
|
||||
AURA_EFFECT_HANDLE_REAPPLY = 0x08, // handler updates effect on target after aura is reapplied on target
|
||||
AURA_EFFECT_HANDLE_STAT = 0x10, // handler updates effect on target when stat removal/apply is needed for calculations by core
|
||||
AURA_EFFECT_HANDLE_SKILL = 0x20, // handler updates effect on target when skill removal/apply is needed for calculations by core
|
||||
AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK = (AURA_EFFECT_HANDLE_SEND_FOR_CLIENT | AURA_EFFECT_HANDLE_REAL), // any case handler need to send packet
|
||||
AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK = (AURA_EFFECT_HANDLE_CHANGE_AMOUNT | AURA_EFFECT_HANDLE_REAL), // any case handler applies effect depending on amount
|
||||
AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK = (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK),
|
||||
AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK = (AURA_EFFECT_HANDLE_REAPPLY | AURA_EFFECT_HANDLE_REAL),
|
||||
};
|
||||
|
||||
//m_schoolAbsorb
|
||||
enum DAMAGE_ABSORB_TYPE
|
||||
{
|
||||
ALL_DAMAGE_ABSORB = -2,
|
||||
ONLY_MAGIC_ABSORB = -1,
|
||||
};
|
||||
|
||||
enum AuraType
|
||||
{
|
||||
SPELL_AURA_NONE = 0,
|
||||
SPELL_AURA_BIND_SIGHT = 1,
|
||||
SPELL_AURA_MOD_POSSESS = 2,
|
||||
SPELL_AURA_PERIODIC_DAMAGE = 3,
|
||||
SPELL_AURA_DUMMY = 4,
|
||||
SPELL_AURA_MOD_CONFUSE = 5,
|
||||
SPELL_AURA_MOD_CHARM = 6,
|
||||
SPELL_AURA_MOD_FEAR = 7,
|
||||
SPELL_AURA_PERIODIC_HEAL = 8,
|
||||
SPELL_AURA_MOD_ATTACKSPEED = 9,
|
||||
SPELL_AURA_MOD_THREAT = 10,
|
||||
SPELL_AURA_MOD_TAUNT = 11,
|
||||
SPELL_AURA_MOD_STUN = 12,
|
||||
SPELL_AURA_MOD_DAMAGE_DONE = 13,
|
||||
SPELL_AURA_MOD_DAMAGE_TAKEN = 14,
|
||||
SPELL_AURA_DAMAGE_SHIELD = 15,
|
||||
SPELL_AURA_MOD_STEALTH = 16,
|
||||
SPELL_AURA_MOD_STEALTH_DETECT = 17,
|
||||
SPELL_AURA_MOD_INVISIBILITY = 18,
|
||||
SPELL_AURA_MOD_INVISIBILITY_DETECT = 19,
|
||||
SPELL_AURA_OBS_MOD_HEALTH = 20, //20, 21 unofficial
|
||||
SPELL_AURA_OBS_MOD_POWER = 21,
|
||||
SPELL_AURA_MOD_RESISTANCE = 22,
|
||||
SPELL_AURA_PERIODIC_TRIGGER_SPELL = 23,
|
||||
SPELL_AURA_PERIODIC_ENERGIZE = 24,
|
||||
SPELL_AURA_MOD_PACIFY = 25,
|
||||
SPELL_AURA_MOD_ROOT = 26,
|
||||
SPELL_AURA_MOD_SILENCE = 27,
|
||||
SPELL_AURA_REFLECT_SPELLS = 28,
|
||||
SPELL_AURA_MOD_STAT = 29,
|
||||
SPELL_AURA_MOD_SKILL = 30,
|
||||
SPELL_AURA_MOD_INCREASE_SPEED = 31,
|
||||
SPELL_AURA_MOD_INCREASE_MOUNTED_SPEED = 32,
|
||||
SPELL_AURA_MOD_DECREASE_SPEED = 33,
|
||||
SPELL_AURA_MOD_INCREASE_HEALTH = 34,
|
||||
SPELL_AURA_MOD_INCREASE_ENERGY = 35,
|
||||
SPELL_AURA_MOD_SHAPESHIFT = 36,
|
||||
SPELL_AURA_EFFECT_IMMUNITY = 37,
|
||||
SPELL_AURA_STATE_IMMUNITY = 38,
|
||||
SPELL_AURA_SCHOOL_IMMUNITY = 39,
|
||||
SPELL_AURA_DAMAGE_IMMUNITY = 40,
|
||||
SPELL_AURA_DISPEL_IMMUNITY = 41,
|
||||
SPELL_AURA_PROC_TRIGGER_SPELL = 42,
|
||||
SPELL_AURA_PROC_TRIGGER_DAMAGE = 43,
|
||||
SPELL_AURA_TRACK_CREATURES = 44,
|
||||
SPELL_AURA_TRACK_RESOURCES = 45,
|
||||
SPELL_AURA_46 = 46, // Ignore all Gear test spells
|
||||
SPELL_AURA_MOD_PARRY_PERCENT = 47,
|
||||
SPELL_AURA_48 = 48, // One periodic spell
|
||||
SPELL_AURA_MOD_DODGE_PERCENT = 49,
|
||||
SPELL_AURA_MOD_CRITICAL_HEALING_AMOUNT = 50,
|
||||
SPELL_AURA_MOD_BLOCK_PERCENT = 51,
|
||||
SPELL_AURA_MOD_WEAPON_CRIT_PERCENT = 52,
|
||||
SPELL_AURA_PERIODIC_LEECH = 53,
|
||||
SPELL_AURA_MOD_HIT_CHANCE = 54,
|
||||
SPELL_AURA_MOD_SPELL_HIT_CHANCE = 55,
|
||||
SPELL_AURA_TRANSFORM = 56,
|
||||
SPELL_AURA_MOD_SPELL_CRIT_CHANCE = 57,
|
||||
SPELL_AURA_MOD_INCREASE_SWIM_SPEED = 58,
|
||||
SPELL_AURA_MOD_DAMAGE_DONE_CREATURE = 59,
|
||||
SPELL_AURA_MOD_PACIFY_SILENCE = 60,
|
||||
SPELL_AURA_MOD_SCALE = 61,
|
||||
SPELL_AURA_PERIODIC_HEALTH_FUNNEL = 62,
|
||||
SPELL_AURA_63 = 63, // old SPELL_AURA_PERIODIC_MANA_FUNNEL
|
||||
SPELL_AURA_PERIODIC_MANA_LEECH = 64,
|
||||
SPELL_AURA_MOD_CASTING_SPEED_NOT_STACK = 65,
|
||||
SPELL_AURA_FEIGN_DEATH = 66,
|
||||
SPELL_AURA_MOD_DISARM = 67,
|
||||
SPELL_AURA_MOD_STALKED = 68,
|
||||
SPELL_AURA_SCHOOL_ABSORB = 69,
|
||||
SPELL_AURA_EXTRA_ATTACKS = 70,
|
||||
SPELL_AURA_MOD_SPELL_CRIT_CHANCE_SCHOOL = 71,
|
||||
SPELL_AURA_MOD_POWER_COST_SCHOOL_PCT = 72,
|
||||
SPELL_AURA_MOD_POWER_COST_SCHOOL = 73,
|
||||
SPELL_AURA_REFLECT_SPELLS_SCHOOL = 74,
|
||||
SPELL_AURA_MOD_LANGUAGE = 75,
|
||||
SPELL_AURA_FAR_SIGHT = 76,
|
||||
SPELL_AURA_MECHANIC_IMMUNITY = 77,
|
||||
SPELL_AURA_MOUNTED = 78,
|
||||
SPELL_AURA_MOD_DAMAGE_PERCENT_DONE = 79,
|
||||
SPELL_AURA_MOD_PERCENT_STAT = 80,
|
||||
SPELL_AURA_SPLIT_DAMAGE_PCT = 81,
|
||||
SPELL_AURA_WATER_BREATHING = 82,
|
||||
SPELL_AURA_MOD_BASE_RESISTANCE = 83,
|
||||
SPELL_AURA_MOD_REGEN = 84,
|
||||
SPELL_AURA_MOD_POWER_REGEN = 85,
|
||||
SPELL_AURA_CHANNEL_DEATH_ITEM = 86,
|
||||
SPELL_AURA_MOD_DAMAGE_PERCENT_TAKEN = 87,
|
||||
SPELL_AURA_MOD_HEALTH_REGEN_PERCENT = 88,
|
||||
SPELL_AURA_PERIODIC_DAMAGE_PERCENT = 89,
|
||||
SPELL_AURA_90 = 90, // old SPELL_AURA_MOD_RESIST_CHANCE
|
||||
SPELL_AURA_MOD_DETECT_RANGE = 91,
|
||||
SPELL_AURA_PREVENTS_FLEEING = 92,
|
||||
SPELL_AURA_MOD_UNATTACKABLE = 93,
|
||||
SPELL_AURA_INTERRUPT_REGEN = 94,
|
||||
SPELL_AURA_GHOST = 95,
|
||||
SPELL_AURA_SPELL_MAGNET = 96,
|
||||
SPELL_AURA_MANA_SHIELD = 97,
|
||||
SPELL_AURA_MOD_SKILL_TALENT = 98,
|
||||
SPELL_AURA_MOD_ATTACK_POWER = 99,
|
||||
SPELL_AURA_AURAS_VISIBLE = 100,
|
||||
SPELL_AURA_MOD_RESISTANCE_PCT = 101,
|
||||
SPELL_AURA_MOD_MELEE_ATTACK_POWER_VERSUS = 102,
|
||||
SPELL_AURA_MOD_TOTAL_THREAT = 103,
|
||||
SPELL_AURA_WATER_WALK = 104,
|
||||
SPELL_AURA_FEATHER_FALL = 105,
|
||||
SPELL_AURA_HOVER = 106,
|
||||
SPELL_AURA_ADD_FLAT_MODIFIER = 107,
|
||||
SPELL_AURA_ADD_PCT_MODIFIER = 108,
|
||||
SPELL_AURA_ADD_TARGET_TRIGGER = 109,
|
||||
SPELL_AURA_MOD_POWER_REGEN_PERCENT = 110,
|
||||
SPELL_AURA_ADD_CASTER_HIT_TRIGGER = 111,
|
||||
SPELL_AURA_OVERRIDE_CLASS_SCRIPTS = 112,
|
||||
SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN = 113,
|
||||
SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT = 114,
|
||||
SPELL_AURA_MOD_HEALING = 115,
|
||||
SPELL_AURA_MOD_REGEN_DURING_COMBAT = 116,
|
||||
SPELL_AURA_MOD_MECHANIC_RESISTANCE = 117,
|
||||
SPELL_AURA_MOD_HEALING_PCT = 118,
|
||||
SPELL_AURA_119 = 119, // old SPELL_AURA_SHARE_PET_TRACKING
|
||||
SPELL_AURA_UNTRACKABLE = 120,
|
||||
SPELL_AURA_EMPATHY = 121,
|
||||
SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT = 122,
|
||||
SPELL_AURA_MOD_TARGET_RESISTANCE = 123,
|
||||
SPELL_AURA_MOD_RANGED_ATTACK_POWER = 124,
|
||||
SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN = 125,
|
||||
SPELL_AURA_MOD_MELEE_DAMAGE_TAKEN_PCT = 126,
|
||||
SPELL_AURA_RANGED_ATTACK_POWER_ATTACKER_BONUS = 127,
|
||||
SPELL_AURA_MOD_POSSESS_PET = 128,
|
||||
SPELL_AURA_MOD_SPEED_ALWAYS = 129,
|
||||
SPELL_AURA_MOD_MOUNTED_SPEED_ALWAYS = 130,
|
||||
SPELL_AURA_MOD_RANGED_ATTACK_POWER_VERSUS = 131,
|
||||
SPELL_AURA_MOD_INCREASE_ENERGY_PERCENT = 132,
|
||||
SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT = 133,
|
||||
SPELL_AURA_MOD_MANA_REGEN_INTERRUPT = 134,
|
||||
SPELL_AURA_MOD_HEALING_DONE = 135,
|
||||
SPELL_AURA_MOD_HEALING_DONE_PERCENT = 136,
|
||||
SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE = 137,
|
||||
SPELL_AURA_MOD_MELEE_HASTE = 138,
|
||||
SPELL_AURA_FORCE_REACTION = 139,
|
||||
SPELL_AURA_MOD_RANGED_HASTE = 140,
|
||||
SPELL_AURA_MOD_RANGED_AMMO_HASTE = 141,
|
||||
SPELL_AURA_MOD_BASE_RESISTANCE_PCT = 142,
|
||||
SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE = 143,
|
||||
SPELL_AURA_SAFE_FALL = 144,
|
||||
SPELL_AURA_MOD_PET_TALENT_POINTS = 145,
|
||||
SPELL_AURA_ALLOW_TAME_PET_TYPE = 146,
|
||||
SPELL_AURA_MECHANIC_IMMUNITY_MASK = 147,
|
||||
SPELL_AURA_RETAIN_COMBO_POINTS = 148,
|
||||
SPELL_AURA_REDUCE_PUSHBACK = 149, // Reduce Pushback
|
||||
SPELL_AURA_MOD_SHIELD_BLOCKVALUE_PCT = 150,
|
||||
SPELL_AURA_TRACK_STEALTHED = 151, // Track Stealthed
|
||||
SPELL_AURA_MOD_DETECTED_RANGE = 152, // Mod Detected Range
|
||||
SPELL_AURA_SPLIT_DAMAGE_FLAT = 153, // Split Damage Flat
|
||||
SPELL_AURA_MOD_STEALTH_LEVEL = 154, // Stealth Level Modifier
|
||||
SPELL_AURA_MOD_WATER_BREATHING = 155, // Mod Water Breathing
|
||||
SPELL_AURA_MOD_REPUTATION_GAIN = 156, // Mod Reputation Gain
|
||||
SPELL_AURA_PET_DAMAGE_MULTI = 157, // Mod Pet Damage
|
||||
SPELL_AURA_MOD_SHIELD_BLOCKVALUE = 158,
|
||||
SPELL_AURA_NO_PVP_CREDIT = 159,
|
||||
SPELL_AURA_MOD_AOE_AVOIDANCE = 160,
|
||||
SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT = 161,
|
||||
SPELL_AURA_POWER_BURN = 162,
|
||||
SPELL_AURA_MOD_CRIT_DAMAGE_BONUS = 163,
|
||||
SPELL_AURA_164 = 164,
|
||||
SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS = 165,
|
||||
SPELL_AURA_MOD_ATTACK_POWER_PCT = 166,
|
||||
SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT = 167,
|
||||
SPELL_AURA_MOD_DAMAGE_DONE_VERSUS = 168,
|
||||
SPELL_AURA_MOD_CRIT_PERCENT_VERSUS = 169,
|
||||
SPELL_AURA_DETECT_AMORE = 170,
|
||||
SPELL_AURA_MOD_SPEED_NOT_STACK = 171,
|
||||
SPELL_AURA_MOD_MOUNTED_SPEED_NOT_STACK = 172,
|
||||
SPELL_AURA_173 = 173, // old SPELL_AURA_ALLOW_CHAMPION_SPELLS
|
||||
SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT = 174, // by defeult intelect, dependent from SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT
|
||||
SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT = 175,
|
||||
SPELL_AURA_SPIRIT_OF_REDEMPTION = 176,
|
||||
SPELL_AURA_AOE_CHARM = 177,
|
||||
SPELL_AURA_MOD_DEBUFF_RESISTANCE = 178,
|
||||
SPELL_AURA_MOD_ATTACKER_SPELL_CRIT_CHANCE = 179,
|
||||
SPELL_AURA_MOD_FLAT_SPELL_DAMAGE_VERSUS = 180,
|
||||
SPELL_AURA_181 = 181, // old SPELL_AURA_MOD_FLAT_SPELL_CRIT_DAMAGE_VERSUS - possible flat spell crit damage versus
|
||||
SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT = 182,
|
||||
SPELL_AURA_MOD_CRITICAL_THREAT = 183,
|
||||
SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE = 184,
|
||||
SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE= 185,
|
||||
SPELL_AURA_MOD_ATTACKER_SPELL_HIT_CHANCE = 186,
|
||||
SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_CHANCE = 187,
|
||||
SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_CHANCE = 188,
|
||||
SPELL_AURA_MOD_RATING = 189,
|
||||
SPELL_AURA_MOD_FACTION_REPUTATION_GAIN = 190,
|
||||
SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED = 191,
|
||||
SPELL_AURA_MOD_MELEE_RANGED_HASTE = 192,
|
||||
SPELL_AURA_MELEE_SLOW = 193,
|
||||
SPELL_AURA_MOD_TARGET_ABSORB_SCHOOL = 194,
|
||||
SPELL_AURA_MOD_TARGET_ABILITY_ABSORB_SCHOOL = 195,
|
||||
SPELL_AURA_MOD_COOLDOWN = 196, // only 24818 Noxious Breath
|
||||
SPELL_AURA_MOD_ATTACKER_SPELL_AND_WEAPON_CRIT_CHANCE = 197,
|
||||
SPELL_AURA_198 = 198, // old SPELL_AURA_MOD_ALL_WEAPON_SKILLS
|
||||
SPELL_AURA_MOD_INCREASES_SPELL_PCT_TO_HIT = 199,
|
||||
SPELL_AURA_MOD_XP_PCT = 200,
|
||||
SPELL_AURA_FLY = 201,
|
||||
SPELL_AURA_IGNORE_COMBAT_RESULT = 202,
|
||||
SPELL_AURA_MOD_ATTACKER_MELEE_CRIT_DAMAGE = 203,
|
||||
SPELL_AURA_MOD_ATTACKER_RANGED_CRIT_DAMAGE = 204,
|
||||
SPELL_AURA_MOD_SCHOOL_CRIT_DMG_TAKEN = 205,
|
||||
SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED = 206,
|
||||
SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED = 207,
|
||||
SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED = 208,
|
||||
SPELL_AURA_MOD_MOUNTED_FLIGHT_SPEED_ALWAYS = 209,
|
||||
SPELL_AURA_MOD_VEHICLE_SPEED_ALWAYS = 210,
|
||||
SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK = 211,
|
||||
SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT = 212,
|
||||
SPELL_AURA_MOD_RAGE_FROM_DAMAGE_DEALT = 213,
|
||||
SPELL_AURA_214 = 214,
|
||||
SPELL_AURA_ARENA_PREPARATION = 215,
|
||||
SPELL_AURA_HASTE_SPELLS = 216,
|
||||
SPELL_AURA_MOD_MELEE_HASTE_2 = 217, // NYI
|
||||
SPELL_AURA_HASTE_RANGED = 218,
|
||||
SPELL_AURA_MOD_MANA_REGEN_FROM_STAT = 219,
|
||||
SPELL_AURA_MOD_RATING_FROM_STAT = 220,
|
||||
SPELL_AURA_IGNORED = 221,
|
||||
SPELL_AURA_222 = 222,
|
||||
SPELL_AURA_RAID_PROC_FROM_CHARGE = 223,
|
||||
SPELL_AURA_224 = 224,
|
||||
SPELL_AURA_RAID_PROC_FROM_CHARGE_WITH_VALUE = 225,
|
||||
SPELL_AURA_PERIODIC_DUMMY = 226,
|
||||
SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE = 227,
|
||||
SPELL_AURA_DETECT_STEALTH = 228,
|
||||
SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE = 229,
|
||||
SPELL_AURA_230 = 230,
|
||||
SPELL_AURA_PROC_TRIGGER_SPELL_WITH_VALUE = 231,
|
||||
SPELL_AURA_MECHANIC_DURATION_MOD = 232,
|
||||
SPELL_AURA_CHANGE_MODEL_FOR_ALL_HUMANOIDS = 233, // client-side only
|
||||
SPELL_AURA_MECHANIC_DURATION_MOD_NOT_STACK = 234,
|
||||
SPELL_AURA_MOD_DISPEL_RESIST = 235,
|
||||
SPELL_AURA_CONTROL_VEHICLE = 236,
|
||||
SPELL_AURA_MOD_SPELL_DAMAGE_OF_ATTACK_POWER = 237,
|
||||
SPELL_AURA_MOD_SPELL_HEALING_OF_ATTACK_POWER = 238,
|
||||
SPELL_AURA_MOD_SCALE_2 = 239,
|
||||
SPELL_AURA_MOD_EXPERTISE = 240,
|
||||
SPELL_AURA_FORCE_MOVE_FORWARD = 241,
|
||||
SPELL_AURA_MOD_SPELL_DAMAGE_FROM_HEALING = 242,
|
||||
SPELL_AURA_MOD_FACTION = 243,
|
||||
SPELL_AURA_COMPREHEND_LANGUAGE = 244,
|
||||
SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL = 245,
|
||||
SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK = 246,
|
||||
SPELL_AURA_CLONE_CASTER = 247,
|
||||
SPELL_AURA_MOD_COMBAT_RESULT_CHANCE = 248,
|
||||
SPELL_AURA_CONVERT_RUNE = 249,
|
||||
SPELL_AURA_MOD_INCREASE_HEALTH_2 = 250,
|
||||
SPELL_AURA_MOD_ENEMY_DODGE = 251,
|
||||
SPELL_AURA_MOD_SPEED_SLOW_ALL = 252,
|
||||
SPELL_AURA_MOD_BLOCK_CRIT_CHANCE = 253,
|
||||
SPELL_AURA_MOD_DISARM_OFFHAND = 254,
|
||||
SPELL_AURA_MOD_MECHANIC_DAMAGE_TAKEN_PERCENT = 255,
|
||||
SPELL_AURA_NO_REAGENT_USE = 256,
|
||||
SPELL_AURA_MOD_TARGET_RESIST_BY_SPELL_CLASS = 257,
|
||||
SPELL_AURA_258 = 258,
|
||||
SPELL_AURA_MOD_HOT_PCT = 259,
|
||||
SPELL_AURA_SCREEN_EFFECT = 260,
|
||||
SPELL_AURA_PHASE = 261,
|
||||
SPELL_AURA_ABILITY_IGNORE_AURASTATE = 262,
|
||||
SPELL_AURA_ALLOW_ONLY_ABILITY = 263,
|
||||
SPELL_AURA_264 = 264,
|
||||
SPELL_AURA_265 = 265,
|
||||
SPELL_AURA_266 = 266,
|
||||
SPELL_AURA_MOD_IMMUNE_AURA_APPLY_SCHOOL = 267,
|
||||
SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT = 268,
|
||||
SPELL_AURA_MOD_IGNORE_TARGET_RESIST = 269,
|
||||
SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST = 270, // Possibly need swap vs 195 aura used only in 1 spell Chaos Bolt Passive
|
||||
SPELL_AURA_MOD_DAMAGE_FROM_CASTER = 271,
|
||||
SPELL_AURA_IGNORE_MELEE_RESET = 272,
|
||||
SPELL_AURA_X_RAY = 273,
|
||||
SPELL_AURA_ABILITY_CONSUME_NO_AMMO = 274,
|
||||
SPELL_AURA_MOD_IGNORE_SHAPESHIFT = 275,
|
||||
SPELL_AURA_MOD_DAMAGE_DONE_FOR_MECHANIC = 276, // NYI
|
||||
SPELL_AURA_MOD_MAX_AFFECTED_TARGETS = 277,
|
||||
SPELL_AURA_MOD_DISARM_RANGED = 278,
|
||||
SPELL_AURA_INITIALIZE_IMAGES = 279,
|
||||
SPELL_AURA_MOD_ARMOR_PENETRATION_PCT = 280,
|
||||
SPELL_AURA_MOD_HONOR_GAIN_PCT = 281,
|
||||
SPELL_AURA_MOD_BASE_HEALTH_PCT = 282,
|
||||
SPELL_AURA_MOD_HEALING_RECEIVED = 283, // Possibly only for some spell family class spells
|
||||
SPELL_AURA_LINKED = 284,
|
||||
SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR = 285,
|
||||
SPELL_AURA_ABILITY_PERIODIC_CRIT = 286,
|
||||
SPELL_AURA_DEFLECT_SPELLS = 287,
|
||||
SPELL_AURA_IGNORE_HIT_DIRECTION = 288,
|
||||
SPELL_AURA_289 = 289,
|
||||
SPELL_AURA_MOD_CRIT_PCT = 290,
|
||||
SPELL_AURA_MOD_XP_QUEST_PCT = 291,
|
||||
SPELL_AURA_OPEN_STABLE = 292,
|
||||
SPELL_AURA_OVERRIDE_SPELLS = 293,
|
||||
SPELL_AURA_PREVENT_REGENERATE_POWER = 294,
|
||||
SPELL_AURA_295 = 295,
|
||||
SPELL_AURA_SET_VEHICLE_ID = 296,
|
||||
SPELL_AURA_BLOCK_SPELL_FAMILY = 297,
|
||||
SPELL_AURA_STRANGULATE = 298,
|
||||
SPELL_AURA_299 = 299,
|
||||
SPELL_AURA_SHARE_DAMAGE_PCT = 300,
|
||||
SPELL_AURA_SCHOOL_HEAL_ABSORB = 301,
|
||||
SPELL_AURA_302 = 302,
|
||||
SPELL_AURA_MOD_DAMAGE_DONE_VERSUS_AURASTATE = 303,
|
||||
SPELL_AURA_MOD_FAKE_INEBRIATE = 304,
|
||||
SPELL_AURA_MOD_MINIMUM_SPEED = 305,
|
||||
SPELL_AURA_306 = 306,
|
||||
SPELL_AURA_HEAL_ABSORB_TEST = 307,
|
||||
SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER = 308,
|
||||
SPELL_AURA_309 = 309,
|
||||
SPELL_AURA_MOD_CREATURE_AOE_DAMAGE_AVOIDANCE = 310,
|
||||
SPELL_AURA_311 = 311,
|
||||
SPELL_AURA_312 = 312,
|
||||
SPELL_AURA_313 = 313,
|
||||
SPELL_AURA_PREVENT_RESURRECTION = 314,
|
||||
SPELL_AURA_UNDERWATER_WALKING = 315,
|
||||
SPELL_AURA_PERIODIC_HASTE = 316,
|
||||
TOTAL_AURAS = 317
|
||||
};
|
||||
|
||||
enum AuraObjectType
|
||||
{
|
||||
UNIT_AURA_TYPE,
|
||||
DYNOBJ_AURA_TYPE,
|
||||
};
|
||||
#endif
|
||||
6745
src/server/game/Spells/Auras/SpellAuraEffects.cpp
Normal file
6745
src/server/game/Spells/Auras/SpellAuraEffects.cpp
Normal file
File diff suppressed because it is too large
Load Diff
392
src/server/game/Spells/Auras/SpellAuraEffects.h
Normal file
392
src/server/game/Spells/Auras/SpellAuraEffects.h
Normal file
@@ -0,0 +1,392 @@
|
||||
/*
|
||||
* Copyright (C)
|
||||
* Copyright (C)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TRINITY_SPELLAURAEFFECTS_H
|
||||
#define TRINITY_SPELLAURAEFFECTS_H
|
||||
|
||||
class Unit;
|
||||
class AuraEffect;
|
||||
class Aura;
|
||||
|
||||
#include "SpellAuras.h"
|
||||
#include "Spell.h"
|
||||
|
||||
typedef void(AuraEffect::*pAuraEffectHandler)(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
|
||||
class AuraEffect
|
||||
{
|
||||
friend void Aura::_InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount);
|
||||
friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID, bool noPeriodicReset);
|
||||
friend Aura::~Aura();
|
||||
private:
|
||||
~AuraEffect();
|
||||
explicit AuraEffect(Aura* base, uint8 effIndex, int32 *baseAmount, Unit* caster);
|
||||
public:
|
||||
Unit* GetCaster() const { return GetBase()->GetCaster(); }
|
||||
uint64 GetCasterGUID() const { return GetBase()->GetCasterGUID(); }
|
||||
Aura* GetBase() const { return m_base; }
|
||||
void GetTargetList(std::list<Unit*> & targetList) const;
|
||||
void GetApplicationList(std::list<AuraApplication*> & applicationList) const;
|
||||
SpellModifier* GetSpellModifier() const { return m_spellmod; }
|
||||
|
||||
SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
|
||||
uint32 GetId() const { return m_spellInfo->Id; }
|
||||
uint32 GetEffIndex() const { return m_effIndex; }
|
||||
int32 GetBaseAmount() const { return m_baseAmount; }
|
||||
int32 GetAmplitude() const { return m_amplitude; }
|
||||
|
||||
int32 GetMiscValueB() const { return m_spellInfo->Effects[m_effIndex].MiscValueB; }
|
||||
int32 GetMiscValue() const { return m_spellInfo->Effects[m_effIndex].MiscValue; }
|
||||
AuraType GetAuraType() const { return (AuraType)m_spellInfo->Effects[m_effIndex].ApplyAuraName; }
|
||||
int32 GetAmount() const { return m_isAuraEnabled ? m_amount : 0; }
|
||||
int32 GetForcedAmount() const { return m_amount; }
|
||||
void SetAmount(int32 amount) { m_amount = amount; m_canBeRecalculated = false;}
|
||||
|
||||
int32 GetPeriodicTimer() const { return m_periodicTimer; }
|
||||
void SetPeriodicTimer(int32 periodicTimer) { m_periodicTimer = periodicTimer; }
|
||||
|
||||
int32 CalculateAmount(Unit* caster);
|
||||
void CalculatePeriodic(Unit* caster, bool create = false, bool load = false);
|
||||
void CalculatePeriodicData();
|
||||
void CalculateSpellMod();
|
||||
void ChangeAmount(int32 newAmount, bool mark = true, bool onStackOrReapply = false);
|
||||
void RecalculateAmount() { if (!CanBeRecalculated()) return; ChangeAmount(CalculateAmount(GetCaster()), false); }
|
||||
void RecalculateAmount(Unit* caster) { if (!CanBeRecalculated()) return; ChangeAmount(CalculateAmount(caster), false); }
|
||||
bool CanBeRecalculated() const { return m_canBeRecalculated; }
|
||||
void SetCanBeRecalculated(bool val) { m_canBeRecalculated = val; }
|
||||
void HandleEffect(AuraApplication * aurApp, uint8 mode, bool apply);
|
||||
void HandleEffect(Unit* target, uint8 mode, bool apply);
|
||||
void ApplySpellMod(Unit* target, bool apply);
|
||||
|
||||
void Update(uint32 diff, Unit* caster);
|
||||
void UpdatePeriodic(Unit* caster);
|
||||
|
||||
uint32 GetTickNumber() const { return m_tickNumber; }
|
||||
int32 GetTotalTicks() const { return m_amplitude ? (GetBase()->GetMaxDuration() / m_amplitude) : 1;}
|
||||
void ResetPeriodic(bool resetPeriodicTimer = false) { if (resetPeriodicTimer) m_periodicTimer = m_amplitude; m_tickNumber = 0;}
|
||||
|
||||
bool IsPeriodic() const { return m_isPeriodic; }
|
||||
void SetPeriodic(bool isPeriodic) { m_isPeriodic = isPeriodic; }
|
||||
bool IsAffectedOnSpell(SpellInfo const* spell) const;
|
||||
bool HasSpellClassMask() const { return m_spellInfo->Effects[m_effIndex].SpellClassMask; }
|
||||
|
||||
void SendTickImmune(Unit* target, Unit* caster) const;
|
||||
void PeriodicTick(AuraApplication * aurApp, Unit* caster) const;
|
||||
|
||||
void HandleProc(AuraApplication* aurApp, ProcEventInfo& eventInfo);
|
||||
|
||||
void CleanupTriggeredSpells(Unit* target);
|
||||
|
||||
// add/remove SPELL_AURA_MOD_SHAPESHIFT (36) linked auras
|
||||
void HandleShapeshiftBoosts(Unit* target, bool apply) const;
|
||||
|
||||
// xinef: storing initial crit chance
|
||||
float GetCritChance() const { return m_critChance; }
|
||||
void SetCritChance(float crit) { m_critChance = crit; }
|
||||
uint8 GetCasterLevel() const { return m_casterLevel; }
|
||||
bool CanApplyResilience() const { return m_applyResilience; }
|
||||
float GetPctMods() const { return m_pctMods; }
|
||||
|
||||
// xinef: stacking
|
||||
uint32 GetAuraGroup() const { return m_auraGroup; }
|
||||
int32 GetOldAmount() const { return m_oldAmount; }
|
||||
void SetOldAmount(int32 amount) { m_oldAmount = amount; }
|
||||
void SetEnabled(bool enabled) { m_isAuraEnabled = enabled; }
|
||||
|
||||
private:
|
||||
Aura* const m_base;
|
||||
|
||||
SpellInfo const* const m_spellInfo;
|
||||
int32 const m_baseAmount;
|
||||
|
||||
bool m_applyResilience;
|
||||
uint8 m_casterLevel;
|
||||
int32 m_amount;
|
||||
float m_critChance;
|
||||
float m_pctMods;
|
||||
|
||||
// xinef: stacking
|
||||
uint32 m_auraGroup;
|
||||
int32 m_oldAmount;
|
||||
bool m_isAuraEnabled;
|
||||
// xinef: channel information for channel triggering
|
||||
ChannelTargetData* m_channelData;
|
||||
|
||||
|
||||
SpellModifier* m_spellmod;
|
||||
|
||||
int32 m_periodicTimer;
|
||||
int32 m_amplitude;
|
||||
uint32 m_tickNumber;
|
||||
|
||||
uint8 const m_effIndex;
|
||||
bool m_canBeRecalculated;
|
||||
bool m_isPeriodic;
|
||||
private:
|
||||
float CalcPeriodicCritChance(Unit const* caster, Unit const* target) const;
|
||||
|
||||
public:
|
||||
// aura effect apply/remove handlers
|
||||
void HandleNULL(AuraApplication const* /*aurApp*/, uint8 /*mode*/, bool /*apply*/) const
|
||||
{
|
||||
// not implemented
|
||||
}
|
||||
void HandleUnused(AuraApplication const* /*aurApp*/, uint8 /*mode*/, bool /*apply*/) const
|
||||
{
|
||||
// useless
|
||||
}
|
||||
void HandleNoImmediateEffect(AuraApplication const* /*aurApp*/, uint8 /*mode*/, bool /*apply*/) const
|
||||
{
|
||||
// aura type not have immediate effect at add/remove and handled by ID in other code place
|
||||
}
|
||||
// visibility & phases
|
||||
void HandleModInvisibilityDetect(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModInvisibility(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModStealth(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModStealthLevel(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModStealthDetect(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleSpiritOfRedemption(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraGhost(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandlePhase(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// unit model
|
||||
void HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraTransform(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModScale(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraCloneCaster(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// fight
|
||||
void HandleFeignDeath(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModUnattackable(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModSilence(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModPacify(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModPacifyAndSilence(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraAllowOnlyAbility(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// tracking
|
||||
void HandleAuraTrackResources(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraTrackCreatures(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraTrackStealthed(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModStalked(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraUntrackable(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// skills & talents
|
||||
void HandleAuraModPetTalentsPoints(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModSkill(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// movement
|
||||
void HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraAllowFlight(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraWaterWalk(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraFeatherFall(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraHover(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleWaterBreathing(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleForceMoveForward(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// threat
|
||||
void HandleModThreat(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModTotalThreat(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModTaunt(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// control
|
||||
void HandleModConfuse(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModFear(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModStun(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModRoot(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandlePreventFleeing(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// charm
|
||||
void HandleModPossess(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModPossessPet(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModCharm(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleCharmConvert(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraControlVehicle(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// modify speed
|
||||
void HandleAuraModIncreaseSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModIncreaseMountedSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModIncreaseFlightSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModIncreaseSwimSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModDecreaseSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModUseNormalSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// immunity
|
||||
void HandleModStateImmunityMask(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModMechanicImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModEffectImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModStateImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModSchoolImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModDmgImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModDispelImmunity(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// modify stats
|
||||
// resistance
|
||||
void HandleAuraModResistanceExclusive(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModResistance(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModBaseResistancePCT(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModResistancePercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModBaseResistance(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModTargetResistance(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// stat
|
||||
void HandleAuraModStat(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModPercentStat(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModSpellDamagePercentFromStat(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModSpellHealingPercentFromStat(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModSpellDamagePercentFromAttackPower(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModSpellHealingPercentFromAttackPower(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModHealingDone(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModTotalPercentStat(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModResistenceOfStatPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModExpertise(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// heal and energize
|
||||
void HandleModPowerRegen(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModPowerRegenPCT(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModManaRegen(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModIncreaseHealth(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModIncreaseMaxHealth(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModIncreaseEnergy(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModIncreaseEnergyPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModIncreaseHealthPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraIncreaseBaseHealthPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// fight
|
||||
void HandleAuraModParryPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModDodgePercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModBlockPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModRegenInterrupt(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModWeaponCritPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModHitChance(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModSpellHitChance(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModSpellCritChance(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModSpellCritChanceShool(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModCritPct(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// attack speed
|
||||
void HandleModCastingSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModMeleeRangedSpeedPct(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModCombatSpeedPct(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModAttackSpeed(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModMeleeSpeedPct(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModRangedHaste(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleRangedAmmoHaste(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// combat rating
|
||||
void HandleModRating(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModRatingFromStat(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// attack power
|
||||
void HandleAuraModAttackPower(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModRangedAttackPower(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModAttackPowerPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModRangedAttackPowerPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModRangedAttackPowerOfStatPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModAttackPowerOfStatPercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModAttackPowerOfArmor(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// damage bonus
|
||||
void HandleModDamageDone(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModDamagePercentDone(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModOffhandDamagePercent(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleShieldBlockValue(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// power cost
|
||||
void HandleModPowerCostPCT(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleModPowerCost(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleArenaPreparation(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleNoReagentUseAura(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraRetainComboPoints(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
// others
|
||||
void HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleChannelDeathItem(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleBindSight(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleForceReaction(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraEmpathy(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModFaction(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleComprehendLanguage(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraConvertRune(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraLinked(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraOpenStable(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraModFakeInebriation(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraOverrideSpells(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandleAuraSetVehicle(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
void HandlePreventResurrection(AuraApplication const* aurApp, uint8 mode, bool apply) const;
|
||||
|
||||
// aura effect periodic tick handlers
|
||||
void HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const;
|
||||
void HandlePeriodicTriggerSpellAuraTick(Unit* target, Unit* caster) const;
|
||||
void HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* caster) const;
|
||||
void HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const;
|
||||
void HandlePeriodicHealthLeechAuraTick(Unit* target, Unit* caster) const;
|
||||
void HandlePeriodicHealthFunnelAuraTick(Unit* target, Unit* caster) const;
|
||||
void HandlePeriodicHealAurasTick(Unit* target, Unit* caster) const;
|
||||
void HandlePeriodicManaLeechAuraTick(Unit* target, Unit* caster) const;
|
||||
void HandleObsModPowerAuraTick(Unit* target, Unit* caster) const;
|
||||
void HandlePeriodicEnergizeAuraTick(Unit* target, Unit* caster) const;
|
||||
void HandlePeriodicPowerBurnAuraTick(Unit* target, Unit* caster) const;
|
||||
|
||||
// aura effect proc handlers
|
||||
void HandleProcTriggerSpellAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo);
|
||||
void HandleProcTriggerSpellWithValueAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo);
|
||||
void HandleProcTriggerDamageAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo);
|
||||
void HandleRaidProcFromChargeAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo);
|
||||
void HandleRaidProcFromChargeWithValueAuraProc(AuraApplication* aurApp, ProcEventInfo& eventInfo);
|
||||
};
|
||||
|
||||
namespace Trinity
|
||||
{
|
||||
// Binary predicate for sorting the priority of absorption aura effects
|
||||
class AbsorbAuraOrderPred
|
||||
{
|
||||
public:
|
||||
AbsorbAuraOrderPred() { }
|
||||
bool operator() (AuraEffect* aurEffA, AuraEffect* aurEffB) const
|
||||
{
|
||||
SpellInfo const* spellProtoA = aurEffA->GetSpellInfo();
|
||||
SpellInfo const* spellProtoB = aurEffB->GetSpellInfo();
|
||||
|
||||
// Wards
|
||||
if ((spellProtoA->SpellFamilyName == SPELLFAMILY_MAGE) ||
|
||||
(spellProtoA->SpellFamilyName == SPELLFAMILY_WARLOCK))
|
||||
if (spellProtoA->GetCategory() == 56)
|
||||
return true;
|
||||
if ((spellProtoB->SpellFamilyName == SPELLFAMILY_MAGE) ||
|
||||
(spellProtoB->SpellFamilyName == SPELLFAMILY_WARLOCK))
|
||||
if (spellProtoB->GetCategory() == 56)
|
||||
return false;
|
||||
|
||||
// Sacred Shield
|
||||
if (spellProtoA->Id == 58597)
|
||||
return true;
|
||||
if (spellProtoB->Id == 58597)
|
||||
return false;
|
||||
|
||||
// Fel Blossom
|
||||
if (spellProtoA->Id == 28527)
|
||||
return true;
|
||||
if (spellProtoB->Id == 28527)
|
||||
return false;
|
||||
|
||||
// Divine Aegis
|
||||
if (spellProtoA->Id == 47753)
|
||||
return true;
|
||||
if (spellProtoB->Id == 47753)
|
||||
return false;
|
||||
|
||||
// Ice Barrier
|
||||
if (spellProtoA->GetCategory() == 471)
|
||||
return true;
|
||||
if (spellProtoB->GetCategory() == 471)
|
||||
return false;
|
||||
|
||||
// Sacrifice
|
||||
if ((spellProtoA->SpellFamilyName == SPELLFAMILY_WARLOCK) &&
|
||||
(spellProtoA->SpellIconID == 693))
|
||||
return true;
|
||||
if ((spellProtoB->SpellFamilyName == SPELLFAMILY_WARLOCK) &&
|
||||
(spellProtoB->SpellIconID == 693))
|
||||
return false;
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif
|
||||
2718
src/server/game/Spells/Auras/SpellAuras.cpp
Normal file
2718
src/server/game/Spells/Auras/SpellAuras.cpp
Normal file
File diff suppressed because it is too large
Load Diff
304
src/server/game/Spells/Auras/SpellAuras.h
Normal file
304
src/server/game/Spells/Auras/SpellAuras.h
Normal file
@@ -0,0 +1,304 @@
|
||||
/*
|
||||
* Copyright (C)
|
||||
* Copyright (C)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef TRINITY_SPELLAURAS_H
|
||||
#define TRINITY_SPELLAURAS_H
|
||||
|
||||
#include "SpellAuraDefines.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "Unit.h"
|
||||
|
||||
class Unit;
|
||||
class SpellInfo;
|
||||
struct SpellModifier;
|
||||
struct ProcTriggerSpell;
|
||||
struct SpellProcEntry;
|
||||
|
||||
// forward decl
|
||||
class AuraEffect;
|
||||
class Aura;
|
||||
class DynamicObject;
|
||||
class AuraScript;
|
||||
class ProcInfo;
|
||||
|
||||
// update aura target map every 500 ms instead of every update - reduce amount of grid searcher calls
|
||||
#define UPDATE_TARGET_MAP_INTERVAL 500
|
||||
|
||||
class AuraApplication
|
||||
{
|
||||
friend void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask);
|
||||
friend void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode);
|
||||
friend void Unit::_ApplyAuraEffect(Aura* aura, uint8 effIndex);
|
||||
friend void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode);
|
||||
friend AuraApplication * Unit::_CreateAuraApplication(Aura* aura, uint8 effMask);
|
||||
private:
|
||||
Unit* const _target;
|
||||
Aura* const _base;
|
||||
AuraRemoveMode _removeMode:8; // Store info for know remove aura reason
|
||||
uint8 _slot; // Aura slot on unit
|
||||
uint8 _flags; // Aura info flag
|
||||
uint8 _effectsToApply; // Used only at spell hit to determine which effect should be applied
|
||||
bool _needClientUpdate:1;
|
||||
|
||||
// xinef: stacking
|
||||
uint8 _disableMask;
|
||||
|
||||
explicit AuraApplication(Unit* target, Unit* caster, Aura* base, uint8 effMask);
|
||||
void _Remove();
|
||||
private:
|
||||
void _InitFlags(Unit* caster, uint8 effMask);
|
||||
void _HandleEffect(uint8 effIndex, bool apply);
|
||||
public:
|
||||
|
||||
Unit* GetTarget() const { return _target; }
|
||||
Aura* GetBase() const { return _base; }
|
||||
|
||||
uint8 GetSlot() const { return _slot; }
|
||||
uint8 GetFlags() const { return _flags; }
|
||||
uint8 GetEffectMask() const { return _flags & (AFLAG_EFF_INDEX_0 | AFLAG_EFF_INDEX_1 | AFLAG_EFF_INDEX_2); }
|
||||
bool HasEffect(uint8 effect) const { ASSERT(effect < MAX_SPELL_EFFECTS); return _flags & (1<<effect); }
|
||||
bool IsPositive() const { return _flags & AFLAG_POSITIVE; }
|
||||
bool IsSelfcasted() const { return _flags & AFLAG_CASTER; }
|
||||
uint8 GetEffectsToApply() const { return _effectsToApply; }
|
||||
|
||||
void SetRemoveMode(AuraRemoveMode mode) { _removeMode = mode; }
|
||||
AuraRemoveMode GetRemoveMode() const {return _removeMode;}
|
||||
|
||||
void SetNeedClientUpdate() { _needClientUpdate = true;}
|
||||
bool IsNeedClientUpdate() const { return _needClientUpdate;}
|
||||
void BuildUpdatePacket(ByteBuffer& data, bool remove) const;
|
||||
void ClientUpdate(bool remove = false);
|
||||
|
||||
// xinef: stacking
|
||||
bool IsActive(uint8 effIdx) { return ((1 << effIdx) & _disableMask) == 0; }
|
||||
void SetDisableMask(uint8 effIdx) { _disableMask |= 1 << effIdx; }
|
||||
void RemoveDisableMask(uint8 effIdx) { _disableMask &= ~(1 << effIdx); }
|
||||
};
|
||||
|
||||
class Aura
|
||||
{
|
||||
friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID, bool noPeriodicReset);
|
||||
public:
|
||||
typedef std::map<uint64, AuraApplication *> ApplicationMap;
|
||||
|
||||
static uint8 BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleEffectMask, WorldObject* owner);
|
||||
static Aura* TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0, bool* refresh = NULL, bool periodicReset = false);
|
||||
static Aura* TryCreate(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0);
|
||||
static Aura* Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID);
|
||||
explicit Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, uint64 casterGUID);
|
||||
void _InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount);
|
||||
virtual ~Aura();
|
||||
|
||||
SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
|
||||
uint32 GetId() const{ return GetSpellInfo()->Id; }
|
||||
|
||||
uint64 GetCastItemGUID() const { return m_castItemGuid; }
|
||||
uint64 GetCasterGUID() const { return m_casterGuid; }
|
||||
Unit* GetCaster() const;
|
||||
WorldObject* GetOwner() const { return m_owner; }
|
||||
Unit* GetUnitOwner() const { ASSERT(GetType() == UNIT_AURA_TYPE); return (Unit*)m_owner; }
|
||||
DynamicObject* GetDynobjOwner() const { ASSERT(GetType() == DYNOBJ_AURA_TYPE); return (DynamicObject*)m_owner; }
|
||||
|
||||
AuraObjectType GetType() const;
|
||||
|
||||
virtual void _ApplyForTarget(Unit* target, Unit* caster, AuraApplication * auraApp);
|
||||
virtual void _UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraApp);
|
||||
void _Remove(AuraRemoveMode removeMode);
|
||||
virtual void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT) = 0;
|
||||
|
||||
virtual void FillTargetMap(std::map<Unit*, uint8> & targets, Unit* caster) = 0;
|
||||
void UpdateTargetMap(Unit* caster, bool apply = true);
|
||||
|
||||
void _RegisterForTargets() {Unit* caster = GetCaster(); UpdateTargetMap(caster, false);}
|
||||
void ApplyForTargets() {Unit* caster = GetCaster(); UpdateTargetMap(caster, true);}
|
||||
void _ApplyEffectForTargets(uint8 effIndex);
|
||||
|
||||
void UpdateOwner(uint32 diff, WorldObject* owner);
|
||||
void Update(uint32 diff, Unit* caster);
|
||||
|
||||
time_t GetApplyTime() const { return m_applyTime; }
|
||||
int32 GetMaxDuration() const { return m_maxDuration; }
|
||||
void SetMaxDuration(int32 duration) { m_maxDuration = duration; }
|
||||
int32 CalcMaxDuration() const { return CalcMaxDuration(GetCaster()); }
|
||||
int32 CalcMaxDuration(Unit* caster) const;
|
||||
int32 GetDuration() const { return m_duration; }
|
||||
void SetDuration(int32 duration, bool withMods = false);
|
||||
void RefreshDuration();
|
||||
void RefreshTimers(bool periodicReset = false);
|
||||
void RefreshTimersWithMods();
|
||||
bool IsExpired() const { return !GetDuration();}
|
||||
bool IsPermanent() const { return GetMaxDuration() == -1; }
|
||||
|
||||
uint8 GetCharges() const { return m_procCharges; }
|
||||
void SetCharges(uint8 charges);
|
||||
uint8 CalcMaxCharges(Unit* caster) const;
|
||||
uint8 CalcMaxCharges() const { return CalcMaxCharges(GetCaster()); }
|
||||
bool ModCharges(int32 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
bool DropCharge(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT) { return ModCharges(-1, removeMode); }
|
||||
|
||||
uint8 GetStackAmount() const { return m_stackAmount; }
|
||||
void SetStackAmount(uint8 num);
|
||||
bool ModStackAmount(int32 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT, bool periodicReset = false);
|
||||
|
||||
void RefreshSpellMods();
|
||||
|
||||
uint8 GetCasterLevel() const { return m_casterLevel; }
|
||||
|
||||
bool IsArea() const;
|
||||
bool IsPassive() const;
|
||||
bool IsDeathPersistent() const;
|
||||
bool IsRemovedOnShapeLost(Unit* target) const { return (GetCasterGUID() == target->GetGUID() && m_spellInfo->Stances && !m_spellInfo->HasAttribute(SPELL_ATTR2_NOT_NEED_SHAPESHIFT) && !m_spellInfo->HasAttribute(SPELL_ATTR0_NOT_SHAPESHIFT)); }
|
||||
bool CanBeSaved() const;
|
||||
bool IsRemoved() const { return m_isRemoved; }
|
||||
bool CanBeSentToClient() const;
|
||||
// Single cast aura helpers
|
||||
bool IsSingleTarget() const {return m_isSingleTarget; }
|
||||
bool IsSingleTargetWith(Aura const* aura) const;
|
||||
void SetIsSingleTarget(bool val) { m_isSingleTarget = val; }
|
||||
void UnregisterSingleTarget();
|
||||
int32 CalcDispelChance(Unit* auraTarget, bool offensive) const;
|
||||
|
||||
void SetLoadedState(int32 maxduration, int32 duration, int32 charges, uint8 stackamount, uint8 recalculateMask, int32 * amount);
|
||||
|
||||
// helpers for aura effects
|
||||
bool HasEffect(uint8 effIndex) const { return bool(GetEffect(effIndex)); }
|
||||
bool HasEffectType(AuraType type) const;
|
||||
AuraEffect* GetEffect(uint8 effIndex) const { ASSERT (effIndex < MAX_SPELL_EFFECTS); return m_effects[effIndex]; }
|
||||
uint8 GetEffectMask() const { uint8 effMask = 0; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (m_effects[i]) effMask |= 1<<i; return effMask; }
|
||||
void RecalculateAmountOfEffects();
|
||||
void HandleAllEffects(AuraApplication * aurApp, uint8 mode, bool apply);
|
||||
|
||||
// Helpers for targets
|
||||
ApplicationMap const & GetApplicationMap() {return m_applications;}
|
||||
void GetApplicationList(std::list<AuraApplication*> & applicationList) const;
|
||||
const AuraApplication * GetApplicationOfTarget (uint64 guid) const { ApplicationMap::const_iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; }
|
||||
AuraApplication * GetApplicationOfTarget (uint64 guid) { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; }
|
||||
bool IsAppliedOnTarget(uint64 guid) const { return m_applications.find(guid) != m_applications.end(); }
|
||||
|
||||
void SetNeedClientUpdateForTargets() const;
|
||||
void HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, bool apply, bool onReapply);
|
||||
bool CanBeAppliedOn(Unit* target);
|
||||
bool CheckAreaTarget(Unit* target);
|
||||
bool CanStackWith(Aura const* checkAura, bool remove) const;
|
||||
bool IsAuraStronger(Aura const* newAura) const;
|
||||
|
||||
// Proc system
|
||||
// this subsystem is not yet in use - the core of it is functional, but still some research has to be done
|
||||
// and some dependant problems fixed before it can replace old proc system (for example cooldown handling)
|
||||
// currently proc system functionality is implemented in Unit::ProcDamageAndSpell
|
||||
bool IsProcOnCooldown() const;
|
||||
void AddProcCooldown(uint32 msec);
|
||||
bool IsUsingCharges() const { return m_isUsingCharges; }
|
||||
void SetUsingCharges(bool val) { m_isUsingCharges = val; }
|
||||
void PrepareProcToTrigger(AuraApplication* aurApp, ProcEventInfo& eventInfo);
|
||||
bool IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventInfo) const;
|
||||
float CalcProcChance(SpellProcEntry const& procEntry, ProcEventInfo& eventInfo) const;
|
||||
void TriggerProcOnEvent(AuraApplication* aurApp, ProcEventInfo& eventInfo);
|
||||
|
||||
// AuraScript
|
||||
void LoadScripts();
|
||||
bool CallScriptCheckAreaTargetHandlers(Unit* target);
|
||||
void CallScriptDispel(DispelInfo* dispelInfo);
|
||||
void CallScriptAfterDispel(DispelInfo* dispelInfo);
|
||||
bool CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode);
|
||||
bool CallScriptEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode);
|
||||
void CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode);
|
||||
void CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode);
|
||||
bool CallScriptEffectPeriodicHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp);
|
||||
void CallScriptEffectUpdatePeriodicHandlers(AuraEffect* aurEff);
|
||||
void CallScriptEffectCalcAmountHandlers(AuraEffect const* aurEff, int32 & amount, bool & canBeRecalculated);
|
||||
void CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool & isPeriodic, int32 & amplitude);
|
||||
void CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellModifier* & spellMod);
|
||||
void CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & defaultPrevented);
|
||||
void CallScriptEffectAfterAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount);
|
||||
void CallScriptEffectManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & defaultPrevented);
|
||||
void CallScriptEffectAfterManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount);
|
||||
void CallScriptEffectSplitHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & splitAmount);
|
||||
|
||||
// Spell Proc Hooks
|
||||
bool CallScriptCheckProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo);
|
||||
bool CallScriptPrepareProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo);
|
||||
bool CallScriptProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo);
|
||||
void CallScriptAfterProcHandlers(AuraApplication const* aurApp, ProcEventInfo& eventInfo);
|
||||
bool CallScriptEffectProcHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, ProcEventInfo& eventInfo);
|
||||
void CallScriptAfterEffectProcHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, ProcEventInfo& eventInfo);
|
||||
|
||||
AuraScript* GetScriptByName(std::string const& scriptName) const;
|
||||
|
||||
std::list<AuraScript*> m_loadedScripts;
|
||||
private:
|
||||
void _DeleteRemovedApplications();
|
||||
protected:
|
||||
SpellInfo const* const m_spellInfo;
|
||||
uint64 const m_casterGuid;
|
||||
uint64 const m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted
|
||||
time_t const m_applyTime;
|
||||
WorldObject* const m_owner; //
|
||||
|
||||
int32 m_maxDuration; // Max aura duration
|
||||
int32 m_duration; // Current time
|
||||
int32 m_timeCla; // Timer for power per sec calcultion
|
||||
int32 m_updateTargetMapInterval; // Timer for UpdateTargetMapOfEffect
|
||||
|
||||
uint8 const m_casterLevel; // Aura level (store caster level for correct show level dep amount)
|
||||
uint8 m_procCharges; // Aura charges (0 for infinite)
|
||||
uint8 m_stackAmount; // Aura stack amount
|
||||
|
||||
AuraEffect* m_effects[3];
|
||||
ApplicationMap m_applications;
|
||||
|
||||
bool m_isRemoved:1;
|
||||
bool m_isSingleTarget:1; // true if it's a single target spell and registered at caster - can change at spell steal for example
|
||||
bool m_isUsingCharges:1;
|
||||
|
||||
private:
|
||||
Unit::AuraApplicationList m_removedApplications;
|
||||
};
|
||||
|
||||
class UnitAura : public Aura
|
||||
{
|
||||
friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
|
||||
protected:
|
||||
explicit UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
|
||||
public:
|
||||
void _ApplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp);
|
||||
void _UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp);
|
||||
|
||||
void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
|
||||
void FillTargetMap(std::map<Unit*, uint8> & targets, Unit* caster);
|
||||
|
||||
// Allow Apply Aura Handler to modify and access m_AuraDRGroup
|
||||
void SetDiminishGroup(DiminishingGroup group) { m_AuraDRGroup = group; }
|
||||
DiminishingGroup GetDiminishGroup() const { return m_AuraDRGroup; }
|
||||
|
||||
private:
|
||||
DiminishingGroup m_AuraDRGroup:8; // Diminishing
|
||||
};
|
||||
|
||||
class DynObjAura : public Aura
|
||||
{
|
||||
friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
|
||||
protected:
|
||||
explicit DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID);
|
||||
public:
|
||||
void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
|
||||
void FillTargetMap(std::map<Unit*, uint8> & targets, Unit* caster);
|
||||
};
|
||||
#endif
|
||||
8216
src/server/game/Spells/Spell.cpp
Normal file
8216
src/server/game/Spells/Spell.cpp
Normal file
File diff suppressed because it is too large
Load Diff
809
src/server/game/Spells/Spell.h
Normal file
809
src/server/game/Spells/Spell.h
Normal file
@@ -0,0 +1,809 @@
|
||||
/*
|
||||
* Copyright (C)
|
||||
* Copyright (C)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __SPELL_H
|
||||
#define __SPELL_H
|
||||
|
||||
#include "GridDefines.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "SpellInfo.h"
|
||||
#include "PathGenerator.h"
|
||||
|
||||
class Unit;
|
||||
class Player;
|
||||
class GameObject;
|
||||
class DynamicObject;
|
||||
class WorldObject;
|
||||
class Aura;
|
||||
class SpellScript;
|
||||
class ByteBuffer;
|
||||
|
||||
#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILLISECONDS)
|
||||
|
||||
enum SpellCastFlags
|
||||
{
|
||||
CAST_FLAG_NONE = 0x00000000,
|
||||
CAST_FLAG_PENDING = 0x00000001, // aoe combat log?
|
||||
CAST_FLAG_UNKNOWN_2 = 0x00000002,
|
||||
CAST_FLAG_UNKNOWN_3 = 0x00000004,
|
||||
CAST_FLAG_UNKNOWN_4 = 0x00000008, // ignore AOE visual
|
||||
CAST_FLAG_UNKNOWN_5 = 0x00000010,
|
||||
CAST_FLAG_AMMO = 0x00000020, // Projectiles visual
|
||||
CAST_FLAG_UNKNOWN_7 = 0x00000040,
|
||||
CAST_FLAG_UNKNOWN_8 = 0x00000080,
|
||||
CAST_FLAG_UNKNOWN_9 = 0x00000100,
|
||||
CAST_FLAG_UNKNOWN_10 = 0x00000200,
|
||||
CAST_FLAG_UNKNOWN_11 = 0x00000400,
|
||||
CAST_FLAG_POWER_LEFT_SELF = 0x00000800,
|
||||
CAST_FLAG_UNKNOWN_13 = 0x00001000,
|
||||
CAST_FLAG_UNKNOWN_14 = 0x00002000,
|
||||
CAST_FLAG_UNKNOWN_15 = 0x00004000,
|
||||
CAST_FLAG_UNKNOWN_16 = 0x00008000,
|
||||
CAST_FLAG_UNKNOWN_17 = 0x00010000,
|
||||
CAST_FLAG_ADJUST_MISSILE = 0x00020000,
|
||||
CAST_FLAG_NO_GCD = 0x00040000, // no GCD for spell casts from charm/summon (vehicle spells is an example)
|
||||
CAST_FLAG_VISUAL_CHAIN = 0x00080000,
|
||||
CAST_FLAG_UNKNOWN_21 = 0x00100000,
|
||||
CAST_FLAG_RUNE_LIST = 0x00200000,
|
||||
CAST_FLAG_UNKNOWN_23 = 0x00400000,
|
||||
CAST_FLAG_UNKNOWN_24 = 0x00800000,
|
||||
CAST_FLAG_UNKNOWN_25 = 0x01000000,
|
||||
CAST_FLAG_UNKNOWN_26 = 0x02000000,
|
||||
CAST_FLAG_IMMUNITY = 0x04000000,
|
||||
CAST_FLAG_UNKNOWN_28 = 0x08000000,
|
||||
CAST_FLAG_UNKNOWN_29 = 0x10000000,
|
||||
CAST_FLAG_UNKNOWN_30 = 0x20000000,
|
||||
CAST_FLAG_UNKNOWN_31 = 0x40000000,
|
||||
CAST_FLAG_UNKNOWN_32 = 0x80000000,
|
||||
};
|
||||
|
||||
enum SpellRangeFlag
|
||||
{
|
||||
SPELL_RANGE_DEFAULT = 0,
|
||||
SPELL_RANGE_MELEE = 1, //melee
|
||||
SPELL_RANGE_RANGED = 2, //hunter range and ranged weapon
|
||||
};
|
||||
|
||||
struct SpellDestination
|
||||
{
|
||||
SpellDestination();
|
||||
SpellDestination(float x, float y, float z, float orientation = 0.0f, uint32 mapId = MAPID_INVALID);
|
||||
SpellDestination(Position const& pos);
|
||||
SpellDestination(WorldObject const& wObj);
|
||||
|
||||
void Relocate(Position const& pos);
|
||||
void RelocateOffset(Position const& offset);
|
||||
|
||||
WorldLocation _position;
|
||||
uint64 _transportGUID;
|
||||
Position _transportOffset;
|
||||
};
|
||||
|
||||
class SpellCastTargets
|
||||
{
|
||||
public:
|
||||
SpellCastTargets();
|
||||
~SpellCastTargets();
|
||||
|
||||
void Read(ByteBuffer& data, Unit* caster);
|
||||
void Write(ByteBuffer& data);
|
||||
|
||||
uint32 GetTargetMask() const { return m_targetMask; }
|
||||
void SetTargetMask(uint32 newMask) { m_targetMask = newMask; }
|
||||
|
||||
void SetTargetFlag(SpellCastTargetFlags flag) { m_targetMask |= flag; }
|
||||
|
||||
uint64 GetUnitTargetGUID() const;
|
||||
Unit* GetUnitTarget() const;
|
||||
void SetUnitTarget(Unit* target);
|
||||
|
||||
uint64 GetGOTargetGUID() const;
|
||||
GameObject* GetGOTarget() const;
|
||||
void SetGOTarget(GameObject* target);
|
||||
|
||||
uint64 GetCorpseTargetGUID() const;
|
||||
Corpse* GetCorpseTarget() const;
|
||||
|
||||
WorldObject* GetObjectTarget() const;
|
||||
uint64 GetObjectTargetGUID() const;
|
||||
void RemoveObjectTarget();
|
||||
|
||||
uint64 GetItemTargetGUID() const { return m_itemTargetGUID; }
|
||||
Item* GetItemTarget() const { return m_itemTarget; }
|
||||
uint32 GetItemTargetEntry() const { return m_itemTargetEntry; }
|
||||
void SetItemTarget(Item* item);
|
||||
void SetTradeItemTarget(Player* caster);
|
||||
void UpdateTradeSlotItem();
|
||||
|
||||
SpellDestination const* GetSrc() const;
|
||||
Position const* GetSrcPos() const;
|
||||
void SetSrc(float x, float y, float z);
|
||||
void SetSrc(Position const& pos);
|
||||
void SetSrc(WorldObject const& wObj);
|
||||
void ModSrc(Position const& pos);
|
||||
void RemoveSrc();
|
||||
|
||||
SpellDestination const* GetDst() const;
|
||||
WorldLocation const* GetDstPos() const;
|
||||
void SetDst(float x, float y, float z, float orientation, uint32 mapId = MAPID_INVALID);
|
||||
void SetDst(Position const& pos);
|
||||
void SetDst(WorldObject const& wObj);
|
||||
void SetDst(SpellDestination const& spellDest);
|
||||
void SetDst(SpellCastTargets const& spellTargets);
|
||||
void ModDst(Position const& pos);
|
||||
void ModDst(SpellDestination const& spellDest);
|
||||
void RemoveDst();
|
||||
|
||||
bool HasSrc() const { return GetTargetMask() & TARGET_FLAG_SOURCE_LOCATION; }
|
||||
bool HasDst() const { return GetTargetMask() & TARGET_FLAG_DEST_LOCATION; }
|
||||
bool HasTraj() const { return m_speed != 0; }
|
||||
|
||||
float GetElevation() const { return m_elevation; }
|
||||
void SetElevation(float elevation) { m_elevation = elevation; }
|
||||
float GetSpeed() const { return m_speed; }
|
||||
void SetSpeed(float speed) { m_speed = speed; }
|
||||
|
||||
float GetDist2d() const { return m_src._position.GetExactDist2d(&m_dst._position); }
|
||||
float GetSpeedXY() const { return m_speed * cos(m_elevation); }
|
||||
float GetSpeedZ() const { return m_speed * sin(m_elevation); }
|
||||
|
||||
void Update(Unit* caster);
|
||||
void OutDebug() const;
|
||||
|
||||
// Xinef: Channel data
|
||||
void SetObjectTargetChannel(uint64 targetGUID);
|
||||
void SetDstChannel(SpellDestination const& spellDest);
|
||||
WorldObject* GetObjectTargetChannel(Unit* caster) const;
|
||||
bool HasDstChannel() const;
|
||||
SpellDestination const* GetDstChannel() const;
|
||||
|
||||
private:
|
||||
uint32 m_targetMask;
|
||||
|
||||
// objects (can be used at spell creating and after Update at casting)
|
||||
WorldObject* m_objectTarget;
|
||||
Item* m_itemTarget;
|
||||
|
||||
// object GUID/etc, can be used always
|
||||
uint64 m_objectTargetGUID;
|
||||
uint64 m_itemTargetGUID;
|
||||
uint32 m_itemTargetEntry;
|
||||
|
||||
SpellDestination m_src;
|
||||
SpellDestination m_dst;
|
||||
|
||||
float m_elevation, m_speed;
|
||||
std::string m_strTarget;
|
||||
|
||||
// Xinef: Save channel data
|
||||
SpellDestination m_dstChannel;
|
||||
uint64 m_objectTargetGUIDChannel;
|
||||
};
|
||||
|
||||
struct SpellValue
|
||||
{
|
||||
explicit SpellValue(SpellInfo const* proto);
|
||||
int32 EffectBasePoints[MAX_SPELL_EFFECTS];
|
||||
uint32 MaxAffectedTargets;
|
||||
float RadiusMod;
|
||||
uint8 AuraStackAmount;
|
||||
bool ForcedCritResult;
|
||||
};
|
||||
|
||||
enum SpellState
|
||||
{
|
||||
SPELL_STATE_NULL = 0,
|
||||
SPELL_STATE_PREPARING = 1,
|
||||
SPELL_STATE_CASTING = 2,
|
||||
SPELL_STATE_FINISHED = 3,
|
||||
SPELL_STATE_IDLE = 4,
|
||||
SPELL_STATE_DELAYED = 5
|
||||
};
|
||||
|
||||
enum SpellEffectHandleMode
|
||||
{
|
||||
SPELL_EFFECT_HANDLE_LAUNCH,
|
||||
SPELL_EFFECT_HANDLE_LAUNCH_TARGET,
|
||||
SPELL_EFFECT_HANDLE_HIT,
|
||||
SPELL_EFFECT_HANDLE_HIT_TARGET,
|
||||
};
|
||||
|
||||
// Xinef: special structure containing data for channel target spells
|
||||
struct ChannelTargetData
|
||||
{
|
||||
ChannelTargetData(uint64 cguid, const SpellDestination* dst) : channelGUID(cguid)
|
||||
{
|
||||
if (dst)
|
||||
spellDst = *dst;
|
||||
}
|
||||
|
||||
uint64 channelGUID;
|
||||
SpellDestination spellDst;
|
||||
};
|
||||
|
||||
class Spell
|
||||
{
|
||||
friend void Unit::SetCurrentCastedSpell(Spell* pSpell);
|
||||
friend class SpellScript;
|
||||
public:
|
||||
|
||||
void EffectNULL(SpellEffIndex effIndex);
|
||||
void EffectUnused(SpellEffIndex effIndex);
|
||||
void EffectDistract(SpellEffIndex effIndex);
|
||||
void EffectPull(SpellEffIndex effIndex);
|
||||
void EffectSchoolDMG(SpellEffIndex effIndex);
|
||||
void EffectEnvironmentalDMG(SpellEffIndex effIndex);
|
||||
void EffectInstaKill(SpellEffIndex effIndex);
|
||||
void EffectDummy(SpellEffIndex effIndex);
|
||||
void EffectTeleportUnits(SpellEffIndex effIndex);
|
||||
void EffectApplyAura(SpellEffIndex effIndex);
|
||||
void EffectSendEvent(SpellEffIndex effIndex);
|
||||
void EffectPowerBurn(SpellEffIndex effIndex);
|
||||
void EffectPowerDrain(SpellEffIndex effIndex);
|
||||
void EffectHeal(SpellEffIndex effIndex);
|
||||
void EffectBind(SpellEffIndex effIndex);
|
||||
void EffectHealthLeech(SpellEffIndex effIndex);
|
||||
void EffectQuestComplete(SpellEffIndex effIndex);
|
||||
void EffectCreateItem(SpellEffIndex effIndex);
|
||||
void EffectCreateItem2(SpellEffIndex effIndex);
|
||||
void EffectCreateRandomItem(SpellEffIndex effIndex);
|
||||
void EffectPersistentAA(SpellEffIndex effIndex);
|
||||
void EffectEnergize(SpellEffIndex effIndex);
|
||||
void EffectOpenLock(SpellEffIndex effIndex);
|
||||
void EffectSummonChangeItem(SpellEffIndex effIndex);
|
||||
void EffectProficiency(SpellEffIndex effIndex);
|
||||
void EffectApplyAreaAura(SpellEffIndex effIndex);
|
||||
void EffectSummonType(SpellEffIndex effIndex);
|
||||
void EffectLearnSpell(SpellEffIndex effIndex);
|
||||
void EffectDispel(SpellEffIndex effIndex);
|
||||
void EffectDualWield(SpellEffIndex effIndex);
|
||||
void EffectPickPocket(SpellEffIndex effIndex);
|
||||
void EffectAddFarsight(SpellEffIndex effIndex);
|
||||
void EffectUntrainTalents(SpellEffIndex effIndex);
|
||||
void EffectHealMechanical(SpellEffIndex effIndex);
|
||||
void EffectJump(SpellEffIndex effIndex);
|
||||
void EffectJumpDest(SpellEffIndex effIndex);
|
||||
void EffectLeapBack(SpellEffIndex effIndex);
|
||||
void EffectQuestClear(SpellEffIndex effIndex);
|
||||
void EffectTeleUnitsFaceCaster(SpellEffIndex effIndex);
|
||||
void EffectLearnSkill(SpellEffIndex effIndex);
|
||||
void EffectAddHonor(SpellEffIndex effIndex);
|
||||
void EffectTradeSkill(SpellEffIndex effIndex);
|
||||
void EffectEnchantItemPerm(SpellEffIndex effIndex);
|
||||
void EffectEnchantItemTmp(SpellEffIndex effIndex);
|
||||
void EffectTameCreature(SpellEffIndex effIndex);
|
||||
void EffectSummonPet(SpellEffIndex effIndex);
|
||||
void EffectLearnPetSpell(SpellEffIndex effIndex);
|
||||
void EffectWeaponDmg(SpellEffIndex effIndex);
|
||||
void EffectForceCast(SpellEffIndex effIndex);
|
||||
void EffectTriggerSpell(SpellEffIndex effIndex);
|
||||
void EffectTriggerMissileSpell(SpellEffIndex effIndex);
|
||||
void EffectThreat(SpellEffIndex effIndex);
|
||||
void EffectHealMaxHealth(SpellEffIndex effIndex);
|
||||
void EffectInterruptCast(SpellEffIndex effIndex);
|
||||
void EffectSummonObjectWild(SpellEffIndex effIndex);
|
||||
void EffectScriptEffect(SpellEffIndex effIndex);
|
||||
void EffectSanctuary(SpellEffIndex effIndex);
|
||||
void EffectAddComboPoints(SpellEffIndex effIndex);
|
||||
void EffectDuel(SpellEffIndex effIndex);
|
||||
void EffectStuck(SpellEffIndex effIndex);
|
||||
void EffectSummonPlayer(SpellEffIndex effIndex);
|
||||
void EffectActivateObject(SpellEffIndex effIndex);
|
||||
void EffectApplyGlyph(SpellEffIndex effIndex);
|
||||
void EffectEnchantHeldItem(SpellEffIndex effIndex);
|
||||
void EffectSummonObject(SpellEffIndex effIndex);
|
||||
void EffectResurrect(SpellEffIndex effIndex);
|
||||
void EffectParry(SpellEffIndex effIndex);
|
||||
void EffectBlock(SpellEffIndex effIndex);
|
||||
void EffectLeap(SpellEffIndex effIndex);
|
||||
void EffectTransmitted(SpellEffIndex effIndex);
|
||||
void EffectDisEnchant(SpellEffIndex effIndex);
|
||||
void EffectInebriate(SpellEffIndex effIndex);
|
||||
void EffectFeedPet(SpellEffIndex effIndex);
|
||||
void EffectDismissPet(SpellEffIndex effIndex);
|
||||
void EffectReputation(SpellEffIndex effIndex);
|
||||
void EffectForceDeselect(SpellEffIndex effIndex);
|
||||
void EffectSelfResurrect(SpellEffIndex effIndex);
|
||||
void EffectSkinning(SpellEffIndex effIndex);
|
||||
void EffectCharge(SpellEffIndex effIndex);
|
||||
void EffectChargeDest(SpellEffIndex effIndex);
|
||||
void EffectProspecting(SpellEffIndex effIndex);
|
||||
void EffectMilling(SpellEffIndex effIndex);
|
||||
void EffectRenamePet(SpellEffIndex effIndex);
|
||||
void EffectSendTaxi(SpellEffIndex effIndex);
|
||||
void EffectSummonCritter(SpellEffIndex effIndex);
|
||||
void EffectKnockBack(SpellEffIndex effIndex);
|
||||
void EffectPullTowards(SpellEffIndex effIndex);
|
||||
void EffectDispelMechanic(SpellEffIndex effIndex);
|
||||
void EffectResurrectPet(SpellEffIndex effIndex);
|
||||
void EffectDestroyAllTotems(SpellEffIndex effIndex);
|
||||
void EffectDurabilityDamage(SpellEffIndex effIndex);
|
||||
void EffectSkill(SpellEffIndex effIndex);
|
||||
void EffectTaunt(SpellEffIndex effIndex);
|
||||
void EffectDurabilityDamagePCT(SpellEffIndex effIndex);
|
||||
void EffectModifyThreatPercent(SpellEffIndex effIndex);
|
||||
void EffectResurrectNew(SpellEffIndex effIndex);
|
||||
void EffectAddExtraAttacks(SpellEffIndex effIndex);
|
||||
void EffectSpiritHeal(SpellEffIndex effIndex);
|
||||
void EffectSkinPlayerCorpse(SpellEffIndex effIndex);
|
||||
void EffectStealBeneficialBuff(SpellEffIndex effIndex);
|
||||
void EffectUnlearnSpecialization(SpellEffIndex effIndex);
|
||||
void EffectHealPct(SpellEffIndex effIndex);
|
||||
void EffectEnergizePct(SpellEffIndex effIndex);
|
||||
void EffectTriggerRitualOfSummoning(SpellEffIndex effIndex);
|
||||
void EffectSummonRaFFriend(SpellEffIndex effIndex);
|
||||
void EffectKillCreditPersonal(SpellEffIndex effIndex);
|
||||
void EffectKillCredit(SpellEffIndex effIndex);
|
||||
void EffectQuestFail(SpellEffIndex effIndex);
|
||||
void EffectQuestStart(SpellEffIndex effIndex);
|
||||
void EffectRedirectThreat(SpellEffIndex effIndex);
|
||||
void EffectGameObjectDamage(SpellEffIndex effIndex);
|
||||
void EffectGameObjectRepair(SpellEffIndex effIndex);
|
||||
void EffectGameObjectSetDestructionState(SpellEffIndex effIndex);
|
||||
void EffectActivateRune(SpellEffIndex effIndex);
|
||||
void EffectCreateTamedPet(SpellEffIndex effIndex);
|
||||
void EffectDiscoverTaxi(SpellEffIndex effIndex);
|
||||
void EffectTitanGrip(SpellEffIndex effIndex);
|
||||
void EffectEnchantItemPrismatic(SpellEffIndex effIndex);
|
||||
void EffectPlayMusic(SpellEffIndex effIndex);
|
||||
void EffectSpecCount(SpellEffIndex effIndex);
|
||||
void EffectActivateSpec(SpellEffIndex effIndex);
|
||||
void EffectPlaySound(SpellEffIndex effIndex);
|
||||
void EffectRemoveAura(SpellEffIndex effIndex);
|
||||
void EffectCastButtons(SpellEffIndex effIndex);
|
||||
void EffectRechargeManaGem(SpellEffIndex effIndex);
|
||||
|
||||
typedef std::set<Aura*> UsedSpellMods;
|
||||
|
||||
Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, uint64 originalCasterGUID = 0, bool skipCheck = false);
|
||||
~Spell();
|
||||
|
||||
void InitExplicitTargets(SpellCastTargets const& targets);
|
||||
void SelectExplicitTargets();
|
||||
|
||||
void SelectSpellTargets();
|
||||
void SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32& processedEffectMask);
|
||||
void SelectImplicitChannelTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType);
|
||||
void SelectImplicitNearbyTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask);
|
||||
void SelectImplicitConeTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask);
|
||||
void SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, uint32 effMask);
|
||||
void SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType);
|
||||
void SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType);
|
||||
void SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType);
|
||||
void SelectImplicitCasterObjectTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType);
|
||||
void SelectImplicitTargetObjectTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType);
|
||||
void SelectImplicitChainTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType, WorldObject* target, uint32 effMask);
|
||||
void SelectImplicitTrajTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType);
|
||||
|
||||
void SelectEffectTypeImplicitTargets(uint8 effIndex);
|
||||
|
||||
uint32 GetSearcherTypeMask(SpellTargetObjectTypes objType, ConditionList* condList);
|
||||
template<class SEARCHER> void SearchTargets(SEARCHER& searcher, uint32 containerMask, Unit* referer, Position const* pos, float radius);
|
||||
|
||||
WorldObject* SearchNearbyTarget(float range, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList = NULL);
|
||||
void SearchAreaTargets(std::list<WorldObject*>& targets, float range, Position const* position, Unit* referer, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectionType, ConditionList* condList);
|
||||
void SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTargets, WorldObject* target, SpellTargetObjectTypes objectType, SpellTargetCheckTypes selectType, SpellTargetSelectionCategories selectCategory, ConditionList* condList, bool isChainHeal);
|
||||
|
||||
void prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = NULL);
|
||||
void cancel(bool bySelf = false);
|
||||
void update(uint32 difftime);
|
||||
void cast(bool skipCheck = false);
|
||||
void _cast(bool skipCheck);
|
||||
void finish(bool ok = true);
|
||||
void TakePower();
|
||||
void TakeAmmo();
|
||||
|
||||
void TakeRunePower(bool didHit);
|
||||
void TakeReagents();
|
||||
void TakeCastItem();
|
||||
|
||||
SpellCastResult CheckCast(bool strict);
|
||||
SpellCastResult CheckPetCast(Unit* target);
|
||||
|
||||
// handlers
|
||||
void handle_immediate();
|
||||
uint64 handle_delayed(uint64 t_offset);
|
||||
// handler helpers
|
||||
void _handle_immediate_phase();
|
||||
void _handle_finish_phase();
|
||||
|
||||
SpellCastResult CheckItems();
|
||||
SpellCastResult CheckSpellFocus();
|
||||
SpellCastResult CheckRange(bool strict);
|
||||
SpellCastResult CheckPower();
|
||||
SpellCastResult CheckRuneCost(uint32 runeCostID);
|
||||
SpellCastResult CheckCasterAuras(bool preventionOnly) const;
|
||||
|
||||
int32 CalculateSpellDamage(uint8 i, Unit const* target) const { return m_caster->CalculateSpellDamage(target, m_spellInfo, i, &m_spellValue->EffectBasePoints[i]); }
|
||||
|
||||
bool HaveTargetsForEffect(uint8 effect) const;
|
||||
void Delayed();
|
||||
void DelayedChannel();
|
||||
uint32 getState() const { return m_spellState; }
|
||||
void setState(uint32 state) { m_spellState = state; }
|
||||
|
||||
void DoCreateItem(uint8 effIndex, uint32 itemId);
|
||||
void WriteSpellGoTargets(WorldPacket* data);
|
||||
void WriteAmmoToPacket(WorldPacket* data);
|
||||
|
||||
bool CheckEffectTarget(Unit const* target, uint32 eff) const;
|
||||
bool CanAutoCast(Unit* target);
|
||||
void CheckSrc() { if (!m_targets.HasSrc()) m_targets.SetSrc(*m_caster); }
|
||||
void CheckDst() { if (!m_targets.HasDst()) m_targets.SetDst(*m_caster); }
|
||||
|
||||
static void WriteCastResultInfo(WorldPacket& data, Player* caster, SpellInfo const* spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError);
|
||||
static void SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 castCount, SpellCastResult result, SpellCustomErrors customError = SPELL_CUSTOM_ERROR_NONE);
|
||||
void SendCastResult(SpellCastResult result);
|
||||
void SendPetCastResult(SpellCastResult result);
|
||||
void SendSpellStart();
|
||||
void SendSpellGo();
|
||||
void SendSpellCooldown();
|
||||
void SendLogExecute();
|
||||
void ExecuteLogEffectTakeTargetPower(uint8 effIndex, Unit* target, uint32 powerType, uint32 powerTaken, float gainMultiplier);
|
||||
void ExecuteLogEffectExtraAttacks(uint8 effIndex, Unit* victim, uint32 attCount);
|
||||
void ExecuteLogEffectInterruptCast(uint8 effIndex, Unit* victim, uint32 spellId);
|
||||
void ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, int32 itemId, int32 slot);
|
||||
void ExecuteLogEffectOpenLock(uint8 effIndex, Object* obj);
|
||||
void ExecuteLogEffectCreateItem(uint8 effIndex, uint32 entry);
|
||||
void ExecuteLogEffectDestroyItem(uint8 effIndex, uint32 entry);
|
||||
void ExecuteLogEffectSummonObject(uint8 effIndex, WorldObject* obj);
|
||||
void ExecuteLogEffectUnsummonObject(uint8 effIndex, WorldObject* obj);
|
||||
void ExecuteLogEffectResurrect(uint8 effIndex, Unit* target);
|
||||
void SendInterrupted(uint8 result);
|
||||
void SendChannelUpdate(uint32 time);
|
||||
void SendChannelStart(uint32 duration);
|
||||
void SendResurrectRequest(Player* target);
|
||||
|
||||
void HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOTarget, uint32 i, SpellEffectHandleMode mode);
|
||||
void HandleThreatSpells();
|
||||
|
||||
SpellInfo const* const m_spellInfo;
|
||||
Item* m_CastItem;
|
||||
uint64 m_castItemGUID;
|
||||
uint8 m_cast_count;
|
||||
uint32 m_glyphIndex;
|
||||
uint32 m_preCastSpell;
|
||||
SpellCastTargets m_targets;
|
||||
SpellCustomErrors m_customError;
|
||||
|
||||
UsedSpellMods m_appliedMods;
|
||||
|
||||
PathGenerator* m_pathFinder; // pussywizard: for precomputing path for charge
|
||||
|
||||
int32 GetCastTime() const { return m_casttime; }
|
||||
bool IsAutoRepeat() const { return m_autoRepeat; }
|
||||
void SetAutoRepeat(bool rep) { m_autoRepeat = rep; }
|
||||
void ReSetTimer() { m_timer = m_casttime > 0 ? m_casttime : 0; }
|
||||
bool IsNextMeleeSwingSpell() const;
|
||||
bool IsTriggered() const { return _triggeredCastFlags & TRIGGERED_FULL_MASK; };
|
||||
bool IsChannelActive() const { return m_caster->GetUInt32Value(UNIT_CHANNEL_SPELL) != 0; }
|
||||
bool IsAutoActionResetSpell() const;
|
||||
|
||||
bool IsDeletable() const { return !m_referencedFromCurrentSpell && !m_executedCurrently; }
|
||||
void SetReferencedFromCurrent(bool yes) { m_referencedFromCurrentSpell = yes; }
|
||||
bool IsInterruptable() const { return !m_executedCurrently; }
|
||||
void SetExecutedCurrently(bool yes) {m_executedCurrently = yes;}
|
||||
uint64 GetDelayStart() const { return m_delayStart; }
|
||||
void SetDelayStart(uint64 m_time) { m_delayStart = m_time; }
|
||||
uint64 GetDelayMoment() const { return m_delayMoment; }
|
||||
uint64 GetDelayTrajectory() const { return m_delayTrajectory; }
|
||||
|
||||
bool IsNeedSendToClient(bool go) const;
|
||||
|
||||
CurrentSpellTypes GetCurrentContainer() const;
|
||||
|
||||
Unit* GetCaster() const { return m_caster; }
|
||||
Unit* GetOriginalCaster() const { return m_originalCaster; }
|
||||
SpellInfo const* GetSpellInfo() const { return m_spellInfo; }
|
||||
int32 GetPowerCost() const { return m_powerCost; }
|
||||
|
||||
bool UpdatePointers(); // must be used at call Spell code after time delay (non triggered spell cast/update spell call/etc)
|
||||
|
||||
void CleanupTargetList();
|
||||
|
||||
void SetSpellValue(SpellValueMod mod, int32 value);
|
||||
SpellValue const* const GetSpellValue() { return m_spellValue; }
|
||||
|
||||
// xinef: moved to public
|
||||
void LoadScripts();
|
||||
|
||||
// Targets store structures and data
|
||||
struct TargetInfo
|
||||
{
|
||||
uint64 targetGUID;
|
||||
uint64 timeDelay;
|
||||
SpellMissInfo missCondition:8;
|
||||
SpellMissInfo reflectResult:8;
|
||||
uint8 effectMask:8;
|
||||
bool processed:1;
|
||||
bool alive:1;
|
||||
bool crit:1;
|
||||
bool scaleAura:1;
|
||||
int32 damage;
|
||||
};
|
||||
std::list<TargetInfo>* GetUniqueTargetInfo() { return &m_UniqueTargetInfo; }
|
||||
protected:
|
||||
bool HasGlobalCooldown() const;
|
||||
void TriggerGlobalCooldown();
|
||||
void CancelGlobalCooldown();
|
||||
|
||||
void SendLoot(uint64 guid, LootType loottype);
|
||||
|
||||
Unit* const m_caster;
|
||||
|
||||
SpellValue * const m_spellValue;
|
||||
|
||||
uint64 m_originalCasterGUID; // real source of cast (aura caster/etc), used for spell targets selection
|
||||
// e.g. damage around area spell trigered by victim aura and damage enemies of aura caster
|
||||
Unit* m_originalCaster; // cached pointer for m_originalCaster, updated at Spell::UpdatePointers()
|
||||
|
||||
Spell** m_selfContainer; // pointer to our spell container (if applicable)
|
||||
|
||||
//Spell data
|
||||
SpellSchoolMask m_spellSchoolMask; // Spell school (can be overwrite for some spells (wand shoot for example)
|
||||
WeaponAttackType m_attackType; // For weapon based attack
|
||||
int32 m_powerCost; // Calculated spell cost initialized only in Spell::prepare
|
||||
int32 m_casttime; // Calculated spell cast time initialized only in Spell::prepare
|
||||
int32 m_channeledDuration; // Calculated channeled spell duration in order to calculate correct pushback.
|
||||
bool m_canReflect; // can reflect this spell?
|
||||
bool m_autoRepeat;
|
||||
uint8 m_runesState;
|
||||
|
||||
uint8 m_delayAtDamageCount;
|
||||
bool isDelayableNoMore()
|
||||
{
|
||||
if (m_delayAtDamageCount >= 2)
|
||||
return true;
|
||||
|
||||
m_delayAtDamageCount++;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Delayed spells system
|
||||
uint64 m_delayStart; // time of spell delay start, filled by event handler, zero = just started
|
||||
uint64 m_delayMoment; // moment of next delay call, used internally
|
||||
uint64 m_delayTrajectory; // Xinef: Trajectory delay
|
||||
bool m_immediateHandled; // were immediate actions handled? (used by delayed spells only)
|
||||
|
||||
// These vars are used in both delayed spell system and modified immediate spell system
|
||||
bool m_referencedFromCurrentSpell; // mark as references to prevent deleted and access by dead pointers
|
||||
bool m_executedCurrently; // mark as executed to prevent deleted and access by dead pointers
|
||||
bool m_needComboPoints;
|
||||
uint8 m_applyMultiplierMask;
|
||||
float m_damageMultipliers[3];
|
||||
|
||||
// Current targets, to be used in SpellEffects (MUST BE USED ONLY IN SPELL EFFECTS)
|
||||
Unit* unitTarget;
|
||||
Item* itemTarget;
|
||||
GameObject* gameObjTarget;
|
||||
WorldLocation* destTarget;
|
||||
int32 damage;
|
||||
SpellEffectHandleMode effectHandleMode;
|
||||
// used in effects handlers
|
||||
Aura* m_spellAura;
|
||||
|
||||
// this is set in Spell Hit, but used in Apply Aura handler
|
||||
DiminishingLevels m_diminishLevel;
|
||||
DiminishingGroup m_diminishGroup;
|
||||
|
||||
// -------------------------------------------
|
||||
GameObject* focusObject;
|
||||
|
||||
// Damage and healing in effects need just calculate
|
||||
int32 m_damage; // Damge in effects count here
|
||||
int32 m_healing; // Healing in effects count here
|
||||
|
||||
// ******************************************
|
||||
// Spell trigger system
|
||||
// ******************************************
|
||||
uint32 m_procAttacker; // Attacker trigger flags
|
||||
uint32 m_procVictim; // Victim trigger flags
|
||||
uint32 m_procEx;
|
||||
void prepareDataForTriggerSystem(AuraEffect const* triggeredByAura);
|
||||
|
||||
// *****************************************
|
||||
// Spell target subsystem
|
||||
// *****************************************
|
||||
std::list<TargetInfo> m_UniqueTargetInfo;
|
||||
uint8 m_channelTargetEffectMask; // Mask req. alive targets
|
||||
|
||||
struct GOTargetInfo
|
||||
{
|
||||
uint64 targetGUID;
|
||||
uint64 timeDelay;
|
||||
uint8 effectMask:8;
|
||||
bool processed:1;
|
||||
};
|
||||
std::list<GOTargetInfo> m_UniqueGOTargetInfo;
|
||||
|
||||
struct ItemTargetInfo
|
||||
{
|
||||
Item *item;
|
||||
uint8 effectMask;
|
||||
};
|
||||
std::list<ItemTargetInfo> m_UniqueItemInfo;
|
||||
|
||||
SpellDestination m_destTargets[MAX_SPELL_EFFECTS];
|
||||
|
||||
void AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid = true, bool implicit = true);
|
||||
void AddGOTarget(GameObject* target, uint32 effectMask);
|
||||
void AddItemTarget(Item* item, uint32 effectMask);
|
||||
void AddDestTarget(SpellDestination const& dest, uint32 effIndex);
|
||||
|
||||
void DoAllEffectOnTarget(TargetInfo* target);
|
||||
SpellMissInfo DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleAura);
|
||||
void DoTriggersOnSpellHit(Unit* unit, uint8 effMask);
|
||||
void DoAllEffectOnTarget(GOTargetInfo* target);
|
||||
void DoAllEffectOnTarget(ItemTargetInfo* target);
|
||||
bool UpdateChanneledTargetList();
|
||||
bool IsValidDeadOrAliveTarget(Unit const* target) const;
|
||||
void HandleLaunchPhase();
|
||||
void DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier, bool firstTarget);
|
||||
|
||||
void PrepareTargetProcessing();
|
||||
void FinishTargetProcessing();
|
||||
|
||||
// spell execution log
|
||||
void InitEffectExecuteData(uint8 effIndex);
|
||||
void CheckEffectExecuteData();
|
||||
|
||||
// Scripting system
|
||||
bool _scriptsLoaded;
|
||||
//void LoadScripts();
|
||||
void CallScriptBeforeCastHandlers();
|
||||
void CallScriptOnCastHandlers();
|
||||
void CallScriptAfterCastHandlers();
|
||||
SpellCastResult CallScriptCheckCastHandlers();
|
||||
void PrepareScriptHitHandlers();
|
||||
bool CallScriptEffectHandlers(SpellEffIndex effIndex, SpellEffectHandleMode mode);
|
||||
void CallScriptBeforeHitHandlers();
|
||||
void CallScriptOnHitHandlers();
|
||||
void CallScriptAfterHitHandlers();
|
||||
void CallScriptObjectAreaTargetSelectHandlers(std::list<WorldObject*>& targets, SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType);
|
||||
void CallScriptObjectTargetSelectHandlers(WorldObject*& target, SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType);
|
||||
void CallScriptDestinationTargetSelectHandlers(SpellDestination& target, SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType);
|
||||
bool CheckScriptEffectImplicitTargets(uint32 effIndex, uint32 effIndexToCheck);
|
||||
std::list<SpellScript*> m_loadedScripts;
|
||||
|
||||
struct HitTriggerSpell
|
||||
{
|
||||
SpellInfo const* triggeredSpell;
|
||||
SpellInfo const* triggeredByAura;
|
||||
// uint8 triggeredByEffIdx This might be needed at a later stage - No need known for now
|
||||
int32 chance;
|
||||
};
|
||||
|
||||
bool CanExecuteTriggersOnHit(uint8 effMask, SpellInfo const* triggeredByAura = NULL) const;
|
||||
void PrepareTriggersExecutedOnHit();
|
||||
typedef std::list<HitTriggerSpell> HitTriggerSpellList;
|
||||
HitTriggerSpellList m_hitTriggerSpells;
|
||||
|
||||
// effect helpers
|
||||
void SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties, uint32 numSummons);
|
||||
void CalculateJumpSpeeds(uint8 i, float dist, float & speedxy, float & speedz);
|
||||
|
||||
SpellCastResult CanOpenLock(uint32 effIndex, uint32 lockid, SkillType& skillid, int32& reqSkillValue, int32& skillValue);
|
||||
// -------------------------------------------
|
||||
|
||||
uint32 m_spellState;
|
||||
int32 m_timer;
|
||||
|
||||
TriggerCastFlags _triggeredCastFlags;
|
||||
|
||||
// if need this can be replaced by Aura copy
|
||||
// we can't store original aura link to prevent access to deleted auras
|
||||
// and in same time need aura data and after aura deleting.
|
||||
SpellInfo const* m_triggeredByAuraSpell;
|
||||
|
||||
bool m_skipCheck;
|
||||
uint8 m_auraScaleMask;
|
||||
|
||||
// xinef:
|
||||
bool _spellTargetsSelected;
|
||||
|
||||
ByteBuffer * m_effectExecuteData[MAX_SPELL_EFFECTS];
|
||||
|
||||
#ifdef MAP_BASED_RAND_GEN
|
||||
int32 irand(int32 min, int32 max) { return int32 (m_caster->GetMap()->mtRand.randInt(max - min)) + min; }
|
||||
uint32 urand(uint32 min, uint32 max) { return m_caster->GetMap()->mtRand.randInt(max - min) + min; }
|
||||
int32 rand32() { return m_caster->GetMap()->mtRand.randInt(); }
|
||||
double rand_norm() { return m_caster->GetMap()->mtRand.randExc(); }
|
||||
double rand_chance() { return m_caster->GetMap()->mtRand.randExc(100.0); }
|
||||
#endif
|
||||
};
|
||||
|
||||
namespace Trinity
|
||||
{
|
||||
struct WorldObjectSpellTargetCheck
|
||||
{
|
||||
Unit* _caster;
|
||||
Unit* _referer;
|
||||
SpellInfo const* _spellInfo;
|
||||
SpellTargetCheckTypes _targetSelectionType;
|
||||
ConditionSourceInfo* _condSrcInfo;
|
||||
ConditionList* _condList;
|
||||
|
||||
WorldObjectSpellTargetCheck(Unit* caster, Unit* referer, SpellInfo const* spellInfo,
|
||||
SpellTargetCheckTypes selectionType, ConditionList* condList);
|
||||
~WorldObjectSpellTargetCheck();
|
||||
bool operator()(WorldObject* target);
|
||||
};
|
||||
|
||||
struct WorldObjectSpellNearbyTargetCheck : public WorldObjectSpellTargetCheck
|
||||
{
|
||||
float _range;
|
||||
Position const* _position;
|
||||
WorldObjectSpellNearbyTargetCheck(float range, Unit* caster, SpellInfo const* spellInfo,
|
||||
SpellTargetCheckTypes selectionType, ConditionList* condList);
|
||||
bool operator()(WorldObject* target);
|
||||
};
|
||||
|
||||
struct WorldObjectSpellAreaTargetCheck : public WorldObjectSpellTargetCheck
|
||||
{
|
||||
float _range;
|
||||
Position const* _position;
|
||||
WorldObjectSpellAreaTargetCheck(float range, Position const* position, Unit* caster,
|
||||
Unit* referer, SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList);
|
||||
bool operator()(WorldObject* target);
|
||||
};
|
||||
|
||||
struct WorldObjectSpellConeTargetCheck : public WorldObjectSpellAreaTargetCheck
|
||||
{
|
||||
float _coneAngle;
|
||||
WorldObjectSpellConeTargetCheck(float coneAngle, float range, Unit* caster,
|
||||
SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList);
|
||||
bool operator()(WorldObject* target);
|
||||
};
|
||||
|
||||
struct WorldObjectSpellTrajTargetCheck : public WorldObjectSpellAreaTargetCheck
|
||||
{
|
||||
WorldObjectSpellTrajTargetCheck(float range, Position const* position, Unit* caster,
|
||||
SpellInfo const* spellInfo, SpellTargetCheckTypes selectionType, ConditionList* condList);
|
||||
bool operator()(WorldObject* target);
|
||||
};
|
||||
}
|
||||
|
||||
typedef void(Spell::*pEffect)(SpellEffIndex effIndex);
|
||||
|
||||
class SpellEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
SpellEvent(Spell* spell);
|
||||
virtual ~SpellEvent();
|
||||
|
||||
virtual bool Execute(uint64 e_time, uint32 p_time);
|
||||
virtual void Abort(uint64 e_time);
|
||||
virtual bool IsDeletable() const;
|
||||
protected:
|
||||
Spell* m_Spell;
|
||||
};
|
||||
|
||||
class ReflectEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
ReflectEvent(uint64 casterGUID, uint64 targetGUID, const SpellInfo* spellInfo) : _casterGUID(casterGUID), _targetGUID(targetGUID), _spellInfo(spellInfo) { }
|
||||
virtual bool Execute(uint64 e_time, uint32 p_time);
|
||||
|
||||
protected:
|
||||
uint64 _casterGUID;
|
||||
uint64 _targetGUID;
|
||||
const SpellInfo* _spellInfo;
|
||||
};
|
||||
|
||||
#endif
|
||||
6190
src/server/game/Spells/SpellEffects.cpp
Normal file
6190
src/server/game/Spells/SpellEffects.cpp
Normal file
File diff suppressed because it is too large
Load Diff
2893
src/server/game/Spells/SpellInfo.cpp
Normal file
2893
src/server/game/Spells/SpellInfo.cpp
Normal file
File diff suppressed because it is too large
Load Diff
520
src/server/game/Spells/SpellInfo.h
Normal file
520
src/server/game/Spells/SpellInfo.h
Normal file
@@ -0,0 +1,520 @@
|
||||
/*
|
||||
* Copyright (C)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _SPELLINFO_H
|
||||
#define _SPELLINFO_H
|
||||
|
||||
#include "SharedDefines.h"
|
||||
#include "Util.h"
|
||||
#include "DBCStructure.h"
|
||||
#include "Object.h"
|
||||
|
||||
class Unit;
|
||||
class Player;
|
||||
class Item;
|
||||
class Spell;
|
||||
class SpellInfo;
|
||||
struct SpellChainNode;
|
||||
struct SpellTargetPosition;
|
||||
struct SpellDurationEntry;
|
||||
struct SpellModifier;
|
||||
struct SpellRangeEntry;
|
||||
struct SpellRadiusEntry;
|
||||
struct SpellEntry;
|
||||
struct SpellCastTimesEntry;
|
||||
struct Condition;
|
||||
|
||||
enum SpellCastTargetFlags
|
||||
{
|
||||
TARGET_FLAG_NONE = 0x00000000,
|
||||
TARGET_FLAG_UNUSED_1 = 0x00000001, // not used
|
||||
TARGET_FLAG_UNIT = 0x00000002, // pguid
|
||||
TARGET_FLAG_UNIT_RAID = 0x00000004, // not sent, used to validate target (if raid member)
|
||||
TARGET_FLAG_UNIT_PARTY = 0x00000008, // not sent, used to validate target (if party member)
|
||||
TARGET_FLAG_ITEM = 0x00000010, // pguid
|
||||
TARGET_FLAG_SOURCE_LOCATION = 0x00000020, // pguid, 3 float
|
||||
TARGET_FLAG_DEST_LOCATION = 0x00000040, // pguid, 3 float
|
||||
TARGET_FLAG_UNIT_ENEMY = 0x00000080, // not sent, used to validate target (if enemy)
|
||||
TARGET_FLAG_UNIT_ALLY = 0x00000100, // not sent, used to validate target (if ally)
|
||||
TARGET_FLAG_CORPSE_ENEMY = 0x00000200, // pguid
|
||||
TARGET_FLAG_UNIT_DEAD = 0x00000400, // not sent, used to validate target (if dead creature)
|
||||
TARGET_FLAG_GAMEOBJECT = 0x00000800, // pguid, used with TARGET_GAMEOBJECT_TARGET
|
||||
TARGET_FLAG_TRADE_ITEM = 0x00001000, // pguid
|
||||
TARGET_FLAG_STRING = 0x00002000, // string
|
||||
TARGET_FLAG_GAMEOBJECT_ITEM = 0x00004000, // not sent, used with TARGET_GAMEOBJECT_ITEM_TARGET
|
||||
TARGET_FLAG_CORPSE_ALLY = 0x00008000, // pguid
|
||||
TARGET_FLAG_UNIT_MINIPET = 0x00010000, // pguid, used to validate target (if non combat pet)
|
||||
TARGET_FLAG_GLYPH_SLOT = 0x00020000, // used in glyph spells
|
||||
TARGET_FLAG_DEST_TARGET = 0x00040000, // sometimes appears with DEST_TARGET spells (may appear or not for a given spell)
|
||||
TARGET_FLAG_UNUSED20 = 0x00080000, // uint32 counter, loop { vec3 - screen position (?), guid }, not used so far
|
||||
TARGET_FLAG_UNIT_PASSENGER = 0x00100000, // guessed, used to validate target (if vehicle passenger)
|
||||
|
||||
TARGET_FLAG_UNIT_MASK = TARGET_FLAG_UNIT | TARGET_FLAG_UNIT_RAID | TARGET_FLAG_UNIT_PARTY
|
||||
| TARGET_FLAG_UNIT_ENEMY | TARGET_FLAG_UNIT_ALLY | TARGET_FLAG_UNIT_DEAD | TARGET_FLAG_UNIT_MINIPET | TARGET_FLAG_UNIT_PASSENGER,
|
||||
TARGET_FLAG_GAMEOBJECT_MASK = TARGET_FLAG_GAMEOBJECT | TARGET_FLAG_GAMEOBJECT_ITEM,
|
||||
TARGET_FLAG_CORPSE_MASK = TARGET_FLAG_CORPSE_ALLY | TARGET_FLAG_CORPSE_ENEMY,
|
||||
TARGET_FLAG_ITEM_MASK = TARGET_FLAG_TRADE_ITEM | TARGET_FLAG_ITEM | TARGET_FLAG_GAMEOBJECT_ITEM,
|
||||
};
|
||||
|
||||
enum SpellTargetSelectionCategories
|
||||
{
|
||||
TARGET_SELECT_CATEGORY_NYI,
|
||||
TARGET_SELECT_CATEGORY_DEFAULT,
|
||||
TARGET_SELECT_CATEGORY_CHANNEL,
|
||||
TARGET_SELECT_CATEGORY_NEARBY,
|
||||
TARGET_SELECT_CATEGORY_CONE,
|
||||
TARGET_SELECT_CATEGORY_AREA,
|
||||
TARGET_SELECT_CATEGORY_TRAJ,
|
||||
};
|
||||
|
||||
enum SpellTargetReferenceTypes
|
||||
{
|
||||
TARGET_REFERENCE_TYPE_NONE,
|
||||
TARGET_REFERENCE_TYPE_CASTER,
|
||||
TARGET_REFERENCE_TYPE_TARGET,
|
||||
TARGET_REFERENCE_TYPE_LAST,
|
||||
TARGET_REFERENCE_TYPE_SRC,
|
||||
TARGET_REFERENCE_TYPE_DEST,
|
||||
};
|
||||
|
||||
enum SpellTargetObjectTypes
|
||||
{
|
||||
TARGET_OBJECT_TYPE_NONE = 0,
|
||||
TARGET_OBJECT_TYPE_SRC,
|
||||
TARGET_OBJECT_TYPE_DEST,
|
||||
TARGET_OBJECT_TYPE_UNIT,
|
||||
TARGET_OBJECT_TYPE_UNIT_AND_DEST,
|
||||
TARGET_OBJECT_TYPE_GOBJ,
|
||||
TARGET_OBJECT_TYPE_GOBJ_ITEM,
|
||||
TARGET_OBJECT_TYPE_ITEM,
|
||||
TARGET_OBJECT_TYPE_CORPSE,
|
||||
// only for effect target type
|
||||
TARGET_OBJECT_TYPE_CORPSE_ENEMY,
|
||||
TARGET_OBJECT_TYPE_CORPSE_ALLY,
|
||||
};
|
||||
|
||||
enum SpellTargetCheckTypes
|
||||
{
|
||||
TARGET_CHECK_DEFAULT,
|
||||
TARGET_CHECK_ENTRY,
|
||||
TARGET_CHECK_ENEMY,
|
||||
TARGET_CHECK_ALLY,
|
||||
TARGET_CHECK_PARTY,
|
||||
TARGET_CHECK_RAID,
|
||||
TARGET_CHECK_RAID_CLASS,
|
||||
TARGET_CHECK_PASSENGER,
|
||||
TARGET_CHECK_CORPSE,
|
||||
};
|
||||
|
||||
enum SpellTargetDirectionTypes
|
||||
{
|
||||
TARGET_DIR_NONE,
|
||||
TARGET_DIR_FRONT,
|
||||
TARGET_DIR_BACK,
|
||||
TARGET_DIR_RIGHT,
|
||||
TARGET_DIR_LEFT,
|
||||
TARGET_DIR_FRONT_RIGHT,
|
||||
TARGET_DIR_BACK_RIGHT,
|
||||
TARGET_DIR_BACK_LEFT,
|
||||
TARGET_DIR_FRONT_LEFT,
|
||||
TARGET_DIR_RANDOM,
|
||||
TARGET_DIR_ENTRY,
|
||||
};
|
||||
|
||||
enum SpellEffectImplicitTargetTypes
|
||||
{
|
||||
EFFECT_IMPLICIT_TARGET_NONE = 0,
|
||||
EFFECT_IMPLICIT_TARGET_EXPLICIT,
|
||||
EFFECT_IMPLICIT_TARGET_CASTER,
|
||||
};
|
||||
|
||||
// Spell clasification
|
||||
enum SpellSpecificType
|
||||
{
|
||||
SPELL_SPECIFIC_NORMAL = 0,
|
||||
SPELL_SPECIFIC_SEAL = 1,
|
||||
SPELL_SPECIFIC_AURA = 3,
|
||||
SPELL_SPECIFIC_STING = 4,
|
||||
SPELL_SPECIFIC_CURSE = 5,
|
||||
SPELL_SPECIFIC_ASPECT = 6,
|
||||
SPELL_SPECIFIC_TRACKER = 7,
|
||||
SPELL_SPECIFIC_WARLOCK_ARMOR = 8,
|
||||
SPELL_SPECIFIC_MAGE_ARMOR = 9,
|
||||
SPELL_SPECIFIC_ELEMENTAL_SHIELD = 10,
|
||||
SPELL_SPECIFIC_MAGE_POLYMORPH = 11,
|
||||
SPELL_SPECIFIC_JUDGEMENT = 13,
|
||||
SPELL_SPECIFIC_WARLOCK_CORRUPTION = 17,
|
||||
SPELL_SPECIFIC_FOOD = 19,
|
||||
SPELL_SPECIFIC_DRINK = 20,
|
||||
SPELL_SPECIFIC_FOOD_AND_DRINK = 21,
|
||||
SPELL_SPECIFIC_PRESENCE = 22,
|
||||
SPELL_SPECIFIC_CHARM = 23,
|
||||
SPELL_SPECIFIC_SCROLL = 24,
|
||||
SPELL_SPECIFIC_MAGE_ARCANE_BRILLANCE = 25,
|
||||
SPELL_SPECIFIC_PRIEST_DIVINE_SPIRIT = 26,
|
||||
SPELL_SPECIFIC_HAND = 27,
|
||||
};
|
||||
|
||||
enum SpellCustomAttributes
|
||||
{
|
||||
SPELL_ATTR0_CU_ENCHANT_PROC = 0x00000001,
|
||||
SPELL_ATTR0_CU_CONE_BACK = 0x00000002,
|
||||
SPELL_ATTR0_CU_CONE_LINE = 0x00000004,
|
||||
SPELL_ATTR0_CU_SHARE_DAMAGE = 0x00000008,
|
||||
SPELL_ATTR0_CU_NO_INITIAL_THREAT = 0x00000010,
|
||||
SPELL_ATTR0_CU_NONE2 = 0x00000020, // UNUSED
|
||||
SPELL_ATTR0_CU_AURA_CC = 0x00000040,
|
||||
SPELL_ATTR0_CU_NONE3 = 0x00000080, // UNUSED
|
||||
SPELL_ATTR0_CU_DIRECT_DAMAGE = 0x00000100,
|
||||
SPELL_ATTR0_CU_CHARGE = 0x00000200,
|
||||
SPELL_ATTR0_CU_PICKPOCKET = 0x00000400,
|
||||
SPELL_ATTR0_CU_NONE4 = 0x00000800, // UNUSED
|
||||
SPELL_ATTR0_CU_NEGATIVE_EFF0 = 0x00001000,
|
||||
SPELL_ATTR0_CU_NEGATIVE_EFF1 = 0x00002000,
|
||||
SPELL_ATTR0_CU_NEGATIVE_EFF2 = 0x00004000,
|
||||
SPELL_ATTR0_CU_IGNORE_ARMOR = 0x00008000,
|
||||
SPELL_ATTR0_CU_REQ_TARGET_FACING_CASTER = 0x00010000,
|
||||
SPELL_ATTR0_CU_REQ_CASTER_BEHIND_TARGET = 0x00020000,
|
||||
SPELL_ATTR0_CU_ALLOW_INFLIGHT_TARGET = 0x00040000,
|
||||
SPELL_ATTR0_CU_NONE6 = 0x00080000, // UNUSED
|
||||
SPELL_ATTR0_CU_BINARY_SPELL = 0x00100000,
|
||||
SPELL_ATTR0_CU_NO_POSITIVE_TAKEN_BONUS = 0x00200000,
|
||||
SPELL_ATTR0_CU_SINGLE_AURA_STACK = 0x00400000, // pussywizard
|
||||
SPELL_ATTR0_CU_SCHOOLMASK_NORMAL_WITH_MAGIC = 0x00800000,
|
||||
SPELL_ATTR0_CU_ENCOUNTER_REWARD = 0x01000000, // pussywizard
|
||||
|
||||
SPELL_ATTR0_CU_NEGATIVE = SPELL_ATTR0_CU_NEGATIVE_EFF0 | SPELL_ATTR0_CU_NEGATIVE_EFF1 | SPELL_ATTR0_CU_NEGATIVE_EFF2,
|
||||
};
|
||||
|
||||
uint32 GetTargetFlagMask(SpellTargetObjectTypes objType);
|
||||
|
||||
class SpellImplicitTargetInfo
|
||||
{
|
||||
private:
|
||||
Targets _target;
|
||||
public:
|
||||
SpellImplicitTargetInfo() {}
|
||||
SpellImplicitTargetInfo(uint32 target);
|
||||
|
||||
bool IsArea() const;
|
||||
SpellTargetSelectionCategories GetSelectionCategory() const;
|
||||
SpellTargetReferenceTypes GetReferenceType() const;
|
||||
SpellTargetObjectTypes GetObjectType() const;
|
||||
SpellTargetCheckTypes GetCheckType() const;
|
||||
SpellTargetDirectionTypes GetDirectionType() const;
|
||||
float CalcDirectionAngle() const;
|
||||
|
||||
Targets GetTarget() const;
|
||||
uint32 GetExplicitTargetMask(bool& srcSet, bool& dstSet) const;
|
||||
|
||||
private:
|
||||
struct StaticData
|
||||
{
|
||||
SpellTargetObjectTypes ObjectType; // type of object returned by target type
|
||||
SpellTargetReferenceTypes ReferenceType; // defines which object is used as a reference when selecting target
|
||||
SpellTargetSelectionCategories SelectionCategory;
|
||||
SpellTargetCheckTypes SelectionCheckType; // defines selection criteria
|
||||
SpellTargetDirectionTypes DirectionType; // direction for cone and dest targets
|
||||
};
|
||||
static StaticData _data[TOTAL_SPELL_TARGETS];
|
||||
};
|
||||
|
||||
class SpellEffectInfo
|
||||
{
|
||||
SpellInfo const* _spellInfo;
|
||||
uint8 _effIndex;
|
||||
public:
|
||||
uint32 Effect;
|
||||
uint32 ApplyAuraName;
|
||||
uint32 Amplitude;
|
||||
int32 DieSides;
|
||||
float RealPointsPerLevel;
|
||||
int32 BasePoints;
|
||||
float PointsPerComboPoint;
|
||||
float ValueMultiplier;
|
||||
float DamageMultiplier;
|
||||
float BonusMultiplier;
|
||||
int32 MiscValue;
|
||||
int32 MiscValueB;
|
||||
Mechanics Mechanic;
|
||||
SpellImplicitTargetInfo TargetA;
|
||||
SpellImplicitTargetInfo TargetB;
|
||||
SpellRadiusEntry const* RadiusEntry;
|
||||
uint32 ChainTarget;
|
||||
uint32 ItemType;
|
||||
uint32 TriggerSpell;
|
||||
flag96 SpellClassMask;
|
||||
std::list<Condition*>* ImplicitTargetConditions;
|
||||
|
||||
SpellEffectInfo() : _spellInfo(NULL), _effIndex(0), Effect(0), ApplyAuraName(0), Amplitude(0), DieSides(0),
|
||||
RealPointsPerLevel(0), BasePoints(0), PointsPerComboPoint(0), ValueMultiplier(0), DamageMultiplier(0),
|
||||
BonusMultiplier(0), MiscValue(0), MiscValueB(0), Mechanic(MECHANIC_NONE), RadiusEntry(NULL), ChainTarget(0),
|
||||
ItemType(0), TriggerSpell(0), ImplicitTargetConditions(NULL) {}
|
||||
SpellEffectInfo(SpellEntry const* spellEntry, SpellInfo const* spellInfo, uint8 effIndex);
|
||||
|
||||
bool IsEffect() const;
|
||||
bool IsEffect(SpellEffects effectName) const;
|
||||
bool IsAura() const;
|
||||
bool IsAura(AuraType aura) const;
|
||||
bool IsTargetingArea() const;
|
||||
bool IsAreaAuraEffect() const;
|
||||
bool IsFarUnitTargetEffect() const;
|
||||
bool IsFarDestTargetEffect() const;
|
||||
bool IsUnitOwnedAuraEffect() const;
|
||||
|
||||
int32 CalcValue(Unit const* caster = NULL, int32 const* basePoints = NULL, Unit const* target = NULL) const;
|
||||
int32 CalcBaseValue(int32 value) const;
|
||||
float CalcValueMultiplier(Unit* caster, Spell* spell = NULL) const;
|
||||
float CalcDamageMultiplier(Unit* caster, Spell* spell = NULL) const;
|
||||
|
||||
bool HasRadius() const;
|
||||
float CalcRadius(Unit* caster = NULL, Spell* = NULL) const;
|
||||
|
||||
uint32 GetProvidedTargetMask() const;
|
||||
uint32 GetMissingTargetMask(bool srcSet = false, bool destSet = false, uint32 mask = 0) const;
|
||||
|
||||
SpellEffectImplicitTargetTypes GetImplicitTargetType() const;
|
||||
SpellTargetObjectTypes GetUsedTargetObjectType() const;
|
||||
|
||||
private:
|
||||
struct StaticData
|
||||
{
|
||||
SpellEffectImplicitTargetTypes ImplicitTargetType; // defines what target can be added to effect target list if there's no valid target type provided for effect
|
||||
SpellTargetObjectTypes UsedTargetObjectType; // defines valid target object type for spell effect
|
||||
};
|
||||
static StaticData _data[TOTAL_SPELL_EFFECTS];
|
||||
};
|
||||
|
||||
class SpellInfo
|
||||
{
|
||||
public:
|
||||
uint32 Id;
|
||||
SpellCategoryEntry const* CategoryEntry;
|
||||
uint32 Dispel;
|
||||
uint32 Mechanic;
|
||||
uint32 Attributes;
|
||||
uint32 AttributesEx;
|
||||
uint32 AttributesEx2;
|
||||
uint32 AttributesEx3;
|
||||
uint32 AttributesEx4;
|
||||
uint32 AttributesEx5;
|
||||
uint32 AttributesEx6;
|
||||
uint32 AttributesEx7;
|
||||
uint32 AttributesCu;
|
||||
uint32 Stances;
|
||||
uint32 StancesNot;
|
||||
uint32 Targets;
|
||||
uint32 TargetCreatureType;
|
||||
uint32 RequiresSpellFocus;
|
||||
uint32 FacingCasterFlags;
|
||||
uint32 CasterAuraState;
|
||||
uint32 TargetAuraState;
|
||||
uint32 CasterAuraStateNot;
|
||||
uint32 TargetAuraStateNot;
|
||||
uint32 CasterAuraSpell;
|
||||
uint32 TargetAuraSpell;
|
||||
uint32 ExcludeCasterAuraSpell;
|
||||
uint32 ExcludeTargetAuraSpell;
|
||||
SpellCastTimesEntry const* CastTimeEntry;
|
||||
uint32 RecoveryTime;
|
||||
uint32 CategoryRecoveryTime;
|
||||
uint32 StartRecoveryCategory;
|
||||
uint32 StartRecoveryTime;
|
||||
uint32 InterruptFlags;
|
||||
uint32 AuraInterruptFlags;
|
||||
uint32 ChannelInterruptFlags;
|
||||
uint32 ProcFlags;
|
||||
uint32 ProcChance;
|
||||
uint32 ProcCharges;
|
||||
uint32 MaxLevel;
|
||||
uint32 BaseLevel;
|
||||
uint32 SpellLevel;
|
||||
SpellDurationEntry const* DurationEntry;
|
||||
uint32 PowerType;
|
||||
uint32 ManaCost;
|
||||
uint32 ManaCostPerlevel;
|
||||
uint32 ManaPerSecond;
|
||||
uint32 ManaPerSecondPerLevel;
|
||||
uint32 ManaCostPercentage;
|
||||
uint32 RuneCostID;
|
||||
SpellRangeEntry const* RangeEntry;
|
||||
float Speed;
|
||||
uint32 StackAmount;
|
||||
uint32 Totem[2];
|
||||
int32 Reagent[MAX_SPELL_REAGENTS];
|
||||
uint32 ReagentCount[MAX_SPELL_REAGENTS];
|
||||
int32 EquippedItemClass;
|
||||
int32 EquippedItemSubClassMask;
|
||||
int32 EquippedItemInventoryTypeMask;
|
||||
uint32 TotemCategory[2];
|
||||
uint32 SpellVisual[2];
|
||||
uint32 SpellIconID;
|
||||
uint32 ActiveIconID;
|
||||
char* SpellName[16];
|
||||
char* Rank[16];
|
||||
uint32 MaxTargetLevel;
|
||||
uint32 MaxAffectedTargets;
|
||||
uint32 SpellFamilyName;
|
||||
flag96 SpellFamilyFlags;
|
||||
uint32 DmgClass;
|
||||
uint32 PreventionType;
|
||||
int32 AreaGroupId;
|
||||
uint32 SchoolMask;
|
||||
SpellEffectInfo Effects[MAX_SPELL_EFFECTS];
|
||||
uint32 ExplicitTargetMask;
|
||||
SpellChainNode const* ChainEntry;
|
||||
|
||||
// Mine
|
||||
AuraStateType _auraState;
|
||||
SpellSpecificType _spellSpecific;
|
||||
bool _isStackableWithRanks;
|
||||
bool _isSpellValid;
|
||||
bool _isCritCapable;
|
||||
bool _requireCooldownInfo;
|
||||
|
||||
SpellInfo(SpellEntry const* spellEntry);
|
||||
~SpellInfo();
|
||||
|
||||
uint32 GetCategory() const;
|
||||
bool HasEffect(SpellEffects effect) const;
|
||||
bool HasAura(AuraType aura) const;
|
||||
bool HasAnyAura() const;
|
||||
bool HasAreaAuraEffect() const;
|
||||
|
||||
inline bool HasAttribute(SpellAttr0 attribute) const { return Attributes & attribute; }
|
||||
inline bool HasAttribute(SpellAttr1 attribute) const { return AttributesEx & attribute; }
|
||||
inline bool HasAttribute(SpellAttr2 attribute) const { return AttributesEx2 & attribute; }
|
||||
inline bool HasAttribute(SpellAttr3 attribute) const { return AttributesEx3 & attribute; }
|
||||
inline bool HasAttribute(SpellAttr4 attribute) const { return AttributesEx4 & attribute; }
|
||||
inline bool HasAttribute(SpellAttr5 attribute) const { return AttributesEx5 & attribute; }
|
||||
inline bool HasAttribute(SpellAttr6 attribute) const { return AttributesEx6 & attribute; }
|
||||
inline bool HasAttribute(SpellAttr7 attribute) const { return AttributesEx7 & attribute; }
|
||||
inline bool HasAttribute(SpellCustomAttributes customAttribute) const { return AttributesCu & customAttribute; }
|
||||
|
||||
bool IsExplicitDiscovery() const;
|
||||
bool IsLootCrafting() const;
|
||||
bool IsQuestTame() const;
|
||||
bool IsProfessionOrRiding() const;
|
||||
bool IsProfession() const;
|
||||
bool IsPrimaryProfession() const;
|
||||
bool IsPrimaryProfessionFirstRank() const;
|
||||
bool IsAbilityLearnedWithProfession() const;
|
||||
bool IsAbilityOfSkillType(uint32 skillType) const;
|
||||
|
||||
bool IsAffectingArea() const;
|
||||
bool IsTargetingArea() const;
|
||||
bool NeedsExplicitUnitTarget() const;
|
||||
bool NeedsToBeTriggeredByCaster(SpellInfo const* triggeringSpell, uint8 effIndex = MAX_SPELL_EFFECTS) const;
|
||||
bool IsChannelCategorySpell() const;
|
||||
bool IsSelfCast() const;
|
||||
|
||||
bool IsPassive() const;
|
||||
bool IsAutocastable() const;
|
||||
bool ComputeIsCritCapable() const;
|
||||
bool IsCritCapable() const;
|
||||
bool RequireCooldownInfo() const;
|
||||
void SetCritCapable(bool val);
|
||||
bool ComputeIsStackableWithRanks() const;
|
||||
bool IsStackableWithRanks() const;
|
||||
void SetStackableWithRanks(bool val);
|
||||
bool IsSpellValid() const;
|
||||
void SetSpellValid(bool val);
|
||||
bool IsPassiveStackableWithRanks() const;
|
||||
bool IsMultiSlotAura() const;
|
||||
bool IsCooldownStartedOnEvent() const;
|
||||
bool IsDeathPersistent() const;
|
||||
bool IsRequiringDeadTarget() const;
|
||||
bool IsAllowingDeadTarget() const;
|
||||
bool CanBeUsedInCombat() const;
|
||||
bool IsPositive() const;
|
||||
bool IsPositiveEffect(uint8 effIndex) const;
|
||||
bool IsChanneled() const;
|
||||
bool NeedsComboPoints() const;
|
||||
bool IsBreakingStealth() const;
|
||||
bool IsRangedWeaponSpell() const;
|
||||
bool IsAutoRepeatRangedSpell() const;
|
||||
|
||||
bool IsAffectedBySpellMods() const;
|
||||
bool IsAffectedBySpellMod(SpellModifier const* mod) const;
|
||||
|
||||
bool CanPierceImmuneAura(SpellInfo const* aura) const;
|
||||
bool CanDispelAura(SpellInfo const* aura) const;
|
||||
|
||||
bool IsSingleTarget() const;
|
||||
bool IsAuraExclusiveBySpecificWith(SpellInfo const* spellInfo) const;
|
||||
bool IsAuraExclusiveBySpecificPerCasterWith(SpellInfo const* spellInfo) const;
|
||||
|
||||
SpellCastResult CheckShapeshift(uint32 form) const;
|
||||
SpellCastResult CheckLocation(uint32 map_id, uint32 zone_id, uint32 area_id, Player const* player = NULL) const;
|
||||
SpellCastResult CheckTarget(Unit const* caster, WorldObject const* target, bool implicit = true) const;
|
||||
SpellCastResult CheckExplicitTarget(Unit const* caster, WorldObject const* target, Item const* itemTarget = NULL) const;
|
||||
bool CheckTargetCreatureType(Unit const* target) const;
|
||||
|
||||
// xinef: aura stacking
|
||||
bool IsStrongerAuraActive(Unit const* caster, Unit const* target) const;
|
||||
bool IsAuraEffectEqual(SpellInfo const* otherSpellInfo) const;
|
||||
bool ValidateAttribute6SpellDamageMods(const Unit* caster, const AuraEffect* auraEffect, bool isDot) const;
|
||||
|
||||
SpellSchoolMask GetSchoolMask() const;
|
||||
uint32 GetAllEffectsMechanicMask() const;
|
||||
uint32 GetEffectMechanicMask(uint8 effIndex) const;
|
||||
uint32 GetSpellMechanicMaskByEffectMask(uint32 effectMask) const;
|
||||
Mechanics GetEffectMechanic(uint8 effIndex) const;
|
||||
bool HasAnyEffectMechanic() const;
|
||||
uint32 GetDispelMask() const;
|
||||
static uint32 GetDispelMask(DispelType type);
|
||||
uint32 GetExplicitTargetMask() const;
|
||||
|
||||
AuraStateType GetAuraState() const;
|
||||
SpellSpecificType GetSpellSpecific() const;
|
||||
|
||||
float GetMinRange(bool positive = false) const;
|
||||
float GetMaxRange(bool positive = false, Unit* caster = NULL, Spell* spell = NULL) const;
|
||||
|
||||
int32 GetDuration() const;
|
||||
int32 GetMaxDuration() const;
|
||||
|
||||
uint32 GetMaxTicks() const;
|
||||
|
||||
uint32 CalcCastTime(Unit* caster = NULL, Spell* spell = NULL) const;
|
||||
uint32 GetRecoveryTime() const;
|
||||
|
||||
int32 CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask, Spell* spell = NULL) const;
|
||||
|
||||
bool IsRanked() const;
|
||||
uint8 GetRank() const;
|
||||
SpellInfo const* GetFirstRankSpell() const;
|
||||
SpellInfo const* GetLastRankSpell() const;
|
||||
SpellInfo const* GetNextRankSpell() const;
|
||||
SpellInfo const* GetPrevRankSpell() const;
|
||||
SpellInfo const* GetAuraRankForLevel(uint8 level) const;
|
||||
bool IsRankOf(SpellInfo const* spellInfo) const;
|
||||
bool IsDifferentRankOf(SpellInfo const* spellInfo) const;
|
||||
bool IsHighRankOf(SpellInfo const* spellInfo) const;
|
||||
|
||||
// loading helpers
|
||||
uint32 _GetExplicitTargetMask() const;
|
||||
bool _IsPositiveEffect(uint8 effIndex, bool deep) const;
|
||||
bool _IsPositiveSpell() const;
|
||||
static bool _IsPositiveTarget(uint32 targetA, uint32 targetB);
|
||||
AuraStateType LoadAuraState() const;
|
||||
SpellSpecificType LoadSpellSpecific() const;
|
||||
// unloading helpers
|
||||
void _UnloadImplicitTargetConditionLists();
|
||||
};
|
||||
|
||||
#endif // _SPELLINFO_H
|
||||
6317
src/server/game/Spells/SpellMgr.cpp
Normal file
6317
src/server/game/Spells/SpellMgr.cpp
Normal file
File diff suppressed because it is too large
Load Diff
765
src/server/game/Spells/SpellMgr.h
Normal file
765
src/server/game/Spells/SpellMgr.h
Normal file
@@ -0,0 +1,765 @@
|
||||
/*
|
||||
* Copyright (C)
|
||||
* Copyright (C)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _SPELLMGR_H
|
||||
#define _SPELLMGR_H
|
||||
|
||||
// For static or at-server-startup loaded spell data
|
||||
|
||||
#include <ace/Singleton.h>
|
||||
#include "Common.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "Unit.h"
|
||||
|
||||
class SpellInfo;
|
||||
class Player;
|
||||
class Unit;
|
||||
class ProcEventInfo;
|
||||
struct SkillLineAbilityEntry;
|
||||
|
||||
#define SPELL_RELIC_COOLDOWN 1
|
||||
|
||||
// only used in code
|
||||
enum SpellCategories
|
||||
{
|
||||
SPELLCATEGORY_HEALTH_MANA_POTIONS = 4,
|
||||
SPELLCATEGORY_DEVOUR_MAGIC = 12,
|
||||
SPELLCATEGORY_JUDGEMENT = 1210, // Judgement (seal trigger)
|
||||
SPELLCATEGORY_FOOD = 11,
|
||||
SPELLCATEGORY_DRINK = 59,
|
||||
};
|
||||
|
||||
//SpellFamilyFlags
|
||||
enum SpellFamilyFlag
|
||||
{
|
||||
// SPELLFAMILYFLAG = SpellFamilyFlags[0]
|
||||
// SPELLFAMILYFLAG1 = SpellFamilyFlags[1]
|
||||
// SPELLFAMILYFLAG2 = SpellFamilyFlags[2]
|
||||
|
||||
// Rogue
|
||||
SPELLFAMILYFLAG_ROGUE_VANISH = 0x00000800,
|
||||
SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT = 0x00000860, // Vanish, Evasion, Sprint
|
||||
SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP = 0x00000240, // Cold Blood, Shadowstep
|
||||
SPELLFAMILYFLAG_ROGUE_KICK = 0x00000010, // Kick
|
||||
SPELLFAMILYFLAG1_ROGUE_DISMANTLE = 0x00100000, // Dismantle
|
||||
SPELLFAMILYFLAG_ROGUE_BLADE_FLURRY = 0x40000000, // Blade Flurry
|
||||
SPELLFAMILYFLAG1_ROGUE_BLADE_FLURRY = 0x00000800, // Blade Flurry
|
||||
|
||||
// Warrior
|
||||
SPELLFAMILYFLAG_WARRIOR_CHARGE = 0x00000001,
|
||||
SPELLFAMILYFLAG_WARRIOR_SLAM = 0x00200000,
|
||||
SPELLFAMILYFLAG_WARRIOR_EXECUTE = 0x20000000,
|
||||
SPELLFAMILYFLAG_WARRIOR_CONCUSSION_BLOW = 0x04000000,
|
||||
|
||||
// Warlock
|
||||
SPELLFAMILYFLAG_WARLOCK_LIFETAP = 0x00040000,
|
||||
|
||||
// Druid
|
||||
SPELLFAMILYFLAG2_DRUID_STARFALL = 0x00000100,
|
||||
|
||||
// Paladin
|
||||
SPELLFAMILYFLAG1_PALADIN_DIVINESTORM = 0x00020000,
|
||||
|
||||
// Shaman
|
||||
SPELLFAMILYFLAG_SHAMAN_FROST_SHOCK = 0x80000000,
|
||||
SPELLFAMILYFLAG_SHAMAN_HEALING_STREAM = 0x00002000,
|
||||
SPELLFAMILYFLAG_SHAMAN_MANA_SPRING = 0x00004000,
|
||||
SPELLFAMILYFLAG2_SHAMAN_LAVA_LASH = 0x00000004,
|
||||
SPELLFAMILYFLAG_SHAMAN_FIRE_NOVA = 0x28000000,
|
||||
|
||||
// Deathknight
|
||||
SPELLFAMILYFLAG_DK_DEATH_STRIKE = 0x00000010,
|
||||
SPELLFAMILYFLAG_DK_DEATH_COIL = 0x00002000,
|
||||
|
||||
// TODO: Figure out a more accurate name for the following familyflag(s)
|
||||
SPELLFAMILYFLAG_SHAMAN_TOTEM_EFFECTS = 0x04000000, // Seems to be linked to most totems and some totem effects
|
||||
};
|
||||
|
||||
|
||||
#define SPELL_LINKED_MAX_SPELLS 200000
|
||||
|
||||
enum SpellLinkedType
|
||||
{
|
||||
SPELL_LINK_CAST = 0, // +: cast; -: remove
|
||||
SPELL_LINK_HIT = 1 * 200000,
|
||||
SPELL_LINK_AURA = 2 * 200000, // +: aura; -: immune
|
||||
SPELL_LINK_REMOVE = 0,
|
||||
};
|
||||
|
||||
|
||||
// Spell proc event related declarations (accessed using SpellMgr functions)
|
||||
enum ProcFlags
|
||||
{
|
||||
PROC_FLAG_NONE = 0x00000000,
|
||||
|
||||
PROC_FLAG_KILLED = 0x00000001, // 00 Killed by agressor - not sure about this flag
|
||||
PROC_FLAG_KILL = 0x00000002, // 01 Kill target (in most cases need XP/Honor reward)
|
||||
|
||||
PROC_FLAG_DONE_MELEE_AUTO_ATTACK = 0x00000004, // 02 Done melee auto attack
|
||||
PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK = 0x00000008, // 03 Taken melee auto attack
|
||||
|
||||
PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS = 0x00000010, // 04 Done attack by Spell that has dmg class melee
|
||||
PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS = 0x00000020, // 05 Taken attack by Spell that has dmg class melee
|
||||
|
||||
PROC_FLAG_DONE_RANGED_AUTO_ATTACK = 0x00000040, // 06 Done ranged auto attack
|
||||
PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK = 0x00000080, // 07 Taken ranged auto attack
|
||||
|
||||
PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS = 0x00000100, // 08 Done attack by Spell that has dmg class ranged
|
||||
PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS = 0x00000200, // 09 Taken attack by Spell that has dmg class ranged
|
||||
|
||||
PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS = 0x00000400, // 10 Done positive spell that has dmg class none
|
||||
PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS = 0x00000800, // 11 Taken positive spell that has dmg class none
|
||||
|
||||
PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG = 0x00001000, // 12 Done negative spell that has dmg class none
|
||||
PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG = 0x00002000, // 13 Taken negative spell that has dmg class none
|
||||
|
||||
PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS = 0x00004000, // 14 Done positive spell that has dmg class magic
|
||||
PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS = 0x00008000, // 15 Taken positive spell that has dmg class magic
|
||||
|
||||
PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG = 0x00010000, // 16 Done negative spell that has dmg class magic
|
||||
PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG = 0x00020000, // 17 Taken negative spell that has dmg class magic
|
||||
|
||||
PROC_FLAG_DONE_PERIODIC = 0x00040000, // 18 Successful do periodic (damage / healing)
|
||||
PROC_FLAG_TAKEN_PERIODIC = 0x00080000, // 19 Taken spell periodic (damage / healing)
|
||||
|
||||
PROC_FLAG_TAKEN_DAMAGE = 0x00100000, // 20 Taken any damage
|
||||
PROC_FLAG_DONE_TRAP_ACTIVATION = 0x00200000, // 21 On trap activation (possibly needs name change to ON_GAMEOBJECT_CAST or USE)
|
||||
|
||||
PROC_FLAG_DONE_MAINHAND_ATTACK = 0x00400000, // 22 Done main-hand melee attacks (spell and autoattack)
|
||||
PROC_FLAG_DONE_OFFHAND_ATTACK = 0x00800000, // 23 Done off-hand melee attacks (spell and autoattack)
|
||||
|
||||
PROC_FLAG_DEATH = 0x01000000, // 24 Died in any way
|
||||
|
||||
// flag masks
|
||||
AUTO_ATTACK_PROC_FLAG_MASK = PROC_FLAG_DONE_MELEE_AUTO_ATTACK | PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK
|
||||
| PROC_FLAG_DONE_RANGED_AUTO_ATTACK | PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK,
|
||||
|
||||
MELEE_PROC_FLAG_MASK = PROC_FLAG_DONE_MELEE_AUTO_ATTACK | PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK
|
||||
| PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS | PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS
|
||||
| PROC_FLAG_DONE_MAINHAND_ATTACK | PROC_FLAG_DONE_OFFHAND_ATTACK,
|
||||
|
||||
RANGED_PROC_FLAG_MASK = PROC_FLAG_DONE_RANGED_AUTO_ATTACK | PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK
|
||||
| PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS | PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS,
|
||||
|
||||
SPELL_PROC_FLAG_MASK = PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS | PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS
|
||||
| PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS | PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS
|
||||
| PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS | PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS
|
||||
| PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG | PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG
|
||||
| PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS
|
||||
| PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG | PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG,
|
||||
|
||||
SPELL_CAST_PROC_FLAG_MASK = SPELL_PROC_FLAG_MASK | PROC_FLAG_DONE_TRAP_ACTIVATION | RANGED_PROC_FLAG_MASK,
|
||||
|
||||
PERIODIC_PROC_FLAG_MASK = PROC_FLAG_DONE_PERIODIC | PROC_FLAG_TAKEN_PERIODIC,
|
||||
|
||||
DONE_HIT_PROC_FLAG_MASK = PROC_FLAG_DONE_MELEE_AUTO_ATTACK | PROC_FLAG_DONE_RANGED_AUTO_ATTACK
|
||||
| PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS | PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS
|
||||
| PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_NONE_DMG_CLASS_NEG
|
||||
| PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_DONE_SPELL_MAGIC_DMG_CLASS_NEG
|
||||
| PROC_FLAG_DONE_PERIODIC | PROC_FLAG_DONE_MAINHAND_ATTACK | PROC_FLAG_DONE_OFFHAND_ATTACK,
|
||||
|
||||
TAKEN_HIT_PROC_FLAG_MASK = PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK | PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK
|
||||
| PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS | PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS
|
||||
| PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_POS | PROC_FLAG_TAKEN_SPELL_NONE_DMG_CLASS_NEG
|
||||
| PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_POS | PROC_FLAG_TAKEN_SPELL_MAGIC_DMG_CLASS_NEG
|
||||
| PROC_FLAG_TAKEN_PERIODIC | PROC_FLAG_TAKEN_DAMAGE,
|
||||
|
||||
REQ_SPELL_PHASE_PROC_FLAG_MASK = SPELL_PROC_FLAG_MASK & DONE_HIT_PROC_FLAG_MASK,
|
||||
};
|
||||
|
||||
#define MELEE_BASED_TRIGGER_MASK (PROC_FLAG_DONE_MELEE_AUTO_ATTACK | \
|
||||
PROC_FLAG_TAKEN_MELEE_AUTO_ATTACK | \
|
||||
PROC_FLAG_DONE_SPELL_MELEE_DMG_CLASS | \
|
||||
PROC_FLAG_TAKEN_SPELL_MELEE_DMG_CLASS | \
|
||||
PROC_FLAG_DONE_RANGED_AUTO_ATTACK | \
|
||||
PROC_FLAG_TAKEN_RANGED_AUTO_ATTACK | \
|
||||
PROC_FLAG_DONE_SPELL_RANGED_DMG_CLASS | \
|
||||
PROC_FLAG_TAKEN_SPELL_RANGED_DMG_CLASS)
|
||||
|
||||
enum ProcFlagsExLegacy
|
||||
{
|
||||
PROC_EX_NONE = 0x0000000, // If none can tigger on Hit/Crit only (passive spells MUST defined by SpellFamily flag)
|
||||
PROC_EX_NORMAL_HIT = 0x0000001, // If set only from normal hit (only damage spells)
|
||||
PROC_EX_CRITICAL_HIT = 0x0000002,
|
||||
PROC_EX_MISS = 0x0000004,
|
||||
PROC_EX_RESIST = 0x0000008,
|
||||
PROC_EX_DODGE = 0x0000010,
|
||||
PROC_EX_PARRY = 0x0000020,
|
||||
PROC_EX_BLOCK = 0x0000040,
|
||||
PROC_EX_EVADE = 0x0000080,
|
||||
PROC_EX_IMMUNE = 0x0000100,
|
||||
PROC_EX_DEFLECT = 0x0000200,
|
||||
PROC_EX_ABSORB = 0x0000400,
|
||||
PROC_EX_REFLECT = 0x0000800,
|
||||
PROC_EX_INTERRUPT = 0x0001000, // Melee hit result can be Interrupt (not used)
|
||||
PROC_EX_FULL_BLOCK = 0x0002000, // block al attack damage
|
||||
PROC_EX_RESERVED2 = 0x0004000,
|
||||
PROC_EX_NOT_ACTIVE_SPELL = 0x0008000, // Spell mustn't do damage/heal to proc
|
||||
PROC_EX_EX_TRIGGER_ALWAYS = 0x0010000, // If set trigger always no matter of hit result
|
||||
PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000, // If set trigger always but only one time (not implemented yet)
|
||||
PROC_EX_ONLY_ACTIVE_SPELL = 0x0040000, // Spell has to do damage/heal to proc
|
||||
PROC_EX_NO_OVERHEAL = 0x0080000, // Proc if heal did some work
|
||||
PROC_EX_NO_AURA_REFRESH = 0x0100000, // Proc if aura was not refreshed
|
||||
|
||||
// Flags for internal use - do not use these in db!
|
||||
PROC_EX_INTERNAL_CANT_PROC = 0x0800000,
|
||||
PROC_EX_INTERNAL_DOT = 0x1000000,
|
||||
PROC_EX_INTERNAL_HOT = 0x2000000,
|
||||
PROC_EX_INTERNAL_TRIGGERED = 0x4000000,
|
||||
PROC_EX_INTERNAL_REQ_FAMILY = 0x8000000
|
||||
};
|
||||
|
||||
#define AURA_SPELL_PROC_EX_MASK \
|
||||
(PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT | PROC_EX_MISS | \
|
||||
PROC_EX_RESIST | PROC_EX_DODGE | PROC_EX_PARRY | PROC_EX_BLOCK | \
|
||||
PROC_EX_EVADE | PROC_EX_IMMUNE | PROC_EX_DEFLECT | \
|
||||
PROC_EX_ABSORB | PROC_EX_REFLECT | PROC_EX_INTERRUPT)
|
||||
|
||||
enum ProcFlagsSpellType
|
||||
{
|
||||
PROC_SPELL_TYPE_NONE = 0x0000000,
|
||||
PROC_SPELL_TYPE_DAMAGE = 0x0000001, // damage type of spell
|
||||
PROC_SPELL_TYPE_HEAL = 0x0000002, // heal type of spell
|
||||
PROC_SPELL_TYPE_NO_DMG_HEAL = 0x0000004, // other spells
|
||||
PROC_SPELL_TYPE_MASK_ALL = PROC_SPELL_TYPE_DAMAGE | PROC_SPELL_TYPE_HEAL | PROC_SPELL_TYPE_NO_DMG_HEAL
|
||||
};
|
||||
|
||||
enum ProcFlagsSpellPhase
|
||||
{
|
||||
PROC_SPELL_PHASE_NONE = 0x0000000,
|
||||
PROC_SPELL_PHASE_CAST = 0x0000001,
|
||||
PROC_SPELL_PHASE_HIT = 0x0000002,
|
||||
PROC_SPELL_PHASE_FINISH = 0x0000004,
|
||||
PROC_SPELL_PHASE_MASK_ALL = PROC_SPELL_PHASE_CAST | PROC_SPELL_PHASE_HIT | PROC_SPELL_PHASE_FINISH
|
||||
};
|
||||
|
||||
enum ProcFlagsHit
|
||||
{
|
||||
PROC_HIT_NONE = 0x0000000, // no value - PROC_HIT_NORMAL | PROC_HIT_CRITICAL for TAKEN proc type, PROC_HIT_NORMAL | PROC_HIT_CRITICAL | PROC_HIT_ABSORB for DONE
|
||||
PROC_HIT_NORMAL = 0x0000001, // non-critical hits
|
||||
PROC_HIT_CRITICAL = 0x0000002,
|
||||
PROC_HIT_MISS = 0x0000004,
|
||||
PROC_HIT_FULL_RESIST = 0x0000008,
|
||||
PROC_HIT_DODGE = 0x0000010,
|
||||
PROC_HIT_PARRY = 0x0000020,
|
||||
PROC_HIT_BLOCK = 0x0000040, // partial or full block
|
||||
PROC_HIT_EVADE = 0x0000080,
|
||||
PROC_HIT_IMMUNE = 0x0000100,
|
||||
PROC_HIT_DEFLECT = 0x0000200,
|
||||
PROC_HIT_ABSORB = 0x0000400, // partial or full absorb
|
||||
PROC_HIT_REFLECT = 0x0000800,
|
||||
PROC_HIT_INTERRUPT = 0x0001000, // (not used atm)
|
||||
PROC_HIT_FULL_BLOCK = 0x0002000,
|
||||
PROC_HIT_MASK_ALL = 0x2FFF,
|
||||
};
|
||||
|
||||
enum ProcAttributes
|
||||
{
|
||||
PROC_ATTR_REQ_EXP_OR_HONOR = 0x0000010,
|
||||
};
|
||||
|
||||
struct SpellProcEventEntry
|
||||
{
|
||||
uint32 schoolMask; // if nonzero - bit mask for matching proc condition based on spell candidate's school: Fire=2, Mask=1<<(2-1)=2
|
||||
uint32 spellFamilyName; // if nonzero - for matching proc condition based on candidate spell's SpellFamilyNamer value
|
||||
flag96 spellFamilyMask; // if nonzero - for matching proc condition based on candidate spell's SpellFamilyFlags (like auras 107 and 108 do)
|
||||
uint32 procFlags; // bitmask for matching proc event
|
||||
uint32 procEx; // proc Extend info (see ProcFlagsEx)
|
||||
float ppmRate; // for melee (ranged?) damage spells - proc rate per minute. if zero, falls back to flat chance from Spell.dbc
|
||||
float customChance; // Owerride chance (in most cases for debug only)
|
||||
uint32 cooldown; // hidden cooldown used for some spell proc events, applied to _triggered_spell_
|
||||
};
|
||||
|
||||
typedef UNORDERED_MAP<uint32, SpellProcEventEntry> SpellProcEventMap;
|
||||
|
||||
struct SpellProcEntry
|
||||
{
|
||||
uint32 schoolMask; // if nonzero - bitmask for matching proc condition based on spell's school
|
||||
uint32 spellFamilyName; // if nonzero - for matching proc condition based on candidate spell's SpellFamilyName
|
||||
flag96 spellFamilyMask; // if nonzero - bitmask for matching proc condition based on candidate spell's SpellFamilyFlags
|
||||
uint32 typeMask; // if nonzero - owerwrite procFlags field for given Spell.dbc entry, bitmask for matching proc condition, see enum ProcFlags
|
||||
uint32 spellTypeMask; // if nonzero - bitmask for matching proc condition based on candidate spell's damage/heal effects, see enum ProcFlagsSpellType
|
||||
uint32 spellPhaseMask; // if nonzero - bitmask for matching phase of a spellcast on which proc occurs, see enum ProcFlagsSpellPhase
|
||||
uint32 hitMask; // if nonzero - bitmask for matching proc condition based on hit result, see enum ProcFlagsHit
|
||||
uint32 attributesMask; // bitmask, see ProcAttributes
|
||||
float ratePerMinute; // if nonzero - chance to proc is equal to value * aura caster's weapon speed / 60
|
||||
float chance; // if nonzero - owerwrite procChance field for given Spell.dbc entry, defines chance of proc to occur, not used if perMinuteRate set
|
||||
uint32 cooldown; // if nonzero - cooldown in secs for aura proc, applied to aura
|
||||
uint32 charges; // if nonzero - owerwrite procCharges field for given Spell.dbc entry, defines how many times proc can occur before aura remove, 0 - infinite
|
||||
};
|
||||
|
||||
typedef UNORDERED_MAP<uint32, SpellProcEntry> SpellProcMap;
|
||||
|
||||
struct SpellEnchantProcEntry
|
||||
{
|
||||
uint32 customChance;
|
||||
float PPMChance;
|
||||
uint32 procEx;
|
||||
};
|
||||
|
||||
typedef UNORDERED_MAP<uint32, SpellEnchantProcEntry> SpellEnchantProcEventMap;
|
||||
|
||||
struct SpellBonusEntry
|
||||
{
|
||||
float direct_damage;
|
||||
float dot_damage;
|
||||
float ap_bonus;
|
||||
float ap_dot_bonus;
|
||||
};
|
||||
|
||||
typedef UNORDERED_MAP<uint32, SpellBonusEntry> SpellBonusMap;
|
||||
|
||||
enum SpellGroupSpecialFlags
|
||||
{
|
||||
SPELL_GROUP_SPECIAL_FLAG_NONE = 0x000,
|
||||
SPELL_GROUP_SPECIAL_FLAG_ELIXIR_BATTLE = 0x001,
|
||||
SPELL_GROUP_SPECIAL_FLAG_ELIXIR_GUARDIAN = 0x002,
|
||||
SPELL_GROUP_SPECIAL_FLAG_ELIXIR_UNSTABLE = 0x004,
|
||||
SPELL_GROUP_SPECIAL_FLAG_ELIXIR_SHATTRATH = 0x008,
|
||||
SPELL_GROUP_SPECIAL_FLAG_STACK_EXCLUSIVE_MAX= 0x00F,
|
||||
SPELL_GROUP_SPECIAL_FLAG_FORCED_STRONGEST = 0x010, // xinef: specially helpful flag if some spells have different auras, but only one should be present
|
||||
SPELL_GROUP_SPECIAL_FLAG_SKIP_STRONGER_CHECK= 0x020,
|
||||
SPELL_GROUP_SPECIAL_FLAG_BASE_AMOUNT_CHECK = 0x040,
|
||||
SPELL_GROUP_SPECIAL_FLAG_PRIORITY1 = 0x100,
|
||||
SPELL_GROUP_SPECIAL_FLAG_PRIORITY2 = 0x200,
|
||||
SPELL_GROUP_SPECIAL_FLAG_PRIORITY3 = 0x400,
|
||||
SPELL_GROUP_SPECIAL_FLAG_PRIORITY4 = 0x800,
|
||||
SPELL_GROUP_SPECIAL_FLAG_MAX = 0x1000,
|
||||
};
|
||||
|
||||
enum SpellGroupStackFlags
|
||||
{
|
||||
SPELL_GROUP_STACK_FLAG_NONE = 0x00,
|
||||
SPELL_GROUP_STACK_FLAG_EXCLUSIVE = 0x01,
|
||||
SPELL_GROUP_STACK_FLAG_NOT_SAME_CASTER = 0x02,
|
||||
SPELL_GROUP_STACK_FLAG_FLAGGED = 0x04, // xinef: just a marker
|
||||
SPELL_GROUP_STACK_FLAG_NEVER_STACK = 0x08,
|
||||
SPELL_GROUP_STACK_FLAG_EFFECT_EXCLUSIVE = 0x10,
|
||||
SPELL_GROUP_STACK_FLAG_MAX = 0x20,
|
||||
|
||||
// Internal use
|
||||
SPELL_GROUP_STACK_FLAG_FORCED_STRONGEST = 0x100,
|
||||
SPELL_GROUP_STACK_FLAG_FORCED_WEAKEST = 0x200,
|
||||
};
|
||||
|
||||
struct SpellStackInfo
|
||||
{
|
||||
uint32 groupId;
|
||||
SpellGroupSpecialFlags specialFlags;
|
||||
};
|
||||
// spell_id, group_id
|
||||
typedef std::map<uint32, SpellStackInfo> SpellGroupMap;
|
||||
typedef std::map<uint32, SpellGroupStackFlags> SpellGroupStackMap;
|
||||
|
||||
|
||||
|
||||
struct SpellThreatEntry
|
||||
{
|
||||
int32 flatMod; // flat threat-value for this Spell - default: 0
|
||||
float pctMod; // threat-multiplier for this Spell - default: 1.0f
|
||||
float apPctMod; // Pct of AP that is added as Threat - default: 0.0f
|
||||
};
|
||||
|
||||
typedef std::map<uint32, SpellThreatEntry> SpellThreatMap;
|
||||
typedef std::map<uint32, float> SpellMixologyMap;
|
||||
|
||||
// coordinates for spells (accessed using SpellMgr functions)
|
||||
struct SpellTargetPosition
|
||||
{
|
||||
uint32 target_mapId;
|
||||
float target_X;
|
||||
float target_Y;
|
||||
float target_Z;
|
||||
float target_Orientation;
|
||||
};
|
||||
|
||||
typedef std::map<std::pair<uint32 /*spell_id*/, SpellEffIndex /*effIndex*/>, SpellTargetPosition> SpellTargetPositionMap;
|
||||
|
||||
// Enum with EffectRadiusIndex and their actual radius
|
||||
enum EffectRadiusIndex
|
||||
{
|
||||
EFFECT_RADIUS_2_YARDS = 7,
|
||||
EFFECT_RADIUS_5_YARDS = 8,
|
||||
EFFECT_RADIUS_20_YARDS = 9,
|
||||
EFFECT_RADIUS_30_YARDS = 10,
|
||||
EFFECT_RADIUS_45_YARDS = 11,
|
||||
EFFECT_RADIUS_100_YARDS = 12,
|
||||
EFFECT_RADIUS_10_YARDS = 13,
|
||||
EFFECT_RADIUS_8_YARDS = 14,
|
||||
EFFECT_RADIUS_3_YARDS = 15,
|
||||
EFFECT_RADIUS_1_YARD = 16,
|
||||
EFFECT_RADIUS_13_YARDS = 17,
|
||||
EFFECT_RADIUS_15_YARDS = 18,
|
||||
EFFECT_RADIUS_18_YARDS = 19,
|
||||
EFFECT_RADIUS_25_YARDS = 20,
|
||||
EFFECT_RADIUS_35_YARDS = 21,
|
||||
EFFECT_RADIUS_200_YARDS = 22,
|
||||
EFFECT_RADIUS_40_YARDS = 23,
|
||||
EFFECT_RADIUS_65_YARDS = 24,
|
||||
EFFECT_RADIUS_70_YARDS = 25,
|
||||
EFFECT_RADIUS_4_YARDS = 26,
|
||||
EFFECT_RADIUS_50_YARDS = 27,
|
||||
EFFECT_RADIUS_50000_YARDS = 28,
|
||||
EFFECT_RADIUS_6_YARDS = 29,
|
||||
EFFECT_RADIUS_500_YARDS = 30,
|
||||
EFFECT_RADIUS_80_YARDS = 31,
|
||||
EFFECT_RADIUS_12_YARDS = 32,
|
||||
EFFECT_RADIUS_99_YARDS = 33,
|
||||
EFFECT_RADIUS_55_YARDS = 35,
|
||||
EFFECT_RADIUS_0_YARDS = 36,
|
||||
EFFECT_RADIUS_7_YARDS = 37,
|
||||
EFFECT_RADIUS_21_YARDS = 38,
|
||||
EFFECT_RADIUS_34_YARDS = 39,
|
||||
EFFECT_RADIUS_9_YARDS = 40,
|
||||
EFFECT_RADIUS_150_YARDS = 41,
|
||||
EFFECT_RADIUS_11_YARDS = 42,
|
||||
EFFECT_RADIUS_16_YARDS = 43,
|
||||
EFFECT_RADIUS_0_5_YARDS = 44, // 0.5 yards
|
||||
EFFECT_RADIUS_10_YARDS_2 = 45,
|
||||
EFFECT_RADIUS_5_YARDS_2 = 46,
|
||||
EFFECT_RADIUS_15_YARDS_2 = 47,
|
||||
EFFECT_RADIUS_60_YARDS = 48,
|
||||
EFFECT_RADIUS_90_YARDS = 49,
|
||||
EFFECT_RADIUS_15_YARDS_3 = 50,
|
||||
EFFECT_RADIUS_60_YARDS_2 = 51,
|
||||
EFFECT_RADIUS_5_YARDS_3 = 52,
|
||||
EFFECT_RADIUS_60_YARDS_3 = 53,
|
||||
EFFECT_RADIUS_50000_YARDS_2 = 54,
|
||||
EFFECT_RADIUS_130_YARDS = 55,
|
||||
EFFECT_RADIUS_38_YARDS = 56,
|
||||
EFFECT_RADIUS_45_YARDS_2 = 57,
|
||||
EFFECT_RADIUS_32_YARDS = 59,
|
||||
EFFECT_RADIUS_44_YARDS = 60,
|
||||
EFFECT_RADIUS_14_YARDS = 61,
|
||||
EFFECT_RADIUS_47_YARDS = 62,
|
||||
EFFECT_RADIUS_23_YARDS = 63,
|
||||
EFFECT_RADIUS_3_5_YARDS = 64, // 3.5 yards
|
||||
EFFECT_RADIUS_80_YARDS_2 = 65
|
||||
};
|
||||
|
||||
// Spell pet auras
|
||||
class PetAura
|
||||
{
|
||||
private:
|
||||
typedef UNORDERED_MAP<uint32, uint32> PetAuraMap;
|
||||
|
||||
public:
|
||||
PetAura() : removeOnChangePet(false), damage(0)
|
||||
{
|
||||
auras.clear();
|
||||
}
|
||||
|
||||
PetAura(uint32 petEntry, uint32 aura, bool _removeOnChangePet, int _damage) :
|
||||
removeOnChangePet(_removeOnChangePet), damage(_damage)
|
||||
{
|
||||
auras[petEntry] = aura;
|
||||
}
|
||||
|
||||
uint32 GetAura(uint32 petEntry) const
|
||||
{
|
||||
PetAuraMap::const_iterator itr = auras.find(petEntry);
|
||||
if (itr != auras.end())
|
||||
return itr->second;
|
||||
PetAuraMap::const_iterator itr2 = auras.find(0);
|
||||
if (itr2 != auras.end())
|
||||
return itr2->second;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AddAura(uint32 petEntry, uint32 aura)
|
||||
{
|
||||
auras[petEntry] = aura;
|
||||
}
|
||||
|
||||
bool IsRemovedOnChangePet() const
|
||||
{
|
||||
return removeOnChangePet;
|
||||
}
|
||||
|
||||
int32 GetDamage() const
|
||||
{
|
||||
return damage;
|
||||
}
|
||||
|
||||
private:
|
||||
PetAuraMap auras;
|
||||
bool removeOnChangePet;
|
||||
int32 damage;
|
||||
};
|
||||
typedef std::map<uint32, PetAura> SpellPetAuraMap;
|
||||
|
||||
struct SpellArea
|
||||
{
|
||||
uint32 spellId;
|
||||
uint32 areaId; // zone/subzone/or 0 is not limited to zone
|
||||
uint32 questStart; // quest start (quest must be active or rewarded for spell apply)
|
||||
uint32 questEnd; // quest end (quest must not be rewarded for spell apply)
|
||||
int32 auraSpell; // spell aura must be applied for spell apply)if possitive) and it must not be applied in other case
|
||||
uint32 raceMask; // can be applied only to races
|
||||
Gender gender; // can be applied only to gender
|
||||
uint32 questStartStatus; // QuestStatus that quest_start must have in order to keep the spell
|
||||
uint32 questEndStatus; // QuestStatus that the quest_end must have in order to keep the spell (if the quest_end's status is different than this, the spell will be dropped)
|
||||
bool autocast; // if true then auto applied at area enter, in other case just allowed to cast
|
||||
|
||||
// helpers
|
||||
bool IsFitToRequirements(Player const* player, uint32 newZone, uint32 newArea) const;
|
||||
};
|
||||
|
||||
typedef std::multimap<uint32, SpellArea> SpellAreaMap;
|
||||
typedef std::multimap<uint32, SpellArea const*> SpellAreaForQuestMap;
|
||||
typedef std::multimap<uint32, SpellArea const*> SpellAreaForAuraMap;
|
||||
typedef std::multimap<uint32, SpellArea const*> SpellAreaForAreaMap;
|
||||
typedef std::pair<SpellAreaMap::const_iterator, SpellAreaMap::const_iterator> SpellAreaMapBounds;
|
||||
typedef std::pair<SpellAreaForQuestMap::const_iterator, SpellAreaForQuestMap::const_iterator> SpellAreaForQuestMapBounds;
|
||||
typedef std::pair<SpellAreaForAuraMap::const_iterator, SpellAreaForAuraMap::const_iterator> SpellAreaForAuraMapBounds;
|
||||
typedef std::pair<SpellAreaForAreaMap::const_iterator, SpellAreaForAreaMap::const_iterator> SpellAreaForAreaMapBounds;
|
||||
|
||||
// Spell rank chain (accessed using SpellMgr functions)
|
||||
struct SpellChainNode
|
||||
{
|
||||
SpellInfo const* prev;
|
||||
SpellInfo const* next;
|
||||
SpellInfo const* first;
|
||||
SpellInfo const* last;
|
||||
uint8 rank;
|
||||
};
|
||||
|
||||
typedef UNORDERED_MAP<uint32, SpellChainNode> SpellChainMap;
|
||||
|
||||
// spell_id req_spell
|
||||
typedef std::multimap<uint32, uint32> SpellRequiredMap;
|
||||
typedef std::pair<SpellRequiredMap::const_iterator, SpellRequiredMap::const_iterator> SpellRequiredMapBounds;
|
||||
|
||||
// req_spell spell_id
|
||||
typedef std::multimap<uint32, uint32> SpellsRequiringSpellMap;
|
||||
typedef std::pair<SpellsRequiringSpellMap::const_iterator, SpellsRequiringSpellMap::const_iterator> SpellsRequiringSpellMapBounds;
|
||||
|
||||
// Spell learning properties (accessed using SpellMgr functions)
|
||||
struct SpellLearnSkillNode
|
||||
{
|
||||
uint16 skill;
|
||||
uint16 step;
|
||||
uint16 value; // 0 - max skill value for player level
|
||||
uint16 maxvalue; // 0 - max skill value for player level
|
||||
};
|
||||
|
||||
typedef std::map<uint32, SpellLearnSkillNode> SpellLearnSkillMap;
|
||||
|
||||
typedef std::multimap<uint32, SkillLineAbilityEntry const*> SkillLineAbilityMap;
|
||||
typedef std::pair<SkillLineAbilityMap::const_iterator, SkillLineAbilityMap::const_iterator> SkillLineAbilityMapBounds;
|
||||
|
||||
typedef std::multimap<uint32, uint32> PetLevelupSpellSet;
|
||||
typedef std::map<uint32, PetLevelupSpellSet> PetLevelupSpellMap;
|
||||
|
||||
typedef std::map<uint32, uint32> SpellDifficultySearcherMap;
|
||||
|
||||
struct PetDefaultSpellsEntry
|
||||
{
|
||||
uint32 spellid[MAX_CREATURE_SPELL_DATA_SLOT];
|
||||
};
|
||||
|
||||
// < 0 for petspelldata id, > 0 for creature_id
|
||||
typedef std::map<int32, PetDefaultSpellsEntry> PetDefaultSpellsMap;
|
||||
|
||||
typedef std::vector<uint32> SpellCustomAttribute;
|
||||
typedef std::vector<bool> EnchantCustomAttribute;
|
||||
|
||||
typedef std::vector<SpellInfo*> SpellInfoMap;
|
||||
|
||||
typedef std::map<int32, std::vector<int32> > SpellLinkedMap;
|
||||
|
||||
bool IsPrimaryProfessionSkill(uint32 skill);
|
||||
|
||||
inline bool IsProfessionSkill(uint32 skill)
|
||||
{
|
||||
return IsPrimaryProfessionSkill(skill) || skill == SKILL_FISHING || skill == SKILL_COOKING || skill == SKILL_FIRST_AID;
|
||||
}
|
||||
|
||||
inline bool IsProfessionOrRidingSkill(uint32 skill)
|
||||
{
|
||||
return IsProfessionSkill(skill) || skill == SKILL_RIDING;
|
||||
}
|
||||
|
||||
bool IsPartOfSkillLine(uint32 skillId, uint32 spellId);
|
||||
|
||||
// spell diminishing returns
|
||||
DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto, bool triggered);
|
||||
DiminishingReturnsType GetDiminishingReturnsGroupType(DiminishingGroup group);
|
||||
DiminishingLevels GetDiminishingReturnsMaxLevel(DiminishingGroup group);
|
||||
int32 GetDiminishingReturnsLimitDuration(DiminishingGroup group, SpellInfo const* spellproto);
|
||||
bool IsDiminishingReturnsGroupDurationLimited(DiminishingGroup group);
|
||||
|
||||
typedef std::set<uint32> TalentAdditionalSet;
|
||||
|
||||
class SpellMgr
|
||||
{
|
||||
friend class ACE_Singleton<SpellMgr, ACE_Null_Mutex>;
|
||||
// Constructors
|
||||
private:
|
||||
SpellMgr();
|
||||
~SpellMgr();
|
||||
|
||||
// Accessors (const or static functions)
|
||||
public:
|
||||
// Spell correctness for client using
|
||||
static bool ComputeIsSpellValid(SpellInfo const* spellInfo, bool msg = true);
|
||||
static bool IsSpellValid(SpellInfo const* spellInfo);
|
||||
static bool CheckSpellValid(SpellInfo const* spellInfo, uint32 spellId, bool isTalent);
|
||||
|
||||
// Spell difficulty
|
||||
uint32 GetSpellDifficultyId(uint32 spellId) const;
|
||||
void SetSpellDifficultyId(uint32 spellId, uint32 id);
|
||||
uint32 GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) const;
|
||||
SpellInfo const* GetSpellForDifficultyFromSpell(SpellInfo const* spell, Unit const* caster) const;
|
||||
|
||||
// Spell Ranks table
|
||||
SpellChainNode const* GetSpellChainNode(uint32 spell_id) const;
|
||||
uint32 GetFirstSpellInChain(uint32 spell_id) const;
|
||||
uint32 GetLastSpellInChain(uint32 spell_id) const;
|
||||
uint32 GetNextSpellInChain(uint32 spell_id) const;
|
||||
uint32 GetPrevSpellInChain(uint32 spell_id) const;
|
||||
uint8 GetSpellRank(uint32 spell_id) const;
|
||||
// not strict check returns provided spell if rank not avalible
|
||||
uint32 GetSpellWithRank(uint32 spell_id, uint32 rank, bool strict = false) const;
|
||||
|
||||
// Spell Required table
|
||||
SpellRequiredMapBounds GetSpellsRequiredForSpellBounds(uint32 spell_id) const;
|
||||
SpellsRequiringSpellMapBounds GetSpellsRequiringSpellBounds(uint32 spell_id) const;
|
||||
bool IsSpellRequiringSpell(uint32 spellid, uint32 req_spellid) const;
|
||||
|
||||
// Spell learning
|
||||
SpellLearnSkillNode const* GetSpellLearnSkill(uint32 spell_id) const;
|
||||
|
||||
// Spell target coordinates
|
||||
SpellTargetPosition const* GetSpellTargetPosition(uint32 spell_id, SpellEffIndex effIndex) const;
|
||||
|
||||
// Spell Groups
|
||||
uint32 GetSpellGroup(uint32 spellid) const;
|
||||
SpellGroupSpecialFlags GetSpellGroupSpecialFlags(uint32 spell_id) const;
|
||||
SpellGroupStackFlags GetGroupStackFlags(uint32 groupid) const;
|
||||
SpellGroupStackFlags CheckSpellGroupStackRules(SpellInfo const* spellInfo1, SpellInfo const* spellInfo2, bool remove, bool areaAura) const;
|
||||
void GetSetOfSpellsInSpellGroupWithFlag(uint32 group_id, SpellGroupSpecialFlags flag, std::set<uint32>& availableElixirs) const;
|
||||
|
||||
// Spell proc event table
|
||||
SpellProcEventEntry const* GetSpellProcEvent(uint32 spellId) const;
|
||||
bool IsSpellProcEventCanTriggeredBy(SpellInfo const* spellProto, SpellProcEventEntry const* spellProcEvent, uint32 EventProcFlag, SpellInfo const* procSpell, uint32 procFlags, uint32 procExtra, bool active) const;
|
||||
|
||||
// Spell proc table
|
||||
SpellProcEntry const* GetSpellProcEntry(uint32 spellId) const;
|
||||
bool CanSpellTriggerProcOnEvent(SpellProcEntry const& procEntry, ProcEventInfo& eventInfo) const;
|
||||
|
||||
// Spell bonus data table
|
||||
SpellBonusEntry const* GetSpellBonusData(uint32 spellId) const;
|
||||
|
||||
// Spell threat table
|
||||
SpellThreatEntry const* GetSpellThreatEntry(uint32 spellID) const;
|
||||
|
||||
// Spell mixology table
|
||||
float GetSpellMixologyBonus(uint32 spellId) const;
|
||||
|
||||
SkillLineAbilityMapBounds GetSkillLineAbilityMapBounds(uint32 spell_id) const;
|
||||
|
||||
PetAura const* GetPetAura(uint32 spell_id, uint8 eff) const;
|
||||
|
||||
SpellEnchantProcEntry const* GetSpellEnchantProcEvent(uint32 enchId) const;
|
||||
bool IsArenaAllowedEnchancment(uint32 ench_id) const;
|
||||
|
||||
const std::vector<int32> *GetSpellLinked(int32 spell_id) const;
|
||||
|
||||
PetLevelupSpellSet const* GetPetLevelupSpellList(uint32 petFamily) const;
|
||||
PetDefaultSpellsEntry const* GetPetDefaultSpellsEntry(int32 id) const;
|
||||
|
||||
// Spell area
|
||||
SpellAreaMapBounds GetSpellAreaMapBounds(uint32 spell_id) const;
|
||||
SpellAreaForQuestMapBounds GetSpellAreaForQuestMapBounds(uint32 quest_id) const;
|
||||
SpellAreaForQuestMapBounds GetSpellAreaForQuestEndMapBounds(uint32 quest_id) const;
|
||||
SpellAreaForAuraMapBounds GetSpellAreaForAuraMapBounds(uint32 spell_id) const;
|
||||
SpellAreaForAreaMapBounds GetSpellAreaForAreaMapBounds(uint32 area_id) const;
|
||||
|
||||
// SpellInfo object management
|
||||
SpellInfo const* GetSpellInfo(uint32 spellId) const { return spellId < GetSpellInfoStoreSize() ? mSpellInfoMap[spellId] : NULL; }
|
||||
uint32 GetSpellInfoStoreSize() const { return mSpellInfoMap.size(); }
|
||||
|
||||
// Talent Additional Set
|
||||
bool IsAdditionalTalentSpell(uint32 spellId) const;
|
||||
|
||||
// Modifiers
|
||||
public:
|
||||
|
||||
// Loading data at server startup
|
||||
void UnloadSpellInfoChains();
|
||||
void LoadSpellTalentRanks();
|
||||
void LoadSpellRanks();
|
||||
void LoadSpellRequired();
|
||||
void LoadSpellLearnSkills();
|
||||
void LoadSpellTargetPositions();
|
||||
void LoadSpellGroups();
|
||||
void LoadSpellGroupStackRules();
|
||||
void LoadSpellProcEvents();
|
||||
void LoadSpellProcs();
|
||||
void LoadSpellBonusess();
|
||||
void LoadSpellThreats();
|
||||
void LoadSpellMixology();
|
||||
void LoadSkillLineAbilityMap();
|
||||
void LoadSpellPetAuras();
|
||||
void LoadEnchantCustomAttr();
|
||||
void LoadSpellEnchantProcData();
|
||||
void LoadSpellLinked();
|
||||
void LoadPetLevelupSpellMap();
|
||||
void LoadPetDefaultSpells();
|
||||
void LoadSpellAreas();
|
||||
void LoadSpellInfoStore();
|
||||
void UnloadSpellInfoStore();
|
||||
void UnloadSpellInfoImplicitTargetConditionLists();
|
||||
void LoadSpellCustomAttr();
|
||||
void LoadDbcDataCorrections();
|
||||
void LoadSpellSpecificAndAuraState();
|
||||
|
||||
private:
|
||||
SpellDifficultySearcherMap mSpellDifficultySearcherMap;
|
||||
SpellChainMap mSpellChains;
|
||||
SpellsRequiringSpellMap mSpellsReqSpell;
|
||||
SpellRequiredMap mSpellReq;
|
||||
SpellLearnSkillMap mSpellLearnSkills;
|
||||
SpellTargetPositionMap mSpellTargetPositions;
|
||||
SpellGroupMap mSpellGroupMap;
|
||||
SpellGroupStackMap mSpellGroupStackMap;
|
||||
SpellProcEventMap mSpellProcEventMap;
|
||||
SpellProcMap mSpellProcMap;
|
||||
SpellBonusMap mSpellBonusMap;
|
||||
SpellThreatMap mSpellThreatMap;
|
||||
SpellMixologyMap mSpellMixologyMap;
|
||||
SpellPetAuraMap mSpellPetAuraMap;
|
||||
SpellLinkedMap mSpellLinkedMap;
|
||||
SpellEnchantProcEventMap mSpellEnchantProcEventMap;
|
||||
EnchantCustomAttribute mEnchantCustomAttr;
|
||||
SpellAreaMap mSpellAreaMap;
|
||||
SpellAreaForQuestMap mSpellAreaForQuestMap;
|
||||
SpellAreaForQuestMap mSpellAreaForQuestEndMap;
|
||||
SpellAreaForAuraMap mSpellAreaForAuraMap;
|
||||
SpellAreaForAreaMap mSpellAreaForAreaMap;
|
||||
SkillLineAbilityMap mSkillLineAbilityMap;
|
||||
PetLevelupSpellMap mPetLevelupSpellMap;
|
||||
PetDefaultSpellsMap mPetDefaultSpellsMap; // only spells not listed in related mPetLevelupSpellMap entry
|
||||
SpellInfoMap mSpellInfoMap;
|
||||
TalentAdditionalSet mTalentSpellAdditionalSet;
|
||||
};
|
||||
|
||||
#define sSpellMgr ACE_Singleton<SpellMgr, ACE_Null_Mutex>::instance()
|
||||
|
||||
#endif
|
||||
1162
src/server/game/Spells/SpellScript.cpp
Normal file
1162
src/server/game/Spells/SpellScript.cpp
Normal file
File diff suppressed because it is too large
Load Diff
886
src/server/game/Spells/SpellScript.h
Normal file
886
src/server/game/Spells/SpellScript.h
Normal file
@@ -0,0 +1,886 @@
|
||||
/*
|
||||
* Copyright (C)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __SPELL_SCRIPT_H
|
||||
#define __SPELL_SCRIPT_H
|
||||
|
||||
#include "Util.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "SpellAuraDefines.h"
|
||||
#include "Spell.h"
|
||||
#include <stack>
|
||||
|
||||
class Unit;
|
||||
class SpellInfo;
|
||||
class SpellScript;
|
||||
class Spell;
|
||||
class Aura;
|
||||
class AuraEffect;
|
||||
struct SpellModifier;
|
||||
class Creature;
|
||||
class GameObject;
|
||||
class DynamicObject;
|
||||
class Player;
|
||||
class Item;
|
||||
class WorldLocation;
|
||||
class WorldObject;
|
||||
|
||||
#define SPELL_EFFECT_ANY (uint16)-1
|
||||
#define SPELL_AURA_ANY (uint16)-1
|
||||
|
||||
enum SpellScriptState
|
||||
{
|
||||
SPELL_SCRIPT_STATE_NONE = 0,
|
||||
SPELL_SCRIPT_STATE_REGISTRATION,
|
||||
SPELL_SCRIPT_STATE_LOADING,
|
||||
SPELL_SCRIPT_STATE_UNLOADING,
|
||||
};
|
||||
#define SPELL_SCRIPT_STATE_END SPELL_SCRIPT_STATE_UNLOADING + 1
|
||||
|
||||
// helper class from which SpellScript and SpellAura derive, use these classes instead
|
||||
class _SpellScript
|
||||
{
|
||||
// internal use classes & functions
|
||||
// DO NOT THESE IN SCRIPTS
|
||||
protected:
|
||||
virtual bool _Validate(SpellInfo const* entry);
|
||||
|
||||
public:
|
||||
_SpellScript() : m_currentScriptState(SPELL_SCRIPT_STATE_NONE), m_scriptName(NULL), m_scriptSpellId(0) {}
|
||||
virtual ~_SpellScript() {}
|
||||
virtual void _Register();
|
||||
virtual void _Unload();
|
||||
virtual void _Init(std::string const* scriptname, uint32 spellId);
|
||||
std::string const* _GetScriptName() const;
|
||||
|
||||
protected:
|
||||
class EffectHook
|
||||
{
|
||||
public:
|
||||
EffectHook(uint8 _effIndex);
|
||||
virtual ~EffectHook() { }
|
||||
|
||||
uint8 GetAffectedEffectsMask(SpellInfo const* spellEntry);
|
||||
bool IsEffectAffected(SpellInfo const* spellEntry, uint8 effIndex);
|
||||
virtual bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex) = 0;
|
||||
std::string EffIndexToString();
|
||||
protected:
|
||||
uint8 effIndex;
|
||||
};
|
||||
|
||||
class EffectNameCheck
|
||||
{
|
||||
public:
|
||||
EffectNameCheck(uint16 _effName) { effName = _effName; }
|
||||
bool Check(SpellInfo const* spellEntry, uint8 effIndex);
|
||||
std::string ToString();
|
||||
private:
|
||||
uint16 effName;
|
||||
};
|
||||
|
||||
class EffectAuraNameCheck
|
||||
{
|
||||
public:
|
||||
EffectAuraNameCheck(uint16 _effAurName) { effAurName = _effAurName; }
|
||||
bool Check(SpellInfo const* spellEntry, uint8 effIndex);
|
||||
std::string ToString();
|
||||
private:
|
||||
uint16 effAurName;
|
||||
};
|
||||
|
||||
uint8 m_currentScriptState;
|
||||
std::string const* m_scriptName;
|
||||
uint32 m_scriptSpellId;
|
||||
public:
|
||||
//
|
||||
// SpellScript/AuraScript interface base
|
||||
// these functions are safe to override, see notes below for usage instructions
|
||||
//
|
||||
// Function in which handler functions are registered, must be implemented in script
|
||||
virtual void Register() = 0;
|
||||
// Function called on server startup, if returns false script won't be used in core
|
||||
// use for: dbc/template data presence/correctness checks
|
||||
virtual bool Validate(SpellInfo const* /*spellEntry*/) { return true; }
|
||||
// Function called when script is created, if returns false script will be unloaded afterwards
|
||||
// use for: initializing local script variables (DO NOT USE CONSTRUCTOR FOR THIS PURPOSE!)
|
||||
virtual bool Load() { return true; }
|
||||
// Function called when script is destroyed
|
||||
// use for: deallocating memory allocated by script
|
||||
virtual void Unload() {}
|
||||
};
|
||||
|
||||
// SpellScript interface - enum used for runtime checks of script function calls
|
||||
enum SpellScriptHookType
|
||||
{
|
||||
SPELL_SCRIPT_HOOK_EFFECT_LAUNCH = SPELL_SCRIPT_STATE_END,
|
||||
SPELL_SCRIPT_HOOK_EFFECT_LAUNCH_TARGET,
|
||||
SPELL_SCRIPT_HOOK_EFFECT_HIT,
|
||||
SPELL_SCRIPT_HOOK_EFFECT_HIT_TARGET,
|
||||
SPELL_SCRIPT_HOOK_BEFORE_HIT,
|
||||
SPELL_SCRIPT_HOOK_HIT,
|
||||
SPELL_SCRIPT_HOOK_AFTER_HIT,
|
||||
SPELL_SCRIPT_HOOK_OBJECT_AREA_TARGET_SELECT,
|
||||
SPELL_SCRIPT_HOOK_OBJECT_TARGET_SELECT,
|
||||
SPELL_SCRIPT_HOOK_DESTINATION_TARGET_SELECT,
|
||||
SPELL_SCRIPT_HOOK_CHECK_CAST,
|
||||
SPELL_SCRIPT_HOOK_BEFORE_CAST,
|
||||
SPELL_SCRIPT_HOOK_ON_CAST,
|
||||
SPELL_SCRIPT_HOOK_AFTER_CAST,
|
||||
};
|
||||
|
||||
#define HOOK_SPELL_HIT_START SPELL_SCRIPT_HOOK_EFFECT_HIT
|
||||
#define HOOK_SPELL_HIT_END SPELL_SCRIPT_HOOK_AFTER_HIT + 1
|
||||
#define HOOK_SPELL_START SPELL_SCRIPT_HOOK_EFFECT
|
||||
#define HOOK_SPELL_END SPELL_SCRIPT_HOOK_CHECK_CAST + 1
|
||||
#define HOOK_SPELL_COUNT HOOK_SPELL_END - HOOK_SPELL_START
|
||||
|
||||
class SpellScript : public _SpellScript
|
||||
{
|
||||
// internal use classes & functions
|
||||
// DO NOT THESE IN SCRIPTS
|
||||
public:
|
||||
#define SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) \
|
||||
typedef SpellCastResult(CLASSNAME::*SpellCheckCastFnType)(); \
|
||||
typedef void(CLASSNAME::*SpellEffectFnType)(SpellEffIndex); \
|
||||
typedef void(CLASSNAME::*SpellHitFnType)(); \
|
||||
typedef void(CLASSNAME::*SpellCastFnType)(); \
|
||||
typedef void(CLASSNAME::*SpellObjectAreaTargetSelectFnType)(std::list<WorldObject*>&); \
|
||||
typedef void(CLASSNAME::*SpellObjectTargetSelectFnType)(WorldObject*&); \
|
||||
typedef void(CLASSNAME::*SpellDestinationTargetSelectFnType)(SpellDestination&);
|
||||
|
||||
SPELLSCRIPT_FUNCTION_TYPE_DEFINES(SpellScript)
|
||||
|
||||
class CastHandler
|
||||
{
|
||||
public:
|
||||
CastHandler(SpellCastFnType _pCastHandlerScript);
|
||||
void Call(SpellScript* spellScript);
|
||||
private:
|
||||
SpellCastFnType pCastHandlerScript;
|
||||
};
|
||||
|
||||
class CheckCastHandler
|
||||
{
|
||||
public:
|
||||
CheckCastHandler(SpellCheckCastFnType checkCastHandlerScript);
|
||||
SpellCastResult Call(SpellScript* spellScript);
|
||||
private:
|
||||
SpellCheckCastFnType _checkCastHandlerScript;
|
||||
};
|
||||
|
||||
class EffectHandler : public _SpellScript::EffectNameCheck, public _SpellScript::EffectHook
|
||||
{
|
||||
public:
|
||||
EffectHandler(SpellEffectFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName);
|
||||
std::string ToString();
|
||||
bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex);
|
||||
void Call(SpellScript* spellScript, SpellEffIndex effIndex);
|
||||
private:
|
||||
SpellEffectFnType pEffectHandlerScript;
|
||||
};
|
||||
|
||||
class HitHandler
|
||||
{
|
||||
public:
|
||||
HitHandler(SpellHitFnType _pHitHandlerScript);
|
||||
void Call(SpellScript* spellScript);
|
||||
private:
|
||||
SpellHitFnType pHitHandlerScript;
|
||||
};
|
||||
|
||||
class TargetHook : public _SpellScript::EffectHook
|
||||
{
|
||||
public:
|
||||
TargetHook(uint8 _effectIndex, uint16 _targetType, bool _area, bool _dest);
|
||||
bool CheckEffect(SpellInfo const* spellInfo, uint8 effIndex);
|
||||
std::string ToString();
|
||||
uint16 GetTarget() const { return targetType; }
|
||||
protected:
|
||||
uint16 targetType;
|
||||
bool area;
|
||||
bool dest;
|
||||
};
|
||||
|
||||
class ObjectAreaTargetSelectHandler : public TargetHook
|
||||
{
|
||||
public:
|
||||
ObjectAreaTargetSelectHandler(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType);
|
||||
void Call(SpellScript* spellScript, std::list<WorldObject*>& targets);
|
||||
private:
|
||||
SpellObjectAreaTargetSelectFnType pObjectAreaTargetSelectHandlerScript;
|
||||
};
|
||||
|
||||
class ObjectTargetSelectHandler : public TargetHook
|
||||
{
|
||||
public:
|
||||
ObjectTargetSelectHandler(SpellObjectTargetSelectFnType _pObjectTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType);
|
||||
void Call(SpellScript* spellScript, WorldObject*& target);
|
||||
private:
|
||||
SpellObjectTargetSelectFnType pObjectTargetSelectHandlerScript;
|
||||
};
|
||||
|
||||
class DestinationTargetSelectHandler : public TargetHook
|
||||
{
|
||||
public:
|
||||
DestinationTargetSelectHandler(SpellDestinationTargetSelectFnType _DestinationTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType);
|
||||
void Call(SpellScript* spellScript, SpellDestination& target);
|
||||
private:
|
||||
SpellDestinationTargetSelectFnType DestinationTargetSelectHandlerScript;
|
||||
};
|
||||
|
||||
#define SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) \
|
||||
class CastHandlerFunction : public SpellScript::CastHandler { public: CastHandlerFunction(SpellCastFnType _pCastHandlerScript) : SpellScript::CastHandler((SpellScript::SpellCastFnType)_pCastHandlerScript) {} }; \
|
||||
class CheckCastHandlerFunction : public SpellScript::CheckCastHandler { public: CheckCastHandlerFunction(SpellCheckCastFnType _checkCastHandlerScript) : SpellScript::CheckCastHandler((SpellScript::SpellCheckCastFnType)_checkCastHandlerScript) {} }; \
|
||||
class EffectHandlerFunction : public SpellScript::EffectHandler { public: EffectHandlerFunction(SpellEffectFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : SpellScript::EffectHandler((SpellScript::SpellEffectFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \
|
||||
class HitHandlerFunction : public SpellScript::HitHandler { public: HitHandlerFunction(SpellHitFnType _pHitHandlerScript) : SpellScript::HitHandler((SpellScript::SpellHitFnType)_pHitHandlerScript) {} }; \
|
||||
class ObjectAreaTargetSelectHandlerFunction : public SpellScript::ObjectAreaTargetSelectHandler { public: ObjectAreaTargetSelectHandlerFunction(SpellObjectAreaTargetSelectFnType _pObjectAreaTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::ObjectAreaTargetSelectHandler((SpellScript::SpellObjectAreaTargetSelectFnType)_pObjectAreaTargetSelectHandlerScript, _effIndex, _targetType) {} }; \
|
||||
class ObjectTargetSelectHandlerFunction : public SpellScript::ObjectTargetSelectHandler { public: ObjectTargetSelectHandlerFunction(SpellObjectTargetSelectFnType _pObjectTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::ObjectTargetSelectHandler((SpellScript::SpellObjectTargetSelectFnType)_pObjectTargetSelectHandlerScript, _effIndex, _targetType) { } }; \
|
||||
class DestinationTargetSelectHandlerFunction : public SpellScript::DestinationTargetSelectHandler { public: DestinationTargetSelectHandlerFunction(SpellDestinationTargetSelectFnType _DestinationTargetSelectHandlerScript, uint8 _effIndex, uint16 _targetType) : SpellScript::DestinationTargetSelectHandler((SpellScript::SpellDestinationTargetSelectFnType)_DestinationTargetSelectHandlerScript, _effIndex, _targetType) { } };
|
||||
|
||||
#define PrepareSpellScript(CLASSNAME) SPELLSCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) SPELLSCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME)
|
||||
public:
|
||||
bool _Validate(SpellInfo const* entry);
|
||||
bool _Load(Spell* spell);
|
||||
void _InitHit();
|
||||
bool _IsEffectPrevented(SpellEffIndex effIndex) { return m_hitPreventEffectMask & (1<<effIndex); }
|
||||
bool _IsDefaultEffectPrevented(SpellEffIndex effIndex) { return m_hitPreventDefaultEffectMask & (1<<effIndex); }
|
||||
void _PrepareScriptCall(SpellScriptHookType hookType);
|
||||
void _FinishScriptCall();
|
||||
bool IsInCheckCastHook() const;
|
||||
bool IsInTargetHook() const;
|
||||
bool IsInHitPhase() const;
|
||||
bool IsInEffectHook() const;
|
||||
private:
|
||||
Spell* m_spell;
|
||||
uint8 m_hitPreventEffectMask;
|
||||
uint8 m_hitPreventDefaultEffectMask;
|
||||
public:
|
||||
//
|
||||
// SpellScript interface
|
||||
// hooks to which you can attach your functions
|
||||
//
|
||||
// example: BeforeCast += SpellCastFn(class::function);
|
||||
HookList<CastHandler> BeforeCast;
|
||||
// example: OnCast += SpellCastFn(class::function);
|
||||
HookList<CastHandler> OnCast;
|
||||
// example: AfterCast += SpellCastFn(class::function);
|
||||
HookList<CastHandler> AfterCast;
|
||||
#define SpellCastFn(F) CastHandlerFunction(&F)
|
||||
|
||||
// example: OnCheckCast += SpellCheckCastFn();
|
||||
// where function is SpellCastResult function()
|
||||
HookList<CheckCastHandler> OnCheckCast;
|
||||
#define SpellCheckCastFn(F) CheckCastHandlerFunction(&F)
|
||||
|
||||
// example: OnEffect**** += SpellEffectFn(class::function, EffectIndexSpecifier, EffectNameSpecifier);
|
||||
// where function is void function(SpellEffIndex effIndex)
|
||||
HookList<EffectHandler> OnEffectLaunch;
|
||||
HookList<EffectHandler> OnEffectLaunchTarget;
|
||||
HookList<EffectHandler> OnEffectHit;
|
||||
HookList<EffectHandler> OnEffectHitTarget;
|
||||
#define SpellEffectFn(F, I, N) EffectHandlerFunction(&F, I, N)
|
||||
|
||||
// example: BeforeHit += SpellHitFn(class::function);
|
||||
HookList<HitHandler> BeforeHit;
|
||||
// example: OnHit += SpellHitFn(class::function);
|
||||
HookList<HitHandler> OnHit;
|
||||
// example: AfterHit += SpellHitFn(class::function);
|
||||
HookList<HitHandler> AfterHit;
|
||||
// where function is: void function()
|
||||
#define SpellHitFn(F) HitHandlerFunction(&F)
|
||||
|
||||
// example: OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(class::function, EffectIndexSpecifier, TargetsNameSpecifier);
|
||||
// where function is void function(std::list<WorldObject*>& targets)
|
||||
HookList<ObjectAreaTargetSelectHandler> OnObjectAreaTargetSelect;
|
||||
#define SpellObjectAreaTargetSelectFn(F, I, N) ObjectAreaTargetSelectHandlerFunction(&F, I, N)
|
||||
|
||||
// example: OnObjectTargetSelect += SpellObjectTargetSelectFn(class::function, EffectIndexSpecifier, TargetsNameSpecifier);
|
||||
// where function is void function(WorldObject*& target)
|
||||
HookList<ObjectTargetSelectHandler> OnObjectTargetSelect;
|
||||
#define SpellObjectTargetSelectFn(F, I, N) ObjectTargetSelectHandlerFunction(&F, I, N)
|
||||
|
||||
// example: OnDestinationTargetSelect += SpellDestinationTargetSelectFn(class::function, EffectIndexSpecifier, TargetsNameSpecifier);
|
||||
// where function is void function(SpellDestination& target)
|
||||
HookList<DestinationTargetSelectHandler> OnDestinationTargetSelect;
|
||||
#define SpellDestinationTargetSelectFn(F, I, N) DestinationTargetSelectHandlerFunction(&F, I, N)
|
||||
|
||||
// hooks are executed in following order, at specified event of spell:
|
||||
// 1. BeforeCast - executed when spell preparation is finished (when cast bar becomes full) before cast is handled
|
||||
// 2. OnCheckCast - allows to override result of CheckCast function
|
||||
// 3a. OnObjectAreaTargetSelect - executed just before adding selected targets to final target list (for area targets)
|
||||
// 3b. OnObjectTargetSelect - executed just before adding selected target to final target list (for single unit targets)
|
||||
// 3c. OnDestinationTargetSelect - executed just before adding selected target to final target list (for destination targets)
|
||||
// 4. OnCast - executed just before spell is launched (creates missile) or executed
|
||||
// 5. AfterCast - executed after spell missile is launched and immediate spell actions are done
|
||||
// 6. OnEffectLaunch - executed just before specified effect handler call - when spell missile is launched
|
||||
// 7. OnEffectLaunchTarget - executed just before specified effect handler call - when spell missile is launched - called for each target from spell target map
|
||||
// 8. OnEffectHit - executed just before specified effect handler call - when spell missile hits dest
|
||||
// 9. BeforeHit - executed just before spell hits a target - called for each target from spell target map
|
||||
// 10. OnEffectHitTarget - executed just before specified effect handler call - called for each target from spell target map
|
||||
// 11. OnHit - executed just before spell deals damage and procs auras - when spell hits target - called for each target from spell target map
|
||||
// 12. AfterHit - executed just after spell finishes all it's jobs for target - called for each target from spell target map
|
||||
|
||||
//
|
||||
// methods allowing interaction with Spell object
|
||||
//
|
||||
// methods useable during all spell handling phases
|
||||
Unit* GetCaster();
|
||||
Unit* GetOriginalCaster();
|
||||
SpellInfo const* GetSpellInfo();
|
||||
SpellValue const* GetSpellValue();
|
||||
|
||||
// methods useable after spell is prepared
|
||||
// accessors to the explicit targets of the spell
|
||||
// explicit target - target selected by caster (player, game client, or script - DoCast(explicitTarget, ...), required for spell to be cast
|
||||
// examples:
|
||||
// -shadowstep - explicit target is the unit you want to go behind of
|
||||
// -chain heal - explicit target is the unit to be healed first
|
||||
// -holy nova/arcane explosion - explicit target = NULL because target you are selecting doesn't affect how spell targets are selected
|
||||
// you can determine if spell requires explicit targets by dbc columns:
|
||||
// - Targets - mask of explicit target types
|
||||
// - ImplicitTargetXX set to TARGET_XXX_TARGET_YYY, _TARGET_ here means that explicit target is used by the effect, so spell needs one too
|
||||
|
||||
// returns: WorldLocation which was selected as a spell destination or NULL
|
||||
WorldLocation const* GetExplTargetDest();
|
||||
|
||||
void SetExplTargetDest(WorldLocation& loc);
|
||||
|
||||
// returns: WorldObject which was selected as an explicit spell target or NULL if there's no target
|
||||
WorldObject* GetExplTargetWorldObject();
|
||||
|
||||
// returns: Unit which was selected as an explicit spell target or NULL if there's no target
|
||||
Unit* GetExplTargetUnit();
|
||||
|
||||
// returns: GameObject which was selected as an explicit spell target or NULL if there's no target
|
||||
GameObject* GetExplTargetGObj();
|
||||
|
||||
// returns: Item which was selected as an explicit spell target or NULL if there's no target
|
||||
Item* GetExplTargetItem();
|
||||
|
||||
// methods useable only during spell hit on target, or during spell launch on target:
|
||||
// returns: target of current effect if it was Unit otherwise NULL
|
||||
Unit* GetHitUnit();
|
||||
// returns: target of current effect if it was Creature otherwise NULL
|
||||
Creature* GetHitCreature();
|
||||
// returns: target of current effect if it was Player otherwise NULL
|
||||
Player* GetHitPlayer();
|
||||
// returns: target of current effect if it was Item otherwise NULL
|
||||
Item* GetHitItem();
|
||||
// returns: target of current effect if it was GameObject otherwise NULL
|
||||
GameObject* GetHitGObj();
|
||||
// returns: destination of current effect
|
||||
WorldLocation* GetHitDest();
|
||||
// setter/getter for for damage done by spell to target of spell hit
|
||||
// returns damage calculated before hit, and real dmg done after hit
|
||||
int32 GetHitDamage();
|
||||
void SetHitDamage(int32 damage);
|
||||
void PreventHitDamage() { SetHitDamage(0); }
|
||||
// setter/getter for for heal done by spell to target of spell hit
|
||||
// returns healing calculated before hit, and real dmg done after hit
|
||||
int32 GetHitHeal();
|
||||
void SetHitHeal(int32 heal);
|
||||
void PreventHitHeal() { SetHitHeal(0); }
|
||||
Spell* GetSpell() { return m_spell; }
|
||||
// returns current spell hit target aura
|
||||
Aura* GetHitAura();
|
||||
// prevents applying aura on current spell hit target
|
||||
void PreventHitAura();
|
||||
|
||||
// prevents effect execution on current spell hit target
|
||||
// including other effect/hit scripts
|
||||
// will not work on aura/damage/heal
|
||||
// will not work if effects were already handled
|
||||
void PreventHitEffect(SpellEffIndex effIndex);
|
||||
|
||||
// prevents default effect execution on current spell hit target
|
||||
// will not work on aura/damage/heal effects
|
||||
// will not work if effects were already handled
|
||||
void PreventHitDefaultEffect(SpellEffIndex effIndex);
|
||||
|
||||
// method avalible only in EffectHandler method
|
||||
int32 GetEffectValue() const;
|
||||
void SetEffectValue(int32 value);
|
||||
|
||||
// returns: cast item if present.
|
||||
Item* GetCastItem();
|
||||
|
||||
// Creates item. Calls Spell::DoCreateItem method.
|
||||
void CreateItem(uint32 effIndex, uint32 itemId);
|
||||
|
||||
// Returns SpellInfo from the spell that triggered the current one
|
||||
SpellInfo const* GetTriggeringSpell();
|
||||
|
||||
// finishes spellcast prematurely with selected error message
|
||||
void FinishCast(SpellCastResult result);
|
||||
|
||||
void Cancel(); // pussywizard
|
||||
|
||||
void SetCustomCastResultMessage(SpellCustomErrors result);
|
||||
};
|
||||
|
||||
// AuraScript interface - enum used for runtime checks of script function calls
|
||||
enum AuraScriptHookType
|
||||
{
|
||||
AURA_SCRIPT_HOOK_EFFECT_APPLY = SPELL_SCRIPT_STATE_END,
|
||||
AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY,
|
||||
AURA_SCRIPT_HOOK_EFFECT_REMOVE,
|
||||
AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE,
|
||||
AURA_SCRIPT_HOOK_EFFECT_PERIODIC,
|
||||
AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC,
|
||||
AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT,
|
||||
AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC,
|
||||
AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD,
|
||||
AURA_SCRIPT_HOOK_EFFECT_ABSORB,
|
||||
AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB,
|
||||
AURA_SCRIPT_HOOK_EFFECT_MANASHIELD,
|
||||
AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD,
|
||||
AURA_SCRIPT_HOOK_EFFECT_SPLIT,
|
||||
AURA_SCRIPT_HOOK_CHECK_AREA_TARGET,
|
||||
AURA_SCRIPT_HOOK_DISPEL,
|
||||
AURA_SCRIPT_HOOK_AFTER_DISPEL,
|
||||
// Spell Proc Hooks
|
||||
AURA_SCRIPT_HOOK_CHECK_PROC,
|
||||
AURA_SCRIPT_HOOK_PREPARE_PROC,
|
||||
AURA_SCRIPT_HOOK_PROC,
|
||||
AURA_SCRIPT_HOOK_EFFECT_PROC,
|
||||
AURA_SCRIPT_HOOK_EFFECT_AFTER_PROC,
|
||||
AURA_SCRIPT_HOOK_AFTER_PROC,
|
||||
/*AURA_SCRIPT_HOOK_APPLY,
|
||||
AURA_SCRIPT_HOOK_REMOVE, */
|
||||
};
|
||||
/*
|
||||
#define HOOK_AURA_EFFECT_START HOOK_AURA_EFFECT_APPLY
|
||||
#define HOOK_AURA_EFFECT_END HOOK_AURA_EFFECT_CALC_SPELLMOD + 1
|
||||
#define HOOK_AURA_EFFECT_COUNT HOOK_AURA_EFFECT_END - HOOK_AURA_EFFECT_START
|
||||
*/
|
||||
class AuraScript : public _SpellScript
|
||||
{
|
||||
// internal use classes & functions
|
||||
// DO NOT THESE IN SCRIPTS
|
||||
public:
|
||||
|
||||
#define AURASCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) \
|
||||
typedef bool(CLASSNAME::*AuraCheckAreaTargetFnType)(Unit* target); \
|
||||
typedef void(CLASSNAME::*AuraDispelFnType)(DispelInfo* dispelInfo); \
|
||||
typedef void(CLASSNAME::*AuraEffectApplicationModeFnType)(AuraEffect const*, AuraEffectHandleModes); \
|
||||
typedef void(CLASSNAME::*AuraEffectPeriodicFnType)(AuraEffect const*); \
|
||||
typedef void(CLASSNAME::*AuraEffectUpdatePeriodicFnType)(AuraEffect*); \
|
||||
typedef void(CLASSNAME::*AuraEffectCalcAmountFnType)(AuraEffect const*, int32 &, bool &); \
|
||||
typedef void(CLASSNAME::*AuraEffectCalcPeriodicFnType)(AuraEffect const*, bool &, int32 &); \
|
||||
typedef void(CLASSNAME::*AuraEffectCalcSpellModFnType)(AuraEffect const*, SpellModifier* &); \
|
||||
typedef void(CLASSNAME::*AuraEffectAbsorbFnType)(AuraEffect*, DamageInfo &, uint32 &); \
|
||||
typedef void(CLASSNAME::*AuraEffectSplitFnType)(AuraEffect*, DamageInfo &, uint32 &); \
|
||||
typedef bool(CLASSNAME::*AuraCheckProcFnType)(ProcEventInfo&); \
|
||||
typedef void(CLASSNAME::*AuraProcFnType)(ProcEventInfo&); \
|
||||
typedef void(CLASSNAME::*AuraEffectProcFnType)(AuraEffect const*, ProcEventInfo&); \
|
||||
|
||||
AURASCRIPT_FUNCTION_TYPE_DEFINES(AuraScript)
|
||||
|
||||
class CheckAreaTargetHandler
|
||||
{
|
||||
public:
|
||||
CheckAreaTargetHandler(AuraCheckAreaTargetFnType pHandlerScript);
|
||||
bool Call(AuraScript* auraScript, Unit* target);
|
||||
private:
|
||||
AuraCheckAreaTargetFnType pHandlerScript;
|
||||
};
|
||||
class AuraDispelHandler
|
||||
{
|
||||
public:
|
||||
AuraDispelHandler(AuraDispelFnType pHandlerScript);
|
||||
void Call(AuraScript* auraScript, DispelInfo* dispelInfo);
|
||||
private:
|
||||
AuraDispelFnType pHandlerScript;
|
||||
};
|
||||
class EffectBase : public _SpellScript::EffectAuraNameCheck, public _SpellScript::EffectHook
|
||||
{
|
||||
public:
|
||||
EffectBase(uint8 _effIndex, uint16 _effName);
|
||||
std::string ToString();
|
||||
bool CheckEffect(SpellInfo const* spellEntry, uint8 effIndex);
|
||||
};
|
||||
class EffectPeriodicHandler : public EffectBase
|
||||
{
|
||||
public:
|
||||
EffectPeriodicHandler(AuraEffectPeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName);
|
||||
void Call(AuraScript* auraScript, AuraEffect const* _aurEff);
|
||||
private:
|
||||
AuraEffectPeriodicFnType pEffectHandlerScript;
|
||||
};
|
||||
class EffectUpdatePeriodicHandler : public EffectBase
|
||||
{
|
||||
public:
|
||||
EffectUpdatePeriodicHandler(AuraEffectUpdatePeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName);
|
||||
void Call(AuraScript* auraScript, AuraEffect* aurEff);
|
||||
private:
|
||||
AuraEffectUpdatePeriodicFnType pEffectHandlerScript;
|
||||
};
|
||||
class EffectCalcAmountHandler : public EffectBase
|
||||
{
|
||||
public:
|
||||
EffectCalcAmountHandler(AuraEffectCalcAmountFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName);
|
||||
void Call(AuraScript* auraScript, AuraEffect const* aurEff, int32 & amount, bool & canBeRecalculated);
|
||||
private:
|
||||
AuraEffectCalcAmountFnType pEffectHandlerScript;
|
||||
};
|
||||
class EffectCalcPeriodicHandler : public EffectBase
|
||||
{
|
||||
public:
|
||||
EffectCalcPeriodicHandler(AuraEffectCalcPeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName);
|
||||
void Call(AuraScript* auraScript, AuraEffect const* aurEff, bool & isPeriodic, int32 & periodicTimer);
|
||||
private:
|
||||
AuraEffectCalcPeriodicFnType pEffectHandlerScript;
|
||||
};
|
||||
class EffectCalcSpellModHandler : public EffectBase
|
||||
{
|
||||
public:
|
||||
EffectCalcSpellModHandler(AuraEffectCalcSpellModFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName);
|
||||
void Call(AuraScript* auraScript, AuraEffect const* aurEff, SpellModifier* & spellMod);
|
||||
private:
|
||||
AuraEffectCalcSpellModFnType pEffectHandlerScript;
|
||||
};
|
||||
class EffectApplyHandler : public EffectBase
|
||||
{
|
||||
public:
|
||||
EffectApplyHandler(AuraEffectApplicationModeFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName, AuraEffectHandleModes _mode);
|
||||
void Call(AuraScript* auraScript, AuraEffect const* _aurEff, AuraEffectHandleModes _mode);
|
||||
private:
|
||||
AuraEffectApplicationModeFnType pEffectHandlerScript;
|
||||
AuraEffectHandleModes mode;
|
||||
};
|
||||
class EffectAbsorbHandler : public EffectBase
|
||||
{
|
||||
public:
|
||||
EffectAbsorbHandler(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex);
|
||||
void Call(AuraScript* auraScript, AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount);
|
||||
private:
|
||||
AuraEffectAbsorbFnType pEffectHandlerScript;
|
||||
};
|
||||
class EffectManaShieldHandler : public EffectBase
|
||||
{
|
||||
public:
|
||||
EffectManaShieldHandler(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex);
|
||||
void Call(AuraScript* auraScript, AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount);
|
||||
private:
|
||||
AuraEffectAbsorbFnType pEffectHandlerScript;
|
||||
};
|
||||
class EffectSplitHandler : public EffectBase
|
||||
{
|
||||
public:
|
||||
EffectSplitHandler(AuraEffectSplitFnType _pEffectHandlerScript, uint8 _effIndex);
|
||||
void Call(AuraScript* auraScript, AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & splitAmount);
|
||||
private:
|
||||
AuraEffectSplitFnType pEffectHandlerScript;
|
||||
};
|
||||
class CheckProcHandler
|
||||
{
|
||||
public:
|
||||
CheckProcHandler(AuraCheckProcFnType handlerScript);
|
||||
bool Call(AuraScript* auraScript, ProcEventInfo& eventInfo);
|
||||
private:
|
||||
AuraCheckProcFnType _HandlerScript;
|
||||
};
|
||||
class AuraProcHandler
|
||||
{
|
||||
public:
|
||||
AuraProcHandler(AuraProcFnType handlerScript);
|
||||
void Call(AuraScript* auraScript, ProcEventInfo& eventInfo);
|
||||
private:
|
||||
AuraProcFnType _HandlerScript;
|
||||
};
|
||||
class EffectProcHandler : public EffectBase
|
||||
{
|
||||
public:
|
||||
EffectProcHandler(AuraEffectProcFnType effectHandlerScript, uint8 effIndex, uint16 effName);
|
||||
void Call(AuraScript* auraScript, AuraEffect const* aurEff, ProcEventInfo& eventInfo);
|
||||
private:
|
||||
AuraEffectProcFnType _EffectHandlerScript;
|
||||
};
|
||||
|
||||
#define AURASCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME) \
|
||||
class CheckAreaTargetFunction : public AuraScript::CheckAreaTargetHandler { public: CheckAreaTargetFunction(AuraCheckAreaTargetFnType _pHandlerScript) : AuraScript::CheckAreaTargetHandler((AuraScript::AuraCheckAreaTargetFnType)_pHandlerScript) {} }; \
|
||||
class AuraDispelFunction : public AuraScript::AuraDispelHandler { public: AuraDispelFunction(AuraDispelFnType _pHandlerScript) : AuraScript::AuraDispelHandler((AuraScript::AuraDispelFnType)_pHandlerScript) {} }; \
|
||||
class EffectPeriodicHandlerFunction : public AuraScript::EffectPeriodicHandler { public: EffectPeriodicHandlerFunction(AuraEffectPeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : AuraScript::EffectPeriodicHandler((AuraScript::AuraEffectPeriodicFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \
|
||||
class EffectUpdatePeriodicHandlerFunction : public AuraScript::EffectUpdatePeriodicHandler { public: EffectUpdatePeriodicHandlerFunction(AuraEffectUpdatePeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : AuraScript::EffectUpdatePeriodicHandler((AuraScript::AuraEffectUpdatePeriodicFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \
|
||||
class EffectCalcAmountHandlerFunction : public AuraScript::EffectCalcAmountHandler { public: EffectCalcAmountHandlerFunction(AuraEffectCalcAmountFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : AuraScript::EffectCalcAmountHandler((AuraScript::AuraEffectCalcAmountFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \
|
||||
class EffectCalcPeriodicHandlerFunction : public AuraScript::EffectCalcPeriodicHandler { public: EffectCalcPeriodicHandlerFunction(AuraEffectCalcPeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : AuraScript::EffectCalcPeriodicHandler((AuraScript::AuraEffectCalcPeriodicFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \
|
||||
class EffectCalcSpellModHandlerFunction : public AuraScript::EffectCalcSpellModHandler { public: EffectCalcSpellModHandlerFunction(AuraEffectCalcSpellModFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName) : AuraScript::EffectCalcSpellModHandler((AuraScript::AuraEffectCalcSpellModFnType)_pEffectHandlerScript, _effIndex, _effName) {} }; \
|
||||
class EffectApplyHandlerFunction : public AuraScript::EffectApplyHandler { public: EffectApplyHandlerFunction(AuraEffectApplicationModeFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName, AuraEffectHandleModes _mode) : AuraScript::EffectApplyHandler((AuraScript::AuraEffectApplicationModeFnType)_pEffectHandlerScript, _effIndex, _effName, _mode) {} }; \
|
||||
class EffectAbsorbFunction : public AuraScript::EffectAbsorbHandler { public: EffectAbsorbFunction(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex) : AuraScript::EffectAbsorbHandler((AuraScript::AuraEffectAbsorbFnType)_pEffectHandlerScript, _effIndex) {} }; \
|
||||
class EffectManaShieldFunction : public AuraScript::EffectManaShieldHandler { public: EffectManaShieldFunction(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex) : AuraScript::EffectManaShieldHandler((AuraScript::AuraEffectAbsorbFnType)_pEffectHandlerScript, _effIndex) {} }; \
|
||||
class EffectSplitFunction : public AuraScript::EffectSplitHandler { public: EffectSplitFunction(AuraEffectSplitFnType _pEffectHandlerScript, uint8 _effIndex) : AuraScript::EffectSplitHandler((AuraScript::AuraEffectSplitFnType)_pEffectHandlerScript, _effIndex) {} }; \
|
||||
class CheckProcHandlerFunction : public AuraScript::CheckProcHandler { public: CheckProcHandlerFunction(AuraCheckProcFnType handlerScript) : AuraScript::CheckProcHandler((AuraScript::AuraCheckProcFnType)handlerScript) {} }; \
|
||||
class AuraProcHandlerFunction : public AuraScript::AuraProcHandler { public: AuraProcHandlerFunction(AuraProcFnType handlerScript) : AuraScript::AuraProcHandler((AuraScript::AuraProcFnType)handlerScript) {} }; \
|
||||
class EffectProcHandlerFunction : public AuraScript::EffectProcHandler { public: EffectProcHandlerFunction(AuraEffectProcFnType effectHandlerScript, uint8 effIndex, uint16 effName) : AuraScript::EffectProcHandler((AuraScript::AuraEffectProcFnType)effectHandlerScript, effIndex, effName) {} }; \
|
||||
|
||||
#define PrepareAuraScript(CLASSNAME) AURASCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) AURASCRIPT_FUNCTION_CAST_DEFINES(CLASSNAME)
|
||||
|
||||
public:
|
||||
AuraScript() : _SpellScript(), m_aura(NULL), m_auraApplication(NULL), m_defaultActionPrevented(false)
|
||||
{}
|
||||
bool _Validate(SpellInfo const* entry);
|
||||
bool _Load(Aura* aura);
|
||||
void _PrepareScriptCall(AuraScriptHookType hookType, AuraApplication const* aurApp = NULL);
|
||||
void _FinishScriptCall();
|
||||
bool _IsDefaultActionPrevented();
|
||||
private:
|
||||
Aura* m_aura;
|
||||
AuraApplication const* m_auraApplication;
|
||||
bool m_defaultActionPrevented;
|
||||
|
||||
class ScriptStateStore
|
||||
{
|
||||
public:
|
||||
AuraApplication const* _auraApplication;
|
||||
uint8 _currentScriptState;
|
||||
bool _defaultActionPrevented;
|
||||
ScriptStateStore(uint8 currentScriptState, AuraApplication const* auraApplication, bool defaultActionPrevented)
|
||||
: _auraApplication(auraApplication), _currentScriptState(currentScriptState), _defaultActionPrevented(defaultActionPrevented)
|
||||
{}
|
||||
};
|
||||
typedef std::stack<ScriptStateStore> ScriptStateStack;
|
||||
ScriptStateStack m_scriptStates;
|
||||
|
||||
public:
|
||||
//
|
||||
// AuraScript interface
|
||||
// hooks to which you can attach your functions
|
||||
//
|
||||
// executed when area aura checks if it can be applied on target
|
||||
// example: OnEffectApply += AuraEffectApplyFn(class::function);
|
||||
// where function is: bool function (Unit* target);
|
||||
HookList<CheckAreaTargetHandler> DoCheckAreaTarget;
|
||||
#define AuraCheckAreaTargetFn(F) CheckAreaTargetFunction(&F)
|
||||
|
||||
// executed when aura is dispelled by a unit
|
||||
// example: OnDispel += AuraDispelFn(class::function);
|
||||
// where function is: void function (DispelInfo* dispelInfo);
|
||||
HookList<AuraDispelHandler> OnDispel;
|
||||
// executed after aura is dispelled by a unit
|
||||
// example: AfterDispel += AuraDispelFn(class::function);
|
||||
// where function is: void function (DispelInfo* dispelInfo);
|
||||
HookList<AuraDispelHandler> AfterDispel;
|
||||
#define AuraDispelFn(F) AuraDispelFunction(&F)
|
||||
|
||||
// executed when aura effect is applied with specified mode to target
|
||||
// should be used when when effect handler preventing/replacing is needed, do not use this hook for triggering spellcasts/removing auras etc - may be unsafe
|
||||
// example: OnEffectApply += AuraEffectApplyFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes);
|
||||
// where function is: void function (AuraEffect const* aurEff, AuraEffectHandleModes mode);
|
||||
HookList<EffectApplyHandler> OnEffectApply;
|
||||
// executed after aura effect is applied with specified mode to target
|
||||
// example: AfterEffectApply += AuraEffectApplyFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes);
|
||||
// where function is: void function (AuraEffect const* aurEff, AuraEffectHandleModes mode);
|
||||
HookList<EffectApplyHandler> AfterEffectApply;
|
||||
#define AuraEffectApplyFn(F, I, N, M) EffectApplyHandlerFunction(&F, I, N, M)
|
||||
|
||||
// executed after aura effect is removed with specified mode from target
|
||||
// should be used when when effect handler preventing/replacing is needed, do not use this hook for triggering spellcasts/removing auras etc - may be unsafe
|
||||
// example: OnEffectRemove += AuraEffectRemoveFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes);
|
||||
// where function is: void function (AuraEffect const* aurEff, AuraEffectHandleModes mode);
|
||||
HookList<EffectApplyHandler> OnEffectRemove;
|
||||
// executed when aura effect is removed with specified mode from target
|
||||
// example: AfterEffectRemove += AuraEffectRemoveFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier, AuraEffectHandleModes);
|
||||
// where function is: void function (AuraEffect const* aurEff, AuraEffectHandleModes mode);
|
||||
HookList<EffectApplyHandler> AfterEffectRemove;
|
||||
#define AuraEffectRemoveFn(F, I, N, M) EffectApplyHandlerFunction(&F, I, N, M)
|
||||
|
||||
// executed when periodic aura effect ticks on target
|
||||
// example: OnEffectPeriodic += AuraEffectPeriodicFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
|
||||
// where function is: void function (AuraEffect const* aurEff);
|
||||
HookList<EffectPeriodicHandler> OnEffectPeriodic;
|
||||
#define AuraEffectPeriodicFn(F, I, N) EffectPeriodicHandlerFunction(&F, I, N)
|
||||
|
||||
// executed when periodic aura effect is updated
|
||||
// example: OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
|
||||
// where function is: void function (AuraEffect* aurEff);
|
||||
HookList<EffectUpdatePeriodicHandler> OnEffectUpdatePeriodic;
|
||||
#define AuraEffectUpdatePeriodicFn(F, I, N) EffectUpdatePeriodicHandlerFunction(&F, I, N)
|
||||
|
||||
// executed when aura effect calculates amount
|
||||
// example: DoEffectCalcAmount += AuraEffectCalcAmounFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
|
||||
// where function is: void function (AuraEffect* aurEff, int32& amount, bool& canBeRecalculated);
|
||||
HookList<EffectCalcAmountHandler> DoEffectCalcAmount;
|
||||
#define AuraEffectCalcAmountFn(F, I, N) EffectCalcAmountHandlerFunction(&F, I, N)
|
||||
|
||||
// executed when aura effect calculates periodic data
|
||||
// example: DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
|
||||
// where function is: void function (AuraEffect const* aurEff, bool& isPeriodic, int32& amplitude);
|
||||
HookList<EffectCalcPeriodicHandler> DoEffectCalcPeriodic;
|
||||
#define AuraEffectCalcPeriodicFn(F, I, N) EffectCalcPeriodicHandlerFunction(&F, I, N)
|
||||
|
||||
// executed when aura effect calculates spellmod
|
||||
// example: DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
|
||||
// where function is: void function (AuraEffect const* aurEff, SpellModifier*& spellMod);
|
||||
HookList<EffectCalcSpellModHandler> DoEffectCalcSpellMod;
|
||||
#define AuraEffectCalcSpellModFn(F, I, N) EffectCalcSpellModHandlerFunction(&F, I, N)
|
||||
|
||||
// executed when absorb aura effect is going to reduce damage
|
||||
// example: OnEffectAbsorb += AuraEffectAbsorbFn(class::function, EffectIndexSpecifier);
|
||||
// where function is: void function (AuraEffect const* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount);
|
||||
HookList<EffectAbsorbHandler> OnEffectAbsorb;
|
||||
#define AuraEffectAbsorbFn(F, I) EffectAbsorbFunction(&F, I)
|
||||
|
||||
// executed after absorb aura effect reduced damage to target - absorbAmount is real amount absorbed by aura
|
||||
// example: AfterEffectAbsorb += AuraEffectAbsorbFn(class::function, EffectIndexSpecifier);
|
||||
// where function is: void function (AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount);
|
||||
HookList<EffectAbsorbHandler> AfterEffectAbsorb;
|
||||
|
||||
// executed when mana shield aura effect is going to reduce damage
|
||||
// example: OnEffectManaShield += AuraEffectAbsorbFn(class::function, EffectIndexSpecifier);
|
||||
// where function is: void function (AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount);
|
||||
HookList<EffectManaShieldHandler> OnEffectManaShield;
|
||||
#define AuraEffectManaShieldFn(F, I) EffectManaShieldFunction(&F, I)
|
||||
|
||||
// executed after mana shield aura effect reduced damage to target - absorbAmount is real amount absorbed by aura
|
||||
// example: AfterEffectManaShield += AuraEffectAbsorbFn(class::function, EffectIndexSpecifier);
|
||||
// where function is: void function (AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& absorbAmount);
|
||||
HookList<EffectManaShieldHandler> AfterEffectManaShield;
|
||||
|
||||
// executed when the caster of some spell with split dmg aura gets damaged through it
|
||||
// example: OnEffectSplit += AuraEffectSplitFn(class::function, EffectIndexSpecifier);
|
||||
// where function is: void function (AuraEffect* aurEff, DamageInfo& dmgInfo, uint32& splitAmount);
|
||||
HookList<EffectSplitHandler> OnEffectSplit;
|
||||
#define AuraEffectSplitFn(F, I) EffectSplitFunction(&F, I)
|
||||
|
||||
// executed when aura checks if it can proc
|
||||
// example: DoCheckProc += AuraCheckProcFn(class::function);
|
||||
// where function is: bool function (ProcEventInfo& eventInfo);
|
||||
HookList<CheckProcHandler> DoCheckProc;
|
||||
#define AuraCheckProcFn(F) CheckProcHandlerFunction(&F)
|
||||
|
||||
// executed before aura procs (possibility to prevent charge drop/cooldown)
|
||||
// example: DoPrepareProc += AuraProcFn(class::function);
|
||||
// where function is: void function (ProcEventInfo& eventInfo);
|
||||
HookList<AuraProcHandler> DoPrepareProc;
|
||||
// executed when aura procs
|
||||
// example: OnProc += AuraProcFn(class::function);
|
||||
// where function is: void function (ProcEventInfo& eventInfo);
|
||||
HookList<AuraProcHandler> OnProc;
|
||||
// executed after aura proced
|
||||
// example: AfterProc += AuraProcFn(class::function);
|
||||
// where function is: void function (ProcEventInfo& eventInfo);
|
||||
HookList<AuraProcHandler> AfterProc;
|
||||
#define AuraProcFn(F) AuraProcHandlerFunction(&F)
|
||||
|
||||
// executed when aura effect procs
|
||||
// example: OnEffectProc += AuraEffectProcFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
|
||||
// where function is: void function (AuraEffect const* aurEff, ProcEventInfo& procInfo);
|
||||
HookList<EffectProcHandler> OnEffectProc;
|
||||
// executed after aura effect proced
|
||||
// example: AfterEffectProc += AuraEffectProcFn(class::function, EffectIndexSpecifier, EffectAuraNameSpecifier);
|
||||
// where function is: void function (AuraEffect const* aurEff, ProcEventInfo& procInfo);
|
||||
HookList<EffectProcHandler> AfterEffectProc;
|
||||
#define AuraEffectProcFn(F, I, N) EffectProcHandlerFunction(&F, I, N)
|
||||
|
||||
// AuraScript interface - hook/effect execution manipulators
|
||||
|
||||
// prevents default action of a hook from being executed (works only while called in a hook which default action can be prevented)
|
||||
void PreventDefaultAction();
|
||||
|
||||
// AuraScript interface - functions which are redirecting to Aura class
|
||||
|
||||
// returns proto of the spell
|
||||
SpellInfo const* GetSpellInfo() const;
|
||||
// returns spellid of the spell
|
||||
uint32 GetId() const;
|
||||
|
||||
// returns guid of object which casted the aura (m_originalCaster of the Spell class)
|
||||
uint64 GetCasterGUID() const;
|
||||
// returns unit which casted the aura or NULL if not avalible (caster logged out for example)
|
||||
Unit* GetCaster() const;
|
||||
// returns object on which aura was casted, target for non-area auras, area aura source for area auras
|
||||
WorldObject* GetOwner() const;
|
||||
// returns owner if it's unit or unit derived object, NULL otherwise (only for persistent area auras NULL is returned)
|
||||
Unit* GetUnitOwner() const;
|
||||
// returns owner if it's dynobj, NULL otherwise
|
||||
DynamicObject* GetDynobjOwner() const;
|
||||
|
||||
// removes aura with remove mode (see AuraRemoveMode enum)
|
||||
void Remove(uint32 removeMode = 0);
|
||||
// returns aura object of script
|
||||
Aura* GetAura() const;
|
||||
|
||||
// returns type of the aura, may be dynobj owned aura or unit owned aura
|
||||
AuraObjectType GetType() const;
|
||||
|
||||
// aura duration manipulation - when duration goes to 0 aura is removed
|
||||
int32 GetDuration() const;
|
||||
void SetDuration(int32 duration, bool withMods = false);
|
||||
// sets duration to maxduration
|
||||
void RefreshDuration();
|
||||
time_t GetApplyTime() const;
|
||||
int32 GetMaxDuration() const;
|
||||
void SetMaxDuration(int32 duration);
|
||||
int32 CalcMaxDuration() const;
|
||||
// expired - duration just went to 0
|
||||
bool IsExpired() const;
|
||||
// permament - has infinite duration
|
||||
bool IsPermanent() const;
|
||||
|
||||
// charges manipulation - 0 - not charged aura
|
||||
uint8 GetCharges() const;
|
||||
void SetCharges(uint8 charges);
|
||||
uint8 CalcMaxCharges() const;
|
||||
bool ModCharges(int8 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
// returns true if last charge dropped
|
||||
bool DropCharge(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
|
||||
// stack amount manipulation
|
||||
uint8 GetStackAmount() const;
|
||||
void SetStackAmount(uint8 num);
|
||||
bool ModStackAmount(int32 num, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||
|
||||
// passive - "working in background", not saved, not removed by immunities, not seen by player
|
||||
bool IsPassive() const;
|
||||
// death persistent - not removed on death
|
||||
bool IsDeathPersistent() const;
|
||||
|
||||
// check if aura has effect of given effindex
|
||||
bool HasEffect(uint8 effIndex) const;
|
||||
// returns aura effect of given effect index or NULL
|
||||
AuraEffect* GetEffect(uint8 effIndex) const;
|
||||
|
||||
// check if aura has effect of given aura type
|
||||
bool HasEffectType(AuraType type) const;
|
||||
|
||||
// AuraScript interface - functions which are redirecting to AuraApplication class
|
||||
// Do not call these in hooks in which AuraApplication is not avalible, otherwise result will differ from expected (the functions will return NULL)
|
||||
|
||||
// returns currently processed target of an aura
|
||||
// Return value does not need to be NULL-checked, the only situation this will (always)
|
||||
// return NULL is when the call happens in an unsupported hook, in other cases, it is always valid
|
||||
Unit* GetTarget() const;
|
||||
// returns AuraApplication object of currently processed target
|
||||
AuraApplication const* GetTargetApplication() const;
|
||||
};
|
||||
|
||||
//
|
||||
// definitions:
|
||||
//
|
||||
// EffectIndexSpecifier - specifies conditions for effects
|
||||
// EFFECT_0 - first effect matches
|
||||
// EFFECT_1 - second effect matches
|
||||
// EFFECT_2 - third effect matches
|
||||
// EFFECT_FIRST_FOUND - first effect matching other conditions matches
|
||||
// EFFECT_ALL - all effects of spell match
|
||||
//
|
||||
// EffectNameSpecifier - specifies conditions for spell effect names
|
||||
// SPELL_EFFECT_ANY - any effect but not 0 matches condition
|
||||
// SPELL_EFFECT_XXX - one of values of enum SpellEffects - effect with equal name matches
|
||||
//
|
||||
|
||||
#endif // __SPELL_SCRIPT_H
|
||||
Reference in New Issue
Block a user