aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2016-10-05 01:40:00 -0300
committerjoschiwald <joschiwald.trinity@gmail.com>2017-08-13 13:04:07 +0200
commit2b8af950da11c83ba9c48c4e741d709c3531e949 (patch)
tree0b7d4e2d2eb3ff9a50561f949796a04ce89ff548
parented6cf717c8ffafe9bf14298d3582c171008c8b49 (diff)
Core/Scripts: add a workaround for Will of the Forsaken shared cooldown
Closes #7151 (cherry picked from commit d482b0e368797aecd71c0c2cce4be89ead8c546f) # Conflicts: # src/server/scripts/Spells/spell_generic.cpp
-rw-r--r--sql/updates/world/master/2017_08_13_01_world_2016_10_05_03_world.sql6
-rw-r--r--src/server/scripts/Spells/spell_generic.cpp42
2 files changed, 34 insertions, 14 deletions
diff --git a/sql/updates/world/master/2017_08_13_01_world_2016_10_05_03_world.sql b/sql/updates/world/master/2017_08_13_01_world_2016_10_05_03_world.sql
new file mode 100644
index 00000000000..41f582280f8
--- /dev/null
+++ b/sql/updates/world/master/2017_08_13_01_world_2016_10_05_03_world.sql
@@ -0,0 +1,6 @@
+DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (7744, 42292, 59752);
+DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_pvp_trinket_wotf_shared_cd','spell_wotf_shared_cd','spell_pvp_trinket_shared_cd');
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(7744, 'spell_wotf_shared_cd'),
+(42292, 'spell_pvp_trinket_shared_cd'),
+(59752, 'spell_pvp_trinket_shared_cd');
diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp
index 25e1ce45c75..9e1f4d2dd87 100644
--- a/src/server/scripts/Spells/spell_generic.cpp
+++ b/src/server/scripts/Spells/spell_generic.cpp
@@ -3363,38 +3363,51 @@ class spell_gen_tournament_pennant : public SpellScriptLoader
}
};
-
-
enum PvPTrinketTriggeredSpells
{
SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER = 72752,
SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF = 72757
};
+template <uint32 TriggeredSpellId>
class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader
{
public:
- spell_pvp_trinket_wotf_shared_cd() : SpellScriptLoader("spell_pvp_trinket_wotf_shared_cd") { }
+ spell_pvp_trinket_wotf_shared_cd(char const* ScriptName) : SpellScriptLoader(ScriptName) { }
+ template <uint32 Triggered>
class spell_pvp_trinket_wotf_shared_cd_SpellScript : public SpellScript
{
PrepareSpellScript(spell_pvp_trinket_wotf_shared_cd_SpellScript);
- bool Load() override
- {
- return GetCaster()->GetTypeId() == TYPEID_PLAYER;
- }
-
bool Validate(SpellInfo const* /*spellInfo*/) override
{
- return ValidateSpellInfo({ SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER, SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF });
+ return ValidateSpellInfo({ Triggered });
}
void HandleScript()
{
- // This is only needed because spells cast from spell_linked_spell are triggered by default
- // Spell::SendSpellCooldown() skips all spells with TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD
- GetCaster()->GetSpellHistory()->StartCooldown(GetSpellInfo(), 0, GetSpell());
+ /*
+ * @workaround: PendingCast flag normally means 'triggered' spell, however
+ * if the spell is cast triggered, the core won't send SMSG_SPELL_GO packet
+ * so client never registers the cooldown (see Spell::IsNeedSendToClient)
+ *
+ * ServerToClient: SMSG_SPELL_GO (0x0132) Length: 42 ConnIdx: 0 Time: 07/19/2010 02:32:35.000 Number: 362675
+ * Caster GUID: Full: Player
+ * Caster Unit GUID: Full: Player
+ * Cast Count: 0
+ * Spell ID: 72752 (72752)
+ * Cast Flags: PendingCast, Unknown3, Unknown7 (265)
+ * Time: 3901468825
+ * Hit Count: 1
+ * [0] Hit GUID: Player
+ * Miss Count: 0
+ * Target Flags: Unit (2)
+ * Target GUID: 0x0
+ */
+
+ // Spell flags need further research, until then just cast not triggered
+ GetCaster()->CastSpell((Unit*)nullptr, Triggered, false);
}
void Register() override
@@ -3405,7 +3418,7 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader
SpellScript* GetSpellScript() const override
{
- return new spell_pvp_trinket_wotf_shared_cd_SpellScript();
+ return new spell_pvp_trinket_wotf_shared_cd_SpellScript<TriggeredSpellId>();
}
};
@@ -4610,7 +4623,8 @@ void AddSC_generic_spell_scripts()
new spell_gen_throw_shield();
new spell_gen_tournament_duel();
new spell_gen_tournament_pennant();
- new spell_pvp_trinket_wotf_shared_cd();
+ new spell_pvp_trinket_wotf_shared_cd<SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER>("spell_pvp_trinket_shared_cd");
+ new spell_pvp_trinket_wotf_shared_cd<SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF>("spell_wotf_shared_cd");
new spell_gen_turkey_marker();
new spell_gen_upper_deck_create_foam_sword();
new spell_gen_vampiric_touch();