openrune: just about finish rework, gets to login

This commit is contained in:
therealunull
2020-12-13 15:12:37 -05:00
parent 11a239e94e
commit b54ff7f7db
693 changed files with 11362 additions and 3943 deletions

View File

@@ -36,7 +36,7 @@ buildscript {
dependencies { dependencies {
classpath("org.ajoberstar.grgit:grgit-core:4.1.0") classpath("org.ajoberstar.grgit:grgit-core:4.1.0")
classpath("com.github.ben-manes:gradle-versions-plugin:0.36.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")
} }
} }

View File

@@ -24,7 +24,6 @@
*/ */
package net.runelite.cache.util; package net.runelite.cache.util;
import java.io.IOException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import net.runelite.http.api.RuneLiteAPI; import net.runelite.http.api.RuneLiteAPI;
@@ -42,14 +41,7 @@ public class XteaKeyManager
{ {
XteaClient xteaClient = new XteaClient(RuneLiteAPI.CLIENT); XteaClient xteaClient = new XteaClient(RuneLiteAPI.CLIENT);
try keys = null;
{
keys = xteaClient.get();
}
catch (IOException e)
{
e.printStackTrace();
}
logger.info("Loaded {} keys", keys.size()); logger.info("Loaded {} keys", keys.size());
} }

View File

@@ -25,6 +25,10 @@
package net.runelite.http.api; package net.runelite.http.api;
import com.google.gson.Gson; 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.HttpUrl;
import okhttp3.Interceptor; import okhttp3.Interceptor;
import okhttp3.MediaType; import okhttp3.MediaType;
@@ -33,21 +37,6 @@ import okhttp3.Request;
import okhttp3.Response; import okhttp3.Response;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; 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 public class RuneLiteAPI
{ {
@@ -64,36 +53,27 @@ public class RuneLiteAPI
private static final String BASE = "https://api.runelite.net"; private static final String BASE = "https://api.runelite.net";
private static final String WSBASE = "https://api.runelite.net/ws"; private static final String WSBASE = "https://api.runelite.net/ws";
private static final String STATICBASE = "https://static.runelite.net"; 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 final Properties properties = new Properties();
private static String version; private static String version;
private static String upstreamVersion;
private static int rsVersion; private static int rsVersion;
static static
{ {
try (InputStream in = RuneLiteAPI.class.getResourceAsStream("/runelite.properties")) try
{ {
InputStream in = RuneLiteAPI.class.getResourceAsStream("/runelite.properties");
properties.load(in); properties.load(in);
version = properties.getProperty("runelite.version"); version = properties.getProperty("runelite.version");
rsVersion = Integer.parseInt(properties.getProperty("rs.version"));
String commit = properties.getProperty("runelite.commit"); String commit = properties.getProperty("runelite.commit");
boolean dirty = Boolean.parseBoolean(properties.getProperty("runelite.dirty")); boolean dirty = Boolean.parseBoolean(properties.getProperty("runelite.dirty"));
userAgent = "OpenOSRS/" + version + "-" + commit + (dirty ? "+" : ""); userAgent = "RuneLite/" + version + "-" + commit + (dirty ? "+" : "");
rsVersion = Integer.parseInt(properties.getProperty("rs.version"));
parseMavenVersion();
} }
catch (NumberFormatException e) catch (NumberFormatException e)
{ {
e.printStackTrace(); throw new RuntimeException("Version string has not been substituted; Re-run maven");
throw new RuntimeException("Version string has not been substituted; Re-run Gradle");
} }
catch (IOException ex) catch (IOException ex)
{ {
@@ -104,6 +84,7 @@ public class RuneLiteAPI
.pingInterval(30, TimeUnit.SECONDS) .pingInterval(30, TimeUnit.SECONDS)
.addNetworkInterceptor(new Interceptor() .addNetworkInterceptor(new Interceptor()
{ {
@Override @Override
public Response intercept(Chain chain) throws IOException public Response intercept(Chain chain) throws IOException
{ {
@@ -119,12 +100,14 @@ public class RuneLiteAPI
public static HttpUrl getSessionBase() public static HttpUrl getSessionBase()
{ {
return HttpUrl.parse(OPENOSRS_SESSION); final String prop = System.getProperty("runelite.session.url");
}
public static HttpUrl getXteaBase() if (prop != null && !prop.isEmpty())
{ {
return HttpUrl.parse(OPENOSRS_XTEA); return HttpUrl.parse(prop);
}
return HttpUrl.parse(BASE + "/session");
} }
public static HttpUrl getApiBase() public static HttpUrl getApiBase()
@@ -165,7 +148,12 @@ public class RuneLiteAPI
public static String getVersion() public static String getVersion()
{ {
return upstreamVersion; return version;
}
public static void setVersion(String version)
{
RuneLiteAPI.version = version;
} }
public static int getRsVersion() public static int getRsVersion()
@@ -173,60 +161,4 @@ public class RuneLiteAPI
return rsVersion; 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);
}
}
} }

View File

@@ -25,7 +25,6 @@
package net.runelite.http.api.account; package net.runelite.http.api.account;
import com.google.gson.JsonParseException; import com.google.gson.JsonParseException;
import io.reactivex.rxjava3.core.Observable;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
@@ -96,7 +95,7 @@ public class AccountClient
} }
} }
public Observable<Boolean> sessionCheck() public boolean sessionCheck()
{ {
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
.addPathSegment("account") .addPathSegment("account")
@@ -104,23 +103,20 @@ public class AccountClient
.build(); .build();
log.debug("Built URI: {}", url); log.debug("Built URI: {}", url);
return Observable.fromCallable(() ->
{
Request request = new Request.Builder()
.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString())
.url(url)
.build();
try (Response response = client.newCall(request).execute()) Request request = new Request.Builder()
{ .header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString())
return response.isSuccessful(); .url(url)
} .build();
catch (IOException ex)
{ try (Response response = client.newCall(request).execute())
log.debug("Unable to verify session", ex); {
return true; // assume it is still valid if the server is unreachable return response.isSuccessful();
} }
}); catch (IOException ex)
{
log.debug("Unable to verify session", ex);
return true; // assume it is still valid if the server is unreachable
}
} }
} }

View File

