project: Merge upstream (#2049)

project: Merge upstream

Co-authored-by: null <dkvldev@gmail.com>
Co-authored-by: Adam <Adam@sigterm.info>
Co-authored-by: Abex <mii7303@gmail.com>
Co-authored-by: Tomas Slusny <slusnucky@gmail.com>
Co-authored-by: winterdaze <35933468+winterdaze@users.noreply.github.com>
Co-authored-by: null <55587410+emiljensen2@users.noreply.github.com>
Co-authored-by: Seth <sethtroll3@gmail.com>
Co-authored-by: Runelite auto updater <runelite@runelite.net>
This commit is contained in:
Owain van Brakel
2019-11-18 01:48:06 +01:00
committed by GitHub
31 changed files with 222 additions and 116 deletions

View File

@@ -27,9 +27,9 @@ const val kotlinVersion = "1.3.50"
object ProjectVersions {
const val launcherVersion = "2.0.4"
const val rlVersion = "1.5.41-SNAPSHOT"
const val rlVersion = "1.5.41"
const val openosrsVersion = "2.1.13.0-SNAPSHOT"
const val openosrsVersion = "2.1.13.0"
const val rsversion = 185
const val cacheversion = 165

View File

@@ -35,8 +35,7 @@ public enum HiscoreEndpoint
HARDCORE_IRONMAN("Hardcore Ironman", "https://services.runescape.com/m=hiscore_oldschool_hardcore_ironman/index_lite.ws"),
ULTIMATE_IRONMAN("Ultimate Ironman", "https://services.runescape.com/m=hiscore_oldschool_ultimate/index_lite.ws"),
DEADMAN("Deadman", "https://services.runescape.com/m=hiscore_oldschool_deadman/index_lite.ws"),
SEASONAL_DEADMAN("Seasonal Deadman", "https://services.runescape.com/m=hiscore_oldschool_seasonal/index_lite.ws"),
DEADMAN_TOURNAMENT("Deadman Tournament", "https://services.runescape.com/m=hiscore_oldschool_tournament/index_lite.ws");
LEAGUE("Twisted League", "https://services.runescape.com/m=hiscore_oldschool_seasonal/index_lite.ws");
private final String name;
private final HttpUrl hiscoreURL;

View File

@@ -54,6 +54,7 @@ public class HiscoreResult
private Skill runecraft;
private Skill hunter;
private Skill construction;
private Skill leaguePoints;
private Skill bountyHunterHunter;
private Skill bountyHunterRogue;
private Skill clueScrollAll;
@@ -115,6 +116,8 @@ public class HiscoreResult
return getHunter();
case CONSTRUCTION:
return getConstruction();
case LEAGUE_POINTS:
return getLeaguePoints();
case OVERALL:
return getOverall();
case BOUNTY_HUNTER_HUNTER:

View File

@@ -26,8 +26,6 @@ package net.runelite.http.api.hiscore;
import java.util.ArrayList;
import java.util.List;
import net.runelite.http.api.hiscore.HiscoreResult;
import net.runelite.http.api.hiscore.Skill;
public class HiscoreResultBuilder
{
@@ -77,9 +75,9 @@ public class HiscoreResultBuilder
hiscoreResult.setRunecraft(skills.get(21));
hiscoreResult.setHunter(skills.get(22));
hiscoreResult.setConstruction(skills.get(23));
hiscoreResult.setBountyHunterHunter(skills.get(24));
hiscoreResult.setBountyHunterRogue(skills.get(25));
hiscoreResult.setLastManStanding(skills.get(26));
hiscoreResult.setLeaguePoints(skills.get(24));
hiscoreResult.setBountyHunterHunter(skills.get(25));
hiscoreResult.setBountyHunterRogue(skills.get(26));
hiscoreResult.setClueScrollAll(skills.get(27));
hiscoreResult.setClueScrollBeginner(skills.get(28));
hiscoreResult.setClueScrollEasy(skills.get(29));
@@ -87,6 +85,7 @@ public class HiscoreResultBuilder
hiscoreResult.setClueScrollHard(skills.get(31));
hiscoreResult.setClueScrollElite(skills.get(32));
hiscoreResult.setClueScrollMaster(skills.get(33));
hiscoreResult.setLastManStanding(skills.get(34));
return hiscoreResult;
}
}

View File

@@ -50,16 +50,17 @@ public enum HiscoreSkill
RUNECRAFT("Runecraft"),
HUNTER("Hunter"),
CONSTRUCTION("Construction"),
LEAGUE_POINTS("League Points"),
BOUNTY_HUNTER_HUNTER("Bounty Hunter - Hunter"),
BOUNTY_HUNTER_ROGUE("Bounty Hunter - Rogue"),
LAST_MAN_STANDING("Last Man Standing"),
CLUE_SCROLL_ALL("Clue Scrolls (all)"),
CLUE_SCROLL_BEGINNER("Clue Scrolls (beginner)"),
CLUE_SCROLL_EASY("Clue Scrolls (easy)"),
CLUE_SCROLL_MEDIUM("Clue Scrolls (medium)"),
CLUE_SCROLL_HARD("Clue Scrolls (hard)"),
CLUE_SCROLL_ELITE("Clue Scrolls (elite)"),
CLUE_SCROLL_MASTER("Clue Scrolls (master)");
CLUE_SCROLL_MASTER("Clue Scrolls (master)"),
LAST_MAN_STANDING("Last Man Standing");
private final String name;

View File

@@ -34,6 +34,5 @@ public enum WorldType
LAST_MAN_STANDING,
TOURNAMENT,
DEADMAN,
SEASONAL_DEADMAN,
DEADMAN_TOURNAMENT
LEAGUE;
}

