Fix PvPUtil.isAttackable

This commit is contained in:
Lucwousin
2020-06-28 02:35:37 +02:00
parent 36a0ca4118
commit dcd8f6a837

View File

@@ -24,9 +24,6 @@ import java.util.Comparator;
import java.util.Objects; import java.util.Objects;
import java.util.TreeMap; import java.util.TreeMap;
/**
*
*/
public class PvPUtil public class PvPUtil
{ {
private static final Polygon NOT_WILDERNESS_BLACK_KNIGHTS = new Polygon( // this is black knights castle private static final Polygon NOT_WILDERNESS_BLACK_KNIGHTS = new Polygon( // this is black knights castle
@@ -82,28 +79,19 @@ public class PvPUtil
{ {
int wildernessLevel = 0; int wildernessLevel = 0;
if (!(client.getVar(Varbits.IN_WILDERNESS) == 1
|| WorldType.isPvpWorld(client.getWorldType())
|| WorldType.isDeadmanWorld(client.getWorldType())))
{
return false;
}
if (WorldType.isDeadmanWorld(client.getWorldType())) if (WorldType.isDeadmanWorld(client.getWorldType()))
{ {
return true; return true;
} }
if (WorldType.isPvpWorld(client.getWorldType())) if (WorldType.isPvpWorld(client.getWorldType()))
{ {
if (client.getVar(Varbits.IN_WILDERNESS) != 1) wildernessLevel += 15;
{
return Math.abs(client.getLocalPlayer().getCombatLevel() - player.getCombatLevel()) <= 15;
}
wildernessLevel = 15;
} }
return Math.abs(client.getLocalPlayer().getCombatLevel() - player.getCombatLevel()) if (client.getVar(Varbits.IN_WILDERNESS) == 1)
< (getWildernessLevelFrom(client.getLocalPlayer().getWorldLocation()) + wildernessLevel); {
wildernessLevel += getWildernessLevelFrom(client.getLocalPlayer().getWorldLocation());
}
return wildernessLevel != 0 && Math.abs(client.getLocalPlayer().getCombatLevel() - player.getCombatLevel()) <= wildernessLevel;
} }
public static int calculateRisk(Client client, ItemManager itemManager) public static int calculateRisk(Client client, ItemManager itemManager)