@@ -40,7 +40,6 @@ import okhttp3.Response;
@AllArgsConstructor @AllArgsConstructor
public class ChatClient public class ChatClient
{ {
private static final RequestBody body = RequestBody.Companion.create(new byte[0], null);
private final OkHttpClient client; private final OkHttpClient client;
public boolean submitKc(String username, String boss, int kc) throws IOException 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 public Duels getDuels(String username) throws IOException
{ {
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()

View File

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

View File

@@ -24,6 +24,7 @@
*/ */
package net.runelite.http.api.config; package net.runelite.http.api.config;
import com.google.gson.Gson;
import com.google.gson.JsonParseException; import com.google.gson.JsonParseException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@@ -48,6 +49,7 @@ import okhttp3.Response;
public class ConfigClient public class ConfigClient
{ {
private static final MediaType TEXT_PLAIN = MediaType.parse("text/plain"); private static final MediaType TEXT_PLAIN = MediaType.parse("text/plain");
private static final Gson GSON = RuneLiteAPI.GSON;
private final OkHttpClient client; private final OkHttpClient client;
private final UUID uuid; private final UUID uuid;
@@ -114,6 +116,59 @@ public class ConfigClient
return future; 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) public CompletableFuture<Void> unset(String key)
{ {
CompletableFuture<Void> future = new CompletableFuture<>(); CompletableFuture<Void> future = new CompletableFuture<>();
@@ -151,4 +206,4 @@ public class ConfigClient
return future; return future;
} }
} }

View File

@@ -24,28 +24,15 @@
*/ */
package net.runelite.http.api.config; package net.runelite.http.api.config;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ConfigEntry public class ConfigEntry
{ {
private String key; private String key;
private String value; 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;
}
}

View File

@@ -26,18 +26,12 @@ package net.runelite.http.api.config;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Data;
@Data
@AllArgsConstructor
public class Configuration public class Configuration
{ {
private List<ConfigEntry> config = new ArrayList<>(); private List<ConfigEntry> config = new ArrayList<>();
}
public Configuration(List<ConfigEntry> config)
{
this.config = config;
}
public List<ConfigEntry> getConfig()
{
return config;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -70,10 +70,9 @@ public class ExamineClient
log.debug("Built URI: {}", url); log.debug("Built URI: {}", url);
RequestBody body = RequestBody.Companion.create(text, TEXT);
Request request = new Request.Builder() Request request = new Request.Builder()
.url(url) .url(url)
.post(body) .post(RequestBody.create(TEXT, text))
.build(); .build();
client.newCall(request).enqueue(new Callback() client.newCall(request).enqueue(new Callback()

View File

@@ -59,7 +59,6 @@ public class GrandExchangeClient
.addPathSegment("ge") .addPathSegment("ge")
.build(); .build();
RequestBody body = RequestBody.Companion.create(GSON.toJson(grandExchangeTrade), JSON);
Request.Builder builder = new Request.Builder(); Request.Builder builder = new Request.Builder();
if (uuid != null) if (uuid != null)
{ {
@@ -71,7 +70,7 @@ public class GrandExchangeClient
} }
Request request = builder Request request = builder
.post(body) .post(RequestBody.create(JSON, GSON.toJson(grandExchangeTrade)))
.url(url) .url(url)
.build(); .build();

View File

@@ -24,18 +24,14 @@
*/ */
package net.runelite.http.api.item; package net.runelite.http.api.item;
import com.google.common.collect.ImmutableMap;
import com.google.gson.JsonParseException; import com.google.gson.JsonParseException;
import com.google.gson.stream.JsonReader; import com.google.gson.reflect.TypeToken;
import io.reactivex.rxjava3.core.Observable;
import java.awt.image.BufferedImage;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.Arrays; import java.lang.reflect.Type;
import javax.imageio.ImageIO;
import javax.naming.directory.SearchResult;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Map;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.http.api.RuneLiteAPI; import net.runelite.http.api.RuneLiteAPI;
@@ -50,13 +46,13 @@ public class ItemClient
{ {
private final OkHttpClient client; private final OkHttpClient client;
public ItemPrice lookupItemPrice(int itemId) throws IOException public ItemPrice[] getPrices() throws IOException
{ {
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() HttpUrl.Builder urlBuilder = RuneLiteAPI.getApiBase().newBuilder()
.addPathSegment("item") .addPathSegment("item")
.addPathSegment("" + itemId) .addPathSegment("prices.js");
.addPathSegment("price")
.build(); HttpUrl url = urlBuilder.build();
log.debug("Built URI: {}", url); log.debug("Built URI: {}", url);
@@ -68,43 +64,7 @@ public class ItemClient
{ {
if (!response.isSuccessful()) if (!response.isSuccessful())
{ {
log.debug("Error looking up item {}: {}", itemId, response); log.warn("Error looking up prices: {}", 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
{
HttpUrl.Builder urlBuilder = RuneLiteAPI.getApiBase().newBuilder()
.addPathSegment("item")
.addPathSegment("price");
for (int itemId : itemIds)
{
urlBuilder.addQueryParameter("id", String.valueOf(itemId));
}
HttpUrl url = urlBuilder.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 items {}: {}", Arrays.toString(itemIds), response);
return null; return null;
} }
@@ -117,13 +77,14 @@ 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("item")
.addPathSegment("" + itemId) // TODO: Change this to stats.min.json later after release is undeployed
.addPathSegment("icon") .addPathSegment("stats.ids.min.json");
.build();
HttpUrl url = urlBuilder.build();
log.debug("Built URI: {}", url); log.debug("Built URI: {}", url);
@@ -131,128 +92,23 @@ public class ItemClient
.url(url) .url(url)
.build(); .build();
return Observable.defer(() -> try (Response response = client.newCall(request).execute())
{ {
try (Response response = client.newCall(request).execute()) if (!response.isSuccessful())
{ {
if (!response.isSuccessful()) log.warn("Error looking up item stats: {}", response);
{ return null;
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) InputStream in = response.body().byteStream();
{ final Type typeToken = new TypeToken<Map<Integer, ItemStats>>()
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() {
.addPathSegment("item") }.getType();
.addPathSegment("search") return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), typeToken);
.addQueryParameter("query", itemName) }
.build(); catch (JsonParseException ex)
log.debug("Built URI: {}", url);
return Observable.defer(() ->
{ {
Request request = new Request.Builder() throw new IOException(ex);
.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");
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()))
{
ImmutableMap.Builder<Integer, ItemPrice> builder = ImmutableMap.builderWithExpectedSize(3666);
reader.beginArray();
while (reader.hasNext())
{
ItemPrice price = RuneLiteAPI.GSON.fromJson(reader, ItemPrice.class);
builder.put(
price.getId(),
price
);
}
reader.endArray();
return builder.build();
}
});
}
public Observable<ImmutableMap<Integer, ItemStats>> getStats()
{
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)
);
}
reader.endObject();
return builder.build();
}
});
} }
} }

View File

@@ -29,7 +29,7 @@ import lombok.Builder;
import lombok.Value; import lombok.Value;
@Value @Value
@Builder(builderClassName = "Builder") @Builder
public class ItemEquipmentStats public class ItemEquipmentStats
{ {
private int slot; private int slot;

View File

@@ -24,14 +24,10 @@
*/ */
package net.runelite.http.api.item; package net.runelite.http.api.item;
import lombok.AllArgsConstructor;
import lombok.Builder;
import com.google.gson.annotations.SerializedName; import com.google.gson.annotations.SerializedName;
import lombok.Value; import lombok.Value;
@Value @Value
@AllArgsConstructor
@Builder(builderClassName = "Builder")
public class ItemStats public class ItemStats
{ {
private boolean quest; private boolean quest;
@@ -57,9 +53,9 @@ public class ItemStats
{ {
final ItemEquipmentStats equipment = this.equipment != null final ItemEquipmentStats equipment = this.equipment != null
? this.equipment ? this.equipment
: new ItemEquipmentStats.Builder().build(); : new ItemEquipmentStats.ItemEquipmentStatsBuilder().build();
newEquipment = new ItemEquipmentStats.Builder() newEquipment = new ItemEquipmentStats.ItemEquipmentStatsBuilder()
.slot(equipment.getSlot()) .slot(equipment.getSlot())
.astab(equipment.getAstab() - other.equipment.getAstab()) .astab(equipment.getAstab() - other.equipment.getAstab())
.aslash(equipment.getAslash() - other.equipment.getAslash()) .aslash(equipment.getAslash() - other.equipment.getAslash())

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2018, Forsco <https://github.com/forsco> * Copyright (c) 2020, Adam <Adam@sigterm.info>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * 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 * 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer. * list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, * 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation * this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution. * 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 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * 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.AllArgsConstructor;
import lombok.Builder; import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Getter @Data
@Setter
@Builder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ToString public class LootAggregate
public class ImageEmbed
{ {
String url; private String eventId;
String proxy_url; private LootRecordType type;
int height; private Collection<GameItem> drops;
int width; private Instant first_time;
private Instant last_time;
private int amount;
} }

View File

@@ -26,10 +26,8 @@ package net.runelite.http.api.loottracker;
import java.time.Instant; import java.time.Instant;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@Data @Data
@@ -38,27 +36,8 @@ import lombok.NoArgsConstructor;
public class LootRecord public class LootRecord
{ {
private String eventId; private String eventId;
@Getter
private String username;
private LootRecordType type; private LootRecordType type;
private Object metadata; private Object metadata;
private Collection<GameItem> drops; private Collection<GameItem> drops;
private Instant time; 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;
}
} }

View File

@@ -29,7 +29,6 @@ public enum LootRecordType
NPC, NPC,
PLAYER, PLAYER,
EVENT, EVENT,
DEATH,
PICKPOCKET, PICKPOCKET,
UNKNOWN UNKNOWN
} }

View File

@@ -64,13 +64,18 @@ public class LootTrackerClient
{ {
CompletableFuture<Void> future = new CompletableFuture<>(); 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(); Request.Builder requestBuilder = new Request.Builder();
if (uuid != null) if (uuid != null)
{ {
requestBuilder.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString()); 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() client.newCall(requestBuilder.build()).enqueue(new Callback()
{ {
@@ -100,7 +105,7 @@ public class LootTrackerClient
return future; return future;
} }
public Collection<LootRecord> get() throws IOException public Collection<LootAggregate> get() throws IOException
{ {
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
.addPathSegment("loottracker") .addPathSegment("loottracker")
@@ -120,7 +125,9 @@ public class LootTrackerClient
} }
InputStream in = response.body().byteStream(); 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) catch (JsonParseException ex)
{ {

View File

@@ -25,7 +25,6 @@
package net.runelite.http.api.osbuddy; package net.runelite.http.api.osbuddy;
import com.google.gson.JsonParseException; import com.google.gson.JsonParseException;
import io.reactivex.rxjava3.core.Observable;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
@@ -44,7 +43,7 @@ public class OSBGrandExchangeClient
{ {
private final OkHttpClient client; private final OkHttpClient client;
public Observable<OSBGrandExchangeResult> lookupItem(int itemId) public OSBGrandExchangeResult lookupItem(int itemId) throws IOException
{ {
final HttpUrl url = RuneLiteAPI.getApiBase().newBuilder() final HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
.addPathSegment("osb") .addPathSegment("osb")
@@ -54,26 +53,23 @@ public class OSBGrandExchangeClient
log.debug("Built URI: {}", url); log.debug("Built URI: {}", url);
return Observable.defer(() -> final Request request = new Request.Builder()
.url(url)
.build();
try (final Response response = client.newCall(request).execute())
{ {
final Request request = new Request.Builder() if (!response.isSuccessful())
.url(url)
.build();
try (final Response response = client.newCall(request).execute())
{ {
if (!response.isSuccessful()) throw new IOException("Error looking up item id: " + response);
{
return Observable.error(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));
} }
catch (JsonParseException ex)
{ final InputStream in = response.body().byteStream();
return Observable.error(ex); return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), OSBGrandExchangeResult.class);
} }
}); catch (JsonParseException ex)
{
throw new IOException(ex);
}
} }
} }

View File

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

View File

@@ -33,7 +33,6 @@ import java.nio.charset.StandardCharsets;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.http.api.RuneLiteAPI; import net.runelite.http.api.RuneLiteAPI;
import okhttp3.CacheControl;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.Request; import okhttp3.Request;
@@ -55,7 +54,6 @@ public class WorldClient
Request request = new Request.Builder() Request request = new Request.Builder()
.url(url) .url(url)
.cacheControl(CacheControl.FORCE_NETWORK)
.build(); .build();
try (Response response = client.newCall(request).execute()) try (Response response = client.newCall(request).execute())

View File

@@ -16,6 +16,10 @@
package net.runelite.http.api.ws; 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.Gson;
import com.google.gson.JsonElement; import com.google.gson.JsonElement;
import com.google.gson.JsonObject; 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.reflect.TypeToken;
import com.google.gson.stream.JsonReader; import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter; 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 * Adapts values whose runtime type may differ from their declaration type. This

View File

@@ -24,9 +24,7 @@
*/ */
package net.runelite.http.api.ws; package net.runelite.http.api.ws;
import net.runelite.api.events.Event; public class WebsocketMessage
public class WebsocketMessage implements Event
{ {
protected boolean _party; protected boolean _party;

View File

@@ -25,10 +25,9 @@
package net.runelite.http.api.ws.messages; package net.runelite.http.api.ws.messages;
import java.util.UUID; import java.util.UUID;
import net.runelite.api.events.Event;
import net.runelite.http.api.ws.WebsocketMessage; import net.runelite.http.api.ws.WebsocketMessage;
public class Handshake extends WebsocketMessage implements Event public class Handshake extends WebsocketMessage
{ {
private UUID session; private UUID session;

View File

@@ -24,14 +24,13 @@
*/ */
package net.runelite.http.api.ws.messages; package net.runelite.http.api.ws.messages;
import net.runelite.api.events.Event;
import net.runelite.http.api.ws.WebsocketMessage; import net.runelite.http.api.ws.WebsocketMessage;
/** /**
* Called after a successful login to the server * Called after a successful login to the server
* @author Adam * @author Adam
*/ */
public class LoginResponse extends WebsocketMessage implements Event public class LoginResponse extends WebsocketMessage
{ {
private String username; private String username;

View File

@@ -27,12 +27,11 @@ package net.runelite.http.api.ws.messages.party;
import java.util.UUID; import java.util.UUID;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Value; import lombok.Value;
import net.runelite.api.events.Event;
import net.runelite.http.api.ws.WebsocketMessage; import net.runelite.http.api.ws.WebsocketMessage;
@Value @Value
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class Join extends WebsocketMessage implements Event public class Join extends WebsocketMessage
{ {
private final UUID partyId; private final UUID partyId;
private final String name; private final String name;

View File

@@ -24,7 +24,8 @@
*/ */
package net.runelite.http.api.ws.messages.party; package net.runelite.http.api.ws.messages.party;
import net.runelite.api.events.Event;
import net.runelite.http.api.ws.WebsocketMessage; import net.runelite.http.api.ws.WebsocketMessage;
public class Part extends WebsocketMessage implements Event {} public class Part extends WebsocketMessage
{
}

View File

@@ -24,12 +24,10 @@
*/ */
package net.runelite.http.api.ws.messages.party; package net.runelite.http.api.ws.messages.party;
import lombok.EqualsAndHashCode;
import lombok.Value; import lombok.Value;
import net.runelite.api.events.Event;
@Value @Value
@EqualsAndHashCode(callSuper = true) public class PartyChatMessage extends PartyMemberMessage
public class PartyChatMessage extends PartyMemberMessage implements Event
{ {
private final String value; private final String value;
} }

View File

@@ -3,11 +3,10 @@ package net.runelite.http.api.ws.messages.party;
import java.util.UUID; import java.util.UUID;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import net.runelite.api.events.Event;
@Getter @Getter
@Setter @Setter
public abstract class PartyMemberMessage extends PartyMessage implements Event public abstract class PartyMemberMessage extends PartyMessage
{ {
private UUID memberId; private UUID memberId;
} }

View File

@@ -24,10 +24,9 @@
*/ */
package net.runelite.http.api.ws.messages.party; package net.runelite.http.api.ws.messages.party;
import net.runelite.api.events.Event;
import net.runelite.http.api.ws.WebsocketMessage; import net.runelite.http.api.ws.WebsocketMessage;
public abstract class PartyMessage extends WebsocketMessage implements Event public abstract class PartyMessage extends WebsocketMessage
{ {
public PartyMessage() public PartyMessage()
{ {

View File

@@ -27,12 +27,11 @@ package net.runelite.http.api.ws.messages.party;
import java.util.UUID; import java.util.UUID;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Value; import lombok.Value;
import net.runelite.api.events.Event;
import net.runelite.http.api.ws.WebsocketMessage; import net.runelite.http.api.ws.WebsocketMessage;
@Value @Value
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class UserJoin extends WebsocketMessage implements Event public class UserJoin extends WebsocketMessage
{ {
private final UUID memberId; private final UUID memberId;
private final UUID partyId; private final UUID partyId;

View File

@@ -27,12 +27,11 @@ package net.runelite.http.api.ws.messages.party;
import java.util.UUID; import java.util.UUID;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Value; import lombok.Value;
import net.runelite.api.events.Event;
import net.runelite.http.api.ws.WebsocketMessage; import net.runelite.http.api.ws.WebsocketMessage;
@Value @Value
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class UserPart extends WebsocketMessage implements Event public class UserPart extends WebsocketMessage
{ {
private final UUID memberId; private final UUID memberId;
} }

View File

@@ -26,8 +26,9 @@ package net.runelite.http.api.ws.messages.party;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
import lombok.Value; import lombok.Value;
import net.runelite.api.events.Event;
@Value @Value
@EqualsAndHashCode(callSuper = true) @EqualsAndHashCode(callSuper = true)
public class UserSync extends PartyMemberMessage implements Event {} public class UserSync extends PartyMemberMessage
{
}

View File

@@ -29,16 +29,18 @@ import com.google.gson.reflect.TypeToken;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.HashMap;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.List;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.http.api.RuneLiteAPI; import net.runelite.http.api.RuneLiteAPI;
import static net.runelite.http.api.RuneLiteAPI.JSON;
import okhttp3.Call; import okhttp3.Call;
import okhttp3.Callback; import okhttp3.Callback;
import okhttp3.HttpUrl; import okhttp3.HttpUrl;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import okhttp3.Request; import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response; import okhttp3.Response;
@Slf4j @Slf4j
@@ -47,21 +49,18 @@ public class XteaClient
{ {
private final OkHttpClient client; 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() HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
.addPathSegment("submit") .addPathSegment("xtea")
.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]))
.build(); .build();
log.debug("Built URI: {}", url); log.debug("Built URI: {}", url);
Request request = new Request.Builder() Request request = new Request.Builder()
.post(RequestBody.create(JSON, json))
.url(url) .url(url)
.build(); .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() HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
.addPathSegment("get") .addPathSegment("xtea")
.build(); .build();
Request request = new Request.Builder() Request request = new Request.Builder()
@@ -105,7 +104,7 @@ public class XteaClient
{ {
InputStream in = response.body().byteStream(); InputStream in = response.body().byteStream();
// CHECKSTYLE:OFF // 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 // CHECKSTYLE:ON
} }
catch (JsonParseException ex) catch (JsonParseException ex)
@@ -113,4 +112,26 @@ public class XteaClient
throw new IOException(ex); 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);
}
}
}

View File

@@ -27,7 +27,7 @@ package net.runelite.http.api.xtea;
public class XteaKey public class XteaKey
{ {
private int region; private int region;
private int[] keys; private int keys[];
public int getRegion() public int getRegion()
{ {

View File

@@ -932,7 +932,7 @@ public interface Client extends GameShell
* @return the corresponding object composition * @return the corresponding object composition
* @see ObjectID * @see ObjectID
*/ */
ObjectDefinition getObjectDefinition(int objectId); ObjectDefinition getObjectComposition(int objectId);
/** /**
* Gets the NPC composition corresponding to an NPCs ID. * Gets the NPC composition corresponding to an NPCs ID.
@@ -1010,7 +1010,7 @@ public interface Client extends GameShell
* @param height the height * @param height the height
* @return the sprite image * @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. * Gets the location of the local player.
@@ -1863,7 +1863,7 @@ public interface Client extends GameShell
void setSelectedSpellName(String name); void setSelectedSpellName(String name);
boolean isSpellSelected(); boolean getSpellSelected();
String getSelectedSpellActionName(); String getSelectedSpellActionName();

View File

@@ -37,18 +37,18 @@ public class MenuEntry implements Cloneable
/** /**
* The option text added to the menu (ie. "Walk here", "Use"). * 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). * The target of the action (ie. Item or Actor name).
* <p> * <p>
* If the option does not apply to any target, this field * If the option does not apply to any target, this field
* will be set to empty string. * will be set to empty string.
*/ */
private String target; private String menuTarget;
/** /**
* An identifier value for the target of the action. * An identifier value for the target of the action.
*/ */
private int identifier; private int type;
/** /**
* The action the entry will trigger. * The action the entry will trigger.
* {@link MenuAction} * {@link MenuAction}
@@ -57,11 +57,11 @@ public class MenuEntry implements Cloneable
/** /**
* An additional parameter for the action. * An additional parameter for the action.
*/ */
private int param0; private int actionParam0;
/** /**
* A second additional parameter for the action. * 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 * 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 * 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; 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.menuOption = menuOption;
this.target = target; this.menuTarget = menuTarget;
this.identifier = identifier; this.type = type;
this.opcode = opcode; this.opcode = opcode;
this.param0 = param0; this.actionParam0 = actionParam0;
this.param1 = param1; this.widgetId = widgetId;
this.forceLeftClick = forceLeftClick; this.forceLeftClick = forceLeftClick;
} }
@@ -97,7 +97,7 @@ public class MenuEntry implements Cloneable
/** /**
* Get opcode, but as it's enum counterpart * Get opcode, but as it's enum counterpart
*/ */
public MenuAction getMenuOpcode() public MenuAction getMenuAction()
{ {
return MenuAction.of(getOpcode()); return MenuAction.of(getOpcode());
} }

View File

@@ -59,7 +59,7 @@ public interface NPC extends Actor
* *
* @return the composition * @return the composition
*/ */
NPCComposition getDefinition(); NPCComposition getComposition();
/** /**
* Get the composition for this NPC and transform it if required * Get the composition for this NPC and transform it if required

View File

@@ -31,7 +31,7 @@ public class BeforeRender implements Event
{ {
public static final BeforeRender INSTANCE = new BeforeRender(); public static final BeforeRender INSTANCE = new BeforeRender();
private BeforeRender() public BeforeRender()
{ {
// noop // noop
} }

View File

@@ -24,14 +24,14 @@
*/ */
package net.runelite.api.events; package net.runelite.api.events;
import lombok.Value; import lombok.Data;
import net.runelite.api.GameObject; import net.runelite.api.GameObject;
import net.runelite.api.Tile; import net.runelite.api.Tile;
/** /**
* An event where a {@link GameObject} is added to a {@link Tile}. * An event where a {@link GameObject} is added to a {@link Tile}.
*/ */
@Value @Data
public class GameObjectSpawned implements Event public class GameObjectSpawned implements Event
{ {
/** /**

View File

@@ -45,7 +45,7 @@ public class GameTick implements Event
{ {
public static final GameTick INSTANCE = new GameTick(); public static final GameTick INSTANCE = new GameTick();
private GameTick() public GameTick()
{ {
// noop // noop
} }

View File

@@ -86,12 +86,12 @@ public class MenuOptionClicked extends MenuEntry implements Event
public void setMenuEntry(MenuEntry e) public void setMenuEntry(MenuEntry e)
{ {
setOption(e.getOption()); setMenuOption(e.getMenuOption());
setTarget(e.getTarget()); setMenuTarget(e.getMenuTarget());
setIdentifier(e.getIdentifier()); setType(e.getType());
setOpcode(e.getOpcode()); setOpcode(e.getOpcode());
setParam0(e.getParam0()); setActionParam0(e.getActionParam0());
setParam1(e.getParam1()); setWidgetId(e.getWidgetId());
setForceLeftClick(e.isForceLeftClick()); setForceLeftClick(e.isForceLeftClick());
} }
} }

View File

@@ -29,7 +29,6 @@ import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent; import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent; import java.awt.event.MouseWheelEvent;
import net.runelite.api.MainBufferProvider; import net.runelite.api.MainBufferProvider;
import net.runelite.api.events.Event;
import net.runelite.api.widgets.WidgetItem; import net.runelite.api.widgets.WidgetItem;
/** /**
@@ -38,18 +37,18 @@ import net.runelite.api.widgets.WidgetItem;
public interface Callbacks 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 * @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. * Post a deferred event, which gets delayed until the next cycle.
* *
* @param event the event * @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. * Called each client cycle.
@@ -71,6 +70,8 @@ public interface Callbacks
*/ */
void drawAboveOverheads(); void drawAboveOverheads();
void drawAfterWidgets();
/** /**
* Client top-most draw method, rendering over top of most of game interfaces. * Client top-most draw method, rendering over top of most of game interfaces.
* *
@@ -170,4 +171,4 @@ public interface Callbacks
* @param keyEvent the key event * @param keyEvent the key event
*/ */
void keyTyped(KeyEvent keyEvent); void keyTyped(KeyEvent keyEvent);
} }

View File

@@ -74,6 +74,7 @@ dependencies {
exclude(group = "org.slf4j") exclude(group = "org.slf4j")
} }
implementation(group = "org.pf4j", name = "pf4j-update", version = "2.3.0") 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")) implementation(project(":http-api"))
runtimeOnly(group = "org.pushing-pixels", name = "radiance-trident", version = "2.5.1") runtimeOnly(group = "org.pushing-pixels", name = "radiance-trident", version = "2.5.1")

View File

@@ -52,6 +52,8 @@ import net.runelite.client.util.DeferredEventBus;
import net.runelite.client.util.ExecutorServiceExceptionLogger; import net.runelite.client.util.ExecutorServiceExceptionLogger;
import net.runelite.http.api.chat.ChatClient; import net.runelite.http.api.chat.ChatClient;
import okhttp3.OkHttpClient; import okhttp3.OkHttpClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@AllArgsConstructor @AllArgsConstructor
public class RuneLiteModule extends AbstractModule public class RuneLiteModule extends AbstractModule
@@ -87,6 +89,10 @@ public class RuneLiteModule extends AbstractModule
bind(EventBus.class) bind(EventBus.class)
.annotatedWith(Names.named("Deferred EventBus")) .annotatedWith(Names.named("Deferred EventBus"))
.to(DeferredEventBus.class); .to(DeferredEventBus.class);
bind(Logger.class)
.annotatedWith(Names.named("Core Logger"))
.toInstance(LoggerFactory.getLogger(RuneLite.class));
} }
@Provides @Provides

View File

@@ -85,7 +85,6 @@ import net.runelite.api.Player;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.PlayerChanged; import net.runelite.api.events.PlayerChanged;
import net.runelite.api.events.UsernameChanged; import net.runelite.api.events.UsernameChanged;
import net.runelite.api.events.WorldChanged;
import net.runelite.client.RuneLite; import net.runelite.client.RuneLite;
import net.runelite.client.account.AccountSession; import net.runelite.client.account.AccountSession;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
@@ -1043,12 +1042,6 @@ public class ConfigManager
updateRSProfile(); updateRSProfile();
} }
@Subscribe
private void onWorldChanged(WorldChanged ev)
{
updateRSProfile();
}
@Subscribe @Subscribe
private void onPlayerChanged(PlayerChanged ev) private void onPlayerChanged(PlayerChanged ev)
{ {

View File

@@ -27,7 +27,6 @@ package net.runelite.client.config;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.Getter; import lombok.Getter;
import net.runelite.client.ui.FontManager; import net.runelite.client.ui.FontManager;
import java.awt.Font; import java.awt.Font;
@Getter @Getter

View File

@@ -109,8 +109,8 @@ public class MenuManager
{ {
for (MenuEntry menuEntry : client.getMenuEntries()) for (MenuEntry menuEntry : client.getMenuEntries())
{ {
String option = menuEntry.getOption(); String option = menuEntry.getMenuOption();
String target = menuEntry.getTarget(); String target = menuEntry.getMenuTarget();
if (option.equals(customMenuOption.getMenuOption()) && target.equals(customMenuOption.getMenuTarget())) if (option.equals(customMenuOption.getMenuOption()) && target.equals(customMenuOption.getMenuTarget()))
{ {
@@ -128,7 +128,7 @@ public class MenuManager
return; return;
} }
int widgetId = event.getActionParam1(); int widgetId = event.getWidgetId();
Collection<WidgetMenuOption> options = managedMenuOptions.get(widgetId); Collection<WidgetMenuOption> options = managedMenuOptions.get(widgetId);
for (WidgetMenuOption currentMenu : options) for (WidgetMenuOption currentMenu : options)
@@ -139,9 +139,9 @@ public class MenuManager
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1); menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry(); MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
menuEntry.setOption(currentMenu.getMenuOption()); menuEntry.setMenuOption(currentMenu.getMenuOption());
menuEntry.setParam1(widgetId); menuEntry.setWidgetId(widgetId);
menuEntry.setTarget(currentMenu.getMenuTarget()); menuEntry.setMenuTarget(currentMenu.getMenuTarget());
menuEntry.setType(MenuAction.RUNELITE.getId()); menuEntry.setType(MenuAction.RUNELITE.getId());
client.setMenuEntries(menuEntries); client.setMenuEntries(menuEntries);

View File

@@ -25,7 +25,6 @@
package net.runelite.client.menus; package net.runelite.client.menus;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
import java.awt.Color; import java.awt.Color;
import net.runelite.client.ui.JagexColors; import net.runelite.client.ui.JagexColors;
import net.runelite.client.util.ColorUtil; import net.runelite.client.util.ColorUtil;

View File

@@ -133,37 +133,11 @@ public class ClientLoader implements Supplier<Applet>
StandardOpenOption.CREATE, StandardOpenOption.READ, StandardOpenOption.WRITE); StandardOpenOption.CREATE, StandardOpenOption.READ, StandardOpenOption.WRITE);
FileLock flock = lockfile.lock()) 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"); SplashScreen.stage(.40, null, "Loading client");
File jarFile = updateCheckMode == AUTO ? PATCHED_CACHE : VANILLA_CACHE; 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 // 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. // 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"); SplashScreen.stage(.465, "Starting", "Starting Old School RuneScape");
@@ -175,7 +149,7 @@ public class ClientLoader implements Supplier<Applet>
return rs; return rs;
} }
catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException
| VerificationException | SecurityException e) | SecurityException e)
{ {
log.error("Error loading RS!", e); log.error("Error loading RS!", e);
@@ -543,7 +517,7 @@ public class ClientLoader implements Supplier<Applet>
if (rs instanceof Client) if (rs instanceof Client)
{ {
log.info("client-patch {}", ((Client) rs).getBuildID()); //.info("client-patch {}", ((Client) rs).getBuildID());
} }
return rs; return rs;

View File

@@ -143,7 +143,7 @@ public class OverlayManager
event.consume(); event.consume();
Overlay overlay = overlays.get(event.getId()); Overlay overlay = overlays.get(event.getType());
if (overlay != null) if (overlay != null)
{ {
List<OverlayMenuEntry> menuEntries = overlay.getMenuEntries(); List<OverlayMenuEntry> menuEntries = overlay.getMenuEntries();

View File

@@ -877,10 +877,10 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
OverlayMenuEntry overlayMenuEntry = menuEntries.get(i); OverlayMenuEntry overlayMenuEntry = menuEntries.get(i);
final MenuEntry entry = new MenuEntry(); final MenuEntry entry = new MenuEntry();
entry.setOption(overlayMenuEntry.getOption()); entry.setMenuOption(overlayMenuEntry.getOption());
entry.setTarget(ColorUtil.wrapWithColorTag(overlayMenuEntry.getTarget(), JagexColors.MENU_TARGET)); entry.setMenuTarget(ColorUtil.wrapWithColorTag(overlayMenuEntry.getTarget(), JagexColors.MENU_TARGET));
entry.setType(overlayMenuEntry.getMenuAction().getId()); entry.setType(overlayMenuEntry.getMenuAction().getId());
entry.setIdentifier(overlayManager.getOverlays().indexOf(overlay)); // overlay id entry.setType(overlayManager.getOverlays().indexOf(overlay)); // overlay id
entries[i] = entry; entries[i] = entry;
} }

View File

@@ -65,10 +65,10 @@ public class ObsidianSkin extends SubstanceSkin
final SubstanceColorSchemeBundle defaultSchemeBundle = new SubstanceColorSchemeBundle( final SubstanceColorSchemeBundle defaultSchemeBundle = new SubstanceColorSchemeBundle(
activeScheme, enabledScheme, enabledScheme); activeScheme, enabledScheme, enabledScheme);
defaultSchemeBundle.registerColorScheme(enabledScheme, 0.6f, //defaultSchemeBundle.registerColorScheme(enabledScheme, 0.6f,
ComponentState.DISABLED_UNSELECTED); // ComponentState.DISABLED_UNSELECTED);
defaultSchemeBundle.registerColorScheme(activeScheme, 0.6f, //defaultSchemeBundle.registerColorScheme(activeScheme, 0.6f,
ComponentState.DISABLED_SELECTED); // ComponentState.DISABLED_SELECTED);
// borders // borders
final SubstanceColorScheme borderDisabledSelectedScheme = schemes final SubstanceColorScheme borderDisabledSelectedScheme = schemes
@@ -82,9 +82,9 @@ public class ObsidianSkin extends SubstanceSkin
final SubstanceColorScheme markActiveScheme = schemes.get("RuneLite Mark Active"); final SubstanceColorScheme markActiveScheme = schemes.get("RuneLite Mark Active");
defaultSchemeBundle.registerColorScheme(markActiveScheme, ColorSchemeAssociationKind.MARK, defaultSchemeBundle.registerColorScheme(markActiveScheme, ColorSchemeAssociationKind.MARK,
ComponentState.getActiveStates()); ComponentState.getActiveStates());
defaultSchemeBundle.registerColorScheme(markActiveScheme, 0.6f, //defaultSchemeBundle.registerColorScheme(markActiveScheme, 0.6f,
ColorSchemeAssociationKind.MARK, ComponentState.DISABLED_SELECTED, // ColorSchemeAssociationKind.MARK, ComponentState.DISABLED_SELECTED,
ComponentState.DISABLED_UNSELECTED); // ComponentState.DISABLED_UNSELECTED);
// separators // separators
final SubstanceColorScheme separatorScheme = schemes.get("RuneLite Separator"); final SubstanceColorScheme separatorScheme = schemes.get("RuneLite Separator");
@@ -102,8 +102,8 @@ public class ObsidianSkin extends SubstanceSkin
final SubstanceColorSchemeBundle decorationsSchemeBundle = new SubstanceColorSchemeBundle( final SubstanceColorSchemeBundle decorationsSchemeBundle = new SubstanceColorSchemeBundle(
activeScheme, enabledScheme, enabledScheme); activeScheme, enabledScheme, enabledScheme);
decorationsSchemeBundle.registerColorScheme(enabledScheme, 0.5f, //decorationsSchemeBundle.registerColorScheme(enabledScheme, 0.5f,
ComponentState.DISABLED_UNSELECTED); // ComponentState.DISABLED_UNSELECTED);
// borders // borders
decorationsSchemeBundle.registerColorScheme(borderDisabledSelectedScheme, decorationsSchemeBundle.registerColorScheme(borderDisabledSelectedScheme,
@@ -129,8 +129,8 @@ public class ObsidianSkin extends SubstanceSkin
final SubstanceColorSchemeBundle headerSchemeBundle = new SubstanceColorSchemeBundle(activeScheme, final SubstanceColorSchemeBundle headerSchemeBundle = new SubstanceColorSchemeBundle(activeScheme,
enabledScheme, enabledScheme); enabledScheme, enabledScheme);
headerSchemeBundle.registerColorScheme(enabledScheme, 0.5f, //headerSchemeBundle.registerColorScheme(enabledScheme, 0.5f,
ComponentState.DISABLED_UNSELECTED); // ComponentState.DISABLED_UNSELECTED);
// borders // borders
final SubstanceColorScheme headerBorderScheme = schemes.get("RuneLite Header Border"); final SubstanceColorScheme headerBorderScheme = schemes.get("RuneLite Header Border");
@@ -142,13 +142,13 @@ public class ObsidianSkin extends SubstanceSkin
headerSchemeBundle.registerColorScheme(markActiveScheme, ColorSchemeAssociationKind.MARK, headerSchemeBundle.registerColorScheme(markActiveScheme, ColorSchemeAssociationKind.MARK,
ComponentState.getActiveStates()); ComponentState.getActiveStates());
headerSchemeBundle.registerHighlightColorScheme(activeScheme, 0.7f, //headerSchemeBundle.registerHighlightColorScheme(activeScheme, 0.7f,
ComponentState.ROLLOVER_UNSELECTED, ComponentState.ROLLOVER_ARMED, // ComponentState.ROLLOVER_UNSELECTED, ComponentState.ROLLOVER_ARMED,
ComponentState.ARMED); // ComponentState.ARMED);
headerSchemeBundle.registerHighlightColorScheme(activeScheme, 0.8f, //headerSchemeBundle.registerHighlightColorScheme(activeScheme, 0.8f,
ComponentState.SELECTED); // ComponentState.SELECTED);
headerSchemeBundle.registerHighlightColorScheme(activeScheme, 1.0f, //headerSchemeBundle.registerHighlightColorScheme(activeScheme, 1.0f,
ComponentState.ROLLOVER_SELECTED); // ComponentState.ROLLOVER_SELECTED);
final SubstanceColorScheme headerWatermarkScheme = schemes.get("RuneLite Header Watermark"); final SubstanceColorScheme headerWatermarkScheme = schemes.get("RuneLite Header Watermark");

View File

@@ -547,7 +547,8 @@
526, 526,
2530, 2530,
3187, 3187,
24655 24655,
25199
], ],
"monks robe": [ "monks robe": [
542, 542,
@@ -1652,6 +1653,10 @@
1005, 1005,
7957 7957
], ],
"red cape": [
1007,
25207
],
"blue skirt": [ "blue skirt": [
1011, 1011,
7386, 7386,
@@ -1662,6 +1667,11 @@
12445, 12445,
12447 12447
], ],
"blue cape": [
1021,
25195,
25208
],
"blue partyhat": [ "blue partyhat": [
1042, 1042,
2422 2422
@@ -3353,7 +3363,17 @@
], ],
"explosive potion": [ "explosive potion": [
4045, 4045,
23818 23818,
25211
],
"bandages": [
4049,
25202
],
"barricade": [
4053,
25209,
25210
], ],
"decorative sword": [ "decorative sword": [
4068, 4068,
@@ -3402,7 +3422,12 @@
4506, 4506,
4511, 4511,
20489, 20489,
24160 24160,
25157,
25165,
25169,
25174,
25176
], ],
"decorative shield": [ "decorative shield": [
4072, 4072,
@@ -3415,11 +3440,14 @@
4081, 4081,
10588, 10588,
12017, 12017,
12018 12018,
25250,
25278
], ],
"sled": [ "sled": [
4083, 4083,
4084 4084,
25282
], ],
"dragon platelegs": [ "dragon platelegs": [
4087, 4087,
@@ -3494,7 +3522,8 @@
], ],
"stick": [ "stick": [
4179, 4179,
9702 9702,
25285
], ],
"extended brush": [ "extended brush": [
4191, 4191,
@@ -4790,20 +4819,24 @@
"seers ring": [ "seers ring": [
6731, 6731,
11770, 11770,
23624 23624,
25258
], ],
"archers ring": [ "archers ring": [
6733, 6733,
11771 11771,
25260
], ],
"warrior ring": [ "warrior ring": [
6735, 6735,
11772 11772,
25262
], ],
"berserker ring": [ "berserker ring": [
6737, 6737,
11773, 11773,
23595 23595,
25264
], ],
"darklight": [ "darklight": [
6746, 6746,
@@ -6114,7 +6147,18 @@
11781, 11781,
11782, 11782,
11783, 11783,
11784 11784,
25266,
25267,
25268,
25269,
25270,
25271,
25272,
25273,
25274,
25275,
25276
], ],
"bandana eyepatch": [ "bandana eyepatch": [
8924, 8924,
@@ -7387,7 +7431,15 @@
23073, 23073,
23075, 23075,
24370, 24370,
24444 24444,
25177,
25179,
25181,
25183,
25185,
25187,
25189,
25191
], ],
"slayer ring": [ "slayer ring": [
11866, 11866,
@@ -7472,15 +7524,18 @@
], ],
"ring of the gods": [ "ring of the gods": [
12601, 12601,
13202 13202,
25252
], ],
"tyrannical ring": [ "tyrannical ring": [
12603, 12603,
12691 12691,
25254
], ],
"treasonous ring": [ "treasonous ring": [
12605, 12605,
12692 12692,
25256
], ],
"bandos page": [ "bandos page": [
12613, 12613,
@@ -8215,7 +8270,9 @@
19550, 19550,
19710, 19710,
20655, 20655,
20657 20657,
25246,
25248
], ],
"amulet of torture": [ "amulet of torture": [
19553, 19553,
@@ -8594,7 +8651,8 @@
], ],
"granite ring": [ "granite ring": [
21739, 21739,
21752 21752,
25193
], ],
"imbued saradomin max cape": [ "imbued saradomin max cape": [
21776, 21776,
@@ -8872,6 +8930,10 @@
22405, 22405,
22446 22446
], ],
"old key": [
22428,
25244
],
"battlemage potion": [ "battlemage potion": [
22449, 22449,
22452, 22452,
@@ -9478,5 +9540,64 @@
"extradimensional bag": [ "extradimensional bag": [
25106, 25106,
25108 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
] ]
} }

View File

@@ -24,50 +24,35 @@
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--> -->
<configuration scan="true"> <configuration scan="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder> <encoder>
<Pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</Pattern> <Pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</Pattern>
</encoder> </encoder>
</appender> </appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${user.home}/.runelite/logs/client.log</file> <file>${user.home}/.runelite/logs/client.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover --> <!-- daily rollover -->
<fileNamePattern>${user.home}/.runelite/logs/client_%d{yyyy-MM-dd}.%i.log</fileNamePattern> <fileNamePattern>${user.home}/.runelite/logs/client_%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- when file size is larger than defined, roll to new file --> <!-- when file size is larger than defined, roll to new file -->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>10MB</maxFileSize> <maxFileSize>10MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy> </timeBasedFileNamingAndTriggeringPolicy>
<!-- keep 30 days' worth of history --> <!-- keep 30 days' worth of history -->
<maxHistory>30</maxHistory> <maxHistory>30</maxHistory>
</rollingPolicy> </rollingPolicy>
<encoder> <encoder>
<Pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</Pattern> <Pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n</Pattern>
</encoder> </encoder>
</appender> </appender>
<!-- Configure the Sentry appender, overriding the logging threshold to the WARN level --> <root level="INFO">
<appender name="Sentry" class="io.sentry.logback.SentryAppender"> <appender-ref ref="STDOUT"/>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> <appender-ref ref="FILE"/>
<level>ERROR</level> </root>
</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> </configuration>

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 720 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 943 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 759 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 824 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 716 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 197 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 448 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 410 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 973 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 343 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 871 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -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.

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 386 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 375 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 348 B

Some files were not shown because too many files have changed in this diff Show More