Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

Commit

Permalink
[Core/Mechanics] Don't allow players to ress allies if encounter is i…
Browse files Browse the repository at this point in the history
…n progress in instance (Except if they use Rebirth)
  • Loading branch information
dimiandre committed Aug 2, 2013
1 parent dcb4cf2 commit 4ad961e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
10 changes: 9 additions & 1 deletion src/server/game/Spells/Spell.cpp
Expand Up @@ -4448,8 +4448,16 @@ void Spell::SendChannelStart(uint32 duration)
m_caster->SetUInt32Value(UNIT_CHANNEL_SPELL, m_spellInfo->Id);
}

void Spell::SendResurrectRequest(Player* target)
void Spell::SendResurrectRequest(Player* target, bool forced)
{
// Check if instance is in combat..
if (InstanceScript* instance = target->GetInstanceScript())
{
// If encounter is in progress and ress is not forced.. don't ress that player
if (instance->IsEncounterInProgress() && !forced)
return;
}

// get ressurector name for creature resurrections, otherwise packet will be not accepted
// for player resurrections the name is looked up by guid
std::string const sentName(m_caster->GetTypeId() == TYPEID_PLAYER
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Spells/Spell.h
Expand Up @@ -440,7 +440,7 @@ class Spell
void SendInterrupted(uint8 result);
void SendChannelUpdate(uint32 time);
void SendChannelStart(uint32 duration);
void SendResurrectRequest(Player* target);
void SendResurrectRequest(Player* target, bool forced = false);

void HandleHolyPower(Player* caster);
void HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOTarget, uint32 i, SpellEffectHandleMode mode);
Expand Down
9 changes: 7 additions & 2 deletions src/server/game/Spells/SpellEffects.cpp
Expand Up @@ -5214,10 +5214,15 @@ void Spell::EffectResurrect(SpellEffIndex effIndex)
uint32 health = target->CountPctFromMaxHealth(damage);
uint32 mana = CalculatePct(target->GetMaxPower(POWER_MANA), damage);

ExecuteLogEffectResurrect(effIndex, target);
bool forced = false;

// Force resurrection with Rebirth spell
if (GetSpellInfo())
forced = GetSpellInfo()->Id == 20484;

ExecuteLogEffectResurrect(effIndex, target);
target->SetResurrectRequestData(m_caster, health, mana, 0);
SendResurrectRequest(target);
SendResurrectRequest(target, forced);
}

void Spell::EffectAddExtraAttacks(SpellEffIndex effIndex)
Expand Down

0 comments on commit 4ad961e

Please sign in to comment.