Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2022-01-26 01:20:31 +01:00
19 changed files with 157 additions and 71 deletions

View File

@@ -36,6 +36,7 @@ dependencies {
implementation(group = "com.google.guava", name = "guava", version = "30.1.1-jre") implementation(group = "com.google.guava", name = "guava", version = "30.1.1-jre")
implementation(group = "org.apache.commons", name = "commons-text", version = "1.9") implementation(group = "org.apache.commons", name = "commons-text", version = "1.9")
implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.32") implementation(group = "org.slf4j", name = "slf4j-api", version = "1.7.32")
implementation(group = "org.jetbrains", name = "annotations", version = "22.0.0")
testImplementation(group = "junit", name = "junit", version = "4.12") testImplementation(group = "junit", name = "junit", version = "4.12")
} }

View File

@@ -204,6 +204,12 @@ public final class AnimationID
public static final int LEAGUE_HOME_TELEPORT_4 = 8803; public static final int LEAGUE_HOME_TELEPORT_4 = 8803;
public static final int LEAGUE_HOME_TELEPORT_5 = 8805; public static final int LEAGUE_HOME_TELEPORT_5 = 8805;
public static final int LEAGUE_HOME_TELEPORT_6 = 8807; public static final int LEAGUE_HOME_TELEPORT_6 = 8807;
public static final int SHATTERED_LEAGUE_HOME_TELEPORT_1 = 9209;
public static final int SHATTERED_LEAGUE_HOME_TELEPORT_2 = 9210;
public static final int SHATTERED_LEAGUE_HOME_TELEPORT_3 = 9211;
public static final int SHATTERED_LEAGUE_HOME_TELEPORT_4 = 9212;
public static final int SHATTERED_LEAGUE_HOME_TELEPORT_5 = 9213;
public static final int SHATTERED_LEAGUE_HOME_TELEPORT_6 = 9214;
public static final int RAID_LIGHT_ANIMATION = 3101; public static final int RAID_LIGHT_ANIMATION = 3101;
public static final int LOOTBEAM_ANIMATION = 9260; public static final int LOOTBEAM_ANIMATION = 9260;

View File

@@ -35,6 +35,7 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import net.runelite.api.annotations.VisibleForExternalPlugins; import net.runelite.api.annotations.VisibleForExternalPlugins;
import net.runelite.api.clan.ClanChannel; import net.runelite.api.clan.ClanChannel;
import net.runelite.api.clan.ClanID;
import net.runelite.api.clan.ClanSettings; import net.runelite.api.clan.ClanSettings;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
@@ -42,9 +43,11 @@ import net.runelite.api.events.PlayerChanged;
import net.runelite.api.hooks.Callbacks; import net.runelite.api.hooks.Callbacks;
import net.runelite.api.hooks.DrawCallbacks; import net.runelite.api.hooks.DrawCallbacks;
import net.runelite.api.vars.AccountType; import net.runelite.api.vars.AccountType;
import net.runelite.api.widgets.ItemQuantityMode;
import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetInfo;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.intellij.lang.annotations.MagicConstant;
/** /**
* Represents the RuneScape client. * Represents the RuneScape client.
@@ -440,7 +443,7 @@ public interface Client extends GameEngine
* @return the created sprite * @return the created sprite
*/ */
@Nullable @Nullable
SpritePixels createItemSprite(int itemId, int quantity, int border, int shadowColor, int stackable, boolean noted, int scale); SpritePixels createItemSprite(int itemId, int quantity, int border, int shadowColor, @MagicConstant(valuesFromClass = ItemQuantityMode.class) int stackable, boolean noted, int scale);
/** /**
* Loads and creates the sprite images of the passed archive and file IDs. * Loads and creates the sprite images of the passed archive and file IDs.
@@ -944,7 +947,7 @@ public interface Client extends GameEngine
* *
* @return the widget flags table * @return the widget flags table
*/ */
HashTable getWidgetFlags(); HashTable<IntegerNode> getWidgetFlags();
/** /**
* Gets the widget node component table. * Gets the widget node component table.
@@ -2274,7 +2277,7 @@ public interface Client extends GameEngine
* @return * @return
* @see KeyCode * @see KeyCode
*/ */
boolean isKeyPressed(int keycode); boolean isKeyPressed(@MagicConstant(valuesFromClass = KeyCode.class) int keycode);
int getFollowerIndex(); int getFollowerIndex();
@@ -2375,7 +2378,7 @@ public interface Client extends GameEngine
* @see net.runelite.api.clan.ClanID * @see net.runelite.api.clan.ClanID
*/ */
@Nullable @Nullable
ClanChannel getClanChannel(int clanId); ClanChannel getClanChannel(@MagicConstant(valuesFromClass = ClanID.class) int clanId);
/** /**
* Get clan settings by id * Get clan settings by id
@@ -2384,7 +2387,7 @@ public interface Client extends GameEngine
* @see net.runelite.api.clan.ClanID * @see net.runelite.api.clan.ClanID
*/ */
@Nullable @Nullable
ClanSettings getClanSettings(int clanId); ClanSettings getClanSettings(@MagicConstant(valuesFromClass = ClanID.class) int clanId);
void setUnlockedFps(boolean unlock); void setUnlockedFps(boolean unlock);
void setUnlockedFpsTarget(int fps); void setUnlockedFpsTarget(int fps);

View File

