diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Handlers/GuildHandler.cpp | 5 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_mage.cpp | 70 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_paladin.cpp | 40 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_rogue.cpp | 53 |
5 files changed, 163 insertions, 7 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 170582755b3..ee9b63eb364 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 } diff --git a/src/server/game/Handlers/GuildHandler.cpp b/src/server/game/Handlers/GuildHandler.cpp index 22f8513870c..8a2f9d9d39a 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); diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 1d94cb6caf8..da020d944e8 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 2a3fcd88778..3faa4cebe23 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 39f23fc0516..ee0dd44f008 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(); |