mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
[Bug Fix] PR 2032 would lock client on casting fail as written (#2038)
This commit is contained in:
parent
4e40d7eacc
commit
f814b5bec5
@ -180,22 +180,27 @@ bool Mob::CastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
|
||||
}
|
||||
|
||||
//Goal of Spells:UseSpellImpliedTargeting is to replicate the EQ2 feature where spells will 'pass through' invalid targets to target's target to try to find a valid target.
|
||||
if (RuleB(Spells,UseSpellImpliedTargeting) && IsClient()) {
|
||||
Mob* spell_target = entity_list.GetMobID(target_id);
|
||||
if (spell_target && spell_target->GetTarget()) {
|
||||
// If either this is beneficial and the target is not a player or player's pet or vis versa
|
||||
if ((IsBeneficialSpell(spell_id) && (!(spell_target->IsClient() || (spell_target->HasOwner() && spell_target->GetOwner()->IsClient()))))
|
||||
|| (IsDetrimentalSpell(spell_id) && (spell_target->IsClient() || (spell_target->HasOwner() && spell_target->GetOwner()->IsClient())))) {
|
||||
//Check if the target's target is a valid target; we can use DoCastingChecksOnTarget() here because we can let it handle the failure as vanilla would
|
||||
if (DoCastingChecksOnTarget(true, spell_id, spell_target->GetTarget())) {
|
||||
target_id = spell_target->GetTarget()->GetID();
|
||||
} else {
|
||||
//Just return false here because we are going to fail the next check block anyway if we reach this point.
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (RuleB(Spells,UseSpellImpliedTargeting) && IsClient()) {
|
||||
Mob* spell_target = entity_list.GetMobID(target_id);
|
||||
if (spell_target) {
|
||||
Mob* targets_target = spell_target->GetTarget();
|
||||
if (targets_target) {
|
||||
// If either this is beneficial and the target is not a player or player's pet or vis versa
|
||||
if ((IsBeneficialSpell(spell_id) && (!(spell_target->IsClient() || (spell_target->HasOwner() && spell_target->GetOwner()->IsClient()))))
|
||||
|| (IsDetrimentalSpell(spell_id) && (spell_target->IsClient() || (spell_target->HasOwner() && spell_target->GetOwner()->IsClient())))) {
|
||||
//Check if the target's target is a valid target; we can use DoCastingChecksOnTarget() here because we can let it handle the failure as vanilla would
|
||||
if (DoCastingChecksOnTarget(true, spell_id, targets_target)) {
|
||||
target_id = targets_target->GetID();
|
||||
}
|
||||
else {
|
||||
//Just return false here because we are going to fail the next check block anyway if we reach this point.
|
||||
StopCastSpell(spell_id, send_spellbar_enable);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!DoCastingChecksOnCaster(spell_id, slot) ||
|
||||
!DoCastingChecksZoneRestrictions(true, spell_id) ||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user