Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Owain van Brakel
2019-11-27 21:17:39 +01:00
560 changed files with 2726 additions and 3094 deletions

View File

@@ -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();
}

View File

@@ -238,7 +238,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()
{
@@ -308,7 +308,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;

View File

@@ -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;

View File

@@ -139,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
*/

View File

@@ -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
{

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;

View File

@@ -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)

View File

@@ -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,19 +19,23 @@ 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 extends Event> Relay<Object> getSubject(Class<T> eventClass)
{
@@ -47,34 +55,65 @@ public class EventBus implements EventBusInterface
return compositeDisposable;
}
@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)
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 extends Event> 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);

View File

@@ -10,6 +10,8 @@ public interface EventBusInterface
<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 extends Event> void post(Class<? extends T> eventClass, @NonNull T event);

View File

@@ -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;
}
}

View File

@@ -36,4 +36,9 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
@Documented
public @interface Subscribe {}
public @interface Subscribe
{
int takeUntil() default -1;
EventScheduler subscribe() default EventScheduler.DEFAULT;
EventScheduler observe() default EventScheduler.DEFAULT;
}

View File

@@ -59,7 +59,7 @@ public class Flexo extends Robot
public static final int fixedWidth = Constants.GAME_FIXED_WIDTH;
public static final int fixedHeight = Constants.GAME_FIXED_HEIGHT;
public static boolean isStretched;
public static int minDelay = 45;
public static final int minDelay = 45;
public static MouseMotionFactory currentMouseMotionFactory;
public boolean pausedIndefinitely = false;
private Robot peer;
@@ -74,7 +74,7 @@ public class Flexo extends Robot
.getDefaultScreenDevice());
}
private void init(GraphicsDevice screen) throws AWTException
private void init(GraphicsDevice screen)
{
try
{

View File

@@ -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),

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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;

View File

@@ -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()

View File

@@ -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();

View File

@@ -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();

View File

@@ -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);

View File

@@ -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();

View File

@@ -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)
{

View File

@@ -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;

View File

@@ -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)

View File

@@ -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);

View File

@@ -36,6 +36,7 @@ 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
@@ -62,7 +63,7 @@ public abstract class Plugin implements Module
@SuppressWarnings("unchecked")
final void addAnnotatedSubscriptions(EventBus eventBus)
{
annotatedSubscriptions.forEach(sub -> eventBus.subscribe(sub.type, annotatedSubsLock, sub.method));
annotatedSubscriptions.forEach(sub -> eventBus.subscribe(sub.type, annotatedSubsLock, sub.method, sub.takeUntil, sub.subscribe, sub.observe));
}
final void removeAnnotatedSubscriptions(EventBus eventBus)
@@ -76,8 +77,11 @@ public abstract class Plugin implements Module
for (Method method : this.getClass().getDeclaredMethods())
{
if (method.getAnnotation(Subscribe.class) == null)
Subscribe annotation = method.getAnnotation(Subscribe.class);
if (annotation == null)
{
continue;
}
assert method.getParameterCount() == 1 : "Methods annotated with @Subscribe should have only one parameter";
@@ -88,7 +92,7 @@ public abstract class Plugin implements Module
method.setAccessible(true);
Subscription sub = new Subscription(type.asSubclass(Event.class), event -> method.invoke(this, event));
Subscription sub = new Subscription(type.asSubclass(Event.class), event -> method.invoke(this, event), annotation.takeUntil(), annotation.subscribe(), annotation.observe());
builder.add(sub);
}
@@ -101,5 +105,8 @@ public abstract class Plugin implements Module
{
private final Class type;
private final Consumer method;
private final int takeUntil;
private final EventScheduler subscribe;
private final EventScheduler observe;
}
}

View File

@@ -570,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

View File

@@ -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;

View File

@@ -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;

View File

@@ -79,16 +79,6 @@ public class DiaryRequirementsPlugin extends Plugin
@Inject
private ClientThread clientThread;
@Override
protected void startUp() throws Exception
{
}
@Override
protected void shutDown() throws Exception
{
}
@Subscribe
private void onWidgetLoaded(final WidgetLoaded event)
{

View File

@@ -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;

View File

@@ -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)

View File

@@ -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)

View File

@@ -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;

View File

