This commit is contained in:
Ian W. ONeill
2019-07-20 05:32:33 +01:00
15 changed files with 1071 additions and 156 deletions

View File

@@ -3,27 +3,33 @@
# RuneLitePlus # RuneLitePlus
[![forthebadge](https://forthebadge.com/images/badges/built-by-developers.svg)](https://forthebadge.com) [![Build Status](https://travis-ci.org/runelite-extended/runelite.svg?branch=master)](https://travis-ci.org/runelite-extended/runelite)
[![HitCount](http://hits.dwyl.io/runelite-extended/runelite.svg)](http://hits.dwyl.io/runelite-extended/runelite)
[![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](https://runelitepl.us) is an extended version of [RuneLite](https://github.com/runelite/runelite) that provides more functionality and less restrictions while staying more open-source. We are not affiliated with RuneLite.
[RuneLitePlus](https://runelitepl.us) is an extended version of [RuneLite](https://github.com/runelite/runelite) that provides more functionality and less restrictions while staying more open-source.
## Discord ## Discord
![[Discord]](https://discordapp.com/api/guilds/373382904769675265/widget.png?style=banner2) [![Discord](https://img.shields.io/discord/373382904769675265.svg)](https://discord.gg/HN5gf3m)
## Project Layout ## Project Layout
- [cache](cache/src/main/java/net/runelite/cache) - Libraries used for reading/writing cache files, as well as the data in it - [cache](cache/src/main/java/net/runelite/cache) - Libraries used for reading/writing cache files, as well as the data in it
- [deobfuscator](deobfuscator/src/main/java/net/runelite/deob) - Can decompile and cleanup gamepacks as well as map updates to newer revs
- [http-api](http-api/src/main/java/net/runelite/http/api) - API for runelite and runeliteplus - [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 - [http-service](http-service/src/main/java/net/runelite/http/service) - Service for https://api.runelitepl.us
- [injector-plugin](injector-plugin/src/main/java/net/runelite/injector) - Tool for implementing our modifications to the gamepack
- [runelite-api](runelite-api/src/main/java/net/runelite/api) - RuneLite API, interfaces for accessing the client - [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 - [runelite-mixins](runelite-mixins/src/main/java/net/runelite) - Classes containing the Objects to be injected using the injector-plugin
- [runescape-api](runescape-api/src/main/java/net/runelite) - Mappings correspond to these interfaces, runelite-api is a subset of this - [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 - [runelite-client](runelite-client/src/main/java/net/runelite/client) - Game client with plugins
## Private Servers
Currently we support RSMod which can be found at: https://github.com/Tomm0017/rsmod
```
Use -local-injected and -private-server args.
Replace modulus in RSBufferMixin.
Set codebase in PrivateRSAppletStub.
Disable Default World plugin if you have it enabled, this causes issues with codebase.
```
## License ## License
RuneLitePlus is licensed under the BSD 2-clause license. See the license header in the respective file to be sure. RuneLitePlus is licensed under the BSD 2-clause license. See the license header in the respective file to be sure.

View File

@@ -56,10 +56,10 @@
"size": "3168921" "size": "3168921"
}, },
{ {
"hash": "d982191ebbd930b573e6d2242cdfefefdf1c610f1f046e204866749eefde1c5f", "hash": "e25ba84d1b376ed44b9ecdc72a23db55e2127c1079507ab79d0d2d2e3cae7d0d",
"name": "client-1.5.30-SNAPSHOT.jar", "name": "client-1.5.30-SNAPSHOT.jar",
"path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/client-1.5.30-SNAPSHOT.jar", "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/client-1.5.30-SNAPSHOT.jar",
"size": "6280727" "size": "6287131"
}, },
{ {
"hash": "18c4a0095d5c1da6b817592e767bb23d29dd2f560ad74df75ff3961dbde25b79", "hash": "18c4a0095d5c1da6b817592e767bb23d29dd2f560ad74df75ff3961dbde25b79",
@@ -248,10 +248,10 @@
"size": "2327547" "size": "2327547"
}, },
{ {
"hash": "c0a81abdd6a7486851ef7f0df2ce70d7e362fb033eb5c4267a4a476e35a1824a", "hash": "62e5ffeaef627f96c08f7ba203ac15bec1e6d1bc975e43f94b9fd0affe8fc53a",
"name": "runelite-api-1.5.30-SNAPSHOT.jar", "name": "runelite-api-1.5.30-SNAPSHOT.jar",
"path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/runelite-api-1.5.30-SNAPSHOT.jar", "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/runelite-api-1.5.30-SNAPSHOT.jar",
"size": "1033784" "size": "1033835"
}, },
{ {
"hash": "e8e743c2eb9e59f2990a5bdc48f061b7138890f065c0d603ecb8cdf0b0b158f7", "hash": "e8e743c2eb9e59f2990a5bdc48f061b7138890f065c0d603ecb8cdf0b0b158f7",
@@ -260,7 +260,7 @@
"size": "58398" "size": "58398"
}, },
{ {
"hash": "fea59d29ac883248bcc77a5f05b0cefebc226583d291f52d377e39db06fe7d19", "hash": "d6fd6564dcbbaa68259d675a6f4928cf44394f04963917f08d2c1c179eee829d",
"name": "http-api-1.5.30-SNAPSHOT.jar", "name": "http-api-1.5.30-SNAPSHOT.jar",
"path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/http-api-1.5.30-SNAPSHOT.jar", "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/http-api-1.5.30-SNAPSHOT.jar",
"size": "139678" "size": "139678"
@@ -290,10 +290,10 @@
"size": "617294" "size": "617294"
}, },
{ {
"hash": "9f5333cb045ebd90b1ee457f1ceafc1a085265232926a24fb582ff1960bef703", "hash": "efeddd377fb52fcb8298d016277299316b4637be9e52a51cc2bea980610c6b1b",
"name": "injected-client-1.5.30-SNAPSHOT.jar", "name": "injected-client-1.5.30-SNAPSHOT.jar",
"path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/injected-client-1.5.30-SNAPSHOT.jar", "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/injected-client-1.5.30-SNAPSHOT.jar",
"size": "2253443" "size": "2253211"
}, },
{ {
"hash": "21b5cac673a156cd8d6cf9efe15ff267b6353eeb129678aa4b39542683ba0dc2", "hash": "21b5cac673a156cd8d6cf9efe15ff267b6353eeb129678aa4b39542683ba0dc2",
@@ -308,7 +308,7 @@
"size": "27750" "size": "27750"
}, },
{ {
"hash": "830a08b9d5c20ab8e2033c16fc6ee067e6ffcd0c730f303d648aadfa81210d62", "hash": "cc09ab0b140e0d0496c2165d4b32ce24f4d6446c0a26c5dc77b06bdf99ee8fae",
"name": "reactive-streams-1.0.2.jar", "name": "reactive-streams-1.0.2.jar",
"path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/artifacts/reactive-streams-1.0.2.jar", "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/artifacts/reactive-streams-1.0.2.jar",
"size": "27750" "size": "27750"

24
params.txt Normal file
View File

@@ -0,0 +1,24 @@
Created at Thu Jul 18 15:08:02 CDT 2019
codebase=http://oldschool14.runescape.com/
mainclass=client.class
param=1=1
param=2=https://payments.jagex.com/operator/v1/
param=3=true
param=4=59193
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=314
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

View File

@@ -199,12 +199,6 @@
<version>${project.version}</version> <version>${project.version}</version>
<scope>runtime</scope> <scope>runtime</scope>
</dependency> </dependency>
<dependency>
<groupId>net.runelite</groupId>
<artifactId>injected-client</artifactId>
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
<dependency> <dependency>
<groupId>net.runelite</groupId> <groupId>net.runelite</groupId>
<artifactId>http-api</artifactId> <artifactId>http-api</artifactId>

View File

@@ -82,7 +82,7 @@ import org.slf4j.LoggerFactory;
@Slf4j @Slf4j
public class RuneLite public class RuneLite
{ {
public static final String RUNELIT_VERSION = "2.0.4"; public static final String RUNELIT_VERSION = "2.0.5";
public static final File RUNELITE_DIR = new File(System.getProperty("user.home"), ".runelite"); public static final File RUNELITE_DIR = new File(System.getProperty("user.home"), ".runelite");
public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles"); public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles");
public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins"); public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins");
@@ -181,6 +181,7 @@ public class RuneLite
parser.accepts("debug", "Show extra debugging output"); parser.accepts("debug", "Show extra debugging output");
parser.accepts("no-splash", "Do not show the splash screen"); parser.accepts("no-splash", "Do not show the splash screen");
parser.accepts("local-injected", "Use local injected-client"); parser.accepts("local-injected", "Use local injected-client");
parser.accepts("private-server", "Use a non official server to play");
final ArgumentAcceptingOptionSpec<String> proxyInfo = parser final ArgumentAcceptingOptionSpec<String> proxyInfo = parser
.accepts("proxy") .accepts("proxy")
@@ -251,6 +252,13 @@ public class RuneLite
} }
} }
final boolean privateServer = options.has("private-server");
if (privateServer)
{
ClientLoader.usePrivateServer = true;
}
PROFILES_DIR.mkdirs(); PROFILES_DIR.mkdirs();
if (options.has("debug")) if (options.has("debug"))

View File

@@ -51,7 +51,7 @@ public interface ChatTranslationConfig extends Config
@ConfigItem( @ConfigItem(
keyName = "publicTargetLanguage", keyName = "publicTargetLanguage",
name = "Target Language", name = "Target Language",
description = "Language to translate messages too.", description = "Language to translate messages to.",
position = 2, position = 2,
group = "Chat Translation", group = "Chat Translation",
hidden = true, hidden = true,
@@ -77,7 +77,7 @@ public interface ChatTranslationConfig extends Config
@ConfigItem( @ConfigItem(
keyName = "playerTargetLanguage", keyName = "playerTargetLanguage",
name = "Target Language", name = "Target Language",
description = "Language to translate messages too.", description = "Language to translate messages to.",
position = 4, position = 4,
group = "Player Message Translation", group = "Player Message Translation",
hidden = true, hidden = true,

View File

@@ -35,6 +35,7 @@ import java.awt.image.BufferedImage;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@@ -60,6 +61,7 @@ import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.FocusChanged; import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.GrandExchangeOfferChanged; import net.runelite.api.events.GrandExchangeOfferChanged;
import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.ScriptCallbackEvent; import net.runelite.api.events.ScriptCallbackEvent;
@@ -98,20 +100,18 @@ import net.runelite.http.api.osbuddy.OSBGrandExchangeClient;
@Singleton @Singleton
public class GrandExchangePlugin extends Plugin public class GrandExchangePlugin extends Plugin
{ {
static final String SEARCH_GRAND_EXCHANGE = "Search Grand Exchange";
private static final int OFFER_TYPE = 18;
private static final int OFFER_CONTAINER_ITEM = 21; private static final int OFFER_CONTAINER_ITEM = 21;
private static final int OFFER_DEFAULT_ITEM_ID = 6512; private static final int OFFER_DEFAULT_ITEM_ID = 6512;
private static final OSBGrandExchangeClient CLIENT = new OSBGrandExchangeClient(); private static final OSBGrandExchangeClient CLIENT = new OSBGrandExchangeClient();
private static final String OSB_GE_TEXT = "<br>OSBuddy Actively traded price: "; private static final String OSB_GE_TEXT = "<br>OSBuddy Actively traded price: ";
private static final String AFFORD_GE_TEXT = "<br>Can Afford: ";
private static final String BUY_LIMIT_GE_TEXT = "Buy limit: "; private static final String BUY_LIMIT_GE_TEXT = "<br>Buy limit: ";
private static final String AFFORD_GE_TEXT = "<br>Afford: ";
private static final Gson GSON = new Gson(); private static final Gson GSON = new Gson();
private static final TypeToken<Map<Integer, Integer>> BUY_LIMIT_TOKEN = new TypeToken<Map<Integer, Integer>>() private static final TypeToken<Map<Integer, Integer>> BUY_LIMIT_TOKEN = new TypeToken<Map<Integer, Integer>>()
{ {
}; };
static final String SEARCH_GRAND_EXCHANGE = "Search Grand Exchange";
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private NavigationButton button; private NavigationButton button;
@@ -162,17 +162,26 @@ public class GrandExchangePlugin extends Plugin
private EventBus eventBus; private EventBus eventBus;
private Widget grandExchangeText; private Widget grandExchangeText;
private Widget grandExchangeOfferType;
private Widget grandExchangeItem; private Widget grandExchangeItem;
private Map<Integer, Integer> itemGELimits; private Map<Integer, Integer> itemGELimits;
private GrandExchangeClient grandExchangeClient; private GrandExchangeClient grandExchangeClient;
private int coins = 0; private int coins = 0;
private int lastAmount = -1; private boolean quickLookup;
private int lastItem = -1; private boolean enableNotifications;
private boolean enableOsbPrices;
private boolean enableGELimits;
private boolean enableAfford;
private int osbItem = -1; private static Map<Integer, Integer> loadGELimits()
private String osbText = ""; {
final InputStream geLimitData = GrandExchangePlugin.class.getResourceAsStream("ge_limits.json");
final Map<Integer, Integer> itemGELimits = GSON.fromJson(new InputStreamReader(geLimitData), BUY_LIMIT_TOKEN.getType());
log.debug("Loaded {} limits", itemGELimits.size());
return itemGELimits;
}
private SavedOffer getOffer(int slot) private SavedOffer getOffer(int slot)
{ {
@@ -194,12 +203,6 @@ public class GrandExchangePlugin extends Plugin
configManager.unsetConfiguration("geoffer." + client.getUsername().toLowerCase(), Integer.toString(slot)); configManager.unsetConfiguration("geoffer." + client.getUsername().toLowerCase(), Integer.toString(slot));
} }
private boolean quickLookup;
private boolean enableNotifications;
private boolean enableOsbPrices;
private boolean enableGELimits;
private boolean enableAfford;
@Provides @Provides
GrandExchangeConfig provideConfig(ConfigManager configManager) GrandExchangeConfig provideConfig(ConfigManager configManager)
{ {
@@ -250,6 +253,7 @@ public class GrandExchangePlugin extends Plugin
keyManager.unregisterKeyListener(inputListener); keyManager.unregisterKeyListener(inputListener);
grandExchangeText = null; grandExchangeText = null;
grandExchangeItem = null; grandExchangeItem = null;
grandExchangeOfferType = null;
itemGELimits = null; itemGELimits = null;
grandExchangeClient = null; grandExchangeClient = null;
} }
@@ -257,6 +261,7 @@ public class GrandExchangePlugin extends Plugin
private void addSubscriptions() private void addSubscriptions()
{ {
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged); eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage); eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
eventBus.subscribe(SessionOpen.class, this, this::onSessionOpen); eventBus.subscribe(SessionOpen.class, this, this::onSessionOpen);
eventBus.subscribe(SessionClose.class, this, this::onSessionClose); eventBus.subscribe(SessionClose.class, this, this::onSessionClose);
@@ -461,14 +466,14 @@ public class GrandExchangePlugin extends Plugin
{ {
switch (event.getGroupId()) switch (event.getGroupId())
{ {
// Grand exchange was opened.
case WidgetID.GRAND_EXCHANGE_GROUP_ID: case WidgetID.GRAND_EXCHANGE_GROUP_ID:
Widget grandExchangeOffer = client.getWidget(WidgetInfo.GRAND_EXCHANGE_OFFER_CONTAINER); Widget grandExchangeOffer = client.getWidget(WidgetInfo.GRAND_EXCHANGE_OFFER_CONTAINER);
grandExchangeText = client.getWidget(WidgetInfo.GRAND_EXCHANGE_OFFER_TEXT); grandExchangeText = client.getWidget(WidgetInfo.GRAND_EXCHANGE_OFFER_TEXT);
grandExchangeItem = grandExchangeOffer.getDynamicChildren()[OFFER_CONTAINER_ITEM]; grandExchangeItem = grandExchangeOffer.getDynamicChildren()[OFFER_CONTAINER_ITEM];
grandExchangeOfferType = grandExchangeOffer.getDynamicChildren()[OFFER_TYPE];
break; break;
// Grand exchange was closed (if it was open before).
case WidgetID.INVENTORY_GROUP_ID: case WidgetID.INVENTORY_GROUP_ID:
grandExchangeOfferType = null;
grandExchangeText = null; grandExchangeText = null;
grandExchangeItem = null; grandExchangeItem = null;
break; break;
@@ -477,11 +482,6 @@ public class GrandExchangePlugin extends Plugin
private void onScriptCallbackEvent(ScriptCallbackEvent event) private void onScriptCallbackEvent(ScriptCallbackEvent event)
{ {
if (event.getEventName().equals("geBuilt"))
{
rebuildGeText();
}
if (!event.getEventName().equals("setGETitle") || !config.showTotal()) if (!event.getEventName().equals("setGETitle") || !config.showTotal())
{ {
return; return;
@@ -515,14 +515,13 @@ public class GrandExchangePlugin extends Plugin
titleBuilder.append(')'); titleBuilder.append(')');
// Append to title
String[] stringStack = client.getStringStack(); String[] stringStack = client.getStringStack();
int stringStackSize = client.getStringStackSize(); int stringStackSize = client.getStringStackSize();
stringStack[stringStackSize - 1] += titleBuilder.toString(); stringStack[stringStackSize - 1] += titleBuilder.toString();
} }
public void rebuildGeText() private void onGameTick(GameTick event)
{ {
if (grandExchangeText == null || grandExchangeItem == null || grandExchangeItem.isHidden()) if (grandExchangeText == null || grandExchangeItem == null || grandExchangeItem.isHidden())
{ {
@@ -530,32 +529,22 @@ public class GrandExchangePlugin extends Plugin
} }
final Widget geText = grandExchangeText; final Widget geText = grandExchangeText;
final String geTextString = geText.getText();
final String offerType = grandExchangeOfferType.getText();
final int itemId = grandExchangeItem.getItemId(); final int itemId = grandExchangeItem.getItemId();
if (itemId == OFFER_DEFAULT_ITEM_ID || itemId == -1) if (itemId == OFFER_DEFAULT_ITEM_ID || itemId == -1)
{ {
lastAmount = osbItem = lastItem = -1;
// This item is invalid/nothing has been searched for
return; return;
} }
final int currentItemPrice = client.getVar(Varbits.GRAND_EXCHANGE_PRICE_PER_ITEM); final int currentItemPrice = client.getVar(Varbits.GRAND_EXCHANGE_PRICE_PER_ITEM);
if (lastItem == itemId && lastAmount == currentItemPrice ) if (this.enableAfford && offerType.equals("Buy offer") && itemGELimits != null && !geTextString.contains(AFFORD_GE_TEXT))
{
return;
}
lastItem = itemId;
lastAmount = currentItemPrice;
String[] texts = geText.getText().split("<br>");
String text = texts[0];
if (this.enableAfford)
{ {
final ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY); final ItemContainer itemContainer = client.getItemContainer(InventoryID.INVENTORY);
final Item[] items = itemContainer.getItems(); final Item[] items = Objects.requireNonNull(itemContainer).getItems();
for (Item item : items) for (Item item : items)
{ {
if (item.getId() == COINS_995) if (item.getId() == COINS_995)
@@ -565,61 +554,55 @@ public class GrandExchangePlugin extends Plugin
} }
} }
text += AFFORD_GE_TEXT + StackFormatter.formatNumber(coins / currentItemPrice) + " "; final String text = geText.getText() + AFFORD_GE_TEXT + StackFormatter.formatNumber(coins / currentItemPrice) + " ";
geText.setText(text);
} }
if (this.enableGELimits && itemGELimits != null)
if (this.enableGELimits && itemGELimits != null && !geTextString.contains(BUY_LIMIT_GE_TEXT))
{ {
final Integer itemLimit = itemGELimits.get(itemId); final Integer itemLimit = itemGELimits.get(itemId);
// If we have item buy limit, append it // If we have item buy limit, append it
if (itemLimit != null) if (itemLimit != null)
{ {
text += (!this.enableAfford ? "<br>" : "") + BUY_LIMIT_GE_TEXT + StackFormatter.formatNumber(itemLimit); final String text = geText.getText() + BUY_LIMIT_GE_TEXT + StackFormatter.formatNumber(itemLimit);
geText.setText(text);
} }
} }
if (!this.enableOsbPrices) if (!this.enableOsbPrices || geTextString.contains(OSB_GE_TEXT))
{ {
geText.setText(text); // OSB prices are disabled or price was already looked up, so no need to set it again
return; return;
} }
geText.setText(text + osbText);
log.debug("Looking up OSB item price {}", itemId); log.debug("Looking up OSB item price {}", itemId);
if (osbItem == lastItem)
{
// OSB Item was already looked up
return;
}
osbItem = lastItem;
final String str = text;
executorService.submit(() -> executorService.submit(() ->
{ {
if (geText.getText().contains(OSB_GE_TEXT))
{
// If there are multiple tasks queued and one of them have already added the price
return;
}
CLIENT.lookupItem(itemId) CLIENT.lookupItem(itemId)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(Schedulers.from(clientThread)) .observeOn(Schedulers.from(clientThread))
.subscribe( .subscribe(
(osbresult) -> (osbresult) ->
{ {
osbText = OSB_GE_TEXT + StackFormatter.formatNumber(osbresult.getOverall_average()); final String text = geText.getText() + OSB_GE_TEXT + StackFormatter.formatNumber(osbresult.getOverall_average());
geText.setText(str + osbText); if (geText.getText().contains(OSB_GE_TEXT))
{
// If there are multiple tasks queued and one of them have already added the price
return;
}
geText.setText(text);
}, },
(e) -> log.debug("Error getting price of item {}", itemId, e) (e) -> log.debug("Error getting price of item {}", itemId, e)
); );
}); });
} }
private static Map<Integer, Integer> loadGELimits()
{
final InputStream geLimitData = GrandExchangePlugin.class.getResourceAsStream("ge_limits.json");
final Map<Integer, Integer> itemGELimits = GSON.fromJson(new InputStreamReader(geLimitData), BUY_LIMIT_TOKEN.getType());
log.debug("Loaded {} limits", itemGELimits.size());
return itemGELimits;
}
} }

View File

@@ -42,6 +42,7 @@ import net.runelite.api.ItemDefinition;
import net.runelite.api.NPC; import net.runelite.api.NPC;
import net.runelite.api.Player; import net.runelite.api.Player;
import net.runelite.api.Prayer; import net.runelite.api.Prayer;
import net.runelite.api.Varbits;
import net.runelite.api.coords.WorldArea; import net.runelite.api.coords.WorldArea;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.api.kit.KitType; import net.runelite.api.kit.KitType;
@@ -521,20 +522,9 @@ class Utils
} }
ThumbnailEmbed image = ThumbnailEmbed.builder() ThumbnailEmbed image = ThumbnailEmbed.builder()
.url("https://oldschool.runescape.wiki/images/a/a1/Skull_(status)_icon.png") .url(ICONBASEURL + player.getWeapon() + ".png")
.height(50)
.width(50)
.build(); .build();
if (player.getPlayer().getSkullIcon() == null)
{
image = ThumbnailEmbed.builder()
.url(ICONBASEURL + player.getWeapon() + ".png")
.height(100)
.width(100)
.build();
}
fieldList.add(FieldEmbed.builder() fieldList.add(FieldEmbed.builder()
.name("Risk") .name("Risk")
.value(StackFormatter.quantityToRSDecimalStack(player.getRisk())) .value(StackFormatter.quantityToRSDecimalStack(player.getRisk()))
@@ -552,18 +542,20 @@ class Utils
.value(Integer.toString(player.getPlayer().getCombatLevel())) .value(Integer.toString(player.getPlayer().getCombatLevel()))
.inline(true) .inline(true)
.build()); .build());
if (client.getVar(Varbits.IN_WILDERNESS) == 1)
{
fieldList.add(FieldEmbed.builder()
.name("Wildy Level")
.value(Integer.toString(player.getWildyLevel()))
.inline(true)
.build());
fieldList.add(FieldEmbed.builder() fieldList.add(FieldEmbed.builder()
.name("Wildy Level") .name("Location")
.value(Integer.toString(player.getWildyLevel())) .value(player.getLocation())
.inline(true) .inline(true)
.build()); .build());
}
fieldList.add(FieldEmbed.builder()
.name("Location")
.value(player.getLocation())
.inline(true)
.build());
fieldList.add(FieldEmbed.builder() fieldList.add(FieldEmbed.builder()
.name("Target") .name("Target")
@@ -613,7 +605,15 @@ class Utils
} }
} }
message(player.getPlayer().getName(), " ", ICONBASEURL + Objects.requireNonNull(getEntry(player.getGear())).getKey() + ".png", image, fieldList, url, discordClient, color); String icon = ICONBASEURL + Objects.requireNonNull(getEntry(player.getGear())).getKey() + ".png";
String name = "☠️ " + player.getName() + " ☠️";
if (player.getPlayer().getSkullIcon() == null)
{
name = player.getName();
}
message(name, " ", icon, image, fieldList, url, discordClient, color);
player.setScouted(true); player.setScouted(true);
fieldList.clear(); fieldList.clear();
} }
@@ -633,7 +633,7 @@ class Utils
DiscordEmbed discordEmbed = DiscordEmbed.builder() DiscordEmbed discordEmbed = DiscordEmbed.builder()
.author(AuthorEmbed.builder() .author(AuthorEmbed.builder()
.icon_url(iconUrl) // Icon of npc / player .icon_url(iconUrl)
.name(name) .name(name)
.build()) .build())
.thumbnail(thumbnail) .thumbnail(thumbnail)

View File

@@ -219,7 +219,7 @@ public class ReportButtonPlugin extends Plugin
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (event.getGroup().equals("regenmeter")) if (event.getGroup().equals("reportButton"))
{ {
this.timeStyle = config.time(); this.timeStyle = config.time();
} }

View File

@@ -26,22 +26,31 @@
*/ */
package net.runelite.client.rs; package net.runelite.client.rs;
import java.net.URLClassLoader;
import java.applet.Applet; import java.applet.Applet;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL; import java.net.URL;
import java.net.URLClassLoader;
import java.net.URLConnection;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import javax.inject.Singleton; import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.client.RuneLite;
import net.runelite.http.api.RuneLiteAPI;
@Slf4j @Slf4j
@Singleton @Singleton
public class ClientLoader public class ClientLoader
{ {
public static boolean useLocalInjected = false;
public static boolean usePrivateServer = false;
private final ClientConfigLoader clientConfigLoader; private final ClientConfigLoader clientConfigLoader;
private final ClientUpdateCheckMode updateCheckMode; private final ClientUpdateCheckMode updateCheckMode;
public static boolean useLocalInjected = false;
@Inject @Inject
private ClientLoader( private ClientLoader(
@@ -52,6 +61,120 @@ public class ClientLoader
this.clientConfigLoader = clientConfigLoader; this.clientConfigLoader = clientConfigLoader;
} }
private static Applet loadRLPlus(final RSConfig config) throws ClassNotFoundException, InstantiationException, IllegalAccessException
{
if (useLocalInjected)
{
try
{
URL localInjected = new File("./injected-client/target/injected-client-" + RuneLiteAPI.getVersion() + ".jar").toURI().toURL();
log.info("Using local injected-client");
URLClassLoader classLoader = new URLClassLoader(new URL[]{localInjected});
Class<?> clientClass = classLoader.loadClass("client");
return loadFromClass(config, clientClass);
}
catch (MalformedURLException e)
{
e.printStackTrace();
}
}
try
{
File cachedInjected = new File(RuneLite.RUNELITE_DIR + "/injected-client-" + RuneLiteAPI.getVersion() + ".jar");
URL remoteInjected = new URL("https://github.com/runelite-extended/maven-repo/raw/master/live/injected-client-" + RuneLiteAPI.getVersion() + ".jar");
int remoteSize = getFileSize(remoteInjected);
URL cachedInjectedURL = cachedInjected.toURI().toURL();
int cachedSize = 0;
if (cachedInjected.exists())
{
cachedSize = getFileSize(cachedInjectedURL);
}
if (remoteSize != cachedSize)
{
log.info("Injected-client size mismatch, updating.");
try (BufferedInputStream in = new BufferedInputStream(remoteInjected.openStream()))
{
FileOutputStream fileOutputStream = new FileOutputStream(cachedInjected);
byte[] dataBuffer = new byte[1024];
int bytesRead;
while ((bytesRead = in.read(dataBuffer, 0, 1024)) != -1)
{
fileOutputStream.write(dataBuffer, 0, bytesRead);
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
URLClassLoader classLoader = new URLClassLoader(new URL[]{cachedInjectedURL}, RuneLite.class.getClassLoader());
Class<?> clientClass = classLoader.loadClass("client");
return loadFromClass(config, clientClass);
}
catch (IOException e)
{
e.printStackTrace();
}
log.error("Failed to load injected-client!");
return null;
}
private static Applet loadVanilla(final RSConfig config) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
{
final String codebase = config.getCodeBase();
final String initialJar = config.getInitialJar();
final String initialClass = config.getInitialClass();
final URL url = new URL(codebase + initialJar);
// Must set parent classloader to null, or it will pull from
// this class's classloader first
final URLClassLoader classloader = new URLClassLoader(new URL[]{url}, null);
final Class<?> clientClass = classloader.loadClass(initialClass);
return loadFromClass(config, clientClass);
}
private static Applet loadFromClass(final RSConfig config, final Class<?> clientClass) throws IllegalAccessException, InstantiationException
{
final Applet rs = (Applet) clientClass.newInstance();
if (usePrivateServer)
{
rs.setStub(new PrivateRSAppletStub());
return rs;
}
rs.setStub(new RSAppletStub(config));
return rs;
}
private static int getFileSize(URL url)
{
URLConnection conn = null;
try
{
conn = url.openConnection();
if (conn instanceof HttpURLConnection)
{
((HttpURLConnection) conn).setRequestMethod("HEAD");
}
conn.getInputStream();
return conn.getContentLength();
}
catch (IOException e)
{
throw new RuntimeException(e);
}
finally
{
if (conn instanceof HttpURLConnection)
{
((HttpURLConnection) conn).disconnect();
}
}
}
public Applet load() public Applet load()
{ {
try try
@@ -84,32 +207,4 @@ public class ClientLoader
return null; return null;
} }
} }
private static Applet loadRLPlus(final RSConfig config) throws ClassNotFoundException, InstantiationException, IllegalAccessException
{
// the injected client is a runtime scoped dependency
final Class<?> clientClass = ClientLoader.class.getClassLoader().loadClass(config.getInitialClass());
return loadFromClass(config, clientClass);
}
private static Applet loadVanilla(final RSConfig config) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException
{
final String codebase = config.getCodeBase();
final String initialJar = config.getInitialJar();
final String initialClass = config.getInitialClass();
final URL url = new URL(codebase + initialJar);
// Must set parent classloader to null, or it will pull from
// this class's classloader first
final URLClassLoader classloader = new URLClassLoader(new URL[]{url}, null);
final Class<?> clientClass = classloader.loadClass(initialClass);
return loadFromClass(config, clientClass);
}
private static Applet loadFromClass(final RSConfig config, final Class<?> clientClass) throws IllegalAccessException, InstantiationException
{
final Applet rs = (Applet) clientClass.newInstance();
rs.setStub(new RSAppletStub(config));
return rs;
}
} }

View File

@@ -0,0 +1,115 @@
package net.runelite.client.rs;
import java.applet.AppletContext;
import java.applet.AppletStub;
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 java.util.HashMap;
import java.util.Map;
import java.util.logging.Logger;
public class PrivateRSAppletStub implements AppletStub
{
public static final Logger logger = Logger.getLogger(RSAppletStub.class.getSimpleName());
private static final HashMap<String, String> params = new HashMap<String, String>();
private static final HashMap<String, String> cfg = new HashMap<String, String>();
private static URL codebase;
public PrivateRSAppletStub()
{
try
{
parseParams(new FileInputStream(new File("./params.txt")));
String worldListKey = null;
for (Map.Entry<String, String> 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 false;
}
@Override
public URL getDocumentBase()
{
return codebase;
}
@Override
public URL getCodeBase()
{
return codebase;
}
@Override
public String getParameter(String name)
{
return params.get(name);
}
@Override
public AppletContext getAppletContext()
{
return null;
}
@Override
public void appletResize(int width, int height)
{
}
}

View File

@@ -13671,7 +13671,7 @@
"acrush": -2, "acrush": -2,
"dslash": 1, "dslash": 1,
"str": 28, "str": 28,
"aspeed": 5 "aspeed": 4
} }
}, },
"3758": { "3758": {

View File

@@ -0,0 +1,53 @@
/*
* Copyright (c) 2019, Null (zeruth)
* 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.mixins;
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;
@Mixin(RSBuffer.class)
public abstract class RSBufferMixin implements RSBuffer
{
@Inject
private static BigInteger exponent = new BigInteger("10001", 16);
@Inject
private static BigInteger modulus = new BigInteger("83ff79a3e258b99ead1a70e1049883e78e513c4cdec538d8da9483879a9f81689c0c7d146d7b82b52d05cf26132b1cda5930eeef894e4ccf3d41eebc3aabe54598c4ca48eb5a31d736bfeea17875a35558b9e3fcd4aebe2a9cc970312a477771b36e173dc2ece6001ab895c553e2770de40073ea278026f36961c94428d8d7db", 16);
@Copy("encryptRsa")
public void rs$encryptRsa(BigInteger var1, BigInteger var2)
{
}
@Replace("encryptRsa")
public void rl$encryptRsa(BigInteger var1, BigInteger var2)
{
rs$encryptRsa(exponent, modulus);
}
}

View File

@@ -31,6 +31,7 @@ import net.runelite.api.mixins.FieldHook;
import net.runelite.api.mixins.Inject; import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook; import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin; import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow; import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient; import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSGameShell; import net.runelite.rs.api.RSGameShell;
@@ -97,4 +98,11 @@ public abstract class RSGameShellMixin implements RSGameShell
setResizeCanvasNextFrame(true); setResizeCanvasNextFrame(true);
} }
} }
@Replace("checkHost")
protected final boolean checkHost()
{
//Always allow host.
return true;
}
} }