Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2019-11-18 01:27:29 +01:00
31 changed files with 222 additions and 116 deletions

View File

@@ -698,7 +698,16 @@ public enum Varbits
WITHDRAW_X_AMOUNT(3960),
IN_PVP_AREA(8121);
IN_PVP_AREA(8121),
/**
* Twisted league
*/
TWISTED_LEAGUE_RELIC_1(10049),
TWISTED_LEAGUE_RELIC_2(10050),
TWISTED_LEAGUE_RELIC_3(10051),
TWISTED_LEAGUE_RELIC_4(10052),
TWISTED_LEAGUE_RELIC_5(10053);
/**
* The raw varbit ID.

View File

@@ -1,3 +1,27 @@
/*
* Copyright (c) 2018, Tomas Slusny <slusnucky@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.api;
import java.util.Collection;
@@ -36,18 +60,14 @@ public enum WorldType
* Tournament world type.
*/
TOURNAMENT(1 << 25),
/**
* Deadman Tournament world type.
*/
DEADMAN_TOURNAMENT(1 << 26),
/**
* Deadman world type.
*/
DEADMAN(1 << 29),
/**
* Seasonal deadman world type.
* League world type
*/
SEASONAL_DEADMAN(1 << 30);
LEAGUE(1 << 30);
private final int mask;
@@ -58,44 +78,34 @@ public enum WorldType
private static final EnumSet<WorldType> PVP_WORLD_TYPES = EnumSet.of(
DEADMAN,
DEADMAN_TOURNAMENT,
PVP,
SEASONAL_DEADMAN
PVP
);
private static final EnumSet<WorldType> DEADMAN_WORLD_TYPES = EnumSet.of(
DEADMAN,
DEADMAN_TOURNAMENT,
SEASONAL_DEADMAN
DEADMAN
);
private static final EnumSet<WorldType> HIGHRISK_WORLD_TYPES = EnumSet.of(
HIGH_RISK
);
private static final EnumSet<WorldType> ALL_HIGHRISK_WORLD_TYPES = EnumSet.of(
HIGH_RISK,
DEADMAN,
DEADMAN_TOURNAMENT,
SEASONAL_DEADMAN
DEADMAN
);
private static final EnumSet<WorldType> ALL_PVP_WORLD_TYPES = EnumSet.of(
HIGH_RISK,
DEADMAN,
DEADMAN_TOURNAMENT,
PVP,
SEASONAL_DEADMAN
PVP
);
private static final EnumSet<WorldType> ALL_PK_WORLD_TYPES = EnumSet.of(
HIGH_RISK,
DEADMAN,
DEADMAN_TOURNAMENT,
PVP,
SEASONAL_DEADMAN,
BOUNTY
);
);
/**
* Create enum set of world types from mask.
@@ -137,10 +147,10 @@ public enum WorldType
}
/**
* Checks whether a world having a {@link Collection} of {@link WorldType}s is a PVP/DEADMAN/HIGHRISK world.
* 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/DEADMAN/HIGHRISK world, false otherwise.
* @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)
@@ -157,19 +167,19 @@ public enum WorldType
{
return worldTypes.stream().anyMatch(HIGHRISK_WORLD_TYPES::contains);
}
public static boolean isAllHighRiskWorld(final Collection<WorldType> worldTypes)
{
return worldTypes.stream().anyMatch(ALL_HIGHRISK_WORLD_TYPES::contains);
}
public static boolean isAllPvpWorld(final Collection<WorldType> worldTypes)
{
return worldTypes.stream().anyMatch(ALL_PVP_WORLD_TYPES::contains);
}
public static boolean isAllPKWorld(final Collection<WorldType> worldTypes)
{
return worldTypes.stream().anyMatch(ALL_PK_WORLD_TYPES::contains);
}
}
}