Merge pull request #3847 from Nightfirecat/remove-teleblock-timer-in-safe-zones

Remove teleblock timer in safe zones
This commit is contained in:
Tomas Slusny
2018-09-24 10:29:42 +02:00
committed by GitHub
5 changed files with 131 additions and 21 deletions

View File

@@ -211,6 +211,12 @@ public enum Varbits
*/
IN_GAME_BA(3923),
/**
* 0 = Outside wilderness
* 1 = In wilderness
*/
IN_WILDERNESS(5963),
/**
* Fishing Trawler
* FISHING_TRAWLER_ACTIVITY Expected values: 0-255

View File

@@ -24,6 +24,7 @@
*/
package net.runelite.api;
import java.util.Collection;
import java.util.EnumSet;
/**
@@ -75,6 +76,13 @@ public enum WorldType
this.mask = mask;
}
private static EnumSet<WorldType> PVP_WORLD_TYPES = EnumSet.of(
DEADMAN,
PVP,
PVP_HIGH_RISK,
SEASONAL_DEADMAN
);
/**
* Create enum set of world types from mask.
*
@@ -113,4 +121,16 @@ public enum WorldType
return mask;
}
}
/**
* Checks whether a world having a {@link Collection} of {@link WorldType}s is a PVP world.
*
* @param worldTypes A {@link Collection} of {@link WorldType}s describing the given world.
* @return True if the given worldtypes of the world are a PVP world, false otherwise.
* @see Client#getWorldType()
*/
public static boolean isPvpWorld(final Collection<WorldType> worldTypes)
{
return worldTypes.stream().anyMatch(PVP_WORLD_TYPES::contains);
}
}

View File

@@ -117,6 +117,7 @@ public class WidgetID
public static final int FOSSIL_ISLAND_OXYGENBAR_ID = 609;
public static final int MINIGAME_TAB_ID = 76;
public static final int SPELLBOOK_GROUP_ID = 218;
public static final int PVP_GROUP_ID = 90;
static class WorldMap
{
@@ -679,4 +680,15 @@ public class WidgetID
{
static final int ARCEUUS_HOME_TELEPORT = 145;
}
}
static class Pvp
{
static final int PVP_WIDGET_CONTAINER = 50;
static final int SKULL_CONTAINER = 51;
static final int SKULL = 52;
static final int SAFE_ZONE = 53;
static final int ATTACK_RANGE = 55;
static final int WILDERNESS_LEVEL = 56; // this can also be the Deadman Mode "Protection" text
static final int DEADMAN_PROTECTION_TIME = 57;
}
}

View File

@@ -414,7 +414,18 @@ public enum WidgetInfo
SPELL_LUMBRIDGE_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.StandardSpellBook.LUMBRIDGE_HOME_TELEPORT),
SPELL_EDGEVILLE_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.AncientSpellBook.EDGEVILLE_HOME_TELEPORT),
SPELL_LUNAR_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.LunarSpellBook.LUNAR_HOME_TELEPORT),
SPELL_ARCEUUS_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.ArceuusSpellBook.ARCEUUS_HOME_TELEPORT);
SPELL_ARCEUUS_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.ArceuusSpellBook.ARCEUUS_HOME_TELEPORT),
PVP_CONTAINER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.PVP_WIDGET_CONTAINER),
PVP_SKULL_CONTAINER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SKULL_CONTAINER),
PVP_SKULL(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SKULL),
PVP_WILDERNESS_LEVEL(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.ATTACK_RANGE),
PVP_WORLD_SAFE_ZONE(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SAFE_ZONE),
PVP_WORLD_ATTACK_RANGE(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.ATTACK_RANGE),
DEADMAN_PROTECTION_TEXT(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.WILDERNESS_LEVEL),
DEADMAN_PROTECTION_TIME(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.DEADMAN_PROTECTION_TIME);
private final int groupId;
private final int childId;