Merge pull request #2488 from kyle-escobar/upstream-4-7-2020

upstream: merge
This commit is contained in:
Kyle
2020-04-08 02:53:59 +01:00
committed by GitHub
9 changed files with 71 additions and 127 deletions

View File

@@ -1,36 +0,0 @@
/*
* Copyright (c) 2017, 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.item;
import lombok.Data;
@Data
public class Item
{
private int id;
private String name;
private String description;
private ItemType type;
}

View File

@@ -35,6 +35,7 @@ import java.io.InputStreamReader;
import java.util.Arrays;
import javax.imageio.ImageIO;
import javax.inject.Inject;
import javax.naming.directory.SearchResult;
import net.runelite.http.api.RuneLiteAPI;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;

View File

@@ -1,42 +0,0 @@
/*
* Copyright (c) 2017, 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.item;
import java.util.List;
public class SearchResult
{
private List<Item> items;
public List<Item> getItems()
{
return items;
}
public void setItems(List<Item> items)
{
this.items = items;
}
}

View File

@@ -26,18 +26,6 @@ package net.runelite.api;
public final class ScriptID
{
/**
* Handles zoom input
*
* Updates the VarClientInts (73, 74) to this same value
* <ul>
* <li> int Reset zoom position </li>
* <li> int Reset zoom position </li>
* </ul>
*/
@ScriptArguments(integer = 2)
public static final int CAMERA_DO_ZOOM = 42;
/**
* Updates the scrollbar handle and container to the new height of the content container
* <ul>
@@ -59,6 +47,12 @@ public final class ScriptID
@ScriptArguments(integer = 1, string = 1)
public static final int CHATBOX_INPUT = 96;
/**
* Rebuilds the chatbox
*/
@ScriptArguments()
public static final int BUILD_CHATBOX = 216;
/**
* Opens the Private Message chat interface
*
@@ -70,12 +64,6 @@ public final class ScriptID
@ScriptArguments(string = 1)
public static final int OPEN_PRIVATE_MESSAGE_INTERFACE = 107;
/**
* Rebuilds the chatbox
*/
@ScriptArguments()
public static final int BUILD_CHATBOX = 216;
/**
* Rebuilds the text input widget inside the chat interface
* <ul>
@@ -85,12 +73,6 @@ public final class ScriptID
@ScriptArguments(string = 1)
public static final int CHAT_TEXT_INPUT_REBUILD = 222;
/**
* Builds the chatbox input widget
*/
@ScriptArguments()
public static final int CHAT_PROMPT_INIT = 223;
/**
* Closes the chatbox input
* <ul>
@@ -127,6 +109,12 @@ public final class ScriptID
@ScriptArguments(integer = 20)
public static final int BANK_PIN_OP = 685;
/**
* Builds the chatbox input widget
*/
@ScriptArguments()
public static final int CHAT_PROMPT_INIT = 223;
/**
* Checks the state of the given stash unit.
* <ul>
@@ -135,7 +123,7 @@ public final class ScriptID
* <li>int Bitpacked stash unit states 2</li>
* <li>int Bitpacked stash unit states 3</li>
* </ul>
* <p>
*
* Returns a pair of booleans indicating if the stash unit is built and if it is filled
*/
@ScriptArguments(integer = 4)
@@ -152,19 +140,8 @@ public final class ScriptID
public static final int DEATH_KEEP_ITEM_EXAMINE = 1603;
/**
* Creates a disabled experience drop
*
* <ul>
* <li>int (Skill ordinal) Sets what icon to use</li>
* <li>int Amount of exp to drop</li>
* </ul>
*/
@ScriptArguments(integer = 2)
public static final int XPDROP_DISABLED = 2091;
/**
* <ul>
* Queries the completion state of a quest by its struct id
* <ul>
* <li> int (struct) The id of the quest
* </ul>
* Returns
@@ -185,6 +162,18 @@ public final class ScriptID
@ScriptArguments(integer = 2)
public static final int DIARY_QUEST_UPDATE_LINECOUNT = 2523;
/**
* Handles zoom input
*
* Updates the VarClientInts (73, 74) to this same value
* <ul>
* <li> int Reset zoom position </li>
* <li> int Reset zoom position </li>
* </ul>
*/
@ScriptArguments(integer = 2)
public static final int CAMERA_DO_ZOOM = 42;
/**
* Rebuilds the Spellbook
*/
@@ -206,6 +195,17 @@ public final class ScriptID
@ScriptArguments(string = 2)
public static final int PRIVMSG = 10004;
/**
* Creates a disabled experience drop
*
* <ul>
* <li>int (Skill ordinal) Sets what icon to use</li>
* <li>int Amount of exp to drop</li>
* </ul>
*/
@ScriptArguments(integer = 2)
public static final int XPDROP_DISABLED = 2091;
/**
* Join a clan, duh
*/
@@ -309,4 +309,3 @@ public final class ScriptID
@ScriptArguments(integer = 7)
public static final int IGNORE_UPDATE = 630;
}

View File