@@ -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
{

View File

@@ -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;

View File

@@ -135,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;
@@ -167,8 +161,14 @@ 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();
@@ -183,7 +183,7 @@ public class AgilityPlugin extends Plugin
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
eventBus.unregister(MENU_SUBS);
@@ -255,7 +255,7 @@ public class AgilityPlugin extends Plugin
}
}
public void updateConfig()
private void updateConfig()
{
this.removeDistanceCap = config.removeDistanceCap();
this.showLapCount = config.showLapCount();

View File

@@ -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;

View File

@@ -70,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<>();
@@ -87,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;

View File

@@ -64,7 +64,7 @@ public class AmmoPlugin extends Plugin
private AmmoCounter counterBox;
@Override
protected void startUp() throws Exception
protected void startUp()
{
clientThread.invokeLater(() ->
@@ -79,7 +79,7 @@ public class AmmoPlugin extends Plugin
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
infoBoxManager.removeInfoBox(counterBox);
counterBox = null;

View File

@@ -58,13 +58,13 @@ public class AnimationSmoothingPlugin extends Plugin
}
@Override
protected void startUp() throws Exception
protected void startUp()
{
update();
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
client.setInterpolatePlayerAnimations(false);
client.setInterpolateNpcAnimations(false);

View File

@@ -74,20 +74,74 @@ public class AntiDragPlugin extends Plugin
@Inject
private KeyManager keyManager;
@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;
private final HotkeyListener toggleListener = new HotkeyListener(() -> this.key)
{
@Override
public void hotkeyPressed()
{
toggleDrag = !toggleDrag;
if (toggleDrag)
{
if (configOverlay)
{
overlayManager.add(overlay);
}
if (changeCursor)
{
clientUI.setCursor(selectedCursor.getCursorImage(), selectedCursor.toString());
}
client.setInventoryDragDelay(config.dragDelay());
}
else
{
overlayManager.remove(overlay);
client.setInventoryDragDelay(DEFAULT_DELAY);
clientUI.resetCursor();
}
}
};
private final HotkeyListener holdListener = new HotkeyListener(() -> this.key)
{
@Override
public void hotkeyPressed()
{
if (configOverlay)
{
overlayManager.add(overlay);
}
if (changeCursor)
{
clientUI.setCursor(selectedCursor.getCursorImage(), selectedCursor.toString());
}
client.setInventoryDragDelay(config.dragDelay());
}
@Override
public void hotkeyReleased()
{
overlayManager.remove(overlay);
client.setInventoryDragDelay(DEFAULT_DELAY);
clientUI.resetCursor();
}
};
@Provides
AntiDragConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(AntiDragConfig.class);
}
@Override
protected void startUp() throws Exception
protected void startUp()
{
overlay.setColor(config.color());
updateConfig();
@@ -100,7 +154,7 @@ public class AntiDragPlugin extends Plugin
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
client.setInventoryDragDelay(DEFAULT_DELAY);
keyManager.unregisterKeyListener(holdListener);
@@ -194,58 +248,4 @@ public class AntiDragPlugin extends Plugin
keyManager.unregisterKeyListener(toggleListener);
}
}
private final HotkeyListener toggleListener = new HotkeyListener(() -> this.key)
{
@Override
public void hotkeyPressed()
{
toggleDrag = !toggleDrag;
if (toggleDrag)
{
if (configOverlay)
{
overlayManager.add(overlay);
}
if (changeCursor)
{
clientUI.setCursor(selectedCursor.getCursorImage(), selectedCursor.toString());
}
client.setInventoryDragDelay(config.dragDelay());
}
else
{
overlayManager.remove(overlay);
client.setInventoryDragDelay(DEFAULT_DELAY);
clientUI.resetCursor();
}
}
};
private final HotkeyListener holdListener = new HotkeyListener(() -> this.key)
{
@Override
public void hotkeyPressed()
{
if (configOverlay)
{
overlayManager.add(overlay);
}
if (changeCursor)
{
clientUI.setCursor(selectedCursor.getCursorImage(), selectedCursor.toString());
}
client.setInventoryDragDelay(config.dragDelay());
}
@Override
public void hotkeyReleased()
{
overlayManager.remove(overlay);
client.setInventoryDragDelay(DEFAULT_DELAY);
clientUI.resetCursor();
}
};
}

View File

@@ -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
*/

View File

@@ -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
{

View File

@@ -72,30 +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;
@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)
@@ -176,7 +188,7 @@ public class AoeWarningPlugin extends Plugin
overlayManager.remove(coreOverlay);
overlayManager.remove(bombOverlay);
reset();
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)

View File

@@ -70,7 +70,7 @@ public class AttackStylesPlugin extends Plugin
private int attackStyleVarbit = -1;
private int equippedWeaponTypeVarbit = -1;
private int castingModeVarbit = -1;
@Getter
@Getter(AccessLevel.PACKAGE)
@Nullable
private AttackStyle attackStyle;
private final Set<Skill> warnedSkills = new HashSet<>();
@@ -112,7 +112,7 @@ public class AttackStylesPlugin extends Plugin
boolean removeWarnedStyles;
@Override
protected void startUp() throws Exception
protected void startUp()
{
updateConfig();

View File

@@ -160,7 +160,7 @@ public class BankPlugin extends Plugin
private boolean rightClickBankLoot;
@Override
protected void startUp() throws Exception
protected void startUp()
{
updateConfig();
searchString = "";

View File

@@ -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;

View File

@@ -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;
@@ -151,8 +153,6 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
private boolean shiftPressed = false;
private int nextRowIndex = 0;
@VisibleForTesting
Multiset<Integer> itemQuantities = HashMultiset.create();
@Provides
BankTagsConfig getConfig(ConfigManager configManager)
@@ -171,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()
{
@@ -224,19 +236,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
}
}
@Override
public void shutDown()
{
keyManager.unregisterKeyListener(this);
mouseManager.unregisterMouseWheelListener(this);
clientThread.invokeLater(tabInterface::destroy);
spriteManager.removeSpriteOverrides(TabSprites.values());
shiftPressed = false;
itemQuantities.clear();
}
private boolean isSearching()
private boolean isSearching()
{
return client.getVar(VarClientInt.INPUT_TYPE) == InputType.SEARCH.getType()
|| (client.getVar(VarClientInt.INPUT_TYPE) <= 0

View File

@@ -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

View File

@@ -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);

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -106,7 +106,7 @@ public class BanListPlugin extends Plugin
}
@Override
protected void startUp() throws Exception
protected void startUp()
{
updateConfig();
@@ -116,7 +116,7 @@ public class BanListPlugin extends Plugin
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
wdrScamSet.clear();

View File

@@ -55,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;
@@ -123,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);
}
}

View File

@@ -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 = "",

View File

@@ -75,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();
@@ -118,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:

View File

