Fixed bug where some NPCs near the wilderness were incorrectly considered to be in the wilderness for aggression checks
This commit is contained in:
@@ -72,7 +72,7 @@ public class AggressiveBehavior {
|
|||||||
}
|
}
|
||||||
if (entity instanceof NPC && target instanceof Player) {
|
if (entity instanceof NPC && target instanceof Player) {
|
||||||
NPC npc = (NPC) entity;
|
NPC npc = (NPC) entity;
|
||||||
if (npc.getAggressiveHandler() != null && npc.getAggressiveHandler().isAllowTolerance() && WildernessZone.getWilderness(npc) == -1) {
|
if (npc.getAggressiveHandler() != null && npc.getAggressiveHandler().isAllowTolerance() && !WildernessZone.isInZone(npc)) {
|
||||||
if (RegionManager.forId(regionId).isTolerated(target.asPlayer())) {
|
if (RegionManager.forId(regionId).isTolerated(target.asPlayer())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,11 +296,10 @@ public final class WildernessZone extends MapZone {
|
|||||||
*/
|
*/
|
||||||
public static boolean isInZone(Entity e) {
|
public static boolean isInZone(Entity e) {
|
||||||
Location l = e.getLocation();
|
Location l = e.getLocation();
|
||||||
for (RegionZone zone : e.getViewport().getRegion().getRegionZones()) {
|
for (ZoneBorders z : INSTANCE.borders) {
|
||||||
if (zone.getZone() == INSTANCE && zone.getBorders().insideBorder(l.getX(), l.getY())) {
|
if (z.insideBorder(e))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user