View File

@@ -35,9 +35,8 @@ enum ServiceWorldType
HIGH_RISK(WorldType.HIGH_RISK, 1 << 10),
LAST_MAN_STANDING(WorldType.LAST_MAN_STANDING, 1 << 14),
TOURNAMENT(WorldType.TOURNAMENT, 1 << 25),
DEADMAN_TOURNAMENT(WorldType.DEADMAN_TOURNAMENT, 1 << 26),
DEADMAN(WorldType.DEADMAN, 1 << 29),
SEASONAL_DEADMAN(WorldType.SEASONAL_DEADMAN, 1 << 30);
LEAGUE(WorldType.LEAGUE, 1 << 30);
private final WorldType apiType;
private final int mask;

View File

@@ -60,16 +60,17 @@ public class HiscoreServiceTest
+ "638177,1,0\n"
+ "516239,9,1000\n"
+ "492790,1,0\n"
+ "2,2460\n" // leagues
+ "-1,-1\n"
+ "73,1738\n"
+ "-1,-1\n"
+ "531,1432\n"
+ "324,212\n"
+ "8008,131\n"
+ "1337,911\n"
+ "42,14113\n"
+ "1,777\n"
+ "254,92\n";
+ "254,92\n"
+ "-1,-1\n"; // lms
private final MockWebServer server = new MockWebServer();
@@ -105,6 +106,7 @@ public class HiscoreServiceTest
Assert.assertEquals(777, result.getClueScrollElite().getLevel());
Assert.assertEquals(254, result.getClueScrollMaster().getRank());
Assert.assertEquals(-1, result.getLastManStanding().getLevel());
Assert.assertEquals(2460, result.getLeaguePoints().getLevel());
}
}

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);
}
}
}

View File

@@ -192,9 +192,9 @@ public class Notifier
case SOLID_UNTIL_CANCELLED:
case FLASH_UNTIL_CANCELLED:
// Any interaction with the client since the notification started will cancel it after the minimum duration
if (client.getMouseIdleTicks() < MINIMUM_FLASH_DURATION_TICKS
if ((client.getMouseIdleTicks() < MINIMUM_FLASH_DURATION_TICKS
|| client.getKeyboardIdleTicks() < MINIMUM_FLASH_DURATION_TICKS
|| client.getMouseLastPressedMillis() > mouseLastPressedMillis)
|| client.getMouseLastPressedMillis() > mouseLastPressedMillis) && clientUI.isFocused())
{
flashStart = null;
}

