mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
[Bots] Line of Sight and Mez optimizations and cleanup (#4746)
* [Bots] Line of Sight and Mez optimizations and cleanup - Renames `Map:CheckForLoSCheat` to `Map:CheckForDoorLoSCheat` to better reflect what it does. - Renames `Map:RangeCheckForLoSCheat` to `Map:RangeCheckForDoorLoSCheat` to better reflect what it does. - Adds the rule `Pets:PetsRequireLoS` to determine whether or not commanded pet attacks require an addition layer of LoS checks for edge-cases. - Adds the rule `Bots:BotsRequireLoS` to determine whether or not bots require LoS to `^attack`, `^pull` and `^precombat`. - Adds the rule `Map:ZonesToCheckDoorCheat` to control what if any zones will be checked.. - Corrects, removes and adds LoS checks where necessary. - Improves door checking logic for locked or triggered doors that could be blocking LoS. - Cleans up false positives for door cheat checks. - Adds `drawbox` option to `#door` command. This will spawn points at the center and each corner of the door's "box". It will also spawn points at your and your target's location. - Improves Mez and AE Mez logic - Adds more details to the rule `Bots:EpicPetSpellName` * Remove leftover debugging * Change return to continue for GetFirstIncomingMobToMez checks * Move mez chance fail to beginning of cast process
This commit is contained in:
+36
-46
@@ -8675,56 +8675,54 @@ bool Mob::IsInGroupOrRaid(Mob* other, bool same_raid_group) {
|
||||
|
||||
bool Mob::DoLosChecks(Mob* other) {
|
||||
if (!CheckLosFN(other) || !CheckWaterLoS(other)) {
|
||||
if (CheckLosCheatExempt(other)) {
|
||||
if (RuleB(Map, EnableLoSCheatExemptions) && CheckLosCheatExempt(other)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!CheckLosCheat(other)) {
|
||||
if (RuleB(Map, CheckForDoorLoSCheat) && !CheckDoorLoSCheat(other)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Mob::CheckLosCheat(Mob* other) {
|
||||
if (RuleB(Map, CheckForLoSCheat)) {
|
||||
for (auto itr : entity_list.GetDoorsList()) {
|
||||
Doors* d = itr.second;
|
||||
bool Mob::CheckDoorLoSCheat(Mob* other) {
|
||||
if (!other->IsOfClientBotMerc() && other->CastToNPC()->IsOnHatelist(this)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const std::string& zones_to_check = RuleS(Map, ZonesToCheckDoorCheat);
|
||||
|
||||
if (zones_to_check.empty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const auto& v = Strings::Split(zones_to_check, ",");
|
||||
|
||||
if (zones_to_check == "all" || std::find(v.begin(), v.end(), std::to_string(zone->GetZoneID())) != v.end()) {
|
||||
for (auto itr: entity_list.GetDoorsList()) {
|
||||
Doors *d = itr.second;
|
||||
|
||||
if (
|
||||
!d->IsDoorOpen() &&
|
||||
(
|
||||
d->GetKeyItem() ||
|
||||
d->GetLockpick() ||
|
||||
d->IsDoorOpen() ||
|
||||
d->IsDoorBlacklisted() ||
|
||||
d->GetNoKeyring() != 0 ||
|
||||
d->GetDoorParam() > 0
|
||||
d->GetNoKeyring() != 0
|
||||
)
|
||||
) {
|
||||
// If the door is a trigger door, check if the trigger door is open
|
||||
if (d->GetTriggerDoorID() > 0) {
|
||||
auto td = entity_list.GetDoorsByDoorID(d->GetTriggerDoorID());
|
||||
) {
|
||||
float distance = Distance(m_Position, d->GetPosition());
|
||||
|
||||
if (td) {
|
||||
if (Strings::RemoveNumbers(d->GetDoorName()) != Strings::RemoveNumbers(td->GetDoorName())) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (distance > RuleR(Map, RangeCheckForDoorLoSCheat) || !CheckLosFN(d->GetX(), d->GetY(), d->GetZ(), GetSize())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (DistanceNoZ(GetPosition(), d->GetPosition()) <= 50) {
|
||||
auto who_to_door = DistanceNoZ(GetPosition(), d->GetPosition());
|
||||
auto other_to_door = DistanceNoZ(other->GetPosition(), d->GetPosition());
|
||||
auto who_to_other = DistanceNoZ(GetPosition(), other->GetPosition());
|
||||
auto distance_difference = who_to_other - (who_to_door + other_to_door);
|
||||
|
||||
if (distance_difference >= (-1 * RuleR(Maps, RangeCheckForLoSCheat)) && distance_difference <= RuleR(Maps, RangeCheckForLoSCheat)) {
|
||||
return false;
|
||||
}
|
||||
if (d->IsDoorBetween(GetPosition(), other->GetPosition(), d->GetSize())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8733,26 +8731,18 @@ bool Mob::CheckLosCheat(Mob* other) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Mob::CheckLosCheatExempt(Mob* other)
|
||||
{
|
||||
if (RuleB(Map, EnableLoSCheatExemptions)) {
|
||||
/* This is an exmaple of how to configure exemptions for LoS checks.
|
||||
glm::vec4 exempt_check_who;
|
||||
glm::vec4 exempt_check_other;
|
||||
bool Mob::CheckLosCheatExempt(Mob* other) {
|
||||
glm::vec4 exempt_check_who;
|
||||
|
||||
switch (zone->GetZoneID()) {
|
||||
case POEARTHB:
|
||||
exempt_check_who.x = 2051; exempt_check_who.y = 407; exempt_check_who.z = -219; //Middle of councilman spawns
|
||||
//exempt_check_other.x = 1455; exempt_check_other.y = 415; exempt_check_other.z = -242;
|
||||
//check to be sure the player and the target are outside of the councilman area
|
||||
//if the player is inside the cove they cannot be higher than the ceiling (no exploiting from uptop)
|
||||
if (GetZ() <= -171 && other->GetZ() <= -171 && DistanceNoZ(other->GetPosition(), exempt_check_who) <= 800 && DistanceNoZ(GetPosition(), exempt_check_who) <= 800) {
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
*/
|
||||
switch (zone->GetZoneID()) {
|
||||
case Zones::POEARTHB:
|
||||
exempt_check_who.x = 2053; exempt_check_who.y = 408; exempt_check_who.z = -219; //Middle of councilman spawns
|
||||
//if the player is inside the cove they cannot be higher than the ceiling (no exploiting from uptop) --- 800 from center of council to furthest corner in cove
|
||||
if (GetZ() <= -171 && other->GetZ() <= -171 && DistanceNoZ(other->GetPosition(), exempt_check_who) <= 800 && DistanceNoZ(GetPosition(), exempt_check_who) <= 800) {
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user