@@ -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,99 +173,50 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
@Inject
private KeyManager keyManager;
@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;
@@ -302,8 +271,14 @@ 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();
@@ -321,7 +296,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
overlayManager.remove(widgetsOverlay);
overlayManager.remove(sceneOverlay);
@@ -343,7 +318,7 @@ public class BarbarianAssaultPlugin extends Plugin implements KeyListener
menu.clearHiddenMenus();
}
@Override
@Override
public void keyTyped(KeyEvent e)
{
}
@@ -399,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();
}

View File

@@ -40,17 +40,17 @@ 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;
@@ -89,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);
}
}
}

View File

@@ -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());

View File

@@ -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)

View File

@@ -41,31 +41,31 @@ 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)

View File

@@ -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,12 +125,6 @@ public class BarrowsPlugin extends Plugin
@Inject
private BarrowsConfig config;
@Provides
BarrowsConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(BarrowsConfig.class);
}
@Getter(AccessLevel.PACKAGE)
private boolean showMinimap;
@Getter(AccessLevel.PACKAGE)
@@ -143,8 +137,14 @@ 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();

View File

@@ -81,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;
@@ -98,7 +102,7 @@ public class BlackjackPlugin extends Plugin
}
@Override
protected void startUp() throws Exception
protected void startUp()
{
menuManager.addPriorityEntry(KNOCKOUT_BANDIT);
menuManager.addPriorityEntry(KNOCKOUT_MENAPHITE);
@@ -106,7 +110,7 @@ public class BlackjackPlugin extends Plugin
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
menuManager.removePriorityEntry(PICKPOCKET_BANDIT);
menuManager.removePriorityEntry(PICKPOCKET_MENAPHITE);

View File

@@ -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)

View File

@@ -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

View File

@@ -103,7 +103,7 @@ public class BlastFurnacePlugin extends Plugin
private boolean showBarDispenser;
@Override
protected void startUp() throws Exception
protected void startUp()
{
updateConfig();
@@ -124,7 +124,7 @@ public class BlastFurnacePlugin extends Plugin
foremanTimer = null;
}
@Provides
@Provides
BlastFurnaceConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(BlastFurnaceConfig.class);

View File

@@ -73,12 +73,6 @@ public class BlastMinePlugin extends Plugin
@Inject
private BlastMinePluginConfig config;
@Provides
BlastMinePluginConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(BlastMinePluginConfig.class);
}
@Getter(AccessLevel.PACKAGE)
private boolean showOreOverlay;
@Getter(AccessLevel.PACKAGE)
@@ -92,8 +86,14 @@ 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();
@@ -102,7 +102,7 @@ public class BlastMinePlugin extends Plugin
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
overlayManager.remove(blastMineRockOverlay);
overlayManager.remove(blastMineOreCountOverlay);

View File

@@ -100,7 +100,7 @@ public interface BoostsConfig extends Config
{
return false;
}
@ConfigItem(
keyName = "displayNextBuffChange",
name = "Display next buff change",

View File

@@ -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,26 +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;
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;
@@ -130,7 +130,7 @@ public class BoostsPlugin extends Plugin
}
@Override
protected void startUp() throws Exception
protected void startUp()
{
updateConfig();
@@ -154,7 +154,7 @@ public class BoostsPlugin extends Plugin
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
overlayManager.remove(boostsOverlay);
overlayManager.remove(combatIconsOverlay);

View File

@@ -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);

View File

@@ -52,12 +52,7 @@ public class BossTimersPlugin extends Plugin
private ItemManager itemManager;
@Override
protected void startUp() throws Exception
{
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
infoBoxManager.removeIf(t -> t instanceof RespawnTimer);
}

View File

@@ -36,7 +36,7 @@ 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)
{
@@ -80,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"));
}
}

View File