View File

@@ -87,6 +87,7 @@ import org.slf4j.LoggerFactory;
public class RuneLite
{
public static final File RUNELITE_DIR = new File(System.getProperty("user.home"), ".runelite");
public static final File CACHE_DIR = new File(RUNELITE_DIR, "cache");
public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles");
public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins");
public static final File SCREENSHOT_DIR = new File(RUNELITE_DIR, "screenshots");

View File

@@ -75,7 +75,7 @@ public class RuneLiteModule extends AbstractModule
bindConstant().annotatedWith(Names.named("developerMode")).to(developerMode);
bind(ScheduledExecutorService.class).toInstance(new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor()));
bind(OkHttpClient.class).toInstance(RuneLiteAPI.CLIENT.newBuilder()
.cache(new Cache(new File(RuneLite.RUNELITE_DIR, "cache" + File.separator + "okhttp"), MAX_OKHTTP_CACHE_SIZE))
.cache(new Cache(new File(RuneLite.CACHE_DIR, "okhttp"), MAX_OKHTTP_CACHE_SIZE))
.build());
bind(MenuManager.class);
bind(ChatMessageManager.class);

View File

@@ -108,7 +108,7 @@ public class AttackStylesPlugin extends Plugin
private boolean warnForRanged;
private boolean warnForMagic;
private boolean hideAutoRetaliate;
private boolean removeWarnedStyles;
boolean removeWarnedStyles;
@Override
protected void startUp() throws Exception
@@ -170,7 +170,7 @@ public class AttackStylesPlugin extends Plugin
return warnedSkillSelected;
}
private void onWidgetHiddenChanged(WidgetHiddenChanged event)
void onWidgetHiddenChanged(WidgetHiddenChanged event)
{
if (event.getWidget().isSelfHidden() || TO_GROUP(event.getWidget().getId()) != COMBAT_GROUP_ID)
{

View File

@@ -28,6 +28,7 @@ package net.runelite.client.plugins.chatcommands;
import com.google.inject.Provides;
import io.reactivex.schedulers.Schedulers;
import java.io.IOException;
import java.util.EnumSet;
import java.util.List;
import java.util.concurrent.ScheduledExecutorService;
import java.util.regex.Matcher;
@@ -42,8 +43,10 @@ import net.runelite.api.Experience;
import net.runelite.api.IconID;
import net.runelite.api.ItemDefinition;
import net.runelite.api.MessageNode;
import net.runelite.api.Player;
import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits;
import net.runelite.api.WorldType;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.VarbitChanged;
@@ -1157,31 +1160,28 @@ public class ChatCommandsPlugin extends Plugin
*/
private HiscoreLookup getCorrectLookupFor(final ChatMessage chatMessage)
{
final String player;
final HiscoreEndpoint ironmanStatus;
Player localPlayer = client.getLocalPlayer();
final String player = sanitize(chatMessage.getName());
if (chatMessage.getType().equals(ChatMessageType.PRIVATECHATOUT))
// If we are sending the message then just use the local hiscore endpoint for the world
if (chatMessage.getType().equals(ChatMessageType.PRIVATECHATOUT)
|| player.equals(localPlayer.getName()))
{
player = client.getLocalPlayer().getName();
ironmanStatus = hiscoreEndpoint;
return new HiscoreLookup(localPlayer.getName(), hiscoreEndpoint);
}
else
{
player = sanitize(chatMessage.getName());
if (player.equals(client.getLocalPlayer().getName()))
// Public chat on a leagues world is always league hiscores, regardless of icon
if (chatMessage.getType() == ChatMessageType.PUBLICCHAT || chatMessage.getType() == ChatMessageType.MODCHAT)
{
if (client.getWorldType().contains(WorldType.LEAGUE))
{
// Get ironman status from for the local player
ironmanStatus = hiscoreEndpoint;
}
else
{
// Get ironman status from their icon in chat
ironmanStatus = getHiscoreEndpointByName(chatMessage.getName());
return new HiscoreLookup(player, HiscoreEndpoint.LEAGUE);
}
}
return new HiscoreLookup(player, ironmanStatus);
// Get ironman status from their icon in chat
HiscoreEndpoint endpoint = getHiscoreEndpointByName(chatMessage.getName());
return new HiscoreLookup(player, endpoint);
}
/**
@@ -1220,6 +1220,12 @@ public class ChatCommandsPlugin extends Plugin
*/
private HiscoreEndpoint getLocalHiscoreEndpointType()
{
EnumSet<WorldType> worldType = client.getWorldType();
if (worldType.contains(WorldType.LEAGUE))
{
return HiscoreEndpoint.LEAGUE;
}
return toEndPoint(client.getAccountType());
}

View File

@@ -68,6 +68,10 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat
"Jorral",
"Speak to Jorral to receive a strange device.",
new WorldPoint(2436, 3347, 0));
private static final HotColdClue MASTER_CLUE_LEAGUE = new HotColdClue("Buried beneath the ground, who knows where it's found. Lucky for you, A man called Watson may have a clue.",
"Watson",
"Speak to Watson to receive a strange device.",
new WorldPoint(1645, 3572, 0));
private final String text;
private final String npc;
@@ -89,6 +93,11 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat
MASTER_CLUE.reset();
return MASTER_CLUE;
}
else if (MASTER_CLUE_LEAGUE.text.equalsIgnoreCase(text))
{
MASTER_CLUE_LEAGUE.reset();
return MASTER_CLUE_LEAGUE;
}
return null;
}
@@ -272,11 +281,11 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat
final Set<HotColdTemperature> temperatureSet;
if (this.equals(BEGINNER_CLUE))
if (this == BEGINNER_CLUE)
{
temperatureSet = HotColdTemperature.BEGINNER_HOT_COLD_TEMPERATURES;
}
else if (this.equals(MASTER_CLUE))
else if (this == MASTER_CLUE || this == MASTER_CLUE_LEAGUE)
{
temperatureSet = HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES;
}
@@ -300,8 +309,9 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat
return false;
}
if ((this.equals(BEGINNER_CLUE) && temperature == HotColdTemperature.BEGINNER_VISIBLY_SHAKING)
|| (this.equals(MASTER_CLUE) && temperature == HotColdTemperature.MASTER_VISIBLY_SHAKING))
boolean master = this == MASTER_CLUE || this == MASTER_CLUE_LEAGUE;
if ((this == BEGINNER_CLUE && temperature == HotColdTemperature.BEGINNER_VISIBLY_SHAKING)
|| (master && temperature == HotColdTemperature.MASTER_VISIBLY_SHAKING))
{
markFinalSpot(localWorld);
}
@@ -327,11 +337,11 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat
{
final boolean isBeginner;
if (this.equals(BEGINNER_CLUE))
if (this == BEGINNER_CLUE)
{
isBeginner = true;
}
else if (this.equals(MASTER_CLUE))
else if (this == MASTER_CLUE || this == MASTER_CLUE_LEAGUE)
{
isBeginner = false;
}

View File

@@ -79,6 +79,7 @@ public class DeathIndicatorPlugin extends Plugin
static final int HIJACKED_ITEMID = 0x69696969;
private static final Set<Integer> RESPAWN_REGIONS = ImmutableSet.of(
6457, // Kourend
12850, // Lumbridge
11828, // Falador
12342, // Edgeville

View File

@@ -82,6 +82,7 @@ import static net.runelite.http.api.hiscore.HiscoreSkill.HERBLORE;
import static net.runelite.http.api.hiscore.HiscoreSkill.HITPOINTS;
import static net.runelite.http.api.hiscore.HiscoreSkill.HUNTER;
import static net.runelite.http.api.hiscore.HiscoreSkill.LAST_MAN_STANDING;
import static net.runelite.http.api.hiscore.HiscoreSkill.LEAGUE_POINTS;
import static net.runelite.http.api.hiscore.HiscoreSkill.MAGIC;
import static net.runelite.http.api.hiscore.HiscoreSkill.MINING;
import static net.runelite.http.api.hiscore.HiscoreSkill.OVERALL;
@@ -275,6 +276,7 @@ public class HiscorePanel extends PluginPanel
minigamePanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
minigamePanel.add(makeSkillPanel(CLUE_SCROLL_ALL));
minigamePanel.add(makeSkillPanel(LEAGUE_POINTS));
minigamePanel.add(makeSkillPanel(LAST_MAN_STANDING));
minigamePanel.add(makeSkillPanel(BOUNTY_HUNTER_ROGUE));
minigamePanel.add(makeSkillPanel(BOUNTY_HUNTER_HUNTER));
@@ -470,15 +472,17 @@ public class HiscorePanel extends PluginPanel
case 0:
return null;
case 1:
return HiscoreSkill.OVERALL;
return OVERALL;
case 2:
return HiscoreSkill.CLUE_SCROLL_ALL;
return CLUE_SCROLL_ALL;
case 3:
return HiscoreSkill.LAST_MAN_STANDING;
return LEAGUE_POINTS;
case 4:
return HiscoreSkill.BOUNTY_HUNTER_ROGUE;
return LAST_MAN_STANDING;
case 5:
return HiscoreSkill.BOUNTY_HUNTER_HUNTER;
return BOUNTY_HUNTER_ROGUE;
case 6:
return BOUNTY_HUNTER_HUNTER;
}
return null;
@@ -562,6 +566,12 @@ public class HiscorePanel extends PluginPanel
content += "<p><span style = 'color:white'>Rank:</span> " + rank + "</p>";
break;
}
case LEAGUE_POINTS:
{
String rank = (result.getLeaguePoints().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getLeaguePoints().getRank());
content += "<p><span style = 'color:white'>Rank:</span> " + rank + "</p>";
break;
}
case OVERALL:
{
Skill requestedSkill = result.getSkill(skill);
@@ -651,18 +661,14 @@ public class HiscorePanel extends PluginPanel
{
EnumSet<WorldType> wTypes = client.getWorldType();
if (wTypes.contains(WorldType.DEADMAN_TOURNAMENT))
{
return HiscoreEndpoint.DEADMAN_TOURNAMENT;
}
else if (wTypes.contains(WorldType.SEASONAL_DEADMAN))
{
return HiscoreEndpoint.SEASONAL_DEADMAN;
}
else if (wTypes.contains(WorldType.DEADMAN))
if (wTypes.contains(WorldType.DEADMAN))
{
return HiscoreEndpoint.DEADMAN;
}
else if (wTypes.contains(WorldType.LEAGUE))
{
return HiscoreEndpoint.LEAGUE;
}
}
return HiscoreEndpoint.NORMAL;
}

