From 30a7ea912d00d012bbca3230041fa806e2cab43e Mon Sep 17 00:00:00 2001 From: Aokromes Date: Thu, 23 Jan 2014 20:23:01 +0100 Subject: DB/Creature Fix faction of some creatures By Justiciar, closes #10711 --- sql/updates/world/2014_01_23_14_world_creature_template.sql | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 sql/updates/world/2014_01_23_14_world_creature_template.sql (limited to 'sql') diff --git a/sql/updates/world/2014_01_23_14_world_creature_template.sql b/sql/updates/world/2014_01_23_14_world_creature_template.sql new file mode 100644 index 00000000000..05ce8f568fc --- /dev/null +++ b/sql/updates/world/2014_01_23_14_world_creature_template.sql @@ -0,0 +1,4 @@ +-- +UPDATE `creature_template` SET `faction_A`=64, `faction_H`=64 WHERE `entry` IN (39675, 39368, 39386, 39678, 39396, 39275, 39349); +UPDATE `creature_template` SET `faction_A`=875, `faction_H`=875 WHERE `entry` IN (39717, 39716, 39715); +UPDATE `creature_template` SET `faction_A`=59, `faction_H`=59 WHERE `entry`=1117; -- cgit v1.2.3 From f0c4224603c73c9b3e1a2b1e8edc2c7d8c3e3d25 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Fri, 24 Jan 2014 01:32:15 +0100 Subject: Core/Spells: move killing spree to spellscript Closes #10597 Closes #11468 --- .../2014_01_23_15_world_spell_script_names.sql | 3 + src/server/game/Grids/Notifiers/GridNotifiers.h | 20 ---- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 32 ------ src/server/scripts/Spells/spell_rogue.cpp | 118 +++++++++++++++++++-- 4 files changed, 114 insertions(+), 59 deletions(-) create mode 100644 sql/updates/world/2014_01_23_15_world_spell_script_names.sql (limited to 'sql') diff --git a/sql/updates/world/2014_01_23_15_world_spell_script_names.sql b/sql/updates/world/2014_01_23_15_world_spell_script_names.sql new file mode 100644 index 00000000000..f3812f60e2c --- /dev/null +++ b/sql/updates/world/2014_01_23_15_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=51690; +INSERT INTO `spell_script_names` (`spell_id` ,`ScriptName`) VALUES +(51690, 'spell_rog_killing_spree'); diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index f5138845012..319b7b589b9 100644 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -835,26 +835,6 @@ namespace Trinity float i_range; }; - class AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck - { - public: - AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck(Unit const* funit, float range) - : i_funit(funit), i_range(range) { } - - bool operator()(const Unit* u) - { - return u->IsAlive() - && i_funit->IsWithinDistInMap(u, i_range) - && !i_funit->IsFriendlyTo(u) - && i_funit->IsValidAttackTarget(u) - && u->GetCreatureType() != CREATURE_TYPE_CRITTER - && i_funit->CanSeeOrDetect(u); - } - private: - Unit const* i_funit; - float i_range; - }; - class CreatureWithDbGUIDCheck { public: diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 1273b92596f..8ead8087d49 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -33,7 +33,6 @@ #include "Formulas.h" #include "GridNotifiers.h" #include "GridNotifiersImpl.h" -#include "CellImpl.h" #include "ScriptMgr.h" #include "Vehicle.h" #include "Battlefield.h" @@ -5351,37 +5350,6 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const if (!target->HasAuraType(SPELL_AURA_MOD_STEALTH)) target->RemoveAurasDueToSpell(31665); break; - // Killing Spree - case 51690: - { - /// @todo this should use effect[1] of 51690 - UnitList targets; - { - // eff_radius == 0 - float radius = GetSpellInfo()->GetMaxRange(false); - - CellCoord p(Trinity::ComputeCellCoord(target->GetPositionX(), target->GetPositionY())); - Cell cell(p); - - Trinity::AnyUnfriendlyAttackableVisibleUnitInObjectRangeCheck u_check(target, radius); - Trinity::UnitListSearcher checker(target, targets, u_check); - - TypeContainerVisitor, GridTypeMapContainer > grid_object_checker(checker); - TypeContainerVisitor, WorldTypeMapContainer > world_object_checker(checker); - - cell.Visit(p, grid_object_checker, *GetBase()->GetOwner()->GetMap(), *target, radius); - cell.Visit(p, world_object_checker, *GetBase()->GetOwner()->GetMap(), *target, radius); - } - - if (targets.empty()) - return; - - Unit* spellTarget = Trinity::Containers::SelectRandomContainerElement(targets); - - target->CastSpell(spellTarget, 57840, true); - target->CastSpell(spellTarget, 57841, true); - break; - } // Overkill case 58428: if (!target->HasAuraType(SPELL_AURA_MOD_STEALTH)) diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 4670117f0ea..2936586f4d9 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -28,13 +28,17 @@ enum RogueSpells { - SPELL_ROGUE_BLADE_FLURRY_EXTRA_ATTACK = 22482, - SPELL_ROGUE_CHEAT_DEATH_COOLDOWN = 31231, - SPELL_ROGUE_GLYPH_OF_PREPARATION = 56819, - SPELL_ROGUE_PREY_ON_THE_WEAK = 58670, - SPELL_ROGUE_SHIV_TRIGGERED = 5940, - SPELL_ROGUE_TRICKS_OF_THE_TRADE_DMG_BOOST = 57933, - SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC = 59628, + SPELL_ROGUE_BLADE_FLURRY_EXTRA_ATTACK = 22482, + SPELL_ROGUE_CHEAT_DEATH_COOLDOWN = 31231, + SPELL_ROGUE_GLYPH_OF_PREPARATION = 56819, + SPELL_ROGUE_KILLING_SPREE = 51690, + SPELL_ROGUE_KILLING_SPREE_TELEPORT = 57840, + SPELL_ROGUE_KILLING_SPREE_WEAPON_DMG = 57841, + SPELL_ROGUE_KILLING_SPREE_DMG_BUFF = 61851, + SPELL_ROGUE_PREY_ON_THE_WEAK = 58670, + SPELL_ROGUE_SHIV_TRIGGERED = 5940, + SPELL_ROGUE_TRICKS_OF_THE_TRADE_DMG_BOOST = 57933, + SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC = 59628, }; // 13877, 33735, (check 51211, 65956) - Blade Flurry @@ -249,6 +253,105 @@ class spell_rog_deadly_poison : public SpellScriptLoader } }; +// 51690 - Killing Spree +class spell_rog_killing_spree : public SpellScriptLoader +{ + public: + spell_rog_killing_spree() : SpellScriptLoader("spell_rog_killing_spree") { } + + class spell_rog_killing_spree_SpellScript : public SpellScript + { + PrepareSpellScript(spell_rog_killing_spree_SpellScript); + + void FilterTargets(std::list& targets) + { + if (targets.empty() || GetCaster()->GetVehicleBase()) + FinishCast(SPELL_FAILED_OUT_OF_RANGE); + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Aura* aura = GetCaster()->GetAura(SPELL_ROGUE_KILLING_SPREE)) + { + if (spell_rog_killing_spree_AuraScript* script = dynamic_cast(aura->GetScriptByName("spell_rog_killing_spree"))) + script->AddTarget(GetHitUnit()); + } + } + + void Register() OVERRIDE + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rog_killing_spree_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_DEST_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_rog_killing_spree_SpellScript::HandleDummy, EFFECT_1, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const OVERRIDE + { + return new spell_rog_killing_spree_SpellScript(); + } + + class spell_rog_killing_spree_AuraScript : public AuraScript + { + PrepareAuraScript(spell_rog_killing_spree_AuraScript); + + bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE + { + if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_KILLING_SPREE_TELEPORT) + || !sSpellMgr->GetSpellInfo(SPELL_ROGUE_KILLING_SPREE_WEAPON_DMG) + || !sSpellMgr->GetSpellInfo(SPELL_ROGUE_KILLING_SPREE_DMG_BUFF)) + return false; + return true; + } + + void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->CastSpell(GetTarget(), SPELL_ROGUE_KILLING_SPREE_DMG_BUFF, true); + } + + void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) + { + while (!_targets.empty()) + { + uint64 guid = Trinity::Containers::SelectRandomContainerElement(_targets); + if (Unit* target = ObjectAccessor::GetUnit(*GetTarget(), guid)) + { + GetTarget()->CastSpell(target, SPELL_ROGUE_KILLING_SPREE_TELEPORT, true); + GetTarget()->CastSpell(target, SPELL_ROGUE_KILLING_SPREE_WEAPON_DMG, true); + break; + } + else + _targets.remove(guid); + } + } + + void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + GetTarget()->RemoveAurasDueToSpell(SPELL_ROGUE_KILLING_SPREE_DMG_BUFF); + } + + void Register() OVERRIDE + { + AfterEffectApply += AuraEffectApplyFn(spell_rog_killing_spree_AuraScript::HandleApply, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_rog_killing_spree_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + AfterEffectRemove += AuraEffectRemoveFn(spell_rog_killing_spree_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + + public: + void AddTarget(Unit* target) + { + _targets.push_back(target->GetGUID()); + } + + private: + std::list _targets; + }; + + AuraScript* GetAuraScript() const OVERRIDE + { + return new spell_rog_killing_spree_AuraScript(); + } +}; + // -31130 - Nerves of Steel class spell_rog_nerves_of_steel : public SpellScriptLoader { @@ -594,6 +697,7 @@ void AddSC_rogue_spell_scripts() new spell_rog_blade_flurry(); new spell_rog_cheat_death(); new spell_rog_deadly_poison(); + new spell_rog_killing_spree(); new spell_rog_nerves_of_steel(); new spell_rog_preparation(); new spell_rog_prey_on_the_weak(); -- cgit v1.2.3