Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2020-05-31 05:35:48 +02:00
12 changed files with 70 additions and 61 deletions
@@ -54,6 +54,7 @@ public class RuneLiteAPI
private static final Logger logger = LoggerFactory.getLogger(RuneLiteAPI.class);
public static final String RUNELITE_AUTH = "RUNELITE-AUTH";
public static final String RUNELITE_MACHINEID = "RUNELITE-MACHINEID";
public static final OkHttpClient CLIENT;
public static final Gson GSON = new Gson();
@@ -27,7 +27,7 @@ package net.runelite.http.api.ge;
import com.google.gson.Gson;
import java.io.IOException;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.http.api.RuneLiteAPI;
import static net.runelite.http.api.RuneLiteAPI.JSON;
@@ -39,12 +39,14 @@ import okhttp3.RequestBody;
import okhttp3.Response;
@Slf4j
@AllArgsConstructor
public class GrandExchangeClient
{
private static final Gson GSON = RuneLiteAPI.GSON;
private final UUID uuid;
@Setter
private UUID uuid;
@Setter
private String machineId;
public void submit(GrandExchangeTrade grandExchangeTrade)
{
@@ -53,8 +55,17 @@ public class GrandExchangeClient
.build();
RequestBody body = RequestBody.Companion.create(GSON.toJson(grandExchangeTrade), JSON);
Request request = new Request.Builder()
.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString())
Request.Builder builder = new Request.Builder();
if (uuid != null)
{
builder.header(RuneLiteAPI.RUNELITE_AUTH, uuid.toString());
}
if (machineId != null)
{
builder.header(RuneLiteAPI.RUNELITE_MACHINEID, machineId);
}
Request request = builder
.post(body)
.url(url)
.build();
@@ -24,15 +24,18 @@
*/
package net.runelite.http.api.ge;
import java.time.Instant;
import lombok.Data;
import net.runelite.http.api.worlds.WorldType;
@Data
public class GrandExchangeTrade
{
private boolean buy;
private boolean cancel;
private int itemId;
private int quantity;
private int total;
private int price;
private Instant time;
private int offer;
private WorldType worldType;
}
@@ -130,8 +130,11 @@ public final class AnimationID
public static final int FISHING_BAREHAND_CAUGHT_TUNA_1 = 6710;
public static final int FISHING_BAREHAND_CAUGHT_TUNA_2 = 6711;
public static final int FISHING_PEARL_ROD = 8188;
public static final int FISHING_PEARL_FLY_ROD = 8192;
public static final int FISHING_PEARL_BARBARIAN_ROD = 8193;
public static final int FISHING_PEARL_FLY_ROD = 8189;
public static final int FISHING_PEARL_BARBARIAN_ROD = 8190;
public static final int FISHING_PEARL_ROD_2 = 8191;
public static final int FISHING_PEARL_FLY_ROD_2 = 8192;
public static final int FISHING_PEARL_BARBARIAN_ROD_2 = 8193;
public static final int FISHING_PEARL_OILY_ROD = 6932;
public static final int MINING_BRONZE_PICKAXE = 625;
public static final int MINING_IRON_PICKAXE = 626;
@@ -11472,5 +11472,15 @@ public final class ItemID
public static final int LOGS_24650 = 24650;
public static final int RAW_SHRIMPS_24652 = 24652;
public static final int BONES_24655 = 24655;
public static final int ENRAGED_TEKTINY = 24656;
public static final int FLYING_VESPINA = 24658;
public static final int MASSIVE_STORAGE_UNIT = 24660;
public static final int MASSIVE_STORAGE_UNIT_24661 = 24661;
public static final int MASSIVE_STORAGE_UNIT_24662 = 24662;
public static final int MASSIVE_STORAGE_UNIT_24663 = 24663;
public static final int TWISTED_ANCESTRAL_HAT = 24664;
public static final int TWISTED_ANCESTRAL_ROBE_TOP = 24666;
public static final int TWISTED_ANCESTRAL_ROBE_BOTTOM = 24668;
public static final int TWISTED_ANCESTRAL_COLOUR_KIT = 24670;
/* This file is automatically generated. Do not edit. */
}
@@ -8512,5 +8512,9 @@ public final class NpcID
public static final int ACCOUNT_SECURITY_TUTOR = 9504;
public static final int HAMELN_THE_JESTER_9505 = 9505;
public static final int HANCHEN_THE_HOUND_9506 = 9506;
public static final int ENRAGED_TEKTINY = 9511;
public static final int FLYING_VESPINA = 9512;
public static final int ENRAGED_TEKTINY_9513 = 9513;
public static final int FLYING_VESPINA_9514 = 9514;
/* This file is automatically generated. Do not edit. */
}
@@ -12975,5 +12975,11 @@ public final class NullItemID
public static final int NULL_24651 = 24651;
public static final int NULL_24653 = 24653;
public static final int NULL_24654 = 24654;
public static final int NULL_24657 = 24657;
public static final int NULL_24659 = 24659;
public static final int NULL_24665 = 24665;
public static final int NULL_24667 = 24667;
public static final int NULL_24669 = 24669;
public static final int NULL_24671 = 24671;
/* This file is automatically generated. Do not edit. */
}
@@ -18335,5 +18335,7 @@ public final class NullObjectID
public static final int NULL_37958 = 37958;
public static final int NULL_37960 = 37960;
public static final int NULL_37962 = 37962;
public static final int NULL_37976 = 37976;
public static final int NULL_37977 = 37977;
/* This file is automatically generated. Do not edit. */
}
@@ -19628,5 +19628,6 @@ public final class ObjectID
public static final int TREE_37973 = 37973;
public static final int TREE_37974 = 37974;
public static final int TREE_37975 = 37975;
public static final int MASSIVE_STORAGE_UNIT = 37978;
/* This file is automatically generated. Do not edit. */
}
@@ -71,6 +71,8 @@ public interface Callbacks
*/
void drawAboveOverheads();
void drawAfterWidgets();
/**
* Client top-most draw method, rendering over top of most of game interfaces.
*
@@ -24,7 +24,6 @@
*/
package net.runelite.client.callback;
import com.google.inject.Injector;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
@@ -40,15 +39,12 @@ import java.awt.image.VolatileImage;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.BufferProvider;
import net.runelite.api.Client;
import net.runelite.api.Entity;
import net.runelite.api.MainBufferProvider;
import net.runelite.api.NullItemID;
import net.runelite.api.RenderOverview;
import net.runelite.api.Skill;
import net.runelite.api.WorldMapManager;
import net.runelite.api.events.BeforeMenuRender;
import net.runelite.api.events.BeforeRender;
import net.runelite.api.events.Event;
import net.runelite.api.events.FakeXpDrop;
@@ -56,12 +52,10 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.hooks.Callbacks;
import net.runelite.api.hooks.DrawCallbacks;
import net.runelite.api.widgets.Widget;
import static net.runelite.api.widgets.WidgetInfo.WORLD_MAP_VIEW;
import net.runelite.api.widgets.WidgetItem;
import net.runelite.client.Notifier;
import net.runelite.client.RuneLite;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.events.DrawFinished;
@@ -89,11 +83,6 @@ public class Hooks implements Callbacks
{
private static final long CHECK = RSTimeUnit.GAME_TICKS.getDuration().toNanos(); // ns - how often to run checks
private static final Injector injector = RuneLite.getInjector();
private static final Client client = injector.getInstance(Client.class);
public static final OverlayRenderer renderer = injector.getInstance(OverlayRenderer.class);
private static final OverlayManager overlayManager = injector.getInstance(OverlayManager.class);
private static final GameTick GAME_TICK = GameTick.INSTANCE;
private static final BeforeRender BEFORE_RENDER = BeforeRender.INSTANCE;
private static final DrawFinished drawFinishedEvent = new DrawFinished();
@@ -102,6 +91,14 @@ public class Hooks implements Callbacks
private int mouseY = 0;
private final Image cursor = ImageUtil.getResourceStreamFromClass(Hooks.class, "cursor.png");
@Inject
private Client client;
@Inject
private OverlayRenderer renderer;
@Inject
private OverlayManager overlayManager;
@Inject
private EventBus eventBus;
@@ -150,6 +147,7 @@ public class Hooks implements Callbacks
/**
* Get the Graphics2D for the MainBufferProvider image
* This caches the Graphics2D instance so it can be reused
*
* @param mainBufferProvider
* @return
*/
@@ -414,7 +412,7 @@ public class Hooks implements Callbacks
try
{
renderer.render((Graphics2D)finalImage.getGraphics(), OverlayLayer.AFTER_MIRROR);
renderer.render((Graphics2D) finalImage.getGraphics(), OverlayLayer.AFTER_MIRROR);
}
catch (Exception ex)
{
@@ -475,7 +473,8 @@ public class Hooks implements Callbacks
}
}
public static void drawAfterWidgets()
@Override
public void drawAfterWidgets()
{
MainBufferProvider bufferProvider = (MainBufferProvider) client.getBufferProvider();
Graphics2D graphics2d = getGraphics(bufferProvider);
@@ -530,38 +529,6 @@ public class Hooks implements Callbacks
deferredEventBus.replay();
}
public static void renderDraw(Entity entity, int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int x, int y, int z, long hash)
{
DrawCallbacks drawCallbacks = client.getDrawCallbacks();
if (drawCallbacks != null)
{
drawCallbacks.draw(entity, orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash);
}
else
{
entity.draw(orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash);
}
}
public static void clearColorBuffer(int x, int y, int width, int height, int color)
{
BufferProvider bp = client.getBufferProvider();
int canvasWidth = bp.getWidth();
int[] pixels = bp.getPixels();
int pixelPos = y * canvasWidth + x;
int pixelJump = canvasWidth - width;
for (int cy = y; cy < y + height; cy++)
{
for (int cx = x; cx < x + width; cx++)
{
pixels[pixelPos++] = 0;
}
pixelPos += pixelJump;
}
}
@Override
public void drawItem(int itemId, WidgetItem widgetItem)
{
@@ -572,13 +539,6 @@ public class Hooks implements Callbacks
}
}
public static boolean drawMenu()
{
BeforeMenuRender event = new BeforeMenuRender();
client.getCallbacks().post(BeforeMenuRender.class, event);
return event.isConsumed();
}
public void onScriptCallbackEvent(ScriptCallbackEvent scriptCallbackEvent)
{
if (!scriptCallbackEvent.getEventName().equals("fakeXpDrop"))
@@ -9764,5 +9764,11 @@
24638,
24641,
24644
],
"massive storage unit": [
24660,
24661,
24662,
24663
]
}