openrune: just about finish rework, gets to login
@@ -36,7 +36,7 @@ buildscript {
|
||||
dependencies {
|
||||
classpath("org.ajoberstar.grgit:grgit-core:4.1.0")
|
||||
classpath("com.github.ben-manes:gradle-versions-plugin:0.36.0")
|
||||
classpath("com.openosrs:injector-plugin:1.1.7")
|
||||
classpath("com.openosrs:injector-plugin:1.2.0")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,6 @@
|
||||
*/
|
||||
package net.runelite.cache.util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
@@ -42,14 +41,7 @@ public class XteaKeyManager
|
||||
{
|
||||
XteaClient xteaClient = new XteaClient(RuneLiteAPI.CLIENT);
|
||||
|
||||
try
|
||||
{
|
||||
keys = xteaClient.get();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
keys = null;
|
||||
|
||||
logger.info("Loaded {} keys", keys.size());
|
||||
}
|
||||
|
||||
@@ -25,6 +25,10 @@
|
||||
package net.runelite.http.api;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.MediaType;
|
||||
@@ -33,21 +37,6 @@ import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.xml.sax.SAXException;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
public class RuneLiteAPI
|
||||
{
|
||||
@@ -64,36 +53,27 @@ public class RuneLiteAPI
|
||||
private static final String BASE = "https://api.runelite.net";
|
||||
private static final String WSBASE = "https://api.runelite.net/ws";
|
||||
private static final String STATICBASE = "https://static.runelite.net";
|
||||
|
||||
private static final String OPENOSRS_SESSION = "http://session.openosrs.dev";
|
||||
private static final String OPENOSRS_XTEA = "http://xtea.openosrs.dev";
|
||||
private static final String MAVEN_METADATA = "https://repo.runelite.net/net/runelite/runelite-parent/maven-metadata.xml";
|
||||
|
||||
private static final Properties properties = new Properties();
|
||||
private static String version;
|
||||
private static String upstreamVersion;
|
||||
private static int rsVersion;
|
||||
|
||||
static
|
||||
{
|
||||
try (InputStream in = RuneLiteAPI.class.getResourceAsStream("/runelite.properties"))
|
||||
try
|
||||
{
|
||||
InputStream in = RuneLiteAPI.class.getResourceAsStream("/runelite.properties");
|
||||
properties.load(in);
|
||||
|
||||
version = properties.getProperty("runelite.version");
|
||||
rsVersion = Integer.parseInt(properties.getProperty("rs.version"));
|
||||
String commit = properties.getProperty("runelite.commit");
|
||||
boolean dirty = Boolean.parseBoolean(properties.getProperty("runelite.dirty"));
|
||||
|
||||
userAgent = "OpenOSRS/" + version + "-" + commit + (dirty ? "+" : "");
|
||||
|
||||
rsVersion = Integer.parseInt(properties.getProperty("rs.version"));
|
||||
|
||||
parseMavenVersion();
|
||||
userAgent = "RuneLite/" + version + "-" + commit + (dirty ? "+" : "");
|
||||
}
|
||||
catch (NumberFormatException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException("Version string has not been substituted; Re-run Gradle");
|
||||
throw new RuntimeException("Version string has not been substituted; Re-run maven");
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
@@ -104,6 +84,7 @@ public class RuneLiteAPI
|
||||
.pingInterval(30, TimeUnit.SECONDS)
|
||||
.addNetworkInterceptor(new Interceptor()
|
||||
{
|
||||
|
||||
@Override
|
||||
public Response intercept(Chain chain) throws IOException
|
||||
{
|
||||
@@ -119,12 +100,14 @@ public class RuneLiteAPI
|
||||
|
||||
public static HttpUrl getSessionBase()
|
||||
{
|
||||
return HttpUrl.parse(OPENOSRS_SESSION);
|
||||
final String prop = System.getProperty("runelite.session.url");
|
||||
|
||||
if (prop != null && !prop.isEmpty())
|
||||
{
|
||||
return HttpUrl.parse(prop);
|
||||
}
|
||||
|
||||
public static HttpUrl getXteaBase()
|
||||
{
|
||||
return HttpUrl.parse(OPENOSRS_XTEA);
|
||||
return HttpUrl.parse(BASE + "/session");
|
||||
}
|
||||
|
||||
public static HttpUrl getApiBase()
|
||||
@@ -165,7 +148,12 @@ public class RuneLiteAPI
|
||||
|
||||
public static String getVersion()
|
||||
{
|
||||
return upstreamVersion;
|
||||
return version;
|
||||
}
|
||||
|
||||
public static void setVersion(String version)
|
||||
{
|
||||
RuneLiteAPI.version = version;
|
||||
}
|
||||
|
||||
public static int getRsVersion()
|
||||
@@ -173,60 +161,4 @@ public class RuneLiteAPI
|
||||
return rsVersion;
|
||||
}
|
||||
|
||||
public static String getRlpVersion()
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
private static byte[] downloadUrl(URL toDownload)
|
||||
{
|
||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
InputStream stream;
|
||||
try
|
||||
{
|
||||
byte[] chunk = new byte[4096];
|
||||
int bytesRead;
|
||||
URLConnection conn = toDownload.openConnection();
|
||||
conn.setRequestProperty("User-Agent", userAgent);
|
||||
stream = conn.getInputStream();
|
||||
|
||||
while ((bytesRead = stream.read(chunk)) > 0)
|
||||
{
|
||||
outputStream.write(chunk, 0, bytesRead);
|
||||
}
|
||||
stream.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
return outputStream.toByteArray();
|
||||
}
|
||||
|
||||
private static void parseMavenVersion()
|
||||
{
|
||||
try (ByteArrayInputStream fis = new ByteArrayInputStream(downloadUrl(new URL(MAVEN_METADATA))))
|
||||
{
|
||||
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
||||
factory.setValidating(false);
|
||||
factory.setIgnoringElementContentWhitespace(true);
|
||||
DocumentBuilder builder = factory.newDocumentBuilder();
|
||||
Document doc = builder.parse(fis);
|
||||
NodeList versionList = doc.getElementsByTagName("version");
|
||||
for (int i = 0; i != versionList.getLength(); i++)
|
||||
{
|
||||
Node node = versionList.item(i);
|
||||
if (node.getTextContent() != null && !node.getTextContent().endsWith("SNAPSHOT"))
|
||||
{
|
||||
upstreamVersion = node.getTextContent();
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (ParserConfigurationException | IOException | SAXException ex)
|
||||
{
|
||||
logger.error(null, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
package net.runelite.http.api.account;
|
||||
|
||||
import com.google.gson.JsonParseException;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -96,7 +95,7 @@ public class AccountClient
|
||||
}
|
||||
}
|
||||
|
||||
public Observable<Boolean> sessionCheck()
|
||||
public boolean sessionCheck()
|
||||
{
|
||||
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||
.addPathSegment("account")
|
||||
@@ -105,8 +104,6 @@ public class AccountClient
|
||||
|
||||
log.debug("Built URI: {}", url);
|
||||
|
||||
return Observable.fromCallable(() ->
|
||||
{
|
||||
Request request = new Request.Builder()
|
||||
.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString())
|
||||
.url(url)
|
||||
@@ -121,6 +118,5 @@ public class AccountClient
|
||||
log.debug("Unable to verify session", ex);
|
||||
return true; // assume it is still valid if the server is unreachable
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,7 +40,6 @@ import okhttp3.Response;
|
||||
@AllArgsConstructor
|
||||
public class ChatClient
|
||||
{
|
||||
private static final RequestBody body = RequestBody.Companion.create(new byte[0], null);
|
||||
private final OkHttpClient client;
|
||||
|
||||
public boolean submitKc(String username, String boss, int kc) throws IOException
|
||||
@@ -289,7 +288,6 @@ public class ChatClient
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Duels getDuels(String username) throws IOException
|
||||
{
|
||||
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Spedwards <https://github.com/Spedwards>
|
||||
* 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;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
|
||||
@Data
|
||||
public class House
|
||||
{
|
||||
private String owner;
|
||||
private boolean guildedAltarPresent;
|
||||
private boolean occultAltarPresent;
|
||||
private boolean spiritTreePresent;
|
||||
private boolean fairyRingPresent;
|
||||
private boolean wildernessObeliskPresent;
|
||||
private boolean repairStandPresent;
|
||||
private boolean combatDummyPresent;
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return RuneLiteAPI.GSON.toJson(this);
|
||||
}
|
||||
}
|
||||
@@ -24,6 +24,7 @@
|
||||
*/
|
||||
package net.runelite.http.api.config;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonParseException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
@@ -48,6 +49,7 @@ import okhttp3.Response;
|
||||
public class ConfigClient
|
||||
{
|
||||
private static final MediaType TEXT_PLAIN = MediaType.parse("text/plain");
|
||||
private static final Gson GSON = RuneLiteAPI.GSON;
|
||||
|
||||
private final OkHttpClient client;
|
||||
private final UUID uuid;
|
||||
@@ -114,6 +116,59 @@ public class ConfigClient
|
||||
return future;
|
||||
}
|
||||
|
||||
public CompletableFuture<Void> patch(Configuration configuration)
|
||||
{
|
||||
CompletableFuture<Void> future = new CompletableFuture<>();
|
||||
|
||||
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||
.addPathSegment("config")
|
||||
.build();
|
||||
|
||||
log.debug("Built URI: {}", url);
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.patch(RequestBody.create(RuneLiteAPI.JSON, GSON.toJson(configuration)))
|
||||
.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString())
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
client.newCall(request).enqueue(new Callback()
|
||||
{
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e)
|
||||
{
|
||||
log.warn("Unable to synchronize configuration item", e);
|
||||
future.completeExceptionally(e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response)
|
||||
{
|
||||
if (response.code() != 200)
|
||||
{
|
||||
String body = "bad response";
|
||||
try
|
||||
{
|
||||
body = response.body().string();
|
||||
}
|
||||
catch (IOException ignored)
|
||||
{
|
||||
}
|
||||
|
||||
log.warn("failed to synchronize some of {} configuration values: {}", configuration.getConfig().size(), body);
|
||||
}
|
||||
else
|
||||
{
|
||||
log.debug("Synchronized {} configuration values", configuration.getConfig().size());
|
||||
}
|
||||
response.close();
|
||||
future.complete(null);
|
||||
}
|
||||
});
|
||||
|
||||
return future;
|
||||
}
|
||||
|
||||
public CompletableFuture<Void> unset(String key)
|
||||
{
|
||||
CompletableFuture<Void> future = new CompletableFuture<>();
|
||||
|
||||
@@ -24,28 +24,15 @@
|
||||
*/
|
||||
package net.runelite.http.api.config;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ConfigEntry
|
||||
{
|
||||
private String key;
|
||||
private String value;
|
||||
|
||||
public String getKey()
|
||||
{
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key)
|
||||
{
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getValue()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -26,18 +26,12 @@ package net.runelite.http.api.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class Configuration
|
||||
{
|
||||
private List<ConfigEntry> config = new ArrayList<>();
|
||||
|
||||
public Configuration(List<ConfigEntry> config)
|
||||
{
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public List<ConfigEntry> getConfig()
|
||||
{
|
||||
return config;
|
||||
}
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Forsco <https://github.com/forsco>
|
||||
* 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.discord;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import java.io.IOException;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.MediaType;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
|
||||
@Slf4j
|
||||
public class DiscordClient
|
||||
{
|
||||
public static final Gson gson = new Gson();
|
||||
private static final MediaType JSON = MediaType.parse("application/json");
|
||||
|
||||
public void message(HttpUrl url, DiscordMessage discordMessage)
|
||||
{
|
||||
log.debug("Message being sent");
|
||||
message(url, discordMessage, 0, 5);
|
||||
}
|
||||
|
||||
private void message(HttpUrl url, DiscordMessage discordMessage, int retryAttempt, int maxAttempts)
|
||||
{
|
||||
RequestBody body = RequestBody.Companion.create(gson.toJson(discordMessage), JSON);
|
||||
Request request = new Request.Builder()
|
||||
.post(body)
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
log.debug("Attempting to message with {}", discordMessage);
|
||||
|
||||
RuneLiteAPI.CLIENT.newCall(request).enqueue(new Callback()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onFailure(Call call, IOException e)
|
||||
{
|
||||
log.warn("Unable to submit discord post.", e);
|
||||
if (retryAttempt < maxAttempts)
|
||||
{
|
||||
message(url, discordMessage, retryAttempt + 1, maxAttempts);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call call, Response response) throws IOException
|
||||
{
|
||||
try
|
||||
{
|
||||
if (response.body() == null)
|
||||
{
|
||||
log.debug("API Call - Reponse was null.");
|
||||
return;
|
||||
}
|
||||
if (response.body().string().contains("You are being rate limited") && retryAttempt < maxAttempts)
|
||||
{
|
||||
log.debug("You are being rate limited, retrying...");
|
||||
message(url, discordMessage, retryAttempt + 1, maxAttempts);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
response.close();
|
||||
log.debug("Submitted discord log record");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Forsco <https://github.com/forsco>
|
||||
* 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.discord;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
import net.runelite.http.api.discord.embed.AuthorEmbed;
|
||||
import net.runelite.http.api.discord.embed.FieldEmbed;
|
||||
import net.runelite.http.api.discord.embed.FooterEmbed;
|
||||
import net.runelite.http.api.discord.embed.ImageEmbed;
|
||||
import net.runelite.http.api.discord.embed.ProviderEmbed;
|
||||
import net.runelite.http.api.discord.embed.ThumbnailEmbed;
|
||||
import net.runelite.http.api.discord.embed.VideoEmbed;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@ToString
|
||||
public class DiscordEmbed
|
||||
{
|
||||
String title;
|
||||
String type;
|
||||
String description;
|
||||
String url;
|
||||
String timestamp;
|
||||
String iconurl;
|
||||
String color;
|
||||
FooterEmbed footer;
|
||||
ImageEmbed image;
|
||||
ThumbnailEmbed thumbnail;
|
||||
VideoEmbed video;
|
||||
ProviderEmbed provider;
|
||||
AuthorEmbed author;
|
||||
final List<FieldEmbed> fields = new ArrayList<>();
|
||||
|
||||
public DiscordEmbed(AuthorEmbed author, ThumbnailEmbed thumb, String description, FooterEmbed footer, String color, List<FieldEmbed> fields)
|
||||
{
|
||||
this.author = author;
|
||||
this.thumbnail = thumb;
|
||||
this.description = description;
|
||||
this.footer = footer;
|
||||
this.color = color;
|
||||
this.fields.addAll(fields);
|
||||
}
|
||||
|
||||
public DiscordMessage toDiscordMessage(String username, String content, String avatarUrl)
|
||||
{
|
||||
return new DiscordMessage(username, content, avatarUrl, this);
|
||||
}
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Forsco <https://github.com/forsco>
|
||||
* 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.discord.embed;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class AuthorEmbed
|
||||
{
|
||||
String name;
|
||||
String url;
|
||||
String icon_url;
|
||||
String proxy_icon_url;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Forsco <https://github.com/forsco>
|
||||
* 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.discord.embed;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class FieldEmbed
|
||||
{
|
||||
@NonNull
|
||||
String name;
|
||||
@NonNull
|
||||
String value;
|
||||
boolean inline;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Forsco <https://github.com/forsco>
|
||||
* 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.discord.embed;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class FooterEmbed
|
||||
{
|
||||
String text;
|
||||
String icon_url;
|
||||
String proxy_icon_url;
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Forsco <https://github.com/forsco>
|
||||
* 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.discord.embed;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class ProviderEmbed
|
||||
{
|
||||
String name;
|
||||
String url;
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Forsco <https://github.com/forsco>
|
||||
* 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.discord.embed;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class ThumbnailEmbed
|
||||
{
|
||||
String url;
|
||||
String proxy_url;
|
||||
int height;
|
||||
int width;
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Forsco <https://github.com/forsco>
|
||||
* 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.discord.embed;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class VideoEmbed
|
||||
{
|
||||
String url;
|
||||
int height;
|
||||
int width;
|
||||
}
|
||||
@@ -70,10 +70,9 @@ public class ExamineClient
|
||||
|
||||
log.debug("Built URI: {}", url);
|
||||
|
||||
RequestBody body = RequestBody.Companion.create(text, TEXT);
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.post(body)
|
||||
.post(RequestBody.create(TEXT, text))
|
||||
.build();
|
||||
|
||||
client.newCall(request).enqueue(new Callback()
|
||||
|
||||
@@ -59,7 +59,6 @@ public class GrandExchangeClient
|
||||
.addPathSegment("ge")
|
||||
.build();
|
||||
|
||||
RequestBody body = RequestBody.Companion.create(GSON.toJson(grandExchangeTrade), JSON);
|
||||
Request.Builder builder = new Request.Builder();
|
||||
if (uuid != null)
|
||||
{
|
||||
@@ -71,7 +70,7 @@ public class GrandExchangeClient
|
||||
}
|
||||
|
||||
Request request = builder
|
||||
.post(body)
|
||||
.post(RequestBody.create(JSON, GSON.toJson(grandExchangeTrade)))
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
|
||||
@@ -24,18 +24,14 @@
|
||||
*/
|
||||
package net.runelite.http.api.item;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import java.awt.image.BufferedImage;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.Arrays;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.naming.directory.SearchResult;
|
||||
import java.lang.reflect.Type;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Map;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
@@ -50,47 +46,11 @@ public class ItemClient
|
||||
{
|
||||
private final OkHttpClient client;
|
||||
|
||||
public ItemPrice lookupItemPrice(int itemId) throws IOException
|
||||
{
|
||||
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||
.addPathSegment("item")
|
||||
.addPathSegment("" + itemId)
|
||||
.addPathSegment("price")
|
||||
.build();
|
||||
|
||||
log.debug("Built URI: {}", url);
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
try (Response response = client.newCall(request).execute())
|
||||
{
|
||||
if (!response.isSuccessful())
|
||||
{
|
||||
log.debug("Error looking up item {}: {}", itemId, response);
|
||||
return null;
|
||||
}
|
||||
|
||||
InputStream in = response.body().byteStream();
|
||||
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), ItemPrice.class);
|
||||
}
|
||||
catch (JsonParseException ex)
|
||||
{
|
||||
throw new IOException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemPrice[] lookupItemPrice(Integer[] itemIds) throws IOException
|
||||
public ItemPrice[] getPrices() throws IOException
|
||||
{
|
||||
HttpUrl.Builder urlBuilder = RuneLiteAPI.getApiBase().newBuilder()
|
||||
.addPathSegment("item")
|
||||
.addPathSegment("price");
|
||||
|
||||
for (int itemId : itemIds)
|
||||
{
|
||||
urlBuilder.addQueryParameter("id", String.valueOf(itemId));
|
||||
}
|
||||
.addPathSegment("prices.js");
|
||||
|
||||
HttpUrl url = urlBuilder.build();
|
||||
|
||||
@@ -104,7 +64,7 @@ public class ItemClient
|
||||
{
|
||||
if (!response.isSuccessful())
|
||||
{
|
||||
log.debug("Error looking up items {}: {}", Arrays.toString(itemIds), response);
|
||||
log.warn("Error looking up prices: {}", response);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -117,142 +77,38 @@ public class ItemClient
|
||||
}
|
||||
}
|
||||
|
||||
public Observable<BufferedImage> getIcon(int itemId)
|
||||
public Map<Integer, ItemStats> getStats() throws IOException
|
||||
{
|
||||
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||
HttpUrl.Builder urlBuilder = RuneLiteAPI.getStaticBase().newBuilder()
|
||||
.addPathSegment("item")
|
||||
.addPathSegment("" + itemId)
|
||||
.addPathSegment("icon")
|
||||
.build();
|
||||
|
||||
log.debug("Built URI: {}", url);
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
return Observable.defer(() ->
|
||||
{
|
||||
try (Response response = client.newCall(request).execute())
|
||||
{
|
||||
if (!response.isSuccessful())
|
||||
{
|
||||
log.debug("Error grabbing icon {}: {}", itemId, response);
|
||||
return Observable.just(null);
|
||||
}
|
||||
|
||||
InputStream in = response.body().byteStream();
|
||||
synchronized (ImageIO.class)
|
||||
{
|
||||
return Observable.just(ImageIO.read(in));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Observable<SearchResult> search(String itemName)
|
||||
{
|
||||
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||
.addPathSegment("item")
|
||||
.addPathSegment("search")
|
||||
.addQueryParameter("query", itemName)
|
||||
.build();
|
||||
|
||||
log.debug("Built URI: {}", url);
|
||||
|
||||
return Observable.defer(() ->
|
||||
{
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
try (Response response = client.newCall(request).execute())
|
||||
{
|
||||
if (!response.isSuccessful())
|
||||
{
|
||||
log.debug("Error looking up item {}: {}", itemName, response);
|
||||
return Observable.just(null);
|
||||
}
|
||||
|
||||
InputStream in = response.body().byteStream();
|
||||
return Observable.just(RuneLiteAPI.GSON.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), SearchResult.class));
|
||||
}
|
||||
catch (JsonParseException ex)
|
||||
{
|
||||
return Observable.error(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Observable<ImmutableMap<Integer, ItemPrice>> getPrices()
|
||||
{
|
||||
HttpUrl.Builder urlBuilder = RuneLiteAPI.getApiBase().newBuilder()
|
||||
.addPathSegment("item")
|
||||
.addPathSegment("prices.js");
|
||||
// TODO: Change this to stats.min.json later after release is undeployed
|
||||
.addPathSegment("stats.ids.min.json");
|
||||
|
||||
HttpUrl url = urlBuilder.build();
|
||||
|
||||
log.debug("Built URI: {}", url);
|
||||
|
||||
return Observable.fromCallable(() ->
|
||||
{
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
try (JsonReader reader = new JsonReader(client.newCall(request).execute().body().charStream()))
|
||||
try (Response response = client.newCall(request).execute())
|
||||
{
|
||||
ImmutableMap.Builder<Integer, ItemPrice> builder = ImmutableMap.builderWithExpectedSize(3666);
|
||||
reader.beginArray();
|
||||
|
||||
while (reader.hasNext())
|
||||
if (!response.isSuccessful())
|
||||
{
|
||||
ItemPrice price = RuneLiteAPI.GSON.fromJson(reader, ItemPrice.class);
|
||||
|
||||
builder.put(
|
||||
price.getId(),
|
||||
price
|
||||
);
|
||||
log.warn("Error looking up item stats: {}", response);
|
||||
return null;
|
||||
}
|
||||
|
||||
reader.endArray();
|
||||
return builder.build();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Observable<ImmutableMap<Integer, ItemStats>> getStats()
|
||||
InputStream in = response.body().byteStream();
|
||||
final Type typeToken = new TypeToken<Map<Integer, ItemStats>>()
|
||||
{
|
||||
HttpUrl url = RuneLiteAPI.getStaticBase()
|
||||
.newBuilder()
|
||||
.addPathSegment("item")
|
||||
.addPathSegment("stats.ids.min.json")
|
||||
.build();
|
||||
|
||||
log.debug("Built URI {}", url);
|
||||
return Observable.fromCallable(() ->
|
||||
{
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
try (JsonReader reader = new JsonReader(client.newCall(request).execute().body().charStream()))
|
||||
{
|
||||
// This is the size the items are as I wrote this. the builder gets increased by 1 every time otherwise
|
||||
ImmutableMap.Builder<Integer, ItemStats> builder = ImmutableMap.builderWithExpectedSize(7498);
|
||||
reader.beginObject();
|
||||
|
||||
while (reader.hasNext())
|
||||
{
|
||||
builder.put(
|
||||
Integer.parseInt(reader.nextName()),
|
||||
RuneLiteAPI.GSON.fromJson(reader, ItemStats.class)
|
||||
);
|
||||
}.getType();
|
||||
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), typeToken);
|
||||
}
|
||||
|
||||
reader.endObject();
|
||||
return builder.build();
|
||||
catch (JsonParseException ex)
|
||||
{
|
||||
throw new IOException(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ import lombok.Builder;
|
||||
import lombok.Value;
|
||||
|
||||
@Value
|
||||
@Builder(builderClassName = "Builder")
|
||||
@Builder
|
||||
public class ItemEquipmentStats
|
||||
{
|
||||
private int slot;
|
||||
|
||||
@@ -24,14 +24,10 @@
|
||||
*/
|
||||
package net.runelite.http.api.item;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Value;
|
||||
|
||||
@Value
|
||||
@AllArgsConstructor
|
||||
@Builder(builderClassName = "Builder")
|
||||
public class ItemStats
|
||||
{
|
||||
private boolean quest;
|
||||
@@ -57,9 +53,9 @@ public class ItemStats
|
||||
{
|
||||
final ItemEquipmentStats equipment = this.equipment != null
|
||||
? this.equipment
|
||||
: new ItemEquipmentStats.Builder().build();
|
||||
: new ItemEquipmentStats.ItemEquipmentStatsBuilder().build();
|
||||
|
||||
newEquipment = new ItemEquipmentStats.Builder()
|
||||
newEquipment = new ItemEquipmentStats.ItemEquipmentStatsBuilder()
|
||||
.slot(equipment.getSlot())
|
||||
.astab(equipment.getAstab() - other.equipment.getAstab())
|
||||
.aslash(equipment.getAslash() - other.equipment.getAslash())
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Forsco <https://github.com/forsco>
|
||||
* Copyright (c) 2020, Adam <Adam@sigterm.info>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -7,7 +7,6 @@
|
||||
*
|
||||
* 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.
|
||||
@@ -23,26 +22,23 @@
|
||||
* (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.loottracker;
|
||||
|
||||
package net.runelite.http.api.discord.embed;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Collection;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@ToString
|
||||
public class ImageEmbed
|
||||
public class LootAggregate
|
||||
{
|
||||
String url;
|
||||
String proxy_url;
|
||||
int height;
|
||||
int width;
|
||||
private String eventId;
|
||||
private LootRecordType type;
|
||||
private Collection<GameItem> drops;
|
||||
private Instant first_time;
|
||||
private Instant last_time;
|
||||
private int amount;
|
||||
}
|
||||
@@ -26,10 +26,8 @@ package net.runelite.http.api.loottracker;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@@ -38,27 +36,8 @@ import lombok.NoArgsConstructor;
|
||||
public class LootRecord
|
||||
{
|
||||
private String eventId;
|
||||
@Getter
|
||||
private String username;
|
||||
private LootRecordType type;
|
||||
private Object metadata;
|
||||
private Collection<GameItem> drops;
|
||||
private Instant time;
|
||||
|
||||
/**
|
||||
* constructor for lootRecords retrieved by http api (doesn't store/retrieve username)
|
||||
* @param eventId - the eventID or the name/title of the LootRecord
|
||||
* @param type - The LootRecordType
|
||||
* @param gameItems - the list of items/quantities
|
||||
* @param time - the Instant that the Loot Record was received
|
||||
*/
|
||||
public LootRecord(String eventId, LootRecordType type, List<GameItem> gameItems, Instant time)
|
||||
{
|
||||
// Insert blank username
|
||||
this.username = "";
|
||||
this.eventId = eventId;
|
||||
this.type = type;
|
||||
this.drops = gameItems;
|
||||
this.time = time;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ public enum LootRecordType
|
||||
NPC,
|
||||
PLAYER,
|
||||
EVENT,
|
||||
DEATH,
|
||||
PICKPOCKET,
|
||||
UNKNOWN
|
||||
}
|
||||
|
||||
@@ -64,13 +64,18 @@ public class LootTrackerClient
|
||||
{
|
||||
CompletableFuture<Void> future = new CompletableFuture<>();
|
||||
|
||||
RequestBody body = RequestBody.Companion.create(GSON.toJson(lootRecords), JSON);
|
||||
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||
.addPathSegment("loottracker")
|
||||
.build();
|
||||
|
||||
Request.Builder requestBuilder = new Request.Builder();
|
||||
if (uuid != null)
|
||||
{
|
||||
requestBuilder.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString());
|
||||
}
|
||||
requestBuilder.post(body);
|
||||
requestBuilder.post(RequestBody.create(JSON, GSON.toJson(lootRecords)))
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
client.newCall(requestBuilder.build()).enqueue(new Callback()
|
||||
{
|
||||
@@ -100,7 +105,7 @@ public class LootTrackerClient
|
||||
return future;
|
||||
}
|
||||
|
||||
public Collection<LootRecord> get() throws IOException
|
||||
public Collection<LootAggregate> get() throws IOException
|
||||
{
|
||||
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||
.addPathSegment("loottracker")
|
||||
@@ -120,7 +125,9 @@ public class LootTrackerClient
|
||||
}
|
||||
|
||||
InputStream in = response.body().byteStream();
|
||||
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), new TypeToken<List<LootRecord>>() {}.getType());
|
||||
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), new TypeToken<List<LootAggregate>>()
|
||||
{
|
||||
}.getType());
|
||||
}
|
||||
catch (JsonParseException ex)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
package net.runelite.http.api.osbuddy;
|
||||
|
||||
import com.google.gson.JsonParseException;
|
||||
import io.reactivex.rxjava3.core.Observable;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
@@ -44,7 +43,7 @@ public class OSBGrandExchangeClient
|
||||
{
|
||||
private final OkHttpClient client;
|
||||
|
||||
public Observable<OSBGrandExchangeResult> lookupItem(int itemId)
|
||||
public OSBGrandExchangeResult lookupItem(int itemId) throws IOException
|
||||
{
|
||||
final HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||
.addPathSegment("osb")
|
||||
@@ -54,8 +53,6 @@ public class OSBGrandExchangeClient
|
||||
|
||||
log.debug("Built URI: {}", url);
|
||||
|
||||
return Observable.defer(() ->
|
||||
{
|
||||
final Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.build();
|
||||
@@ -64,16 +61,15 @@ public class OSBGrandExchangeClient
|
||||
{
|
||||
if (!response.isSuccessful())
|
||||
{
|
||||
return Observable.error(new IOException("Error looking up item id: " + response));
|
||||
throw new IOException("Error looking up item id: " + response);
|
||||
}
|
||||
|
||||
final InputStream in = response.body().byteStream();
|
||||
return Observable.just(RuneLiteAPI.GSON.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), OSBGrandExchangeResult.class));
|
||||
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), OSBGrandExchangeResult.class);
|
||||
}
|
||||
catch (JsonParseException ex)
|
||||
{
|
||||
return Observable.error(ex);
|
||||
throw new IOException(ex);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,215 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Lucas <https://github.com/lucwousin>
|
||||
* 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.util;
|
||||
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonToken;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import net.runelite.http.api.item.ItemEquipmentStats;
|
||||
import net.runelite.http.api.item.ItemPrice;
|
||||
import net.runelite.http.api.item.ItemStats;
|
||||
|
||||
/**
|
||||
* A class to put GSON TypeAdapters. These make just as fast the first time you
|
||||
* deserialize something as it would otherwise be after creating these itself.
|
||||
* Kinda funny actually, cause the first time probably matters the most, especially
|
||||
* for jsons that only get deserialized once.
|
||||
*/
|
||||
public class TypeAdapters
|
||||
{
|
||||
public static final TypeAdapter<ItemStats> ITEMSTATS = new TypeAdapter<ItemStats>()
|
||||
{
|
||||
@Deprecated
|
||||
@Override
|
||||
public void write(JsonWriter out, ItemStats value)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStats read(JsonReader in) throws IOException
|
||||
{
|
||||
in.beginObject();
|
||||
|
||||
boolean quest = false;
|
||||
boolean equip = false;
|
||||
double weight = 0;
|
||||
ItemEquipmentStats stats = null;
|
||||
while (in.peek() != JsonToken.END_OBJECT)
|
||||
{
|
||||
switch (in.nextName())
|
||||
{
|
||||
case "quest":
|
||||
quest = in.nextBoolean();
|
||||
break;
|
||||
case "equipable":
|
||||
equip = in.nextBoolean();
|
||||
break;
|
||||
case "weight":
|
||||
weight = in.nextDouble();
|
||||
break;
|
||||
case "equipment":
|
||||
stats = EQUIPMENTSTATS.read(in);
|
||||
break;
|
||||
}
|
||||
}
|
||||
in.endObject();
|
||||
|
||||
return new ItemStats(quest, equip, weight, 0, stats);
|
||||
}
|
||||
};
|
||||
|
||||
public static final TypeAdapter<ItemEquipmentStats> EQUIPMENTSTATS = new TypeAdapter<ItemEquipmentStats>()
|
||||
{
|
||||
@Deprecated
|
||||
@Override
|
||||
public void write(JsonWriter out, ItemEquipmentStats value)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemEquipmentStats read(JsonReader in) throws IOException
|
||||
{
|
||||
ItemEquipmentStats.Builder builder = ItemEquipmentStats.builder();
|
||||
|
||||
in.beginObject();
|
||||
while (in.peek() != JsonToken.END_OBJECT)
|
||||
{
|
||||
String name = in.nextName();
|
||||
int val = in.nextInt();
|
||||
switch (name)
|
||||
{
|
||||
case "slot":
|
||||
builder.slot(val);
|
||||
break;
|
||||
case "astab":
|
||||
builder.astab(val);
|
||||
break;
|
||||
case "aslash":
|
||||
builder.aslash(val);
|
||||
break;
|
||||
case "acrush":
|
||||
builder.acrush(val);
|
||||
break;
|
||||
case "amagic":
|
||||
builder.amagic(val);
|
||||
break;
|
||||
case "arange":
|
||||
builder.arange(val);
|
||||
break;
|
||||
case "dstab":
|
||||
builder.dstab(val);
|
||||
break;
|
||||
case "dslash":
|
||||
builder.dslash(val);
|
||||
break;
|
||||
case "dcrush":
|
||||
builder.dcrush(val);
|
||||
break;
|
||||
case "dmagic":
|
||||
builder.dmagic(val);
|
||||
break;
|
||||
case "drange":
|
||||
builder.drange(val);
|
||||
break;
|
||||
case "str":
|
||||
builder.str(val);
|
||||
break;
|
||||
case "rstr":
|
||||
builder.rstr(val);
|
||||
break;
|
||||
case "mdmg":
|
||||
builder.mdmg(val);
|
||||
break;
|
||||
case "prayer":
|
||||
builder.prayer(val);
|
||||
break;
|
||||
case "aspeed":
|
||||
builder.aspeed(val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
in.endObject();
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
};
|
||||
|
||||
public static final TypeAdapter<ItemPrice> ITEMPRICE = new TypeAdapter<ItemPrice>()
|
||||
{
|
||||
@Override
|
||||
public void write(JsonWriter out, ItemPrice value)
|
||||
{
|
||||
throw new UnsupportedOperationException("Not supported");
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemPrice read(JsonReader in) throws IOException
|
||||
{
|
||||
/*
|
||||
* The ItemPrice json hosted by runelite is 'perfect'
|
||||
* by that I mean every field always exists, even with value 0.
|
||||
* This is why we can skip names and known-0 values
|
||||
*/
|
||||
ItemPrice ret = new ItemPrice();
|
||||
|
||||
in.beginObject();
|
||||
|
||||
// ID
|
||||
in.skipValue();
|
||||
ret.setId(in.nextInt());
|
||||
|
||||
// Name
|
||||
in.skipValue();
|
||||
ret.setName(in.nextString());
|
||||
|
||||
// Price
|
||||
in.skipValue();
|
||||
ret.setPrice(in.nextInt());
|
||||
|
||||
// Time
|
||||
in.skipValue();
|
||||
in.beginObject();
|
||||
|
||||
// Secs
|
||||
in.skipValue();
|
||||
ret.setTime(Instant.ofEpochSecond(in.nextLong()));
|
||||
|
||||
// Nanos
|
||||
in.skipValue();
|
||||
in.skipValue();
|
||||
|
||||
in.endObject();
|
||||
in.endObject();
|
||||
|
||||
return ret;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -33,7 +33,6 @@ import java.nio.charset.StandardCharsets;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
import okhttp3.CacheControl;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
@@ -55,7 +54,6 @@ public class WorldClient
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.cacheControl(CacheControl.FORCE_NETWORK)
|
||||
.build();
|
||||
|
||||
try (Response response = client.newCall(request).execute())
|
||||
|
||||
@@ -16,6 +16,10 @@
|
||||
|
||||
package net.runelite.http.api.ws;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
@@ -27,9 +31,6 @@ import com.google.gson.internal.Streams;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import java.io.IOException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Adapts values whose runtime type may differ from their declaration type. This
|
||||
|
||||
@@ -24,9 +24,7 @@
|
||||
*/
|
||||
package net.runelite.http.api.ws;
|
||||
|
||||
import net.runelite.api.events.Event;
|
||||
|
||||
public class WebsocketMessage implements Event
|
||||
public class WebsocketMessage
|
||||
{
|
||||
protected boolean _party;
|
||||
|
||||
|
||||
@@ -25,10 +25,9 @@
|
||||
package net.runelite.http.api.ws.messages;
|
||||
|
||||
import java.util.UUID;
|
||||
import net.runelite.api.events.Event;
|
||||
import net.runelite.http.api.ws.WebsocketMessage;
|
||||
|
||||
public class Handshake extends WebsocketMessage implements Event
|
||||
public class Handshake extends WebsocketMessage
|
||||
{
|
||||
private UUID session;
|
||||
|
||||
|
||||
@@ -24,14 +24,13 @@
|
||||
*/
|
||||
package net.runelite.http.api.ws.messages;
|
||||
|
||||
import net.runelite.api.events.Event;
|
||||
import net.runelite.http.api.ws.WebsocketMessage;
|
||||
|
||||
/**
|
||||
* Called after a successful login to the server
|
||||
* @author Adam
|
||||
*/
|
||||
public class LoginResponse extends WebsocketMessage implements Event
|
||||
public class LoginResponse extends WebsocketMessage
|
||||
{
|
||||
private String username;
|
||||
|
||||
|
||||
@@ -27,12 +27,11 @@ package net.runelite.http.api.ws.messages.party;
|
||||
import java.util.UUID;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Value;
|
||||
import net.runelite.api.events.Event;
|
||||
import net.runelite.http.api.ws.WebsocketMessage;
|
||||
|
||||
@Value
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class Join extends WebsocketMessage implements Event
|
||||
public class Join extends WebsocketMessage
|
||||
{
|
||||
private final UUID partyId;
|
||||
private final String name;
|
||||
|
||||
@@ -24,7 +24,8 @@
|
||||
*/
|
||||
package net.runelite.http.api.ws.messages.party;
|
||||
|
||||
import net.runelite.api.events.Event;
|
||||
import net.runelite.http.api.ws.WebsocketMessage;
|
||||
|
||||
public class Part extends WebsocketMessage implements Event {}
|
||||
public class Part extends WebsocketMessage
|
||||
{
|
||||
}
|
||||
|
||||
@@ -24,12 +24,10 @@
|
||||
*/
|
||||
package net.runelite.http.api.ws.messages.party;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Value;
|
||||
import net.runelite.api.events.Event;
|
||||
|
||||
@Value
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PartyChatMessage extends PartyMemberMessage implements Event
|
||||
public class PartyChatMessage extends PartyMemberMessage
|
||||
{
|
||||
private final String value;
|
||||
}
|
||||
|
||||
@@ -3,11 +3,10 @@ package net.runelite.http.api.ws.messages.party;
|
||||
import java.util.UUID;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.events.Event;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public abstract class PartyMemberMessage extends PartyMessage implements Event
|
||||
public abstract class PartyMemberMessage extends PartyMessage
|
||||
{
|
||||
private UUID memberId;
|
||||
}
|
||||
|
||||
@@ -24,10 +24,9 @@
|
||||
*/
|
||||
package net.runelite.http.api.ws.messages.party;
|
||||
|
||||
import net.runelite.api.events.Event;
|
||||
import net.runelite.http.api.ws.WebsocketMessage;
|
||||
|
||||
public abstract class PartyMessage extends WebsocketMessage implements Event
|
||||
public abstract class PartyMessage extends WebsocketMessage
|
||||
{
|
||||
public PartyMessage()
|
||||
{
|
||||
|
||||
@@ -27,12 +27,11 @@ package net.runelite.http.api.ws.messages.party;
|
||||
import java.util.UUID;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Value;
|
||||
import net.runelite.api.events.Event;
|
||||
import net.runelite.http.api.ws.WebsocketMessage;
|
||||
|
||||
@Value
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserJoin extends WebsocketMessage implements Event
|
||||
public class UserJoin extends WebsocketMessage
|
||||
{
|
||||
private final UUID memberId;
|
||||
private final UUID partyId;
|
||||
|
||||
@@ -27,12 +27,11 @@ package net.runelite.http.api.ws.messages.party;
|
||||
import java.util.UUID;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Value;
|
||||
import net.runelite.api.events.Event;
|
||||
import net.runelite.http.api.ws.WebsocketMessage;
|
||||
|
||||
@Value
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserPart extends WebsocketMessage implements Event
|
||||
public class UserPart extends WebsocketMessage
|
||||
{
|
||||
private final UUID memberId;
|
||||
}
|
||||
|
||||
@@ -26,8 +26,9 @@ package net.runelite.http.api.ws.messages.party;
|
||||
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Value;
|
||||
import net.runelite.api.events.Event;
|
||||
|
||||
@Value
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class UserSync extends PartyMemberMessage implements Event {}
|
||||
public class UserSync extends PartyMemberMessage
|
||||
{
|
||||
}
|
||||
|
||||
@@ -29,16 +29,18 @@ import com.google.gson.reflect.TypeToken;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
import static net.runelite.http.api.RuneLiteAPI.JSON;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.RequestBody;
|
||||
import okhttp3.Response;
|
||||
|
||||
@Slf4j
|
||||
@@ -47,21 +49,18 @@ public class XteaClient
|
||||
{
|
||||
private final OkHttpClient client;
|
||||
|
||||
public void submit(int region, int[] keys)
|
||||
public void submit(XteaRequest xteaRequest)
|
||||
{
|
||||
String json = RuneLiteAPI.GSON.toJson(xteaRequest);
|
||||
|
||||
HttpUrl url = RuneLiteAPI.getXteaBase().newBuilder()
|
||||
.addPathSegment("submit")
|
||||
.addQueryParameter("region", String.valueOf(region))
|
||||
.addQueryParameter("key1", String.valueOf(keys[0]))
|
||||
.addQueryParameter("key2", String.valueOf(keys[1]))
|
||||
.addQueryParameter("key3", String.valueOf(keys[2]))
|
||||
.addQueryParameter("key4", String.valueOf(keys[3]))
|
||||
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||
.addPathSegment("xtea")
|
||||
.build();
|
||||
|
||||
log.debug("Built URI: {}", url);
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.post(RequestBody.create(JSON, json))
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
@@ -91,10 +90,10 @@ public class XteaClient
|
||||
});
|
||||
}
|
||||
|
||||
public HashMap<Integer, Integer[]> get() throws IOException
|
||||
public List<XteaKey> get() throws IOException
|
||||
{
|
||||
HttpUrl url = RuneLiteAPI.getXteaBase().newBuilder()
|
||||
.addPathSegment("get")
|
||||
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||
.addPathSegment("xtea")
|
||||
.build();
|
||||
|
||||
Request request = new Request.Builder()
|
||||
@@ -105,7 +104,7 @@ public class XteaClient
|
||||
{
|
||||
InputStream in = response.body().byteStream();
|
||||
// CHECKSTYLE:OFF
|
||||
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), new TypeToken<HashMap<Integer, Integer[]>>() {}.getType());
|
||||
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), new TypeToken<List<XteaKey>>() { }.getType());
|
||||
// CHECKSTYLE:ON
|
||||
}
|
||||
catch (JsonParseException ex)
|
||||
@@ -113,4 +112,26 @@ public class XteaClient
|
||||
throw new IOException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public XteaKey get(int region) throws IOException
|
||||
{
|
||||
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
||||
.addPathSegment("xtea")
|
||||
.addPathSegment(Integer.toString(region))
|
||||
.build();
|
||||
|
||||
Request request = new Request.Builder()
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
try (Response response = client.newCall(request).execute())
|
||||
{
|
||||
InputStream in = response.body().byteStream();
|
||||
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), XteaKey.class);
|
||||
}
|
||||
catch (JsonParseException ex)
|
||||
{
|
||||
throw new IOException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,7 @@ package net.runelite.http.api.xtea;
|
||||
public class XteaKey
|
||||
{
|
||||
private int region;
|
||||
private int[] keys;
|
||||
private int keys[];
|
||||
|
||||
public int getRegion()
|
||||
{
|
||||
|
||||
@@ -932,7 +932,7 @@ public interface Client extends GameShell
|
||||
* @return the corresponding object composition
|
||||
* @see ObjectID
|
||||
*/
|
||||
ObjectDefinition getObjectDefinition(int objectId);
|
||||
ObjectDefinition getObjectComposition(int objectId);
|
||||
|
||||
/**
|
||||
* Gets the NPC composition corresponding to an NPCs ID.
|
||||
@@ -1010,7 +1010,7 @@ public interface Client extends GameShell
|
||||
* @param height the height
|
||||
* @return the sprite image
|
||||
*/
|
||||
SpritePixels createSprite(int[] pixels, int width, int height);
|
||||
SpritePixels createSpritePixels(int[] pixels, int width, int height);
|
||||
|
||||
/**
|
||||
* Gets the location of the local player.
|
||||
@@ -1863,7 +1863,7 @@ public interface Client extends GameShell
|
||||
|
||||
void setSelectedSpellName(String name);
|
||||
|
||||
boolean isSpellSelected();
|
||||
boolean getSpellSelected();
|
||||
|
||||
String getSelectedSpellActionName();
|
||||
|
||||
|
||||
@@ -37,18 +37,18 @@ public class MenuEntry implements Cloneable
|
||||
/**
|
||||
* The option text added to the menu (ie. "Walk here", "Use").
|
||||
*/
|
||||
private String option;
|
||||
private String menuOption;
|
||||
/**
|
||||
* The target of the action (ie. Item or Actor name).
|
||||
* <p>
|
||||
* If the option does not apply to any target, this field
|
||||
* will be set to empty string.
|
||||
*/
|
||||
private String target;
|
||||
private String menuTarget;
|
||||
/**
|
||||
* An identifier value for the target of the action.
|
||||
*/
|
||||
private int identifier;
|
||||
private int type;
|
||||
/**
|
||||
* The action the entry will trigger.
|
||||
* {@link MenuAction}
|
||||
@@ -57,11 +57,11 @@ public class MenuEntry implements Cloneable
|
||||
/**
|
||||
* An additional parameter for the action.
|
||||
*/
|
||||
private int param0;
|
||||
private int actionParam0;
|
||||
/**
|
||||
* A second additional parameter for the action.
|
||||
*/
|
||||
private int param1;
|
||||
private int widgetId;
|
||||
/**
|
||||
* If this field is true and you have single mouse button on and this entry is
|
||||
* the top entry the right click menu will not be opened when you left click
|
||||
@@ -70,14 +70,14 @@ public class MenuEntry implements Cloneable
|
||||
*/
|
||||
private boolean forceLeftClick;
|
||||
|
||||
public MenuEntry(String option, String target, int identifier, int opcode, int param0, int param1, boolean forceLeftClick)
|
||||
public MenuEntry(String menuOption, String menuTarget, int type, int opcode, int actionParam0, int widgetId, boolean forceLeftClick)
|
||||
{
|
||||
this.option = option;
|
||||
this.target = target;
|
||||
this.identifier = identifier;
|
||||
this.menuOption = menuOption;
|
||||
this.menuTarget = menuTarget;
|
||||
this.type = type;
|
||||
this.opcode = opcode;
|
||||
this.param0 = param0;
|
||||
this.param1 = param1;
|
||||
this.actionParam0 = actionParam0;
|
||||
this.widgetId = widgetId;
|
||||
this.forceLeftClick = forceLeftClick;
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ public class MenuEntry implements Cloneable
|
||||
/**
|
||||
* Get opcode, but as it's enum counterpart
|
||||
*/
|
||||
public MenuAction getMenuOpcode()
|
||||
public MenuAction getMenuAction()
|
||||
{
|
||||
return MenuAction.of(getOpcode());
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public interface NPC extends Actor
|
||||
*
|
||||
* @return the composition
|
||||
*/
|
||||
NPCComposition getDefinition();
|
||||
NPCComposition getComposition();
|
||||
|
||||
/**
|
||||
* Get the composition for this NPC and transform it if required
|
||||
|
||||
@@ -31,7 +31,7 @@ public class BeforeRender implements Event
|
||||
{
|
||||
public static final BeforeRender INSTANCE = new BeforeRender();
|
||||
|
||||
private BeforeRender()
|
||||
public BeforeRender()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
@@ -24,14 +24,14 @@
|
||||
*/
|
||||
package net.runelite.api.events;
|
||||
|
||||
import lombok.Value;
|
||||
import lombok.Data;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.Tile;
|
||||
|
||||
/**
|
||||
* An event where a {@link GameObject} is added to a {@link Tile}.
|
||||
*/
|
||||
@Value
|
||||
@Data
|
||||
public class GameObjectSpawned implements Event
|
||||
{
|
||||
/**
|
||||
|
||||
@@ -45,7 +45,7 @@ public class GameTick implements Event
|
||||
{
|
||||
public static final GameTick INSTANCE = new GameTick();
|
||||
|
||||
private GameTick()
|
||||
public GameTick()
|
||||
{
|
||||
// noop
|
||||
}
|
||||
|
||||
@@ -86,12 +86,12 @@ public class MenuOptionClicked extends MenuEntry implements Event
|
||||
|
||||
public void setMenuEntry(MenuEntry e)
|
||||
{
|
||||
setOption(e.getOption());
|
||||
setTarget(e.getTarget());
|
||||
setIdentifier(e.getIdentifier());
|
||||
setMenuOption(e.getMenuOption());
|
||||
setMenuTarget(e.getMenuTarget());
|
||||
setType(e.getType());
|
||||
setOpcode(e.getOpcode());
|
||||
setParam0(e.getParam0());
|
||||
setParam1(e.getParam1());
|
||||
setActionParam0(e.getActionParam0());
|
||||
setWidgetId(e.getWidgetId());
|
||||
setForceLeftClick(e.isForceLeftClick());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,6 @@ import java.awt.event.KeyEvent;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseWheelEvent;
|
||||
import net.runelite.api.MainBufferProvider;
|
||||
import net.runelite.api.events.Event;
|
||||
import net.runelite.api.widgets.WidgetItem;
|
||||
|
||||
/**
|
||||
@@ -38,18 +37,18 @@ import net.runelite.api.widgets.WidgetItem;
|
||||
public interface Callbacks
|
||||
{
|
||||
/**
|
||||
* Post an event. See the events in api.events.
|
||||
* Post an event. See the events in net.runelite.api.events.
|
||||
*
|
||||
* @param event the event
|
||||
*/
|
||||
<T extends Event, E extends T> void post(Class<T> eventClass, E event);
|
||||
void post(Object event);
|
||||
|
||||
/**
|
||||
* Post a deferred event, which gets delayed until the next cycle.
|
||||
*
|
||||
* @param event the event
|
||||
*/
|
||||
<T extends Event, E extends T> void postDeferred(Class<T> eventClass, E event);
|
||||
void postDeferred(Object event);
|
||||
|
||||
/**
|
||||
* Called each client cycle.
|
||||
@@ -71,6 +70,8 @@ public interface Callbacks
|
||||
*/
|
||||
void drawAboveOverheads();
|
||||
|
||||
void drawAfterWidgets();
|
||||
|
||||
/**
|
||||
* Client top-most draw method, rendering over top of most of game interfaces.
|
||||
*
|
||||
|
||||
@@ -74,6 +74,7 @@ dependencies {
|
||||
exclude(group = "org.slf4j")
|
||||
}
|
||||
implementation(group = "org.pf4j", name = "pf4j-update", version = "2.3.0")
|
||||
implementation(group = "com.google.archivepatcher", name = "archive-patch-applier", version= "1.0.4")
|
||||
implementation(project(":http-api"))
|
||||
|
||||
runtimeOnly(group = "org.pushing-pixels", name = "radiance-trident", version = "2.5.1")
|
||||
|
||||
@@ -52,6 +52,8 @@ import net.runelite.client.util.DeferredEventBus;
|
||||
import net.runelite.client.util.ExecutorServiceExceptionLogger;
|
||||
import net.runelite.http.api.chat.ChatClient;
|
||||
import okhttp3.OkHttpClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
@AllArgsConstructor
|
||||
public class RuneLiteModule extends AbstractModule
|
||||
@@ -87,6 +89,10 @@ public class RuneLiteModule extends AbstractModule
|
||||
bind(EventBus.class)
|
||||
.annotatedWith(Names.named("Deferred EventBus"))
|
||||
.to(DeferredEventBus.class);
|
||||
|
||||
bind(Logger.class)
|
||||
.annotatedWith(Names.named("Core Logger"))
|
||||
.toInstance(LoggerFactory.getLogger(RuneLite.class));
|
||||
}
|
||||
|
||||
@Provides
|
||||
|
||||
@@ -85,7 +85,6 @@ import net.runelite.api.Player;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.PlayerChanged;
|
||||
import net.runelite.api.events.UsernameChanged;
|
||||
import net.runelite.api.events.WorldChanged;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.account.AccountSession;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
@@ -1043,12 +1042,6 @@ public class ConfigManager
|
||||
updateRSProfile();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onWorldChanged(WorldChanged ev)
|
||||
{
|
||||
updateRSProfile();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onPlayerChanged(PlayerChanged ev)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,6 @@ package net.runelite.client.config;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
|
||||
import java.awt.Font;
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -109,8 +109,8 @@ public class MenuManager
|
||||
{
|
||||
for (MenuEntry menuEntry : client.getMenuEntries())
|
||||
{
|
||||
String option = menuEntry.getOption();
|
||||
String target = menuEntry.getTarget();
|
||||
String option = menuEntry.getMenuOption();
|
||||
String target = menuEntry.getMenuTarget();
|
||||
|
||||
if (option.equals(customMenuOption.getMenuOption()) && target.equals(customMenuOption.getMenuTarget()))
|
||||
{
|
||||
@@ -128,7 +128,7 @@ public class MenuManager
|
||||
return;
|
||||
}
|
||||
|
||||
int widgetId = event.getActionParam1();
|
||||
int widgetId = event.getWidgetId();
|
||||
Collection<WidgetMenuOption> options = managedMenuOptions.get(widgetId);
|
||||
|
||||
for (WidgetMenuOption currentMenu : options)
|
||||
@@ -139,9 +139,9 @@ public class MenuManager
|
||||
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
|
||||
|
||||
MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
|
||||
menuEntry.setOption(currentMenu.getMenuOption());
|
||||
menuEntry.setParam1(widgetId);
|
||||
menuEntry.setTarget(currentMenu.getMenuTarget());
|
||||
menuEntry.setMenuOption(currentMenu.getMenuOption());
|
||||
menuEntry.setWidgetId(widgetId);
|
||||
menuEntry.setMenuTarget(currentMenu.getMenuTarget());
|
||||
menuEntry.setType(MenuAction.RUNELITE.getId());
|
||||
|
||||
client.setMenuEntries(menuEntries);
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
package net.runelite.client.menus;
|
||||
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.ui.JagexColors;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
@@ -133,37 +133,11 @@ public class ClientLoader implements Supplier<Applet>
|
||||
StandardOpenOption.CREATE, StandardOpenOption.READ, StandardOpenOption.WRITE);
|
||||
FileLock flock = lockfile.lock())
|
||||
{
|
||||
SplashScreen.stage(.05, null, "Downloading Old School RuneScape");
|
||||
try
|
||||
{
|
||||
updateVanilla(config);
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
// try again with the fallback config and gamepack
|
||||
if (!config.isFallback())
|
||||
{
|
||||
log.warn("Unable to download game client, attempting to use fallback config", ex);
|
||||
config = downloadFallbackConfig();
|
||||
updateVanilla(config);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
if (updateCheckMode == AUTO)
|
||||
{
|
||||
SplashScreen.stage(.35, null, "Patching");
|
||||
applyPatch();
|
||||
}
|
||||
|
||||
SplashScreen.stage(.40, null, "Loading client");
|
||||
File jarFile = updateCheckMode == AUTO ? PATCHED_CACHE : VANILLA_CACHE;
|
||||
// create the classloader for the jar while we hold the lock, and eagerly load and link all classes
|
||||
// in the jar. Otherwise the jar can change on disk and can break future classloads.
|
||||
classLoader = createJarClassLoader(jarFile);
|
||||
classLoader = createJarClassLoader(new File("./injected-client/build/libs/injected-client-3.5.4.jar"));
|
||||
}
|
||||
|
||||
SplashScreen.stage(.465, "Starting", "Starting Old School RuneScape");
|
||||
@@ -175,7 +149,7 @@ public class ClientLoader implements Supplier<Applet>
|
||||
return rs;
|
||||
}
|
||||
catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException
|
||||
| VerificationException | SecurityException e)
|
||||
| SecurityException e)
|
||||
{
|
||||
log.error("Error loading RS!", e);
|
||||
|
||||
@@ -543,7 +517,7 @@ public class ClientLoader implements Supplier<Applet>
|
||||
|
||||
if (rs instanceof Client)
|
||||
{
|
||||
log.info("client-patch {}", ((Client) rs).getBuildID());
|
||||
//.info("client-patch {}", ((Client) rs).getBuildID());
|
||||
}
|
||||
|
||||
return rs;
|
||||
|
||||
@@ -143,7 +143,7 @@ public class OverlayManager
|
||||
|
||||
event.consume();
|
||||
|
||||
Overlay overlay = overlays.get(event.getId());
|
||||
Overlay overlay = overlays.get(event.getType());
|
||||
if (overlay != null)
|
||||
{
|
||||
List<OverlayMenuEntry> menuEntries = overlay.getMenuEntries();
|
||||
|
||||
@@ -877,10 +877,10 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
||||
OverlayMenuEntry overlayMenuEntry = menuEntries.get(i);
|
||||
|
||||
final MenuEntry entry = new MenuEntry();
|
||||
entry.setOption(overlayMenuEntry.getOption());
|
||||
entry.setTarget(ColorUtil.wrapWithColorTag(overlayMenuEntry.getTarget(), JagexColors.MENU_TARGET));
|
||||
entry.setMenuOption(overlayMenuEntry.getOption());
|
||||
entry.setMenuTarget(ColorUtil.wrapWithColorTag(overlayMenuEntry.getTarget(), JagexColors.MENU_TARGET));
|
||||
entry.setType(overlayMenuEntry.getMenuAction().getId());
|
||||
entry.setIdentifier(overlayManager.getOverlays().indexOf(overlay)); // overlay id
|
||||
entry.setType(overlayManager.getOverlays().indexOf(overlay)); // overlay id
|
||||
|
||||
entries[i] = entry;
|
||||
}
|
||||
|
||||
@@ -65,10 +65,10 @@ public class ObsidianSkin extends SubstanceSkin
|
||||
|
||||
final SubstanceColorSchemeBundle defaultSchemeBundle = new SubstanceColorSchemeBundle(
|
||||
activeScheme, enabledScheme, enabledScheme);
|
||||
defaultSchemeBundle.registerColorScheme(enabledScheme, 0.6f,
|
||||
ComponentState.DISABLED_UNSELECTED);
|
||||
defaultSchemeBundle.registerColorScheme(activeScheme, 0.6f,
|
||||
ComponentState.DISABLED_SELECTED);
|
||||
//defaultSchemeBundle.registerColorScheme(enabledScheme, 0.6f,
|
||||
// ComponentState.DISABLED_UNSELECTED);
|
||||
//defaultSchemeBundle.registerColorScheme(activeScheme, 0.6f,
|
||||
// ComponentState.DISABLED_SELECTED);
|
||||
|
||||
// borders
|
||||
final SubstanceColorScheme borderDisabledSelectedScheme = schemes
|
||||
@@ -82,9 +82,9 @@ public class ObsidianSkin extends SubstanceSkin
|
||||
final SubstanceColorScheme markActiveScheme = schemes.get("RuneLite Mark Active");
|
||||
defaultSchemeBundle.registerColorScheme(markActiveScheme, ColorSchemeAssociationKind.MARK,
|
||||
ComponentState.getActiveStates());
|
||||
defaultSchemeBundle.registerColorScheme(markActiveScheme, 0.6f,
|
||||
ColorSchemeAssociationKind.MARK, ComponentState.DISABLED_SELECTED,
|
||||
ComponentState.DISABLED_UNSELECTED);
|
||||
//defaultSchemeBundle.registerColorScheme(markActiveScheme, 0.6f,
|
||||
// ColorSchemeAssociationKind.MARK, ComponentState.DISABLED_SELECTED,
|
||||
// ComponentState.DISABLED_UNSELECTED);
|
||||
|
||||
// separators
|
||||
final SubstanceColorScheme separatorScheme = schemes.get("RuneLite Separator");
|
||||
@@ -102,8 +102,8 @@ public class ObsidianSkin extends SubstanceSkin
|
||||
|
||||
final SubstanceColorSchemeBundle decorationsSchemeBundle = new SubstanceColorSchemeBundle(
|
||||
activeScheme, enabledScheme, enabledScheme);
|
||||
decorationsSchemeBundle.registerColorScheme(enabledScheme, 0.5f,
|
||||
ComponentState.DISABLED_UNSELECTED);
|
||||
//decorationsSchemeBundle.registerColorScheme(enabledScheme, 0.5f,
|
||||
// ComponentState.DISABLED_UNSELECTED);
|
||||
|
||||
// borders
|
||||
decorationsSchemeBundle.registerColorScheme(borderDisabledSelectedScheme,
|
||||
@@ -129,8 +129,8 @@ public class ObsidianSkin extends SubstanceSkin
|
||||
|
||||
final SubstanceColorSchemeBundle headerSchemeBundle = new SubstanceColorSchemeBundle(activeScheme,
|
||||
enabledScheme, enabledScheme);
|
||||
headerSchemeBundle.registerColorScheme(enabledScheme, 0.5f,
|
||||
ComponentState.DISABLED_UNSELECTED);
|
||||
//headerSchemeBundle.registerColorScheme(enabledScheme, 0.5f,
|
||||
// ComponentState.DISABLED_UNSELECTED);
|
||||
|
||||
// borders
|
||||
final SubstanceColorScheme headerBorderScheme = schemes.get("RuneLite Header Border");
|
||||
@@ -142,13 +142,13 @@ public class ObsidianSkin extends SubstanceSkin
|
||||
headerSchemeBundle.registerColorScheme(markActiveScheme, ColorSchemeAssociationKind.MARK,
|
||||
ComponentState.getActiveStates());
|
||||
|
||||
headerSchemeBundle.registerHighlightColorScheme(activeScheme, 0.7f,
|
||||
ComponentState.ROLLOVER_UNSELECTED, ComponentState.ROLLOVER_ARMED,
|
||||
ComponentState.ARMED);
|
||||
headerSchemeBundle.registerHighlightColorScheme(activeScheme, 0.8f,
|
||||
ComponentState.SELECTED);
|
||||
headerSchemeBundle.registerHighlightColorScheme(activeScheme, 1.0f,
|
||||
ComponentState.ROLLOVER_SELECTED);
|
||||
//headerSchemeBundle.registerHighlightColorScheme(activeScheme, 0.7f,
|
||||
// ComponentState.ROLLOVER_UNSELECTED, ComponentState.ROLLOVER_ARMED,
|
||||
// ComponentState.ARMED);
|
||||
//headerSchemeBundle.registerHighlightColorScheme(activeScheme, 0.8f,
|
||||
// ComponentState.SELECTED);
|
||||
//headerSchemeBundle.registerHighlightColorScheme(activeScheme, 1.0f,
|
||||
// ComponentState.ROLLOVER_SELECTED);
|
||||
|
||||
final SubstanceColorScheme headerWatermarkScheme = schemes.get("RuneLite Header Watermark");
|
||||
|
||||
|
||||
@@ -547,7 +547,8 @@
|
||||
526,
|
||||
2530,
|
||||
3187,
|
||||
24655
|
||||
24655,
|
||||
25199
|
||||
],
|
||||
"monks robe": [
|
||||
542,
|
||||
@@ -1652,6 +1653,10 @@
|
||||
1005,
|
||||
7957
|
||||
],
|
||||
"red cape": [
|
||||
1007,
|
||||
25207
|
||||
],
|
||||
"blue skirt": [
|
||||
1011,
|
||||
7386,
|
||||
@@ -1662,6 +1667,11 @@
|
||||
12445,
|
||||
12447
|
||||
],
|
||||
"blue cape": [
|
||||
1021,
|
||||
25195,
|
||||
25208
|
||||
],
|
||||
"blue partyhat": [
|
||||
1042,
|
||||
2422
|
||||
@@ -3353,7 +3363,17 @@
|
||||
],
|
||||
"explosive potion": [
|
||||
4045,
|
||||
23818
|
||||
23818,
|
||||
25211
|
||||
],
|
||||
"bandages": [
|
||||
4049,
|
||||
25202
|
||||
],
|
||||
"barricade": [
|
||||
4053,
|
||||
25209,
|
||||
25210
|
||||
],
|
||||
"decorative sword": [
|
||||
4068,
|
||||
@@ -3402,7 +3422,12 @@
|
||||
4506,
|
||||
4511,
|
||||
20489,
|
||||
24160
|
||||
24160,
|
||||
25157,
|
||||
25165,
|
||||
25169,
|
||||
25174,
|
||||
25176
|
||||
],
|
||||
"decorative shield": [
|
||||
4072,
|
||||
@@ -3415,11 +3440,14 @@
|
||||
4081,
|
||||
10588,
|
||||
12017,
|
||||
12018
|
||||
12018,
|
||||
25250,
|
||||
25278
|
||||
],
|
||||
"sled": [
|
||||
4083,
|
||||
4084
|
||||
4084,
|
||||
25282
|
||||
],
|
||||
"dragon platelegs": [
|
||||
4087,
|
||||
@@ -3494,7 +3522,8 @@
|
||||
],
|
||||
"stick": [
|
||||
4179,
|
||||
9702
|
||||
9702,
|
||||
25285
|
||||
],
|
||||
"extended brush": [
|
||||
4191,
|
||||
@@ -4790,20 +4819,24 @@
|
||||
"seers ring": [
|
||||
6731,
|
||||
11770,
|
||||
23624
|
||||
23624,
|
||||
25258
|
||||
],
|
||||
"archers ring": [
|
||||
6733,
|
||||
11771
|
||||
11771,
|
||||
25260
|
||||
],
|
||||
"warrior ring": [
|
||||
6735,
|
||||
11772
|
||||
11772,
|
||||
25262
|
||||
],
|
||||
"berserker ring": [
|
||||
6737,
|
||||
11773,
|
||||
23595
|
||||
23595,
|
||||
25264
|
||||
],
|
||||
"darklight": [
|
||||
6746,
|
||||
@@ -6114,7 +6147,18 @@
|
||||
11781,
|
||||
11782,
|
||||
11783,
|
||||
11784
|
||||
11784,
|
||||
25266,
|
||||
25267,
|
||||
25268,
|
||||
25269,
|
||||
25270,
|
||||
25271,
|
||||
25272,
|
||||
25273,
|
||||
25274,
|
||||
25275,
|
||||
25276
|
||||
],
|
||||
"bandana eyepatch": [
|
||||
8924,
|
||||
@@ -7387,7 +7431,15 @@
|
||||
23073,
|
||||
23075,
|
||||
24370,
|
||||
24444
|
||||
24444,
|
||||
25177,
|
||||
25179,
|
||||
25181,
|
||||
25183,
|
||||
25185,
|
||||
25187,
|
||||
25189,
|
||||
25191
|
||||
],
|
||||
"slayer ring": [
|
||||
11866,
|
||||
@@ -7472,15 +7524,18 @@
|
||||
],
|
||||
"ring of the gods": [
|
||||
12601,
|
||||
13202
|
||||
13202,
|
||||
25252
|
||||
],
|
||||
"tyrannical ring": [
|
||||
12603,
|
||||
12691
|
||||
12691,
|
||||
25254
|
||||
],
|
||||
"treasonous ring": [
|
||||
12605,
|
||||
12692
|
||||
12692,
|
||||
25256
|
||||
],
|
||||
"bandos page": [
|
||||
12613,
|
||||
@@ -8215,7 +8270,9 @@
|
||||
19550,
|
||||
19710,
|
||||
20655,
|
||||
20657
|
||||
20657,
|
||||
25246,
|
||||
25248
|
||||
],
|
||||
"amulet of torture": [
|
||||
19553,
|
||||
@@ -8594,7 +8651,8 @@
|
||||
],
|
||||
"granite ring": [
|
||||
21739,
|
||||
21752
|
||||
21752,
|
||||
25193
|
||||
],
|
||||
"imbued saradomin max cape": [
|
||||
21776,
|
||||
@@ -8872,6 +8930,10 @@
|
||||
22405,
|
||||
22446
|
||||
],
|
||||
"old key": [
|
||||
22428,
|
||||
25244
|
||||
],
|
||||
"battlemage potion": [
|
||||
22449,
|
||||
22452,
|
||||
@@ -9478,5 +9540,64 @@
|
||||
"extradimensional bag": [
|
||||
25106,
|
||||
25108
|
||||
],
|
||||
"decorative boots": [
|
||||
25155,
|
||||
25163,
|
||||
25167,
|
||||
25171,
|
||||
25173
|
||||
],
|
||||
"castlewars brew": [
|
||||
25159,
|
||||
25160,
|
||||
25161,
|
||||
25162
|
||||
],
|
||||
"soul fragment": [
|
||||
25196,
|
||||
25201
|
||||
],
|
||||
"potion of power": [
|
||||
25203,
|
||||
25204,
|
||||
25205,
|
||||
25206
|
||||
],
|
||||
"blue icon": [
|
||||
25212,
|
||||
25213,
|
||||
25214,
|
||||
25215,
|
||||
25216,
|
||||
25217,
|
||||
25218,
|
||||
25219,
|
||||
25220,
|
||||
25221,
|
||||
25222,
|
||||
25223,
|
||||
25224,
|
||||
25225,
|
||||
25226,
|
||||
25227
|
||||
],
|
||||
"red icon": [
|
||||
25228,
|
||||
25229,
|
||||
25230,
|
||||
25231,
|
||||
25232,
|
||||
25233,
|
||||
25234,
|
||||
25235,
|
||||
25236,
|
||||
25237,
|
||||
25238,
|
||||
25239,
|
||||
25240,
|
||||
25241,
|
||||
25242,
|
||||
25243
|
||||
]
|
||||
}
|
||||
@@ -51,23 +51,8 @@
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Configure the Sentry appender, overriding the logging threshold to the WARN level -->
|
||||
<appender name="Sentry" class="io.sentry.logback.SentryAppender">
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
<!-- Optionally add an encoder -->
|
||||
<encoder>
|
||||
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT"/>
|
||||
<appender-ref ref="FILE"/>
|
||||
<appender-ref ref="Sentry" />
|
||||
</root>
|
||||
|
||||
<logger name="org.pf4j" level="WARN"/>
|
||||
<logger name="org.jgroups" level="WARN"/>
|
||||
</configuration>
|
||||
@@ -0,0 +1,19 @@
|
||||
-----BEGIN CERTIFICATE-----
|
||||
MIIDDDCCAfSgAwIBAgIJAK8uBanmNQZaMA0GCSqGSIb3DQEBCwUAMBsxGTAXBgNV
|
||||
BAMMEHJ1bmVsaXRlLXBsdWdpbnMwHhcNMTkxMjEyMjEwNzUxWhcNMjUxMjEwMjEw
|
||||
NzUxWjAbMRkwFwYDVQQDDBBydW5lbGl0ZS1wbHVnaW5zMIIBIjANBgkqhkiG9w0B
|
||||
AQEFAAOCAQ8AMIIBCgKCAQEApu11OVANSU+pHaXRxB7fIZapucJ6BT46neicEixs
|
||||
NVPuK/QRVjO/G8F++MXFD/tlZUOEDllDN8uaHBIVwxilqEVYL7oX65Esl7qqC1TZ
|
||||
WGdjiMyYoK3CXWEWB4w+CdB31T7JG2HqH45ZsVs+U9OVWBkNkL5nNQNPOmZFd+3A
|
||||
yCb9nGlO7SxduiHpwh3CV19jY47y8tevyo5qpaBuQeWtu3vbpeer0kbDarwD3xoF
|
||||
yUMPRK518gxRUSmOpsSG5viQ731mKVCUUfIXz91d3s+kJYAjORHS4zJe9s+1dljp
|
||||
oLYNLkaP6m3CmNtC84OxkmognvZTNMbiQ3GQm/BK4sdjPQIDAQABo1MwUTAdBgNV
|
||||
HQ4EFgQUxrkiRXNd0OHPMkqgl9UgV1//OuQwHwYDVR0jBBgwFoAUxrkiRXNd0OHP
|
||||
Mkqgl9UgV1//OuQwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAQEA
|
||||
StPyblz3aqOM5z2KqHX1B7Z3Q8B58g55YSefpcfwWEc6LT4HCztszcZDteWpV3W2
|
||||
ERfemkGKgsDhQ0qkzIt7tS5eNN3PPj7RZZm7vl5HquQ1vC/33ri/Z3CEKzbW7knt
|
||||
i1iEpx8E9DKb9J9DjdKwNxSomOyCOFUt9YoQJs80xc1mwPDd6aWR3xwvnEUimkm+
|
||||
Dbj7HMOXLeyN810wkeWcT8nC5GhxH3ZAmVExBHsaIOB876RntzshBehjY8s8JQhw
|
||||
R+fT1e8EhYMM9ylYDk1KIWFWrAujjU04lS9tXZ5C2e7fr9R953XN6Y0PNM/taNTU
|
||||
GzwGroJZI02V+1ADO14rRA==
|
||||
-----END CERTIFICATE-----
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 170 B |
|
After Width: | Height: | Size: 170 B |
|
After Width: | Height: | Size: 720 B |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 943 B |
|
After Width: | Height: | Size: 759 B |
|
After Width: | Height: | Size: 824 B |
|
After Width: | Height: | Size: 716 B |
|
After Width: | Height: | Size: 197 B |
|
After Width: | Height: | Size: 434 B |
|
After Width: | Height: | Size: 448 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 410 B |
|
After Width: | Height: | Size: 477 B |
|
After Width: | Height: | Size: 764 B |
|
After Width: | Height: | Size: 973 B |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 343 B |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 871 B |
|
After Width: | Height: | Size: 1.4 KiB |
@@ -0,0 +1 @@
|
||||
The images in this folder are derivatives of "twemoji" (https://github.com/twitter/twemoji) by "Twitter, Inc", used under CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). The derivatives are licensed under the same license.
|
||||
|
After Width: | Height: | Size: 323 B |
|
After Width: | Height: | Size: 329 B |
|
After Width: | Height: | Size: 386 B |
|
After Width: | Height: | Size: 135 B |
|
After Width: | Height: | Size: 558 B |
|
After Width: | Height: | Size: 278 B |
|
After Width: | Height: | Size: 375 B |
|
After Width: | Height: | Size: 428 B |
|
After Width: | Height: | Size: 348 B |