diff --git a/sql/updates/world/custom/custom_2018_08_24_01_world.sql b/sql/updates/world/custom/custom_2018_08_24_01_world.sql new file mode 100644 index 00000000000..d13ccd55dff --- /dev/null +++ b/sql/updates/world/custom/custom_2018_08_24_01_world.sql @@ -0,0 +1,13 @@ +DELETE FROM `creature_template_addon` WHERE `entry`= 33248; +-- Creature Power Word: Barrier 33248 SAI +SET @ENTRY := 33248; +UPDATE `creature_template` SET `unit_flags`= 33554440, `unit_flags2`= 34, `minlevel`= 1, `maxlevel`= 1, `faction`= 35, `AIName`="SmartAI" WHERE `entry`= @ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@ENTRY, 0, 0, 1, 63, 0, 100, 0, 0, 0, 0, 0, 11, 40031, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, "When just created - Self: Cast spell 40031 on Self // "), +(@ENTRY, 0, 1, 0, 61, 0, 100, 0, 0, 0, 0, 0, 11, 81781, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, " Linked - Self: Cast spell 81781 on Self // "); + + +DELETE FROM `spell_script_names` WHERE `ScriptName`= 'spell_power_word_barrier'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(81781, 'spell_power_word_barrier'); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index a7d313854d6..4ffc96c2f97 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -8407,6 +8407,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy) ++itr; controlled->SetInCombatState(PvP, enemy); + controlled->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT); } } diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 5db0209b748..b8df36d5469 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -93,7 +93,8 @@ enum PriestSpellIcons PRIEST_ICON_ID_BORROWED_TIME = 2899, PRIEST_ICON_ID_DIVINE_TOUCH_TALENT = 3021, PRIEST_ICON_ID_PAIN_AND_SUFFERING = 2874, - PRIEST_ICON_ID_SHIELD_DISCIPLINE = 566 + PRIEST_ICON_ID_SHIELD_DISCIPLINE = 566, + PRIEST_ICON_ID_GLYPH_OF_POWER_WORD_BARRIER = 3837 }; enum MiscSpells @@ -1646,6 +1647,40 @@ class spell_pri_archangel : public SpellScript } }; +class spell_power_word_barrier : public AuraScript +{ + PrepareAuraScript(spell_power_word_barrier); + + bool Load() + { + TempSummon* summon = GetCaster()->ToTempSummon(); + if (!summon) + return false; + + Unit* summoner = summon->GetSummoner(); + if (!summoner) + return false; + + _glyphEnabled = summoner->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_GLYPH_OF_POWER_WORD_BARRIER, EFFECT_0) != nullptr; + + return true; + } + + void HandleGlyph(AuraEffect const* /*aurEff*/) + { + if (!_glyphEnabled) + PreventDefaultAction(); + } + + void Register() override + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_power_word_barrier::HandleGlyph, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + } + +private: + bool _glyphEnabled; +}; + void AddSC_priest_spell_scripts() { RegisterSpellScript(spell_pri_archangel); @@ -1674,6 +1709,7 @@ void AddSC_priest_spell_scripts() new spell_pri_pain_and_suffering_proc(); new spell_pri_penance(); new spell_pri_phantasm(); + RegisterAuraScript(spell_power_word_barrier); new spell_pri_power_word_shield(); new spell_pri_prayer_of_mending_heal(); RegisterAuraScript(spell_pri_shadow_orb);