From c33e366eff37fd7663a6d1fc1fc117c57bcce086 Mon Sep 17 00:00:00 2001 From: Warpten Date: Sat, 1 Dec 2012 13:59:40 +0100 Subject: [PATCH 1/3] Core/Players: Fixed "Your talents have been reset" at login. Reason behind this is that when you are not specced your talents field in database is "0 0". However, zero is an invalid talent tree ID. As such, ignore it. --- src/server/game/Entities/Player/Player.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 170582755b..ee9b63eb36 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -17337,7 +17337,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) uint32 talentTree = atol(talentTrees[i]); if (sTalentTabStore.LookupEntry(talentTree)) SetPrimaryTalentTree(i, talentTree); - else if (i == GetActiveSpec()) + else if (i == GetActiveSpec() && talentTree != 0) SetAtLoginFlag(AT_LOGIN_RESET_TALENTS); // invalid tree, reset talents } From fc6c93d0c4dc15f06c60619fb96a395589d8e67d Mon Sep 17 00:00:00 2001 From: Warpten Date: Sat, 1 Dec 2012 14:00:08 +0100 Subject: [PATCH 2/3] Core/Guilds: Fixed one mistake in CMSG_GUILD_SET_GUILD_MASTER's handling, thanks to @Shauren for pointing it out. --- src/server/game/Handlers/GuildHandler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp index 22f8513870..8a2f9d9d39 100644 --- a/src/server/game/Handlers/GuildHandler.cpp +++ b/src/server/game/Handlers/GuildHandler.cpp @@ -816,8 +816,9 @@ void WorldSession::HandleGuildNewsUpdateStickyOpcode(WorldPacket& recvPacket) void WorldSession::HandleGuildSetGuildMaster(WorldPacket& recvPacket) { - uint8 nameLength; - recvPacket >> nameLength; + uint8 nameLength = recvPacket.ReadBits(7); + // This is related to guild master inactivity. + /*bool isDethrone = */recvPacket.ReadBit(); std::string playerName = recvPacket.ReadString(nameLength); if (Guild* guild = GetPlayer()->GetGuild()) guild->HandleSetNewGuildMaster(this, playerName); From 4d111c10f0389b0fc762e58df0fb7003fb4ec11e Mon Sep 17 00:00:00 2001 From: Warpten Date: Sat, 1 Dec 2012 14:58:56 +0100 Subject: [PATCH 3/3] Scripts/Spells: Fixed Rogue's Recuperate, Mage's Conjure Refreshment and Paladin's Sacred Shield. Also fixed SQL file naming. --- ...012_11_25_02_world_spell_script_names.sql} | 0 ...2012_12_01_00_world_spell_script_names.sql | 16 +++++ src/server/scripts/Spells/spell_mage.cpp | 70 +++++++++++++++++++ src/server/scripts/Spells/spell_paladin.cpp | 40 ++++++++++- src/server/scripts/Spells/spell_rogue.cpp | 53 +++++++++++++- 5 files changed, 175 insertions(+), 4 deletions(-) rename sql/updates/world/{2012_11_25_world_spell_script_names.sql => 2012_11_25_02_world_spell_script_names.sql} (100%) create mode 100644 sql/updates/world/2012_12_01_00_world_spell_script_names.sql diff --git a/sql/updates/world/2012_11_25_world_spell_script_names.sql b/sql/updates/world/2012_11_25_02_world_spell_script_names.sql similarity index 100% rename from sql/updates/world/2012_11_25_world_spell_script_names.sql rename to sql/updates/world/2012_11_25_02_world_spell_script_names.sql diff --git a/sql/updates/world/2012_12_01_00_world_spell_script_names.sql b/sql/updates/world/2012_12_01_00_world_spell_script_names.sql new file mode 100644 index 0000000000..bd13cb8ef9 --- /dev/null +++ b/sql/updates/world/2012_12_01_00_world_spell_script_names.sql @@ -0,0 +1,16 @@ +-- Conjure Refreshment +DELETE FROM `spell_script_names` WHERE `spell_id`=42955; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(42955, 'spell_mage_conjure_refreshment'); + +-- Sacred Shield +DELETE FROM spell_proc_event WHERE entry=85285; +INSERT INTO spell_proc_event (entry, Cooldown) VALUES(85285, 60); +DELETE FROM spell_script_names WHERE spell_id=85285; +INSERT INTO spell_script_names (spell_id, ScriptName) VALUES +(85285, 'spell_pal_sacred_shield'); + +-- Recuperate +DELETE FROM spell_script_names WHERE spell_id=73651; +INSERT INTO spell_script_names (spell_id, ScriptName) VALUES +(73651, "spell_rog_recuperate"); diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 1d94cb6caf..da020d944e 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -39,6 +39,7 @@ enum MageSpells SPELL_MAGE_SUMMON_WATER_ELEMENTAL_PERMANENT = 70908, SPELL_MAGE_SUMMON_WATER_ELEMENTAL_TEMPORARY = 70907, SPELL_MAGE_GLYPH_OF_BLAST_WAVE = 62126, + SPELL_MAGE_CONJURE_REFRESHMENT = 42955, }; class spell_mage_blast_wave : public SpellScriptLoader @@ -423,6 +424,75 @@ public: } }; +struct ConjureRefreshmentData +{ + uint32 minLevel; + uint32 maxLevel; + uint32 spellId; +}; + +uint8 const MAX_CONJURE_REFRESHMENT_SPELLS = 7; +const ConjureRefreshmentData _conjureData[MAX_CONJURE_REFRESHMENT_SPELLS] = +{ + { 33, 43, 92739 }, + { 44, 53, 92799 }, + { 54, 63, 92802 }, + { 64, 73, 92805 }, + { 74, 79, 74625 }, + { 80, 84, 92822 }, + { 85, 85, 92727 } +}; + +class spell_mage_conjure_refreshment : public SpellScriptLoader +{ + public: + spell_mage_conjure_refreshment() : SpellScriptLoader("spell_mage_conjure_refreshment") { } + + class spell_mage_conjure_refreshment_SpellScript : public SpellScript + { + PrepareSpellScript(spell_mage_conjure_refreshment_SpellScript); + + bool Validate(SpellInfo const* /*spellEntry*/) + { + for (uint8 i = 0; i < MAX_CONJURE_REFRESHMENT_SPELLS; ++i) + if (!sSpellMgr->GetSpellInfo(_conjureData[i].spellId)) + return false; + return true; + } + + bool Load() + { + if (GetCaster()->GetTypeId() != TYPEID_PLAYER) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + uint8 level = GetHitUnit()->getLevel(); + for (uint8 i = 0; i < MAX_CONJURE_REFRESHMENT_SPELLS; ++i) + { + ConjureRefreshmentData const& spellData = _conjureData[i]; + if (level < spellData.minLevel || level > spellData.maxLevel) + continue; + GetHitUnit()->CastSpell(GetHitUnit(), spellData.spellId); + break; + } + } + + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_mage_conjure_refreshment_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_mage_conjure_refreshment_SpellScript(); + } +}; + void AddSC_mage_spell_scripts() { new spell_mage_blast_wave(); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 2a3fcd8877..3faa4cebe2 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -668,19 +668,53 @@ class spell_pal_divine_sacrifice : public SpellScriptLoader } }; +class spell_pal_sacred_shield : public SpellScriptLoader +{ + public: + spell_pal_sacred_shield() : SpellScriptLoader("spell_pal_sacred_shield") { } + + class spell_pal_sacred_shield_SpellScript : public SpellScript + { + PrepareSpellScript(spell_pal_sacred_shield_SpellScript); + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (caster->GetTypeId() != TYPEID_PLAYER) + return SPELL_FAILED_DONT_REPORT; + + if (!caster->HealthBelowPct(30)) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_pal_sacred_shield_SpellScript::CheckCast); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_pal_sacred_shield_SpellScript(); + } +}; + void AddSC_paladin_spell_scripts() { //new spell_pal_ardent_defender(); new spell_pal_blessing_of_faith(); new spell_pal_blessing_of_sanctuary(); + new spell_pal_divine_sacrifice(); + new spell_pal_exorcism_and_holy_wrath_damage(); new spell_pal_guarded_by_the_light(); + new spell_pal_hand_of_sacrifice(); new spell_pal_holy_shock(); new spell_pal_judgement_of_command(); new spell_pal_divine_storm(); new spell_pal_divine_storm_dummy(); new spell_pal_lay_on_hands(); new spell_pal_righteous_defense(); - new spell_pal_exorcism_and_holy_wrath_damage(); - new spell_pal_hand_of_sacrifice(); - new spell_pal_divine_sacrifice(); + new spell_pal_sacred_shield(); } diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index 39f23fc051..ee0dd44f00 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -26,12 +26,14 @@ #include "SpellScript.h" #include "SpellAuraEffects.h" -enum RogueSpells +enum RogueData { ROGUE_SPELL_SHIV_TRIGGERED = 5940, ROGUE_SPELL_GLYPH_OF_PREPARATION = 56819, ROGUE_SPELL_PREY_ON_THE_WEAK = 58670, ROGUE_SPELL_CHEAT_DEATH_COOLDOWN = 31231, + + ROGUE_ICON_IMPROVED_RECUPERATE = 4819 }; // Cheat Death @@ -418,12 +420,61 @@ class spell_rog_shadowstep : public SpellScriptLoader } }; +class spell_rog_recuperate : public SpellScriptLoader +{ + public: + spell_rog_recuperate() : SpellScriptLoader("spell_rog_recuperate") { } + + class spell_rog_recuperate_AuraScript : public AuraScript + { + PrepareAuraScript(spell_rog_recuperate_AuraScript); + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void OnPeriodic(AuraEffect const* /*aurEff*/) + { + if (Unit* caster = GetCaster()) + if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_0)) + effect->RecalculateAmount(caster); + } + + void CalculateBonus(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) + { + canBeRecalculated = false; + if (Unit* caster = GetCaster()) + { + int32 baseAmount = GetSpellInfo()->Effects[EFFECT_0].CalcValue(caster) * 1000; + // Improved Recuperate + if (AuraEffect const* auraEffect = caster->GetDummyAuraEffect(SPELLFAMILY_ROGUE, ROGUE_ICON_IMPROVED_RECUPERATE, EFFECT_0)) + baseAmount += auraEffect->GetAmount(); + + amount = CalculatePct(caster->GetMaxHealth(), float(baseAmount) / 1000.0f); + } + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_rog_recuperate_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_recuperate_AuraScript::CalculateBonus, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_rog_recuperate_AuraScript(); + } +}; + void AddSC_rogue_spell_scripts() { new spell_rog_cheat_death(); new spell_rog_nerves_of_steel(); new spell_rog_preparation(); new spell_rog_prey_on_the_weak(); + new spell_rog_recuperate(); new spell_rog_shiv(); new spell_rog_deadly_poison(); new spell_rog_shadowstep();