Skip to content

Commit

Permalink
Merge pull request runelite#16 from FrostyFridge/rl-update
Browse files Browse the repository at this point in the history
Update to new RL api for new game version
  • Loading branch information
FrostyFridge committed Mar 14, 2019
2 parents b30315f + 0967af2 commit f7c7211
Show file tree
Hide file tree
Showing 324 changed files with 7,781 additions and 2,361 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This repo is kept public because I don't mind other people using it.

**Old Plugins, updated and re-enabled**


- AoE Projectile Warnings **Currently broken, expect a fix Soon™**
- Fight Caves & Jad
- Zulrah Helper
Expand Down
2 changes: 1 addition & 1 deletion cache-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.5.11-SNAPSHOT</version>
<version>1.5.16-SNAPSHOT</version>
</parent>

<artifactId>cache-client</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion cache-updater/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.5.11-SNAPSHOT</version>
<version>1.5.16-SNAPSHOT</version>
</parent>

<name>Cache Updater</name>
Expand Down
2 changes: 1 addition & 1 deletion cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.5.11-SNAPSHOT</version>
<version>1.5.16-SNAPSHOT</version>
</parent>

<artifactId>cache</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ public void init()
add(ARRAY_STORE, "array_store", 2, 0);
add(GET_VARC_STRING, "get_varc_string", 0, 0, 0, 1);
add(PUT_VARC_STRING, "put_varc_string", 0, 0, 1, 0);
add(GET_VARC_STRING_2, "get_varc_string2", 0, 0, 0, 1);
add(PUT_VARC_STRING_2, "put_varc_string2", 0, 0, 1, 0);
add(SWITCH, "switch", 1, 0);
add(WIDGET_CREATE_CHILD, "widget_create_child", 3, 0);
add(WIDGET_DESTROY_CHILD, "widget_destroy_child", 0, 0);
Expand Down
2 changes: 2 additions & 0 deletions cache/src/main/java/net/runelite/cache/script/Opcodes.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class Opcodes
public static final int ARRAY_STORE = 46;
public static final int GET_VARC_STRING = 47;
public static final int PUT_VARC_STRING = 48;
public static final int GET_VARC_STRING_2 = 49;
public static final int PUT_VARC_STRING_2 = 50;
public static final int SWITCH = 60;
public static final int WIDGET_CREATE_CHILD = 100;
public static final int WIDGET_DESTROY_CHILD = 101;
Expand Down
5 changes: 3 additions & 2 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">
<module name="Checker">
<module name="TreeWalker">
<module name="LeftCurly">
Expand Down
2 changes: 1 addition & 1 deletion http-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.5.11-SNAPSHOT</version>
<version>1.5.16-SNAPSHOT</version>
</parent>

