diff --git a/README.md b/README.md index c1e6723a8b..0fa8b7c87b 100644 --- a/README.md +++ b/README.md @@ -2,31 +2,24 @@ -# RuneLitePlus -[![forthebadge](https://forthebadge.com/images/badges/built-by-developers.svg)](https://forthebadge.com) +# RuneLitePlus-PS rev180 [![Build Status](https://travis-ci.org/zeruth/runeliteplus-ps.svg?branch=master)](https://travis-ci.org/zeruth/runeliteplus-ps) [![Discord](https://img.shields.io/discord/373382904769675265.svg)](https://discord.gg/HN5gf3m) -[![Build Status](https://travis-ci.org/runelite-extended/runelite.svg?branch=master)](https://travis-ci.org/runelite-extended/runelite) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) [![HitCount](http://hits.dwyl.io/runelite-extended/runelite.svg)](http://hits.dwyl.io/runelite-extended/runelite) [![saythanks](https://img.shields.io/badge/say-thanks-32cd32.svg)](https://www.patreon.com/RuneLitePlus) +[RuneLitePlus-PS](https://runelitepl.us) is a fork of [RuneLite](https://github.com/runelite/runelite) that provides more functionality and less restrictions while staying open source. This is a specific version meant for rs-mod which can be found here: +https://www.rune-server.ee/runescape-development/rs2-server/downloads/684206-180-rs-mod-release.html -[RuneLitePlus](https://runelitepl.us) is a extended version of [RuneLite](https://github.com/runelite/runelite) that provides more functionality and less restrictions while staying more open-source. +## Usage +By default, this connects to our sandbox server, which is for client testing. +To setup your rsa keys, navigate to runelite-mixins and go to RSBufferMixin and set modulus and exponent +To setup your codebase, navigate to runelite-client/rs and go to RSAppletStub and set codebase = new URL("http://IP_OR_URL_HERE/"); +After that it's ran much like RuneLite or RuneLitePlus, install then run RuneLite.main() -## Discord -![[Discord]](https://discordapp.com/api/guilds/373382904769675265/widget.png?style=banner2) - -## Project Layout - -- [cache](cache/src/main/java/net/runelite/cache) - Libraries used for reading/writing cache files, as well as the data in it -- [http-api](http-api/src/main/java/net/runelite/http/api) - API for runelite and runeliteplus -- [http-service](http-service/src/main/java/net/runelite/http/service) - Service for https://api.runelitepl.us -- [runelite-api](runelite-api/src/main/java/net/runelite/api) - RuneLite API, interfaces for accessing the client -- [runelite-mixins](runelite-mixins/src/main/java/net/runelite) - Mixins which are injected into the vanilla client's classes -- [runescape-api](runescape-api/src/main/java/net/runelite) - Mappings correspond to these interfaces, runelite-api is a subset of this -- [runelite-client](runelite-client/src/main/java/net/runelite/client) - Game client with plugins +To release the built jar publicly, you'd have to host your injected client remotely and make some small modifications to rs.ClientLoader ## License -RuneLitePlus is licensed under the BSD 2-clause license. See the license header in the respective file to be sure. +RuneLitePlus-PS is licensed under the BSD 2-clause license. See the license header in the respective file to be sure. ## Contribute and Develop diff --git a/http-api/src/main/java/net/runelite/http/api/xtea/XteaClient.java b/http-api/src/main/java/net/runelite/http/api/xtea/XteaClient.java index 7e01dc4b56..25196717ba 100644 --- a/http-api/src/main/java/net/runelite/http/api/xtea/XteaClient.java +++ b/http-api/src/main/java/net/runelite/http/api/xtea/XteaClient.java @@ -49,55 +49,7 @@ public class XteaClient public void submit(XteaRequest xteaRequest) { - String json = RuneLiteAPI.GSON.toJson(xteaRequest); - - HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder() - .addPathSegment("xtea") - .build(); - - logger.debug("Built URI: {}", url); - - Request request = new Request.Builder() - .post(RequestBody.create(JSON, json)) - .url(url) - .build(); - - try - { - try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute()) - { - logger.debug("xtea response " + response.code()); - } - } - catch (IOException e) - { - e.printStackTrace(); - } - - RuneLiteAPI.RLP_CLIENT.newCall(request).enqueue(new Callback() - { - @Override - public void onFailure(Call call, IOException e) - { - logger.warn("unable to submit xtea keys", e); - } - - @Override - public void onResponse(Call call, Response response) - { - try - { - if (!response.isSuccessful()) - { - logger.debug("unsuccessful xtea response"); - } - } - finally - { - response.close(); - } - } - }); + // Don't submit xteas from private server } public List get() throws IOException diff --git a/params.txt b/params.txt new file mode 100644 index 0000000000..5de07bea64 --- /dev/null +++ b/params.txt @@ -0,0 +1,24 @@ +Created at Thu Jun 20 05:35:31 CDT 2019 + +codebase=http://oldschool6b.runescape.com/ +mainclass=client.class + +param=1=1 +param=2=https://payments.jagex.com/operator/v1/ +param=3=true +param=4=761 +param=5=1 +param=6=0 +param=7=0 +param=8=true +param=9=ElZAIrq5NpKN6D3mDdihco3oPeYN2KFy2DCquj7JMmECPmLrDP3Bnw +param=10=5 +param=11=https://auth.jagex.com/ +param=12=306 +param=13=.runescape.com +param=14=0 +param=15=0 +param=16=false +param=17=http://www.runescape.com/g=oldscape/slr.ws?order=LPWM +param=18= +param=19=196515767263-1oo20deqm6edn7ujlihl6rpadk9drhva.apps.googleusercontent.com diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java deleted file mode 100644 index 96d5dfa246..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldPlugin.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * Copyright (c) 2018, Tomas Slusny - * 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.client.plugins.defaultworld; - -import com.google.inject.Provides; -import java.io.IOException; -import javax.inject.Inject; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Client; -import net.runelite.api.GameState; -import net.runelite.api.events.GameStateChanged; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.SessionOpen; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.util.WorldUtil; -import net.runelite.http.api.worlds.World; -import net.runelite.http.api.worlds.WorldClient; -import net.runelite.http.api.worlds.WorldResult; - -@PluginDescriptor( - name = "Default World", - description = "Enable a default world to be selected when launching the client", - tags = {"home"} -) -@Slf4j -public class DefaultWorldPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private DefaultWorldConfig config; - - private final WorldClient worldClient = new WorldClient(); - private int worldCache; - private boolean worldChangeRequired; - - @Override - protected void startUp() throws Exception - { - worldChangeRequired = true; - applyWorld(); - } - - @Override - protected void shutDown() throws Exception - { - worldChangeRequired = true; - changeWorld(worldCache); - } - - @Provides - DefaultWorldConfig getConfig(ConfigManager configManager) - { - return configManager.getConfig(DefaultWorldConfig.class); - } - - @Subscribe - public void onSessionOpen(SessionOpen event) - { - worldChangeRequired = true; - applyWorld(); - } - - @Subscribe - public void onGameStateChanged(GameStateChanged event) - { - applyWorld(); - } - - private void changeWorld(int newWorld) - { - if (!worldChangeRequired || client.getGameState() != GameState.LOGIN_SCREEN) - { - return; - } - - worldChangeRequired = false; - int correctedWorld = newWorld < 300 ? newWorld + 300 : newWorld; - - // Old School RuneScape worlds start on 301 so don't even bother trying to find lower id ones - // and also do not try to set world if we are already on it - if (correctedWorld <= 300 || client.getWorld() == correctedWorld) - { - return; - } - - try - { - final WorldResult worldResult = worldClient.lookupWorlds(); - - if (worldResult == null) - { - return; - } - - final World world = worldResult.findWorld(correctedWorld); - - if (world != null) - { - final net.runelite.api.World rsWorld = client.createWorld(); - rsWorld.setActivity(world.getActivity()); - rsWorld.setAddress(world.getAddress()); - rsWorld.setId(world.getId()); - rsWorld.setPlayerCount(world.getPlayers()); - rsWorld.setLocation(world.getLocation()); - rsWorld.setTypes(WorldUtil.toWorldTypes(world.getTypes())); - - client.changeWorld(rsWorld); - log.debug("Applied new world {}", correctedWorld); - } - else - { - log.warn("World {} not found.", correctedWorld); - } - } - catch (IOException e) - { - log.warn("Error looking up world {}. Error: {}", correctedWorld, e); - } - } - - private void applyWorld() - { - if (worldCache == 0) - { - worldCache = client.getWorld(); - log.debug("Stored old world {}", worldCache); - } - - final int newWorld = config.getWorld(); - changeWorld(newWorld); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java index 1024da016f..a56a7b3a3d 100644 --- a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java +++ b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java @@ -60,13 +60,8 @@ public class ClientLoader switch (updateCheckMode) { - case AUTO: default: return loadRLPlus(config); - case VANILLA: - return loadVanilla(config); - case NONE: - return null; } } catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException e) @@ -107,7 +102,7 @@ public class ClientLoader private static Applet loadFromClass(final RSConfig config, final Class clientClass) throws IllegalAccessException, InstantiationException { final Applet rs = (Applet) clientClass.newInstance(); - rs.setStub(new RSAppletStub(config)); + rs.setStub(new RSAppletStub()); return rs; } } diff --git a/runelite-client/src/main/java/net/runelite/client/rs/RSAppletStub.java b/runelite-client/src/main/java/net/runelite/client/rs/RSAppletStub.java index a3a2a0f14a..df3fce8e0e 100644 --- a/runelite-client/src/main/java/net/runelite/client/rs/RSAppletStub.java +++ b/runelite-client/src/main/java/net/runelite/client/rs/RSAppletStub.java @@ -1,70 +1,133 @@ -/* - * Copyright (c) 2016-2017, Adam - * Copyright (c) 2018, Tomas Slusny - * 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.client.rs; import java.applet.AppletContext; import java.applet.AppletStub; -import java.net.MalformedURLException; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.net.URL; -import lombok.RequiredArgsConstructor; +import java.util.HashMap; +import java.util.Map; +import java.util.logging.Logger; -@RequiredArgsConstructor -class RSAppletStub implements AppletStub +public class RSAppletStub implements AppletStub { - private final RSConfig config; + + public static final Logger logger = Logger.getLogger(RSAppletStub.class.getSimpleName()); + + private static final HashMap params = new HashMap(); + private static final HashMap cfg = new HashMap(); + private static URL codebase; + + static + { + cfg.put("privacyurl", "http://www.jagex.com/g=oldscape/privacy/privacy.ws"); + cfg.put("window_preferredheight", "600"); + cfg.put("msg", "new_version_link=http://oldschool.runescape.com/"); + cfg.put("applet_minwidth", "765"); + cfg.put("adverturl", "http://www.runescape.com/g=oldscape/bare_advert.ws"); + cfg.put("cachedir", "oldschool"); + cfg.put("window_preferredwidth", "800"); + cfg.put("applet_maxheight", "2160"); + cfg.put("win_sub_version", "1"); + cfg.put("browsercontrol_win_x86_jar", "browsercontrol_0_-1928975093.jar"); + cfg.put("other_sub_version", "2"); + cfg.put("initial_jar", "gamepack_4840368.jar"); + cfg.put("advert_height", "96"); + cfg.put("title", "Old School RuneScape"); + cfg.put("storebase", "0"); + cfg.put("initial_class", "client.class"); + cfg.put("applet_maxwidth", "5760"); + cfg.put("download", "1230228"); + cfg.put("termsurl", "http://www.jagex.com/g=oldscape/terms/terms.ws"); + cfg.put("codebase", "http://oldschool1.runescape.com/"); + cfg.put("mac_sub_version", "2"); + cfg.put("browsercontrol_win_amd64_jar", "browsercontrol_1_1674545273.jar"); + cfg.put("applet_minheight", "503"); + cfg.put("viewerversion", "124"); + } + + public RSAppletStub() + { + try + { + parseParams(new FileInputStream(new File("./params.txt"))); + String worldListKey = null; + for (Map.Entry paramEntry : params.entrySet()) + { + String key = paramEntry.getKey(); + String value = paramEntry.getValue(); + if (value.contains("slr.ws")) + { + worldListKey = key; + break; + } + } + codebase = new URL("http://runeliteplus-ps.ddns.net"); //host + params.put(worldListKey, "http://" + codebase.getHost()); + } + catch (IOException e) + { + e.printStackTrace(); + } + } + + private static void parseParams(InputStream stream) throws IOException + { + BufferedReader br = new BufferedReader(new InputStreamReader(stream)); + String line; + while ((line = br.readLine()) != null) + { + int idx = line.indexOf('='); + if (idx != -1) + { + String key = line.substring(0, idx); + String val = line.substring(idx + 1); + if (key.equals("param")) + { + idx = val.indexOf('='); + key = val.substring(0, idx); + val = val.substring(idx + 1); + params.put(key, val); + } + else + { + cfg.put(key, val); + } + } + } + } + + public static void log(String format, Object... params) + { + System.out.printf(format + "\n", params); + } @Override public boolean isActive() { - return true; + return false; } @Override public URL getDocumentBase() { - return getCodeBase(); + return codebase; } @Override public URL getCodeBase() { - try - { - return new URL(config.getCodeBase()); - } - catch (MalformedURLException ex) - { - return null; - } + return codebase; } @Override public String getParameter(String name) { - return config.getAppletProperties().get(name); + return params.get(name); } @Override @@ -77,4 +140,4 @@ class RSAppletStub implements AppletStub public void appletResize(int width, int height) { } -} \ No newline at end of file +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldConfig.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSBufferMixin.java similarity index 52% rename from runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldConfig.java rename to runelite-mixins/src/main/java/net/runelite/mixins/RSBufferMixin.java index 480d4c891d..e37dadc241 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/defaultworld/DefaultWorldConfig.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSBufferMixin.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Tomas Slusny + * Copyright (c) 2019, Null (zeruth) * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -22,22 +22,32 @@ * (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.client.plugins.defaultworld; +package net.runelite.mixins; -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; +import java.math.BigInteger; +import net.runelite.api.mixins.Copy; +import net.runelite.api.mixins.Inject; +import net.runelite.api.mixins.Mixin; +import net.runelite.api.mixins.Replace; +import net.runelite.rs.api.RSBuffer; -@ConfigGroup("defaultworld") -public interface DefaultWorldConfig extends Config +@Mixin(RSBuffer.class) +public abstract class RSBufferMixin implements RSBuffer { - @ConfigItem( - keyName = "defaultWorld", - name = "Default world", - description = "World to use as default one" - ) - default int getWorld() + @Inject + private static BigInteger modulus = new BigInteger("10001", 16); + + @Inject + private static BigInteger exponent = new BigInteger("bb5d826b249905895f4e463422dd339f8375ed5b212ac8890a97e4ab7dba0c5fe8188f44c00f8106e5721f615a8bcee2da7316ff1572cad5fbfd33f30985f0ae855cfd498483ecc0c3a01c8630f90cff1f54e75a44d58482c371e203e6eb7ba879fd65949aeef827a5e550429bd857d712f64351bc1162e1615ca6622a3bc9b8e31a96000fb0a01a12a51ca3e89918c06759d1db65c33dc6a074abec02f94466886d1a52e7d084aa88338aab1f25d58f9e03ed0a308c6c4eed139c1c1c818cd2370d8cd28ec34bce18360d1756e202eb733f998200242d71ce19548f23b03c1eac4d6e9892616ade1c66d2ce3ab69744e27d7099f3574bcd3d3e95e7a52180d9", 16); + + @Copy("encryptRsa") + public void rs$encryptRsa(BigInteger var1, BigInteger var2) { - return 0; } -} \ No newline at end of file + + @Replace("encryptRsa") + public void rl$encryptRsa(BigInteger var1, BigInteger var2) + { + rs$encryptRsa(modulus, exponent); + } +} diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSGameShellMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSGameShellMixin.java index e45d2612e7..93f389345a 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSGameShellMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSGameShellMixin.java @@ -31,6 +31,7 @@ import net.runelite.api.mixins.FieldHook; import net.runelite.api.mixins.Inject; import net.runelite.api.mixins.MethodHook; import net.runelite.api.mixins.Mixin; +import net.runelite.api.mixins.Replace; import net.runelite.api.mixins.Shadow; import net.runelite.rs.api.RSClient; import net.runelite.rs.api.RSGameShell; @@ -97,4 +98,11 @@ public abstract class RSGameShellMixin implements RSGameShell setResizeCanvasNextFrame(true); } } + + @Replace("checkHost") + protected final boolean checkHost() + { + //Always allow host. + return true; + } }