Merge remote-tracking branch 'runelite/master' into 2310-merge

This commit is contained in:
Owain van Brakel
2019-10-30 04:30:39 +01:00
13 changed files with 67 additions and 39 deletions

View File

@@ -25,13 +25,9 @@
package net.runelite.http.api; package net.runelite.http.api;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import net.runelite.http.api.item.ItemEquipmentStats;
import net.runelite.http.api.item.ItemPrice;
import net.runelite.http.api.item.ItemStats;
import net.runelite.http.api.util.TypeAdapters;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import okhttp3.Interceptor; import okhttp3.Interceptor;
import okhttp3.MediaType;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.Request; import okhttp3.Request;
import okhttp3.Response; import okhttp3.Response;
@@ -60,12 +56,9 @@ public class RuneLiteAPI
public static final String RUNELITE_AUTH = "RUNELITE-AUTH"; public static final String RUNELITE_AUTH = "RUNELITE-AUTH";
public static final OkHttpClient CLIENT; public static final OkHttpClient CLIENT;
public static final Gson GSON = new GsonBuilder() public static final Gson GSON = new Gson();
.setPrettyPrinting() public static final MediaType JSON = MediaType.parse("application/json");
.registerTypeAdapter(ItemStats.class, TypeAdapters.ITEMSTATS) public static String userAgent;
.registerTypeAdapter(ItemEquipmentStats.class, TypeAdapters.EQUIPMENTSTATS)
.registerTypeAdapter(ItemPrice.class, TypeAdapters.ITEMPRICE)
.create();
private static final String BASE = "https://api.runelite.net"; private static final String BASE = "https://api.runelite.net";
private static final String WSBASE = "https://api.runelite.net/ws"; private static final String WSBASE = "https://api.runelite.net/ws";
@@ -76,8 +69,6 @@ public class RuneLiteAPI
private static final String MAVEN_METADATA = "http://repo.runelite.net/net/runelite/runelite-parent/maven-metadata.xml"; private static final String MAVEN_METADATA = "http://repo.runelite.net/net/runelite/runelite-parent/maven-metadata.xml";
private static final Properties properties = new Properties(); private static final Properties properties = new Properties();
private static String userAgent;
private static String version; private static String version;
private static String upstreamVersion; private static String upstreamVersion;
private static int rsVersion; private static int rsVersion;

View File