@@ -30,6 +30,7 @@ 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;
@@ -76,7 +77,7 @@ public class BossTimeTrackerPlugin extends Plugin
@Inject
private ConfigManager configManager;
@Getter
@Getter(AccessLevel.PACKAGE)
private BossTimeTracker timer;
private Instant startTime;
@@ -84,11 +85,6 @@ public class BossTimeTrackerPlugin extends Plugin
private Boolean started = false;
private boolean loggingIn;
@Override
public void startUp()
{
}
@Subscribe
public void onGameStateChanged(GameStateChanged event)
{
@@ -238,14 +234,14 @@ public class BossTimeTrackerPlugin extends Plugin
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
removeTimer();
resetConfig();
resetVars();
}
private void loadConfig()
private void loadConfig()
{
startTime = configManager.getConfiguration(CONFIG_GROUP, CONFIG_TIME, Instant.class);
started = configManager.getConfiguration(CONFIG_GROUP, CONFIG_STARTED, Boolean.class);

View File

@@ -2,15 +2,15 @@ package net.runelite.client.plugins.bronzeman;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.client.game.ItemManager;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPosition;
import javax.inject.Inject;
import java.awt.image.BufferedImage;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
/**

View File

@@ -13,6 +13,7 @@ import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;
import javax.inject.Inject;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
@@ -60,7 +61,7 @@ public class BronzemanPlugin extends Plugin
private List<Integer> unlockedItems;
@Getter
@Getter(AccessLevel.PACKAGE)
private BufferedImage unlockImage = null;
/**
* Loads GrandExchange widgets for further manipulation of the interface
@@ -69,7 +70,7 @@ public class BronzemanPlugin extends Plugin
private Widget grandExchangeChatBox;
@Override
protected void startUp() throws Exception
protected void startUp()
{
loadUnlockImage();
unlockedItems = new ArrayList<>();
@@ -77,13 +78,13 @@ public class BronzemanPlugin extends Plugin
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
unlockedItems = null;
overlayManager.remove(bronzemanOverlay);
}
/**
/**
* Loads players unlocks on login
**/
@Subscribe
@@ -178,7 +179,7 @@ public class BronzemanPlugin extends Plugin
/**
* Queues a new unlock to be properly displayed
**/
public void queueItemUnlock(int itemId)
private void queueItemUnlock(int itemId)
{
unlockedItems.add(itemId);
bronzemanOverlay.addItemUnlock(itemId);

View File

@@ -1,5 +1,6 @@
package net.runelite.client.plugins.bronzeman;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
@@ -11,14 +12,14 @@ import lombok.Setter;
public class ItemUnlock
{
@Getter
@Getter(AccessLevel.PACKAGE)
private final int itemId;
@Getter
@Getter(AccessLevel.PACKAGE)
private long initTime;
@Getter
@Setter
@Getter(AccessLevel.PACKAGE)
@Setter(AccessLevel.PACKAGE)
private int locationY;
ItemUnlock(int itemId)

View File

@@ -79,34 +79,49 @@ public class CannonPlugin extends Plugin
);
private CannonCounter counter;
private boolean skipProjectileCheckThisTick;
@Getter(AccessLevel.PACKAGE)
private int cballsLeft;
@Getter(AccessLevel.PACKAGE)
private boolean cannonPlaced;
@Getter(AccessLevel.PACKAGE)
private WorldPoint cannonPosition;
@Getter(AccessLevel.PACKAGE)
private GameObject cannon;
@Getter(AccessLevel.PACKAGE)
private List<WorldPoint> spotPoints = new ArrayList<>();
@Inject
private ItemManager itemManager;
@Inject
private InfoBoxManager infoBoxManager;
@Inject
private Notifier notifier;
@Inject
private OverlayManager overlayManager;
@Inject
private CannonOverlay cannonOverlay;
@Inject
private CannonSpotOverlay cannonSpotOverlay;
@Inject
private CannonConfig config;
@Inject
private Client client;
@Inject
private ClientThread clientThread;
private boolean lock;
private boolean showEmptyCannonNotification;
private boolean showInfobox;
@@ -126,7 +141,7 @@ public class CannonPlugin extends Plugin
}
@Override
protected void startUp() throws Exception
protected void startUp()
{
updateConfig();
@@ -136,7 +151,7 @@ public class CannonPlugin extends Plugin
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
cannonSpotOverlay.setHidden(true);
overlayManager.remove(cannonOverlay);
@@ -271,7 +286,7 @@ public class CannonPlugin extends Plugin
// counter doesn't decrease if the player has been too far away
// from the cannon due to the projectiels not being in memory,
// so our counter can be higher than it is supposed to be.
int amt = Integer.valueOf(m.group());
int amt = Integer.parseInt(m.group());
if (cballsLeft + amt >= MAX_CBALLS)
{
skipProjectileCheckThisTick = true;

View File

@@ -27,6 +27,7 @@ package net.runelite.client.plugins.cannon;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.coords.WorldPoint;
@@ -67,7 +68,7 @@ public enum CannonSpots
ICE_WARRIOR(new WorldPoint(2955, 3876, 0)),
BANDIT(new WorldPoint(3037, 3700, 0));
@Getter
@Getter(AccessLevel.PACKAGE)
private static final List<WorldPoint> cannonSpots = new ArrayList<>();
static

View File

@@ -30,6 +30,7 @@ import java.util.ArrayList;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.GameState;
import net.runelite.api.NPC;
@@ -50,7 +51,7 @@ import net.runelite.client.ui.overlay.OverlayManager;
@Singleton
public class CerberusPlugin extends Plugin
{
@Getter
@Getter(AccessLevel.PACKAGE)
private final List<NPC> ghosts = new ArrayList<>();
@Inject
@@ -60,13 +61,13 @@ public class CerberusPlugin extends Plugin
private CerberusOverlay overlay;
@Override
protected void startUp() throws Exception
protected void startUp()
{
overlayManager.add(overlay);
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
overlayManager.remove(overlay);
ghosts.clear();

View File

@@ -32,10 +32,10 @@ import net.runelite.client.config.ConfigItem;
public interface ChatboxPerformanceConfig extends Config
{
@ConfigItem(
position = 1,
keyName = "Chatbox",
name = "Toggle gradient",
description = "Toggles the gradient inside the chatbox."
position = 1,
keyName = "Chatbox",
name = "Toggle gradient",
description = "Toggles the gradient inside the chatbox."
)
default boolean transparentChatBox()
{

View File

@@ -89,7 +89,7 @@ public class ChatboxPerformancePlugin extends Plugin
{
clientThread.invokeLater(() -> client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0));
}
}
}
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent ev)

View File

@@ -148,6 +148,192 @@ public class ChatCommandsPlugin extends Plugin
@Inject
private ChatKeyboardListener chatKeyboardListener;
/**
* Returns the ironman status based on the symbol in the name of the player.
*
* @param name player name
* @return hiscore endpoint
*/
private static HiscoreEndpoint getHiscoreEndpointByName(final String name)
{
if (name.contains(IconID.IRONMAN.toString()))
{
return toEndPoint(AccountType.IRONMAN);
}
else if (name.contains(IconID.ULTIMATE_IRONMAN.toString()))
{
return toEndPoint(AccountType.ULTIMATE_IRONMAN);
}
else if (name.contains(IconID.HARDCORE_IRONMAN.toString()))
{
return toEndPoint(AccountType.HARDCORE_IRONMAN);
}
else
{
return toEndPoint(AccountType.NORMAL);
}
}
/**
* Converts account type to hiscore endpoint
*
* @param accountType account type
* @return hiscore endpoint
*/
private static HiscoreEndpoint toEndPoint(final AccountType accountType)
{
switch (accountType)
{
case IRONMAN:
return HiscoreEndpoint.IRONMAN;
case ULTIMATE_IRONMAN:
return HiscoreEndpoint.ULTIMATE_IRONMAN;
case HARDCORE_IRONMAN:
return HiscoreEndpoint.HARDCORE_IRONMAN;
default:
return HiscoreEndpoint.NORMAL;
}
}
private static String longBossName(String boss)
{
switch (boss.toLowerCase())
{
case "corp":
return "Corporeal Beast";
case "jad":
return "TzTok-Jad";
case "kq":
return "Kalphite Queen";
case "chaos ele":
return "Chaos Elemental";
case "dusk":
case "dawn":
case "gargs":
return "Grotesque Guardians";
case "crazy arch":
return "Crazy Archaeologist";
case "deranged arch":
return "Deranged Archaeologist";
case "mole":
return "Giant Mole";
case "vetion":
return "Vet'ion";
case "vene":
return "Venenatis";
case "kbd":
return "King Black Dragon";
case "vork":
return "Vorkath";
case "sire":
return "Abyssal Sire";
case "smoke devil":
case "thermy":
return "Thermonuclear Smoke Devil";
case "cerb":
return "Cerberus";
case "zuk":
case "inferno":
return "TzKal-Zuk";
case "hydra":
return "Alchemical Hydra";
// gwd
case "sara":
case "saradomin":
case "zilyana":
case "zily":
return "Commander Zilyana";
case "zammy":
case "zamorak":
case "kril":
case "kril trutsaroth":
return "K'ril Tsutsaroth";
case "arma":
case "kree":
case "kreearra":
case "armadyl":
return "Kree'arra";
case "bando":
case "bandos":
case "graardor":
return "General Graardor";
// dks
case "supreme":
return "Dagannoth Supreme";
case "rex":
return "Dagannoth Rex";
case "prime":
return "Dagannoth Prime";
case "wt":
return "Wintertodt";
case "barrows":
return "Barrows Chests";
case "herbi":
return "Herbiboar";
// cox
case "cox":
case "xeric":
case "chambers":
case "olm":
case "raids":
return "Chambers of Xeric";
// cox cm
case "cox cm":
case "xeric cm":
case "chambers cm":
case "olm cm":
case "raids cm":
return "Chambers of Xeric Challenge Mode";
// tob
case "tob":
case "theatre":
case "verzik":
case "verzik vitur":
case "raids 2":
return "Theatre of Blood";
// agility course
case "prif":
case "prifddinas":
return "Prifddinas Agility Course";
// The Gauntlet
case "gaunt":
case "gauntlet":
return "Gauntlet";
// Corrupted Gauntlet
case "cgaunt":
case "cgauntlet":
return "Corrupted Gauntlet";
default:
return WordUtils.capitalize(boss);
}
}
@Override
public void startUp()
{
@@ -185,7 +371,7 @@ public class ChatCommandsPlugin extends Plugin
chatCommandManager.unregisterCommand(DUEL_ARENA_COMMAND);
}
@Provides
@Provides
ChatCommandsConfig provideConfig(ConfigManager configManager)
{
return configManager.getConfig(ChatCommandsConfig.class);
@@ -721,7 +907,6 @@ public class ChatCommandsPlugin extends Plugin
return true;
}
private void personalBestLookup(ChatMessage chatMessage, String message)
{
if (!config.pb())
@@ -1219,196 +1404,10 @@ public class ChatCommandsPlugin extends Plugin
return toEndPoint(client.getAccountType());
}
/**
* Returns the ironman status based on the symbol in the name of the player.
*
* @param name player name
* @return hiscore endpoint
*/
private static HiscoreEndpoint getHiscoreEndpointByName(final String name)
{
if (name.contains(IconID.IRONMAN.toString()))
{
return toEndPoint(AccountType.IRONMAN);
}
else if (name.contains(IconID.ULTIMATE_IRONMAN.toString()))
{
return toEndPoint(AccountType.ULTIMATE_IRONMAN);
}
else if (name.contains(IconID.HARDCORE_IRONMAN.toString()))
{
return toEndPoint(AccountType.HARDCORE_IRONMAN);
}
else
{
return toEndPoint(AccountType.NORMAL);
}
}
/**
* Converts account type to hiscore endpoint
*
* @param accountType account type
* @return hiscore endpoint
*/
private static HiscoreEndpoint toEndPoint(final AccountType accountType)
{
switch (accountType)
{
case IRONMAN:
return HiscoreEndpoint.IRONMAN;
case ULTIMATE_IRONMAN:
return HiscoreEndpoint.ULTIMATE_IRONMAN;
case HARDCORE_IRONMAN:
return HiscoreEndpoint.HARDCORE_IRONMAN;
default:
return HiscoreEndpoint.NORMAL;
}
}
@Value
private static class HiscoreLookup
{
private final String name;
private final HiscoreEndpoint endpoint;
}
private static String longBossName(String boss)
{
switch (boss.toLowerCase())
{
case "corp":
return "Corporeal Beast";
case "jad":
return "TzTok-Jad";
case "kq":
return "Kalphite Queen";
case "chaos ele":
return "Chaos Elemental";
case "dusk":
case "dawn":
case "gargs":
return "Grotesque Guardians";
case "crazy arch":
return "Crazy Archaeologist";
case "deranged arch":
return "Deranged Archaeologist";
case "mole":
return "Giant Mole";
case "vetion":
return "Vet'ion";
case "vene":
return "Venenatis";
case "kbd":
return "King Black Dragon";
case "vork":
return "Vorkath";
case "sire":
return "Abyssal Sire";
case "smoke devil":
case "thermy":
return "Thermonuclear Smoke Devil";
case "cerb":
return "Cerberus";
case "zuk":
case "inferno":
return "TzKal-Zuk";
case "hydra":
return "Alchemical Hydra";
// gwd
case "sara":
case "saradomin":
case "zilyana":
case "zily":
return "Commander Zilyana";
case "zammy":
case "zamorak":
case "kril":
case "kril trutsaroth":
return "K'ril Tsutsaroth";
case "arma":
case "kree":
case "kreearra":
case "armadyl":
return "Kree'arra";
case "bando":
case "bandos":
case "graardor":
return "General Graardor";
// dks
case "supreme":
return "Dagannoth Supreme";
case "rex":
return "Dagannoth Rex";
case "prime":
return "Dagannoth Prime";
case "wt":
return "Wintertodt";
case "barrows":
return "Barrows Chests";
case "herbi":
return "Herbiboar";
// cox
case "cox":
case "xeric":
case "chambers":
case "olm":
case "raids":
return "Chambers of Xeric";
// cox cm
case "cox cm":
case "xeric cm":
case "chambers cm":
case "olm cm":
case "raids cm":
return "Chambers of Xeric Challenge Mode";
// tob
case "tob":
case "theatre":
case "verzik":
case "verzik vitur":
case "raids 2":
return "Theatre of Blood";
// agility course
case "prif":
case "prifddinas":
return "Prifddinas Agility Course";
// The Gauntlet
case "gaunt":
case "gauntlet":
return "Gauntlet";
// Corrupted Gauntlet
case "cgaunt":
case "cgauntlet":
return "Corrupted Gauntlet";
default:
return WordUtils.capitalize(boss);
}
}
}

View File

@@ -28,8 +28,8 @@ import java.awt.event.KeyEvent;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Client;
import net.runelite.api.ScriptID;
import net.runelite.api.GameState;
import net.runelite.api.ScriptID;
import net.runelite.api.VarClientStr;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.input.KeyListener;

View File

@@ -94,7 +94,7 @@ public class ChatFilterPlugin extends Plugin
}
@Override
protected void startUp() throws Exception
protected void startUp()
{
updateConfig();
@@ -103,7 +103,7 @@ public class ChatFilterPlugin extends Plugin
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
filteredPatterns.clear();
client.refreshChat();

View File

@@ -88,6 +88,24 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
private boolean retainChatHistory;
private boolean pmTargetCycling;
/**
* Small hack to prevent plugins checking for specific messages to match. This works because the "—" character
* cannot be seen in-game. This replacement preserves wrapping on chat history messages.
*
* @param message message
* @return message with invisible character before every space
*/
private static String tweakSpaces(final String message)
{
if (message != null)
{
// First replacement cleans up prior applications of this so as not to keep extending the message
return message.replace("", " ").replace(" ", "");
}
return null;
}
@Provides
ChatHistoryConfig getConfig(ConfigManager configManager)
{
@@ -191,22 +209,9 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
}
}
/**
* Small hack to prevent plugins checking for specific messages to match. This works because the "—" character
* cannot be seen in-game. This replacement preserves wrapping on chat history messages.
*
* @param message message
* @return message with invisible character before every space
*/
private static String tweakSpaces(final String message)
@Override
public void keyTyped(KeyEvent e)
{
if (message != null)
{
// First replacement cleans up prior applications of this so as not to keep extending the message
return message.replace("", " ").replace(" ", "");
}
return null;
}
@Override
@@ -239,11 +244,6 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
});
}
@Override
public void keyTyped(KeyEvent e)
{
}
@Override
public void keyReleased(KeyEvent e)
{

View File

@@ -97,12 +97,12 @@ public interface ChatNotificationsConfig extends Config
{
return false;
}
@ConfigItem(
position = 6,
keyName = "notifyOnPm",
name = "Notify on private messsage",
description = "Notifies you whenever a private message was received"
position = 6,
keyName = "notifyOnPm",
name = "Notify on private messsage",
description = "Notifies you whenever a private message was received"
)
default boolean notifyOnPm()
{

View File

@@ -61,6 +61,9 @@ import net.runelite.client.plugins.PluginDescriptor;
@Singleton
public class ChatNotificationsPlugin extends Plugin
{
// Private message cache used to avoid duplicate notifications from ChatHistory.
private final Set<Integer> privateMessageHashes = new HashSet<>();
@Inject
private Client client;
@@ -77,10 +80,6 @@ public class ChatNotificationsPlugin extends Plugin
private Pattern usernameMatcher = null;
private String usernameReplacer = "";
private Pattern highlightMatcher = null;
// Private message cache used to avoid duplicate notifications from ChatHistory.
private final Set<Integer> privateMessageHashes = new HashSet<>();
private boolean highlightOwnName;
private String highlightWordsString;
private boolean notifyOnOwnName;
@@ -89,6 +88,49 @@ public class ChatNotificationsPlugin extends Plugin
private boolean notifyOnDuel;
private boolean notifyOnPm;
/**
* Get the last color tag from a string, or null if there was none
*
* @param str
* @return
*/
private static String getLastColor(String str)
{
int colIdx = str.lastIndexOf("<col=");
int colEndIdx = str.lastIndexOf("</col>");
if (colEndIdx > colIdx)
{
// ends in a </col> which resets the color to normal
return "<col" + ChatColorType.NORMAL + ">";
}
if (colIdx == -1)
{
return null; // no color
}
int closeIdx = str.indexOf('>', colIdx);
if (closeIdx == -1)
{
return null; // unclosed col tag
}
return str.substring(colIdx, closeIdx + 1); // include the >
}
/**
* Strip color tags from a string.
*
* @param str
* @return
*/
@VisibleForTesting
static String stripColor(String str)
{
return str.replaceAll("(<col=[0-9a-f]+>|</col>)", "");
}
@Provides
ChatNotificationsConfig provideConfig(ConfigManager configManager)
{
@@ -315,47 +357,4 @@ public class ChatNotificationsPlugin extends Plugin
return stringBuilder.toString();
}
/**
* Get the last color tag from a string, or null if there was none
*
* @param str
* @return
*/
private static String getLastColor(String str)
{
int colIdx = str.lastIndexOf("<col=");
int colEndIdx = str.lastIndexOf("</col>");
if (colEndIdx > colIdx)
{
// ends in a </col> which resets the color to normal
return "<col" + ChatColorType.NORMAL + ">";
}
if (colIdx == -1)
{
return null; // no color
}
int closeIdx = str.indexOf('>', colIdx);
if (closeIdx == -1)
{
return null; // unclosed col tag
}
return str.substring(colIdx, closeIdx + 1); // include the >
}
/**
* Strip color tags from a string.
*
* @param str
* @return
*/
@VisibleForTesting
static String stripColor(String str)
{
return str.replaceAll("(<col=[0-9a-f]+>|</col>)", "");
}
}

View File

@@ -83,7 +83,7 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
}
@Override
protected void startUp() throws Exception
protected void startUp()
{
translator.setInLang(config.publicTargetLanguage());
translator.setOutLang(config.playerTargetLanguage());
@@ -112,7 +112,7 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
eventBus.unregister(OPTION);
eventBus.unregister(PUBLIC);
@@ -265,6 +265,12 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
client.refreshChat();
}
@Override
public void keyTyped(KeyEvent e)
{
// Nothing.
}
@Override
public void keyPressed(KeyEvent event)
{
@@ -313,10 +319,4 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
{
// Nothing.
}
@Override
public void keyTyped(KeyEvent e)
{
// Nothing.
}
}

View File

@@ -1,5 +1,6 @@
package net.runelite.client.plugins.chattranslation;
import lombok.AccessLevel;
import lombok.Getter;
// TODO: Doesn't Locale pretty much do this as well?
@@ -12,7 +13,7 @@ public enum Languages
FRENCH("French", "fr"),
GERMAN("German", "de");
@Getter
@Getter(AccessLevel.PACKAGE)
private final String name;
private final String shortName;

View File

@@ -23,6 +23,7 @@ class Translator
{
incomingUrlBase = BASE_URL + SOURCE + CENT_URL + lang.toShortString() + LAST_URL;
}
void setOutLang(Languages lang)
{
outgoingUrlBase = BASE_URL + SOURCE + CENT_URL + lang.toShortString() + LAST_URL;
@@ -40,7 +41,7 @@ class Translator
return translate(new URL(url));
}
public String translate(URL url) throws IOException
private String translate(URL url) throws IOException
{
HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setRequestProperty("User-Agent", "Mozilla/5.0");
@@ -57,10 +58,6 @@ class Translator
return parseResult(response.toString());
}
catch (IOException e)
{
throw e;
}
}
private String parseResult(String inputJson)