<name>Web API</name>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
/*
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* 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.ge;

import com.google.gson.Gson;
import java.io.IOException;
import java.util.UUID;
import lombok.AllArgsConstructor;
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
@AllArgsConstructor
public class GrandExchangeClient
{
private static final MediaType JSON = MediaType.parse("application/json");
private static final Gson GSON = RuneLiteAPI.GSON;

private final UUID uuid;

public void submit(GrandExchangeTrade grandExchangeTrade)
{
final HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
.addPathSegment("ge")
.build();

Request request = new Request.Builder()
.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString())
.post(RequestBody.create(JSON, GSON.toJson(grandExchangeTrade)))
.url(url)
.build();

RuneLiteAPI.CLIENT.newCall(request).enqueue(new Callback()
{
@Override
public void onFailure(Call call, IOException e)
{
log.debug("unable to submit trade", e);
}

@Override
public void onResponse(Call call, Response response)
{
log.debug("Submitted trade");
response.close();
}
});
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Levi <me@levischuck.com>
* Copyright (c) 2019, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
Expand All @@ -22,34 +22,17 @@
* (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.xptracker;
package net.runelite.http.api.ge;

import java.time.Instant;
import lombok.Data;

@Data
class XpStateTotal
public class GrandExchangeTrade
{
private int xpGainedInSession = 0;
private int xpPerHour = 0;

void reset()
{
xpGainedInSession = 0;
xpPerHour = 0;
}

void addXpGainedInSession(int skillXpGainedInSession)
{
xpGainedInSession += skillXpGainedInSession;
}

void addXpPerHour(int skillXpGainedPerHour)
{
xpPerHour += skillXpGainedPerHour;
}

XpSnapshotTotal snapshot()
{
return new XpSnapshotTotal(xpGainedInSession, xpPerHour);
}
private boolean buy;
private int itemId;
private int quantity;
private int price;
private Instant time;
}
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,12 @@ public ItemPrice[] getPrices() throws IOException
}
}

public Map<String, ItemStats> getStats() throws IOException
public Map<Integer, ItemStats> getStats() throws IOException
{
HttpUrl.Builder urlBuilder = RuneLiteAPI.getStaticBase().newBuilder()
.addPathSegment("item")
.addPathSegment("stats.min.json");
// TODO: Change this to stats.min.json later after release is undeployed
.addPathSegment("stats.ids.min.json");

HttpUrl url = urlBuilder.build();

Expand All @@ -227,7 +228,7 @@ public Map<String, ItemStats> getStats() throws IOException
}

InputStream in = response.body().byteStream();
final Type typeToken = new TypeToken<Map<String, ItemStats>>()
final Type typeToken = new TypeToken<Map<Integer, ItemStats>>()
{
}.getType();
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), typeToken);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
package net.runelite.http.api.loottracker;

import java.time.Instant;
import java.util.Collection;
import lombok.AllArgsConstructor;
import lombok.Data;
Expand All @@ -37,4 +38,5 @@ public class LootRecord
private String eventId;
private LootRecordType type;
private Collection<GameItem> drops;
private Instant time;
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ public Collection<LootRecord> get() throws IOException

Request request = new Request.Builder()
.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString())
.get()
.url(url)
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
import okhttp3.Response;

@Slf4j
public class GrandExchangeClient
public class OSBGrandExchangeClient
{
public GrandExchangeResult lookupItem(int itemId) throws IOException
public OSBGrandExchangeResult lookupItem(int itemId) throws IOException
{
final HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
.addPathSegment("osb")
Expand All @@ -59,7 +59,7 @@ public GrandExchangeResult lookupItem(int itemId) throws IOException
}

final InputStream in = response.body().byteStream();
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), GrandExchangeResult.class);
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), OSBGrandExchangeResult.class);
}
catch (JsonParseException ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import lombok.Data;

@Data
public class GrandExchangeResult
public class OSBGrandExchangeResult
{
private int item_id;
private int buy_average;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
package net.runelite.http.api.ws.messages.party;

import java.util.UUID;
import lombok.EqualsAndHashCode;
import lombok.Value;
import net.runelite.http.api.ws.WebsocketMessage;

@Value
@EqualsAndHashCode(callSuper = true)
public class Join extends WebsocketMessage
{
private final UUID partyId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
package net.runelite.http.api.ws.messages.party;

import java.util.UUID;
import lombok.EqualsAndHashCode;
import lombok.Value;
import net.runelite.http.api.ws.WebsocketMessage;

@Value
@EqualsAndHashCode(callSuper = true)
public class UserJoin extends WebsocketMessage
{
private final UUID memberId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@
package net.runelite.http.api.ws.messages.party;

import java.util.UUID;
import lombok.EqualsAndHashCode;
import lombok.Value;
import net.runelite.http.api.ws.WebsocketMessage;

@Value
@EqualsAndHashCode(callSuper = true)
public class UserPart extends WebsocketMessage
{
private final UUID memberId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
*/
package net.runelite.http.api.ws.messages.party;

import lombok.EqualsAndHashCode;
import lombok.Value;

@Value
@EqualsAndHashCode(callSuper = true)
public class UserSync extends PartyMemberMessage
{
}
11 changes: 10 additions & 1 deletion http-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<parent>
<groupId>net.runelite</groupId>
<artifactId>runelite-parent</artifactId>
<version>1.5.11-SNAPSHOT</version>
<version>1.5.16-SNAPSHOT</version>
</parent>

<name>Web Service</name>
Expand All @@ -55,6 +55,10 @@
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
</dependency>

<dependency>
<groupId>org.mapstruct</groupId>
Expand Down Expand Up @@ -130,6 +134,11 @@
<version>3.7.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<dependencyManagement>
Expand Down
Loading

0 comments on commit f7c7211

Please sign in to comment.