mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 21:01:29 +00:00
[Bots] Fix pets causing aggro (#4677)
- Adds the rule `Aggro, AggroBotPets`
This commit is contained in:
parent
b0c951bd6e
commit
3ba113a91d
@ -713,6 +713,7 @@ RULE_INT(Aggro, BardAggroCap, 40, "per song bard aggro cap.")
|
|||||||
RULE_INT(Aggro, InitialAggroBonus, 100, "Initial Aggro Bonus, Default: 100")
|
RULE_INT(Aggro, InitialAggroBonus, 100, "Initial Aggro Bonus, Default: 100")
|
||||||
RULE_INT(Aggro, InitialPetAggroBonus, 100, "Initial Pet Aggro Bonus, Default 100")
|
RULE_INT(Aggro, InitialPetAggroBonus, 100, "Initial Pet Aggro Bonus, Default 100")
|
||||||
RULE_STRING(Aggro, ExcludedFleeAllyFactionIDs, "0|5013|5014|5023|5032", "Common Faction IDs that are excluded from faction checks in EntityList::FleeAllyCount")
|
RULE_STRING(Aggro, ExcludedFleeAllyFactionIDs, "0|5013|5014|5023|5032", "Common Faction IDs that are excluded from faction checks in EntityList::FleeAllyCount")
|
||||||
|
RULE_BOOL(Aggro, AggroBotPets, false, "If enabled, NPCs will aggro bot pets")
|
||||||
RULE_CATEGORY_END()
|
RULE_CATEGORY_END()
|
||||||
|
|
||||||
RULE_CATEGORY(TaskSystem)
|
RULE_CATEGORY(TaskSystem)
|
||||||
|
|||||||
@ -405,17 +405,12 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mob *pet_owner = mob->GetOwner();
|
Mob* pet_owner = mob->GetOwner();
|
||||||
if (
|
|
||||||
pet_owner &&
|
if (pet_owner && pet_owner->IsOfClientBot()) {
|
||||||
pet_owner->IsClient() &&
|
if (mob->IsPetAggroExempt(pet_owner)) {
|
||||||
(
|
return false;
|
||||||
!RuleB(Aggro, AggroPlayerPets) ||
|
}
|
||||||
pet_owner->CastToClient()->GetGM() ||
|
|
||||||
mob->GetSpecialAbility(SpecialAbility::AggroImmunity)
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsNPC() && mob->IsNPC() && mob->GetSpecialAbility(SpecialAbility::NPCAggroImmunity)) {
|
if (IsNPC() && mob->IsNPC() && mob->GetSpecialAbility(SpecialAbility::NPCAggroImmunity)) {
|
||||||
@ -582,6 +577,34 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Mob::IsPetAggroExempt(Mob* pet_owner) {
|
||||||
|
if (!pet_owner) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool exempt_client_pet = pet_owner->IsClient() && !RuleB(Aggro, AggroPlayerPets);
|
||||||
|
bool exempt_bot_pet = pet_owner->IsBot() && !RuleB(Aggro, AggroBotPets);
|
||||||
|
|
||||||
|
if (exempt_client_pet || exempt_bot_pet) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Mob* ultimate_owner = GetUltimateOwner();
|
||||||
|
Client* client_owner = (ultimate_owner && ultimate_owner->IsClient())
|
||||||
|
? ultimate_owner->CastToClient()
|
||||||
|
: nullptr;
|
||||||
|
|
||||||
|
if (client_owner && client_owner->GetGM()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetSpecialAbility(SpecialAbility::AggroImmunity)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
int EntityList::FleeAllyCount(Mob* attacker, Mob* skipped)
|
int EntityList::FleeAllyCount(Mob* attacker, Mob* skipped)
|
||||||
{
|
{
|
||||||
// Return a list of how many NPCs of the same faction or race are within aggro range of the given exclude Mob.
|
// Return a list of how many NPCs of the same faction or race are within aggro range of the given exclude Mob.
|
||||||
|
|||||||
@ -1289,6 +1289,7 @@ public:
|
|||||||
void SetLooting(uint16 val) { entity_id_being_looted = val; }
|
void SetLooting(uint16 val) { entity_id_being_looted = val; }
|
||||||
|
|
||||||
bool CheckWillAggro(Mob *mob);
|
bool CheckWillAggro(Mob *mob);
|
||||||
|
bool IsPetAggroExempt(Mob *pet_owner);
|
||||||
|
|
||||||
void InstillDoubt(Mob *who);
|
void InstillDoubt(Mob *who);
|
||||||
bool Charmed() const { return type_of_pet == petCharmed; }
|
bool Charmed() const { return type_of_pet == petCharmed; }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user