From 4f176795ff7007c5cf010f70f36b8de30659017d Mon Sep 17 00:00:00 2001 From: robinsch Date: Sat, 7 May 2016 21:40:19 +0100 Subject: [PATCH] backport nosttbc 404f4b1 fixes for spirit of redemption https://github.com/NostalriusTBC/Core/pull/5 --- src/game/Object/Player.cpp | 4 ++++ src/game/WorldHandlers/Spell.cpp | 5 +++++ src/game/WorldHandlers/SpellAuras.cpp | 8 +++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/game/Object/Player.cpp b/src/game/Object/Player.cpp index 878d138a..63a56a83 100644 --- a/src/game/Object/Player.cpp +++ b/src/game/Object/Player.cpp @@ -9424,6 +9424,10 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool if (IsNonMeleeSpellCasted(false)) { return EQUIP_ERR_CANT_DO_RIGHT_NOW; } + + // prevent equip item in Spirit of Redemption (Aura: 27827) + if (HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) + { return EQUIP_ERR_CANT_DO_RIGHT_NOW; } } uint8 eslot = FindEquipSlot(pProto, slot, swap); diff --git a/src/game/WorldHandlers/Spell.cpp b/src/game/WorldHandlers/Spell.cpp index c370f7a8..dfadfa8a 100644 --- a/src/game/WorldHandlers/Spell.cpp +++ b/src/game/WorldHandlers/Spell.cpp @@ -4462,6 +4462,11 @@ SpellCastResult Spell::CheckCast(bool strict) // check if target is in combat if (non_caster_target && m_spellInfo->HasAttribute(SPELL_ATTR_EX_NOT_IN_COMBAT_TARGET) && target->IsInCombat()) { return SPELL_FAILED_TARGET_AFFECTING_COMBAT; } + + // check if target is affected by Spirit of Redemption (Aura: 27827) + if (target->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) + { return SPELL_FAILED_BAD_TARGETS; } + } // zone check uint32 zone, area; diff --git a/src/game/WorldHandlers/SpellAuras.cpp b/src/game/WorldHandlers/SpellAuras.cpp index 1ec8971a..d8623d51 100644 --- a/src/game/WorldHandlers/SpellAuras.cpp +++ b/src/game/WorldHandlers/SpellAuras.cpp @@ -4249,7 +4249,13 @@ void Aura::HandleSpiritOfRedemption(bool apply, bool Real) { target->SetStandState(UNIT_STAND_STATE_STAND); } } - target->SetHealth(1); + // interrupt casting when entering Spirit of Redemption + if (target->IsNonMeleeSpellCasted(false)) + { target->InterruptNonMeleeSpells(false); } + + // set health and mana to maximum + target->SetHealth(target->GetMaxHealth()); + target->SetPower(POWER_MANA, target->GetMaxPower(POWER_MANA)); } // die at aura end else