Merge pull request #802 from runelite-extended/revert-800-upstreamyboy

Revert "Upstreamyboy"
This commit is contained in:
Ganom
2019-06-28 18:59:02 -04:00
committed by GitHub
39 changed files with 96 additions and 470 deletions

View File

@@ -64,7 +64,7 @@ public class AreaDumper
for (AreaDefinition area : areaManager.getAreas())
{
Files.asCharSink(new File(outDir, area.id + ".json"), Charset.defaultCharset()).write(gson.toJson(area));
Files.write(gson.toJson(area), new File(outDir, area.id + ".json"), Charset.defaultCharset());
++count;
}
}

View File

@@ -80,7 +80,7 @@ public class EnumDumperTest
if (def != null)
{
Files.asCharSink(new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(def));
Files.write(gson.toJson(def), new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset());
++count;
}
}

View File

@@ -101,7 +101,7 @@ public class FrameDumper
frames.add(frame);
}
Files.asCharSink(new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()).write(gson.toJson(frames));
Files.write(gson.toJson(frames), new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset());
++count;
}
}

View File

@@ -74,7 +74,7 @@ public class FramemapDumper
FramemapLoader loader = new FramemapLoader();
FramemapDefinition framemap = loader.load(0, contents);
Files.asCharSink(new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()).write(gson.toJson(framemap));
Files.write(gson.toJson(framemap), new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset());
++count;
}
}

View File

@@ -77,7 +77,7 @@ public class InventoryDumper
InventoryLoader loader = new InventoryLoader();
InventoryDefinition inv = loader.load(file.getFileId(), file.getContents());
Files.asCharSink(new File(outDir, inv.id + ".json"), Charset.defaultCharset()).write(gson.toJson(inv));
Files.write(gson.toJson(inv), new File(outDir, inv.id + ".json"), Charset.defaultCharset());
++count;
}
}

View File

@@ -78,7 +78,7 @@ public class KitDumperTest
KitDefinition def = loader.load(file.getFileId(), b);
Files.asCharSink(new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(def));
Files.write(gson.toJson(def), new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset());
++count;
}
}

View File

@@ -77,7 +77,7 @@ public class OverlayDumper
OverlayLoader loader = new OverlayLoader();
OverlayDefinition overlay = loader.load(file.getFileId(), file.getContents());
Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(overlay));
Files.write(gson.toJson(overlay), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
++count;
}
}

View File

@@ -77,7 +77,7 @@ public class SequenceDumper
SequenceLoader loader = new SequenceLoader();
SequenceDefinition seq = loader.load(file.getFileId(), file.getContents());
Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(seq));
Files.write(gson.toJson(seq), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
++count;
}
}

View File

@@ -71,7 +71,7 @@ public class SoundEffectsDumperTest
SoundEffectLoader soundEffectLoader = new SoundEffectLoader();
SoundEffectDefinition soundEffect = soundEffectLoader.load(contents);
Files.asCharSink(new File(dumpDir, archive.getArchiveId() + ".json"), Charset.defaultCharset()).write(gson.toJson(soundEffect));
Files.write(gson.toJson(soundEffect), new File(dumpDir, archive.getArchiveId() + ".json"), Charset.defaultCharset());
++count;
}
}

View File

@@ -64,7 +64,7 @@ public class StructManagerTest
{
StructDefinition def = struct.getValue();
Files.asCharSink(new File(dumpDir, struct.getKey() + ".json"), Charset.defaultCharset()).write(gson.toJson(def));
Files.write(gson.toJson(def), new File(dumpDir, struct.getKey() + ".json"), Charset.defaultCharset());
++count;
}
}

View File

@@ -64,7 +64,7 @@ public class TextureDumper
for (TextureDefinition texture : tm.getTextures())
{
Files.asCharSink(new File(outDir, texture.getId() + ".json"), Charset.defaultCharset()).write(gson.toJson(texture));
Files.write(gson.toJson(texture), new File(outDir, texture.getId() + ".json"), Charset.defaultCharset());
++count;
}
}

View File

@@ -77,7 +77,7 @@ public class UnderlayDumper
UnderlayLoader loader = new UnderlayLoader();
UnderlayDefinition underlay = loader.load(file.getFileId(), file.getContents());
Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(underlay));
Files.write(gson.toJson(underlay), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
++count;
}
}

