mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 22:37:02 +00:00
[9035] Attempt make more fast and less hackish spell target checks
* Enable server side recheck clear negative to friend or positive to enemy casts that already checks at client side * Use more fast way check in similar cases for non-players, and fall back to old way in unclear (for while at least) Please report if some spell stop propertly casted at friends/enemies.
This commit is contained in:
parent
27e7190301
commit
9e18fc5745
4 changed files with 58 additions and 7 deletions
|
|
@ -4079,21 +4079,35 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: this check can be applied and for player to prevent cheating when IsPositiveSpell will return always correct result.
|
||||
// check target for pet/charmed casts (not self targeted), self targeted cast used for area effects and etc
|
||||
if(non_caster_target && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID())
|
||||
if(non_caster_target)
|
||||
{
|
||||
// check correctness positive/negative cast target (pet cast real check and cheating check)
|
||||
if(IsPositiveSpell(m_spellInfo->Id))
|
||||
// simple cases
|
||||
if (IsExplicitPositiveTarget(m_spellInfo->EffectImplicitTargetA[0]))
|
||||
{
|
||||
if(m_caster->IsHostileTo(target))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
}
|
||||
else
|
||||
else if (IsExplicitNegativeTarget(m_spellInfo->EffectImplicitTargetA[0]))
|
||||
{
|
||||
if(m_caster->IsFriendlyTo(target))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
}
|
||||
// TODO: this check can be applied and for player to prevent cheating when IsPositiveSpell will return always correct result.
|
||||
// check target for pet/charmed casts (not self targeted), self targeted cast used for area effects and etc
|
||||
else if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->GetCharmerOrOwnerGUID())
|
||||
{
|
||||
// check correctness positive/negative cast target (pet cast real check and cheating check)
|
||||
if(IsPositiveSpell(m_spellInfo->Id))
|
||||
{
|
||||
if(m_caster->IsHostileTo(target))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(m_caster->IsFriendlyTo(target))
|
||||
return SPELL_FAILED_BAD_TARGETS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(IsPositiveSpell(m_spellInfo->Id))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue