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

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