Disable zoom extender when a cache overlay fails to load
The zoom extender relies on multiple scripts to be up to date. If only one is changed, its functionality breaks badly.
This commit is contained in:
@@ -43,6 +43,7 @@ import joptsimple.OptionParser;
|
||||
import joptsimple.OptionSet;
|
||||
import joptsimple.util.EnumConverter;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.account.SessionManager;
|
||||
@@ -145,6 +146,10 @@ public class RuneLite
|
||||
@Nullable
|
||||
private Client client;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private boolean overlayOutdated;
|
||||
|
||||
public static void main(String[] args) throws Exception
|
||||
{
|
||||
Locale.setDefault(Locale.ENGLISH);
|
||||
|
||||
@@ -42,6 +42,7 @@ import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.IndexDataBase;
|
||||
import net.runelite.api.MainBufferProvider;
|
||||
import net.runelite.api.RenderOverview;
|
||||
import net.runelite.api.WorldMapManager;
|
||||
@@ -274,6 +275,13 @@ public class Hooks implements Callbacks
|
||||
keyManager.processKeyTyped(keyEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void overlayLoadFailed(IndexDataBase indexDataBase, int archiveId, int fileId)
|
||||
{
|
||||
RuneLite runeLite = injector.getInstance(RuneLite.class);
|
||||
runeLite.setOverlayOutdated(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(MainBufferProvider mainBufferProvider, Graphics graphics, int x, int y)
|
||||
{
|
||||
|
||||
@@ -32,6 +32,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -45,6 +46,9 @@ import net.runelite.client.plugins.PluginDescriptor;
|
||||
@Slf4j
|
||||
public class ZoomPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private RuneLite runeLite;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@@ -60,6 +64,13 @@ public class ZoomPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onScriptEvent(ScriptCallbackEvent event)
|
||||
{
|
||||
if (runeLite.isOverlayOutdated())
|
||||
{
|
||||
// if any cache overlay fails to load then assume at least one of the zoom scripts is outdated
|
||||
// and prevent zoom extending entirely.
|
||||
return;
|
||||
}
|
||||
|
||||
int[] intStack = client.getIntStack();
|
||||
int intStackSize = client.getIntStackSize();
|
||||
if (zoomConfig.outerLimit())
|
||||
|
||||
Reference in New Issue
Block a user