Fix PvPUtil.isAttackable
This commit is contained in:
@@ -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
|
||||||
@@ -81,29 +78,20 @@ public class PvPUtil
|
|||||||
public static boolean isAttackable(Client client, Player player)
|
public static boolean isAttackable(Client client, Player player)
|
||||||
{
|
{
|
||||||
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user