mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 04:56:20 +00:00
move los checks to mob.cpp
This commit is contained in:
@@ -1708,89 +1708,3 @@ void Mob::RogueEvade(Mob *other)
|
|||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Mob::DoLosChecks(Mob* who, Mob* other) {
|
|
||||||
if (!who->CheckLosFN(other) || !who->CheckWaterLoS(other)) {
|
|
||||||
if (who->CheckLosCheatExempt(who, other)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (CheckLosCheat(who, other)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Mob::CheckLosCheat(Mob* who, Mob* other) {
|
|
||||||
if (RuleB(Map, CheckForLoSCheat)) {
|
|
||||||
auto& door_list = entity_list.GetDoorsList();
|
|
||||||
for (auto itr : door_list) {
|
|
||||||
Doors* door = itr.second;
|
|
||||||
if (door && !door->IsDoorOpen() && (door->GetTriggerType() == 255 || door->GetLockpick() != 0 || door->GetKeyItem() != 0 || door->GetNoKeyring() != 0)) {
|
|
||||||
if (DistanceNoZ(who->GetPosition(), door->GetPosition()) <= 50) {
|
|
||||||
auto who_to_door = DistanceNoZ(who->GetPosition(), door->GetPosition());
|
|
||||||
auto other_to_door = DistanceNoZ(other->GetPosition(), door->GetPosition());
|
|
||||||
auto who_to_other = DistanceNoZ(who->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 (RuleB(Map, CheckForLoSCheat)) {
|
|
||||||
// uint8 zone_id = zone->GetZoneID();
|
|
||||||
// // ZoneID, target XYZ, my range from target
|
|
||||||
// //float zone_basic_checks[] = { 6, 36 };
|
|
||||||
// //float zone_basic_x_coord[] = { -295, -179.908 };
|
|
||||||
// //float zone_basic_y_coord[] = { -18, -630.708 };
|
|
||||||
// //float zone_basic_y_coord[] = { 50.97, -69.971 };
|
|
||||||
// //float zone_basic_range_check[] = { 21, 10 };
|
|
||||||
// //if door and target infront, fail
|
|
||||||
// //if door and target behind, fail
|
|
||||||
//
|
|
||||||
// if (zone_id == 103) {
|
|
||||||
// Doors* door_to_check = entity_list.FindDoor(8);
|
|
||||||
// TestDebug("Entered LoSCheat for ZoneID: [{}]", zone_id);
|
|
||||||
// glm::vec4 who_check; who_check.x = 1202; who_check.y = 559; who_check.z = -158.94;
|
|
||||||
// glm::vec4 other_check; other_check.x = 1291; other_check.y = 559; other_check.z = -158.19;
|
|
||||||
// float my_distance = DistanceNoZ(who->GetPosition(), who_check);
|
|
||||||
// float tar_distance = DistanceNoZ(other->GetPosition(), other_check);
|
|
||||||
// float my_range = 16;
|
|
||||||
// float tar_range = 75;
|
|
||||||
// if (my_distance <= my_range && tar_distance <= tar_range && !quest_manager.isdooropen(8)) {
|
|
||||||
// TestDebug("Door is NOT open");
|
|
||||||
// TestDebug("LoSCheat failed");
|
|
||||||
// return false;
|
|
||||||
// }
|
|
||||||
// TestDebug("LoS Check for ZoneID: [{}] was [{}] units for [{}], [{}] units for [{}]", zone_id, my_distance, who->GetCleanName(), tar_distance, other->GetCleanName());
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Mob::CheckLosCheatExempt(Mob* who, Mob* other) {
|
|
||||||
if (RuleB(Map, EnableLoSCheatExemptions)) {
|
|
||||||
glm::vec4 exempt_check_who;
|
|
||||||
glm::vec4 exempt_check_other;
|
|
||||||
/* This is an exmaple of how to configure exemptions for LoS checks.
|
|
||||||
if (zone->GetZoneID() == 222) { //PoEarthB
|
|
||||||
exempt_check_who.x = 2051; exempt_check_who.y = 407; exempt_check_who.z = -219; //Middle of councilman spawns
|
|
||||||
//check to be sure the player and the target are in the pit to PoEarthB
|
|
||||||
//if the player is inside the cove they cannot be higher than the ceiling (no exploiting from uptop)
|
|
||||||
//otherwise they can pass LoS checks even if they don't have true LoS
|
|
||||||
if (who->GetZ() <= -171 && other->GetZ() <= -171 && DistanceNoZ(other->GetPosition(), exempt_check_who) <= 800 && DistanceNoZ(who->GetPosition(), exempt_check_who) <= 800) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -9477,3 +9477,61 @@ bool Mob::IsInGroupOrRaid(Mob *other, bool sameRaidGroup) {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Mob::DoLosChecks(Mob* who, Mob* other) {
|
||||||
|
if (!who->CheckLosFN(other) || !who->CheckWaterLoS(other)) {
|
||||||
|
if (who->CheckLosCheatExempt(who, other)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CheckLosCheat(who, other)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Mob::CheckLosCheat(Mob* who, Mob* other) {
|
||||||
|
if (RuleB(Map, CheckForLoSCheat)) {
|
||||||
|
for (auto itr : entity_list.GetDoorsList()) {
|
||||||
|
Doors* d = itr.second;
|
||||||
|
if (d && !d->IsDoorOpen() && (d->GetTriggerType() == 255 || d->GetLockpick() != 0 || d->GetKeyItem() != 0 || d->GetNoKeyring() != 0)) {
|
||||||
|
if (DistanceNoZ(who->GetPosition(), d->GetPosition()) <= 50) {
|
||||||
|
auto who_to_door = DistanceNoZ(who->GetPosition(), d->GetPosition());
|
||||||
|
auto other_to_door = DistanceNoZ(other->GetPosition(), d->GetPosition());
|
||||||
|
auto who_to_other = DistanceNoZ(who->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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Mob::CheckLosCheatExempt(Mob* who, Mob* other) {
|
||||||
|
if (RuleB(Map, EnableLoSCheatExemptions)) {
|
||||||
|
glm::vec4 exempt_check_who;
|
||||||
|
glm::vec4 exempt_check_other;
|
||||||
|
/* This is an exmaple of how to configure exemptions for LoS checks.
|
||||||
|
if (zone->GetZoneID() == 222) { //PoEarthB
|
||||||
|
exempt_check_who.x = 2051; exempt_check_who.y = 407; exempt_check_who.z = -219; //Middle of councilman spawns
|
||||||
|
//check to be sure the player and the target are in the pit to PoEarthB
|
||||||
|
//if the player is inside the cove they cannot be higher than the ceiling (no exploiting from uptop)
|
||||||
|
//otherwise they can pass LoS checks even if they don't have true LoS
|
||||||
|
if (who->GetZ() <= -171 && other->GetZ() <= -171 && DistanceNoZ(other->GetPosition(), exempt_check_who) <= 800 && DistanceNoZ(who->GetPosition(), exempt_check_who) <= 800) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user