View File

@@ -77,7 +77,7 @@ public class VarbitDumper
VarbitLoader loader = new VarbitLoader();
VarbitDefinition varbit = loader.load(file.getFileId(), file.getContents());
Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(varbit));
Files.write(gson.toJson(varbit), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
++count;
}
}

View File

@@ -77,7 +77,7 @@ public class WorldMapDumperTest
WorldMapLoader loader = new WorldMapLoader();
WorldMapDefinition def = loader.load(file.getContents(), file.getFileId());
Files.asCharSink(new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset()).write(gson.toJson(def));
Files.write(gson.toJson(def), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
++count;
}
}

View File

@@ -39,8 +39,8 @@ import okhttp3.Response;
public class ChatClient
{
private static final Predicate<String> LAYOUT_VALIDATOR = Pattern
.compile("\\[[A-Z]+]:(\\s*\\w+\\s*(\\([A-Za-z]+\\))?,?)+")
.asPredicate();
.compile("\\[[A-Z]+]:(\\s*\\w+\\s*(\\([A-Za-z]+\\))?,?)+")
.asPredicate();
public boolean submitKc(String username, String boss, int kc) throws IOException
{
@@ -237,7 +237,7 @@ public class ChatClient
.url(url)
.build();
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute())
{
return response.isSuccessful();
}
@@ -273,16 +273,16 @@ public class ChatClient
}
HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder()
.addPathSegment("chat")
.addPathSegment("layout")
.addQueryParameter("name", username)
.addQueryParameter("layout", layout)
.build();
.addPathSegment("chat")
.addPathSegment("layout")
.addQueryParameter("name", username)
.addQueryParameter("layout", layout)
.build();
Request request = new Request.Builder()
.post(RequestBody.create(null, new byte[0]))
.url(url)
.build();
.post(RequestBody.create(null, new byte[0]))
.url(url)
.build();
try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute())
{
@@ -290,40 +290,17 @@ public class ChatClient
}
}
public boolean submitDuels(String username, int wins, int losses, int winningStreak, int losingStreak) throws IOException
{
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
.addPathSegment("chat")
.addPathSegment("duels")
.addQueryParameter("name", username)
.addQueryParameter("wins", Integer.toString(wins))
.addQueryParameter("losses", Integer.toString(losses))
.addQueryParameter("winningStreak", Integer.toString(winningStreak))
.addQueryParameter("losingStreak", Integer.toString(losingStreak))
.build();
Request request = new Request.Builder()
.post(RequestBody.create(null, new byte[0]))
.url(url)
.build();
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
{
return response.isSuccessful();
}
}
public String getLayout(String username) throws IOException
{
HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder()
.addPathSegment("chat")
.addPathSegment("layout")
.addQueryParameter("name", username)
.build();
.addPathSegment("chat")
.addPathSegment("layout")
.addQueryParameter("name", username)
.build();
Request request = new Request.Builder()
.url(url)
.build();
.url(url)
.build();
try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute())
{
@@ -351,15 +328,15 @@ public class ChatClient
public House[] getHosts(int world, String location) throws IOException
{
HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder()
.addPathSegment("chat")
.addPathSegment("hosts")
.addQueryParameter("world", Integer.toString(world))
.addQueryParameter("location", location)
.build();
.addPathSegment("chat")
.addPathSegment("hosts")
.addQueryParameter("world", Integer.toString(world))
.addQueryParameter("location", location)
.build();
Request request = new Request.Builder()
.url(url)
.build();
.url(url)
.build();
try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute())
{
@@ -370,35 +347,6 @@ public class ChatClient
InputStream in = response.body().byteStream();
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), House[].class);
}
catch (JsonParseException ex)
{
throw new IOException(ex);
}
}
public Duels getDuels(String username) throws IOException
{
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
.addPathSegment("chat")
.addPathSegment("duels")
.addQueryParameter("name", username)
.build();
Request request = new Request.Builder()
.url(url)
.build();
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
{
if (!response.isSuccessful())
{
throw new IOException("Unable to look up duels!");
}
InputStream in = response.body().byteStream();
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), Duels.class);
}
catch (JsonParseException ex)
{
@@ -409,24 +357,24 @@ public class ChatClient
public boolean submitHost(int world, String location, House house) throws IOException
{
HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder()
.addPathSegment("chat")
.addPathSegment("hosts")
.addQueryParameter("world", Integer.toString(world))
.addQueryParameter("location", location)
.addQueryParameter("owner", house.getOwner())
.addQueryParameter("guildedAltar", Boolean.toString(house.isGuildedAltarPresent()))
.addQueryParameter("occultAltar", Boolean.toString(house.isOccultAltarPresent()))
.addQueryParameter("spiritTree", Boolean.toString(house.isSpiritTreePresent()))
.addQueryParameter("fairyRing", Boolean.toString(house.isFairyRingPresent()))
.addQueryParameter("wildernessObelisk", Boolean.toString(house.isWildernessObeliskPresent()))
.addQueryParameter("repairStand", Boolean.toString(house.isRepairStandPresent()))
.addQueryParameter("combatDummy", Boolean.toString(house.isCombatDummyPresent()))
.build();
.addPathSegment("chat")
.addPathSegment("hosts")
.addQueryParameter("world", Integer.toString(world))
.addQueryParameter("location", location)
.addQueryParameter("owner", house.getOwner())
.addQueryParameter("guildedAltar", Boolean.toString(house.isGuildedAltarPresent()))
.addQueryParameter("occultAltar", Boolean.toString(house.isOccultAltarPresent()))
.addQueryParameter("spiritTree", Boolean.toString(house.isSpiritTreePresent()))
.addQueryParameter("fairyRing", Boolean.toString(house.isFairyRingPresent()))
.addQueryParameter("wildernessObelisk", Boolean.toString(house.isWildernessObeliskPresent()))
.addQueryParameter("repairStand", Boolean.toString(house.isRepairStandPresent()))
.addQueryParameter("combatDummy", Boolean.toString(house.isCombatDummyPresent()))
.build();
Request request = new Request.Builder()
.post(RequestBody.create(null, new byte[0]))
.url(url)
.build();
.post(RequestBody.create(null, new byte[0]))
.url(url)
.build();
try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute())
{
@@ -437,29 +385,29 @@ public class ChatClient
public boolean removeHost(int world, String location, House house) throws IOException
{
HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder()
.addPathSegment("chat")
.addPathSegment("hosts")
.addQueryParameter("world", Integer.toString(world))
.addQueryParameter("location", location)
.addQueryParameter("owner", house.getOwner())
.addQueryParameter("guildedAltar", Boolean.toString(house.isGuildedAltarPresent()))
.addQueryParameter("occultAltar", Boolean.toString(house.isOccultAltarPresent()))
.addQueryParameter("spiritTree", Boolean.toString(house.isSpiritTreePresent()))
.addQueryParameter("fairyRing", Boolean.toString(house.isFairyRingPresent()))
.addQueryParameter("wildernessObelisk", Boolean.toString(house.isWildernessObeliskPresent()))
.addQueryParameter("repairStand", Boolean.toString(house.isRepairStandPresent()))
.addQueryParameter("combatDummy", Boolean.toString(house.isCombatDummyPresent()))
.addQueryParameter("remove", Boolean.toString(true))
.build();
.addPathSegment("chat")
.addPathSegment("hosts")
.addQueryParameter("world", Integer.toString(world))
.addQueryParameter("location", location)
.addQueryParameter("owner", house.getOwner())
.addQueryParameter("guildedAltar", Boolean.toString(house.isGuildedAltarPresent()))
.addQueryParameter("occultAltar", Boolean.toString(house.isOccultAltarPresent()))
.addQueryParameter("spiritTree", Boolean.toString(house.isSpiritTreePresent()))
.addQueryParameter("fairyRing", Boolean.toString(house.isFairyRingPresent()))
.addQueryParameter("wildernessObelisk", Boolean.toString(house.isWildernessObeliskPresent()))
.addQueryParameter("repairStand", Boolean.toString(house.isRepairStandPresent()))
.addQueryParameter("combatDummy", Boolean.toString(house.isCombatDummyPresent()))
.addQueryParameter("remove", Boolean.toString(true))
.build();
Request request = new Request.Builder()
.post(RequestBody.create(null, new byte[0]))
.url(url)
.build();
.post(RequestBody.create(null, new byte[0]))
.url(url)
.build();
try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute())
{
return response.isSuccessful();
}
}
}
}

