mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +00:00
[Commands] Cleanup #aggro Command. (#1799)
- Cleanup messages and logic. - Cleanup constant names and references. - Cleanup aggro description methods.
This commit is contained in:
parent
04fda24c8e
commit
b9214bfdee
@ -20,31 +20,31 @@
|
||||
#include "races.h"
|
||||
#include "rulesys.h"
|
||||
|
||||
const char *FactionValueToString(FACTION_VALUE fv)
|
||||
const char *FactionValueToString(FACTION_VALUE faction_value)
|
||||
{
|
||||
switch (fv) {
|
||||
switch (faction_value) {
|
||||
case FACTION_ALLY:
|
||||
return ("Ally");
|
||||
return "Ally";
|
||||
case FACTION_WARMLY:
|
||||
return ("Warmly");
|
||||
return "Warmly";
|
||||
case FACTION_KINDLY:
|
||||
return ("Kindly");
|
||||
case FACTION_AMIABLE:
|
||||
return ("Amiable");
|
||||
case FACTION_INDIFFERENT:
|
||||
return ("Indifferent");
|
||||
case FACTION_APPREHENSIVE:
|
||||
return ("Apprehensive");
|
||||
case FACTION_DUBIOUS:
|
||||
return ("Dubious");
|
||||
case FACTION_THREATENLY:
|
||||
return ("Threatenly");
|
||||
return "Kindly";
|
||||
case FACTION_AMIABLY:
|
||||
return "Amiably";
|
||||
case FACTION_INDIFFERENTLY:
|
||||
return "Indifferently";
|
||||
case FACTION_APPREHENSIVELY:
|
||||
return "Apprehensively";
|
||||
case FACTION_DUBIOUSLY:
|
||||
return "Dubiously";
|
||||
case FACTION_THREATENINGLY:
|
||||
return "Threateningly";
|
||||
case FACTION_SCOWLS:
|
||||
return ("Scowls, ready to attack.");
|
||||
return "Scowls";
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return ("Unknown Faction Con");
|
||||
return "Unknown";
|
||||
}
|
||||
|
||||
|
||||
@ -70,19 +70,19 @@ FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value)
|
||||
return FACTION_KINDLY;
|
||||
}
|
||||
if (character_value >= RuleI(Faction, AmiablyFactionMinimum)) {
|
||||
return FACTION_AMIABLE;
|
||||
return FACTION_AMIABLY;
|
||||
}
|
||||
if (character_value >= RuleI(Faction, IndifferentlyFactionMinimum)) {
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
}
|
||||
if (character_value >= RuleI(Faction, ApprehensivelyFactionMinimum)) {
|
||||
return FACTION_APPREHENSIVE;
|
||||
return FACTION_APPREHENSIVELY;
|
||||
}
|
||||
if (character_value >= RuleI(Faction, DubiouslyFactionMinimum)) {
|
||||
return FACTION_DUBIOUS;
|
||||
return FACTION_DUBIOUSLY;
|
||||
}
|
||||
if (character_value >= RuleI(Faction, ThreateninglyFactionMinimum)) {
|
||||
return FACTION_THREATENLY;
|
||||
return FACTION_THREATENINGLY;
|
||||
}
|
||||
return FACTION_SCOWLS;
|
||||
}
|
||||
|
||||
@ -27,13 +27,13 @@ enum FACTION_VALUE {
|
||||
FACTION_ALLY = 1,
|
||||
FACTION_WARMLY = 2,
|
||||
FACTION_KINDLY = 3,
|
||||
FACTION_AMIABLE = 4,
|
||||
FACTION_AMIABLY = 4,
|
||||
|
||||
FACTION_INDIFFERENT = 5,
|
||||
FACTION_INDIFFERENTLY = 5,
|
||||
|
||||
FACTION_APPREHENSIVE = 6,
|
||||
FACTION_DUBIOUS = 7,
|
||||
FACTION_THREATENLY = 8,
|
||||
FACTION_APPREHENSIVELY = 6,
|
||||
FACTION_DUBIOUSLY = 7,
|
||||
FACTION_THREATENINGLY = 8,
|
||||
FACTION_SCOWLS = 9
|
||||
};
|
||||
|
||||
@ -75,6 +75,6 @@ struct NPCFaction
|
||||
uint8 temp;
|
||||
};
|
||||
|
||||
const char *FactionValueToString(FACTION_VALUE fv);
|
||||
const char *FactionValueToString(FACTION_VALUE faction_value);
|
||||
FACTION_VALUE CalculateFaction(FactionMods* fm, int32 tmpCharacter_value);
|
||||
#endif
|
||||
|
||||
@ -204,7 +204,7 @@ enum { //some random constants
|
||||
#define MIN_LEVEL_ALCHEMY 25
|
||||
|
||||
//chance ratio that a
|
||||
#define THREATENLY_ARRGO_CHANCE 32 // 32/128 (25%) chance that a mob will arrgo on con Threatenly
|
||||
#define THREATENINGLY_AGGRO_CHANCE 32 // 32/128 (25%) chance that a mob will arrgo on con Threatenly
|
||||
|
||||
//max factions per npc faction list
|
||||
#define MAX_NPC_FACTIONS 20
|
||||
|
||||
612
zone/aggro.cpp
612
zone/aggro.cpp
@ -38,190 +38,359 @@ extern Zone* zone;
|
||||
//#define LOSDEBUG 6
|
||||
|
||||
void EntityList::DescribeAggro(Client *towho, NPC *from_who, float d, bool verbose) {
|
||||
float d2 = d*d;
|
||||
float distance_squared = (d * d);
|
||||
|
||||
towho->Message(Chat::White, "Describing aggro for %s", from_who->GetName());
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Describing aggro for {} ({}).",
|
||||
from_who->GetCleanName(),
|
||||
from_who->GetID()
|
||||
).c_str()
|
||||
);
|
||||
|
||||
bool engaged = from_who->IsEngaged();
|
||||
if(engaged) {
|
||||
bool is_engaged = from_who->IsEngaged();
|
||||
bool will_aggro_npcs = from_who->WillAggroNPCs();
|
||||
if (is_engaged) {
|
||||
Mob *top = from_who->GetHateTop();
|
||||
towho->Message(Chat::White, ".. I am currently fighting with %s", top == nullptr?"(nullptr)":top->GetName());
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"I am currently engaged with {}.",
|
||||
(
|
||||
!top ?
|
||||
"nothing" :
|
||||
fmt::format(
|
||||
"{} ({})",
|
||||
top->GetCleanName(),
|
||||
top->GetID()
|
||||
)
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
bool check_npcs = from_who->WillAggroNPCs();
|
||||
|
||||
if(verbose) {
|
||||
char namebuf[256];
|
||||
|
||||
int my_primary = from_who->GetPrimaryFaction();
|
||||
Mob *own = from_who->GetOwner();
|
||||
if(own != nullptr)
|
||||
my_primary = own->GetPrimaryFaction();
|
||||
|
||||
if(my_primary == 0) {
|
||||
strcpy(namebuf, "(No faction)");
|
||||
} else if(my_primary < 0) {
|
||||
strcpy(namebuf, "(Special faction)");
|
||||
} else {
|
||||
if(!content_db.GetFactionName(my_primary, namebuf, sizeof(namebuf)))
|
||||
strcpy(namebuf, "(Unknown)");
|
||||
if (verbose) {
|
||||
int faction_id = from_who->GetPrimaryFaction();
|
||||
Mob *owner = from_who->GetOwner();
|
||||
if(owner) {
|
||||
faction_id = owner->GetPrimaryFaction();
|
||||
}
|
||||
towho->Message(Chat::White, ".. I am on faction %s (%d)\n", namebuf, my_primary);
|
||||
|
||||
std::string faction_name = (
|
||||
faction_id > 0 ?
|
||||
content_db.GetFactionName(faction_id) :
|
||||
(
|
||||
faction_id == 0 ?
|
||||
"None" :
|
||||
fmt::format(
|
||||
"Special Faction {}",
|
||||
faction_id
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) is on Faction {} ({}).",
|
||||
from_who->GetCleanName(),
|
||||
from_who->GetID(),
|
||||
faction_name,
|
||||
faction_id
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
for (auto it = mob_list.begin(); it != mob_list.end(); ++it) {
|
||||
Mob *mob = it->second;
|
||||
if (mob->IsClient()) //also ensures that mob != around
|
||||
for (const auto& npc_entity : entity_list.GetNPCList()) {
|
||||
auto entity_id = npc_entity.first;
|
||||
auto npc = npc_entity.second;
|
||||
if (npc == from_who) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (DistanceSquared(mob->GetPosition(), from_who->GetPosition()) > d2)
|
||||
if (DistanceSquared(npc->GetPosition(), from_who->GetPosition()) > distance_squared) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (engaged) {
|
||||
uint32 amm = from_who->GetHateAmount(mob);
|
||||
if (amm == 0)
|
||||
towho->Message(Chat::White, "... %s is not on my hate list.", mob->GetName());
|
||||
else
|
||||
towho->Message(Chat::White, "... %s is on my hate list with value %lu", mob->GetName(), (unsigned long)amm);
|
||||
} else if (!check_npcs && mob->IsNPC()) {
|
||||
towho->Message(Chat::White, "... %s is an NPC and my npc_aggro is disabled.", mob->GetName());
|
||||
if (is_engaged) {
|
||||
uint32 hate_amount = from_who->GetHateAmount(npc);
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) is {}on my hate list{}.",
|
||||
npc->GetCleanName(),
|
||||
npc->GetID(),
|
||||
!hate_amount ? "not " : "",
|
||||
(
|
||||
!hate_amount ?
|
||||
"" :
|
||||
fmt::format(
|
||||
" with a hate amount of {}.",
|
||||
hate_amount
|
||||
)
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
} else if (!will_aggro_npcs) {
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) is an NPC and I cannot aggro NPCs.",
|
||||
npc->GetCleanName(),
|
||||
npc->GetID()
|
||||
).c_str()
|
||||
);
|
||||
} else {
|
||||
from_who->DescribeAggro(towho, mob, verbose);
|
||||
from_who->DescribeAggro(towho, npc, verbose);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
//this logic is duplicated from below, try to keep it up to date.
|
||||
float iAggroRange = GetAggroRange();
|
||||
|
||||
float t1, t2, t3;
|
||||
t1 = std::abs(mob->GetX() - GetX());
|
||||
t2 = std::abs(mob->GetY() - GetY());
|
||||
t3 = std::abs(mob->GetZ() - GetZ());
|
||||
|
||||
if(( t1 > iAggroRange)
|
||||
|| ( t2 > iAggroRange)
|
||||
|| ( t3 > iAggroRange) ) {
|
||||
towho->Message(Chat::White, "...%s is out of range (fast). distances (%.3f,%.3f,%.3f), range %.3f", mob->GetName(),
|
||||
t1, t2, t3, iAggroRange);
|
||||
float aggro_range = GetAggroRange();
|
||||
float x_range = std::abs(mob->GetX() - GetX());
|
||||
float y_range = std::abs(mob->GetY() - GetY());
|
||||
float z_range = std::abs(mob->GetZ() - GetZ());
|
||||
if (
|
||||
x_range > aggro_range ||
|
||||
y_range > aggro_range ||
|
||||
z_range > aggro_range
|
||||
) {
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) is out of range. X Range: {} Y Range: {} Z Range: {} Aggro Range: {}",
|
||||
mob->GetCleanName(),
|
||||
mob->GetID(),
|
||||
x_range,
|
||||
y_range,
|
||||
z_range,
|
||||
aggro_range
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if(mob->IsInvisible(this)) {
|
||||
towho->Message(Chat::White, "...%s is invisible to me. ", mob->GetName());
|
||||
if (mob->IsInvisible(this)) {
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) is invisible to me. ",
|
||||
mob->GetCleanName(),
|
||||
mob->GetID()
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
if((mob->IsClient() &&
|
||||
(!mob->CastToClient()->Connected()
|
||||
|| mob->CastToClient()->IsLD()
|
||||
|| mob->CastToClient()->IsBecomeNPC()
|
||||
|| mob->CastToClient()->GetGM()
|
||||
|
||||
if (
|
||||
mob->IsClient() &&
|
||||
(
|
||||
!mob->CastToClient()->Connected() ||
|
||||
mob->CastToClient()->IsLD() ||
|
||||
mob->CastToClient()->IsBecomeNPC() ||
|
||||
mob->CastToClient()->GetGM()
|
||||
)
|
||||
))
|
||||
{
|
||||
towho->Message(Chat::White, "...%s is my owner. ", mob->GetName());
|
||||
) {
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) is a GM or is not connected. ",
|
||||
mob->GetCleanName(),
|
||||
mob->GetID()
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(mob == GetOwner()) {
|
||||
towho->Message(Chat::White, "...%s a GM or is not connected. ", mob->GetName());
|
||||
if (mob == GetOwner()) {
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) is my owner. ",
|
||||
mob->GetCleanName(),
|
||||
mob->GetID()
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
float dist2 = DistanceSquared(mob->GetPosition(), m_Position);
|
||||
|
||||
float iAggroRange2 = iAggroRange*iAggroRange;
|
||||
if( dist2 > iAggroRange2 ) {
|
||||
towho->Message(Chat::White, "...%s is out of range. %.3f > %.3f ", mob->GetName(),
|
||||
dist2, iAggroRange2);
|
||||
float distance_squared = DistanceSquared(mob->GetPosition(), m_Position);
|
||||
float aggro_range_squared = (aggro_range * aggro_range);
|
||||
if (distance_squared > aggro_range_squared) {
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) is out of range. Distance: {:.2f} Aggro Range: {:.2f}",
|
||||
mob->GetCleanName(),
|
||||
mob->GetID(),
|
||||
distance_squared,
|
||||
aggro_range_squared
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (RuleB(Aggro, UseLevelAggro))
|
||||
{
|
||||
if (GetLevel() < RuleI(Aggro, MinAggroLevel) && mob->GetLevelCon(GetLevel()) == CON_GRAY && GetBodyType() != 3 && !AlwaysAggro())
|
||||
{
|
||||
towho->Message(Chat::White, "...%s is red to me (basically)", mob->GetName(), dist2, iAggroRange2);
|
||||
if (RuleB(Aggro, UseLevelAggro)) {
|
||||
if (
|
||||
GetLevel() < RuleI(Aggro, MinAggroLevel) &&
|
||||
mob->GetLevelCon(GetLevel()) == CON_GRAY &&
|
||||
GetBodyType() != BT_Undead &&
|
||||
!AlwaysAggro()
|
||||
) {
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) considers Red to me.",
|
||||
mob->GetCleanName(),
|
||||
mob->GetID()
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if(GetINT() > RuleI(Aggro, IntAggroThreshold) && mob->GetLevelCon(GetLevel()) == CON_GRAY && !AlwaysAggro()) {
|
||||
towho->Message(Chat::White, "...%s is red to me (basically)", mob->GetName(),
|
||||
dist2, iAggroRange2);
|
||||
} else {
|
||||
if (
|
||||
GetINT() > RuleI(Aggro, IntAggroThreshold) &&
|
||||
mob->GetLevelCon(GetLevel()) == CON_GRAY &&
|
||||
!AlwaysAggro()
|
||||
) {
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) considers Red to me.",
|
||||
mob->GetCleanName(),
|
||||
mob->GetID()
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(verbose) {
|
||||
int my_primary = GetPrimaryFaction();
|
||||
int mob_primary = mob->GetPrimaryFaction();
|
||||
Mob *own = GetOwner();
|
||||
if(own != nullptr)
|
||||
my_primary = own->GetPrimaryFaction();
|
||||
own = mob->GetOwner();
|
||||
if(mob_primary > 0 && own != nullptr)
|
||||
mob_primary = own->GetPrimaryFaction();
|
||||
if (verbose) {
|
||||
int faction_id = GetPrimaryFaction();
|
||||
int mob_faction_id = mob->GetPrimaryFaction();
|
||||
Mob *owner = GetOwner();
|
||||
if (owner) {
|
||||
faction_id = owner->GetPrimaryFaction();
|
||||
}
|
||||
|
||||
if(mob_primary == 0) {
|
||||
towho->Message(Chat::White, "...%s has no primary faction", mob->GetName());
|
||||
} else if(mob_primary < 0) {
|
||||
towho->Message(Chat::White, "...%s is on special faction %d", mob->GetName(), mob_primary);
|
||||
owner = mob->GetOwner();
|
||||
if (mob_faction_id && owner) {
|
||||
mob_faction_id = owner->GetPrimaryFaction();
|
||||
}
|
||||
|
||||
if (!mob_faction_id) {
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) has no primary Faction.",
|
||||
mob->GetCleanName(),
|
||||
mob->GetID()
|
||||
).c_str()
|
||||
);
|
||||
} else if (mob_faction_id < 0) {
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) is on special Faction {}.",
|
||||
mob->GetCleanName(),
|
||||
mob->GetID(),
|
||||
mob_faction_id
|
||||
).c_str()
|
||||
);
|
||||
} else {
|
||||
char namebuf[256];
|
||||
if(!content_db.GetFactionName(mob_primary, namebuf, sizeof(namebuf)))
|
||||
strcpy(namebuf, "(Unknown)");
|
||||
std::list<struct NPCFaction*>::iterator cur,end;
|
||||
cur = faction_list.begin();
|
||||
end = faction_list.end();
|
||||
bool res = false;
|
||||
for(; cur != end; ++cur) {
|
||||
struct NPCFaction* fac = *cur;
|
||||
if ((int32)fac->factionID == mob_primary) {
|
||||
if (fac->npc_value > 0) {
|
||||
towho->Message(Chat::White, "...%s is on ALLY faction %s (%d) with %d", mob->GetName(), namebuf, mob_primary, fac->npc_value);
|
||||
res = true;
|
||||
break;
|
||||
} else if (fac->npc_value < 0) {
|
||||
towho->Message(Chat::White, "...%s is on ENEMY faction %s (%d) with %d", mob->GetName(), namebuf, mob_primary, fac->npc_value);
|
||||
res = true;
|
||||
break;
|
||||
} else {
|
||||
towho->Message(Chat::White, "...%s is on NEUTRAL faction %s (%d) with 0", mob->GetName(), namebuf, mob_primary);
|
||||
res = true;
|
||||
break;
|
||||
}
|
||||
auto faction_name = content_db.GetFactionName(mob_faction_id);
|
||||
bool has_entry = false;
|
||||
for (auto faction : faction_list) {
|
||||
if (static_cast<int>(faction->factionID) == mob_faction_id) {
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) has {} standing with Faction {} ({}) with their Faction Level of {}",
|
||||
mob->GetCleanName(),
|
||||
mob->GetID(),
|
||||
(
|
||||
faction->npc_value != 0 ?
|
||||
(
|
||||
faction->npc_value > 0 ?
|
||||
"positive" :
|
||||
"negative"
|
||||
) :
|
||||
"neutral"
|
||||
),
|
||||
faction_name,
|
||||
faction->factionID,
|
||||
faction->npc_value
|
||||
).c_str()
|
||||
);
|
||||
has_entry = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!res) {
|
||||
towho->Message(Chat::White, "...%s is on faction %s (%d), which I have no entry for.", mob->GetName(), namebuf, mob_primary);
|
||||
|
||||
if (!has_entry) {
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) is on Faction {} ({}), for which I do not have an entry.",
|
||||
mob->GetCleanName(),
|
||||
mob->GetID(),
|
||||
faction_name,
|
||||
mob_faction_id
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FACTION_VALUE fv = mob->GetReverseFactionCon(this);
|
||||
auto faction_value = mob->GetReverseFactionCon(this);
|
||||
|
||||
if(!(
|
||||
fv == FACTION_SCOWLS
|
||||
||
|
||||
(mob->GetPrimaryFaction() != GetPrimaryFaction() && mob->GetPrimaryFaction() == -4 && GetOwner() == nullptr)
|
||||
||
|
||||
fv == FACTION_THREATENLY
|
||||
)) {
|
||||
towho->Message(Chat::White, "...%s faction not low enough. value='%s'", mob->GetName(), FactionValueToString(fv));
|
||||
if(
|
||||
!(
|
||||
faction_value == FACTION_THREATENINGLY ||
|
||||
faction_value == FACTION_SCOWLS ||
|
||||
(
|
||||
mob->GetPrimaryFaction() != GetPrimaryFaction() &&
|
||||
mob->GetPrimaryFaction() == -4 &&
|
||||
!GetOwner()
|
||||
)
|
||||
)
|
||||
) {
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) does not have low enough faction, their Faction Level is {} ({}).",
|
||||
mob->GetCleanName(),
|
||||
mob->GetID(),
|
||||
FactionValueToString(faction_value),
|
||||
faction_value
|
||||
).c_str()
|
||||
);
|
||||
return;
|
||||
}
|
||||
if(fv == FACTION_THREATENLY) {
|
||||
towho->Message(Chat::White, "...%s threatening to me, so they only have a %d chance per check of attacking.", mob->GetName());
|
||||
}
|
||||
|
||||
if(!CheckLosFN(mob)) {
|
||||
towho->Message(Chat::White, "...%s is out of sight.", mob->GetName());
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) is out of sight.",
|
||||
mob->GetCleanName(),
|
||||
mob->GetID()
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
towho->Message(Chat::White, "...%s meets all conditions, I should be attacking them.", mob->GetName());
|
||||
towho->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"{} ({}) meets all conditions, I should be attacking them.",
|
||||
mob->GetCleanName(),
|
||||
mob->GetID()
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -229,65 +398,87 @@ void NPC::DescribeAggro(Client *towho, Mob *mob, bool verbose) {
|
||||
to keep the #aggro command accurate.
|
||||
*/
|
||||
bool Mob::CheckWillAggro(Mob *mob) {
|
||||
if(!mob)
|
||||
if(!mob) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//sometimes if a client has some lag while zoning into a dangerous place while either invis or a GM
|
||||
//they will aggro mobs even though it's supposed to be impossible, to lets make sure we've finished connecting
|
||||
if (mob->IsClient()) {
|
||||
if (!mob->CastToClient()->ClientFinishedLoading() || mob->CastToClient()->IsHoveringForRespawn() || mob->CastToClient()->bZoning)
|
||||
if (
|
||||
!mob->CastToClient()->ClientFinishedLoading() ||
|
||||
mob->CastToClient()->IsHoveringForRespawn() ||
|
||||
mob->CastToClient()->bZoning
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// We don't want to aggro clients outside of water if we're water only.
|
||||
if (mob->IsClient() && mob->CastToClient()->GetLastRegion() != RegionTypeWater && IsUnderwaterOnly()) {
|
||||
if (
|
||||
mob->IsClient() &&
|
||||
mob->CastToClient()->GetLastRegion() != RegionTypeWater &&
|
||||
IsUnderwaterOnly()
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Pets shouldn't scan for aggro
|
||||
*/
|
||||
if (this->GetOwner()) {
|
||||
if (GetOwner()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Mob *pet_owner = mob->GetOwner();
|
||||
if (pet_owner && pet_owner->IsClient() && (!RuleB(Aggro, AggroPlayerPets) || pet_owner->CastToClient()->GetGM())) {
|
||||
if (
|
||||
pet_owner &&
|
||||
pet_owner->IsClient() &&
|
||||
(
|
||||
!RuleB(Aggro, AggroPlayerPets) ||
|
||||
pet_owner->CastToClient()->GetGM()
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
float iAggroRange = GetAggroRange();
|
||||
|
||||
// Check If it's invisible and if we can see invis
|
||||
// Check if it's a client, and that the client is connected and not linkdead,
|
||||
// and that the client isn't Playing an NPC, with thier gm flag on
|
||||
// Check if it's not a Interactive NPC
|
||||
// Trumpcard: The 1st 3 checks are low cost calcs to filter out unnessecary distance checks. Leave them at the beginning, they are the most likely occurence.
|
||||
// Image: I moved this up by itself above faction and distance checks because if one of these return true, theres no reason to go through the other information
|
||||
|
||||
float aggro_range = GetAggroRange();
|
||||
float x_range = std::abs(mob->GetX() - GetX());
|
||||
float y_range = std::abs(mob->GetY() - GetY());
|
||||
float z_range = std::abs(mob->GetZ() - GetZ());
|
||||
|
||||
float t1, t2, t3;
|
||||
t1 = std::abs(mob->GetX() - GetX());
|
||||
t2 = std::abs(mob->GetY() - GetY());
|
||||
t3 = std::abs(mob->GetZ() - GetZ());
|
||||
|
||||
if(( t1 > iAggroRange)
|
||||
|| ( t2 > iAggroRange)
|
||||
|| ( t3 > iAggroRange)
|
||||
|| (mob->IsInvisible(this))
|
||||
|| (mob->IsClient() &&
|
||||
(!mob->CastToClient()->Connected()
|
||||
if (
|
||||
x_range > aggro_range ||
|
||||
y_range > aggro_range ||
|
||||
z_range > aggro_range ||
|
||||
mob->IsInvisible(this) ||
|
||||
(
|
||||
mob->IsClient() &&
|
||||
(
|
||||
!mob->CastToClient()->Connected()
|
||||
|| mob->CastToClient()->IsLD()
|
||||
|| mob->CastToClient()->IsBecomeNPC()
|
||||
|| mob->CastToClient()->GetGM()
|
||||
)
|
||||
))
|
||||
{
|
||||
return(false);
|
||||
)
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Don't aggro new clients if we are already engaged unless PROX_AGGRO is set
|
||||
if (IsEngaged() && (!GetSpecialAbility(PROX_AGGRO) || (GetSpecialAbility(PROX_AGGRO) && !CombatRange(mob)))) {
|
||||
LogAggro("[{}] is in combat, and does not have prox_aggro, or does and is out of combat range with [{}]", GetName(), mob->GetName());
|
||||
LogAggro(
|
||||
"[{}] is in combat, and does not have prox_aggro, or does and is out of combat range with [{}]",
|
||||
GetName(),
|
||||
mob->GetName()
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -296,105 +487,100 @@ bool Mob::CheckWillAggro(Mob *mob) {
|
||||
//aggro this mob...???
|
||||
//changed to be 'if I have an owner and this is it'
|
||||
if(mob == GetOwner()) {
|
||||
return(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
float dist2 = DistanceSquared(mob->GetPosition(), m_Position);
|
||||
float iAggroRange2 = iAggroRange*iAggroRange;
|
||||
float distance_squared = DistanceSquared(mob->GetPosition(), m_Position);
|
||||
float aggro_range_squared = (aggro_range * aggro_range);
|
||||
|
||||
if( dist2 > iAggroRange2 ) {
|
||||
if (distance_squared > aggro_range_squared ) {
|
||||
// Skip it, out of range
|
||||
return(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
//Image: Get their current target and faction value now that its required
|
||||
//this function call should seem backwards
|
||||
FACTION_VALUE fv = mob->GetReverseFactionCon(this);
|
||||
FACTION_VALUE faction_value = mob->GetReverseFactionCon(this);
|
||||
|
||||
// Make sure they're still in the zone
|
||||
// Are they in range?
|
||||
// Are they kos?
|
||||
// Are we stupid or are they green
|
||||
// and they don't have their gm flag on
|
||||
int heroicCHA_mod = mob->itembonuses.HeroicCHA/25; // 800 Heroic CHA cap
|
||||
if(heroicCHA_mod > THREATENLY_ARRGO_CHANCE)
|
||||
heroicCHA_mod = THREATENLY_ARRGO_CHANCE;
|
||||
if (RuleB(Aggro, UseLevelAggro) &&
|
||||
(
|
||||
//old InZone check taken care of above by !mob->CastToClient()->Connected()
|
||||
(
|
||||
( GetLevel() >= RuleI(Aggro, MinAggroLevel))
|
||||
||(GetBodyType() == 3) || AlwaysAggro()
|
||||
||( mob->IsClient() && mob->CastToClient()->IsSitting() )
|
||||
||( mob->GetLevelCon(GetLevel()) != CON_GRAY)
|
||||
int heroic_cha_mod = (mob->itembonuses.HeroicCHA / 25); // 800 Heroic CHA cap
|
||||
if(heroic_cha_mod > THREATENINGLY_AGGRO_CHANCE) {
|
||||
heroic_cha_mod = THREATENINGLY_AGGRO_CHANCE;
|
||||
}
|
||||
|
||||
)
|
||||
&&
|
||||
(
|
||||
if (
|
||||
RuleB(Aggro, UseLevelAggro) &&
|
||||
(
|
||||
fv == FACTION_SCOWLS
|
||||
||
|
||||
(mob->GetPrimaryFaction() != GetPrimaryFaction() && mob->GetPrimaryFaction() == -4 && GetOwner() == nullptr)
|
||||
||
|
||||
GetLevel() >= RuleI(Aggro, MinAggroLevel) ||
|
||||
GetBodyType() == BT_Undead ||
|
||||
AlwaysAggro() ||
|
||||
(
|
||||
fv == FACTION_THREATENLY
|
||||
&& zone->random.Roll(THREATENLY_ARRGO_CHANCE - heroicCHA_mod)
|
||||
mob->IsClient() &&
|
||||
mob->CastToClient()->IsSitting()
|
||||
) ||
|
||||
mob->GetLevelCon(GetLevel()) != CON_GRAY
|
||||
) &&
|
||||
(
|
||||
faction_value == FACTION_SCOWLS ||
|
||||
(
|
||||
mob->GetPrimaryFaction() != GetPrimaryFaction() &&
|
||||
mob->GetPrimaryFaction() == -4 &&
|
||||
!GetOwner()
|
||||
) ||
|
||||
(
|
||||
faction_value == FACTION_THREATENINGLY &&
|
||||
zone->random.Roll(THREATENINGLY_AGGRO_CHANCE - heroic_cha_mod)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
//FatherNiwtit: make sure we can see them. last since it is very expensive
|
||||
) {
|
||||
if(CheckLosFN(mob)) {
|
||||
LogAggro("Check aggro for [{}] target [{}]", GetName(), mob->GetName());
|
||||
return( mod_will_aggro(mob, this) );
|
||||
return mod_will_aggro(mob, this);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if
|
||||
(
|
||||
//old InZone check taken care of above by !mob->CastToClient()->Connected()
|
||||
(
|
||||
( GetINT() <= RuleI(Aggro, IntAggroThreshold) )
|
||||
|| AlwaysAggro()
|
||||
||( mob->IsClient() && mob->CastToClient()->IsSitting() )
|
||||
||( mob->GetLevelCon(GetLevel()) != CON_GRAY)
|
||||
|
||||
)
|
||||
&&
|
||||
(
|
||||
} else {
|
||||
if (
|
||||
(
|
||||
fv == FACTION_SCOWLS
|
||||
||
|
||||
(mob->GetPrimaryFaction() != GetPrimaryFaction() && mob->GetPrimaryFaction() == -4 && GetOwner() == nullptr)
|
||||
||
|
||||
GetINT() <= RuleI(Aggro, IntAggroThreshold) ||
|
||||
AlwaysAggro() ||
|
||||
(
|
||||
fv == FACTION_THREATENLY
|
||||
&& zone->random.Roll(THREATENLY_ARRGO_CHANCE - heroicCHA_mod)
|
||||
mob->IsClient() &&
|
||||
mob->CastToClient()->IsSitting()
|
||||
) ||
|
||||
mob->GetLevelCon(GetLevel()) != CON_GRAY
|
||||
) &&
|
||||
(
|
||||
faction_value == FACTION_SCOWLS ||
|
||||
(
|
||||
mob->GetPrimaryFaction() != GetPrimaryFaction() &&
|
||||
mob->GetPrimaryFaction() == -4 &&
|
||||
!GetOwner()
|
||||
) ||
|
||||
(
|
||||
faction_value == FACTION_THREATENINGLY
|
||||
&& zone->random.Roll(THREATENINGLY_AGGRO_CHANCE - heroic_cha_mod)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
{
|
||||
//FatherNiwtit: make sure we can see them. last since it is very expensive
|
||||
) {
|
||||
if(CheckLosFN(mob)) {
|
||||
LogAggro("Check aggro for [{}] target [{}]", GetName(), mob->GetName());
|
||||
return( mod_will_aggro(mob, this) );
|
||||
return mod_will_aggro(mob, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LogAggro("Is In zone?:[{}]\n", mob->InZone());
|
||||
LogAggro("Dist^2: [{}]\n", dist2);
|
||||
LogAggro("Range^2: [{}]\n", iAggroRange2);
|
||||
LogAggro("Faction: [{}]\n", fv);
|
||||
LogAggro("Dist^2: [{}]\n", distance_squared);
|
||||
LogAggro("Range^2: [{}]\n", aggro_range_squared);
|
||||
LogAggro("Faction: [{}]\n", faction_value);
|
||||
LogAggro("AlwaysAggroFlag: [{}]\n", AlwaysAggro());
|
||||
LogAggro("Int: [{}]\n", GetINT());
|
||||
LogAggro("Con: [{}]\n", GetLevelCon(mob->GetLevel()));
|
||||
|
||||
return(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
int EntityList::GetHatedCount(Mob *attacker, Mob *exclude, bool inc_gray_con)
|
||||
|
||||
@ -3471,7 +3471,7 @@ float Client::CalcPriceMod(Mob* other, bool reverse)
|
||||
if (other)
|
||||
{
|
||||
int factionlvl = GetFactionLevel(CharacterID(), other->CastToNPC()->GetNPCTypeID(), GetFactionRace(), GetClass(), GetDeity(), other->CastToNPC()->GetPrimaryFaction(), other);
|
||||
if (factionlvl >= FACTION_APPREHENSIVE) // Apprehensive or worse.
|
||||
if (factionlvl >= FACTION_APPREHENSIVELY) // Apprehensive or worse.
|
||||
{
|
||||
if (GetCHA() > 103)
|
||||
{
|
||||
@ -3486,7 +3486,7 @@ float Client::CalcPriceMod(Mob* other, bool reverse)
|
||||
chaformula = 1*(RuleI(Merchant, PricePenaltyPct));
|
||||
}
|
||||
}
|
||||
if (factionlvl <= FACTION_INDIFFERENT) // Indifferent or better.
|
||||
if (factionlvl <= FACTION_INDIFFERENTLY) // Indifferent or better.
|
||||
{
|
||||
if (GetCHA() > 75)
|
||||
{
|
||||
@ -7860,7 +7860,7 @@ FACTION_VALUE Client::GetReverseFactionCon(Mob* iOther) {
|
||||
return GetSpecialFactionCon(iOther);
|
||||
|
||||
if (iOther->GetPrimaryFaction() == 0)
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
|
||||
return GetFactionLevel(CharacterID(), 0, GetFactionRace(), GetClass(), GetDeity(), iOther->GetPrimaryFaction(), iOther);
|
||||
}
|
||||
@ -7883,25 +7883,25 @@ FACTION_VALUE Client::GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_ra
|
||||
{
|
||||
if (pFaction < 0)
|
||||
return GetSpecialFactionCon(tnpc);
|
||||
FACTION_VALUE fac = FACTION_INDIFFERENT;
|
||||
FACTION_VALUE fac = FACTION_INDIFFERENTLY;
|
||||
int32 tmpFactionValue;
|
||||
FactionMods fmods;
|
||||
|
||||
// few optimizations
|
||||
if (GetFeigned())
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
if(!zone->CanDoCombat())
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
if (invisible_undead && tnpc && !tnpc->SeeInvisibleUndead())
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
if (IsInvisible(tnpc))
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
if (tnpc && tnpc->GetOwnerID() != 0) // pets con amiably to owner and indiff to rest
|
||||
{
|
||||
if (char_id == tnpc->GetOwner()->CastToClient()->CharacterID())
|
||||
return FACTION_AMIABLE;
|
||||
return FACTION_AMIABLY;
|
||||
else
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
}
|
||||
|
||||
//First get the NPC's Primary faction
|
||||
@ -7921,15 +7921,15 @@ FACTION_VALUE Client::GetFactionLevel(uint32 char_id, uint32 npc_id, uint32 p_ra
|
||||
}
|
||||
else
|
||||
{
|
||||
return(FACTION_INDIFFERENT);
|
||||
return(FACTION_INDIFFERENTLY);
|
||||
}
|
||||
|
||||
// merchant fix
|
||||
if (tnpc && tnpc->IsNPC() && tnpc->CastToNPC()->MerchantType && (fac == FACTION_THREATENLY || fac == FACTION_SCOWLS))
|
||||
fac = FACTION_DUBIOUS;
|
||||
if (tnpc && tnpc->IsNPC() && tnpc->CastToNPC()->MerchantType && (fac == FACTION_THREATENINGLY || fac == FACTION_SCOWLS))
|
||||
fac = FACTION_DUBIOUSLY;
|
||||
|
||||
if (tnpc != 0 && fac != FACTION_SCOWLS && tnpc->CastToNPC()->CheckAggro(this))
|
||||
fac = FACTION_THREATENLY;
|
||||
fac = FACTION_THREATENINGLY;
|
||||
|
||||
return fac;
|
||||
}
|
||||
|
||||
@ -4875,7 +4875,7 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app)
|
||||
if (tmob->IsNPC())
|
||||
{
|
||||
if (GetFeigned())
|
||||
con->faction = FACTION_INDIFFERENT;
|
||||
con->faction = FACTION_INDIFFERENTLY;
|
||||
}
|
||||
|
||||
if (!(con->faction == FACTION_SCOWLS))
|
||||
@ -4883,21 +4883,21 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app)
|
||||
if (tmob->IsNPC())
|
||||
{
|
||||
if (tmob->CastToNPC()->IsOnHatelist(this))
|
||||
con->faction = FACTION_THREATENLY;
|
||||
con->faction = FACTION_THREATENINGLY;
|
||||
}
|
||||
}
|
||||
|
||||
if (con->faction == FACTION_APPREHENSIVE) {
|
||||
if (con->faction == FACTION_APPREHENSIVELY) {
|
||||
con->faction = FACTION_SCOWLS;
|
||||
}
|
||||
else if (con->faction == FACTION_DUBIOUS) {
|
||||
con->faction = FACTION_THREATENLY;
|
||||
else if (con->faction == FACTION_DUBIOUSLY) {
|
||||
con->faction = FACTION_THREATENINGLY;
|
||||
}
|
||||
else if (con->faction == FACTION_SCOWLS) {
|
||||
con->faction = FACTION_APPREHENSIVE;
|
||||
con->faction = FACTION_APPREHENSIVELY;
|
||||
}
|
||||
else if (con->faction == FACTION_THREATENLY) {
|
||||
con->faction = FACTION_DUBIOUS;
|
||||
else if (con->faction == FACTION_THREATENINGLY) {
|
||||
con->faction = FACTION_DUBIOUSLY;
|
||||
}
|
||||
|
||||
mod_consider(tmob, con);
|
||||
|
||||
@ -116,7 +116,7 @@ int command_init(void)
|
||||
if (
|
||||
command_add("acceptrules", "[acceptrules] - Accept the EQEmu Agreement", AccountStatus::Player, command_acceptrules) ||
|
||||
command_add("advnpcspawn", "[maketype|makegroup|addgroupentry|addgroupspawn][removegroupspawn|movespawn|editgroupbox|cleargroupbox]", AccountStatus::GMLeadAdmin, command_advnpcspawn) ||
|
||||
command_add("aggro", "(range) [-v] - Display aggro information for all mobs 'range' distance from your target. -v is verbose faction info.", AccountStatus::QuestTroupe, command_aggro) ||
|
||||
command_add("aggro", "[Distance] [-v] - Display aggro information for all mobs 'Distance' distance from your target. (-v is verbose Faction Information)", AccountStatus::QuestTroupe, command_aggro) ||
|
||||
command_add("aggrozone", "[aggro] - Aggro every mob in the zone with X aggro. Default is 0. Not recommend if you're not invulnerable.", AccountStatus::GMAdmin, command_aggrozone) ||
|
||||
command_add("ai", "[factionid/spellslist/con/guard/roambox/stop/start] - Modify AI on NPC target", AccountStatus::GMAdmin, command_ai) ||
|
||||
command_add("appearance", "[type] [value] - Send an appearance packet for you or your target", AccountStatus::GMLeadAdmin, command_appearance) ||
|
||||
|
||||
@ -1033,14 +1033,14 @@ void EntityList::AESpell(
|
||||
//which have bad faction with us
|
||||
if (
|
||||
!(caster_mob->CheckAggro(current_mob) ||
|
||||
faction_value == FACTION_THREATENLY ||
|
||||
faction_value == FACTION_THREATENINGLY ||
|
||||
faction_value == FACTION_SCOWLS)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//only affect mobs we would assist.
|
||||
if (!(faction_value <= FACTION_AMIABLE)) {
|
||||
if (!(faction_value <= FACTION_AMIABLY)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -1209,13 +1209,13 @@ void EntityList::AEBardPulse(
|
||||
if (is_detrimental_spell) {
|
||||
//affect mobs that are on our hate list, or
|
||||
//which have bad faction with us
|
||||
if (!(caster->CheckAggro(current_mob) || faction == FACTION_THREATENLY || faction == FACTION_SCOWLS)) {
|
||||
if (!(caster->CheckAggro(current_mob) || faction == FACTION_THREATENINGLY || faction == FACTION_SCOWLS)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
//only affect mobs we would assist.
|
||||
if (!(faction <= FACTION_AMIABLE)) {
|
||||
if (!(faction <= FACTION_AMIABLY)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3671,7 +3671,7 @@ void EntityList::SendAlarm(Trap *trap, Mob *currenttarget, uint8 kos)
|
||||
|
||||
if (kos) {
|
||||
uint8 factioncon = currenttarget->GetReverseFactionCon(cur);
|
||||
if (factioncon == FACTION_THREATENLY || factioncon == FACTION_SCOWLS) {
|
||||
if (factioncon == FACTION_THREATENINGLY || factioncon == FACTION_SCOWLS) {
|
||||
cur->AddToHateList(currenttarget,1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,20 +2,27 @@
|
||||
|
||||
void command_aggro(Client *c, const Seperator *sep)
|
||||
{
|
||||
if (c->GetTarget() == nullptr || !c->GetTarget()->IsNPC()) {
|
||||
c->Message(Chat::White, "Error: you must have an NPC target.");
|
||||
int arguments = sep->argnum;
|
||||
if (!arguments || !sep->IsNumber(1)) {
|
||||
c->Message(Chat::White, "Usage: #aggro [Distance] [-v] (-v is verbose Faction Information)");
|
||||
return;
|
||||
}
|
||||
float d = atof(sep->arg[1]);
|
||||
if (d == 0.0f) {
|
||||
c->Message(Chat::Red, "Error: distance argument required.");
|
||||
return;
|
||||
}
|
||||
bool verbose = false;
|
||||
if (sep->arg[2][0] == '-' && sep->arg[2][1] == 'v' && sep->arg[2][2] == '\0') {
|
||||
verbose = true;
|
||||
}
|
||||
|
||||
entity_list.DescribeAggro(c, c->GetTarget()->CastToNPC(), d, verbose);
|
||||
if (
|
||||
!c->GetTarget() ||
|
||||
(
|
||||
c->GetTarget() &&
|
||||
!c->GetTarget()->IsNPC()
|
||||
)
|
||||
) {
|
||||
c->Message(Chat::White, "You must target an NPC to use this command.");
|
||||
return;
|
||||
}
|
||||
|
||||
NPC* target = c->GetTarget()->CastToNPC();
|
||||
|
||||
float distance = std::stof(sep->arg[1]);
|
||||
bool verbose = !strcasecmp("-v", sep->arg[2]);
|
||||
entity_list.DescribeAggro(c, target, distance, verbose);
|
||||
}
|
||||
|
||||
|
||||
@ -4193,11 +4193,11 @@ luabind::scope lua_register_faction() {
|
||||
luabind::value("Ally", static_cast<int>(FACTION_ALLY)),
|
||||
luabind::value("Warmly", static_cast<int>(FACTION_WARMLY)),
|
||||
luabind::value("Kindly", static_cast<int>(FACTION_KINDLY)),
|
||||
luabind::value("Amiable", static_cast<int>(FACTION_AMIABLE)),
|
||||
luabind::value("Indifferent", static_cast<int>(FACTION_INDIFFERENT)),
|
||||
luabind::value("Apprehensive", static_cast<int>(FACTION_APPREHENSIVE)),
|
||||
luabind::value("Dubious", static_cast<int>(FACTION_DUBIOUS)),
|
||||
luabind::value("Threatenly", static_cast<int>(FACTION_THREATENLY)),
|
||||
luabind::value("Amiable", static_cast<int>(FACTION_AMIABLY)),
|
||||
luabind::value("Indifferent", static_cast<int>(FACTION_INDIFFERENTLY)),
|
||||
luabind::value("Apprehensive", static_cast<int>(FACTION_APPREHENSIVELY)),
|
||||
luabind::value("Dubious", static_cast<int>(FACTION_DUBIOUSLY)),
|
||||
luabind::value("Threatenly", static_cast<int>(FACTION_THREATENINGLY)),
|
||||
luabind::value("Scowls", static_cast<int>(FACTION_SCOWLS))
|
||||
];
|
||||
}
|
||||
|
||||
34
zone/mob.cpp
34
zone/mob.cpp
@ -5715,7 +5715,7 @@ void Mob::ClearItemFactionBonuses() {
|
||||
|
||||
FACTION_VALUE Mob::GetSpecialFactionCon(Mob* iOther) {
|
||||
if (!iOther)
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
|
||||
iOther = iOther->GetOwnerOrSelf();
|
||||
Mob* self = this->GetOwnerOrSelf();
|
||||
@ -5726,9 +5726,9 @@ FACTION_VALUE Mob::GetSpecialFactionCon(Mob* iOther) {
|
||||
int iOtherPrimaryFaction = iOther->GetPrimaryFaction();
|
||||
|
||||
if (selfPrimaryFaction >= 0 && selfAIcontrolled)
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
if (iOther->GetPrimaryFaction() >= 0)
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
/* special values:
|
||||
-2 = indiff to player, ally to AI on special values, indiff to AI
|
||||
-3 = dub to player, ally to AI on special values, indiff to AI
|
||||
@ -5748,27 +5748,27 @@ FACTION_VALUE Mob::GetSpecialFactionCon(Mob* iOther) {
|
||||
if (selfAIcontrolled && iOtherAIControlled)
|
||||
return FACTION_ALLY;
|
||||
else
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
case -3: // -3 = dub to player, ally to AI on special values, indiff to AI
|
||||
if (selfAIcontrolled && iOtherAIControlled)
|
||||
return FACTION_ALLY;
|
||||
else
|
||||
return FACTION_DUBIOUS;
|
||||
return FACTION_DUBIOUSLY;
|
||||
case -4: // -4 = atk to player, ally to AI on special values, indiff to AI
|
||||
if (selfAIcontrolled && iOtherAIControlled)
|
||||
return FACTION_ALLY;
|
||||
else
|
||||
return FACTION_SCOWLS;
|
||||
case -5: // -5 = indiff to player, indiff to AI
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
case -6: // -6 = dub to player, indiff to AI
|
||||
if (selfAIcontrolled && iOtherAIControlled)
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
else
|
||||
return FACTION_DUBIOUS;
|
||||
return FACTION_DUBIOUSLY;
|
||||
case -7: // -7 = atk to player, indiff to AI
|
||||
if (selfAIcontrolled && iOtherAIControlled)
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
else
|
||||
return FACTION_SCOWLS;
|
||||
case -8: // -8 = indiff to players, ally to AI on same value, indiff to AI
|
||||
@ -5776,25 +5776,25 @@ FACTION_VALUE Mob::GetSpecialFactionCon(Mob* iOther) {
|
||||
if (selfPrimaryFaction == iOtherPrimaryFaction)
|
||||
return FACTION_ALLY;
|
||||
else
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
}
|
||||
else
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
case -9: // -9 = dub to players, ally to AI on same value, indiff to AI
|
||||
if (selfAIcontrolled && iOtherAIControlled) {
|
||||
if (selfPrimaryFaction == iOtherPrimaryFaction)
|
||||
return FACTION_ALLY;
|
||||
else
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
}
|
||||
else
|
||||
return FACTION_DUBIOUS;
|
||||
return FACTION_DUBIOUSLY;
|
||||
case -10: // -10 = atk to players, ally to AI on same value, indiff to AI
|
||||
if (selfAIcontrolled && iOtherAIControlled) {
|
||||
if (selfPrimaryFaction == iOtherPrimaryFaction)
|
||||
return FACTION_ALLY;
|
||||
else
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
}
|
||||
else
|
||||
return FACTION_SCOWLS;
|
||||
@ -5806,7 +5806,7 @@ FACTION_VALUE Mob::GetSpecialFactionCon(Mob* iOther) {
|
||||
return FACTION_SCOWLS;
|
||||
}
|
||||
else
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
case -12: // -12 = dub to players, ally to AI on same value, atk to AI
|
||||
if (selfAIcontrolled && iOtherAIControlled) {
|
||||
if (selfPrimaryFaction == iOtherPrimaryFaction)
|
||||
@ -5817,7 +5817,7 @@ FACTION_VALUE Mob::GetSpecialFactionCon(Mob* iOther) {
|
||||
|
||||
}
|
||||
else
|
||||
return FACTION_DUBIOUS;
|
||||
return FACTION_DUBIOUSLY;
|
||||
case -13: // -13 = atk to players, ally to AI on same value, atk to AI
|
||||
if (selfAIcontrolled && iOtherAIControlled) {
|
||||
if (selfPrimaryFaction == iOtherPrimaryFaction)
|
||||
@ -5828,7 +5828,7 @@ FACTION_VALUE Mob::GetSpecialFactionCon(Mob* iOther) {
|
||||
else
|
||||
return FACTION_SCOWLS;
|
||||
default:
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1176,7 +1176,7 @@ public:
|
||||
inline float GetCWPP() const { return(static_cast<float>(cur_wp_pause)); }
|
||||
inline int GetCWP() const { return(cur_wp); }
|
||||
void SetCurrentWP(int waypoint) { cur_wp = waypoint; }
|
||||
virtual FACTION_VALUE GetReverseFactionCon(Mob* iOther) { return FACTION_INDIFFERENT; }
|
||||
virtual FACTION_VALUE GetReverseFactionCon(Mob* iOther) { return FACTION_INDIFFERENTLY; }
|
||||
|
||||
virtual const bool IsUnderwaterOnly() const { return false; }
|
||||
inline bool IsTrackable() const { return(trackable); }
|
||||
|
||||
10
zone/npc.cpp
10
zone/npc.cpp
@ -2907,7 +2907,7 @@ FACTION_VALUE NPC::GetReverseFactionCon(Mob* iOther) {
|
||||
return GetSpecialFactionCon(iOther);
|
||||
|
||||
if (primaryFaction == 0)
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
|
||||
//if we are a pet, use our owner's faction stuff
|
||||
Mob *own = GetOwner();
|
||||
@ -2917,7 +2917,7 @@ FACTION_VALUE NPC::GetReverseFactionCon(Mob* iOther) {
|
||||
//make sure iOther is an npc
|
||||
//also, if we dont have a faction, then they arnt gunna think anything of us either
|
||||
if(!iOther->IsNPC() || GetPrimaryFaction() == 0)
|
||||
return(FACTION_INDIFFERENT);
|
||||
return(FACTION_INDIFFERENTLY);
|
||||
|
||||
//if we get here, iOther is an NPC too
|
||||
|
||||
@ -2941,7 +2941,7 @@ FACTION_VALUE NPC::CheckNPCFactionAlly(int32 other_faction) {
|
||||
else if (fac->npc_value < 0)
|
||||
return FACTION_SCOWLS;
|
||||
else
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2953,7 +2953,7 @@ FACTION_VALUE NPC::CheckNPCFactionAlly(int32 other_faction) {
|
||||
if (GetPrimaryFaction() == other_faction)
|
||||
return FACTION_ALLY;
|
||||
else
|
||||
return FACTION_INDIFFERENT;
|
||||
return FACTION_INDIFFERENTLY;
|
||||
}
|
||||
|
||||
bool NPC::IsFactionListAlly(uint32 other_faction) {
|
||||
@ -3421,7 +3421,7 @@ void NPC::AIYellForHelp(Mob *sender, Mob *attacker)
|
||||
}
|
||||
}
|
||||
|
||||
if (sender->GetReverseFactionCon(mob) <= FACTION_AMIABLE) {
|
||||
if (sender->GetReverseFactionCon(mob) <= FACTION_AMIABLY) {
|
||||
//attacking someone on same faction, or a friend
|
||||
//Father Nitwit: make sure we can see them.
|
||||
if (mob->CheckLosFN(sender)) {
|
||||
|
||||
@ -3105,19 +3105,19 @@ uint8 QuestManager::FactionValue()
|
||||
case FACTION_SCOWLS:
|
||||
newfac = 1;
|
||||
break;
|
||||
case FACTION_THREATENLY:
|
||||
case FACTION_THREATENINGLY:
|
||||
newfac = 2;
|
||||
break;
|
||||
case FACTION_DUBIOUS:
|
||||
case FACTION_DUBIOUSLY:
|
||||
newfac = 3;
|
||||
break;
|
||||
case FACTION_APPREHENSIVE:
|
||||
case FACTION_APPREHENSIVELY:
|
||||
newfac = 4;
|
||||
break;
|
||||
case FACTION_INDIFFERENT:
|
||||
case FACTION_INDIFFERENTLY:
|
||||
newfac = 5;
|
||||
break;
|
||||
case FACTION_AMIABLE:
|
||||
case FACTION_AMIABLY:
|
||||
newfac = 6;
|
||||
break;
|
||||
case FACTION_KINDLY:
|
||||
|
||||
@ -6181,13 +6181,13 @@ void Mob::BeamDirectional(uint16 spell_id, int16 resist_adjust)
|
||||
auto fac = (*iter)->GetReverseFactionCon(this);
|
||||
if (beneficial_targets) {
|
||||
// only affect mobs we would assist.
|
||||
if (!(fac <= FACTION_AMIABLE)) {
|
||||
if (!(fac <= FACTION_AMIABLY)) {
|
||||
++iter;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// affect mobs that are on our hate list, or which have bad faction with us
|
||||
if (!(CheckAggro(*iter) || fac == FACTION_THREATENLY || fac == FACTION_SCOWLS)) {
|
||||
if (!(CheckAggro(*iter) || fac == FACTION_THREATENINGLY || fac == FACTION_SCOWLS)) {
|
||||
++iter;
|
||||
continue;
|
||||
}
|
||||
@ -6256,13 +6256,13 @@ void Mob::ConeDirectional(uint16 spell_id, int16 resist_adjust)
|
||||
auto fac = (*iter)->GetReverseFactionCon(this);
|
||||
if (beneficial_targets) {
|
||||
// only affect mobs we would assist.
|
||||
if (!(fac <= FACTION_AMIABLE)) {
|
||||
if (!(fac <= FACTION_AMIABLY)) {
|
||||
++iter;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
// affect mobs that are on our hate list, or which have bad faction with us
|
||||
if (!(CheckAggro(*iter) || fac == FACTION_THREATENLY || fac == FACTION_SCOWLS)) {
|
||||
if (!(CheckAggro(*iter) || fac == FACTION_THREATENINGLY || fac == FACTION_SCOWLS)) {
|
||||
++iter;
|
||||
continue;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user