Merge branch 'master' into rebasetob
This commit is contained in:
@@ -192,9 +192,9 @@ public class Notifier
|
||||
case SOLID_UNTIL_CANCELLED:
|
||||
case FLASH_UNTIL_CANCELLED:
|
||||
// Any interaction with the client since the notification started will cancel it after the minimum duration
|
||||
if (client.getMouseIdleTicks() < MINIMUM_FLASH_DURATION_TICKS
|
||||
if ((client.getMouseIdleTicks() < MINIMUM_FLASH_DURATION_TICKS
|
||||
|| client.getKeyboardIdleTicks() < MINIMUM_FLASH_DURATION_TICKS
|
||||
|| client.getMouseLastPressedMillis() > mouseLastPressedMillis)
|
||||
|| client.getMouseLastPressedMillis() > mouseLastPressedMillis) && clientUI.isFocused())
|
||||
{
|
||||
flashStart = null;
|
||||
}
|
||||
@@ -316,7 +316,7 @@ public class Notifier
|
||||
|
||||
private static Process sendCommand(final List<String> commands) throws IOException
|
||||
{
|
||||
return new ProcessBuilder(commands.toArray(new String[commands.size()]))
|
||||
return new ProcessBuilder(commands.toArray(new String[0]))
|
||||
.redirectErrorStream(true)
|
||||
.start();
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.client.account.SessionManager;
|
||||
import net.runelite.client.callback.Hooks;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
@@ -61,6 +62,7 @@ import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.game.ClanManager;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.game.LootManager;
|
||||
import net.runelite.client.game.PlayerManager;
|
||||
import net.runelite.client.game.XpDropManager;
|
||||
import net.runelite.client.game.chatbox.ChatboxPanelManager;
|
||||
import net.runelite.client.graphics.ModelOutlineRenderer;
|
||||
@@ -86,6 +88,7 @@ import org.slf4j.LoggerFactory;
|
||||
public class RuneLite
|
||||
{
|
||||
public static final File RUNELITE_DIR = new File(System.getProperty("user.home"), ".runelite");
|
||||
public static final File CACHE_DIR = new File(RUNELITE_DIR, "cache");
|
||||
public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles");
|
||||
public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins");
|
||||
public static final File SCREENSHOT_DIR = new File(RUNELITE_DIR, "screenshots");
|
||||
@@ -156,6 +159,9 @@ public class RuneLite
|
||||
@Inject
|
||||
private Provider<XpDropManager> xpDropManager;
|
||||
|
||||
@Inject
|
||||
private Provider<PlayerManager> playerManager;
|
||||
|
||||
@Inject
|
||||
private Provider<ChatboxPanelManager> chatboxPanelManager;
|
||||
|
||||
@@ -236,7 +242,7 @@ public class RuneLite
|
||||
|
||||
Authenticator.setDefault(new Authenticator()
|
||||
{
|
||||
private PasswordAuthentication auth = new PasswordAuthentication(user, pass);
|
||||
private final PasswordAuthentication auth = new PasswordAuthentication(user, pass);
|
||||
|
||||
protected PasswordAuthentication getPasswordAuthentication()
|
||||
{
|
||||
@@ -288,8 +294,6 @@ public class RuneLite
|
||||
RuneLiteSplashScreen.setError("Error while loading!", "Please check your internet connection and your DNS settings.");
|
||||
});
|
||||
|
||||
RuneLiteSplashScreen.stage(0, "Starting OpenOSRS injector");
|
||||
|
||||
PROFILES_DIR.mkdirs();
|
||||
|
||||
final long start = System.currentTimeMillis();
|
||||
@@ -306,7 +310,7 @@ public class RuneLite
|
||||
log.info("Client initialization took {}ms. Uptime: {}ms", end - start, uptime);
|
||||
}
|
||||
|
||||
public void start() throws Exception
|
||||
private void start() throws Exception
|
||||
{
|
||||
// Load RuneLite or Vanilla client
|
||||
final boolean isOutdated = client == null;
|
||||
@@ -364,9 +368,11 @@ public class RuneLite
|
||||
commandManager.get();
|
||||
lootManager.get();
|
||||
xpDropManager.get();
|
||||
playerManager.get();
|
||||
chatboxPanelManager.get();
|
||||
|
||||
eventBus.subscribe(GameStateChanged.class, this, hooks::onGameStateChanged);
|
||||
eventBus.subscribe(ScriptCallbackEvent.class, this, hooks::onScriptCallbackEvent);
|
||||
|
||||
// Add core overlays
|
||||
WidgetOverlay.createOverlays(client).forEach(overlayManager::add);
|
||||
|
||||
@@ -41,8 +41,8 @@ import net.runelite.client.callback.Hooks;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.config.ChatColorConfig;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.RuneLiteConfig;
|
||||
import net.runelite.client.config.OpenOSRSConfig;
|
||||
import net.runelite.client.config.RuneLiteConfig;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.menus.MenuManager;
|
||||
@@ -75,7 +75,7 @@ public class RuneLiteModule extends AbstractModule
|
||||
bindConstant().annotatedWith(Names.named("developerMode")).to(developerMode);
|
||||
bind(ScheduledExecutorService.class).toInstance(new ExecutorServiceExceptionLogger(Executors.newSingleThreadScheduledExecutor()));
|
||||
bind(OkHttpClient.class).toInstance(RuneLiteAPI.CLIENT.newBuilder()
|
||||
.cache(new Cache(new File(RuneLite.RUNELITE_DIR, "cache" + File.separator + "okhttp"), MAX_OKHTTP_CACHE_SIZE))
|
||||
.cache(new Cache(new File(RuneLite.CACHE_DIR, "okhttp"), MAX_OKHTTP_CACHE_SIZE))
|
||||
.build());
|
||||
bind(MenuManager.class);
|
||||
bind(ChatMessageManager.class);
|
||||
|
||||
@@ -29,6 +29,7 @@ import java.util.Iterator;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.function.BooleanSupplier;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
@@ -41,6 +42,7 @@ public class ClientThread implements Executor
|
||||
private final ConcurrentLinkedQueue<BooleanSupplier> invokes = new ConcurrentLinkedQueue<>();
|
||||
|
||||
@Inject
|
||||
@Nullable
|
||||
private Client client;
|
||||
|
||||
public void invoke(Runnable r)
|
||||
|
||||
@@ -47,12 +47,15 @@ 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;
|
||||
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;
|
||||
@@ -136,6 +139,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
|
||||
*/
|
||||
@@ -156,13 +160,13 @@ public class Hooks implements Callbacks
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void post(Class<T> eventClass, Event event)
|
||||
public <T extends Event, E extends T> void post(Class<T> eventClass, E event)
|
||||
{
|
||||
eventBus.post(eventClass, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void postDeferred(Class<T> eventClass, Event event)
|
||||
public <T extends Event, E extends T> void postDeferred(Class<T> eventClass, E event)
|
||||
{
|
||||
deferredEventBus.post(eventClass, event);
|
||||
}
|
||||
@@ -544,4 +548,25 @@ public class Hooks implements Callbacks
|
||||
client.getCallbacks().post(BeforeMenuRender.class, event);
|
||||
return event.isConsumed();
|
||||
}
|
||||
|
||||
public void onScriptCallbackEvent(ScriptCallbackEvent scriptCallbackEvent)
|
||||
{
|
||||
if (!scriptCallbackEvent.getEventName().equals("fakeXpDrop"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final int[] intStack = client.getIntStack();
|
||||
final int intStackSize = client.getIntStackSize();
|
||||
|
||||
final int statId = intStack[intStackSize - 2];
|
||||
final int xp = intStack[intStackSize - 1];
|
||||
|
||||
Skill skill = Skill.values()[statId];
|
||||
FakeXpDrop fakeXpDrop = new FakeXpDrop(
|
||||
skill,
|
||||
xp
|
||||
);
|
||||
eventBus.post(FakeXpDrop.class, fakeXpDrop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,8 +25,8 @@
|
||||
package net.runelite.client.chat;
|
||||
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
public class ChatMessageBuilder
|
||||
{
|
||||
|
||||
@@ -46,13 +46,13 @@ import net.runelite.api.MessageNode;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.api.events.ResizeableChanged;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.config.ChatColorConfig;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.ui.JagexColors;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
|
||||
@@ -37,6 +37,4 @@ import java.lang.annotation.Target;
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@Documented
|
||||
public @interface Alpha
|
||||
{
|
||||
}
|
||||
public @interface Alpha {}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
package net.runelite.client.config;
|
||||
|
||||
public class Button
|
||||
{
|
||||
}
|
||||
public class Button {}
|
||||
|
||||
@@ -24,6 +24,4 @@
|
||||
*/
|
||||
package net.runelite.client.config;
|
||||
|
||||
public interface Config
|
||||
{
|
||||
}
|
||||
public interface Config {}
|
||||
|
||||
@@ -26,12 +26,11 @@ package net.runelite.client.config;
|
||||
|
||||
import com.google.common.cache.Cache;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Objects;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.util.ReflectUtil;
|
||||
|
||||
@Slf4j
|
||||
class ConfigInvocationHandler implements InvocationHandler
|
||||
@@ -169,12 +168,8 @@ class ConfigInvocationHandler implements InvocationHandler
|
||||
|
||||
static Object callDefaultMethod(Object proxy, Method method, Object[] args) throws Throwable
|
||||
{
|
||||
// Call the default method implementation - https://rmannibucau.wordpress.com/2014/03/27/java-8-default-interface-methods-and-jdk-dynamic-proxies/
|
||||
Constructor<MethodHandles.Lookup> constructor = MethodHandles.Lookup.class.getDeclaredConstructor(Class.class, int.class);
|
||||
constructor.setAccessible(true);
|
||||
|
||||
Class<?> declaringClass = method.getDeclaringClass();
|
||||
return constructor.newInstance(declaringClass, MethodHandles.Lookup.PUBLIC | MethodHandles.Lookup.PRIVATE)
|
||||
return ReflectUtil.privateLookupIn(declaringClass)
|
||||
.unreflectSpecial(method, declaringClass)
|
||||
.bindTo(proxy)
|
||||
.invokeWithArguments(args);
|
||||
|
||||
@@ -71,6 +71,7 @@ public @interface ConfigItem
|
||||
|
||||
/**
|
||||
* For Config items that have a value of multiple enums,
|
||||
*
|
||||
* @return the number of rows that are display in the item without having to scroll.
|
||||
*/
|
||||
int displayRows() default 2;
|
||||
@@ -82,6 +83,7 @@ public @interface ConfigItem
|
||||
/**
|
||||
* Use this to indicate the enum class that is going to be used in the multiple select config.
|
||||
* This implementation made debugging problems with multiple selects a lot easier
|
||||
*
|
||||
* @return The Enum that will be used for the multiple select
|
||||
*/
|
||||
Class<? extends Enum> enumClass() default Enum.class;
|
||||
|
||||
@@ -59,10 +59,10 @@ import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.RuneLite;
|
||||
import static net.runelite.client.RuneLite.PROFILES_DIR;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
package net.runelite.client.config;
|
||||
|
||||
public class Title
|
||||
{
|
||||
}
|
||||
public class Title {}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class DatabaseManager
|
||||
Settings settings = new Settings();
|
||||
settings.setExecuteLogging(false);
|
||||
|
||||
return DSL.using(connection, SQLDialect.H2, settings);
|
||||
return DSL.using(connection, SQLDialect.H2, settings);
|
||||
}
|
||||
|
||||
public boolean checkTableExists(String table)
|
||||
|
||||
@@ -2,10 +2,14 @@ package net.runelite.client.eventbus;
|
||||
|
||||
import com.jakewharton.rxrelay2.PublishRelay;
|
||||
import com.jakewharton.rxrelay2.Relay;
|
||||
import io.reactivex.ObservableTransformer;
|
||||
import io.reactivex.Scheduler;
|
||||
import io.reactivex.annotations.NonNull;
|
||||
import io.reactivex.annotations.Nullable;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import io.reactivex.schedulers.Schedulers;
|
||||
import io.sentry.Sentry;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -15,21 +19,25 @@ import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.events.Event;
|
||||
import net.runelite.client.RuneLiteProperties;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.config.OpenOSRSConfig;
|
||||
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class EventBus implements EventBusInterface
|
||||
{
|
||||
private Map<Object, Object> subscriptionList = new HashMap<>();
|
||||
private Map<Class<?>, Relay<Object>> subjectList = new HashMap<>();
|
||||
private Map<Object, CompositeDisposable> subscriptionsMap = new HashMap<>();
|
||||
private final Map<Object, Object> subscriptionList = new HashMap<>();
|
||||
private final Map<Class<?>, Relay<Object>> subjectList = new HashMap<>();
|
||||
private final Map<Object, CompositeDisposable> subscriptionsMap = new HashMap<>();
|
||||
|
||||
@Inject
|
||||
private OpenOSRSConfig openOSRSConfig;
|
||||
|
||||
@Inject
|
||||
private ClientThread clientThread;
|
||||
|
||||
@NonNull
|
||||
private <T> Relay<Object> getSubject(Class<T> eventClass)
|
||||
private <T extends Event> Relay<Object> getSubject(Class<T> eventClass)
|
||||
{
|
||||
return subjectList.computeIfAbsent(eventClass, k -> PublishRelay.create().toSerialized());
|
||||
}
|
||||
@@ -47,34 +55,65 @@ public class EventBus implements EventBusInterface
|
||||
return compositeDisposable;
|
||||
}
|
||||
|
||||
@Override
|
||||
// Subscribe on lifecycle (for example from plugin startUp -> shutdown)
|
||||
public <T> void subscribe(Class<T> eventClass, @NonNull Object lifecycle, @NonNull Consumer<T> action)
|
||||
private <T> ObservableTransformer<T, T> applyTake(int until)
|
||||
{
|
||||
if (subscriptionList.containsKey(lifecycle) && eventClass.equals(subscriptionList.get(lifecycle)))
|
||||
return observable -> until > 0 ? observable.take(until) : observable;
|
||||
}
|
||||
|
||||
private Scheduler getScheduler(EventScheduler scheduler)
|
||||
{
|
||||
Scheduler subscribeScheduler;
|
||||
switch (scheduler)
|
||||
{
|
||||
return;
|
||||
case COMPUTATION:
|
||||
subscribeScheduler = Schedulers.computation();
|
||||
break;
|
||||
case IO:
|
||||
subscribeScheduler = Schedulers.io();
|
||||
break;
|
||||
case NEWTHREAD:
|
||||
subscribeScheduler = Schedulers.newThread();
|
||||
break;
|
||||
case SINGLE:
|
||||
subscribeScheduler = Schedulers.single();
|
||||
break;
|
||||
case TRAMPOLINE:
|
||||
subscribeScheduler = Schedulers.trampoline();
|
||||
break;
|
||||
case CLIENT:
|
||||
subscribeScheduler = Schedulers.from(clientThread);
|
||||
break;
|
||||
case DEFAULT:
|
||||
default:
|
||||
subscribeScheduler = null;
|
||||
break;
|
||||
}
|
||||
|
||||
Disposable disposable = getSubject(eventClass)
|
||||
.filter(Objects::nonNull) // Filter out null objects, better safe than sorry
|
||||
.cast(eventClass) // Cast it for easier usage
|
||||
.subscribe(action, error ->
|
||||
{
|
||||
log.error("Exception in eventbus", error);
|
||||
return subscribeScheduler;
|
||||
}
|
||||
|
||||
if (RuneLiteProperties.getLauncherVersion() != null && openOSRSConfig.shareLogs())
|
||||
{
|
||||
Sentry.capture(error);
|
||||
}
|
||||
});
|
||||
private <T> ObservableTransformer<T, T> applyScheduler(EventScheduler eventScheduler, boolean subscribe)
|
||||
{
|
||||
Scheduler scheduler = getScheduler(eventScheduler);
|
||||
|
||||
getCompositeDisposable(lifecycle).add(disposable);
|
||||
subscriptionList.put(lifecycle, eventClass);
|
||||
return observable -> scheduler == null ? observable : subscribe ? observable.subscribeOn(scheduler) : observable.observeOn(scheduler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void subscribe(Class<T> eventClass, @NonNull Object lifecycle, @NonNull Consumer<T> action, int takeUntil)
|
||||
public <T extends Event> void subscribe(Class<T> eventClass, @NonNull Object lifecycle, @NonNull Consumer<T> action)
|
||||
{
|
||||
subscribe(eventClass, lifecycle, action, -1, EventScheduler.DEFAULT, EventScheduler.DEFAULT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends Event> void subscribe(Class<T> eventClass, @NonNull Object lifecycle, @NonNull Consumer<T> action, int takeUtil)
|
||||
{
|
||||
subscribe(eventClass, lifecycle, action, takeUtil, EventScheduler.DEFAULT, EventScheduler.DEFAULT);
|
||||
}
|
||||
|
||||
@Override
|
||||
// Subscribe on lifecycle (for example from plugin startUp -> shutdown)
|
||||
public <T extends Event> void subscribe(Class<T> eventClass, @NonNull Object lifecycle, @NonNull Consumer<T> action, int takeUntil, @Nullable EventScheduler subscribe, @Nullable EventScheduler observe)
|
||||
{
|
||||
if (subscriptionList.containsKey(lifecycle) && eventClass.equals(subscriptionList.get(lifecycle)))
|
||||
{
|
||||
@@ -82,10 +121,12 @@ public class EventBus implements EventBusInterface
|
||||
}
|
||||
|
||||
Disposable disposable = getSubject(eventClass)
|
||||
.compose(applyTake(takeUntil))
|
||||
.filter(Objects::nonNull) // Filter out null objects, better safe than sorry
|
||||
.cast(eventClass) // Cast it for easier usage
|
||||
.take(takeUntil)
|
||||
.doFinally(() -> unregister(lifecycle))
|
||||
.compose(applyScheduler(subscribe, true))
|
||||
.compose(applyScheduler(observe, false))
|
||||
.subscribe(action, error ->
|
||||
{
|
||||
log.error("Exception in eventbus", error);
|
||||
@@ -113,7 +154,7 @@ public class EventBus implements EventBusInterface
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> void post(Class<T> eventClass, @NonNull Event event)
|
||||
public <T extends Event> void post(Class<? extends T> eventClass, @NonNull T event)
|
||||
{
|
||||
getSubject(eventClass).accept(event);
|
||||
}
|
||||
|
||||
@@ -6,11 +6,13 @@ import net.runelite.api.events.Event;
|
||||
|
||||
public interface EventBusInterface
|
||||
{
|
||||
<T> void subscribe(Class<T> eventClass, @NonNull Object lifecycle, @NonNull Consumer<T> action);
|
||||
<T extends Event> void subscribe(Class<T> eventClass, @NonNull Object lifecycle, @NonNull Consumer<T> action);
|
||||
|
||||
<T> void subscribe(Class<T> eventClass, @NonNull Object lifecycle, @NonNull Consumer<T> action, int takeUntil);
|
||||
<T extends Event> void subscribe(Class<T> eventClass, @NonNull Object lifecycle, @NonNull Consumer<T> action, int takeUntil);
|
||||
|
||||
<T extends Event> void subscribe(Class<T> eventClass, @NonNull Object lifecycle, @NonNull Consumer<T> action, int takeUntil, EventScheduler subscribe, EventScheduler observe);
|
||||
|
||||
void unregister(@NonNull Object lifecycle);
|
||||
|
||||
<T> void post(Class<T> eventClass, @NonNull Event event);
|
||||
<T extends Event> void post(Class<? extends T> eventClass, @NonNull T event);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package net.runelite.client.eventbus;
|
||||
|
||||
import io.reactivex.annotations.Nullable;
|
||||
|
||||
public enum EventScheduler
|
||||
{
|
||||
DEFAULT(null),
|
||||
COMPUTATION("computation"),
|
||||
IO("io"),
|
||||
NEWTHREAD("newThread"),
|
||||
SINGLE("single"),
|
||||
TRAMPOLINE("trampoline"),
|
||||
CLIENT("client");
|
||||
|
||||
public final String scheduler;
|
||||
|
||||
EventScheduler(@Nullable String scheduler)
|
||||
{
|
||||
this.scheduler = scheduler;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2019, gazivodag <https://github.com/gazivodag>
|
||||
* Copyright (c) 2018, Abex
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -10,6 +10,7 @@
|
||||
* 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
|
||||
@@ -21,44 +22,23 @@
|
||||
* (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.eventbus;
|
||||
|
||||
package net.runelite.client.plugins.prayagainstplayer;
|
||||
|
||||
import net.runelite.api.Player;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Contains a player object
|
||||
* When they attacked me
|
||||
* And (in milliseconds) when to expire the overlay around them
|
||||
* Marks a method as an event subscriber.
|
||||
*/
|
||||
public class PlayerContainer
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.METHOD)
|
||||
@Documented
|
||||
public @interface Subscribe
|
||||
{
|
||||
|
||||
private final Player player;
|
||||
private final long whenTheyAttackedMe;
|
||||
private final int millisToExpireHighlight;
|
||||
|
||||
PlayerContainer(final Player player, final long whenTheyAttackedMe, final int millisToExpireHighlight)
|
||||
{
|
||||
this.player = player;
|
||||
this.whenTheyAttackedMe = whenTheyAttackedMe;
|
||||
this.millisToExpireHighlight = millisToExpireHighlight;
|
||||
}
|
||||
|
||||
//getters
|
||||
public Player getPlayer()
|
||||
{
|
||||
return player;
|
||||
}
|
||||
|
||||
long getWhenTheyAttackedMe()
|
||||
{
|
||||
return whenTheyAttackedMe;
|
||||
}
|
||||
|
||||
int getMillisToExpireHighlight()
|
||||
{
|
||||
return millisToExpireHighlight;
|
||||
}
|
||||
|
||||
int takeUntil() default -1;
|
||||
EventScheduler subscribe() default EventScheduler.DEFAULT;
|
||||
EventScheduler observe() default EventScheduler.DEFAULT;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package net.runelite.client.events;
|
||||
|
||||
import lombok.Value;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.events.Event;
|
||||
import net.runelite.client.game.AttackStyle;
|
||||
|
||||
/**
|
||||
* This will fire when {@link net.runelite.client.game.PlayerManager} detects
|
||||
* a change in the player appearance that resulted in the shifting of an attack style.
|
||||
* For example, ranged str went to 0, but melee str went to 108.
|
||||
*/
|
||||
@Value
|
||||
public class AttackStyleChanged implements Event
|
||||
{
|
||||
/**
|
||||
* The player that changed styles.
|
||||
*/
|
||||
private final Player player;
|
||||
|
||||
/**
|
||||
* Can be Unknown(nullable)
|
||||
*
|
||||
* @see net.runelite.client.game.AttackStyle
|
||||
*/
|
||||
private final AttackStyle oldStyle;
|
||||
|
||||
/**
|
||||
* Can be Unknown(nullable)
|
||||
*
|
||||
* @see net.runelite.client.game.AttackStyle
|
||||
*/
|
||||
private final AttackStyle newStyle;
|
||||
}
|
||||
@@ -35,7 +35,4 @@ import net.runelite.api.events.Event;
|
||||
* it has nothing to do with whether an account is being logged out.
|
||||
*/
|
||||
@Data
|
||||
public class SessionClose implements Event
|
||||
{
|
||||
|
||||
}
|
||||
public class SessionClose implements Event {}
|
||||
|
||||
@@ -35,7 +35,4 @@ import net.runelite.api.events.Event;
|
||||
* it has nothing to do with whether an account is being logged in.
|
||||
*/
|
||||
@Data
|
||||
public class SessionOpen implements Event
|
||||
{
|
||||
|
||||
}
|
||||
public class SessionOpen implements Event {}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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.client.events;
|
||||
|
||||
import lombok.Value;
|
||||
import net.runelite.api.events.Event;
|
||||
import net.runelite.http.api.worlds.WorldResult;
|
||||
|
||||
/**
|
||||
* Fired when the @{link net.runelite.client.game.WorldService} refreshes the world list
|
||||
*/
|
||||
@Value
|
||||
public class WorldsFetch implements Event
|
||||
{
|
||||
private final WorldResult worldResult;
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class Flexo extends Robot
|
||||
.getDefaultScreenDevice());
|
||||
}
|
||||
|
||||
private void init(GraphicsDevice screen) throws AWTException
|
||||
private void init(GraphicsDevice screen)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
@@ -26,18 +26,7 @@
|
||||
package net.runelite.client.game;
|
||||
|
||||
import lombok.Getter;
|
||||
import static net.runelite.api.NullObjectID.NULL_25337;
|
||||
import static net.runelite.api.NullObjectID.NULL_26371;
|
||||
import static net.runelite.api.NullObjectID.NULL_26375;
|
||||
import static net.runelite.api.NullObjectID.NULL_26884;
|
||||
import static net.runelite.api.NullObjectID.NULL_26886;
|
||||
import static net.runelite.api.NullObjectID.NULL_29868;
|
||||
import static net.runelite.api.NullObjectID.NULL_29869;
|
||||
import static net.runelite.api.NullObjectID.NULL_29870;
|
||||
import static net.runelite.api.NullObjectID.NULL_31823;
|
||||
import static net.runelite.api.NullObjectID.NULL_31849;
|
||||
import static net.runelite.api.NullObjectID.NULL_33327;
|
||||
import static net.runelite.api.NullObjectID.NULL_33328;
|
||||
import static net.runelite.api.NullObjectID.*;
|
||||
import static net.runelite.api.ObjectID.*;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
@@ -45,40 +34,40 @@ import net.runelite.api.coords.WorldPoint;
|
||||
public enum AgilityShortcut
|
||||
{
|
||||
GENERIC_SHORTCUT(1, "Shortcut", null,
|
||||
// Trollheim
|
||||
ROCKS_3790, ROCKS_3791,
|
||||
// Fremennik Slayer Cave
|
||||
STEPS_29993,
|
||||
// Fossil Island
|
||||
LADDER_30938, LADDER_30939, LADDER_30940, LADDER_30941, RUBBER_CAP_MUSHROOM,
|
||||
// Brimhaven dungeon
|
||||
CREVICE_30198,
|
||||
// Lumbridge
|
||||
STILE_12982,
|
||||
// Gu'Tanoth Bridge
|
||||
GAP, GAP_2831,
|
||||
// Lumbridge Swamp Caves
|
||||
STEPPING_STONE_5948, STEPPING_STONE_5949, ROCKS_6673,
|
||||
// Morytania Pirate Ship
|
||||
ROCK_16115,
|
||||
// Lumber Yard
|
||||
BROKEN_FENCE_2618,
|
||||
// McGrubor's Wood
|
||||
LOOSE_RAILING,
|
||||
// Underwater Area Fossil Island
|
||||
TUNNEL_30959, HOLE_30966, OBSTACLE, OBSTACLE_30767, OBSTACLE_30964, OBSTACLE_30962, PLANT_DOOR_30961,
|
||||
// Tree Gnome Village
|
||||
LOOSE_RAILING_2186,
|
||||
// Burgh de Rott
|
||||
LOW_FENCE,
|
||||
// Taverley
|
||||
STILE,
|
||||
// Asgarnian Ice Dungeon
|
||||
STEPS,
|
||||
// Fossil Island Wyvern Cave
|
||||
STAIRS_31485,
|
||||
// Trollweiss Mountain Cave
|
||||
ROCKY_HANDHOLDS, ROCKY_HANDHOLDS_19847),
|
||||
// Trollheim
|
||||
ROCKS_3790, ROCKS_3791,
|
||||
// Fremennik Slayer Cave
|
||||
STEPS_29993,
|
||||
// Fossil Island
|
||||
LADDER_30938, LADDER_30939, LADDER_30940, LADDER_30941, RUBBER_CAP_MUSHROOM,
|
||||
// Brimhaven dungeon
|
||||
CREVICE_30198,
|
||||
// Lumbridge
|
||||
STILE_12982,
|
||||
// Gu'Tanoth Bridge
|
||||
GAP, GAP_2831,
|
||||
// Lumbridge Swamp Caves
|
||||
STEPPING_STONE_5948, STEPPING_STONE_5949, ROCKS_6673,
|
||||
// Morytania Pirate Ship
|
||||
ROCK_16115,
|
||||
// Lumber Yard
|
||||
BROKEN_FENCE_2618,
|
||||
// McGrubor's Wood
|
||||
LOOSE_RAILING,
|
||||
// Underwater Area Fossil Island
|
||||
TUNNEL_30959, HOLE_30966, OBSTACLE, OBSTACLE_30767, OBSTACLE_30964, OBSTACLE_30962, PLANT_DOOR_30961,
|
||||
// Tree Gnome Village
|
||||
LOOSE_RAILING_2186,
|
||||
// Burgh de Rott
|
||||
LOW_FENCE,
|
||||
// Taverley
|
||||
STILE,
|
||||
// Asgarnian Ice Dungeon
|
||||
STEPS,
|
||||
// Fossil Island Wyvern Cave
|
||||
STAIRS_31485,
|
||||
// Trollweiss Mountain Cave
|
||||
ROCKY_HANDHOLDS, ROCKY_HANDHOLDS_19847),
|
||||
BRIMHAVEN_DUNGEON_MEDIUM_PIPE_RETURN(1, "Pipe Squeeze", null, new WorldPoint(2698, 9491, 0), PIPE_21727),
|
||||
BRIMHAVEN_DUNGEON_PIPE_RETURN(1, "Pipe Squeeze", null, new WorldPoint(2655, 9573, 0), PIPE_21728),
|
||||
BRIMHAVEN_DUNGEON_STEPPING_STONES_RETURN(1, "Pipe Squeeze", null, STEPPING_STONE_21739),
|
||||
@@ -206,7 +195,7 @@ public enum AgilityShortcut
|
||||
REVENANT_CAVES_ANKOU_EAST(75, "Jump", new WorldPoint(3201, 10195, 0), PILLAR_31561),
|
||||
REVENANT_CAVES_ANKOU_NORTH(75, "Jump", new WorldPoint(3180, 10209, 0), PILLAR_31561),
|
||||
ZUL_ANDRA_ISLAND_CROSSING(76, "Stepping Stone", new WorldPoint(2156, 3073, 0), STEPPING_STONE_10663),
|
||||
SHILO_VILLAGE_STEPPING_STONES( 77, "Stepping Stones", new WorldPoint(2863, 2974, 0), STEPPING_STONE_16466),
|
||||
SHILO_VILLAGE_STEPPING_STONES(77, "Stepping Stones", new WorldPoint(2863, 2974, 0), STEPPING_STONE_16466),
|
||||
IORWERTHS_DUNGEON_NORTHERN_SHORTCUT_EAST(78, "Tight Gap", new WorldPoint(3221, 12441, 0), TIGHT_GAP),
|
||||
IORWERTHS_DUNGEON_NORTHERN_SHORTCUT_WEST(78, "Tight Gap", new WorldPoint(3215, 12441, 0), TIGHT_GAP_36693),
|
||||
KHARAZI_JUNGLE_VINE_CLIMB(79, "Vine", new WorldPoint(2897, 2939, 0), NULL_26884, NULL_26886),
|
||||
|
||||
@@ -21,25 +21,23 @@
|
||||
* (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.hideunder;
|
||||
package net.runelite.client.game;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import java.awt.Color;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Prayer;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
class PlayerContainer
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum AttackStyle
|
||||
{
|
||||
private Player player;
|
||||
private boolean target;
|
||||
private int timer;
|
||||
MAGE("Mage", Color.CYAN, Prayer.PROTECT_FROM_MAGIC),
|
||||
RANGE("Range", Color.GREEN, Prayer.PROTECT_FROM_MISSILES),
|
||||
MELEE("Melee", Color.RED, Prayer.PROTECT_FROM_MELEE),
|
||||
UNKNOWN("Unknown", Color.WHITE, null);
|
||||
|
||||
PlayerContainer(Player player)
|
||||
{
|
||||
this.player = player;
|
||||
this.target = false;
|
||||
this.timer = 0;
|
||||
}
|
||||
}
|
||||
private String name;
|
||||
private Color color;
|
||||
private Prayer prayer;
|
||||
}
|
||||
@@ -45,9 +45,9 @@ import net.runelite.api.IndexedSprite;
|
||||
import net.runelite.api.SpriteID;
|
||||
import net.runelite.api.events.ClanChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.api.util.Text;
|
||||
|
||||
@Singleton
|
||||
public class ClanManager
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
package net.runelite.client.game;
|
||||
|
||||
import lombok.Value;
|
||||
|
||||
@Value
|
||||
public class CombatStats
|
||||
{
|
||||
private int magicAttack;
|
||||
private int magicDefence;
|
||||
private int magicStr;
|
||||
private int meleeAtkCrush;
|
||||
private int meleeAtkSlash;
|
||||
private int meleeAtkStab;
|
||||
private int meleeAttack;
|
||||
private int meleeDefCrush;
|
||||
private int meleeDefence;
|
||||
private int meleeDefSlash;
|
||||
private int meleeDefStab;
|
||||
private int meleeStr;
|
||||
private int rangeAttack;
|
||||
private int rangeDefence;
|
||||
private int rangeStr;
|
||||
private int speed;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ class HiscoreLoader extends CacheLoader<HiscoreManager.HiscoreKey, HiscoreResult
|
||||
}
|
||||
|
||||
@Override
|
||||
public HiscoreResult load(@NotNull HiscoreManager.HiscoreKey hiscoreKey) throws Exception
|
||||
public HiscoreResult load(@NotNull HiscoreManager.HiscoreKey hiscoreKey)
|
||||
{
|
||||
return EMPTY;
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ public class ItemManager
|
||||
return getRepairValue(itemId, false);
|
||||
}
|
||||
|
||||
public int getRepairValue(int itemId, boolean fullValue)
|
||||
private int getRepairValue(int itemId, boolean fullValue)
|
||||
{
|
||||
final ItemReclaimCost b = ItemReclaimCost.of(itemId);
|
||||
|
||||
|
||||
@@ -38,12 +38,12 @@ import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.AnimationID;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.TileItem;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NpcID;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.TileItem;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
|
||||
@@ -74,6 +74,7 @@ public class NPCStats
|
||||
|
||||
/**
|
||||
* Based off the formula found here: http://services.runescape.com/m=forum/c=PLuJ4cy6gtA/forums.ws?317,318,712,65587452,209,337584542#209
|
||||
*
|
||||
* @return bonus XP modifier
|
||||
*/
|
||||
public double calculateXpModifier()
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* (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.playerscouter;
|
||||
package net.runelite.client.game;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import lombok.AccessLevel;
|
||||
@@ -31,41 +31,73 @@ import lombok.ToString;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.http.api.hiscore.HiscoreResult;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString(exclude = "player")
|
||||
class PlayerContainer
|
||||
public class PlayerContainer
|
||||
{
|
||||
private AttackStyle attackStyle;
|
||||
private AttackStyle weakness;
|
||||
private HiscoreResult skills;
|
||||
private LinkedHashMap<Integer, Integer> gear;
|
||||
private LinkedHashMap<Integer, Integer> riskedGear;
|
||||
private MeleeStyle meleeStyle;
|
||||
private Player player;
|
||||
private String location;
|
||||
private String name;
|
||||
private String targetString;
|
||||
private CombatStats combatStats;
|
||||
private boolean httpRetry;
|
||||
private boolean scouted;
|
||||
private int prayer;
|
||||
private boolean attacking;
|
||||
private boolean friend;
|
||||
private boolean clan;
|
||||
private int hpLevel;
|
||||
private int potionBoost;
|
||||
private int prayerLevel;
|
||||
private int risk;
|
||||
private int scoutTimer;
|
||||
private int shield;
|
||||
private int timer;
|
||||
private int weapon;
|
||||
private int wildyLevel;
|
||||
|
||||
PlayerContainer(Player player)
|
||||
{
|
||||
this.attackStyle = AttackStyle.UNKNOWN;
|
||||
this.gear = new LinkedHashMap<>();
|
||||
this.httpRetry = false;
|
||||
this.hpLevel = 0;
|
||||
this.location = "N/A";
|
||||
this.meleeStyle = MeleeStyle.STAB;
|
||||
this.name = player.getName();
|
||||
this.player = player;
|
||||
this.prayer = -1;
|
||||
this.risk = 0;
|
||||
this.riskedGear = new LinkedHashMap<>();
|
||||
this.scoutTimer = 500;
|
||||
this.scouted = false;
|
||||
this.skills = null;
|
||||
this.targetString = "";
|
||||
this.weapon = 0;
|
||||
this.wildyLevel = 0;
|
||||
this.weakness = AttackStyle.UNKNOWN;
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
setMeleeStyle(MeleeStyle.NONE);
|
||||
if (getTimer() > 0)
|
||||
{
|
||||
setTimer(getTimer() - 1);
|
||||
if (getTimer() == 0)
|
||||
{
|
||||
setAttacking(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
enum MeleeStyle
|
||||
{
|
||||
CRUSH,
|
||||
SLASH,
|
||||
STAB,
|
||||
NONE
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,551 @@
|
||||
package net.runelite.client.game;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ItemDefinition;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.PlayerAppearanceChanged;
|
||||
import net.runelite.api.events.PlayerDespawned;
|
||||
import net.runelite.api.events.PlayerSpawned;
|
||||
import net.runelite.api.kit.KitType;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.EventScheduler;
|
||||
import net.runelite.client.events.AttackStyleChanged;
|
||||
import net.runelite.client.util.PvPUtil;
|
||||
import net.runelite.http.api.hiscore.HiscoreClient;
|
||||
import net.runelite.http.api.hiscore.HiscoreResult;
|
||||
import net.runelite.http.api.item.ItemEquipmentStats;
|
||||
import net.runelite.http.api.item.ItemStats;
|
||||
|
||||
@Singleton
|
||||
@Slf4j
|
||||
@SuppressWarnings("unused")
|
||||
public class PlayerManager
|
||||
{
|
||||
private static final HiscoreClient HISCORE_CLIENT = new HiscoreClient();
|
||||
private final Client client;
|
||||
private final ItemManager itemManager;
|
||||
private final EventBus eventBus;
|
||||
private final Map<String, PlayerContainer> playerMap = new ConcurrentHashMap<>();
|
||||
private final Map<String, HiscoreResult> resultCache = new ConcurrentHashMap<>();
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
|
||||
|
||||
@Inject
|
||||
PlayerManager(
|
||||
final Client client,
|
||||
final EventBus eventBus,
|
||||
final ItemManager itemManager
|
||||
)
|
||||
{
|
||||
this.client = client;
|
||||
this.itemManager = itemManager;
|
||||
this.eventBus = eventBus;
|
||||
eventBus.subscribe(PlayerDespawned.class, this, this::onPlayerDespawned);
|
||||
eventBus.subscribe(PlayerSpawned.class, this, this::onPlayerSpawned);
|
||||
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
|
||||
eventBus.subscribe(PlayerAppearanceChanged.class, this, this::onAppearenceChanged, -1, EventScheduler.DEFAULT, EventScheduler.COMPUTATION);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection of {@link PlayerContainer} that are attacking you, this can be empty.
|
||||
*/
|
||||
public Set<PlayerContainer> getAllAttackers()
|
||||
{
|
||||
final Set<PlayerContainer> set = new HashSet<>();
|
||||
for (PlayerContainer p : playerMap.values())
|
||||
{
|
||||
if (p.isAttacking())
|
||||
{
|
||||
set.add(p);
|
||||
}
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection of {@link PlayerContainer}, this can be empty.
|
||||
*/
|
||||
public Collection<PlayerContainer> getPlayerContainers()
|
||||
{
|
||||
return playerMap.values();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param name Players name.
|
||||
* @return {@link PlayerContainer} if provided with proper name, else null.
|
||||
*/
|
||||
@Nullable
|
||||
public PlayerContainer getPlayer(String name)
|
||||
{
|
||||
return playerMap.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param player Player object.
|
||||
* @return {@link PlayerContainer} if provided with proper name, else null.
|
||||
*/
|
||||
@Nullable
|
||||
public PlayerContainer getPlayer(Player player)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return playerMap.get(player.getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* This will keep submitting an http request until it successfully updates.
|
||||
*
|
||||
* @param name The player name you wish to update.
|
||||
*/
|
||||
public void updateStats(String name)
|
||||
{
|
||||
final PlayerContainer p = playerMap.get(name);
|
||||
|
||||
if (p == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateStats(p.getPlayer());
|
||||
}
|
||||
|
||||
/**
|
||||
* This will keep submitting an http request until it successfully updates.
|
||||
*
|
||||
* @param requestedPlayer The player object you wish to update.
|
||||
*/
|
||||
public void updateStats(Player requestedPlayer)
|
||||
{
|
||||
if (requestedPlayer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final PlayerContainer player = playerMap.get(requestedPlayer.getName());
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (resultCache.containsKey(player.getName()))
|
||||
{
|
||||
player.setSkills(resultCache.get(player.getName()));
|
||||
player.setPrayerLevel(player.getSkills().getPrayer().getLevel());
|
||||
player.setHpLevel(player.getSkills().getHitpoints().getLevel());
|
||||
return;
|
||||
}
|
||||
|
||||
executorService.submit(() ->
|
||||
{
|
||||
player.setHttpRetry(true);
|
||||
int timeout = 0;
|
||||
HiscoreResult result;
|
||||
do
|
||||
{
|
||||
try
|
||||
{
|
||||
result = HISCORE_CLIENT.lookup(player.getName());
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
if (timeout == 10)
|
||||
{
|
||||
log.error("HiScore Lookup timed out on: {}", player.getName());
|
||||
return;
|
||||
}
|
||||
result = null;
|
||||
timeout++;
|
||||
try
|
||||
{
|
||||
Thread.sleep(1000);
|
||||
}
|
||||
catch (InterruptedException ignored)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
while (result == null);
|
||||
|
||||
resultCache.put(player.getName(), result);
|
||||
player.setSkills(result);
|
||||
player.setPrayerLevel(player.getSkills().getPrayer().getLevel());
|
||||
player.setHpLevel(player.getSkills().getHitpoints().getLevel());
|
||||
player.setHttpRetry(false);
|
||||
});
|
||||
}
|
||||
|
||||
private void onAppearenceChanged(PlayerAppearanceChanged event)
|
||||
{
|
||||
final PlayerContainer player = playerMap.get(event.getPlayer().getName());
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
update(player);
|
||||
player.reset();
|
||||
player.setFriend(client.isFriended(player.getName(), false));
|
||||
player.setClan(client.isClanMember(player.getName()));
|
||||
}
|
||||
|
||||
private void onPlayerDespawned(PlayerDespawned event)
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
playerMap.remove(player.getName());
|
||||
}
|
||||
|
||||
private void onPlayerSpawned(PlayerSpawned event)
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
playerMap.put(player.getName(), new PlayerContainer(player));
|
||||
}
|
||||
|
||||
private void onAnimationChanged(AnimationChanged event)
|
||||
{
|
||||
final Actor actor = event.getActor();
|
||||
|
||||
if (actor.getInteracting() != client.getLocalPlayer() || !(actor instanceof Player) || actor.getAnimation() == -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final PlayerContainer player = playerMap.getOrDefault(actor.getName(), null);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getPlayer().getInteracting() != null &&
|
||||
player.getPlayer().getInteracting() == client.getLocalPlayer())
|
||||
{
|
||||
if (player.getSkills() == null)
|
||||
{
|
||||
updateStats(player.getPlayer());
|
||||
}
|
||||
|
||||
player.setAttacking(true);
|
||||
player.setTimer(8);
|
||||
}
|
||||
}
|
||||
|
||||
private void update(PlayerContainer player)
|
||||
{
|
||||
player.setRisk(0);
|
||||
updatePlayerGear(player);
|
||||
updateAttackStyle(player);
|
||||
updateWeakness(player);
|
||||
player.setLocation(WorldLocation.location(player.getPlayer().getWorldLocation()));
|
||||
player.setWildyLevel(PvPUtil.getWildernessLevelFrom(player.getPlayer().getWorldLocation()));
|
||||
player.setTargetString(targetStringBuilder(player));
|
||||
}
|
||||
|
||||
private void updatePlayerGear(PlayerContainer player)
|
||||
{
|
||||
final Map<Integer, Integer> prices = new HashMap<>();
|
||||
|
||||
if (player.getPlayer().getPlayerAppearance() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int magicAttack = 0,
|
||||
magicDefence = 0,
|
||||
magicStr = 0,
|
||||
meleeAtkCrush = 0,
|
||||
meleeAtkStab = 0,
|
||||
meleeAtkSlash = 0,
|
||||
meleeDefCrush = 0,
|
||||
meleeDefStab = 0,
|
||||
meleeDefSlash = 0,
|
||||
meleeStr = 0,
|
||||
rangeAttack = 0,
|
||||
rangeDefence = 0,
|
||||
rangeStr = 0,
|
||||
speed = 0;
|
||||
|
||||
for (KitType kitType : KitType.values())
|
||||
{
|
||||
if (kitType.equals(KitType.RING) || kitType.equals(KitType.AMMUNITION))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
final int id = player.getPlayer().getPlayerAppearance().getEquipmentId(kitType);
|
||||
|
||||
if (id == -1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (kitType.equals(KitType.WEAPON))
|
||||
{
|
||||
player.setWeapon(id);
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case ItemID.HEAVY_BALLISTA:
|
||||
case ItemID.HEAVY_BALLISTA_23630:
|
||||
case ItemID.LIGHT_BALLISTA:
|
||||
rangeStr += 150;
|
||||
break;
|
||||
case ItemID.MAPLE_LONGBOW:
|
||||
case ItemID.MAPLE_SHORTBOW:
|
||||
rangeStr += 31;
|
||||
break;
|
||||
case ItemID.MAGIC_SHORTBOW:
|
||||
case ItemID.MAGIC_SHORTBOW_20558:
|
||||
case ItemID.MAGIC_SHORTBOW_I:
|
||||
rangeStr += +55;
|
||||
break;
|
||||
case ItemID.DARK_BOW:
|
||||
case ItemID.DARK_BOW_12765:
|
||||
case ItemID.DARK_BOW_12766:
|
||||
case ItemID.DARK_BOW_12767:
|
||||
case ItemID.DARK_BOW_12768:
|
||||
case ItemID.DARK_BOW_20408:
|
||||
rangeStr += +60;
|
||||
break;
|
||||
case ItemID.RUNE_CROSSBOW:
|
||||
case ItemID.RUNE_CROSSBOW_23601:
|
||||
rangeStr += +117;
|
||||
break;
|
||||
case ItemID.DRAGON_CROSSBOW:
|
||||
case ItemID.ARMADYL_CROSSBOW:
|
||||
case ItemID.ARMADYL_CROSSBOW_23611:
|
||||
rangeStr += +122;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
final ItemStats item = itemManager.getItemStats(id, false);
|
||||
final ItemDefinition itemDefinition = itemManager.getItemDefinition(id);
|
||||
|
||||
if (item == null)
|
||||
{
|
||||
log.debug("Item is null: {}", id);
|
||||
continue;
|
||||
}
|
||||
|
||||
final ItemEquipmentStats stats = item.getEquipment();
|
||||
|
||||
speed += stats.getAspeed();
|
||||
meleeAtkCrush += stats.getAcrush();
|
||||
meleeAtkStab += stats.getAstab();
|
||||
meleeAtkSlash += stats.getAslash();
|
||||
meleeDefCrush += stats.getDcrush();
|
||||
meleeDefStab += stats.getDstab();
|
||||
meleeDefSlash += stats.getDslash();
|
||||
magicAttack += stats.getAmagic();
|
||||
rangeAttack += stats.getArange();
|
||||
magicDefence += stats.getDmagic();
|
||||
rangeDefence += stats.getDrange();
|
||||
rangeStr += stats.getRstr();
|
||||
meleeStr += stats.getStr();
|
||||
magicStr += stats.getMdmg();
|
||||
|
||||
if (ItemReclaimCost.breaksOnDeath(id))
|
||||
{
|
||||
prices.put(id, itemManager.getRepairValue(id));
|
||||
log.debug("Item has a broken value: Id {}, Value {}", id, itemManager.getRepairValue(id));
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!itemDefinition.isTradeable() && !ItemMapping.isMapped(id))
|
||||
{
|
||||
prices.put(id, itemDefinition.getPrice());
|
||||
}
|
||||
else if (itemDefinition.isTradeable())
|
||||
{
|
||||
prices.put(id, itemManager.getItemPrice(id, false));
|
||||
}
|
||||
}
|
||||
|
||||
player.setCombatStats(new CombatStats(
|
||||
magicAttack,
|
||||
magicDefence,
|
||||
magicStr,
|
||||
meleeAtkCrush,
|
||||
meleeAtkSlash,
|
||||
meleeAtkStab,
|
||||
(meleeAtkCrush + meleeAtkSlash + meleeAtkStab) / 3,
|
||||
meleeDefCrush,
|
||||
(meleeDefCrush + meleeDefSlash + meleeDefStab) / 3,
|
||||
meleeDefSlash,
|
||||
meleeDefStab,
|
||||
meleeStr,
|
||||
rangeAttack,
|
||||
rangeDefence,
|
||||
rangeStr,
|
||||
speed
|
||||
));
|
||||
updateGear(player, prices);
|
||||
updateMeleeStyle(player);
|
||||
}
|
||||
|
||||
private void updateGear(PlayerContainer player, Map<Integer, Integer> prices)
|
||||
{
|
||||
player.setGear(prices.entrySet()
|
||||
.stream()
|
||||
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, LinkedHashMap::new))
|
||||
);
|
||||
|
||||
player.setRiskedGear(prices.entrySet()
|
||||
.stream()
|
||||
.sorted(Collections.reverseOrder(Map.Entry.comparingByValue()))
|
||||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue, (oldValue, newValue) -> oldValue, LinkedHashMap::new))
|
||||
);
|
||||
|
||||
if (player.getPlayer().getSkullIcon() == null)
|
||||
{
|
||||
removeEntries(player.getRiskedGear(), player.getPrayerLevel() <= 25 ? 3 : 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeEntries(player.getRiskedGear(), player.getPrayerLevel() <= 25 ? 0 : 1);
|
||||
}
|
||||
|
||||
player.getRiskedGear().values().forEach(price -> player.setRisk(player.getRisk() + price));
|
||||
prices.clear();
|
||||
}
|
||||
|
||||
private void updateMeleeStyle(PlayerContainer player)
|
||||
{
|
||||
final CombatStats stats = player.getCombatStats();
|
||||
|
||||
if (stats.getMeleeAtkCrush() >= stats.getMeleeAtkSlash() && stats.getMeleeAtkCrush() >= stats.getMeleeAtkStab())
|
||||
{
|
||||
player.setMeleeStyle(PlayerContainer.MeleeStyle.CRUSH);
|
||||
}
|
||||
else if (stats.getMeleeAtkSlash() >= stats.getMeleeAtkCrush() && stats.getMeleeAtkSlash() >= stats.getMeleeAtkStab())
|
||||
{
|
||||
player.setMeleeStyle(PlayerContainer.MeleeStyle.SLASH);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setMeleeStyle(PlayerContainer.MeleeStyle.STAB);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateAttackStyle(PlayerContainer player)
|
||||
{
|
||||
final AttackStyle oldStyle = player.getAttackStyle();
|
||||
boolean staff = false;
|
||||
|
||||
for (int id : player.getGear().keySet())
|
||||
{
|
||||
ItemDefinition def = itemManager.getItemDefinition(id);
|
||||
if (def.getName().toLowerCase().contains("staff"))
|
||||
{
|
||||
player.setAttackStyle(AttackStyle.MAGE);
|
||||
staff = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (staff)
|
||||
{
|
||||
if (oldStyle != player.getAttackStyle())
|
||||
{
|
||||
eventBus.post(AttackStyleChanged.class, new AttackStyleChanged(
|
||||
player.getPlayer(), oldStyle, player.getAttackStyle())
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
final CombatStats stats = player.getCombatStats();
|
||||
|
||||
if (stats.getMagicStr() >= stats.getRangeStr() && stats.getMagicStr() >= stats.getMeleeStr())
|
||||
{
|
||||
player.setAttackStyle(AttackStyle.MAGE);
|
||||
}
|
||||
else if (stats.getRangeStr() >= stats.getMagicStr() && stats.getRangeStr() >= stats.getMeleeStr())
|
||||
{
|
||||
player.setAttackStyle(AttackStyle.RANGE);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setAttackStyle(AttackStyle.MELEE);
|
||||
}
|
||||
|
||||
if (oldStyle != player.getAttackStyle())
|
||||
{
|
||||
eventBus.post(AttackStyleChanged.class, new AttackStyleChanged(
|
||||
player.getPlayer(), oldStyle, player.getAttackStyle())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateWeakness(PlayerContainer player)
|
||||
{
|
||||
final CombatStats stats = player.getCombatStats();
|
||||
|
||||
if (stats.getMagicDefence() <= stats.getRangeDefence() && stats.getMagicDefence() <= stats.getMeleeDefence())
|
||||
{
|
||||
player.setWeakness(AttackStyle.MAGE);
|
||||
}
|
||||
else if (stats.getRangeDefence() <= stats.getMagicDefence() && stats.getRangeDefence() <= stats.getMeleeDefence())
|
||||
{
|
||||
player.setWeakness(AttackStyle.RANGE);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.setWeakness(AttackStyle.MELEE);
|
||||
}
|
||||
}
|
||||
|
||||
private static void removeEntries(LinkedHashMap<Integer, Integer> map, int quantity)
|
||||
{
|
||||
for (int i = 0; i < quantity; i++)
|
||||
{
|
||||
if (!map.entrySet().iterator().hasNext())
|
||||
{
|
||||
return;
|
||||
}
|
||||
map.entrySet().remove(map.entrySet().iterator().next());
|
||||
}
|
||||
}
|
||||
|
||||
private String targetStringBuilder(PlayerContainer player)
|
||||
{
|
||||
if (player.getPlayer().getInteracting() != null)
|
||||
{
|
||||
Actor actor = player.getPlayer().getInteracting();
|
||||
if (actor instanceof Player)
|
||||
{
|
||||
return "(Player) " + actor.getName();
|
||||
}
|
||||
else if (actor instanceof NPC)
|
||||
{
|
||||
return "(NPC) " + actor.getName();
|
||||
}
|
||||
}
|
||||
return "No Target Detected";
|
||||
}
|
||||
}
|
||||
@@ -41,15 +41,15 @@ public class SoundManager
|
||||
AudioInputStream in = AudioSystem.getAudioInputStream(this.getClass().getClassLoader().getResource(sound.getFilePath()));
|
||||
AudioFormat outFormat = SoundManager.this.getOutFormat(in.getFormat());
|
||||
DataLine.Info info = new DataLine.Info(SourceDataLine.class, outFormat);
|
||||
SourceDataLine line = (SourceDataLine)AudioSystem.getLine(info);
|
||||
SourceDataLine line = (SourceDataLine) AudioSystem.getLine(info);
|
||||
if (line != null)
|
||||
{
|
||||
line.open(outFormat, 2200);
|
||||
if (line.isControlSupported(FloatControl.Type.MASTER_GAIN))
|
||||
{
|
||||
int volume = SoundManager.this.runeliteConfig.volume();
|
||||
FloatControl gainControl = (FloatControl)line.getControl(FloatControl.Type.MASTER_GAIN);
|
||||
BooleanControl muteControl = (BooleanControl)line.getControl(BooleanControl.Type.MUTE);
|
||||
FloatControl gainControl = (FloatControl) line.getControl(FloatControl.Type.MASTER_GAIN);
|
||||
BooleanControl muteControl = (BooleanControl) line.getControl(BooleanControl.Type.MUTE);
|
||||
if (volume == 0)
|
||||
{
|
||||
muteControl.setValue(true);
|
||||
@@ -57,7 +57,7 @@ public class SoundManager
|
||||
else
|
||||
{
|
||||
muteControl.setValue(false);
|
||||
gainControl.setValue((float)(Math.log((double)volume / 100.0) / Math.log(10.0) * 20.0));
|
||||
gainControl.setValue((float) (Math.log((double) volume / 100.0) / Math.log(10.0) * 20.0));
|
||||
}
|
||||
}
|
||||
line.start();
|
||||
|
||||
@@ -57,7 +57,7 @@ public class SpriteManager
|
||||
@Inject
|
||||
private InfoBoxManager infoBoxManager;
|
||||
|
||||
public Cache<Long, BufferedImage> cache = CacheBuilder.newBuilder()
|
||||
private final Cache<Long, BufferedImage> cache = CacheBuilder.newBuilder()
|
||||
.maximumSize(128L)
|
||||
.expireAfterAccess(1, TimeUnit.HOURS)
|
||||
.build();
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* 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.client.game;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Comparator;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.events.WorldsFetch;
|
||||
import net.runelite.client.util.RunnableExceptionLogger;
|
||||
import net.runelite.http.api.worlds.World;
|
||||
import net.runelite.http.api.worlds.WorldClient;
|
||||
import net.runelite.http.api.worlds.WorldResult;
|
||||
|
||||
@Singleton
|
||||
@Slf4j
|
||||
public class WorldService
|
||||
{
|
||||
private static final int WORLD_FETCH_TIMER = 10; // minutes
|
||||
|
||||
private final Client client;
|
||||
private final ScheduledExecutorService scheduledExecutorService;
|
||||
private final WorldClient worldClient;
|
||||
private final EventBus eventBus;
|
||||
private final CompletableFuture<WorldResult> firstRunFuture = new CompletableFuture<>();
|
||||
|
||||
private WorldResult worlds;
|
||||
|
||||
@Inject
|
||||
private WorldService(Client client, ScheduledExecutorService scheduledExecutorService, WorldClient worldClient,
|
||||
EventBus eventBus)
|
||||
{
|
||||
this.client = client;
|
||||
this.scheduledExecutorService = scheduledExecutorService;
|
||||
this.worldClient = worldClient;
|
||||
this.eventBus = eventBus;
|
||||
|
||||
scheduledExecutorService.scheduleWithFixedDelay(RunnableExceptionLogger.wrap(this::tick), 0, WORLD_FETCH_TIMER, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
private void tick()
|
||||
{
|
||||
try
|
||||
{
|
||||
if (worlds == null || client.getGameState() == GameState.LOGGED_IN)
|
||||
{
|
||||
fetch();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
firstRunFuture.complete(worlds);
|
||||
}
|
||||
}
|
||||
|
||||
private void fetch()
|
||||
{
|
||||
log.debug("Fetching worlds");
|
||||
|
||||
try
|
||||
{
|
||||
WorldResult worldResult = worldClient.lookupWorlds();
|
||||
worldResult.getWorlds().sort(Comparator.comparingInt(World::getId));
|
||||
worlds = worldResult;
|
||||
eventBus.post(WorldsFetch.class, new WorldsFetch(worldResult));
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
log.warn("Error looking up worlds", ex);
|
||||
}
|
||||
}
|
||||
|
||||
public void refresh()
|
||||
{
|
||||
scheduledExecutorService.execute(this::fetch);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public WorldResult getWorlds()
|
||||
{
|
||||
if (!firstRunFuture.isDone())
|
||||
{
|
||||
try
|
||||
{
|
||||
return firstRunFuture.get(10, TimeUnit.SECONDS);
|
||||
}
|
||||
catch (InterruptedException | ExecutionException | TimeoutException e)
|
||||
{
|
||||
log.warn("Failed to retrieve worlds on first run", e);
|
||||
}
|
||||
}
|
||||
|
||||
return worlds;
|
||||
}
|
||||
}
|
||||
@@ -21,9 +21,8 @@ public class XpDropManager
|
||||
private int damage = 0;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int tickShow = 0;
|
||||
private int previousExpGained;
|
||||
private Client client;
|
||||
private EventBus eventBus;
|
||||
private final Client client;
|
||||
private final EventBus eventBus;
|
||||
|
||||
@Inject
|
||||
private XpDropManager(
|
||||
@@ -50,7 +49,7 @@ public class XpDropManager
|
||||
Integer previous = previousSkillExpTable.put(skill, xp);
|
||||
if (previous != null)
|
||||
{
|
||||
previousExpGained = xp - previous;
|
||||
int previousExpGained = xp - previous;
|
||||
XpDropEvent xpDropEvent = new XpDropEvent();
|
||||
xpDropEvent.setExp(previousExpGained);
|
||||
xpDropEvent.setSkill(skill);
|
||||
|
||||
@@ -59,7 +59,7 @@ public class ChatboxItemSearch extends ChatboxTextInput
|
||||
private final ItemManager itemManager;
|
||||
private final Client client;
|
||||
|
||||
private Map<Integer, ItemDefinition> results = new LinkedHashMap<>();
|
||||
private final Map<Integer, ItemDefinition> results = new LinkedHashMap<>();
|
||||
private String tooltipText;
|
||||
private int index = -1;
|
||||
|
||||
@@ -68,7 +68,7 @@ public class ChatboxItemSearch extends ChatboxTextInput
|
||||
|
||||
@Inject
|
||||
private ChatboxItemSearch(ChatboxPanelManager chatboxPanelManager, ClientThread clientThread,
|
||||
ItemManager itemManager, Client client)
|
||||
ItemManager itemManager, Client client)
|
||||
{
|
||||
super(chatboxPanelManager, clientThread);
|
||||
this.chatboxPanelManager = chatboxPanelManager;
|
||||
@@ -181,7 +181,7 @@ public class ChatboxItemSearch extends ChatboxTextInput
|
||||
{
|
||||
if (onItemSelected != null)
|
||||
{
|
||||
onItemSelected.accept(results.keySet().toArray(new Integer[results.size()])[index]);
|
||||
onItemSelected.accept(results.keySet().toArray(new Integer[0])[index]);
|
||||
}
|
||||
|
||||
chatboxPanelManager.close();
|
||||
|
||||
@@ -48,6 +48,7 @@ import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.FontID;
|
||||
import net.runelite.api.FontTypeFace;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.api.widgets.JavaScriptCallback;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetPositionMode;
|
||||
@@ -58,7 +59,6 @@ import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.input.KeyListener;
|
||||
import net.runelite.client.input.MouseListener;
|
||||
import net.runelite.client.util.MiscUtils;
|
||||
import net.runelite.api.util.Text;
|
||||
|
||||
@Slf4j
|
||||
public class ChatboxTextInput extends ChatboxInput implements KeyListener, MouseListener
|
||||
@@ -67,7 +67,7 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse
|
||||
private static final Pattern BREAK_MATCHER = Pattern.compile("[^a-zA-Z0-9']");
|
||||
|
||||
private final ChatboxPanelManager chatboxPanelManager;
|
||||
protected final ClientThread clientThread;
|
||||
final ClientThread clientThread;
|
||||
|
||||
private static IntPredicate getDefaultCharValidator()
|
||||
{
|
||||
@@ -135,7 +135,7 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChatboxTextInput lines(int lines)
|
||||
protected ChatboxTextInput lines(int lines)
|
||||
{
|
||||
this.lines = lines;
|
||||
if (built)
|
||||
@@ -573,7 +573,7 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void close()
|
||||
void close()
|
||||
{
|
||||
if (this.onClose != null)
|
||||
{
|
||||
|
||||
@@ -24,6 +24,4 @@
|
||||
*/
|
||||
package net.runelite.client.input;
|
||||
|
||||
public interface KeyListener extends java.awt.event.KeyListener
|
||||
{
|
||||
}
|
||||
public interface KeyListener extends java.awt.event.KeyListener {}
|
||||
|
||||
@@ -83,10 +83,7 @@ public class BaseComparableEntry extends AbstractComparableEntry
|
||||
{
|
||||
int type = entry.getOpcode();
|
||||
|
||||
if (this.type != type)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return this.type == type;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -11,7 +11,6 @@ public interface ComparableEntries
|
||||
*
|
||||
* @param option has to equal entry option
|
||||
* @param target has to equal entry option
|
||||
*
|
||||
* @return a new BaseComparableEntry
|
||||
*/
|
||||
static BaseComparableEntry newBaseComparableEntry(String option, String target)
|
||||
@@ -23,10 +22,9 @@ public interface ComparableEntries
|
||||
* BaseComparableEntries should only be used if there's
|
||||
* no better ComparableEntry available.
|
||||
*
|
||||
* @param option has to equal option
|
||||
* @param target equal or contains depending on strictTarget
|
||||
* @param option has to equal option
|
||||
* @param target equal or contains depending on strictTarget
|
||||
* @param strictTarget read up one line
|
||||
*
|
||||
* @return a new BaseComparableEntry
|
||||
*/
|
||||
static BaseComparableEntry newBaseComparableEntry(String option, String target, boolean strictTarget)
|
||||
@@ -38,13 +36,12 @@ public interface ComparableEntries
|
||||
* BaseComparableEntries should only be used if there's
|
||||
* no better ComparableEntry available.
|
||||
*
|
||||
* @param option equal or contains depending on strictOption
|
||||
* @param target equal or contains depending on strictTarget
|
||||
* @param id has to be the same, or -1 to skip checking
|
||||
* @param type has to be the same, or -1 to skip checking
|
||||
* @param option equal or contains depending on strictOption
|
||||
* @param target equal or contains depending on strictTarget
|
||||
* @param id has to be the same, or -1 to skip checking
|
||||
* @param type has to be the same, or -1 to skip checking
|
||||
* @param strictOption strict option or nah
|
||||
* @param strictTarget strict target or nah
|
||||
*
|
||||
* @return a new BaseComparableEntry
|
||||
*/
|
||||
static BaseComparableEntry newBaseComparableEntry(String option, String target, int id, int type, boolean strictOption, boolean strictTarget)
|
||||
@@ -57,7 +54,7 @@ public interface ComparableEntries
|
||||
* in their name. It then checks the ItemDefinition
|
||||
* for each of them, to see if it's possible for
|
||||
* the item to have option as one of their options.
|
||||
*
|
||||
* <p>
|
||||
* This has to be ran on the clientthread!
|
||||
*/
|
||||
static ItemComparableEntry newInvItemComparableEntry(Client client, String option, String itemName)
|
||||
|
||||
@@ -639,7 +639,7 @@ public class MenuManager
|
||||
/**
|
||||
* Adds to the map of swaps.
|
||||
*/
|
||||
public void addSwap(String option, String target, String option2, String target2, boolean strictOption, boolean strictTarget)
|
||||
private void addSwap(String option, String target, String option2, String target2, boolean strictOption, boolean strictTarget)
|
||||
{
|
||||
option = option.trim().toLowerCase();
|
||||
target = Text.standardize(target);
|
||||
@@ -660,7 +660,7 @@ public class MenuManager
|
||||
}
|
||||
|
||||
|
||||
public void removeSwap(String option, String target, String option2, String target2, boolean strictOption, boolean strictTarget)
|
||||
private void removeSwap(String option, String target, String option2, String target2, boolean strictOption, boolean strictTarget)
|
||||
{
|
||||
option = option.trim().toLowerCase();
|
||||
target = Text.standardize(target);
|
||||
|
||||
@@ -61,7 +61,7 @@ public class ExternalPluginLoader
|
||||
BASE.mkdirs();
|
||||
}
|
||||
|
||||
public void scanAndLoad()
|
||||
void scanAndLoad()
|
||||
{
|
||||
if (!OpenOSRSConfig.enablePlugins())
|
||||
{
|
||||
@@ -111,7 +111,7 @@ public class ExternalPluginLoader
|
||||
return;
|
||||
}
|
||||
|
||||
if (loadedPlugins.size() != 1)
|
||||
if (loadedPlugins.size() > 1)
|
||||
{
|
||||
close(loader);
|
||||
log.warn("You can not have more than one plugin per jar");
|
||||
@@ -119,8 +119,6 @@ public class ExternalPluginLoader
|
||||
}
|
||||
|
||||
Plugin plugin = loadedPlugins.get(0);
|
||||
plugin.file = pluginFile;
|
||||
plugin.loader = loader;
|
||||
|
||||
// Initialize default configuration
|
||||
Injector injector = plugin.getInjector();
|
||||
|
||||
@@ -24,17 +24,28 @@
|
||||
*/
|
||||
package net.runelite.client.plugins;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
import java.io.File;
|
||||
import io.reactivex.functions.Consumer;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Set;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Value;
|
||||
import net.runelite.api.events.Event;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.EventScheduler;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
|
||||
public abstract class Plugin implements Module
|
||||
{
|
||||
protected Injector injector;
|
||||
private final Set<Subscription> annotatedSubscriptions = findSubscriptions();
|
||||
private final Object annotatedSubsLock = new Object();
|
||||
|
||||
public File file;
|
||||
public PluginClassLoader loader;
|
||||
@Getter(AccessLevel.PROTECTED)
|
||||
protected Injector injector;
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
@@ -49,8 +60,53 @@ public abstract class Plugin implements Module
|
||||
{
|
||||
}
|
||||
|
||||
public final Injector getInjector()
|
||||
@SuppressWarnings("unchecked")
|
||||
final void addAnnotatedSubscriptions(EventBus eventBus)
|
||||
{
|
||||
return injector;
|
||||
annotatedSubscriptions.forEach(sub -> eventBus.subscribe(sub.type, annotatedSubsLock, sub.method, sub.takeUntil, sub.subscribe, sub.observe));
|
||||
}
|
||||
|
||||
final void removeAnnotatedSubscriptions(EventBus eventBus)
|
||||
{
|
||||
eventBus.unregister(annotatedSubsLock);
|
||||
}
|
||||
|
||||
private Set<Subscription> findSubscriptions()
|
||||
{
|
||||
ImmutableSet.Builder<Subscription> builder = ImmutableSet.builder();
|
||||
|
||||
for (Method method : this.getClass().getDeclaredMethods())
|
||||
{
|
||||
Subscribe annotation = method.getAnnotation(Subscribe.class);
|
||||
if (annotation == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
assert method.getParameterCount() == 1 : "Methods annotated with @Subscribe should have only one parameter";
|
||||
|
||||
Class<?> type = method.getParameterTypes()[0];
|
||||
|
||||
assert Event.class.isAssignableFrom(type) : "Parameters of methods annotated with @Subscribe should implement net.runelite.api.events.Event";
|
||||
assert method.getReturnType() == void.class : "Methods annotated with @Subscribe should have a void return type";
|
||||
|
||||
method.setAccessible(true);
|
||||
|
||||
Subscription sub = new Subscription(type.asSubclass(Event.class), event -> method.invoke(this, event), annotation.takeUntil(), annotation.subscribe(), annotation.observe());
|
||||
|
||||
builder.add(sub);
|
||||
}
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Value
|
||||
private static class Subscription
|
||||
{
|
||||
private final Class type;
|
||||
private final Consumer method;
|
||||
private final int takeUntil;
|
||||
private final EventScheduler subscribe;
|
||||
private final EventScheduler observe;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,6 +376,8 @@ public class PluginManager
|
||||
}
|
||||
});
|
||||
|
||||
plugin.addAnnotatedSubscriptions(eventBus);
|
||||
|
||||
log.debug("Plugin {} is now running", plugin.getClass().getSimpleName());
|
||||
if (!isOutdated && sceneTileManager != null)
|
||||
{
|
||||
@@ -386,7 +388,6 @@ public class PluginManager
|
||||
}
|
||||
}
|
||||
|
||||
// eventBus.register(plugin);
|
||||
schedule(plugin);
|
||||
eventBus.post(PluginChanged.class, new PluginChanged(plugin, true));
|
||||
}
|
||||
@@ -424,6 +425,8 @@ public class PluginManager
|
||||
}
|
||||
});
|
||||
|
||||
plugin.removeAnnotatedSubscriptions(eventBus);
|
||||
|
||||
log.debug("Plugin {} is now stopped", plugin.getClass().getSimpleName());
|
||||
eventBus.post(PluginChanged.class, new PluginChanged(plugin, false));
|
||||
|
||||
@@ -567,6 +570,7 @@ public class PluginManager
|
||||
* Plugins in group 2 has dependents in group 1, etc.
|
||||
* This allows for loading dependent groups serially, starting from the last group,
|
||||
* while loading plugins within each group in parallel.
|
||||
*
|
||||
* @param graph
|
||||
* @param <T>
|
||||
* @return
|
||||
|
||||
@@ -24,17 +24,15 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.account;
|
||||
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.account.AccountSession;
|
||||
import net.runelite.client.account.SessionManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.SessionOpen;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Account",
|
||||
@@ -49,33 +47,7 @@ public class AccountPlugin extends Plugin
|
||||
@Inject
|
||||
private SessionManager sessionManager;
|
||||
|
||||
@Inject
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Inject
|
||||
private ScheduledExecutorService executor;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
addSubscriptions();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(SessionOpen.class, this, this::onSessionOpen);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onSessionOpen(SessionOpen sessionOpen)
|
||||
{
|
||||
AccountSession session = sessionManager.getAccountSession();
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.achievementdiary;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
public class CombatLevelRequirement implements Requirement
|
||||
{
|
||||
private final int level;
|
||||
|
||||
@@ -27,9 +27,10 @@ package net.runelite.client.plugins.achievementdiary;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.List;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
class DiaryRequirement
|
||||
{
|
||||
private final String task;
|
||||
|
||||
@@ -40,11 +40,12 @@ import net.runelite.api.QuestState;
|
||||
import net.runelite.api.ScriptID;
|
||||
import net.runelite.api.VarPlayer;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.achievementdiary.diaries.ArdougneDiaryRequirement;
|
||||
@@ -59,7 +60,6 @@ import net.runelite.client.plugins.achievementdiary.diaries.MorytaniaDiaryRequir
|
||||
import net.runelite.client.plugins.achievementdiary.diaries.VarrockDiaryRequirement;
|
||||
import net.runelite.client.plugins.achievementdiary.diaries.WesternDiaryRequirement;
|
||||
import net.runelite.client.plugins.achievementdiary.diaries.WildernessDiaryRequirement;
|
||||
import net.runelite.api.util.Text;
|
||||
|
||||
@Slf4j
|
||||
@PluginDescriptor(
|
||||
@@ -79,21 +79,7 @@ public class DiaryRequirementsPlugin extends Plugin
|
||||
@Inject
|
||||
private ClientThread clientThread;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onWidgetLoaded(final WidgetLoaded event)
|
||||
{
|
||||
if (event.getGroupId() == WidgetID.DIARY_QUEST_GROUP_ID)
|
||||
|
||||
@@ -24,12 +24,13 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.achievementdiary;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.runelite.api.Favour;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
public class FavourRequirement implements Requirement
|
||||
{
|
||||
private final Favour house;
|
||||
|
||||
@@ -27,11 +27,12 @@ package net.runelite.client.plugins.achievementdiary;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
|
||||
public abstract class GenericDiaryRequirement
|
||||
{
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Set<DiaryRequirement> requirements = new HashSet<>();
|
||||
|
||||
protected void add(String task, Requirement... requirements)
|
||||
|
||||
@@ -27,11 +27,12 @@ package net.runelite.client.plugins.achievementdiary;
|
||||
import com.google.common.base.Joiner;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.util.List;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
|
||||
public class OrRequirement implements Requirement
|
||||
{
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final List<Requirement> requirements;
|
||||
|
||||
public OrRequirement(Requirement... reqs)
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.achievementdiary;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
public class QuestPointRequirement implements Requirement
|
||||
{
|
||||
private final int qp;
|
||||
|
||||
@@ -24,11 +24,12 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.achievementdiary;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.runelite.api.Quest;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@RequiredArgsConstructor
|
||||
public class QuestRequirement implements Requirement
|
||||
{
|
||||
|
||||
@@ -24,6 +24,4 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.achievementdiary;
|
||||
|
||||
public interface Requirement
|
||||
{
|
||||
}
|
||||
public interface Requirement {}
|
||||
|
||||
@@ -24,12 +24,13 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.achievementdiary;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.runelite.api.Skill;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
public class SkillRequirement implements Requirement
|
||||
{
|
||||
private final Skill skill;
|
||||
|
||||
@@ -71,6 +71,7 @@ import net.runelite.api.events.WallObjectSpawned;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.game.AgilityShortcut;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
@@ -134,12 +135,6 @@ public class AgilityPlugin extends Plugin
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int agilityLevel;
|
||||
|
||||
@Provides
|
||||
AgilityConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(AgilityConfig.class);
|
||||
}
|
||||
|
||||
// Config values
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean removeDistanceCap;
|
||||
@@ -166,11 +161,16 @@ public class AgilityPlugin extends Plugin
|
||||
private boolean notifyAgilityArena;
|
||||
private boolean showAgilityArenaTimer;
|
||||
|
||||
@Provides
|
||||
AgilityConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(AgilityConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
protected void startUp()
|
||||
{
|
||||
updateConfig();
|
||||
addSubscriptions();
|
||||
|
||||
if (config.showShortcutLevel())
|
||||
{
|
||||
@@ -183,9 +183,8 @@ public class AgilityPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
protected void shutDown()
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
eventBus.unregister(MENU_SUBS);
|
||||
|
||||
overlayManager.remove(agilityOverlay);
|
||||
@@ -196,34 +195,13 @@ public class AgilityPlugin extends Plugin
|
||||
agilityLevel = 0;
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
|
||||
eventBus.subscribe(StatChanged .class, this, this::onStatChanged);
|
||||
eventBus.subscribe(ItemSpawned.class, this, this::onItemSpawned);
|
||||
eventBus.subscribe(ItemDespawned.class, this, this::onItemDespawned);
|
||||
eventBus.subscribe(GameTick.class, this, this::onGameTick);
|
||||
eventBus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
|
||||
eventBus.subscribe(GameObjectChanged.class, this, this::onGameObjectChanged);
|
||||
eventBus.subscribe(GameObjectDespawned.class, this, this::onGameObjectDespawned);
|
||||
eventBus.subscribe(GroundObjectSpawned.class, this, this::onGroundObjectSpawned);
|
||||
eventBus.subscribe(GroundObjectChanged.class, this, this::onGroundObjectChanged);
|
||||
eventBus.subscribe(GroundObjectDespawned.class, this, this::onGroundObjectDespawned);
|
||||
eventBus.subscribe(WallObjectSpawned.class, this, this::onWallObjectSpawned);
|
||||
eventBus.subscribe(WallObjectChanged.class, this, this::onWallObjectChanged);
|
||||
eventBus.subscribe(WallObjectDespawned.class, this, this::onWallObjectDespawned);
|
||||
eventBus.subscribe(DecorativeObjectSpawned.class, this, this::onDecorativeObjectSpawned);
|
||||
eventBus.subscribe(DecorativeObjectChanged.class, this, this::onDecorativeObjectChanged);
|
||||
eventBus.subscribe(DecorativeObjectDespawned.class, this, this::onDecorativeObjectDespawned);
|
||||
}
|
||||
|
||||
private void addMenuSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(BeforeRender.class, MENU_SUBS, this::onBeforeRender);
|
||||
eventBus.subscribe(MenuOpened.class, MENU_SUBS, this::onMenuOpened);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
switch (event.getGameState())
|
||||
@@ -248,6 +226,7 @@ public class AgilityPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (!event.getGroup().equals("agility"))
|
||||
@@ -276,7 +255,7 @@ public class AgilityPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
public void updateConfig()
|
||||
private void updateConfig()
|
||||
{
|
||||
this.removeDistanceCap = config.removeDistanceCap();
|
||||
this.showLapCount = config.showLapCount();
|
||||
@@ -293,6 +272,7 @@ public class AgilityPlugin extends Plugin
|
||||
this.showAgilityArenaTimer = config.showAgilityArenaTimer();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatChanged(StatChanged statChanged)
|
||||
{
|
||||
if (statChanged.getSkill() != AGILITY)
|
||||
@@ -335,6 +315,7 @@ public class AgilityPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onItemSpawned(ItemSpawned itemSpawned)
|
||||
{
|
||||
if (obstacles.isEmpty())
|
||||
@@ -351,12 +332,14 @@ public class AgilityPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onItemDespawned(ItemDespawned itemDespawned)
|
||||
{
|
||||
final Tile tile = itemDespawned.getTile();
|
||||
marksOfGrace.remove(tile);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameTick(GameTick tick)
|
||||
{
|
||||
if (isInAgilityArena())
|
||||
@@ -408,61 +391,73 @@ public class AgilityPlugin extends Plugin
|
||||
infoBoxManager.addInfoBox(new AgilityArenaTimer(this, itemManager.getImage(AGILITY_ARENA_TICKET)));
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameObjectSpawned(GameObjectSpawned event)
|
||||
{
|
||||
onTileObject(event.getTile(), null, event.getGameObject());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameObjectChanged(GameObjectChanged event)
|
||||
{
|
||||
onTileObject(event.getTile(), event.getPrevious(), event.getGameObject());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameObjectDespawned(GameObjectDespawned event)
|
||||
{
|
||||
onTileObject(event.getTile(), event.getGameObject(), null);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGroundObjectSpawned(GroundObjectSpawned event)
|
||||
{
|
||||
onTileObject(event.getTile(), null, event.getGroundObject());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGroundObjectChanged(GroundObjectChanged event)
|
||||
{
|
||||
onTileObject(event.getTile(), event.getPrevious(), event.getGroundObject());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGroundObjectDespawned(GroundObjectDespawned event)
|
||||
{
|
||||
onTileObject(event.getTile(), event.getGroundObject(), null);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onWallObjectSpawned(WallObjectSpawned event)
|
||||
{
|
||||
onTileObject(event.getTile(), null, event.getWallObject());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onWallObjectChanged(WallObjectChanged event)
|
||||
{
|
||||
onTileObject(event.getTile(), event.getPrevious(), event.getWallObject());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onWallObjectDespawned(WallObjectDespawned event)
|
||||
{
|
||||
onTileObject(event.getTile(), event.getWallObject(), null);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onDecorativeObjectSpawned(DecorativeObjectSpawned event)
|
||||
{
|
||||
onTileObject(event.getTile(), null, event.getDecorativeObject());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onDecorativeObjectChanged(DecorativeObjectChanged event)
|
||||
{
|
||||
onTileObject(event.getTile(), event.getPrevious(), event.getDecorativeObject());
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onDecorativeObjectDespawned(DecorativeObjectDespawned event)
|
||||
{
|
||||
onTileObject(event.getTile(), event.getDecorativeObject(), null);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
package net.runelite.client.plugins.agility;
|
||||
|
||||
import java.time.Instant;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.Client;
|
||||
@@ -32,8 +33,8 @@ import net.runelite.api.Experience;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.VarPlayer;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
class AgilitySession
|
||||
{
|
||||
private final Courses course;
|
||||
|
||||
@@ -51,6 +51,7 @@ import net.runelite.api.events.NpcSpawned;
|
||||
import net.runelite.api.events.ProjectileMoved;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -69,6 +70,12 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
||||
@Singleton
|
||||
public class HydraPlugin extends Plugin
|
||||
{
|
||||
private static final int[] HYDRA_REGIONS = {
|
||||
5279, 5280,
|
||||
5535, 5536
|
||||
};
|
||||
private static final int STUN_LENGTH = 7;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Map<LocalPoint, Projectile> poisonProjectiles = new HashMap<>();
|
||||
|
||||
@@ -86,13 +93,7 @@ public class HydraPlugin extends Plugin
|
||||
|
||||
private boolean inHydraInstance;
|
||||
private int lastAttackTick;
|
||||
|
||||
private static final int[] HYDRA_REGIONS = {
|
||||
5279, 5280,
|
||||
5535, 5536
|
||||
};
|
||||
private static final int STUN_LENGTH = 7;
|
||||
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@@ -122,9 +123,6 @@ public class HydraPlugin extends Plugin
|
||||
{
|
||||
initConfig();
|
||||
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
|
||||
|
||||
inHydraInstance = checkArea();
|
||||
lastAttackTick = -1;
|
||||
poisonProjectiles.clear();
|
||||
@@ -133,7 +131,6 @@ public class HydraPlugin extends Plugin
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
eventBus.unregister("fight");
|
||||
eventBus.unregister("npcSpawned");
|
||||
|
||||
@@ -165,6 +162,7 @@ public class HydraPlugin extends Plugin
|
||||
eventBus.subscribe(ChatMessage.class, "fight", this::onChatMessage);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (!event.getGroup().equals("betterHydra"))
|
||||
@@ -207,6 +205,7 @@ public class HydraPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameStateChanged(GameStateChanged state)
|
||||
{
|
||||
if (state.getGameState() != GameState.LOGGED_IN)
|
||||
|
||||
@@ -31,11 +31,11 @@ import net.runelite.api.Client;
|
||||
import net.runelite.api.EquipmentInventorySlot;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemDefinition;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.ItemDefinition;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -61,15 +61,11 @@ public class AmmoPlugin extends Plugin
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
private AmmoCounter counterBox;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
protected void startUp()
|
||||
{
|
||||
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
|
||||
|
||||
clientThread.invokeLater(() ->
|
||||
{
|
||||
@@ -83,14 +79,13 @@ public class AmmoPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
protected void shutDown()
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
|
||||
infoBoxManager.removeInfoBox(counterBox);
|
||||
counterBox = null;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onItemContainerChanged(ItemContainerChanged event)
|
||||
{
|
||||
if (event.getItemContainer() != client.getItemContainer(InventoryID.EQUIPMENT))
|
||||
|
||||
@@ -28,9 +28,9 @@ import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
|
||||
@@ -51,9 +51,6 @@ public class AnimationSmoothingPlugin extends Plugin
|
||||
@Inject
|
||||
private AnimationSmoothingConfig config;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Provides
|
||||
AnimationSmoothingConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -61,24 +58,21 @@ public class AnimationSmoothingPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
protected void startUp()
|
||||
{
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
|
||||
update();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
protected void shutDown()
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
|
||||
client.setInterpolatePlayerAnimations(false);
|
||||
client.setInterpolateNpcAnimations(false);
|
||||
client.setInterpolateObjectAnimations(false);
|
||||
client.setInterpolateWidgetAnimations(false);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals(CONFIG_GROUP))
|
||||
|
||||
@@ -34,7 +34,7 @@ import net.runelite.api.events.FocusChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.config.Keybind;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
@@ -71,144 +71,15 @@ public class AntiDragPlugin extends Plugin
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
|
||||
@Inject
|
||||
private KeyManager keyManager;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Provides
|
||||
AntiDragConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(AntiDragConfig.class);
|
||||
}
|
||||
|
||||
private boolean toggleDrag;
|
||||
private boolean configOverlay;
|
||||
private boolean changeCursor;
|
||||
private CustomCursor selectedCursor;
|
||||
private Keybind key;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlay.setColor(config.color());
|
||||
|
||||
addSubscriptions();
|
||||
updateConfig();
|
||||
updateKeyListeners();
|
||||
|
||||
if (config.alwaysOn())
|
||||
{
|
||||
client.setInventoryDragDelay(config.dragDelay());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
|
||||
client.setInventoryDragDelay(DEFAULT_DELAY);
|
||||
keyManager.unregisterKeyListener(holdListener);
|
||||
keyManager.unregisterKeyListener(toggleListener);
|
||||
toggleDrag = false;
|
||||
overlayManager.remove(overlay);
|
||||
clientUI.resetCursor();
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
eventBus.subscribe(FocusChanged.class, this, this::onFocusChanged);
|
||||
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
|
||||
}
|
||||
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("antiDrag"))
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
switch (event.getKey())
|
||||
{
|
||||
case "toggleKeyBind":
|
||||
case "holdKeyBind":
|
||||
updateKeyListeners();
|
||||
break;
|
||||
case "alwaysOn":
|
||||
client.setInventoryDragDelay(config.alwaysOn() ? config.dragDelay() : DEFAULT_DELAY);
|
||||
break;
|
||||
case "dragDelay":
|
||||
if (config.alwaysOn())
|
||||
{
|
||||
client.setInventoryDragDelay(config.dragDelay());
|
||||
}
|
||||
break;
|
||||
case ("changeCursor"):
|
||||
clientUI.resetCursor();
|
||||
break;
|
||||
case ("color"):
|
||||
overlay.setColor(config.color());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState() == GameState.LOGIN_SCREEN)
|
||||
{
|
||||
keyManager.unregisterKeyListener(toggleListener);
|
||||
keyManager.unregisterKeyListener(holdListener);
|
||||
}
|
||||
else if (event.getGameState() == GameState.LOGGING_IN)
|
||||
{
|
||||
updateKeyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.key = config.key();
|
||||
this.configOverlay = config.overlay();
|
||||
this.changeCursor = config.changeCursor();
|
||||
this.selectedCursor = config.selectedCursor();
|
||||
}
|
||||
|
||||
private void onFocusChanged(FocusChanged focusChanged)
|
||||
{
|
||||
if (!focusChanged.isFocused() && config.reqFocus() && !config.alwaysOn())
|
||||
{
|
||||
client.setInventoryDragDelay(DEFAULT_DELAY);
|
||||
overlayManager.remove(overlay);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateKeyListeners()
|
||||
{
|
||||
if (config.holdKeyBind())
|
||||
{
|
||||
keyManager.registerKeyListener(holdListener);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyManager.unregisterKeyListener(holdListener);
|
||||
}
|
||||
|
||||
if (config.toggleKeyBind())
|
||||
{
|
||||
keyManager.registerKeyListener(toggleListener);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyManager.unregisterKeyListener(toggleListener);
|
||||
}
|
||||
}
|
||||
|
||||
private final HotkeyListener toggleListener = new HotkeyListener(() -> this.key)
|
||||
{
|
||||
@Override
|
||||
@@ -262,4 +133,119 @@ public class AntiDragPlugin extends Plugin
|
||||
clientUI.resetCursor();
|
||||
}
|
||||
};
|
||||
|
||||
@Provides
|
||||
AntiDragConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(AntiDragConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
overlay.setColor(config.color());
|
||||
updateConfig();
|
||||
updateKeyListeners();
|
||||
|
||||
if (config.alwaysOn())
|
||||
{
|
||||
client.setInventoryDragDelay(config.dragDelay());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
client.setInventoryDragDelay(DEFAULT_DELAY);
|
||||
keyManager.unregisterKeyListener(holdListener);
|
||||
keyManager.unregisterKeyListener(toggleListener);
|
||||
toggleDrag = false;
|
||||
overlayManager.remove(overlay);
|
||||
clientUI.resetCursor();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("antiDrag"))
|
||||
{
|
||||
updateConfig();
|
||||
|
||||
switch (event.getKey())
|
||||
{
|
||||
case "toggleKeyBind":
|
||||
case "holdKeyBind":
|
||||
updateKeyListeners();
|
||||
break;
|
||||
case "alwaysOn":
|
||||
client.setInventoryDragDelay(config.alwaysOn() ? config.dragDelay() : DEFAULT_DELAY);
|
||||
break;
|
||||
case "dragDelay":
|
||||
if (config.alwaysOn())
|
||||
{
|
||||
client.setInventoryDragDelay(config.dragDelay());
|
||||
}
|
||||
break;
|
||||
case ("changeCursor"):
|
||||
clientUI.resetCursor();
|
||||
break;
|
||||
case ("color"):
|
||||
overlay.setColor(config.color());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState() == GameState.LOGIN_SCREEN)
|
||||
{
|
||||
keyManager.unregisterKeyListener(toggleListener);
|
||||
keyManager.unregisterKeyListener(holdListener);
|
||||
}
|
||||
else if (event.getGameState() == GameState.LOGGING_IN)
|
||||
{
|
||||
updateKeyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.key = config.key();
|
||||
this.configOverlay = config.overlay();
|
||||
this.changeCursor = config.changeCursor();
|
||||
this.selectedCursor = config.selectedCursor();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onFocusChanged(FocusChanged focusChanged)
|
||||
{
|
||||
if (!focusChanged.isFocused() && config.reqFocus() && !config.alwaysOn())
|
||||
{
|
||||
client.setInventoryDragDelay(DEFAULT_DELAY);
|
||||
overlayManager.remove(overlay);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateKeyListeners()
|
||||
{
|
||||
if (config.holdKeyBind())
|
||||
{
|
||||
keyManager.registerKeyListener(holdListener);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyManager.unregisterKeyListener(holdListener);
|
||||
}
|
||||
|
||||
if (config.toggleKeyBind())
|
||||
{
|
||||
keyManager.registerKeyListener(toggleListener);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyManager.unregisterKeyListener(toggleListener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,12 +37,12 @@ public enum AoeProjectileInfo
|
||||
LIZARDMAN_SHAMAN_AOE(ProjectileID.LIZARDMAN_SHAMAN_AOE, 5),
|
||||
CRAZY_ARCHAEOLOGIST_AOE(ProjectileID.CRAZY_ARCHAEOLOGIST_AOE, 3),
|
||||
ICE_DEMON_RANGED_AOE(ProjectileID.ICE_DEMON_RANGED_AOE, 3),
|
||||
|
||||
|
||||
/**
|
||||
* When you don't have pray range on ice demon does an ice barrage
|
||||
*/
|
||||
ICE_DEMON_ICE_BARRAGE_AOE(ProjectileID.ICE_DEMON_ICE_BARRAGE_AOE, 3),
|
||||
|
||||
|
||||
/**
|
||||
* The AOE when vasa first starts
|
||||
*/
|
||||
@@ -63,7 +63,7 @@ public enum AoeProjectileInfo
|
||||
*/
|
||||
GALVEK_MINE(ProjectileID.GALVEK_MINE, 3),
|
||||
GALVEK_BOMB(ProjectileID.GALVEK_BOMB, 3),
|
||||
|
||||
|
||||
/**
|
||||
* the AOEs of Grotesque Guardians
|
||||
*/
|
||||
|
||||
@@ -28,6 +28,7 @@ package net.runelite.client.plugins.aoewarnings;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.runelite.client.config.Config;
|
||||
@@ -40,7 +41,7 @@ import net.runelite.client.config.Title;
|
||||
@ConfigGroup("aoe")
|
||||
public interface AoeWarningConfig extends Config
|
||||
{
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@AllArgsConstructor
|
||||
enum FontStyle
|
||||
{
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.aoewarnings;
|
||||
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
import java.time.Instant;
|
||||
@@ -55,7 +54,7 @@ import net.runelite.api.events.ProjectileMoved;
|
||||
import net.runelite.api.events.ProjectileSpawned;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -73,32 +72,42 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
||||
@Slf4j
|
||||
public class AoeWarningPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
public AoeWarningConfig config;
|
||||
@Inject
|
||||
private Notifier notifier;
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
@Inject
|
||||
private AoeWarningOverlay coreOverlay;
|
||||
@Inject
|
||||
private BombOverlay bombOverlay;
|
||||
@Inject
|
||||
private Client client;
|
||||
@Inject
|
||||
private EventBus eventbus;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> lightningTrail = new ArrayList<>();
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<GameObject> acidTrail = new ArrayList<>();
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<GameObject> crystalSpike = new ArrayList<>();
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<GameObject> wintertodtSnowFall = new ArrayList<>();
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Set<CrystalBomb> bombs = new HashSet<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Set<ProjectileContainer> projectiles = new HashSet<>();
|
||||
|
||||
@Inject
|
||||
public AoeWarningConfig config;
|
||||
|
||||
@Inject
|
||||
private Notifier notifier;
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private AoeWarningOverlay coreOverlay;
|
||||
|
||||
@Inject
|
||||
private BombOverlay bombOverlay;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> lightningTrail = new ArrayList<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<GameObject> acidTrail = new ArrayList<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<GameObject> crystalSpike = new ArrayList<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<GameObject> wintertodtSnowFall = new ArrayList<>();
|
||||
|
||||
// Config values
|
||||
private boolean aoeNotifyAll;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@@ -168,7 +177,6 @@ public class AoeWarningPlugin extends Plugin
|
||||
protected void startUp()
|
||||
{
|
||||
updateConfig();
|
||||
addSubscriptions();
|
||||
overlayManager.add(coreOverlay);
|
||||
overlayManager.add(bombOverlay);
|
||||
reset();
|
||||
@@ -180,20 +188,9 @@ public class AoeWarningPlugin extends Plugin
|
||||
overlayManager.remove(coreOverlay);
|
||||
overlayManager.remove(bombOverlay);
|
||||
reset();
|
||||
eventbus.unregister(this);
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventbus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
eventbus.subscribe(ProjectileMoved.class, this, this::onProjectileMoved);
|
||||
eventbus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
|
||||
eventbus.subscribe(GameObjectDespawned.class, this, this::onGameObjectDespawned);
|
||||
eventbus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
|
||||
eventbus.subscribe(GameTick.class, this, this::onGameTick);
|
||||
eventbus.subscribe(ProjectileSpawned.class, this, this::onProjectileSpawned);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (!event.getGroup().equals("aoe"))
|
||||
@@ -204,6 +201,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
updateConfig();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onProjectileSpawned(ProjectileSpawned event)
|
||||
{
|
||||
final Projectile projectile = event.getProjectile();
|
||||
@@ -232,6 +230,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onProjectileMoved(ProjectileMoved event)
|
||||
{
|
||||
if (projectiles.isEmpty())
|
||||
@@ -250,6 +249,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameObjectSpawned(GameObjectSpawned event)
|
||||
{
|
||||
final GameObject gameObject = event.getGameObject();
|
||||
@@ -284,6 +284,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameObjectDespawned(GameObjectDespawned event)
|
||||
{
|
||||
final GameObject gameObject = event.getGameObject();
|
||||
@@ -305,6 +306,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState() == GameState.LOGGED_IN)
|
||||
@@ -314,6 +316,7 @@ public class AoeWarningPlugin extends Plugin
|
||||
reset();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameTick(GameTick event)
|
||||
{
|
||||
lightningTrail.clear();
|
||||
|
||||
@@ -30,17 +30,16 @@ import com.google.common.collect.Table;
|
||||
import com.google.inject.Provides;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import javax.annotation.Nullable;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import javax.annotation.Nullable;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.VarPlayer;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.events.WidgetHiddenChanged;
|
||||
@@ -51,7 +50,8 @@ import net.runelite.api.widgets.WidgetInfo;
|
||||
import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import static net.runelite.client.plugins.attackstyles.AttackStyle.CASTING;
|
||||
@@ -70,8 +70,11 @@ public class AttackStylesPlugin extends Plugin
|
||||
private int attackStyleVarbit = -1;
|
||||
private int equippedWeaponTypeVarbit = -1;
|
||||
private int castingModeVarbit = -1;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@Nullable
|
||||
private AttackStyle attackStyle;
|
||||
private final Set<Skill> warnedSkills = new HashSet<>();
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean warnedSkillSelected = false;
|
||||
private final Table<WeaponType, WidgetInfo, Boolean> widgetsToHide = HashBasedTable.create();
|
||||
|
||||
@@ -90,9 +93,6 @@ public class AttackStylesPlugin extends Plugin
|
||||
@Inject
|
||||
private AttackStylesOverlay overlay;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Provides
|
||||
AttackStylesConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
@@ -108,13 +108,13 @@ public class AttackStylesPlugin extends Plugin
|
||||
private boolean warnForRanged;
|
||||
private boolean warnForMagic;
|
||||
private boolean hideAutoRetaliate;
|
||||
private boolean removeWarnedStyles;
|
||||
@VisibleForTesting
|
||||
boolean removeWarnedStyles;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
protected void startUp()
|
||||
{
|
||||
updateConfig();
|
||||
addSubscriptions();
|
||||
|
||||
overlayManager.add(overlay);
|
||||
|
||||
@@ -142,35 +142,15 @@ public class AttackStylesPlugin extends Plugin
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
|
||||
overlayManager.remove(overlay);
|
||||
hideWarnedStyles(false);
|
||||
processWidgets();
|
||||
hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), false);
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
eventBus.subscribe(WidgetHiddenChanged.class, this, this::onWidgetHiddenChanged);
|
||||
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
|
||||
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
|
||||
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public AttackStyle getAttackStyle()
|
||||
{
|
||||
return attackStyle;
|
||||
}
|
||||
|
||||
boolean isWarnedSkillSelected()
|
||||
{
|
||||
return warnedSkillSelected;
|
||||
}
|
||||
|
||||
private void onWidgetHiddenChanged(WidgetHiddenChanged event)
|
||||
@Subscribe
|
||||
@VisibleForTesting
|
||||
void onWidgetHiddenChanged(WidgetHiddenChanged event)
|
||||
{
|
||||
if (event.getWidget().isSelfHidden() || TO_GROUP(event.getWidget().getId()) != COMBAT_GROUP_ID)
|
||||
{
|
||||
@@ -180,6 +160,7 @@ public class AttackStylesPlugin extends Plugin
|
||||
processWidgets();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (event.getGroupId() != COMBAT_GROUP_ID)
|
||||
@@ -207,6 +188,7 @@ public class AttackStylesPlugin extends Plugin
|
||||
hideWidget(client.getWidget(WidgetInfo.COMBAT_AUTO_RETALIATE), this.hideAutoRetaliate);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState() == GameState.LOGGED_IN)
|
||||
@@ -215,6 +197,8 @@ public class AttackStylesPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@VisibleForTesting
|
||||
void onVarbitChanged(VarbitChanged event)
|
||||
{
|
||||
int currentAttackStyleVarbit = client.getVar(VarPlayer.ATTACK_STYLE);
|
||||
@@ -240,6 +224,8 @@ public class AttackStylesPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@VisibleForTesting
|
||||
void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("attackIndicator"))
|
||||
|
||||
@@ -66,7 +66,7 @@ import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
@@ -95,16 +95,16 @@ public class BankPlugin extends Plugin
|
||||
);
|
||||
|
||||
private static final List<WidgetInfo> BANK_PINS = ImmutableList.of(
|
||||
WidgetInfo.BANK_PIN_1,
|
||||
WidgetInfo.BANK_PIN_2,
|
||||
WidgetInfo.BANK_PIN_3,
|
||||
WidgetInfo.BANK_PIN_4,
|
||||
WidgetInfo.BANK_PIN_5,
|
||||
WidgetInfo.BANK_PIN_6,
|
||||
WidgetInfo.BANK_PIN_7,
|
||||
WidgetInfo.BANK_PIN_8,
|
||||
WidgetInfo.BANK_PIN_9,
|
||||
WidgetInfo.BANK_PIN_10
|
||||
WidgetInfo.BANK_PIN_1,
|
||||
WidgetInfo.BANK_PIN_2,
|
||||
WidgetInfo.BANK_PIN_3,
|
||||
WidgetInfo.BANK_PIN_4,
|
||||
WidgetInfo.BANK_PIN_5,
|
||||
WidgetInfo.BANK_PIN_6,
|
||||
WidgetInfo.BANK_PIN_7,
|
||||
WidgetInfo.BANK_PIN_8,
|
||||
WidgetInfo.BANK_PIN_9,
|
||||
WidgetInfo.BANK_PIN_10
|
||||
);
|
||||
|
||||
private static final String DEPOSIT_WORN = "Deposit worn items";
|
||||
@@ -133,9 +133,6 @@ public class BankPlugin extends Plugin
|
||||
@Inject
|
||||
private BankSearch bankSearch;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Inject
|
||||
private ContainerCalculation bankCalculation;
|
||||
|
||||
@@ -163,33 +160,21 @@ public class BankPlugin extends Plugin
|
||||
private boolean rightClickBankLoot;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
protected void startUp()
|
||||
{
|
||||
updateConfig();
|
||||
addSubscriptions();
|
||||
searchString = "";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
clientThread.invokeLater(() -> bankSearch.reset(false));
|
||||
forceRightClickFlag = false;
|
||||
itemQuantities = null;
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
eventBus.subscribe(MenuShouldLeftClick.class, this, this::onMenuShouldLeftClick);
|
||||
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
|
||||
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
|
||||
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
|
||||
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
|
||||
eventBus.subscribe(VarClientStrChanged.class, this, this::onVarClientStrChanged);
|
||||
searchString = "";
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onMenuShouldLeftClick(MenuShouldLeftClick event)
|
||||
{
|
||||
if (!forceRightClickFlag)
|
||||
@@ -211,6 +196,7 @@ public class BankPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
if ((event.getOption().equals(DEPOSIT_WORN) && this.rightClickBankEquip)
|
||||
@@ -221,6 +207,7 @@ public class BankPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onScriptCallbackEvent(ScriptCallbackEvent event)
|
||||
{
|
||||
if (event.getEventName().equals("bankPinButtons") && this.largePinNumbers)
|
||||
@@ -265,6 +252,7 @@ public class BankPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (event.getGroupId() != WidgetID.SEED_VAULT_GROUP_ID || !config.seedVaultValue())
|
||||
@@ -275,6 +263,7 @@ public class BankPlugin extends Plugin
|
||||
updateSeedVaultTotal();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onVarClientStrChanged(VarClientStrChanged event)
|
||||
{
|
||||
String searchVar = client.getVar(VarClientStr.INPUT_TEXT);
|
||||
@@ -302,6 +291,7 @@ public class BankPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onItemContainerChanged(ItemContainerChanged event)
|
||||
{
|
||||
int containerId = event.getContainerId();
|
||||
@@ -427,6 +417,7 @@ public class BankPlugin extends Plugin
|
||||
return itemContainer.getItems();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (!event.getGroup().equals("bank"))
|
||||
|
||||
@@ -57,8 +57,8 @@ class ContainerCalculation
|
||||
return null;
|
||||
}
|
||||
|
||||
final int newHash = hashItems(items);
|
||||
|
||||
final int newHash = hashItems(items);
|
||||
|
||||
if (containerPrices != null && hash == newHash)
|
||||
{
|
||||
return containerPrices;
|
||||
|
||||
@@ -52,7 +52,6 @@ import net.runelite.api.ItemID;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.VarClientStr;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.api.events.DraggingWidgetChanged;
|
||||
import net.runelite.api.events.FocusChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
@@ -68,7 +67,8 @@ import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
import net.runelite.client.game.chatbox.ChatboxPanelManager;
|
||||
@@ -97,9 +97,9 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
{
|
||||
public static final String CONFIG_GROUP = "banktags";
|
||||
public static final String TAG_SEARCH = "tag:";
|
||||
private static final String EDIT_TAGS_MENU_OPTION = "Edit-tags";
|
||||
public static final String ICON_SEARCH = "icon_";
|
||||
public static final String VAR_TAG_SUFFIX = "*";
|
||||
private static final String EDIT_TAGS_MENU_OPTION = "Edit-tags";
|
||||
private static final String NUMBER_REGEX = "[0-9]+(\\.[0-9]+)?[kmb]?";
|
||||
|
||||
private static final String SEARCH_BANK_INPUT_TEXT =
|
||||
@@ -112,6 +112,8 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
" *(((?<op>[<>=]|>=|<=) *(?<num>" + NUMBER_REGEX + "))|" +
|
||||
"((?<num1>" + NUMBER_REGEX + ") *- *(?<num2>" + NUMBER_REGEX + ")))$", Pattern.CASE_INSENSITIVE);
|
||||
|
||||
@VisibleForTesting
|
||||
final Multiset<Integer> itemQuantities = HashMultiset.create();
|
||||
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
@@ -146,16 +148,11 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
@Inject
|
||||
private SpriteManager spriteManager;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
|
||||
private boolean shiftPressed = false;
|
||||
private int nextRowIndex = 0;
|
||||
@VisibleForTesting
|
||||
Multiset<Integer> itemQuantities = HashMultiset.create();
|
||||
|
||||
@Provides
|
||||
BankTagsConfig getConfig(ConfigManager configManager)
|
||||
@@ -166,7 +163,6 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
@Override
|
||||
public void startUp()
|
||||
{
|
||||
addSubscriptions();
|
||||
|
||||
cleanConfig();
|
||||
keyManager.registerKeyListener(this);
|
||||
@@ -175,6 +171,18 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
spriteManager.addSpriteOverrides(TabSprites.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutDown()
|
||||
{
|
||||
keyManager.unregisterKeyListener(this);
|
||||
mouseManager.unregisterMouseWheelListener(this);
|
||||
clientThread.invokeLater(tabInterface::destroy);
|
||||
spriteManager.removeSpriteOverrides(TabSprites.values());
|
||||
|
||||
shiftPressed = false;
|
||||
itemQuantities.clear();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private void cleanConfig()
|
||||
{
|
||||
@@ -228,33 +236,6 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutDown()
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
|
||||
keyManager.unregisterKeyListener(this);
|
||||
mouseManager.unregisterMouseWheelListener(this);
|
||||
clientThread.invokeLater(tabInterface::destroy);
|
||||
spriteManager.removeSpriteOverrides(TabSprites.values());
|
||||
|
||||
shiftPressed = false;
|
||||
itemQuantities.clear();
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
|
||||
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
|
||||
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
|
||||
eventBus.subscribe(GameTick.class, this, this::onGameTick);
|
||||
eventBus.subscribe(DraggingWidgetChanged.class, this, this::onDraggingWidgetChanged);
|
||||
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
|
||||
eventBus.subscribe(FocusChanged.class, this, this::onFocusChanged);
|
||||
eventBus.subscribe(ItemContainerChanged.class, this, this::onItemContainerChanged);
|
||||
}
|
||||
|
||||
private boolean isSearching()
|
||||
{
|
||||
return client.getVar(VarClientInt.INPUT_TYPE) == InputType.SEARCH.getType()
|
||||
@@ -262,6 +243,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
&& client.getVar(VarClientStr.INPUT_TEXT) != null && client.getVar(VarClientStr.INPUT_TEXT).length() > 0);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onScriptCallbackEvent(ScriptCallbackEvent event)
|
||||
{
|
||||
String eventName = event.getEventName();
|
||||
@@ -371,6 +353,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
if (event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|
||||
@@ -401,6 +384,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
tabInterface.handleAdd(event);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
if (event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|
||||
@@ -476,6 +460,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onItemContainerChanged(ItemContainerChanged event)
|
||||
{
|
||||
if (event.getContainerId() == InventoryID.BANK.getId())
|
||||
@@ -491,6 +476,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged configChanged)
|
||||
{
|
||||
if (configChanged.getGroup().equals("banktags") && configChanged.getKey().equals("useTabs"))
|
||||
@@ -506,16 +492,19 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameTick(GameTick event)
|
||||
{
|
||||
tabInterface.update();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onDraggingWidgetChanged(DraggingWidgetChanged event)
|
||||
{
|
||||
tabInterface.handleDrag(event.isDraggingWidget(), shiftPressed);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (event.getGroupId() == WidgetID.BANK_GROUP_ID)
|
||||
@@ -524,6 +513,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onFocusChanged(FocusChanged event)
|
||||
{
|
||||
if (!event.isFocused())
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.util.stream.Collectors;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.game.ItemVariationMapping;
|
||||
@@ -45,7 +46,6 @@ import net.runelite.client.plugins.cluescrolls.clues.FairyRingClue;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.HotColdClue;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.MapClue;
|
||||
import net.runelite.client.plugins.cluescrolls.clues.item.ItemRequirement;
|
||||
import net.runelite.api.util.Text;
|
||||
|
||||
@Singleton
|
||||
public class TagManager
|
||||
|
||||
@@ -131,7 +131,7 @@ public class TabInterface
|
||||
private final Rectangle bounds = new Rectangle();
|
||||
private final Rectangle canvasBounds = new Rectangle();
|
||||
|
||||
private ChatboxItemSearch searchProvider;
|
||||
private final ChatboxItemSearch searchProvider;
|
||||
private TagTab activeTab;
|
||||
private int maxTabs;
|
||||
private int currentTabIndex;
|
||||
@@ -302,7 +302,7 @@ public class TabInterface
|
||||
|
||||
final Iterator<String> dataIter = Text.fromCSV(dataString).iterator();
|
||||
String name = dataIter.next();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (char c : name.toCharArray())
|
||||
{
|
||||
if (FILTERED_CHARS.test(c))
|
||||
@@ -324,7 +324,7 @@ public class TabInterface
|
||||
|
||||
while (dataIter.hasNext())
|
||||
{
|
||||
final int itemId = Integer.valueOf(dataIter.next());
|
||||
final int itemId = Integer.parseInt(dataIter.next());
|
||||
tagManager.addTag(itemId, name, itemId < 0);
|
||||
}
|
||||
|
||||
@@ -600,10 +600,10 @@ public class TabInterface
|
||||
}
|
||||
|
||||
if ((event.getIdentifier() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
|
||||
|| event.getIdentifier() == WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getId())
|
||||
|| event.getIdentifier() == WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getId())
|
||||
&& event.getMenuOpcode() == MenuOpcode.EXAMINE_ITEM_BANK_EQ
|
||||
&& (event.getOption().equalsIgnoreCase("withdraw-x")
|
||||
|| event.getOption().equalsIgnoreCase("deposit-x")))
|
||||
|| event.getOption().equalsIgnoreCase("deposit-x")))
|
||||
{
|
||||
waitSearchTick = true;
|
||||
rememberedSearch = client.getVar(VarClientStr.INPUT_TEXT);
|
||||
|
||||
@@ -33,12 +33,13 @@ import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import static net.runelite.client.plugins.banktags.BankTagsPlugin.CONFIG_GROUP;
|
||||
import static net.runelite.client.plugins.banktags.BankTagsPlugin.ICON_SEARCH;
|
||||
import net.runelite.api.util.Text;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
|
||||
@Singleton
|
||||
@@ -46,7 +47,7 @@ class TabManager
|
||||
{
|
||||
private static final String TAG_TABS_CONFIG = "tagtabs";
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final List<TagTab> tabs = new ArrayList<>();
|
||||
private final ConfigManager configManager;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.banktags.tabs;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import net.runelite.client.game.SpriteOverride;
|
||||
@@ -39,9 +40,9 @@ public enum TabSprites implements SpriteOverride
|
||||
DOWN_ARROW(-204, "down-arrow.png"),
|
||||
NEW_TAB(-205, "new-tab.png");
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PUBLIC)
|
||||
private final int spriteId;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PUBLIC)
|
||||
private final String fileName;
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ import net.runelite.client.chat.ChatMessageBuilder;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.chat.QueuedMessage;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -92,9 +92,6 @@ public class BanListPlugin extends Plugin
|
||||
@Inject
|
||||
private ChatMessageManager chatMessageManager;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
private String tobNames = "";
|
||||
private boolean enableWDRScam;
|
||||
private boolean enableWDRToxic;
|
||||
@@ -109,10 +106,9 @@ public class BanListPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
protected void startUp()
|
||||
{
|
||||
updateConfig();
|
||||
addSubscriptions();
|
||||
|
||||
manualBans.addAll(Text.fromCSV(Text.standardize(config.getBannedPlayers())));
|
||||
|
||||
@@ -120,25 +116,16 @@ public class BanListPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
protected void shutDown()
|
||||
{
|
||||
|
||||
eventBus.unregister(this);
|
||||
wdrScamSet.clear();
|
||||
wdrToxicSet.clear();
|
||||
runeWatchSet.clear();
|
||||
manualBans.clear();
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
eventBus.subscribe(WidgetHiddenChanged.class, this, this::onWidgetHiddenChanged);
|
||||
eventBus.subscribe(ClanMemberJoined.class, this, this::onClanMemberJoined);
|
||||
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
|
||||
eventBus.subscribe(GameTick.class, this, this::onGameTick);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("banlist") && event.getKey().equals("bannedPlayers"))
|
||||
@@ -163,6 +150,7 @@ public class BanListPlugin extends Plugin
|
||||
/**
|
||||
* Event to keep making sure player names are highlighted red in clan chat, since the red name goes away frequently
|
||||
*/
|
||||
@Subscribe
|
||||
private void onWidgetHiddenChanged(WidgetHiddenChanged widgetHiddenChanged)
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN
|
||||
@@ -183,6 +171,7 @@ public class BanListPlugin extends Plugin
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onClanMemberJoined(ClanMemberJoined event)
|
||||
{
|
||||
ClanMember member = event.getMember();
|
||||
@@ -213,6 +202,7 @@ public class BanListPlugin extends Plugin
|
||||
/**
|
||||
* If a trade window is opened and the person trading us is on the list, modify "trading with"
|
||||
*/
|
||||
@Subscribe
|
||||
private void onWidgetLoaded(WidgetLoaded widgetLoaded)
|
||||
{
|
||||
if (this.highlightInTrade && widgetLoaded.getGroupId() == PLAYER_TRADE_SCREEN_GROUP_ID)
|
||||
@@ -234,6 +224,7 @@ public class BanListPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameTick(GameTick event)
|
||||
{
|
||||
final Widget raidingParty = client.getWidget(WidgetInfo.THEATRE_OF_BLOOD_RAIDING_PARTY);
|
||||
|
||||
@@ -27,6 +27,13 @@
|
||||
package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Stroke;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Perspective;
|
||||
@@ -39,14 +46,6 @@ import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Stroke;
|
||||
import java.awt.BasicStroke;
|
||||
import java.util.Map;
|
||||
|
||||
@Singleton
|
||||
class AboveSceneOverlay extends Overlay
|
||||
{
|
||||
@@ -56,10 +55,10 @@ class AboveSceneOverlay extends Overlay
|
||||
private static final int EGG_DIAMETER = Perspective.LOCAL_HALF_TILE_SIZE / 4;
|
||||
private static final Color HEALTH_BAR_COLOR = new Color(225, 35, 0, 125);
|
||||
private static final ImmutableMap<WidgetInfo, Point> TEAMMATES = ImmutableMap.of(
|
||||
WidgetInfo.BA_HEAL_TEAMMATE1, new Point(28, 2),
|
||||
WidgetInfo.BA_HEAL_TEAMMATE2, new Point(26, 2),
|
||||
WidgetInfo.BA_HEAL_TEAMMATE3, new Point(26, 2),
|
||||
WidgetInfo.BA_HEAL_TEAMMATE4, new Point(25, 2));
|
||||
WidgetInfo.BA_HEAL_TEAMMATE1, new Point(28, 2),
|
||||
WidgetInfo.BA_HEAL_TEAMMATE2, new Point(26, 2),
|
||||
WidgetInfo.BA_HEAL_TEAMMATE3, new Point(26, 2),
|
||||
WidgetInfo.BA_HEAL_TEAMMATE4, new Point(25, 2));
|
||||
|
||||
private final Client client;
|
||||
private final BarbarianAssaultPlugin game;
|
||||
@@ -124,9 +123,9 @@ class AboveSceneOverlay extends Overlay
|
||||
|
||||
graphics.setColor(HEALTH_BAR_COLOR);
|
||||
graphics.fillRect((widget.getCanvasLocation().getX() - teammate.getValue().getX()),
|
||||
(widget.getCanvasLocation().getY() - teammate.getValue().getY()),
|
||||
getBarWidth(Integer.parseInt(teammateHealth[1]), Integer.parseInt(teammateHealth[0])),
|
||||
HEALTH_BAR_HEIGHT);
|
||||
(widget.getCanvasLocation().getY() - teammate.getValue().getY()),
|
||||
getBarWidth(Integer.parseInt(teammateHealth[1]), Integer.parseInt(teammateHealth[0])),
|
||||
HEALTH_BAR_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Point;
|
||||
|
||||
@@ -45,6 +45,7 @@ public interface BarbarianAssaultConfig extends Config
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showTimer",
|
||||
name = "Show call change timer",
|
||||
@@ -223,7 +224,7 @@ public interface BarbarianAssaultConfig extends Config
|
||||
/*///************///*/
|
||||
/*/// Defender ///*/
|
||||
/*///************///*/
|
||||
|
||||
|
||||
@ConfigSection(
|
||||
name = "Defender",
|
||||
description = "",
|
||||
@@ -301,7 +302,7 @@ public interface BarbarianAssaultConfig extends Config
|
||||
/*///**********///*/
|
||||
/*/// Healer ///*/
|
||||
/*///**********///*/
|
||||
|
||||
|
||||
@ConfigSection(
|
||||
name = "Healer",
|
||||
description = "",
|
||||
|
||||
@@ -26,18 +26,17 @@
|
||||
package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.runelite.client.menus.AbstractComparableEntry;
|
||||
import net.runelite.client.menus.MenuManager;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
class BarbarianAssaultMenu
|
||||
{
|
||||
private final MenuManager menuManager;
|
||||
@@ -76,7 +75,7 @@ class BarbarianAssaultMenu
|
||||
void clearHiddenMenus()
|
||||
{
|
||||
// Clears menus from MenuManager and tracker
|
||||
for (Iterator<AbstractComparableEntry> iterator = tracker.iterator(); iterator.hasNext();)
|
||||
for (Iterator<AbstractComparableEntry> iterator = tracker.iterator(); iterator.hasNext(); )
|
||||
{
|
||||
menuManager.removeHiddenEntry(iterator.next());
|
||||
iterator.remove();
|
||||
@@ -119,7 +118,7 @@ class BarbarianAssaultMenu
|
||||
|
||||
case BLOCK_PENANCE_CAVE:
|
||||
return ((role != Role.DEFENDER && role != null) && game.isRemoveUnusedMenus())
|
||||
|| (role == Role.DEFENDER && game.isRemovePenanceCave());
|
||||
|| (role == Role.DEFENDER && game.isRemovePenanceCave());
|
||||
|
||||
case DUNK_LAVA_CRATER:
|
||||
case FIX:
|
||||
|
||||
@@ -82,7 +82,7 @@ import net.runelite.client.chat.ChatMessageBuilder;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.chat.QueuedMessage;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.input.KeyListener;
|
||||
@@ -122,6 +122,24 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
private static final ImmutableList<WidgetInfo> attackStyles = ImmutableList.of(WidgetInfo.COMBAT_STYLE_ONE,
|
||||
WidgetInfo.COMBAT_STYLE_TWO, WidgetInfo.COMBAT_STYLE_THREE, WidgetInfo.COMBAT_STYLE_FOUR);
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Map<WorldPoint, Integer> redEggs = new HashMap<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Map<WorldPoint, Integer> greenEggs = new HashMap<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Map<WorldPoint, Integer> blueEggs = new HashMap<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Map<WorldPoint, Integer> yellowEggs = new HashMap<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Map<Integer, Healer> healers = new HashMap<>();
|
||||
|
||||
private final List<TimerBox> deathTimes = new ArrayList<>();
|
||||
private final Map<Integer, Projectile> projectiles = new HashMap<>();
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@@ -155,102 +173,50 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
@Inject
|
||||
private KeyManager keyManager;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean inGame = false;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Wave wave = null;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Role role = null;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Scorecard scorecard = null;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Timer gameTimer = null;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Timer callTimer = null;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int stage = -1;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private BufferedImage clockImage;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Font font = null;
|
||||
|
||||
@Getter
|
||||
private final Map<WorldPoint, Integer> redEggs = new HashMap<>();
|
||||
|
||||
@Getter
|
||||
private final Map<WorldPoint, Integer> greenEggs = new HashMap<>();
|
||||
|
||||
@Getter
|
||||
private final Map<WorldPoint, Integer> blueEggs = new HashMap<>();
|
||||
|
||||
@Getter
|
||||
private final Map<WorldPoint, Integer> yellowEggs = new HashMap<>();
|
||||
|
||||
@Getter
|
||||
private final Map<Integer, Healer> healers = new HashMap<>();
|
||||
|
||||
@Getter
|
||||
private String lastCallText = null;
|
||||
|
||||
@Getter
|
||||
private String lastListenText = null;
|
||||
|
||||
// private String lastClickedTell = null;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private String lastCallText = null;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private String lastListenText = null;
|
||||
private int lastCallColor = -1;
|
||||
|
||||
private int lastInteracted = -1;
|
||||
|
||||
private int lastHealerPoisoned = -1;
|
||||
|
||||
private int tickNum = 0;
|
||||
|
||||
// private int gameTick = -1;
|
||||
|
||||
private int lastHealerPoisoned = -1;
|
||||
private int tickNum = 0;
|
||||
private int inGameBit = 0;
|
||||
|
||||
private boolean syncd = true;
|
||||
|
||||
private boolean tickReset = false;
|
||||
|
||||
private boolean hornCalled = false;
|
||||
|
||||
private boolean hornListened = false;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean usingGloryHorn = false;
|
||||
|
||||
private boolean shiftDown = false;
|
||||
|
||||
private boolean controlDown = false;
|
||||
|
||||
private BufferedImage torsoImage, fighterImage, healerImage, rangerImage, runnerImage;
|
||||
|
||||
private final List<TimerBox> deathTimes = new ArrayList<>();
|
||||
|
||||
private final Map<Integer, Projectile> projectiles = new HashMap<>();
|
||||
|
||||
private TimerBox tickCounter;
|
||||
|
||||
private String poisonUsed = null;
|
||||
|
||||
@Provides
|
||||
BarbarianAssaultConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(BarbarianAssaultConfig.class);
|
||||
}
|
||||
|
||||
// save config values
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean swapLadder;
|
||||
@@ -305,11 +271,16 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showEggCountOverlay;
|
||||
|
||||
@Provides
|
||||
BarbarianAssaultConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(BarbarianAssaultConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
protected void startUp()
|
||||
{
|
||||
updateConfig();
|
||||
addSubscriptions();
|
||||
|
||||
font = FontManager.getRunescapeFont().deriveFont(Font.BOLD, 24);
|
||||
torsoImage = itemManager.getImage(ItemID.FIGHTER_TORSO);
|
||||
@@ -325,10 +296,8 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
protected void shutDown()
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
|
||||
overlayManager.remove(widgetsOverlay);
|
||||
overlayManager.remove(sceneOverlay);
|
||||
keyManager.unregisterKeyListener(this);
|
||||
@@ -349,24 +318,6 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
menu.clearHiddenMenus();
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
|
||||
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
|
||||
eventBus.subscribe(ItemSpawned.class, this, this::onItemSpawned);
|
||||
eventBus.subscribe(ItemDespawned.class, this, this::onItemDespawned);
|
||||
eventBus.subscribe(GameTick.class, this, this::onGameTick);
|
||||
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
|
||||
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
|
||||
eventBus.subscribe(BeforeRender.class, this, this::onBeforeRender);
|
||||
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
|
||||
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
|
||||
eventBus.subscribe(InteractingChanged.class, this, this::onInteractingChanged);
|
||||
eventBus.subscribe(ProjectileSpawned.class, this, this::onProjectileSpawned);
|
||||
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e)
|
||||
{
|
||||
@@ -400,6 +351,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged configChanged)
|
||||
{
|
||||
//not client thread be careful
|
||||
@@ -422,7 +374,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
case "swapLadder":
|
||||
case "swapCollectorBag":
|
||||
case "swapDestroyEggs":
|
||||
if (Boolean.valueOf(configChanged.getNewValue()))
|
||||
if (Boolean.parseBoolean(configChanged.getNewValue()))
|
||||
{
|
||||
menu.enableSwaps();
|
||||
}
|
||||
@@ -510,6 +462,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
this.showEggCountOverlay = config.showEggCountOverlay();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
switch (event.getGroupId())
|
||||
@@ -580,6 +533,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onChatMessage(ChatMessage chatMessage)
|
||||
{
|
||||
if (!chatMessage.getType().equals(ChatMessageType.GAMEMESSAGE))
|
||||
@@ -629,7 +583,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
String[] tokens = message.split(" ");
|
||||
|
||||
int time = wave == null ? -1 : (int)wave.getWaveTimer().getElapsedTime();
|
||||
int time = wave == null ? -1 : (int) wave.getWaveTimer().getElapsedTime();
|
||||
|
||||
switch (tokens[4])
|
||||
{
|
||||
@@ -663,6 +617,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onItemSpawned(ItemSpawned itemSpawned)
|
||||
{
|
||||
if (!isInGame())
|
||||
@@ -682,6 +637,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onItemDespawned(ItemDespawned itemDespawned)
|
||||
{
|
||||
if (!isInGame())
|
||||
@@ -732,6 +688,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameTick(GameTick event)
|
||||
{
|
||||
// Keep in mind isInGame is delayed by a tick when a wave ends
|
||||
@@ -763,6 +720,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onNpcSpawned(NpcSpawned event)
|
||||
{
|
||||
if (!isInGame())
|
||||
@@ -785,6 +743,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onNpcDespawned(NpcDespawned event)
|
||||
{
|
||||
if (!isInGame())
|
||||
@@ -800,6 +759,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
// This was almost certainly a waste of time to get working, because almost nobody
|
||||
// actually uses the horn of glory. At least now there shouldn't be anyone complaining
|
||||
// about the horn of glory breaking anything and everything that should never break.
|
||||
@Subscribe
|
||||
private void onBeforeRender(BeforeRender event)
|
||||
{
|
||||
if (!isInGame())
|
||||
@@ -973,6 +933,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
// onMenuEntryAdded is being used for conditional entry changes that are not
|
||||
// easily achievable using MenuManager, all other changes use MenuManager in
|
||||
// the BarbarianAssaultMenu/Menus classes
|
||||
@Subscribe
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
if (!isInGame())
|
||||
@@ -1163,6 +1124,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
client.setMenuEntries(menu.toArray(new MenuEntry[0]));
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
if (!isInGame() && getRole() != null)
|
||||
@@ -1195,6 +1157,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
}
|
||||
|
||||
// Interacting changed has a slight delay until after the hitsplat is applied
|
||||
@Subscribe
|
||||
private void onInteractingChanged(InteractingChanged event)
|
||||
{
|
||||
if (!isInGame() || getRole() != Role.HEALER)
|
||||
@@ -1225,11 +1188,12 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
}
|
||||
else if (StringUtils.equals(opponent.getName(), "Penance Healer"))
|
||||
{
|
||||
lastInteracted = ((NPC)opponent).getIndex();
|
||||
lastInteracted = ((NPC) opponent).getIndex();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onProjectileSpawned(ProjectileSpawned event)
|
||||
{
|
||||
if (!isInGame())
|
||||
@@ -1246,10 +1210,11 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
|
||||
String name = target.getName();
|
||||
if ("Penance Fighter".equals(name) || "Penance Ranger".equals(name))
|
||||
{
|
||||
projectiles.put(((NPC)target).getIndex(), event.getProjectile());
|
||||
projectiles.put(((NPC) target).getIndex(), event.getProjectile());
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onVarbitChanged(VarbitChanged event)
|
||||
{
|
||||
int newInGameBit = client.getVar(Varbits.IN_GAME_BA);
|
||||
|
||||
@@ -26,32 +26,31 @@
|
||||
package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.NPC;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Data
|
||||
class Healer
|
||||
{
|
||||
@Getter(AccessLevel.NONE)
|
||||
private static final List<List<int[]>> CODES = ImmutableList.of(
|
||||
// ImmutableList.of(firstCallFood, secondCallFood, lastFoodTime),
|
||||
ImmutableList.of(new int[]{1, 1}, new int[]{0, 0}, new int[]{0, 0}),
|
||||
ImmutableList.of(new int[]{1, 1, 2}, new int[]{0, 0, 0}, new int[]{0, 0, 21}),
|
||||
ImmutableList.of(new int[]{1, 6, 2}, new int[]{0, 0, 0}, new int[]{0, 0, 0}),
|
||||
ImmutableList.of(new int[]{2, 5, 2, 0}, new int[]{0, 0, 7, 10}, new int[]{0, 0, 0, 0}),
|
||||
ImmutableList.of(new int[]{2, 5, 2, 3, 0}, new int[]{0, 0, 0, 0, 7}, new int[]{0, 0, 21, 30, 0}),
|
||||
ImmutableList.of(new int[]{3, 5, 2, 2, 0, 0}, new int[]{0, 0, 0, 2, 9, 10}, new int[]{12, 18, 21, 0, 0, 0}),
|
||||
ImmutableList.of(new int[]{3, 7, 1, 1, 0, 0, 0}, new int[]{2, 0, 1, 1, 2, 4, 10}, new int[]{0, 21, 0, 0, 30, 45, 0}),
|
||||
ImmutableList.of(new int[]{1, 9, 1, 1, 0, 0, 0}, new int[]{1, 0, 1, 1, 2, 2, 10}, new int[]{0, 0, 0, 0, 33, 42, 0}),
|
||||
ImmutableList.of(new int[]{2, 8, 1, 1, 0, 0, 0, 0}, new int[]{1, 0, 1, 1, 2, 1, 1, 10}, new int[]{0, 21, 0, 0, 0, 0, 0, 0, 0}),
|
||||
ImmutableList.of(new int[]{2, 5, 1, 1, 0, 0, 0}, new int[]{1, 0, 1, 1, 4, 4, 8}, new int[]{21, 33, 0, 33, 30, 45, 0}));
|
||||
// ImmutableList.of(firstCallFood, secondCallFood, lastFoodTime),
|
||||
ImmutableList.of(new int[]{1, 1}, new int[]{0, 0}, new int[]{0, 0}),
|
||||
ImmutableList.of(new int[]{1, 1, 2}, new int[]{0, 0, 0}, new int[]{0, 0, 21}),
|
||||
ImmutableList.of(new int[]{1, 6, 2}, new int[]{0, 0, 0}, new int[]{0, 0, 0}),
|
||||
ImmutableList.of(new int[]{2, 5, 2, 0}, new int[]{0, 0, 7, 10}, new int[]{0, 0, 0, 0}),
|
||||
ImmutableList.of(new int[]{2, 5, 2, 3, 0}, new int[]{0, 0, 0, 0, 7}, new int[]{0, 0, 21, 30, 0}),
|
||||
ImmutableList.of(new int[]{3, 5, 2, 2, 0, 0}, new int[]{0, 0, 0, 2, 9, 10}, new int[]{12, 18, 21, 0, 0, 0}),
|
||||
ImmutableList.of(new int[]{3, 7, 1, 1, 0, 0, 0}, new int[]{2, 0, 1, 1, 2, 4, 10}, new int[]{0, 21, 0, 0, 30, 45, 0}),
|
||||
ImmutableList.of(new int[]{1, 9, 1, 1, 0, 0, 0}, new int[]{1, 0, 1, 1, 2, 2, 10}, new int[]{0, 0, 0, 0, 33, 42, 0}),
|
||||
ImmutableList.of(new int[]{2, 8, 1, 1, 0, 0, 0, 0}, new int[]{1, 0, 1, 1, 2, 1, 1, 10}, new int[]{0, 21, 0, 0, 0, 0, 0, 0, 0}),
|
||||
ImmutableList.of(new int[]{2, 5, 1, 1, 0, 0, 0}, new int[]{1, 0, 1, 1, 4, 4, 8}, new int[]{21, 33, 0, 33, 30, 45, 0}));
|
||||
|
||||
private final NPC npc;
|
||||
|
||||
@@ -90,7 +89,7 @@ class Healer
|
||||
else
|
||||
{
|
||||
long time = Duration.between(timeLastPoisoned, Instant.now()).getSeconds();
|
||||
return time > 20 ? 0 : (int)(20 - time);
|
||||
return time > 20 ? 0 : (int) (20 - time);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,6 +26,7 @@
|
||||
package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
@@ -86,10 +87,10 @@ public enum Menus
|
||||
MEDIC_HORN(null, newBaseComparableEntry("medic", "r horn", -1, -1, true, false)),
|
||||
USE_HORN(null, newBaseComparableEntry("use", "r horn", -1, -1, true, false));
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Role role;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final BaseComparableEntry entry;
|
||||
|
||||
private static final ImmutableSet<Menus> ALL = ImmutableSet.copyOf(Menus.values());
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
@@ -39,90 +40,90 @@ import net.runelite.api.widgets.WidgetInfo;
|
||||
enum Role
|
||||
{
|
||||
ATTACKER(WidgetInfo.BA_ATK_WAVE_TEXT, WidgetInfo.BA_ATK_LISTEN_TOP_TEXT, WidgetInfo.BA_ATK_HORN_LISTEN_TEXT,
|
||||
WidgetInfo.BA_ATK_CALL_TEXT, WidgetInfo.BA_COLL_HORN_LISTEN_TEXT, WidgetInfo.BA_ATK_ROLE_TEXT,
|
||||
WidgetInfo.BA_ATK_ROLE_SPRITE),
|
||||
WidgetInfo.BA_ATK_CALL_TEXT, WidgetInfo.BA_COLL_HORN_LISTEN_TEXT, WidgetInfo.BA_ATK_ROLE_TEXT,
|
||||
WidgetInfo.BA_ATK_ROLE_SPRITE),
|
||||
DEFENDER(WidgetInfo.BA_DEF_WAVE_TEXT, WidgetInfo.BA_DEF_LISTEN_TEXT, WidgetInfo.BA_DEF_HORN_LISTEN_TEXT,
|
||||
WidgetInfo.BA_DEF_CALL_TEXT, WidgetInfo.BA_HEAL_HORN_LISTEN_TEXT, WidgetInfo.BA_DEF_ROLE_TEXT,
|
||||
WidgetInfo.BA_DEF_ROLE_SPRITE),
|
||||
WidgetInfo.BA_DEF_CALL_TEXT, WidgetInfo.BA_HEAL_HORN_LISTEN_TEXT, WidgetInfo.BA_DEF_ROLE_TEXT,
|
||||
WidgetInfo.BA_DEF_ROLE_SPRITE),
|
||||
COLLECTOR(WidgetInfo.BA_COLL_WAVE_TEXT, WidgetInfo.BA_COLL_LISTEN_TEXT, WidgetInfo.BA_COLL_HORN_LISTEN_TEXT,
|
||||
WidgetInfo.BA_COLL_CALL_TEXT, WidgetInfo.BA_ATK_HORN_LISTEN_TEXT, WidgetInfo.BA_COLL_ROLE_TEXT,
|
||||
WidgetInfo.BA_COLL_ROLE_SPRITE),
|
||||
WidgetInfo.BA_COLL_CALL_TEXT, WidgetInfo.BA_ATK_HORN_LISTEN_TEXT, WidgetInfo.BA_COLL_ROLE_TEXT,
|
||||
WidgetInfo.BA_COLL_ROLE_SPRITE),
|
||||
HEALER(WidgetInfo.BA_HEAL_WAVE_TEXT, WidgetInfo.BA_HEAL_LISTEN_TEXT, WidgetInfo.BA_DEF_HORN_LISTEN_TEXT,
|
||||
WidgetInfo.BA_HEAL_CALL_TEXT, WidgetInfo.BA_DEF_HORN_LISTEN_TEXT, WidgetInfo.BA_HEAL_ROLE_TEXT,
|
||||
WidgetInfo.BA_HEAL_ROLE_SPRITE);
|
||||
WidgetInfo.BA_HEAL_CALL_TEXT, WidgetInfo.BA_DEF_HORN_LISTEN_TEXT, WidgetInfo.BA_HEAL_ROLE_TEXT,
|
||||
WidgetInfo.BA_HEAL_ROLE_SPRITE);
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final WidgetInfo wave;
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final WidgetInfo listen;
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final WidgetInfo gloryListen;
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final WidgetInfo call;
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final WidgetInfo gloryCall;
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final WidgetInfo roleText;
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final WidgetInfo roleSprite;
|
||||
|
||||
// Duplicate* entries are to catch instances where the horn of glory has
|
||||
// text different than the normal horn
|
||||
private static final ImmutableMap<String, String> TELLS = ImmutableMap.<String, String>builder()
|
||||
.put("Red egg", "Tell-red")
|
||||
.put("Green egg", "Tell-green")
|
||||
.put("Blue egg", "Tell-blue")
|
||||
.put("Controlled/Bullet/Wind", "Tell-controlled")
|
||||
.put("Accurate/Field/Water", "Tell-accurate")
|
||||
.put("Aggressive/Blunt/Earth", "Tell-aggressive")
|
||||
.put("Defensive/Barbed/Fire", "Tell-defensive")
|
||||
.put("Tofu", "Tell-tofu")
|
||||
.put("Crackers", "Tell-crackers")
|
||||
.put("Worms", "Tell-worms")
|
||||
.put("Poison Worms", "Tell-worms")
|
||||
.put("Pois. Worms", "Tell-worms")
|
||||
.put("Poison Tofu", "Tell-tofu")
|
||||
.put("Pois. Tofu", "Tell-tofu")
|
||||
.put("Poison Meat", "Tell-meat")
|
||||
.put("Pois. Meat", "Tell-meat")
|
||||
.build();
|
||||
.put("Red egg", "Tell-red")
|
||||
.put("Green egg", "Tell-green")
|
||||
.put("Blue egg", "Tell-blue")
|
||||
.put("Controlled/Bullet/Wind", "Tell-controlled")
|
||||
.put("Accurate/Field/Water", "Tell-accurate")
|
||||
.put("Aggressive/Blunt/Earth", "Tell-aggressive")
|
||||
.put("Defensive/Barbed/Fire", "Tell-defensive")
|
||||
.put("Tofu", "Tell-tofu")
|
||||
.put("Crackers", "Tell-crackers")
|
||||
.put("Worms", "Tell-worms")
|
||||
.put("Poison Worms", "Tell-worms")
|
||||
.put("Pois. Worms", "Tell-worms")
|
||||
.put("Poison Tofu", "Tell-tofu")
|
||||
.put("Pois. Tofu", "Tell-tofu")
|
||||
.put("Poison Meat", "Tell-meat")
|
||||
.put("Pois. Meat", "Tell-meat")
|
||||
.build();
|
||||
private static final ImmutableMap<String, String> GLORY_CALLS = ImmutableMap.<String, String>builder()
|
||||
.put("Controlled/Bullet/Wind", "Controlled/")
|
||||
.put("Accurate/Field/Water", "Accurate/")
|
||||
.put("Aggressive/Blunt/Earth", "Aggressive/")
|
||||
.put("Defensive/Barbed/Fire", "Defensive/")
|
||||
.put("Tofu", "Tofu")
|
||||
.put("Crackers", "Crackers")
|
||||
.put("Worms", "Worms")
|
||||
.put("Poison worms", "Pois. Worms")
|
||||
.put("Poison tofu", "Pois. Tofu")
|
||||
.put("Poison meat", "Pois. Meat")
|
||||
.put("Red egg", "Red egg")
|
||||
.put("Green egg", "Green egg")
|
||||
.put("Blue egg", "Blue egg")
|
||||
.build();
|
||||
.put("Controlled/Bullet/Wind", "Controlled/")
|
||||
.put("Accurate/Field/Water", "Accurate/")
|
||||
.put("Aggressive/Blunt/Earth", "Aggressive/")
|
||||
.put("Defensive/Barbed/Fire", "Defensive/")
|
||||
.put("Tofu", "Tofu")
|
||||
.put("Crackers", "Crackers")
|
||||
.put("Worms", "Worms")
|
||||
.put("Poison worms", "Pois. Worms")
|
||||
.put("Poison tofu", "Pois. Tofu")
|
||||
.put("Poison meat", "Pois. Meat")
|
||||
.put("Red egg", "Red egg")
|
||||
.put("Green egg", "Green egg")
|
||||
.put("Blue egg", "Blue egg")
|
||||
.build();
|
||||
private static final ImmutableMap<String, Integer> ITEMS = ImmutableMap.<String, Integer>builder()
|
||||
.put("Tofu", ItemID.TOFU)
|
||||
.put("Crackers", ItemID.CRACKERS)
|
||||
.put("Worms", ItemID.WORMS)
|
||||
.put("Pois. Worms", ItemID.POISONED_WORMS)
|
||||
.put("Pois. Tofu", ItemID.POISONED_TOFU)
|
||||
.put("Pois. Meat", ItemID.POISONED_MEAT)
|
||||
.put("Defensive/", ItemID.BARBED_ARROW)
|
||||
.put("Aggressive/", ItemID.BLUNT_ARROW)
|
||||
.put("Accurate/", ItemID.FIELD_ARROW)
|
||||
.put("Controlled/", ItemID.BULLET_ARROW)
|
||||
.build();
|
||||
.put("Tofu", ItemID.TOFU)
|
||||
.put("Crackers", ItemID.CRACKERS)
|
||||
.put("Worms", ItemID.WORMS)
|
||||
.put("Pois. Worms", ItemID.POISONED_WORMS)
|
||||
.put("Pois. Tofu", ItemID.POISONED_TOFU)
|
||||
.put("Pois. Meat", ItemID.POISONED_MEAT)
|
||||
.put("Defensive/", ItemID.BARBED_ARROW)
|
||||
.put("Aggressive/", ItemID.BLUNT_ARROW)
|
||||
.put("Accurate/", ItemID.FIELD_ARROW)
|
||||
.put("Controlled/", ItemID.BULLET_ARROW)
|
||||
.build();
|
||||
private static final ImmutableMap<String, String> SPLIT_LISTENS = ImmutableMap.<String, String>builder()
|
||||
.put("Controlled/", "Bullet/Wind")
|
||||
.put("Bullet/Wind", "Controlled/")
|
||||
.put("Accurate/", "Field/Water")
|
||||
.put("Field/Water", "Accurate/")
|
||||
.put("Aggressive/", "Blunt/Earth")
|
||||
.put("Blunt/Earth", "Aggressive/")
|
||||
.put("Defensive/", "Barbed/Fire")
|
||||
.put("Barbed/Fire", "Defensive/")
|
||||
.build();
|
||||
.put("Controlled/", "Bullet/Wind")
|
||||
.put("Bullet/Wind", "Controlled/")
|
||||
.put("Accurate/", "Field/Water")
|
||||
.put("Field/Water", "Accurate/")
|
||||
.put("Aggressive/", "Blunt/Earth")
|
||||
.put("Blunt/Earth", "Aggressive/")
|
||||
.put("Defensive/", "Barbed/Fire")
|
||||
.put("Barbed/Fire", "Defensive/")
|
||||
.build();
|
||||
|
||||
|
||||
int getListenItem(String listen)
|
||||
|
||||
@@ -27,7 +27,6 @@ package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
|
||||
@@ -24,13 +24,12 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
|
||||
class Timer
|
||||
{
|
||||
|
||||
@@ -25,14 +25,13 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBox;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class TimerBox extends InfoBox
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import java.awt.Color;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
@@ -35,38 +36,36 @@ import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.chat.ChatMessageBuilder;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
@Data
|
||||
public class Wave
|
||||
{
|
||||
@Getter(AccessLevel.NONE)
|
||||
private static final ImmutableList<WidgetInfo> WIDGETS = ImmutableList.of(
|
||||
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS,
|
||||
WidgetInfo.BA_RUNNERS_PASSED,
|
||||
WidgetInfo.BA_EGGS_COLLECTED,
|
||||
WidgetInfo.BA_HITPOINTS_REPLENISHED,
|
||||
WidgetInfo.BA_WRONG_POISON_PACKS,
|
||||
WidgetInfo.BA_HONOUR_POINTS_REWARD
|
||||
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS,
|
||||
WidgetInfo.BA_RUNNERS_PASSED,
|
||||
WidgetInfo.BA_EGGS_COLLECTED,
|
||||
WidgetInfo.BA_HITPOINTS_REPLENISHED,
|
||||
WidgetInfo.BA_WRONG_POISON_PACKS,
|
||||
WidgetInfo.BA_HONOUR_POINTS_REWARD
|
||||
);
|
||||
|
||||
@Getter(AccessLevel.NONE)
|
||||
private static final ImmutableList<WidgetInfo> POINTSWIDGETS = ImmutableList.of(
|
||||
//Base
|
||||
WidgetInfo.BA_BASE_POINTS,
|
||||
//Attacker
|
||||
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS_POINTS,
|
||||
WidgetInfo.BA_RANGERS_KILLED,
|
||||
WidgetInfo.BA_FIGHTERS_KILLED,
|
||||
//Defender
|
||||
WidgetInfo.BA_RUNNERS_PASSED_POINTS,
|
||||
WidgetInfo.BA_RUNNERS_KILLED,
|
||||
//Collector
|
||||
WidgetInfo.BA_EGGS_COLLECTED_POINTS,
|
||||
//Healer
|
||||
WidgetInfo.BA_HEALERS_KILLED,
|
||||
WidgetInfo.BA_HITPOINTS_REPLENISHED_POINTS,
|
||||
WidgetInfo.BA_WRONG_POISON_PACKS_POINTS
|
||||
//Base
|
||||
WidgetInfo.BA_BASE_POINTS,
|
||||
//Attacker
|
||||
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS_POINTS,
|
||||
WidgetInfo.BA_RANGERS_KILLED,
|
||||
WidgetInfo.BA_FIGHTERS_KILLED,
|
||||
//Defender
|
||||
WidgetInfo.BA_RUNNERS_PASSED_POINTS,
|
||||
WidgetInfo.BA_RUNNERS_KILLED,
|
||||
//Collector
|
||||
WidgetInfo.BA_EGGS_COLLECTED_POINTS,
|
||||
//Healer
|
||||
WidgetInfo.BA_HEALERS_KILLED,
|
||||
WidgetInfo.BA_HITPOINTS_REPLENISHED_POINTS,
|
||||
WidgetInfo.BA_WRONG_POISON_PACKS_POINTS
|
||||
);
|
||||
|
||||
@Getter(AccessLevel.NONE)
|
||||
|
||||
@@ -54,7 +54,7 @@ import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
@@ -101,7 +101,7 @@ public class BarrowsPlugin extends Plugin
|
||||
private LoopTimer barrowsPrayerDrainTimer;
|
||||
private boolean wasInCrypt = false;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Widget puzzleAnswer;
|
||||
|
||||
@Inject
|
||||
@@ -125,15 +125,6 @@ public class BarrowsPlugin extends Plugin
|
||||
@Inject
|
||||
private BarrowsConfig config;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Provides
|
||||
BarrowsConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(BarrowsConfig.class);
|
||||
}
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showMinimap;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@@ -146,11 +137,16 @@ public class BarrowsPlugin extends Plugin
|
||||
private boolean showPuzzleAnswer;
|
||||
private boolean showPrayerDrainTimer;
|
||||
|
||||
@Provides
|
||||
BarrowsConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(BarrowsConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
protected void startUp()
|
||||
{
|
||||
updateConfig();
|
||||
addSubscriptions();
|
||||
|
||||
overlayManager.add(barrowsOverlay);
|
||||
overlayManager.add(brotherOverlay);
|
||||
@@ -159,8 +155,6 @@ public class BarrowsPlugin extends Plugin
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
|
||||
overlayManager.remove(barrowsOverlay);
|
||||
overlayManager.remove(brotherOverlay);
|
||||
walls.clear();
|
||||
@@ -183,19 +177,7 @@ public class BarrowsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
eventBus.subscribe(WallObjectSpawned.class, this, this::onWallObjectSpawned);
|
||||
eventBus.subscribe(WallObjectChanged.class, this, this::onWallObjectChanged);
|
||||
eventBus.subscribe(WallObjectDespawned.class, this, this::onWallObjectDespawned);
|
||||
eventBus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
|
||||
eventBus.subscribe(GameObjectChanged.class, this, this::onGameObjectChanged);
|
||||
eventBus.subscribe(GameObjectDespawned.class, this, this::onGameObjectDespawned);
|
||||
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
|
||||
eventBus.subscribe(WidgetLoaded.class, this, this::onWidgetLoaded);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("barrows"))
|
||||
@@ -219,6 +201,7 @@ public class BarrowsPlugin extends Plugin
|
||||
this.showPrayerDrainTimer = config.showPrayerDrainTimer();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onWallObjectSpawned(WallObjectSpawned event)
|
||||
{
|
||||
WallObject wallObject = event.getWallObject();
|
||||
@@ -228,6 +211,7 @@ public class BarrowsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onWallObjectChanged(WallObjectChanged event)
|
||||
{
|
||||
WallObject previous = event.getPrevious();
|
||||
@@ -240,12 +224,14 @@ public class BarrowsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onWallObjectDespawned(WallObjectDespawned event)
|
||||
{
|
||||
WallObject wallObject = event.getWallObject();
|
||||
walls.remove(wallObject);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameObjectSpawned(GameObjectSpawned event)
|
||||
{
|
||||
GameObject gameObject = event.getGameObject();
|
||||
@@ -255,6 +241,7 @@ public class BarrowsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameObjectChanged(GameObjectChanged event)
|
||||
{
|
||||
GameObject previous = event.getPrevious();
|
||||
@@ -267,12 +254,14 @@ public class BarrowsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameObjectDespawned(GameObjectDespawned event)
|
||||
{
|
||||
GameObject gameObject = event.getGameObject();
|
||||
ladders.remove(gameObject);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState() == GameState.LOADING)
|
||||
@@ -297,6 +286,7 @@ public class BarrowsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (event.getGroupId() == WidgetID.BARROWS_PUZZLE_GROUP_ID)
|
||||
|
||||
@@ -40,6 +40,7 @@ import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.menus.AbstractComparableEntry;
|
||||
import net.runelite.client.menus.MenuManager;
|
||||
@@ -80,12 +81,16 @@ public class BlackjackPlugin extends Plugin
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private BlackjackConfig config;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Inject
|
||||
private MenuManager menuManager;
|
||||
|
||||
private boolean pickpocketOnAggro;
|
||||
private boolean random;
|
||||
private long nextKnockOutTick = 0;
|
||||
@@ -97,26 +102,24 @@ public class BlackjackPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
protected void startUp()
|
||||
{
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
|
||||
menuManager.addPriorityEntry(KNOCKOUT_BANDIT);
|
||||
menuManager.addPriorityEntry(KNOCKOUT_MENAPHITE);
|
||||
this.pickpocketOnAggro = config.pickpocketOnAggro();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
protected void shutDown()
|
||||
{
|
||||
menuManager.removePriorityEntry(PICKPOCKET_BANDIT);
|
||||
menuManager.removePriorityEntry(PICKPOCKET_MENAPHITE);
|
||||
menuManager.removePriorityEntry(KNOCKOUT_BANDIT);
|
||||
menuManager.removePriorityEntry(KNOCKOUT_MENAPHITE);
|
||||
eventBus.unregister(this);
|
||||
eventBus.unregister("poll");
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState() != GameState.LOGGED_IN || !ArrayUtils.contains(client.getMapRegions(), POLLNIVNEACH_REGION))
|
||||
@@ -129,6 +132,7 @@ public class BlackjackPlugin extends Plugin
|
||||
eventBus.subscribe(ChatMessage.class, "poll", this::onChatMessage);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("blackjack"))
|
||||
@@ -183,7 +187,7 @@ public class BlackjackPlugin extends Plugin
|
||||
{
|
||||
return
|
||||
Text.removeTags(entry.getTarget(), true).equalsIgnoreCase(this.getTarget()) &&
|
||||
entry.getOption().equalsIgnoreCase(this.getOption());
|
||||
entry.getOption().equalsIgnoreCase(this.getOption());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ package net.runelite.client.plugins.blastfurnace;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import java.util.Map;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.Varbits;
|
||||
@@ -64,9 +65,9 @@ public enum BarsOres
|
||||
VARBIT = builder.build();
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Varbits varbit;
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final int itemID;
|
||||
|
||||
BarsOres(Varbits varbit, int itemID)
|
||||
|
||||
@@ -38,8 +38,8 @@ import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
import net.runelite.client.ui.overlay.OverlayMenuEntry;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||
import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
||||
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@Singleton
|
||||
|
||||
@@ -46,7 +46,7 @@ import net.runelite.api.util.Text;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
@@ -97,19 +97,15 @@ public class BlastFurnacePlugin extends Plugin
|
||||
@Inject
|
||||
private BlastFurnaceConfig config;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showConveyorBelt;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showBarDispenser;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
protected void startUp()
|
||||
{
|
||||
updateConfig();
|
||||
addSubscriptions();
|
||||
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.add(cofferOverlay);
|
||||
@@ -119,8 +115,6 @@ public class BlastFurnacePlugin extends Plugin
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
|
||||
infoBoxManager.removeIf(ForemanTimer.class::isInstance);
|
||||
overlayManager.remove(overlay);
|
||||
overlayManager.remove(cofferOverlay);
|
||||
@@ -130,21 +124,13 @@ public class BlastFurnacePlugin extends Plugin
|
||||
foremanTimer = null;
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
eventBus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
|
||||
eventBus.subscribe(GameObjectDespawned.class, this, this::onGameObjectDespawned);
|
||||
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
|
||||
eventBus.subscribe(GameTick.class, this, this::onGameTick);
|
||||
}
|
||||
|
||||
@Provides
|
||||
BlastFurnaceConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(BlastFurnaceConfig.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (event.getGroup().equals("blastfurnace"))
|
||||
@@ -153,6 +139,7 @@ public class BlastFurnacePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameObjectSpawned(GameObjectSpawned event)
|
||||
{
|
||||
GameObject gameObject = event.getGameObject();
|
||||
@@ -169,6 +156,7 @@ public class BlastFurnacePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameObjectDespawned(GameObjectDespawned event)
|
||||
{
|
||||
GameObject gameObject = event.getGameObject();
|
||||
@@ -185,6 +173,7 @@ public class BlastFurnacePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState() == GameState.LOADING)
|
||||
@@ -194,6 +183,7 @@ public class BlastFurnacePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameTick(GameTick event)
|
||||
{
|
||||
Widget npcDialog = client.getWidget(WidgetInfo.DIALOG_NPC_TEXT);
|
||||
|
||||
@@ -42,7 +42,7 @@ import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
@@ -73,15 +73,6 @@ public class BlastMinePlugin extends Plugin
|
||||
@Inject
|
||||
private BlastMinePluginConfig config;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Provides
|
||||
BlastMinePluginConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(BlastMinePluginConfig.class);
|
||||
}
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean showOreOverlay;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@@ -95,21 +86,24 @@ public class BlastMinePlugin extends Plugin
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private Color warningColor;
|
||||
|
||||
@Provides
|
||||
BlastMinePluginConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(BlastMinePluginConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
protected void startUp()
|
||||
{
|
||||
updateConfig();
|
||||
addSubscriptions();
|
||||
|
||||
overlayManager.add(blastMineRockOverlay);
|
||||
overlayManager.add(blastMineOreCountOverlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
protected void shutDown()
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
|
||||
overlayManager.remove(blastMineRockOverlay);
|
||||
overlayManager.remove(blastMineOreCountOverlay);
|
||||
final Widget blastMineWidget = client.getWidget(WidgetInfo.BLAST_MINE);
|
||||
@@ -120,13 +114,7 @@ public class BlastMinePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(GameObjectSpawned.class, this, this::onGameObjectSpawned);
|
||||
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
|
||||
eventBus.subscribe(GameTick.class, this, this::onGameTick);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameObjectSpawned(GameObjectSpawned event)
|
||||
{
|
||||
final GameObject gameObject = event.getGameObject();
|
||||
@@ -145,6 +133,7 @@ public class BlastMinePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
if (event.getGameState() == GameState.LOADING)
|
||||
@@ -153,6 +142,7 @@ public class BlastMinePlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameTick(GameTick gameTick)
|
||||
{
|
||||
if (rocks.isEmpty())
|
||||
|
||||
@@ -100,7 +100,7 @@ public interface BoostsConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "displayNextBuffChange",
|
||||
name = "Display next buff change",
|
||||
|
||||
@@ -39,13 +39,13 @@ import net.runelite.api.Client;
|
||||
import net.runelite.api.Constants;
|
||||
import net.runelite.api.Prayer;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.StatChanged;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.events.ConfigChanged;
|
||||
import net.runelite.client.game.SkillIconManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -73,6 +73,11 @@ public class BoostsPlugin extends Plugin
|
||||
Skill.COOKING, Skill.CRAFTING, Skill.FIREMAKING, Skill.FLETCHING, Skill.WOODCUTTING, Skill.RUNECRAFT,
|
||||
Skill.SLAYER, Skill.FARMING, Skill.CONSTRUCTION, Skill.HUNTER);
|
||||
|
||||
@Getter
|
||||
private final Set<Skill> shownSkills = new LinkedHashSet<>();
|
||||
private final int[] lastSkillLevels = new int[Skill.values().length - 1];
|
||||
private final List<String> boostedSkillsChanged = new ArrayList<>();
|
||||
|
||||
@Inject
|
||||
private Notifier notifier;
|
||||
|
||||
@@ -88,28 +93,21 @@ public class BoostsPlugin extends Plugin
|
||||
@Inject
|
||||
private BoostsOverlay boostsOverlay;
|
||||
|
||||
//made this a LinkedHashSet so the order stays consistent for my OCD
|
||||
@Getter
|
||||
private final Set<Skill> shownSkills = new LinkedHashSet<>();
|
||||
@Inject
|
||||
private BoostsConfig config;
|
||||
|
||||
@Inject
|
||||
private SkillIconManager skillIconManager;
|
||||
|
||||
@Inject
|
||||
private CombatIconsOverlay combatIconsOverlay;
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
private boolean isChangedDown = false;
|
||||
private boolean isChangedUp = false;
|
||||
private final int[] lastSkillLevels = new int[Skill.values().length - 1];
|
||||
private int lastChangeDown = -1;
|
||||
private int lastChangeUp = -1;
|
||||
private boolean preserveBeenActive = false;
|
||||
private long lastTickMillis;
|
||||
private final List<String> boostedSkillsChanged = new ArrayList<>();
|
||||
|
||||
private BoostsConfig.DisplayBoosts displayBoosts;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean useRelativeBoost;
|
||||
@@ -132,10 +130,9 @@ public class BoostsPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
protected void startUp()
|
||||
{
|
||||
updateConfig();
|
||||
addSubscriptions();
|
||||
|
||||
overlayManager.add(boostsOverlay);
|
||||
overlayManager.add(combatIconsOverlay);
|
||||
@@ -157,9 +154,8 @@ public class BoostsPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
protected void shutDown()
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
overlayManager.remove(boostsOverlay);
|
||||
overlayManager.remove(combatIconsOverlay);
|
||||
infoBoxManager.removeIf(t -> t instanceof BoostIndicator || t instanceof StatChangeIndicator);
|
||||
@@ -170,14 +166,7 @@ public class BoostsPlugin extends Plugin
|
||||
isChangedDown = false;
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
|
||||
eventBus.subscribe(StatChanged.class, this, this::onStatChanged);
|
||||
eventBus.subscribe(GameTick.class, this, this::onGameTick);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
switch (event.getGameState())
|
||||
@@ -190,6 +179,7 @@ public class BoostsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (!event.getGroup().equals("boosts"))
|
||||
@@ -211,6 +201,7 @@ public class BoostsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onStatChanged(StatChanged statChanged)
|
||||
{
|
||||
Skill skill = statChanged.getSkill();
|
||||
@@ -260,6 +251,7 @@ public class BoostsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameTick(GameTick event)
|
||||
{
|
||||
lastTickMillis = System.currentTimeMillis();
|
||||
|
||||
@@ -11,6 +11,7 @@ import net.runelite.api.Client;
|
||||
import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.client.game.SkillIconManager;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
import net.runelite.client.ui.overlay.OverlayMenuEntry;
|
||||
@@ -20,7 +21,6 @@ import net.runelite.client.ui.overlay.components.ComponentOrientation;
|
||||
import net.runelite.client.ui.overlay.components.ImageComponent;
|
||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
|
||||
@@ -51,12 +51,12 @@ class CombatIconsOverlay extends Overlay
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (plugin.isBoldIconFont())
|
||||
{
|
||||
graphics.setFont(FontManager.getRunescapeBoldFont());
|
||||
}
|
||||
|
||||
|
||||
panelComponent.getChildren().clear();
|
||||
panelComponent.setPreferredSize(new Dimension(28, 0));
|
||||
panelComponent.setWrapping(2);
|
||||
|
||||
@@ -30,7 +30,7 @@ import javax.inject.Singleton;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.events.NpcDespawned;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -51,22 +51,13 @@ public class BossTimersPlugin extends Plugin
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
protected void shutDown()
|
||||
{
|
||||
eventBus.subscribe(NpcDespawned.class, this, this::onNpcDespawned);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
infoBoxManager.removeIf(t -> t instanceof RespawnTimer);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onNpcDespawned(NpcDespawned npcDespawned)
|
||||
{
|
||||
NPC npc = npcDespawned.getNpc();
|
||||
|
||||
@@ -24,20 +24,19 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.bosstimetracker;
|
||||
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBox;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBox;
|
||||
|
||||
public class BossTimeTracker extends InfoBox
|
||||
{
|
||||
private final Instant startTime;
|
||||
private LocalTime time;
|
||||
private Instant lastTime;
|
||||
private final Instant lastTime;
|
||||
|
||||
public BossTimeTracker(BufferedImage image, BossTimeTrackerPlugin plugin, Instant startTime, Instant lastTime)
|
||||
{
|
||||
@@ -81,10 +80,7 @@ public class BossTimeTracker extends InfoBox
|
||||
@Override
|
||||
public String getTooltip()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("Elapsed time: ");
|
||||
builder.append(time.format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
|
||||
return builder.toString();
|
||||
return "Elapsed time: " +
|
||||
time.format(DateTimeFormatter.ofPattern("HH:mm:ss"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,29 +24,28 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.bosstimetracker;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.Arrays;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.ItemID.FIRE_CAPE;
|
||||
import static net.runelite.api.ItemID.INFERNAL_CAPE;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Boss Time Tracker",
|
||||
@@ -78,10 +77,7 @@ public class BossTimeTrackerPlugin extends Plugin
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Getter
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private BossTimeTracker timer;
|
||||
|
||||
private Instant startTime;
|
||||
@@ -89,12 +85,7 @@ public class BossTimeTrackerPlugin extends Plugin
|
||||
private Boolean started = false;
|
||||
private boolean loggingIn;
|
||||
|
||||
@Override
|
||||
public void startUp()
|
||||
{
|
||||
addSubscriptions();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged event)
|
||||
{
|
||||
switch (event.getGameState())
|
||||
@@ -127,6 +118,7 @@ public class BossTimeTrackerPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onChatMessage(ChatMessage event)
|
||||
{
|
||||
if (event.getType() != ChatMessageType.GAMEMESSAGE && event.getType() != ChatMessageType.SPAM)
|
||||
@@ -242,20 +234,13 @@ public class BossTimeTrackerPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
protected void shutDown()
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
removeTimer();
|
||||
resetConfig();
|
||||
resetVars();
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
|
||||
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
|
||||
}
|
||||
|
||||
private void loadConfig()
|
||||
{
|
||||
startTime = configManager.getConfiguration(CONFIG_GROUP, CONFIG_TIME, Instant.class);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user