@@ -24,6 +24,8 @@
*/ */
package net.runelite.api; package net.runelite.api;
import org.intellij.lang.annotations.MagicConstant;
/** /**
* Represents tile collision data for the scene * Represents tile collision data for the scene
*/ */
@@ -42,5 +44,6 @@ public interface CollisionData
* @return all collision flags for the tiles in the scene * @return all collision flags for the tiles in the scene
* @see net.runelite.api.Constants#SCENE_SIZE * @see net.runelite.api.Constants#SCENE_SIZE
*/ */
@MagicConstant(flagsFromClass = CollisionDataFlag.class)
int[][] getFlags(); int[][] getFlags();
} }

View File

@@ -1,5 +1,8 @@
package net.runelite.api; package net.runelite.api;
import net.runelite.api.widgets.WidgetModalMode;
import org.intellij.lang.annotations.MagicConstant;
/** /**
* Represents a widget as an iterable node. * Represents a widget as an iterable node.
*/ */
@@ -16,5 +19,6 @@ public interface WidgetNode extends Node
/** /**
* @see net.runelite.api.widgets.WidgetModalMode * @see net.runelite.api.widgets.WidgetModalMode
*/ */
@MagicConstant(valuesFromClass = WidgetModalMode.class)
int getModalMode(); int getModalMode();
} }

View File