@@ -30,10 +30,10 @@ import java.util.UUID;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.http.api.RuneLiteAPI; import net.runelite.http.api.RuneLiteAPI;
import static net.runelite.http.api.RuneLiteAPI.JSON;
import okhttp3.Call; import okhttp3.Call;
import okhttp3.Callback; import okhttp3.Callback;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.Request; import okhttp3.Request;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.Response; import okhttp3.Response;
@@ -42,7 +42,6 @@ import okhttp3.Response;
@AllArgsConstructor @AllArgsConstructor
public class GrandExchangeClient public class GrandExchangeClient
{ {
private static final MediaType JSON = MediaType.parse("application/json");
private static final Gson GSON = RuneLiteAPI.GSON; private static final Gson GSON = RuneLiteAPI.GSON;
private final UUID uuid; private final UUID uuid;

View File

@@ -36,10 +36,10 @@ import java.util.UUID;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.http.api.RuneLiteAPI; import net.runelite.http.api.RuneLiteAPI;
import static net.runelite.http.api.RuneLiteAPI.JSON;
import okhttp3.Call; import okhttp3.Call;
import okhttp3.Callback; import okhttp3.Callback;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.Request; import okhttp3.Request;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.Response; import okhttp3.Response;
@@ -48,7 +48,6 @@ import okhttp3.Response;
@AllArgsConstructor @AllArgsConstructor
public class LootTrackerClient public class LootTrackerClient
{ {
private static final MediaType JSON = MediaType.parse("application/json");
private static final Gson GSON = RuneLiteAPI.GSON; private static final Gson GSON = RuneLiteAPI.GSON;
private final UUID uuid; private final UUID uuid;

View File

@@ -31,10 +31,10 @@ import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.List; import java.util.List;
import net.runelite.http.api.RuneLiteAPI; import net.runelite.http.api.RuneLiteAPI;
import static net.runelite.http.api.RuneLiteAPI.JSON;
import okhttp3.Call; import okhttp3.Call;
import okhttp3.Callback; import okhttp3.Callback;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.Request; import okhttp3.Request;
import okhttp3.RequestBody; import okhttp3.RequestBody;
import okhttp3.Response; import okhttp3.Response;
@@ -43,8 +43,6 @@ import org.slf4j.LoggerFactory;
public class XteaClient public class XteaClient
{ {
private static final MediaType JSON = MediaType.parse("application/json");
private static final Logger logger = LoggerFactory.getLogger(XteaClient.class); private static final Logger logger = LoggerFactory.getLogger(XteaClient.class);
public void submit(XteaRequest xteaRequest) public void submit(XteaRequest xteaRequest)

View File

@@ -164,7 +164,7 @@ public interface ChatColorConfig extends Config
position = 45, position = 45,
keyName = "opaqueServerMessage", keyName = "opaqueServerMessage",
name = "Server message", name = "Server message",
description = "Color of Server Messages (eg. 'Welcome to Runescape')" description = "Color of Server Messages (eg. 'Welcome to RuneScape')"
) )
Color opaqueServerMessage(); Color opaqueServerMessage();
@@ -404,7 +404,7 @@ public interface ChatColorConfig extends Config
position = 75, position = 75,
keyName = "transparentServerMessage", keyName = "transparentServerMessage",
name = "Server message (transparent)", name = "Server message (transparent)",
description = "Color of Server Messages (eg. 'Welcome to Runescape') (transparent)" description = "Color of Server Messages (eg. 'Welcome to RuneScape') (transparent)"
) )
Color transparentServerMessage(); Color transparentServerMessage();

View File

@@ -106,6 +106,8 @@ public enum ItemMapping
ITEM_FURY_ORNAMENT_KIT(FURY_ORNAMENT_KIT, AMULET_OF_FURY_OR), ITEM_FURY_ORNAMENT_KIT(FURY_ORNAMENT_KIT, AMULET_OF_FURY_OR),
ITEM_TORMENTED_BRACELET(TORMENTED_BRACELET, TORMENTED_BRACELET_OR), ITEM_TORMENTED_BRACELET(TORMENTED_BRACELET, TORMENTED_BRACELET_OR),
ITEM_TORMENTED_ORNAMENT_KIT(TORMENTED_ORNAMENT_KIT, TORMENTED_BRACELET_OR), ITEM_TORMENTED_ORNAMENT_KIT(TORMENTED_ORNAMENT_KIT, TORMENTED_BRACELET_OR),
ITEM_BERSERKER_NECKLACE(BERSERKER_NECKLACE, BERSERKER_NECKLACE_OR),
ITEM_BERSERKER_NECKLACE_ORNAMENT_KIT(BERSERKER_NECKLACE_ORNAMENT_KIT, BERSERKER_NECKLACE_OR),
// Ensouled heads // Ensouled heads
ITEM_ENSOULED_GOBLIN_HEAD(ENSOULED_GOBLIN_HEAD_13448, ENSOULED_GOBLIN_HEAD), ITEM_ENSOULED_GOBLIN_HEAD(ENSOULED_GOBLIN_HEAD_13448, ENSOULED_GOBLIN_HEAD),

View File

@@ -599,9 +599,11 @@ public class TabInterface
chatboxPanelManager.close(); chatboxPanelManager.close();
} }
if (event.getIdentifier() == WidgetInfo.BANK_ITEM_CONTAINER.getId() if ((event.getIdentifier() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|| event.getIdentifier() == WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getId())
&& event.getMenuOpcode() == MenuOpcode.EXAMINE_ITEM_BANK_EQ && event.getMenuOpcode() == MenuOpcode.EXAMINE_ITEM_BANK_EQ
&& event.getOption().equalsIgnoreCase("withdraw-x")) && (event.getOption().equalsIgnoreCase("withdraw-x")
|| event.getOption().equalsIgnoreCase("deposit-x")))
{ {
waitSearchTick = true; waitSearchTick = true;
rememberedSearch = client.getVar(VarClientStr.INPUT_TEXT); rememberedSearch = client.getVar(VarClientStr.INPUT_TEXT);

View File

@@ -144,7 +144,7 @@ public class SkillChallengeClue extends ClueScroll implements NpcClueScroll
new SkillChallengeClue("Craft multiple cosmic runes from a single essence.", item(ItemID.PURE_ESSENCE)), new SkillChallengeClue("Craft multiple cosmic runes from a single essence.", item(ItemID.PURE_ESSENCE)),
new SkillChallengeClue("Plant a watermelon seed.", item(ItemID.RAKE), item(ItemID.SEED_DIBBER), xOfItem(ItemID.WATERMELON_SEED, 3)), new SkillChallengeClue("Plant a watermelon seed.", item(ItemID.RAKE), item(ItemID.SEED_DIBBER), xOfItem(ItemID.WATERMELON_SEED, 3)),
new SkillChallengeClue("Activate the Chivalry prayer."), new SkillChallengeClue("Activate the Chivalry prayer."),
new SkillChallengeClue("Hand in a Tier 2 or higher set of Shayzien supply armour", "hand in a boxed set of shayzien supply armour at tier 2 or above.", any("Shayzien Supply Set (Tier 2 or higher)", item(ItemID.SHAYZIEN_SUPPLY_SET_2), item(ItemID.SHAYZIEN_SUPPLY_SET_3), item(ItemID.SHAYZIEN_SUPPLY_SET_4), item(ItemID.SHAYZIEN_SUPPLY_SET_5))), new SkillChallengeClue("Hand in a Tier 2 or higher set of Shayzien supply armour", "take the lovakengj armourers a boxed set of shayzien supply armour at tier 2 or above.", any("Shayzien Supply Set (Tier 2 or higher)", item(ItemID.SHAYZIEN_SUPPLY_SET_2), item(ItemID.SHAYZIEN_SUPPLY_SET_3), item(ItemID.SHAYZIEN_SUPPLY_SET_4), item(ItemID.SHAYZIEN_SUPPLY_SET_5))),
// Master Sherlock Tasks // Master Sherlock Tasks
new SkillChallengeClue("Equip an abyssal whip in front of the abyssal demons of the Slayer Tower.", true, any("Abyssal Whip", item(ItemID.ABYSSAL_WHIP), item(ItemID.FROZEN_ABYSSAL_WHIP), item(ItemID.VOLCANIC_ABYSSAL_WHIP))), new SkillChallengeClue("Equip an abyssal whip in front of the abyssal demons of the Slayer Tower.", true, any("Abyssal Whip", item(ItemID.ABYSSAL_WHIP), item(ItemID.FROZEN_ABYSSAL_WHIP), item(ItemID.VOLCANIC_ABYSSAL_WHIP))),
new SkillChallengeClue("Smith a runite med helm.", item(ItemID.HAMMER), item(ItemID.RUNITE_BAR)), new SkillChallengeClue("Smith a runite med helm.", item(ItemID.HAMMER), item(ItemID.RUNITE_BAR)),

View File

@@ -38,7 +38,7 @@ import net.runelite.api.coords.WorldPoint;
* <p> * <p>
* These puzzles are established by having some way to test the distance from the solution via "warmth", where being * These puzzles are established by having some way to test the distance from the solution via "warmth", where being
* colder means one is farther away from the target, and being warmer means one is closer to it, with the goal being to * colder means one is farther away from the target, and being warmer means one is closer to it, with the goal being to
* reach the most warm value to discover the solution point. Hot-cold puzzles in Old School Runescape are implemented * reach the most warm value to discover the solution point. Hot-cold puzzles in Old School RuneScape are implemented
* with specific set of solution points, so this solver will filter from a provided set of possible solutions as new * with specific set of solution points, so this solver will filter from a provided set of possible solutions as new
* signals of temperatures and temperature changes are provided. * signals of temperatures and temperature changes are provided.
*/ */

View File

@@ -48,11 +48,16 @@ public class MultipleOfItemRequirement implements ItemRequirement
@Override @Override
public boolean fulfilledBy(Item[] items) public boolean fulfilledBy(Item[] items)
{ {
int quantityFound = 0;
for (Item item : items) for (Item item : items)
{ {
if (item.getId() == itemId && item.getQuantity() >= quantity) if (item.getId() == itemId)
{ {
return true; quantityFound += item.getQuantity();
if (quantityFound >= quantity)
{
return true;
}
} }
} }

View File

@@ -99,7 +99,7 @@ import net.runelite.http.api.hiscore.Skill;
@Singleton @Singleton
public class HiscorePanel extends PluginPanel public class HiscorePanel extends PluginPanel
{ {
/* The maximum allowed username length in runescape accounts */ /* The maximum allowed username length in RuneScape accounts */
private static final int MAX_USERNAME_LENGTH = 12; private static final int MAX_USERNAME_LENGTH = 12;
/** /**
@@ -344,7 +344,7 @@ public class HiscorePanel extends PluginPanel
return; return;
} }
/* Runescape usernames can't be longer than 12 characters long */ /* RuneScape usernames can't be longer than 12 characters long */
if (lookup.length() > MAX_USERNAME_LENGTH) if (lookup.length() > MAX_USERNAME_LENGTH)
{ {
searchBar.setIcon(IconTextField.Icon.ERROR); searchBar.setIcon(IconTextField.Icon.ERROR);

View File

@@ -426,13 +426,21 @@ public class MusicPlugin extends Plugin
{ {
{ {
Widget handle = slider.getHandle(); Widget handle = slider.getHandle();
Widget[] siblings = handle.getParent().getChildren(); Widget parent = handle.getParent();
if (siblings.length < handle.getIndex() || siblings[handle.getIndex()] != handle) if (parent == null)
{ {
continue; continue;
} }
siblings[slider.getTrack().getIndex()] = null; else
siblings[handle.getIndex()] = null; {
Widget[] siblings = parent.getChildren();
if (siblings == null || handle.getIndex() >= siblings.length || siblings[handle.getIndex()] != handle)
{
continue;
}
siblings[slider.getTrack().getIndex()] = null;
siblings[handle.getIndex()] = null;
}
} }
Object[] init = icon.getOnLoadListener(); Object[] init = icon.getOnLoadListener();
@@ -459,11 +467,19 @@ public class MusicPlugin extends Plugin
Widget handle = slider.getHandle(); Widget handle = slider.getHandle();
if (handle != null) if (handle != null)
{ {
Widget[] siblings = handle.getParent().getChildren(); Widget parent = handle.getParent();
if (siblings.length < handle.getIndex() || siblings[handle.getIndex()] != handle) if (parent == null)
{ {
handle = null; handle = null;
} }
else
{
Widget[] siblings = parent.getChildren();
if (siblings == null || handle.getIndex() >= siblings.length || siblings[handle.getIndex()] != handle)
{
handle = null;
}
}
} }
if (handle == null) if (handle == null)
{ {

View File

@@ -377,12 +377,17 @@ LABEL327:
jump LABEL372 jump LABEL372
LABEL330: LABEL330:
iload 7 iload 7
iload 12 ; Load the id of the messageNode
sconst "" ; Push a container for the timestamp
sconst "addTimestamp" ; Push event name
runelite_callback ; Invoke callback
pop_int ; Pop the id of the messageNode
sconst "From " sconst "From "
sload 1 sload 1
sconst ":" sconst ":"
sconst "privateChatSplitFrom" sconst "privateChatSplitFrom"
runelite_callback runelite_callback
join_string 3 join_string 4 ; Add the timestamp to the message
sload 0 sload 0
iload 9 iload 9
iload 10 iload 10
@@ -401,12 +406,17 @@ LABEL330:
jump LABEL407 jump LABEL407
LABEL351: LABEL351:
iload 7 iload 7
iload 12 ; Load the id of the messageNode
sconst "" ; Push container for the timestamp
sconst "addTimestamp" ; Push event name
runelite_callback ; Invoke callback
pop_int ; Pop the id of the messageNode
sconst "To " sconst "To "
sload 1 sload 1
sconst ":" sconst ":"
sconst "privateChatSplitTo" sconst "privateChatSplitTo"
runelite_callback runelite_callback
join_string 3 join_string 4 ; Add the timestamp to the message
sload 0 sload 0
iload 9 iload 9
iload 10 iload 10
@@ -425,7 +435,13 @@ LABEL351:
jump LABEL407 jump LABEL407
LABEL372: LABEL372:
iload 7 iload 7
sload 0 iload 12 ; Load the id of the messageNode
sconst "" ; Push a container for the timestamp
sconst "addTimestamp" ; Push event name
runelite_callback ; Invoke callback
pop_int ; Pop the id of the messageNode
sload 0 ; Load the log in/out message
join_string 2 ; Add the timestamp to the message
iload 9 iload 9
iload 10 iload 10
iconst 10682368 iconst 10682368