Skip to content

Commit

Permalink
Priest: Mind Sear is working as it should be, triggered spell should …
Browse files Browse the repository at this point in the history
…get Aura's Caster as m_caster and m_DestX/Y/Z as Aura target's XYZ.

Signed-off-by: Neo_mat <neomat.github@gmail.com>
  • Loading branch information
neo-mat committed Jan 25, 2012
1 parent 3c38247 commit 86bb53f
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/arcemu-world/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,14 @@ enum PlayerFlags
PLAYER_FLAG_PVP = 0x40000,
};

// used in PLAYER_FIELD_BYTES2 values
enum PlayerFieldByte2Flags
{
PLAYER_FIELD_BYTE2_NONE = 0x00,
PLAYER_FIELD_BYTE2_STEALTH = 0x20,
PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW = 0x40,
};

enum CharterTypes
{
CHARTER_TYPE_GUILD = 0,
Expand Down
1 change: 1 addition & 0 deletions src/arcemu-world/Spell.h
Original file line number Diff line number Diff line change
Expand Up @@ -2219,6 +2219,7 @@ class SERVER_DECL Spell : public EventableObject
TargetsList m_targetUnits[3];
void SafeAddTarget(TargetsList* tgt, uint64 guid);

void RemoveTarget(uint32 i, Object* obj);
void SafeAddMissedTarget(uint64 guid);
void SafeAddModeratedTarget(uint64 guid, uint16 type);

Expand Down
21 changes: 19 additions & 2 deletions src/arcemu-world/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2713,7 +2713,7 @@ void Aura::SpellAuraModStealth(bool apply)

m_target->SetFlag(UNIT_FIELD_BYTES_1, 0x020000);
if(m_target->IsPlayer())
m_target->SetFlag(PLAYER_FIELD_BYTES2, 0x2000);
m_target->SetByteFlag(PLAYER_FIELD_BYTES2, 3, PLAYER_FIELD_BYTE2_STEALTH);

m_target->RemoveAurasByInterruptFlag(AURA_INTERRUPT_ON_STEALTH | AURA_INTERRUPT_ON_INVINCIBLE);
m_target->m_stealthLevel += mod->m_amount;
Expand Down Expand Up @@ -2796,7 +2796,7 @@ void Aura::SpellAuraModStealth(bool apply)

if(p_target != NULL)
{
p_target->RemoveFlag(PLAYER_FIELD_BYTES2, 0x2000);
p_target->RemoveByteFlag(PLAYER_FIELD_BYTES2, 3, PLAYER_FIELD_BYTE2_STEALTH);
p_target->SendSpellCooldownEvent(m_spellProto->Id);

if(p_target->m_outStealthDamageBonusPeriod && p_target->m_outStealthDamageBonusPct)
Expand Down Expand Up @@ -3103,6 +3103,22 @@ void Aura::SpellAuraPeriodicTriggerSpell(bool apply)

void Aura::EventPeriodicTriggerSpell(SpellEntry* spellInfo, bool overridevalues, int32 overridevalue)
{
Unit* u_caster = GetUnitCaster();

if(spellInfo->NameHash == SPELL_HASH_MIND_SEAR)
{
Spell *spell = sSpellFactoryMgr.NewSpell(u_caster, spellInfo, true, this);
SpellCastTargets targets;
//Mind Sear hackz
targets.m_unitTarget = m_target->GetGUID();
targets.m_destX = m_target->GetPositionX();
targets.m_destY = m_target->GetPositionY();
targets.m_destZ = m_target->GetPositionZ();
spell->prepare(&targets);
return;
}
else
{
Spell* spell = sSpellFactoryMgr.NewSpell(m_target, spellInfo, true, this);
if(overridevalues)
{
Expand All @@ -3113,6 +3129,7 @@ void Aura::EventPeriodicTriggerSpell(SpellEntry* spellInfo, bool overridevalues,
SpellCastTargets targets;
spell->GenerateTargets(&targets);
spell->prepare(&targets);
}
}

void Aura::SpellAuraPeriodicEnergize(bool apply)
Expand Down
18 changes: 18 additions & 0 deletions src/arcemu-world/SpellTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,13 @@ void Spell::FillTargetMap(uint32 i)

if(TargetType & SPELL_TARGET_OBJECT_SCRIPTED)
AddScriptedOrSpellFocusTargets(i, TargetType, GetRadius(i), m_spellInfo->MaxTargets);

//Mind Sear hackz
if(GetProto()->Id == 53022 || GetProto()->Id == 49821)
{
Object* target = m_caster->GetMapMgr()->_GetObject(m_targets.m_unitTarget);
RemoveTarget(i, target);
}
}

void Spell::AddScriptedOrSpellFocusTargets(uint32 i, uint32 TargetType, float r, uint32 maxtargets)
Expand Down Expand Up @@ -386,6 +393,17 @@ void Spell::AddAOETargets(uint32 i, uint32 TargetType, float r, uint32 maxtarget
}
}

void Spell::RemoveTarget(uint32 i, Object* obj)
{
TargetsList* t = &m_targetUnits[i];

if(obj == NULL || !obj->IsInWorld())
return;

t->erase(std::remove(t->begin(), t->end(), obj->GetGUID()), t->end());

}

bool Spell::AddTarget(uint32 i, uint32 TargetType, Object* obj)
{
TargetsList* t = &m_targetUnits[i];
Expand Down

0 comments on commit 86bb53f

Please sign in to comment.