mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-09 22:20:24 +00:00
[PVP] Pvp guard assist code. (Guards will assist in PvP based on faction) (#1367)
* Added Guard Assist Code * Added PvP Rule and Detrimental Spell Check * Added IsGuard() Method * Change from uint to bool * Added a faction check to IsGuard() * Simplified Guard Checks, reduced costs * Added IsNPC check to guard check * simplified pet check * Removed Magic numbers * Formatting Fix * Code fixes * Fixed constants Co-authored-by: ProducerZekServer <go@away.com>
This commit is contained in:
@@ -2044,6 +2044,25 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui
|
||||
if(!IsValidSpell(spell_id))
|
||||
return false;
|
||||
|
||||
//Guard Assist Code
|
||||
if (RuleB(Character, PVPEnableGuardFactionAssist) && IsDetrimentalSpell(spell_id) && spell_target != this) {
|
||||
if (IsClient() || (HasOwner() && GetOwner()->IsClient())) {
|
||||
auto& mob_list = entity_list.GetCloseMobList(spell_target);
|
||||
for (auto& e : mob_list) {
|
||||
auto mob = e.second;
|
||||
if (mob->IsNPC() && mob->CastToNPC()->IsGuard()) {
|
||||
float distance = Distance(spell_target->GetPosition(), mob->GetPosition());
|
||||
if ((mob->CheckLosFN(spell_target) || mob->CheckLosFN(this)) && distance <= 70) {
|
||||
auto petorowner = GetOwnerOrSelf();
|
||||
if (spell_target->GetReverseFactionCon(mob) <= petorowner->GetReverseFactionCon(mob)) {
|
||||
mob->AddToHateList(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( spells[spell_id].zonetype == 1 && !zone->CanCastOutdoor()){
|
||||
if(IsClient()){
|
||||
if(!CastToClient()->GetGM()){
|
||||
|
||||
Reference in New Issue
Block a user