Merge branch 'master' of https://github.com/runelite/runelite into upstream-4-7-2020

 Conflicts:
	http-api/src/main/java/net/runelite/http/api/item/ItemClient.java
	http-service/src/main/java/net/runelite/http/service/item/ItemController.java
	http-service/src/main/java/net/runelite/http/service/item/ItemEntry.java
	http-service/src/main/java/net/runelite/http/service/item/ItemService.java
	http-service/src/main/java/net/runelite/http/service/item/RSItem.java
	http-service/src/main/java/net/runelite/http/service/item/RSItemResponse.java
	runelite-api/src/main/java/net/runelite/api/ScriptID.java
	runelite-api/src/main/java/net/runelite/api/Varbits.java
	runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java
	runelite-client/src/main/java/net/runelite/client/callback/Hooks.java
	runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragConfig.java
	runelite-client/src/main/java/net/runelite/client/plugins/antidrag/AntiDragPlugin.java
	runelite-client/src/main/java/net/runelite/client/plugins/camera/CameraPlugin.java
	runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java
	runelite-client/src/main/java/net/runelite/client/plugins/config/PluginHubPanel.java
	runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/BookPanel.java
	runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryConfig.java
	runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPanel.java
	runelite-client/src/main/java/net/runelite/client/plugins/kourendlibrary/KourendLibraryPlugin.java
	runelite-client/src/main/java/net/runelite/client/plugins/music/MusicPlugin.java
	runelite-client/src/main/java/net/runelite/client/plugins/party/PartyPlugin.java
	runelite-client/src/main/java/net/runelite/client/plugins/worldhopper/WorldHopperPlugin.java
This commit is contained in:
kyle-escobar
2020-04-07 21:16:50 -04:00
10 changed files with 166 additions and 93 deletions

View File

@@ -42,11 +42,11 @@ 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;
import net.runelite.api.RenderOverview;
import net.runelite.api.Renderable;
import net.runelite.api.Skill;
import net.runelite.api.WorldMapManager;
import net.runelite.api.events.BeforeMenuRender;
@@ -65,6 +65,7 @@ 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.eventbus.Subscribe;
import net.runelite.client.input.KeyManager;
import net.runelite.client.input.MouseManager;
import net.runelite.client.task.Scheduler;
@@ -75,6 +76,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 +87,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 = new GameTick();
private static final BeforeRender BEFORE_RENDER = new BeforeRender();
@Inject
private EventBus eventBus;
@@ -139,7 +144,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 +194,7 @@ public class Hooks implements Callbacks
clientThread.invoke();
long now = System.currentTimeMillis();
long now = System.nanoTime();
if (now - lastCheck < CHECK)
{

View File

@@ -0,0 +1,74 @@
/*
* Copyright (c) 2020, Sean Dewar <https://github.com/seandewar>
* 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.camera;
import java.awt.Dimension;
import java.awt.Graphics2D;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.Point;
import net.runelite.api.VarClientInt;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.tooltip.Tooltip;
import net.runelite.client.ui.overlay.tooltip.TooltipManager;
class CameraOverlay extends Overlay
{
private final CameraConfig config;
private final Client client;
private final TooltipManager tooltipManager;
@Inject
private CameraOverlay(final CameraConfig config, final Client client, final TooltipManager tooltipManager)
{
this.config = config;
this.client = client;
this.tooltipManager = tooltipManager;
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_WIDGETS);
}
@Override
public Dimension render(final Graphics2D graphics)
{
final Widget slider = client.getWidget(WidgetInfo.OPTIONS_CAMERA_ZOOM_SLIDER_HANDLE);
final Point mousePos = client.getMouseCanvasPosition();
if (slider == null || slider.isHidden() || !slider.getBounds().contains(mousePos.getX(), mousePos.getY()))
{
return null;
}
final int value = client.getVar(VarClientInt.CAMERA_ZOOM_RESIZABLE_VIEWPORT);
final int max = config.innerLimit() ? config.INNER_ZOOM_LIMIT : CameraPlugin.DEFAULT_INNER_ZOOM_LIMIT;
tooltipManager.add(new Tooltip("Camera Zoom: " + value + " / " + max));
return null;
}
}