View File

@@ -1,36 +0,0 @@
/*
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* 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.http.api.chat;
import lombok.Data;
@Data
public class Duels
{
private int wins;
private int losses;
private int winningStreak;
private int losingStreak;
}

View File

@@ -100,4 +100,4 @@ public class ChatController
{
return chatService.getHosts(world, location);
}
}
}

View File

@@ -117,4 +117,4 @@ public class ChatService
jedis.lrem(key, 0, json);
}
}
}
}

View File

@@ -1626,10 +1626,6 @@ public interface Client extends GameShell
* Returns client item composition cache
*/
NodeCache getItemDefinitionCache();
/**
* Returns the array of cross sprites that appear and animate when left-clicking
*/
Sprite[] getCrossSprites();
EnumDefinition getEnum(int id);

View File

@@ -451,7 +451,7 @@ public interface ChatColorConfig extends Config
)
default Color transparentExamineHighlight()
{
return Color.GREEN;
return Color.decode("#0000FF");
}
@ConfigItem(

View File

@@ -110,17 +110,6 @@ public interface ChatCommandsConfig extends Config
@ConfigItem(
position = 7,
keyName = "duels",
name = "Duels Command",
description = "Configures whether the duel arena command is enabled<br> !duels"
)
default boolean duels()
{
return true;
}
@ConfigItem(
position = 8,
keyName = "clearShortcuts",
name = "Clear shortcuts",
description = "Enable shortcuts (ctrl+w and backspace) for clearing the chatbox"

View File

@@ -64,7 +64,6 @@ import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.util.StackFormatter;
import static net.runelite.client.util.Text.sanitize;
import net.runelite.http.api.chat.ChatClient;
import net.runelite.http.api.chat.Duels;
import net.runelite.http.api.hiscore.HiscoreClient;
import net.runelite.http.api.hiscore.HiscoreEndpoint;
import net.runelite.http.api.hiscore.HiscoreResult;
@@ -90,8 +89,6 @@ public class ChatCommandsPlugin extends Plugin
private static final Pattern BARROWS_PATTERN = Pattern.compile("Your Barrows chest count is: <col=ff0000>(\\d+)</col>");
private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("Fight duration: <col=ff0000>[0-9:]+</col>. Personal best: ([0-9:]+)");
private static final Pattern NEW_PB_PATTERN = Pattern.compile("Fight duration: <col=ff0000>([0-9:]+)</col> \\(new personal best\\)");
private static final Pattern DUEL_ARENA_WINS_PATTERN = Pattern.compile("You (were defeated|won)! You have(?: now)? won (\\d+) duels?");
private static final Pattern DUEL_ARENA_LOSSES_PATTERN = Pattern.compile("You have(?: now)? lost (\\d+) duels?");
private static final String TOTAL_LEVEL_COMMAND_STRING = "!total";
private static final String PRICE_COMMAND_STRING = "!price";
private static final String LEVEL_COMMAND_STRING = "!lvl";
@@ -101,7 +98,6 @@ public class ChatCommandsPlugin extends Plugin
private static final String QP_COMMAND_STRING = "!qp";
private static final String GC_COMMAND_STRING = "!gc";
private static final String PB_COMMAND = "!pb";
private static final String DUEL_ARENA_COMMAND = "!duels";
private final HiscoreClient hiscoreClient = new HiscoreClient();
private final ChatClient chatClient = new ChatClient();
@@ -152,7 +148,6 @@ public class ChatCommandsPlugin extends Plugin
chatCommandManager.registerCommandAsync(QP_COMMAND_STRING, this::questPointsLookup, this::questPointsSubmit);
chatCommandManager.registerCommandAsync(GC_COMMAND_STRING, this::gambleCountLookup, this::gambleCountSubmit);
chatCommandManager.registerCommandAsync(PB_COMMAND, this::personalBestLookup, this::personalBestSubmit);
chatCommandManager.registerCommandAsync(DUEL_ARENA_COMMAND, this::duelArenaLookup, this::duelArenaSubmit);
}
@Override
@@ -171,7 +166,6 @@ public class ChatCommandsPlugin extends Plugin
chatCommandManager.unregisterCommand(QP_COMMAND_STRING);
chatCommandManager.unregisterCommand(PB_COMMAND);
chatCommandManager.unregisterCommand(GC_COMMAND_STRING);
chatCommandManager.unregisterCommand(DUEL_ARENA_COMMAND);
}
@Provides
@@ -209,9 +203,7 @@ public class ChatCommandsPlugin extends Plugin
@Subscribe
public void onChatMessage(ChatMessage chatMessage)
{
if (chatMessage.getType() != ChatMessageType.TRADE
&& chatMessage.getType() != ChatMessageType.GAMEMESSAGE
&& chatMessage.getType() != ChatMessageType.SPAM)
if (chatMessage.getType() != ChatMessageType.GAMEMESSAGE && chatMessage.getType() != ChatMessageType.SPAM)
{
return;
}
@@ -247,43 +239,6 @@ public class ChatCommandsPlugin extends Plugin
return;
}
matcher = DUEL_ARENA_WINS_PATTERN.matcher(message);
if (matcher.find())
{
final int oldWins = getKc("Duel Arena Wins");
final int wins = Integer.parseInt(matcher.group(2));
final String result = matcher.group(1);
int winningStreak = getKc("Duel Arena Win Streak");
int losingStreak = getKc("Duel Arena Lose Streak");
if (result.equals("won") && wins > oldWins)
{
losingStreak = 0;
winningStreak += 1;
}
else if (result.equals("were defeated"))
{
losingStreak += 1;
winningStreak = 0;
}
else
{
log.warn("unrecognized duel streak chat message: {}", message);
}
setKc("Duel Arena Wins", wins);
setKc("Duel Arena Win Streak", winningStreak);
setKc("Duel Arena Lose Streak", losingStreak);
}
matcher = DUEL_ARENA_LOSSES_PATTERN.matcher(message);
if (matcher.find())
{
int losses = Integer.parseInt(matcher.group(1));
setKc("Duel Arena Losses", losses);
}
matcher = BARROWS_PATTERN.matcher(message);
if (matcher.find())
{
@@ -464,96 +419,6 @@ public class ChatCommandsPlugin extends Plugin
client.refreshChat();
}
private boolean duelArenaSubmit(ChatInput chatInput, String value)
{
final int wins = getKc("Duel Arena Wins");
final int losses = getKc("Duel Arena Losses");
final int winningStreak = getKc("Duel Arena Win Streak");
final int losingStreak = getKc("Duel Arena Lose Streak");
if (wins <= 0 && losses <= 0 && winningStreak <= 0 && losingStreak <= 0)
{
return false;
}
final String playerName = client.getLocalPlayer().getName();
executor.execute(() ->
{
try
{
chatClient.submitDuels(playerName, wins, losses, winningStreak, losingStreak);
}
catch (Exception ex)
{
log.warn("unable to submit duels", ex);
}
finally
{
chatInput.resume();
}
});
return true;
}
private void duelArenaLookup(ChatMessage chatMessage, String message)
{
if (!config.duels())
{
return;
}
ChatMessageType type = chatMessage.getType();
final String player;
if (type == ChatMessageType.PRIVATECHATOUT)
{
player = client.getLocalPlayer().getName();
}
else
{
player = sanitize(chatMessage.getName());
}
Duels duels;
try
{
duels = chatClient.getDuels(player);
}
catch (IOException ex)
{
log.debug("unable to lookup duels", ex);
return;
}
final int wins = duels.getWins();
final int losses = duels.getLosses();
final int winningStreak = duels.getWinningStreak();
final int losingStreak = duels.getLosingStreak();
String response = new ChatMessageBuilder()
.append(ChatColorType.NORMAL)
.append("Duel Arena wins: ")
.append(ChatColorType.HIGHLIGHT)
.append(Integer.toString(wins))
.append(ChatColorType.NORMAL)
.append(" losses: ")
.append(ChatColorType.HIGHLIGHT)
.append(Integer.toString(losses))
.append(ChatColorType.NORMAL)
.append(" streak: ")
.append(ChatColorType.HIGHLIGHT)
.append(Integer.toString((winningStreak != 0 ? winningStreak : -losingStreak)))
.build();
log.debug("Setting response {}", response);
final MessageNode messageNode = chatMessage.getMessageNode();
messageNode.setRuneLiteFormatMessage(response);
chatMessageManager.update(messageNode);
client.refreshChat();
}
private void questPointsLookup(ChatMessage chatMessage, String message)
{
if (!config.qp())
@@ -1366,4 +1231,4 @@ public class ChatCommandsPlugin extends Plugin
return WordUtils.capitalize(boss);
}
}
}
}