View File

@@ -950,7 +950,7 @@ public class IdleNotifierPlugin extends Plugin
final Player local = client.getLocalPlayer();
SkullIcon currentTickSkull = local.getSkullIcon();
EnumSet worldTypes = client.getWorldType();
if (!(worldTypes.contains(WorldType.DEADMAN) || worldTypes.contains(WorldType.SEASONAL_DEADMAN)))
if (!(worldTypes.contains(WorldType.DEADMAN)))
{
if (!isFirstTick)
{

View File

@@ -279,7 +279,7 @@ public class MultiIndicatorsPlugin extends Plugin
private void findLinesInScene()
{
inDeadman = client.getWorldType().stream().anyMatch(x ->
x == WorldType.DEADMAN || x == WorldType.SEASONAL_DEADMAN);
x == WorldType.DEADMAN);
inPvp = client.getWorldType().stream().anyMatch(x ->
x == WorldType.PVP || x == WorldType.HIGH_RISK);

View File

@@ -184,18 +184,14 @@ public class OpponentInfoPlugin extends Plugin
}
final EnumSet<WorldType> worldType = client.getWorldType();
if (worldType.contains(WorldType.DEADMAN_TOURNAMENT))
{
hiscoreEndpoint = HiscoreEndpoint.DEADMAN_TOURNAMENT;
}
else if (worldType.contains(WorldType.SEASONAL_DEADMAN))
{
hiscoreEndpoint = HiscoreEndpoint.SEASONAL_DEADMAN;
}
else if (worldType.contains(WorldType.DEADMAN))
if (worldType.contains(WorldType.DEADMAN))
{
hiscoreEndpoint = HiscoreEndpoint.DEADMAN;
}
else if (worldType.contains(WorldType.LEAGUE))
{
hiscoreEndpoint = HiscoreEndpoint.LEAGUE;
}
else
{
hiscoreEndpoint = HiscoreEndpoint.NORMAL;

View File

@@ -709,16 +709,16 @@ public class ScreenshotPlugin extends Plugin
if (client.getLocalPlayer() != null && client.getLocalPlayer().getName() != null)
{
final EnumSet<WorldType> worldTypes = client.getWorldType();
final boolean dmm = worldTypes.contains(WorldType.DEADMAN);
final boolean sdmm = worldTypes.contains(WorldType.SEASONAL_DEADMAN);
final boolean dmmt = worldTypes.contains(WorldType.DEADMAN_TOURNAMENT);
final boolean isDmmWorld = dmm || sdmm || dmmt;
String playerDir = client.getLocalPlayer().getName();
if (isDmmWorld)
if (worldTypes.contains(WorldType.DEADMAN))
{
playerDir += "-Deadman";
}
else if (worldTypes.contains(WorldType.LEAGUE))
{
playerDir += "-League";
}
playerFolder = new File(SCREENSHOT_DIR, playerDir);
}
else

View File

@@ -80,6 +80,7 @@ public class StatusOrbsPlugin extends Plugin
private static final int SPEC_REGEN_TICKS = 50;
private static final int NORMAL_HP_REGEN_TICKS = 100;
private static final int TWISTED_LEAGUE_ENDLESS_ENDURANCE_RELIC = 2;
@Inject
private Client client;
@@ -258,6 +259,12 @@ public class StatusOrbsPlugin extends Plugin
hpPerMs *= 2;
}
if (client.getVar(Varbits.TWISTED_LEAGUE_RELIC_1) == TWISTED_LEAGUE_ENDLESS_ENDURANCE_RELIC)
{
ticksPerHPRegen /= 4;
hpPerMs *= 4;
}
ticksSinceHPRegen = (ticksSinceHPRegen + 1) % ticksPerHPRegen;
hitpointsPercentage = ticksSinceHPRegen / (double) ticksPerHPRegen;

View File

@@ -582,9 +582,7 @@ public class TimersPlugin extends Plugin
}
else if (HALF_TELEBLOCK_PATTERN.matcher(event.getMessage()).find())
{
if (client.getWorldType().contains(WorldType.DEADMAN)
&& !client.getWorldType().contains(WorldType.SEASONAL_DEADMAN)
&& !client.getWorldType().contains(WorldType.DEADMAN_TOURNAMENT))
if (client.getWorldType().contains(WorldType.DEADMAN))
{
createGameTimer(DMM_FULLTB);
}

View File

@@ -64,6 +64,7 @@ class WorldTableRow extends JPanel
private static final Color TOURNAMENT_WORLD = new Color(79, 145, 255);
private static final Color MEMBERS_WORLD = new Color(210, 193, 53);
private static final Color FREE_WORLD = new Color(200, 200, 200);
private static final Color LEAGUE_WORLD = new Color(157, 237, 1);
static
{
@@ -247,11 +248,14 @@ class WorldTableRow extends JPanel
}
else if (world.getTypes().contains(WorldType.PVP)
|| world.getTypes().contains(WorldType.HIGH_RISK)
|| world.getTypes().contains(WorldType.DEADMAN)
|| world.getTypes().contains(WorldType.SEASONAL_DEADMAN))
|| world.getTypes().contains(WorldType.DEADMAN))
{
activityField.setForeground(DANGEROUS_WORLD);
}
else if (world.getTypes().contains(WorldType.LEAGUE))
{
activityField.setForeground(LEAGUE_WORLD);
}
else if (world.getTypes().contains(WorldType.TOURNAMENT))
{
activityField.setForeground(TOURNAMENT_WORLD);

View File

@@ -31,8 +31,7 @@ enum XpWorldType
NORMAL,
TOURNEY,
DMM,
SDMM,
DMMT;
LEAGUE;
static XpWorldType of(WorldType type)
{
@@ -42,10 +41,8 @@ enum XpWorldType
return TOURNEY;
case DEADMAN:
return DMM;
case SEASONAL_DEADMAN:
return SDMM;
case DEADMAN_TOURNAMENT:
return DMMT;
case LEAGUE:
return LEAGUE;
default:
return NORMAL;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 311 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

View File

@@ -33,6 +33,7 @@ import net.runelite.api.Client;
import net.runelite.api.Skill;
import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits;
import net.runelite.api.events.WidgetHiddenChanged;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.VarbitChanged;
import net.runelite.api.widgets.Widget;
@@ -44,8 +45,11 @@ import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import static org.mockito.Mockito.atLeastOnce;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.mockito.junit.MockitoJUnitRunner;
@@ -174,6 +178,61 @@ public class AttackStylesPluginTest
WidgetInfo.COMBAT_STYLE_THREE));
}
/*
* Verify that the defensive style is hidden when switching from bludgeon to bow
*/
@Test
public void testHiddenLongrange()
{
final ArgumentCaptor<Boolean> captor = ArgumentCaptor.forClass(Boolean.class);
final ConfigChanged warnForAttackEvent = new ConfigChanged();
warnForAttackEvent.setGroup("attackIndicator");
warnForAttackEvent.setKey("warnForDefensive");
warnForAttackEvent.setNewValue("true");
attackPlugin.onConfigChanged(warnForAttackEvent);
// verify there is a warned skill
Set<Skill> warnedSkills = attackPlugin.getWarnedSkills();
assertTrue(warnedSkills.contains(Skill.DEFENCE));
// Set up mock widget for strength and longrange
final Widget widget = mock(Widget.class);
when(client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR)).thenReturn(widget);
// Set up hidden changed event
final WidgetHiddenChanged widgetHiddenChanged = new WidgetHiddenChanged();
widgetHiddenChanged.setWidget(widget);
when(widget.getId()).thenReturn(WidgetInfo.COMBAT_STYLE_FOUR.getPackedId());
// Enable hiding widgets
final ConfigChanged hideWidgetEvent = new ConfigChanged();
hideWidgetEvent.setGroup("attackIndicator");
hideWidgetEvent.setKey("removeWarnedStyles");
hideWidgetEvent.setNewValue("true");
attackPlugin.onConfigChanged(hideWidgetEvent);
attackPlugin.removeWarnedStyles = true;
// equip bludgeon on player
when(client.getVar(Varbits.EQUIPPED_WEAPON_TYPE)).thenReturn(WeaponType.TYPE_26.ordinal());
attackPlugin.onVarbitChanged(new VarbitChanged());
attackPlugin.onWidgetHiddenChanged(widgetHiddenChanged);
// verify that the agressive style style widget is showing
verify(widget, atLeastOnce()).setHidden(captor.capture());
assertFalse(captor.getValue());
// equip bow on player
// the equipped weaopn varbit will change after the hiddenChanged event has been dispatched
attackPlugin.onWidgetHiddenChanged(widgetHiddenChanged);
when(client.getVar(Varbits.EQUIPPED_WEAPON_TYPE)).thenReturn(WeaponType.TYPE_3.ordinal());
attackPlugin.onVarbitChanged(new VarbitChanged());
// verify that the longrange attack style widget is now hidden
verify(widget, atLeastOnce()).setHidden(captor.capture());
System.out.println(captor.getValue());
assertTrue(captor.getValue());
}
private boolean isAtkHidden()
{
if (attackPlugin.getHiddenWidgets().size() == 0)