@@ -27,6 +27,8 @@ package net.runelite.api.events;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import lombok.Value; import lombok.Value;
import net.runelite.api.clan.ClanChannel; import net.runelite.api.clan.ClanChannel;
import net.runelite.api.clan.ClanID;
import org.intellij.lang.annotations.MagicConstant;
/** /**
* An event fired when the local player joins or leaves a clan channel. * An event fired when the local player joins or leaves a clan channel.
@@ -43,6 +45,7 @@ public class ClanChannelChanged
* The clan id, or -1 for guest clan * The clan id, or -1 for guest clan
* @see net.runelite.api.clan.ClanID * @see net.runelite.api.clan.ClanID
*/ */
@MagicConstant(valuesFromClass = ClanID.class)
private int clanId; private int clanId;
/** /**
* Whether or not this was the guest clan channel * Whether or not this was the guest clan channel

View File

@@ -25,6 +25,8 @@
package net.runelite.api.events; package net.runelite.api.events;
import lombok.Value; import lombok.Value;
import net.runelite.api.widgets.WidgetModalMode;
import org.intellij.lang.annotations.MagicConstant;
/** /**
* Posted when an interface is about to be closed * Posted when an interface is about to be closed
@@ -40,6 +42,7 @@ public class WidgetClosed
/** /**
* @see net.runelite.api.widgets.WidgetModalMode * @see net.runelite.api.widgets.WidgetModalMode
*/ */
@MagicConstant(valuesFromClass = WidgetModalMode.class)
private final int modalMode; private final int modalMode;
/** /**

View File

@@ -30,6 +30,8 @@ import javax.annotation.Nullable;
import net.runelite.api.FontTypeFace; import net.runelite.api.FontTypeFace;
import net.runelite.api.Point; import net.runelite.api.Point;
import net.runelite.api.SpritePixels; import net.runelite.api.SpritePixels;
import org.intellij.lang.annotations.MagicConstant;
import org.jetbrains.annotations.Range;
/** /**
* Represents an on-screen UI element that is drawn on the canvas. * Represents an on-screen UI element that is drawn on the canvas.
@@ -60,6 +62,7 @@ public interface Widget
* *
* @see WidgetType * @see WidgetType
*/ */
@MagicConstant(valuesFromClass = WidgetType.class)
int getType(); int getType();
/** /**
@@ -67,7 +70,7 @@ public interface Widget
* *
* @see WidgetType * @see WidgetType
*/ */
void setType(int type); void setType(@MagicConstant(valuesFromClass = WidgetType.class) int type);
/** /**
* Gets the type of content displayed by the widget. * Gets the type of content displayed by the widget.
@@ -77,14 +80,13 @@ public interface Widget
/** /**
* Sets the type of content displayed by the widget. * Sets the type of content displayed by the widget.
*/ */
void setContentType(int contentType); Widget setContentType(int contentType);
/** /**
* Gets the current click configuration of the widget. * Gets the current click configuration of the widget.
* @see WidgetConfig * @see WidgetConfig
*
* @see WidgetConfig
*/ */
@MagicConstant(flagsFromClass = WidgetConfig.class)
int getClickMask(); int getClickMask();
/** /**
@@ -92,7 +94,7 @@ public interface Widget
* *
* @see WidgetConfig * @see WidgetConfig
*/ */
void setClickMask(int mask); Widget setClickMask(@MagicConstant(flagsFromClass = WidgetConfig.class) int mask);
/** /**
* Gets the parent widget, if this widget is a child. * Gets the parent widget, if this widget is a child.
@@ -193,7 +195,7 @@ public interface Widget
* *
* @param text the text to display * @param text the text to display
*/ */
void setText(String text); Widget setText(String text);
/** /**
* Gets the color as an RGB value. * Gets the color as an RGB value.
@@ -209,7 +211,7 @@ public interface Widget
* @param textColor RGB24 color * @param textColor RGB24 color
* @see java.awt.Color#getRGB() * @see java.awt.Color#getRGB()
*/ */
void setTextColor(int textColor); Widget setTextColor(int textColor);
/** /**
* Gets the transparency of the rectangle * Gets the transparency of the rectangle
@@ -223,7 +225,7 @@ public interface Widget
* *
* @param transparency 0 = fully opaque, 255 = fully transparent * @param transparency 0 = fully opaque, 255 = fully transparent
*/ */
void setOpacity(int transparency); Widget setOpacity(int transparency);
/** /**
* Gets the name "op base" of the widget. * Gets the name "op base" of the widget.
@@ -242,12 +244,12 @@ public interface Widget
* *
* @param name the new name * @param name the new name
*/ */
void setName(String name); Widget setName(String name);
/** /**
* Gets the Model/NPC/Item ID displayed in the widget. * Gets the Model/NPC/Item ID displayed in the widget.
* *
* @see WidgetModelType * @see #getModelType()
*/ */
int getModelId(); int getModelId();
@@ -256,13 +258,14 @@ public interface Widget
* *
* @see WidgetModelType * @see WidgetModelType
*/ */
void setModelId(int id); Widget setModelId(int id);
/** /**
* Gets the model type of the widget. * Gets the model type of the widget.
* *
* @see WidgetModelType * @see WidgetModelType
*/ */
@MagicConstant(valuesFromClass = WidgetModelType.class)
int getModelType(); int getModelType();
/** /**
@@ -271,7 +274,7 @@ public interface Widget
* @param type the new model type * @param type the new model type
* @see WidgetModelType * @see WidgetModelType
*/ */
void setModelType(int type); Widget setModelType(@MagicConstant(valuesFromClass = WidgetModelType.class) int type);
/** /**
* Gets the sequence ID used to animate the model in the widget * Gets the sequence ID used to animate the model in the widget
@@ -285,12 +288,13 @@ public interface Widget
* *
* @see net.runelite.api.AnimationID * @see net.runelite.api.AnimationID
*/ */
void setAnimationId(int animationId); Widget setAnimationId(int animationId);
/** /**
* Gets the x rotation of the model displayed in the widget. * Gets the x rotation of the model displayed in the widget.
* 0 = no rotation, 2047 = full rotation * 0 = no rotation, 2047 = full rotation
*/ */
@Range(from = 0, to = 2047)
int getRotationX(); int getRotationX();
/** /**
@@ -301,12 +305,13 @@ public interface Widget
* *
* @param modelX the new model x rotation value * @param modelX the new model x rotation value
*/ */
void setRotationX(int modelX); Widget setRotationX(@Range(from = 0, to = 2047) int modelX);
/** /**
* Gets the y rotation of the model displayed in the widget. * Gets the y rotation of the model displayed in the widget.
* 0 = no rotation, 2047 = full rotation * 0 = no rotation, 2047 = full rotation
*/ */
@Range(from = 0, to = 2047)
int getRotationY(); int getRotationY();
/** /**
@@ -317,12 +322,13 @@ public interface Widget
* *
* @param modelY the new model y rotation value * @param modelY the new model y rotation value
*/ */
void setRotationY(int modelY); Widget setRotationY(@Range(from = 0, to = 2047) int modelY);
/** /**
* Gets the z rotation of the model displayed in the widget. * Gets the z rotation of the model displayed in the widget.
* 0 = no rotation, 2047 = full rotation * 0 = no rotation, 2047 = full rotation
*/ */
@Range(from = 0, to = 2047)
int getRotationZ(); int getRotationZ();
/** /**
@@ -333,7 +339,7 @@ public interface Widget
* *
* @param modelZ the new model z rotation value * @param modelZ the new model z rotation value
*/ */
void setRotationZ(int modelZ); Widget setRotationZ(@Range(from = 0, to = 2047) int modelZ);
/** /**
* Gets the amount zoomed in on the model displayed in the widget. * Gets the amount zoomed in on the model displayed in the widget.
@@ -345,7 +351,7 @@ public interface Widget
* *
* @param modelZoom the new model zoom value * @param modelZoom the new model zoom value
*/ */
void setModelZoom(int modelZoom); Widget setModelZoom(int modelZoom);
/** /**
* Gets the sprite ID displayed in the widget. * Gets the sprite ID displayed in the widget.
@@ -363,7 +369,7 @@ public interface Widget
/** /**
* Sets if sprites are repeated or stretched * Sets if sprites are repeated or stretched
*/ */
void setSpriteTiling(boolean tiling); Widget setSpriteTiling(boolean tiling);
/** /**
* Sets the sprite ID displayed in the widget. * Sets the sprite ID displayed in the widget.
@@ -371,7 +377,7 @@ public interface Widget
* @param spriteId the sprite ID * @param spriteId the sprite ID
* @see net.runelite.api.SpriteID * @see net.runelite.api.SpriteID
*/ */
void setSpriteId(int spriteId); Widget setSpriteId(int spriteId);
/** /**
* Checks whether this widget or any of its parents are hidden. * Checks whether this widget or any of its parents are hidden.
@@ -395,7 +401,7 @@ public interface Widget
* *
* @param hidden new hidden state * @param hidden new hidden state
*/ */
void setHidden(boolean hidden); Widget setHidden(boolean hidden);
/** /**
* The index of this widget in it's parent's children array * The index of this widget in it's parent's children array
@@ -485,7 +491,7 @@ public interface Widget
* *
* @param itemId the item ID * @param itemId the item ID
*/ */
void setItemId(int itemId); Widget setItemId(int itemId);
/** /**
* Gets the quantity of the item displayed by the widget. * Gets the quantity of the item displayed by the widget.
@@ -499,7 +505,7 @@ public interface Widget
* *
* @param quantity the quantity of the item * @param quantity the quantity of the item
*/ */
void setItemQuantity(int quantity); Widget setItemQuantity(int quantity);
/** /**
* Checks if the passed canvas points is inside of this widget's * Checks if the passed canvas points is inside of this widget's
@@ -518,7 +524,7 @@ public interface Widget
/** /**
* Sets the amount of pixels the widget is scrolled in the X axis * Sets the amount of pixels the widget is scrolled in the X axis
*/ */
void setScrollX(int scrollX); Widget setScrollX(int scrollX);
/** /**
* Gets the amount of pixels the widget is scrolled in the Y axis * Gets the amount of pixels the widget is scrolled in the Y axis
@@ -528,7 +534,7 @@ public interface Widget
/** /**
* sets the amount of pixels the widget is scrolled in the Y axis * sets the amount of pixels the widget is scrolled in the Y axis
*/ */
void setScrollY(int scrollY); Widget setScrollY(int scrollY);
/** /**
* Gets the size of the widget's viewport in the X axis * Gets the size of the widget's viewport in the X axis
@@ -538,7 +544,7 @@ public interface Widget
/** /**
* Sets the size of the widget's viewport in the X axis * Sets the size of the widget's viewport in the X axis
*/ */
void setScrollWidth(int width); Widget setScrollWidth(int width);
/** /**
* Gets the size of the widget's viewport in the Y axis * Gets the size of the widget's viewport in the Y axis
@@ -548,7 +554,7 @@ public interface Widget
/** /**
* Sets the size of the widget's viewport in the Y axis * Sets the size of the widget's viewport in the Y axis
*/ */
void setScrollHeight(int height); Widget setScrollHeight(int height);
/** /**
* Gets the X coordinate of this widget before being adjusted by * Gets the X coordinate of this widget before being adjusted by
@@ -562,7 +568,7 @@ public interface Widget
* *
* @see #setXPositionMode(int) * @see #setXPositionMode(int)
*/ */
void setOriginalX(int originalX); Widget setOriginalX(int originalX);
/** /**
* Gets the Y coordinate of this widget before being adjusted by * Gets the Y coordinate of this widget before being adjusted by
@@ -576,7 +582,15 @@ public interface Widget
* *
* @see #setYPositionMode(int) * @see #setYPositionMode(int)
*/ */
void setOriginalY(int originalY); Widget setOriginalY(int originalY);
/**
* Sets the X/Y coordinates
*/
Widget setPos(int x, int y);
Widget setPos(int x, int y,
@MagicConstant(valuesFromClass = WidgetPositionMode.class) int xMode,
@MagicConstant(valuesFromClass = WidgetPositionMode.class) int yMode);
/** /**
* Gets the height coordinate of this widget before being adjusted by * Gets the height coordinate of this widget before being adjusted by
@@ -590,7 +604,7 @@ public interface Widget
* *
* @see #setHeightMode(int) * @see #setHeightMode(int)
*/ */
void setOriginalHeight(int originalHeight); Widget setOriginalHeight(int originalHeight);
/** /**
* Gets the width coordinate of this widget before being adjusted by * Gets the width coordinate of this widget before being adjusted by
@@ -604,7 +618,12 @@ public interface Widget
* *
* @see #setWidthMode(int) * @see #setWidthMode(int)
*/ */
void setOriginalWidth(int originalWidth); Widget setOriginalWidth(int originalWidth);
Widget setSize(int width, int height);
Widget setSize(int width, int height,
@MagicConstant(valuesFromClass = WidgetSizeMode.class) int widthMode,
@MagicConstant(valuesFromClass = WidgetSizeMode.class) int heightMode);
/** /**
* Gets the menu options available on the widget as a sparse array. * Gets the menu options available on the widget as a sparse array.
@@ -615,9 +634,16 @@ public interface Widget
* Creates a dynamic widget child * Creates a dynamic widget child
* *
* @param index the index of the new widget in the children list or -1 to append to the back * @param index the index of the new widget in the children list or -1 to append to the back
* @param type the type of the widget * @param type the {@link WidgetType} of the widget
*/ */
Widget createChild(int index, int type); Widget createChild(int index, @MagicConstant(valuesFromClass = WidgetType.class) int type);
/**
* Creates a dynamic widget child at the end of the children list
*
* @param type the {@link WidgetType} of the widget
*/
Widget createChild(@MagicConstant(valuesFromClass = WidgetType.class) int type);
/** /**
* Removes all of this widget's dynamic children * Removes all of this widget's dynamic children
@@ -704,7 +730,7 @@ public interface Widget
/** /**
* Sets if the widget has any listeners. This should be called whenever a setXListener function is called * Sets if the widget has any listeners. This should be called whenever a setXListener function is called
*/ */
void setHasListener(boolean hasListener); Widget setHasListener(boolean hasListener);
/** /**
* This is true if the widget is from an if3 interface, or is dynamically created * This is true if the widget is from an if3 interface, or is dynamically created
@@ -761,7 +787,7 @@ public interface Widget
* *
* @see net.runelite.api.FontID * @see net.runelite.api.FontID
*/ */
void setFontId(int id); Widget setFontId(int id);
/** /**
* Returns the border type of item/sprite on the widget * Returns the border type of item/sprite on the widget
@@ -784,7 +810,7 @@ public interface Widget
/** /**
* Sets if text should be shadowed * Sets if text should be shadowed
*/ */
void setTextShadowed(boolean shadowed); Widget setTextShadowed(boolean shadowed);
/** /**
* Returns the widget drag dead zone * Returns the widget drag dead zone
@@ -809,18 +835,21 @@ public interface Widget
/** /**
* Returns widget {@link net.runelite.api.widgets.ItemQuantityMode}. * Returns widget {@link net.runelite.api.widgets.ItemQuantityMode}.
*/ */
@MagicConstant(valuesFromClass = ItemQuantityMode.class)
int getItemQuantityMode(); int getItemQuantityMode();
/** /**
* Sets the widget {@link net.runelite.api.widgets.ItemQuantityMode} * Sets the widget {@link net.runelite.api.widgets.ItemQuantityMode}
*/ */
void setItemQuantityMode(int itemQuantityMode); @MagicConstant(valuesFromClass = ItemQuantityMode.class)
Widget setItemQuantityMode(int itemQuantityMode);
/** /**
* Gets the mode that the X position is calculated from the original X position * Gets the mode that the X position is calculated from the original X position
* *
* @see WidgetPositionMode * @see WidgetPositionMode
*/ */
@MagicConstant(valuesFromClass = WidgetPositionMode.class)
int getXPositionMode(); int getXPositionMode();
/** /**
@@ -829,13 +858,14 @@ public interface Widget
* *
* @see WidgetPositionMode * @see WidgetPositionMode
*/ */
void setXPositionMode(int xpm); Widget setXPositionMode(@MagicConstant(valuesFromClass = WidgetPositionMode.class) int xpm);
/** /**
* Gets the mode that the Y position is calculated from the original Y position * Gets the mode that the Y position is calculated from the original Y position
* *
* @see WidgetPositionMode * @see WidgetPositionMode
*/ */
@MagicConstant(valuesFromClass = WidgetPositionMode.class)
int getYPositionMode(); int getYPositionMode();
/** /**
@@ -844,7 +874,7 @@ public interface Widget
* *
* @see WidgetPositionMode * @see WidgetPositionMode
*/ */
void setYPositionMode(int ypm); Widget setYPositionMode(@MagicConstant(valuesFromClass = WidgetPositionMode.class) int ypm);
/** /**
* Get the line height for this widget. * Get the line height for this widget.
@@ -858,13 +888,14 @@ public interface Widget
* *
* @param lineHeight * @param lineHeight
*/ */
void setLineHeight(int lineHeight); Widget setLineHeight(int lineHeight);
/** /**
* Gets the X axis text position mode * Gets the X axis text position mode
* *
* @see WidgetTextAlignment * @see WidgetTextAlignment
*/ */
@MagicConstant(valuesFromClass = WidgetTextAlignment.class)
int getXTextAlignment(); int getXTextAlignment();
/** /**
@@ -872,13 +903,14 @@ public interface Widget
* *
* @see WidgetTextAlignment * @see WidgetTextAlignment
*/ */
void setXTextAlignment(int xta); Widget setXTextAlignment(@MagicConstant(valuesFromClass = WidgetTextAlignment.class) int xta);
/** /**
* Gets the Y axis text position mode * Gets the Y axis text position mode
* *
* @see WidgetTextAlignment * @see WidgetTextAlignment
*/ */
@MagicConstant(valuesFromClass = WidgetTextAlignment.class)
int getYTextAlignment(); int getYTextAlignment();
/** /**
@@ -886,13 +918,14 @@ public interface Widget
* *
* @see WidgetTextAlignment * @see WidgetTextAlignment
*/ */
void setYTextAlignment(int yta); Widget setYTextAlignment(@MagicConstant(valuesFromClass = WidgetTextAlignment.class) int yta);
/** /**
* Gets the mode controlling widget width * Gets the mode controlling widget width
* *
* @see WidgetSizeMode * @see WidgetSizeMode
*/ */
@MagicConstant(valuesFromClass = WidgetSizeMode.class)
int getWidthMode(); int getWidthMode();
/** /**
@@ -901,13 +934,14 @@ public interface Widget
* *
* @see WidgetSizeMode * @see WidgetSizeMode
*/ */
void setWidthMode(int widthMode); Widget setWidthMode(@MagicConstant(valuesFromClass = WidgetSizeMode.class) int widthMode);
/** /**
* Gets the mode controlling widget width * Gets the mode controlling widget width
* *
* @see WidgetSizeMode * @see WidgetSizeMode
*/ */
@MagicConstant(valuesFromClass = WidgetSizeMode.class)
int getHeightMode(); int getHeightMode();
/** /**
@@ -916,7 +950,7 @@ public interface Widget
* *
* @see WidgetSizeMode * @see WidgetSizeMode
*/ */
void setHeightMode(int heightMode); Widget setHeightMode(@MagicConstant(valuesFromClass = WidgetSizeMode.class) int heightMode);
/** /**
* Gets the font that this widget uses * Gets the font that this widget uses
@@ -931,7 +965,7 @@ public interface Widget
/** /**
* Sets if the rectangle is filled or just stroked * Sets if the rectangle is filled or just stroked
*/ */
void setFilled(boolean filled); Widget setFilled(boolean filled);
/** /**
* Verb for spell targets * Verb for spell targets
@@ -1012,7 +1046,7 @@ public interface Widget
/** /**
* Container this can be dragged in * Container this can be dragged in
*/ */
void setDragParent(Widget dragParent); Widget setDragParent(Widget dragParent);
/** /**
* Gets the script and arguments to be ran when one of the listened for vars changes. * Gets the script and arguments to be ran when one of the listened for vars changes.

View File

@@ -844,6 +844,7 @@ public final class WidgetID
{ {
static final int LUMBRIDGE_HOME_TELEPORT = 6; static final int LUMBRIDGE_HOME_TELEPORT = 6;
static final int KOUREND_HOME_TELEPORT = 4; static final int KOUREND_HOME_TELEPORT = 4;
static final int CATHERBY_HOME_TELEPORT = 5;
} }
static class AncientSpellBook static class AncientSpellBook

View File

@@ -505,6 +505,7 @@ public enum WidgetInfo
SPELL_LUNAR_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.LunarSpellBook.LUNAR_HOME_TELEPORT), SPELL_LUNAR_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.LunarSpellBook.LUNAR_HOME_TELEPORT),
SPELL_ARCEUUS_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.ArceuusSpellBook.ARCEUUS_HOME_TELEPORT), SPELL_ARCEUUS_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.ArceuusSpellBook.ARCEUUS_HOME_TELEPORT),
SPELL_KOUREND_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.StandardSpellBook.KOUREND_HOME_TELEPORT), SPELL_KOUREND_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.StandardSpellBook.KOUREND_HOME_TELEPORT),
SPELL_CATHERBY_HOME_TELEPORT(WidgetID.SPELLBOOK_GROUP_ID, WidgetID.StandardSpellBook.CATHERBY_HOME_TELEPORT),
PVP_WILDERNESS_SKULL_CONTAINER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.WILDERNESS_SKULL_CONTAINER), PVP_WILDERNESS_SKULL_CONTAINER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.WILDERNESS_SKULL_CONTAINER),
PVP_SKULL_CONTAINER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SKULL_CONTAINER), PVP_SKULL_CONTAINER(WidgetID.PVP_GROUP_ID, WidgetID.Pvp.SKULL_CONTAINER),

View File

@@ -53,6 +53,7 @@ import net.runelite.api.GameState;
import net.runelite.api.ItemComposition; import net.runelite.api.ItemComposition;
import static net.runelite.api.ItemID.*; import static net.runelite.api.ItemID.*;
import net.runelite.api.SpritePixels; import net.runelite.api.SpritePixels;
import net.runelite.api.widgets.ItemQuantityMode;
import net.runelite.client.callback.ClientThread; import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.util.AsyncBufferedImage; import net.runelite.client.util.AsyncBufferedImage;
@@ -425,7 +426,7 @@ public class ItemManager
return false; return false;
} }
SpritePixels sprite = client.createItemSprite(itemId, quantity, 1, SpritePixels.DEFAULT_SHADOW_COLOR, SpritePixels sprite = client.createItemSprite(itemId, quantity, 1, SpritePixels.DEFAULT_SHADOW_COLOR,
stackable ? 1 : 0, false, CLIENT_DEFAULT_ZOOM); stackable ? ItemQuantityMode.ALWAYS : ItemQuantityMode.NEVER, false, CLIENT_DEFAULT_ZOOM);
if (sprite == null) if (sprite == null)
{ {
return false; return false;

View File

@@ -210,7 +210,8 @@ public class DailyTasksPlugin extends Plugin
private void checkSand(boolean dailyReset) private void checkSand(boolean dailyReset)
{ {
if (client.getVar(Varbits.QUEST_THE_HAND_IN_THE_SAND) >= SAND_QUEST_COMPLETE if (client.getAccountType() != AccountType.ULTIMATE_IRONMAN
&& client.getVar(Varbits.QUEST_THE_HAND_IN_THE_SAND) >= SAND_QUEST_COMPLETE
&& (client.getVar(Varbits.DAILY_SAND_COLLECTED) == 0 && (client.getVar(Varbits.DAILY_SAND_COLLECTED) == 0
|| dailyReset)) || dailyReset))
{ {

View File

@@ -64,13 +64,15 @@ class Lootbeam
short hsl = JagexColor.rgbToHSL(l.color.getRGB(), 1.0d); short hsl = JagexColor.rgbToHSL(l.color.getRGB(), 1.0d);
int hue = JagexColor.unpackHue(hsl); int hue = JagexColor.unpackHue(hsl);
int sat = Math.min(JagexColor.unpackSaturation(hsl) + 1, JagexColor.SATURATION_MAX); int sat = JagexColor.unpackSaturation(hsl);
int lum = JagexColor.unpackLuminance(hsl); int lum = JagexColor.unpackLuminance(hsl);
int satDelta = sat > 2 ? 1 : 0;
return md.cloneColors() return md.cloneColors()
.recolor((short) 26432, JagexColor.packHSL(hue, sat, Math.min(lum + 12, JagexColor.LUMINANCE_MAX))) .recolor((short) 26432, JagexColor.packHSL(hue, sat - satDelta, lum))
.recolor((short) 26584, JagexColor.packHSL(hue, sat - 1, Math.max(lum - 12, 0))) .recolor((short) 26584, JagexColor.packHSL(hue, sat, Math.min(lum + 24, JagexColor.LUMINANCE_MAX)))
.light(75, 1875, ModelData.DEFAULT_X, ModelData.DEFAULT_Y, ModelData.DEFAULT_Z); .light(75 + ModelData.DEFAULT_AMBIENT, 1875 + ModelData.DEFAULT_CONTRAST,
ModelData.DEFAULT_X, ModelData.DEFAULT_Y, ModelData.DEFAULT_Z);
}, anim(AnimationID.LOOTBEAM_ANIMATION)), }, anim(AnimationID.LOOTBEAM_ANIMATION)),
; ;

View File

@@ -117,4 +117,15 @@ public interface NpcAggroAreaConfig extends Config
{ {
return false; return false;
} }
@ConfigItem(
keyName = "hideIfOutOfCombat",
name = "Hide when out of combat",
description = "Hides unaggressive area lines when out of combat.",
position = 8
)
default boolean hideIfOutOfCombat()
{
return false;
}
} }

View File

@@ -34,6 +34,7 @@ import java.time.Instant;
import javax.inject.Inject; import javax.inject.Inject;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.Perspective; import net.runelite.api.Perspective;
import net.runelite.api.Player;
import net.runelite.api.Point; import net.runelite.api.Point;
import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.LocalPoint;
import net.runelite.api.geometry.Geometry; import net.runelite.api.geometry.Geometry;
@@ -70,6 +71,12 @@ class NpcAggroAreaOverlay extends Overlay
return null; return null;
} }
final Player localPlayer = client.getLocalPlayer();
if (localPlayer.getHealthScale() == -1 && config.hideIfOutOfCombat())
{
return null;
}
GeneralPath lines = plugin.getLinesToDisplay()[client.getPlane()]; GeneralPath lines = plugin.getLinesToDisplay()[client.getPlane()];
if (lines == null) if (lines == null)
{ {

View File

@@ -565,10 +565,10 @@ public class SlayerPlugin extends Plugin
log.debug("Slayer xp change delta: {}, killed npcs: {}", delta, taggedNpcsDiedPrevTick); log.debug("Slayer xp change delta: {}, killed npcs: {}", delta, taggedNpcsDiedPrevTick);
final Task task = Task.getTask(taskName); final Task task = Task.getTask(taskName);
if (task != null && task.getMinimumKillXp() > 0) if (task != null && task.getXpMatcher() != null)
{ {
// Only decrement a kill if the xp drop is above the minimum threshold. This is for Tzhaar and Sire tasks. // Only decrement a kill if the xp drop delta passes the matcher. This is for Tzhaar and Sire tasks.
if (delta >= task.getMinimumKillXp()) if (task.getXpMatcher().test(delta))
{ {
killed(max(taggedNpcsDiedPrevTick, 1)); killed(max(taggedNpcsDiedPrevTick, 1));
} }

View File

@@ -30,6 +30,7 @@ import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.IntPredicate;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import lombok.Getter; import lombok.Getter;
import net.runelite.api.ItemID; import net.runelite.api.ItemID;
@@ -42,9 +43,10 @@ enum Task
// Abyssal demon - 150 xp // Abyssal demon - 150 xp
// Greater abyssal demon - 4200 xp // Greater abyssal demon - 4200 xp
// Abyssal sire - 450 xp // Abyssal sire - 450 xp
// Use 51 for minimum xp to avoid a kill triggering from killing the sire vents // Reanimated abyssal - 31 xp
ABYSSAL_DEMONS("Abyssal demons", ItemID.ABYSSAL_DEMON, 51), // Ignore 50xp drops to avoid recording a kill from sire vents
ABYSSAL_SIRE("Abyssal Sire", ItemID.ABYSSAL_ORPHAN, 51), ABYSSAL_DEMONS("Abyssal demons", ItemID.ABYSSAL_DEMON, (xp) -> xp != 50),
ABYSSAL_SIRE("Abyssal Sire", ItemID.ABYSSAL_ORPHAN, (xp) -> xp != 50),
ADAMANT_DRAGONS("Adamant dragons", ItemID.ADAMANT_DRAGON_MASK), ADAMANT_DRAGONS("Adamant dragons", ItemID.ADAMANT_DRAGON_MASK),
ALCHEMICAL_HYDRA("Alchemical Hydra", ItemID.IKKLE_HYDRA), ALCHEMICAL_HYDRA("Alchemical Hydra", ItemID.IKKLE_HYDRA),
ANKOU("Ankou", ItemID.ANKOU_MASK), ANKOU("Ankou", ItemID.ANKOU_MASK),
@@ -114,7 +116,7 @@ enum Task
ICE_WARRIORS("Ice warriors", ItemID.MITHRIL_FULL_HELM_T, "Icelord"), ICE_WARRIORS("Ice warriors", ItemID.MITHRIL_FULL_HELM_T, "Icelord"),
INFERNAL_MAGES("Infernal mages", ItemID.INFERNAL_MAGE, "Malevolent mage"), INFERNAL_MAGES("Infernal mages", ItemID.INFERNAL_MAGE, "Malevolent mage"),
IRON_DRAGONS("Iron dragons", ItemID.IRON_DRAGON_MASK), IRON_DRAGONS("Iron dragons", ItemID.IRON_DRAGON_MASK),
JAD("TzTok-Jad", ItemID.TZREKJAD, 25250), JAD("TzTok-Jad", ItemID.TZREKJAD, (xp) -> xp == 25250),
JELLIES("Jellies", ItemID.JELLY, "Jelly"), JELLIES("Jellies", ItemID.JELLY, "Jelly"),
JUNGLE_HORROR("Jungle horrors", ItemID.ENSOULED_HORROR_HEAD), JUNGLE_HORROR("Jungle horrors", ItemID.ENSOULED_HORROR_HEAD),
KALPHITE("Kalphite", ItemID.KALPHITE_SOLDIER), KALPHITE("Kalphite", ItemID.KALPHITE_SOLDIER),
@@ -183,7 +185,7 @@ enum Task
WYRMS("Wyrms", ItemID.WYRM), WYRMS("Wyrms", ItemID.WYRM),
ZILYANA("Commander Zilyana", ItemID.PET_ZILYANA), ZILYANA("Commander Zilyana", ItemID.PET_ZILYANA),
ZOMBIES("Zombies", ItemID.ZOMBIE_HEAD, "Undead"), ZOMBIES("Zombies", ItemID.ZOMBIE_HEAD, "Undead"),
ZUK("TzKal-Zuk", ItemID.TZREKZUK, 101890), ZUK("TzKal-Zuk", ItemID.TZREKZUK, (xp) -> xp == 101890),
ZULRAH("Zulrah", ItemID.PET_SNAKELING); ZULRAH("Zulrah", ItemID.PET_SNAKELING);
//</editor-fold> //</editor-fold>
@@ -242,7 +244,8 @@ enum Task
private final String[] targetNames; private final String[] targetNames;
private final int weaknessThreshold; private final int weaknessThreshold;
private final int weaknessItem; private final int weaknessItem;
private final int minimumKillXp; @Nullable
private final IntPredicate xpMatcher;
static static
{ {
@@ -264,7 +267,7 @@ enum Task
this.weaknessThreshold = -1; this.weaknessThreshold = -1;
this.weaknessItem = -1; this.weaknessItem = -1;
this.targetNames = targetNames; this.targetNames = targetNames;
this.minimumKillXp = 0; this.xpMatcher = null;
} }
Task(String name, int itemSpriteId, int weaknessThreshold, int weaknessItem, String... targetNames) Task(String name, int itemSpriteId, int weaknessThreshold, int weaknessItem, String... targetNames)
@@ -275,10 +278,10 @@ enum Task
this.weaknessThreshold = weaknessThreshold; this.weaknessThreshold = weaknessThreshold;
this.weaknessItem = weaknessItem; this.weaknessItem = weaknessItem;
this.targetNames = targetNames; this.targetNames = targetNames;
this.minimumKillXp = 0; this.xpMatcher = null;
} }
Task(String name, int itemSpriteId, int minimumKillXp) Task(String name, int itemSpriteId, IntPredicate xpMatcher)
{ {
Preconditions.checkArgument(itemSpriteId >= 0); Preconditions.checkArgument(itemSpriteId >= 0);
this.name = name; this.name = name;
@@ -286,7 +289,7 @@ enum Task
this.weaknessThreshold = -1; this.weaknessThreshold = -1;
this.weaknessItem = -1; this.weaknessItem = -1;
this.targetNames = new String[0]; this.targetNames = new String[0];
this.minimumKillXp = minimumKillXp; this.xpMatcher = xpMatcher;
} }
@Nullable @Nullable

View File

@@ -41,7 +41,8 @@ enum TeleportWidget
WidgetInfo.SPELL_EDGEVILLE_HOME_TELEPORT.getId(), WidgetInfo.SPELL_EDGEVILLE_HOME_TELEPORT.getId(),
WidgetInfo.SPELL_LUNAR_HOME_TELEPORT.getId(), WidgetInfo.SPELL_LUNAR_HOME_TELEPORT.getId(),
WidgetInfo.SPELL_ARCEUUS_HOME_TELEPORT.getId(), WidgetInfo.SPELL_ARCEUUS_HOME_TELEPORT.getId(),
WidgetInfo.SPELL_KOUREND_HOME_TELEPORT.getId() WidgetInfo.SPELL_KOUREND_HOME_TELEPORT.getId(),
WidgetInfo.SPELL_CATHERBY_HOME_TELEPORT.getId()
); );
private static final Collection MINIGAME_TELEPORT_IDS = ImmutableList.of( private static final Collection MINIGAME_TELEPORT_IDS = ImmutableList.of(
WidgetInfo.MINIGAME_TELEPORT_BUTTON.getId() WidgetInfo.MINIGAME_TELEPORT_BUTTON.getId()

View File

@@ -958,7 +958,8 @@ public class TimersPlugin extends Plugin
&& client.getLocalPlayer().getAnimation() == AnimationID.IDLE && client.getLocalPlayer().getAnimation() == AnimationID.IDLE
&& (lastAnimation == AnimationID.BOOK_HOME_TELEPORT_5 && (lastAnimation == AnimationID.BOOK_HOME_TELEPORT_5
|| lastAnimation == AnimationID.COW_HOME_TELEPORT_6 || lastAnimation == AnimationID.COW_HOME_TELEPORT_6
|| lastAnimation == AnimationID.LEAGUE_HOME_TELEPORT_6)) || lastAnimation == AnimationID.LEAGUE_HOME_TELEPORT_6
|| lastAnimation == AnimationID.SHATTERED_LEAGUE_HOME_TELEPORT_6))
{ {
if (lastTeleportClicked == TeleportWidget.HOME_TELEPORT) if (lastTeleportClicked == TeleportWidget.HOME_TELEPORT)
{ {