View File

@@ -37,7 +37,6 @@ class DevToolsButton extends JButton
{
super(title);
addActionListener((ev) -> setActive(!active));
this.setToolTipText(title);
}
void setActive(boolean active)

View File

@@ -62,14 +62,4 @@ public interface InterfaceStylesConfig extends Config
{
return false;
}
@ConfigItem(
keyName = "rsCrossSprites",
name = "RuneScape cross sprites",
description = "Replaces left-click cross sprites with the ones in RuneScape"
)
default boolean rsCrossSprites()
{
return false;
}
}

View File

@@ -31,13 +31,11 @@ import java.awt.image.BufferedImage;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.HealthBar;
import net.runelite.api.SpriteID;
import net.runelite.api.Sprite;
import net.runelite.api.events.BeforeMenuRender;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.PostHealthBar;
import net.runelite.api.events.WidgetPositioned;
import net.runelite.api.widgets.Widget;
@@ -71,8 +69,6 @@ public class InterfaceStylesPlugin extends Plugin
@Inject
private SpriteManager spriteManager;
private Sprite[] defaultCrossSprites;
@Provides
InterfaceStylesConfig provideConfig(ConfigManager configManager)
{
@@ -93,7 +89,6 @@ public class InterfaceStylesPlugin extends Plugin
restoreWidgetDimensions();
removeGameframe();
restoreHealthBars();
restoreCrossSprites();
});
}
@@ -131,22 +126,6 @@ public class InterfaceStylesPlugin extends Plugin
}
}
@Subscribe
public void onGameStateChanged(GameStateChanged gameStateChanged)
{
if (gameStateChanged.getGameState() != GameState.LOGIN_SCREEN)
{
return;
}
/*
* The cross sprites aren't loaded yet when the initial config change event is received.
* So run the overriding for cross sprites when we reach the login screen,
* at which point the cross sprites will have been loaded.
*/
overrideCrossSprites();
}
private void updateAllOverrides()
{
removeGameframe();
@@ -155,7 +134,6 @@ public class InterfaceStylesPlugin extends Plugin
restoreWidgetDimensions();
adjustWidgetDimensions();
overrideHealthBars();
overrideCrossSprites();
}
@Subscribe
@@ -305,62 +283,6 @@ public class InterfaceStylesPlugin extends Plugin
clientThread.invokeLater(client::resetHealthBarCaches);
}
private void overrideCrossSprites()
{
if (config.rsCrossSprites())
{
// If we've already replaced them,
// we don't need to replace them again
if (defaultCrossSprites != null)
{
return;
}
Sprite[] crossSprites = client.getCrossSprites();
if (crossSprites == null)
{
return;
}
defaultCrossSprites = new Sprite[crossSprites.length];
System.arraycopy(crossSprites, 0, defaultCrossSprites, 0, defaultCrossSprites.length);
for (int i = 0; i < crossSprites.length; i++)
{
Sprite newSprite = getFileSpritePixels("rs3/cross_sprites/" + i + ".png");
if (newSprite == null)
{
continue;
}
crossSprites[i] = newSprite;
}
}
else
{
restoreCrossSprites();
}
}
private void restoreCrossSprites()
{
if (defaultCrossSprites == null)
{
return;
}
Sprite[] crossSprites = client.getCrossSprites();
if (crossSprites != null && defaultCrossSprites.length == crossSprites.length)
{
System.arraycopy(defaultCrossSprites, 0, crossSprites, 0, defaultCrossSprites.length);
}
defaultCrossSprites = null;
}
private void restoreWidgetDimensions()
{
for (WidgetOffset widgetOffset : WidgetOffset.values())

View File

@@ -118,33 +118,33 @@ enum WidgetOffset
FIXED_2005_INTERFACE_CONTAINER(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INTERFACE_CONTAINER, 7, null, null, null),
FIXED_2005_BANK_CONTAINER(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_BANK_CONTAINER, 7, null, null, null),
FIXED_2005_COMBAT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_COMBAT_TAB, 19, 2, null, null),
FIXED_2005_COMBAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_COMBAT_ICON, 28, 1, null, null),
FIXED_2005_COMBAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_COMBAT_ICON, 26, null, null, null),
FIXED_2005_STATS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_STATS_TAB, 55, null, 30, null),
FIXED_2005_STATS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_STATS_ICON, 51, null, null, null),
FIXED_2005_STATS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_STATS_ICON, 53, null, null, null),
FIXED_2005_QUESTS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_QUESTS_TAB, 82, 1, 30, null),
FIXED_2005_QUESTS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_QUESTS_ICON, 80, null, null, null),
FIXED_2005_QUESTS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_QUESTS_ICON, 81, null, null, null),
FIXED_2005_INVENTORY_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB, null, null, 45, null),
FIXED_2005_INVENTORY_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INVENTORY_ICON, 113, 1, null, null),
FIXED_2005_INVENTORY_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_INVENTORY_ICON, 115, null, null, null),
FIXED_2005_EQUIPMENT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_TAB, 153, 1, 30, null),
FIXED_2005_EQUIPMENT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_ICON, 151, 4, null, null),
FIXED_2005_EQUIPMENT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EQUIPMENT_ICON, 152, 4, null, null),
FIXED_2005_PRAYER_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_TAB, 180, null, 32, null),
FIXED_2005_PRAYER_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_ICON, 178, null, null, null),
FIXED_2005_PRAYER_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_PRAYER_ICON, 180, null, null, null),
FIXED_2005_MAGIC_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_TAB, 209, 1, 30, null),
FIXED_2005_MAGIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_ICON, 206, 2, null, null),
FIXED_2005_MAGIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MAGIC_ICON, 206, 3, null, null),
FIXED_2005_CLAN_CHAT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_TAB, 15, null, null, null),
FIXED_2005_CLAN_CHAT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_CLAN_CHAT_ICON, 22, 0, null, null),
FIXED_2005_FRIENDS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_TAB, 51, null, 30, null),
FIXED_2005_FRIENDS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_ICON, 49, -1, null, null),
FIXED_2005_FRIENDS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_FRIENDS_ICON, 50, null, null, null),
FIXED_2005_IGNORES_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_IGNORES_TAB, 79, null, 30, null),
FIXED_2005_IGNORES_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_IGNORES_ICON, 78, null, null, null),
FIXED_2005_LOGOUT_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_LOGOUT_TAB, 107, 1, 45, null),
FIXED_2005_LOGOUT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_LOGOUT_ICON, 112, null, null, null),
FIXED_2005_LOGOUT_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_LOGOUT_ICON, 114, 1, null, null),
FIXED_2005_OPTIONS_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_OPTIONS_TAB, 150, null, 30, null),
FIXED_2005_OPTIONS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_OPTIONS_ICON, 148, -1, null, null),
FIXED_2005_OPTIONS_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_OPTIONS_ICON, 149, null, null, null),
FIXED_2005_EMOTES_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_TAB, 178, null, 30, null),
FIXED_2005_EMOTES_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_ICON, 178, 1, null, null),
FIXED_2005_EMOTES_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_EMOTES_ICON, 179, null, null, null),
FIXED_2005_MUSIC_HIGHLIGHT(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_TAB, 206, null, 30, null),
FIXED_2005_MUSIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_ICON, 202, 2, null, null);
FIXED_2005_MUSIC_ICON(Skin.AROUND_2005, WidgetInfo.FIXED_VIEWPORT_MUSIC_ICON, 202, 5, null, null);
private Skin skin;
private WidgetInfo widgetInfo;

