diff options
author | treeston <treeston.mmoc@gmail.com> | 2016-02-10 14:31:31 +0100 |
---|---|---|
committer | treeston <treeston.mmoc@gmail.com> | 2016-02-10 14:31:31 +0100 |
commit | 7299c519b0c0cb15bb0677b320266e669040d39f (patch) | |
tree | 33e0956bd564f0cbc68781521d26b877a27c2f5f | |
parent | bb9f5bda8bb39779ecdbd043a446174e29fe4799 (diff) | |
parent | 983bbe4a4c28ee0eda19daa3ab8b713a99ffa00d (diff) |
Merge remote-tracking branch 'ccrs/roguehonor' into 3.3.5 (PR #16512)
-rw-r--r-- | sql/updates/world/2016_02_10_04_world.sql | 6 | ||||
-rw-r--r-- | src/server/game/Entities/Unit/Unit.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 5 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_rogue.cpp | 142 |
4 files changed, 148 insertions, 7 deletions
diff --git a/sql/updates/world/2016_02_10_04_world.sql b/sql/updates/world/2016_02_10_04_world.sql new file mode 100644 index 00000000000..1349b83f442 --- /dev/null +++ b/sql/updates/world/2016_02_10_04_world.sql @@ -0,0 +1,6 @@ +-- Honor among thieves +DELETE FROM `spell_script_names` WHERE `scriptname` = 'spell_rog_honor_among_thieves'; +DELETE FROM `spell_script_names` WHERE `scriptname` = 'spell_rog_honor_among_thieves_proc'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(-51698, 'spell_rog_honor_among_thieves'), +(52916, 'spell_rog_honor_among_thieves_proc'); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index bdc97e22649..c224ef78ec8 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -8328,8 +8328,6 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg case 52914: case 52915: case 52910: - // Honor Among Thieves - case 52916: { target = triggeredByAura->GetBase()->GetCaster(); if (!target) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index b72ceecfff0..207908c6d51 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -4683,11 +4683,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool if (target->GetTypeId() == TYPEID_PLAYER) target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use break; - case 52916: // Honor Among Thieves - if (target->GetTypeId() == TYPEID_PLAYER) - if (Unit* spellTarget = ObjectAccessor::GetUnit(*target, target->ToPlayer()->GetComboTarget())) - target->CastSpell(spellTarget, 51699, true); - break; case 71563: if (Aura* newAura = target->AddAura(71564, target)) newAura->SetStackAmount(newAura->GetSpellInfo()->StackAmount); diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 3ca2db40d65..9b577d4e140 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -41,6 +41,9 @@ enum RogueSpells SPELL_ROGUE_SHIV_TRIGGERED = 5940, SPELL_ROGUE_TRICKS_OF_THE_TRADE_DMG_BOOST = 57933, SPELL_ROGUE_TRICKS_OF_THE_TRADE_PROC = 59628, + SPELL_ROGUE_HONOR_AMONG_THIEVES = 51698, + SPELL_ROGUE_HONOR_AMONG_THIEVES_PROC = 52916, + SPELL_ROGUE_HONOR_AMONG_THIEVES_2 = 51699 }; // 13877, 33735, (check 51211, 65956) - Blade Flurry @@ -703,6 +706,143 @@ class spell_rog_tricks_of_the_trade_proc : public SpellScriptLoader } }; +// 51698,51700,51701 - Honor Among Thieves +class spell_rog_honor_among_thieves : public SpellScriptLoader +{ +public: + spell_rog_honor_among_thieves() : SpellScriptLoader("spell_rog_honor_among_thieves") { } + + class spell_rog_honor_among_thieves_AuraScript : public AuraScript + { + PrepareAuraScript(spell_rog_honor_among_thieves_AuraScript); + + bool CheckProc(ProcEventInfo& /*eventInfo*/) + { + Unit* caster = GetCaster(); + if (!caster) + return false; + + if (!caster->GetSpellHistory()->HasCooldown(GetSpellInfo()->Effects[EFFECT_0].TriggerSpell)) + return true; + + return false; + } + + void HandleProc(AuraEffect const* aurEff, ProcEventInfo& /*eventInfo*/) + { + PreventDefaultAction(); + + Unit* caster = GetCaster(); + if (!caster) + return; + + Unit* target = GetTarget(); + target->CastSpell(target, GetSpellInfo()->Effects[EFFECT_0].TriggerSpell, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD), nullptr, aurEff, caster->GetGUID()); + } + + void Register() override + { + DoCheckProc += AuraCheckProcFn(spell_rog_honor_among_thieves_AuraScript::CheckProc); + OnEffectProc += AuraEffectProcFn(spell_rog_honor_among_thieves_AuraScript::HandleProc, EFFECT_0, SPELL_AURA_PROC_TRIGGER_SPELL); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_rog_honor_among_thieves_AuraScript(); + } +}; + +// 52916 - Honor Among Thieves (Proc) +class spell_rog_honor_among_thieves_proc : public SpellScriptLoader +{ +public: + spell_rog_honor_among_thieves_proc() : SpellScriptLoader("spell_rog_honor_among_thieves_proc") { } + + class spell_rog_honor_among_thieves_proc_SpellScript : public SpellScript + { + PrepareSpellScript(spell_rog_honor_among_thieves_proc_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_HONOR_AMONG_THIEVES_PROC)) + return false; + + return true; + } + + void FilterTargets(std::list<WorldObject*>& targets) + { + targets.clear(); + + Unit* target = GetOriginalCaster(); + if (!target) + return; + + targets.push_back(target); + } + + void HandleBeforeHit() + { + Unit* target = GetHitUnit(); + if (!target) + return; + + /* + * The applied aura has a duration of 8 seconds + * This prevents new applications while its active + * Removing it on each new proc enables the application from different sources (different grouped players) + * and on new procs after the source cooldown is finished (1 second) + */ + if (target->HasAura(GetSpellInfo()->Id)) + target->RemoveAura(GetSpellInfo()->Id); + } + + void TriggerCooldown() + { + Unit* target = GetHitUnit(); + if (!target) + return; + + target->GetSpellHistory()->AddCooldown(GetSpellInfo()->Id, 0, std::chrono::seconds(1)); + } + + void Register() override + { + OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_rog_honor_among_thieves_proc_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_PARTY); + BeforeHit += SpellHitFn(spell_rog_honor_among_thieves_proc_SpellScript::HandleBeforeHit); + AfterHit += SpellHitFn(spell_rog_honor_among_thieves_proc_SpellScript::TriggerCooldown); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_rog_honor_among_thieves_proc_SpellScript(); + } + + class spell_rog_honor_among_thieves_proc_AuraScript : public AuraScript + { + PrepareAuraScript(spell_rog_honor_among_thieves_proc_AuraScript); + + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Player* player = GetTarget()->ToPlayer()) + if (Unit* spellTarget = ObjectAccessor::GetUnit(*player, player->GetTarget())) + player->CastSpell(spellTarget, SPELL_ROGUE_HONOR_AMONG_THIEVES_2, true); + } + + void Register() override + { + AfterEffectApply += AuraEffectApplyFn(spell_rog_honor_among_thieves_proc_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const override + { + return new spell_rog_honor_among_thieves_proc_AuraScript(); + } +}; + void AddSC_rogue_spell_scripts() { new spell_rog_blade_flurry(); @@ -716,4 +856,6 @@ void AddSC_rogue_spell_scripts() new spell_rog_shiv(); new spell_rog_tricks_of_the_trade(); new spell_rog_tricks_of_the_trade_proc(); + new spell_rog_honor_among_thieves(); + new spell_rog_honor_among_thieves_proc(); } |