@@ -52,6 +52,12 @@ public enum VarClientInt
*/
INPUT_TYPE(5),
/**
* The game sets this to the same value as {@link #CAMERA_ZOOM_RESIZABLE_VIEWPORT}
*/
CAMERA_ZOOM_FIXED_VIEWPORT(73),
CAMERA_ZOOM_RESIZABLE_VIEWPORT(74),
MEMBERSHIP_STATUS(103),
/**

View File

@@ -435,12 +435,12 @@ public enum Varbits
DAILY_ESSENCE_COLLECTED(4547),
DAILY_RUNES_COLLECTED(4540),
DAILY_SAND_COLLECTED(4549),
DAILY_ARROWS_STATE(4563),
DAILY_FLAX_STATE(4559),
DAILY_ARROWS_STATE(4563),
/**
* This varbit tracks how much bonemeal has been redeemed from Robin
* The player gets 13 for each diary completed above and including Medium, for a maxiumum of 39
*/
*/
DAILY_BONEMEAL_STATE(4543),
DAILY_DYNAMITE_COLLECTED(7939),
@@ -746,6 +746,22 @@ public enum Varbits
/**
* Starts at 100, counts down every 10 ticks (6 seconds)
*/
TWISTED_LEAGUE_RELIC_1(10049),
TWISTED_LEAGUE_RELIC_2(10050),
TWISTED_LEAGUE_RELIC_3(10051),
TWISTED_LEAGUE_RELIC_4(10052),
TWISTED_LEAGUE_RELIC_5(10053),
/**
* Whether the Special Attack orb is disabled due to being in a PvP area
*
* 0 = Enabled (player is not in PvP)
* 1 = Disabled (player in in PvP)
*
* @see <a href="https://oldschool.runescape.wiki/w/Minimap#Special_attack_orb">The OSRS Wiki's Minimap page</a>
*/
PVP_SPEC_ORB(8121),
LMS_POISON_PROGRESS(5317),
/**
@@ -787,7 +803,6 @@ public enum Varbits
EMOTES_TAB_HOTKEY(4687),
CLAN_TAB_HOTKEY(4683),
MUSIC_TAB_HOTKEY(4688);
/**
* The raw varbit ID.
*/

View File

@@ -1321,6 +1321,7 @@ public class WidgetID
static class Options
{
static final int CAMERA_ZOOM_SLIDER_HANDLE = 15;
static final int MUSIC_SLIDER = 37;
static final int SOUND_EFFECT_SLIDER = 43;
static final int AREA_SOUND_SLIDER = 49;

View File

@@ -592,7 +592,6 @@ public enum WidgetInfo
FOSSIL_MUSHROOM_MEADOW(WidgetID.FOSSIL_ISLAND_MUSHROOM_TELE_GROUP_ID, WidgetID.FossilMushroomTeleport.MUSHROOM_MEADOW),
MINIGAME_TELEPORT_BUTTON(WidgetID.MINIGAME_TAB_ID, WidgetID.Minigames.TELEPORT_BUTTON),
PVP_FOG_OVERLAY(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.FOG_OVERLAY),
PVP_CONTAINER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.PVP_WIDGET_CONTAINER),
@@ -871,14 +870,13 @@ public enum WidgetInfo
SEED_VAULT_ITEM_CONTAINER(WidgetID.SEED_VAULT_GROUP_ID, WidgetID.SeedVault.ITEM_CONTAINER),
SEED_VAULT_ITEM_TEXT(WidgetID.SEED_VAULT_GROUP_ID, WidgetID.SeedVault.ITEM_TEXT),
SEED_VAULT_INVENTORY_ITEMS_CONTAINER(WidgetID.SEED_VAULT_INVENTORY_GROUP_ID, WidgetID.SeedVault.INVENTORY_ITEM_CONTAINER),
JEWELLERY_BOX_DUEL_RING(WidgetID.JEWELLERY_BOX_GROUP_ID, WidgetID.JewelBox.DUEL_RING),
JEWELLERY_BOX_GAME_NECK(WidgetID.JEWELLERY_BOX_GROUP_ID, WidgetID.JewelBox.GAME_NECK),
JEWELLERY_BOX_COMB_BRAC(WidgetID.JEWELLERY_BOX_GROUP_ID, WidgetID.JewelBox.COMB_BRAC),
JEWELLERY_BOX_SKIL_NECK(WidgetID.JEWELLERY_BOX_GROUP_ID, WidgetID.JewelBox.SKIL_NECK),
JEWELLERY_BOX_RING_OFGP(WidgetID.JEWELLERY_BOX_GROUP_ID, WidgetID.JewelBox.RING_OFGP),
JEWELLERY_BOX_AMUL_GLOR(WidgetID.JEWELLERY_BOX_GROUP_ID, WidgetID.JewelBox.AMUL_GLOR),
OPTIONS_CAMERA_ZOOM_SLIDER_HANDLE(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.CAMERA_ZOOM_SLIDER_HANDLE),
OPTIONS_MUSIC_SLIDER(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.MUSIC_SLIDER),
OPTIONS_SOUND_EFFECT_SLIDER(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.SOUND_EFFECT_SLIDER),
OPTIONS_AREA_SOUND_SLIDER(WidgetID.OPTIONS_GROUP_ID, WidgetID.Options.AREA_SOUND_SLIDER),

View File

@@ -42,7 +42,6 @@ import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.BufferProvider;
import net.runelite.api.Client;
import net.runelite.api.Constants;
import net.runelite.api.Entity;
import net.runelite.api.MainBufferProvider;
import net.runelite.api.NullItemID;
@@ -75,6 +74,7 @@ import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.OverlayRenderer;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.client.util.DeferredEventBus;
import net.runelite.client.util.RSTimeUnit;
/**
* This class contains field required for mixins and runelite hooks to work.
@@ -85,13 +85,16 @@ import net.runelite.client.util.DeferredEventBus;
@Slf4j
public class Hooks implements Callbacks
{
private static final long CHECK = Constants.GAME_TICK_LENGTH; // ms - how often to run checks
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);
private 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;
@Inject
private EventBus eventBus;
@@ -139,7 +142,6 @@ 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
*/
@@ -190,7 +192,7 @@ public class Hooks implements Callbacks
clientThread.invoke();
long now = System.currentTimeMillis();
long now = System.nanoTime();
if (now - lastCheck < CHECK)
{