View File

@@ -129,12 +129,9 @@ public class LootTrackerPlugin extends Plugin
// Chest loot handling
private static final String CHEST_LOOTED_MESSAGE = "You find some treasure in the chest!";
private static final Pattern LARRAN_LOOTED_PATTERN = Pattern.compile("You have opened Larran's (big|small) chest .*");
private static final Map<Integer, String> CHEST_EVENT_TYPES = ImmutableMap.of(
5179, "Brimstone Chest",
11573, "Crystal Chest",
12093, "Larran's big chest",
13113, "Larran's small chest"
11573, "Crystal Chest"
);
private static final File LOOT_RECORDS_FILE = new File(RuneLite.RUNELITE_DIR, "lootRecords.json");
private static final Set<Integer> RESPAWN_REGIONS = ImmutableSet.of(
@@ -541,7 +538,7 @@ public class LootTrackerPlugin extends Plugin
final String message = event.getMessage();
if (message.equals(CHEST_LOOTED_MESSAGE) || LARRAN_LOOTED_PATTERN.matcher(message).matches())
if (message.equals(CHEST_LOOTED_MESSAGE))
{
final int regionID = client.getLocalPlayer().getWorldLocation().getRegionID();
if (!CHEST_EVENT_TYPES.containsKey(regionID))

View File

@@ -67,7 +67,6 @@ enum RareTreeLocation
new WorldPoint(1640, 3496, 0),
new WorldPoint(1613, 3494, 0),
new WorldPoint(1560, 3636, 0),
new WorldPoint(1646, 3590, 0),
// Miscellania
new WorldPoint(2550, 3869, 0),
@@ -110,8 +109,9 @@ enum RareTreeLocation
new WorldPoint(1353, 3731, 0),
new WorldPoint(1529, 3452, 0),
new WorldPoint(1591, 3421, 0),
new WorldPoint(1647, 3508, 0),
new WorldPoint(1621, 3512, 0),
new WorldPoint(1647, 3510, 0),
new WorldPoint(1632, 3509, 0),
new WorldPoint(1623, 3512, 0),
new WorldPoint(1593, 3491, 0),
new WorldPoint(1583, 3499, 0),
new WorldPoint(1696, 3554, 0),
@@ -119,9 +119,6 @@ enum RareTreeLocation
new WorldPoint(1625, 3669, 0),
new WorldPoint(1642, 3683, 0),
new WorldPoint(1642, 3663, 0),
new WorldPoint(1642, 3533, 0),
new WorldPoint(1671, 3657, 0),
new WorldPoint(1680, 3657, 0),
// Tirannwn
new WorldPoint(2217, 3141, 0),
@@ -190,10 +187,8 @@ enum RareTreeLocation
new WorldPoint(1389, 3821, 0),
new WorldPoint(1610, 3443, 0),
new WorldPoint(1578, 3488, 0),
new WorldPoint(1772, 3510, 0),
new WorldPoint(1685, 3740, 0),
new WorldPoint(1681, 3689, 0),
new WorldPoint(1751, 3564, 0),
new WorldPoint(1796, 3600, 0),
// Misthalin
new WorldPoint(3355, 3312, 0),

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 924 B

View File

@@ -30,7 +30,6 @@ import com.google.inject.testing.fieldbinder.BoundFieldModule;
import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Inject;
import static net.runelite.api.ChatMessageType.GAMEMESSAGE;
import static net.runelite.api.ChatMessageType.TRADE;
import net.runelite.api.Client;
import net.runelite.api.events.ChatMessage;
import net.runelite.client.config.ChatColorConfig;
@@ -192,38 +191,4 @@ public class ChatCommandsPluginTest
verify(configManager).setConfiguration(eq("personalbest.adam"), eq("kree'arra"), eq(181));
}
@Test
public void testDuelArenaWin()
{
when(client.getUsername()).thenReturn("Adam");
ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You won! You have now won 27 duels.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessageEvent);
verify(configManager).setConfiguration("killcount.adam", "duel arena wins", 27);
verify(configManager).setConfiguration("killcount.adam", "duel arena win streak", 1);
}
@Test
public void testDuelArenaWin2()
{
when(client.getUsername()).thenReturn("Adam");
ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You were defeated! You have won 22 duels.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessageEvent);
verify(configManager).setConfiguration("killcount.adam", "duel arena wins", 22);
}
@Test
public void testDuelArenaLose()
{
when(client.getUsername()).thenReturn("Adam");
ChatMessage chatMessageEvent = new ChatMessage(null, TRADE, "", "You have now lost 999 duels.", null, 0);
chatCommandsPlugin.onChatMessage(chatMessageEvent);
verify(configManager).setConfiguration("killcount.adam", "duel arena losses", 999);
}
}
}

View File

@@ -1034,8 +1034,4 @@ public interface RSClient extends RSGameShell, Client
@Import("viewportWalking")
void setViewportWalking(boolean viewportWalking);
@Import("crossSprites")
@Override
RSSprite[] getCrossSprites();
}