View File

@@ -137,7 +137,7 @@ public interface ClanChatConfig extends Config
{
return false;
}
@ConfigItem(
position = 9,
keyName = "clanname",

View File

@@ -95,6 +95,12 @@ public class ClanChatPlugin extends Plugin
private static final String RECENT_TITLE = "Recent CCs";
private static final int JOIN_LEAVE_DURATION = 20;
private static final int MESSAGE_DELAY = 10;
private static final CopyOnWriteArrayList<Player> clanMembers = new CopyOnWriteArrayList<>();
/**
* queue of temporary messages added to the client
*/
private final Deque<ClanJoinMessage> clanJoinMessages = new ArrayDeque<>();
private final Map<String, ClanMemberActivity> activityBuffer = new HashMap<>();
@Inject
private Client client;
@@ -115,22 +121,8 @@ public class ClanChatPlugin extends Plugin
private ClientThread clientThread;
private List<String> chats = new ArrayList<>();
@SuppressWarnings("unchecked")
public static CopyOnWriteArrayList<Player> getClanMembers()
{
return (CopyOnWriteArrayList<Player>) clanMembers.clone();
}
private static final CopyOnWriteArrayList<Player> clanMembers = new CopyOnWriteArrayList<>();
private ClanChatIndicator clanMemberCounter;
/**
* queue of temporary messages added to the client
*/
private final Deque<ClanJoinMessage> clanJoinMessages = new ArrayDeque<>();
private final Map<String, ClanMemberActivity> activityBuffer = new HashMap<>();
private int clanJoinedTick;
private boolean clanChatIcons;
private boolean recentChats;
private boolean showClanCounter;
@@ -142,6 +134,12 @@ public class ClanChatPlugin extends Plugin
private boolean clanTabChat;
private String clanname;
@SuppressWarnings("unchecked")
public static CopyOnWriteArrayList<Player> getClanMembers()
{
return (CopyOnWriteArrayList<Player>) clanMembers.clone();
}
@Provides
ClanChatConfig getConfig(ConfigManager configManager)
{

View File

@@ -34,6 +34,13 @@ import net.runelite.client.ui.overlay.OverlayManager;
@Singleton
public class ClanManModePlugin extends Plugin
{
final Map<String, Integer> clan = new HashMap<>();
int wildernessLevel;
int clanmin;
int clanmax;
int inwildy;
int ticks;
@Inject
private OverlayManager overlayManager;
@@ -89,15 +96,8 @@ public class ClanManModePlugin extends Plugin
return configManager.getConfig(ClanManModeConfig.class);
}
int wildernessLevel;
int clanmin;
int clanmax;
int inwildy;
int ticks;
final Map<String, Integer> clan = new HashMap<>();
@Override
protected void startUp() throws Exception
protected void startUp()
{
updateConfig();
@@ -107,7 +107,7 @@ public class ClanManModePlugin extends Plugin
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
overlayManager.remove(ClanManModeOverlay);
overlayManager.remove(ClanManModeTileOverlay);

View File

@@ -99,7 +99,7 @@ public class ClanManModeService
consumer.accept(player, plugin.getGetClanMemberColor());
}
if (plugin.isHighlightAttacked() && interactors.containsKey(player.getName()))
{
{
String attackername = interactors.get(player.getName());
boolean found = false;
for (Player attacker : client.getPlayers())

View File

@@ -40,6 +40,7 @@ import java.util.List;
import java.util.Objects;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ChatMessageType;
@@ -122,24 +123,24 @@ public class ClueScrollPlugin extends Plugin
13150, 9011,
13151, 9012
};
@Getter
private ClueScroll clue;
@Getter
@Getter(AccessLevel.PUBLIC)
private final List<NPC> npcsToMark = new ArrayList<>();
@Getter
@Getter(AccessLevel.PUBLIC)
private final List<TileObject> objectsToMark = new ArrayList<>();
private final TextComponent textComponent = new TextComponent();
@Getter
@Getter(AccessLevel.PACKAGE)
private ClueScroll clue;
@Getter(AccessLevel.PUBLIC)
private Item[] equippedItems;
@Getter
@Getter(AccessLevel.PUBLIC)
private Item[] inventoryItems;
@Inject
@Getter
@Getter(AccessLevel.PUBLIC)
private Client client;
@Inject
@@ -170,11 +171,33 @@ public class ClueScrollPlugin extends Plugin
private BufferedImage mapArrow;
private Integer clueItemId;
private boolean worldMapPointsSet = false;
private final TextComponent textComponent = new TextComponent();
private boolean displayHintArrows;
/**
* Translate a coordinate either between overworld and real, or real and overworld
*
* @param worldPoint
* @param toOverworld whether to convert to overworld coordinates, or to real coordinates
* @return
*/
public static WorldPoint getMirrorPoint(WorldPoint worldPoint, boolean toOverworld)
{
int region = worldPoint.getRegionID();
for (int i = 0; i < REGION_MIRRORS.length; i += 2)
{
int real = REGION_MIRRORS[i];
int overworld = REGION_MIRRORS[i + 1];
// Test against what we are converting from
if (region == (toOverworld ? real : overworld))
{
return WorldPoint.fromRegion(toOverworld ? overworld : real,
worldPoint.getRegionX(), worldPoint.getRegionY(), worldPoint.getPlane());
}
}
return worldPoint;
}
@Provides
ClueScrollConfig getConfig(ConfigManager configManager)
{
@@ -188,7 +211,7 @@ public class ClueScrollPlugin extends Plugin
}
@Override
protected void startUp() throws Exception
protected void startUp()
{
this.displayHintArrows = config.displayHintArrows();
@@ -199,7 +222,7 @@ public class ClueScrollPlugin extends Plugin
}
@Override
protected void shutDown() throws Exception
protected void shutDown()
{
overlayManager.remove(clueScrollOverlay);
overlayManager.remove(clueScrollEmoteOverlay);
@@ -834,29 +857,4 @@ public class ClueScrollPlugin extends Plugin
newScroll
);
}
/**
* Translate a coordinate either between overworld and real, or real and overworld
*
* @param worldPoint
* @param toOverworld whether to convert to overworld coordinates, or to real coordinates
* @return
*/
public static WorldPoint getMirrorPoint(WorldPoint worldPoint, boolean toOverworld)
{
int region = worldPoint.getRegionID();
for (int i = 0; i < REGION_MIRRORS.length; i += 2)
{
int real = REGION_MIRRORS[i];
int overworld = REGION_MIRRORS[i + 1];
// Test against what we are converting from
if (region == (toOverworld ? real : overworld))
{
return WorldPoint.fromRegion(toOverworld ? overworld : real,
worldPoint.getRegionX(), worldPoint.getRegionY(), worldPoint.getPlane());
}
}
return worldPoint;
}
}

View File

@@ -28,6 +28,7 @@ import com.google.common.collect.ImmutableSet;
import java.awt.Color;
import java.awt.Graphics2D;
import java.util.Set;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.NPC;
import net.runelite.api.ObjectID;
@@ -44,7 +45,7 @@ import net.runelite.client.ui.overlay.components.LineComponent;
import net.runelite.client.ui.overlay.components.PanelComponent;
import net.runelite.client.ui.overlay.components.TitleComponent;
@Getter
@Getter(AccessLevel.PUBLIC)
public class AnagramClue extends ClueScroll implements TextClueScroll, NpcClueScroll, ObjectClueScroll
{
private static final String ANAGRAM_TEXT = "This anagram reveals who to speak to next: ";
@@ -273,12 +274,12 @@ public class AnagramClue extends ClueScroll implements TextClueScroll, NpcClueSc
@Override
public String[] getNpcs()
{
return new String[] {npc};
return new String[]{npc};
}
@Override
public int[] getObjectIds()
{
return new int[] {objectId};
return new int[]{objectId};
}
}

Some files were not shown because too many files have changed in this diff Show More