Merge pull request #1803 from Owain94/1710-merge
project: Merge upstream
This commit is contained in:
@@ -19,4 +19,5 @@ classes/artifacts/client_jar/client.jar
|
||||
*/out/
|
||||
.gradle/
|
||||
runelite-client/src/main/resources/runelite/*
|
||||
runelite-client/dependencies.txt
|
||||
.staging/
|
||||
+1
-1
@@ -92,7 +92,7 @@ allprojects {
|
||||
if (this.name != 'rs-client') apply plugin: 'checkstyle'
|
||||
|
||||
group = 'com.openosrs'
|
||||
version = '1.5.36-SNAPSHOT'
|
||||
version = '1.5.37-SNAPSHOT'
|
||||
|
||||
ext {
|
||||
rsversion = 184
|
||||
|
||||
@@ -25,119 +25,39 @@
|
||||
package net.runelite.api;
|
||||
|
||||
/**
|
||||
* Represents an indexed sprite.
|
||||
* Represents an paletted sprite.
|
||||
*/
|
||||
public interface IndexedSprite
|
||||
{
|
||||
/**
|
||||
* Gets the pixels contained by the sprite.
|
||||
*
|
||||
* @return the sprite pixels
|
||||
* The bitmap of this sprite. Each value is an index into {@link #getPalette()}.
|
||||
* 0 is transparent
|
||||
*/
|
||||
byte[] getPixels();
|
||||
|
||||
/**
|
||||
* Sets the pixels contained by the sprite.
|
||||
*
|
||||
* @param pixels the new sprite pixels
|
||||
*/
|
||||
void setPixels(byte[] pixels);
|
||||
|
||||
/**
|
||||
* Gets the color palette for the sprites pixels.
|
||||
*
|
||||
* @return the color palette
|
||||
* The color palette in RGB. The zero index is unused.
|
||||
*/
|
||||
int[] getPalette();
|
||||
|
||||
/**
|
||||
* Sets the color palette for the sprites pixels.
|
||||
*
|
||||
* @param palette the new color palette
|
||||
*/
|
||||
void setPalette(int[] palette);
|
||||
|
||||
/**
|
||||
* Gets the offset of the sprite along the x-axis.
|
||||
*
|
||||
* @return the x-axis offset
|
||||
*/
|
||||
int getOffsetX();
|
||||
|
||||
/**
|
||||
* Sets the offset of the sprite along the x-axis.
|
||||
*
|
||||
* @param offsetX new x-axis offset
|
||||
*/
|
||||
void setOffsetX(int offsetX);
|
||||
|
||||
/**
|
||||
* Gets the offset of the sprite along the y-axis.
|
||||
*
|
||||
* @return the y-axis offset
|
||||
*/
|
||||
int getOffsetY();
|
||||
|
||||
/**
|
||||
* Sets the offset of the sprite along the y-axis.
|
||||
*
|
||||
* @param offsetY new y-axis offset
|
||||
*/
|
||||
void setOffsetY(int offsetY);
|
||||
|
||||
/**
|
||||
* Gets the width of the sprite.
|
||||
*
|
||||
* @return the width
|
||||
*/
|
||||
int getWidth();
|
||||
|
||||
/**
|
||||
* Sets the width of the sprite.
|
||||
*
|
||||
* @param width the new width
|
||||
*/
|
||||
void setWidth(int width);
|
||||
|
||||
/**
|
||||
* Gets the original width of the sprite.
|
||||
*
|
||||
* @return the width
|
||||
*/
|
||||
int getOriginalWidth();
|
||||
|
||||
/**
|
||||
* Sets the original width of the sprite.
|
||||
*
|
||||
* @param originalWidth the width
|
||||
*/
|
||||
int getHeight();
|
||||
void setHeight(int height);
|
||||
|
||||
int getOriginalWidth();
|
||||
void setOriginalWidth(int originalWidth);
|
||||
|
||||
/**
|
||||
* Gets the height of the sprite.
|
||||
*
|
||||
* @return the height
|
||||
*/
|
||||
int getHeight();
|
||||
|
||||
/**
|
||||
* Sets the height of the sprite.
|
||||
*
|
||||
* @param height the height
|
||||
*/
|
||||
void setHeight(int height);
|
||||
|
||||
/**
|
||||
* Gets the original height of the sprite.
|
||||
*
|
||||
* @return the height
|
||||
*/
|
||||
int getOriginalHeight();
|
||||
|
||||
/**
|
||||
* Sets the original height of the sprite.
|
||||
*
|
||||
* @param originalHeight the height
|
||||
*/
|
||||
void setOriginalHeight(int originalHeight);
|
||||
}
|
||||
|
||||
@@ -8080,16 +8080,17 @@ public final class ItemID
|
||||
public static final int BIRD_SNARE_PACK = 12740;
|
||||
public static final int BOX_TRAP_PACK = 12742;
|
||||
public static final int MAGIC_IMP_BOX_PACK = 12744;
|
||||
public static final int MYSTERIOUS_EMBLEM = 12746;
|
||||
public static final int MYSTERIOUS_EMBLEM_TIER_2 = 12748;
|
||||
public static final int MYSTERIOUS_EMBLEM_TIER_3 = 12749;
|
||||
public static final int MYSTERIOUS_EMBLEM_TIER_4 = 12750;
|
||||
public static final int MYSTERIOUS_EMBLEM_TIER_5 = 12751;
|
||||
public static final int MYSTERIOUS_EMBLEM_TIER_6 = 12752;
|
||||
public static final int MYSTERIOUS_EMBLEM_TIER_7 = 12753;
|
||||
public static final int MYSTERIOUS_EMBLEM_TIER_8 = 12754;
|
||||
public static final int MYSTERIOUS_EMBLEM_TIER_9 = 12755;
|
||||
public static final int MYSTERIOUS_EMBLEM_TIER_10 = 12756;
|
||||
public static final int ARCHAIC_EMBLEM_TIER_1 = 12746;
|
||||
public static final int ARCHAIC_EMBLEM_TIER_1_12747 = 12747;
|
||||
public static final int ARCHAIC_EMBLEM_TIER_2 = 12748;
|
||||
public static final int ARCHAIC_EMBLEM_TIER_3 = 12749;
|
||||
public static final int ARCHAIC_EMBLEM_TIER_4 = 12750;
|
||||
public static final int ARCHAIC_EMBLEM_TIER_5 = 12751;
|
||||
public static final int ARCHAIC_EMBLEM_TIER_6 = 12752;
|
||||
public static final int ARCHAIC_EMBLEM_TIER_7 = 12753;
|
||||
public static final int ARCHAIC_EMBLEM_TIER_8 = 12754;
|
||||
public static final int ARCHAIC_EMBLEM_TIER_9 = 12755;
|
||||
public static final int ARCHAIC_EMBLEM_TIER_10 = 12756;
|
||||
public static final int BLUE_DARK_BOW_PAINT = 12757;
|
||||
public static final int GREEN_DARK_BOW_PAINT = 12759;
|
||||
public static final int YELLOW_DARK_BOW_PAINT = 12761;
|
||||
@@ -10860,6 +10861,7 @@ public final class ItemID
|
||||
public static final int HEALER_ICON_23484 = 23484;
|
||||
public static final int HEALER_ICON_23485 = 23485;
|
||||
public static final int HEALER_ICON_23486 = 23486;
|
||||
public static final int ARCHAIC_EMBLEM_TIER_10_23487 = 23487;
|
||||
public static final int WINE_OF_ZAMORAK_23489 = 23489;
|
||||
public static final int LARRANS_KEY = 23490;
|
||||
public static final int SRARACHA = 23495;
|
||||
@@ -11285,5 +11287,11 @@ public final class ItemID
|
||||
public static final int BASILISK_JAW = 24268;
|
||||
public static final int NEITIZNOT_FACEGUARD = 24271;
|
||||
public static final int BASILISK_KNIGHT = 24276;
|
||||
public static final int MYSTERIOUS_EMBLEM_TIER_1 = 24277;
|
||||
public static final int MYSTERIOUS_EMBLEM_TIER_2 = 24279;
|
||||
public static final int MYSTERIOUS_EMBLEM_TIER_3 = 24281;
|
||||
public static final int MYSTERIOUS_EMBLEM_TIER_4 = 24283;
|
||||
public static final int MYSTERIOUS_EMBLEM_TIER_5 = 24285;
|
||||
public static final int DECORATIVE_EMBLEM = 24287;
|
||||
/* This file is automatically generated. Do not edit. */
|
||||
}
|
||||
|
||||
@@ -24,91 +24,70 @@
|
||||
*/
|
||||
package net.runelite.api;
|
||||
|
||||
/**
|
||||
* Information about a specific {@link NpcID}
|
||||
*/
|
||||
public interface NPCDefinition
|
||||
{
|
||||
/**
|
||||
* Gets the name of the NPC.
|
||||
*
|
||||
* @return the name
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Gets the model IDs that compose this NPC.
|
||||
*
|
||||
* @return the NPCs model IDs
|
||||
*/
|
||||
int[] getModels();
|
||||
|
||||
/**
|
||||
* Gets an array of possible right-click menu actions that can be
|
||||
* performed on the NPC.
|
||||
*
|
||||
* @return the menu actions
|
||||
* The 5 menuops this NPC has when in world. Index 0 corresponds to
|
||||
* {@link MenuAction#NPC_FIRST_OPTION}, Index 2 to
|
||||
* {@link MenuAction#NPC_SECOND_OPTION} and so on.
|
||||
*/
|
||||
String[] getActions();
|
||||
|
||||
/**
|
||||
* Gets whether the NPC can be clicked.
|
||||
*
|
||||
* @return true if the NPC can be clicked, false otherwise
|
||||
*/
|
||||
boolean isClickable();
|
||||
|
||||
/**
|
||||
* Gets whether the NPC is visible on the mini-map.
|
||||
*
|
||||
* @return the mini-map visible state
|
||||
*/
|
||||
boolean isMinimapVisible();
|
||||
|
||||
/**
|
||||
* Gets whether the NPC is visible.
|
||||
*
|
||||
* @return the visible state
|
||||
*/
|
||||
boolean isVisible();
|
||||
|
||||
/**
|
||||
* Gets the ID of the NPC.
|
||||
*
|
||||
* @return the ID of the NPC
|
||||
* @see NpcID
|
||||
*/
|
||||
int getId();
|
||||
|
||||
/**
|
||||
* Gets the combat level of the NPC.
|
||||
*
|
||||
* @return the combat level, -1 if none
|
||||
*/
|
||||
int getCombatLevel();
|
||||
|
||||
/**
|
||||
* Gets the configuration data for the NPC.
|
||||
*
|
||||
* @return the configuration data
|
||||
* Get the {@link NpcID}s of NPCs this can transform into, depending
|
||||
* on a {@link Varbits} or {@link VarPlayer}
|
||||
*/
|
||||
int[] getConfigs();
|
||||
|
||||
/**
|
||||
* Transforms this NPC into a new state, which may have a different ID.
|
||||
* Get the NPC composition the player's state says this NPC should
|
||||
* transmogrify into.
|
||||
*
|
||||
* @return the transformed composition
|
||||
* @throws NullPointerException if {@link #getConfigs()} is null
|
||||
*/
|
||||
NPCDefinition transform();
|
||||
|
||||
/**
|
||||
* Gets the size of the NPC.
|
||||
*
|
||||
* @return the NPCs size
|
||||
* How many tiles wide this NPC is
|
||||
*/
|
||||
int getSize();
|
||||
|
||||
/**
|
||||
* Gets the displayed overhead icon of the NPC.
|
||||
*
|
||||
* @return the overhead icon
|
||||
*/
|
||||
HeadIcon getOverheadIcon();
|
||||
}
|
||||
|
||||
@@ -286,7 +286,6 @@ public final class NpcID
|
||||
public static final int DWARF = 290;
|
||||
public static final int CHAOS_DWARF = 291;
|
||||
public static final int DWARF_292 = 292;
|
||||
public static final int DWARF_293 = 293;
|
||||
public static final int DWARF_294 = 294;
|
||||
public static final int DWARF_295 = 295;
|
||||
public static final int DWARF_296 = 296;
|
||||
@@ -301,14 +300,13 @@ public final class NpcID
|
||||
public static final int JENNIFER = 305;
|
||||
public static final int LUMBRIDGE_GUIDE = 306;
|
||||
public static final int DR_JEKYLL = 307;
|
||||
public static final int EMBLEM_TRADER = 308;
|
||||
public static final int REACHER = 309;
|
||||
public static final int AYESHA = 310;
|
||||
public static final int ADAM = 311;
|
||||
public static final int FROG = 312;
|
||||
public static final int REACHER_313 = 313;
|
||||
public static final int DR_JEKYLL_314 = 314;
|
||||
public static final int EMBLEM_TRADER = 315;
|
||||
public static final int EMBLEM_TRADER_316 = 316;
|
||||
public static final int PAUL = 317;
|
||||
public static final int DARK_CORE = 318;
|
||||
public static final int CORPOREAL_BEAST = 319;
|
||||
@@ -7161,8 +7159,7 @@ public final class NpcID
|
||||
public static final int REVENANT_DARK_BEAST = 7938;
|
||||
public static final int REVENANT_KNIGHT = 7939;
|
||||
public static final int REVENANT_DRAGON = 7940;
|
||||
public static final int EMBLEM_TRADER_7941 = 7941;
|
||||
public static final int EMBLEM_TRADER_7942 = 7942;
|
||||
public static final int EMBLEM_TRADER_7943 = 7943;
|
||||
public static final int FISHING_SPOT_7946 = 7946;
|
||||
public static final int FISHING_SPOT_7947 = 7947;
|
||||
public static final int CORSAIR_TRAITOR_HARD = 7948;
|
||||
|
||||
@@ -4551,7 +4551,6 @@ public final class NullItemID
|
||||
public static final int NULL_12741 = 12741;
|
||||
public static final int NULL_12743 = 12743;
|
||||
public static final int NULL_12745 = 12745;
|
||||
public static final int NULL_12747 = 12747;
|
||||
public static final int NULL_12758 = 12758;
|
||||
public static final int NULL_12760 = 12760;
|
||||
public static final int NULL_12762 = 12762;
|
||||
@@ -12416,7 +12415,6 @@ public final class NullItemID
|
||||
public static final int NULL_23456 = 23456;
|
||||
public static final int NULL_23457 = 23457;
|
||||
public static final int NULL_23459 = 23459;
|
||||
public static final int NULL_23487 = 23487;
|
||||
public static final int NULL_23488 = 23488;
|
||||
public static final int NULL_23491 = 23491;
|
||||
public static final int NULL_23492 = 23492;
|
||||
@@ -12783,5 +12781,10 @@ public final class NullItemID
|
||||
public static final int NULL_24273 = 24273;
|
||||
public static final int NULL_24274 = 24274;
|
||||
public static final int NULL_24275 = 24275;
|
||||
public static final int NULL_24278 = 24278;
|
||||
public static final int NULL_24280 = 24280;
|
||||
public static final int NULL_24282 = 24282;
|
||||
public static final int NULL_24284 = 24284;
|
||||
public static final int NULL_24286 = 24286;
|
||||
/* This file is automatically generated. Do not edit. */
|
||||
}
|
||||
|
||||
@@ -25,58 +25,52 @@
|
||||
package net.runelite.api;
|
||||
|
||||
/**
|
||||
* Represents the template of a specific object.
|
||||
* Information about a specific {@link ObjectID}
|
||||
*/
|
||||
public interface ObjectDefinition
|
||||
{
|
||||
/**
|
||||
* Gets ID for the object.
|
||||
*
|
||||
* @return the object ID
|
||||
* @see ObjectID
|
||||
*/
|
||||
int getId();
|
||||
|
||||
/**
|
||||
* Gets the name of the object.
|
||||
*
|
||||
* @return the object name
|
||||
*/
|
||||
String getName();
|
||||
|
||||
/**
|
||||
* Gets an array of possible right-click menu actions that can be
|
||||
* performed on the object.
|
||||
*
|
||||
* @return the menu actions
|
||||
* The 5 menuops this object has when in world. Index 0 corresponds to
|
||||
* {@link MenuAction#GAME_OBJECT_FIRST_OPTION}, Index 2 to
|
||||
* {@link MenuAction#GAME_OBJECT_SECOND_OPTION} and so on.
|
||||
*/
|
||||
String[] getActions();
|
||||
|
||||
/**
|
||||
* Gets the map scene ID for the object.
|
||||
*
|
||||
* @return the scene ID
|
||||
* Gets the index of this object in the {@link Client#getMapScene()}
|
||||
* array, or -1 if it has no map scene icon
|
||||
*/
|
||||
int getMapSceneId();
|
||||
|
||||
/**
|
||||
* Gets the map icon ID for the object.
|
||||
*
|
||||
* @return the map icon ID
|
||||
* Gets the index of this object in the {@link Client#getMapIcons()}
|
||||
* array, or -1 if it has no full map icon
|
||||
*/
|
||||
int getMapIconId();
|
||||
|
||||
/**
|
||||
* Gets IDs for objects that are considered fakes of this object,
|
||||
* such as barrows walls.
|
||||
*
|
||||
* @return the impostor IDs
|
||||
* Get the {@link ObjectID}s of objects this can transform into, depending
|
||||
* on a {@link Varbits} or {@link VarPlayer}
|
||||
*/
|
||||
int[] getImpostorIds();
|
||||
|
||||
/**
|
||||
* Gets the impostor composition for this object.
|
||||
* Get the object composition the player's state says this object should
|
||||
* transmogrify into.
|
||||
*
|
||||
* @return the impostor
|
||||
* @throws NullPointerException if {@link #getImpostorIds()} is null
|
||||
*/
|
||||
ObjectDefinition getImpostor();
|
||||
}
|
||||
|
||||
@@ -19383,5 +19383,6 @@ public final class ObjectID
|
||||
public static final int DOOR_37422 = 37422;
|
||||
public static final int THE_JORMUNGAND = 37424;
|
||||
public static final int ROUGH_WALL_37431 = 37431;
|
||||
public static final int STREAK_INFO = 37434;
|
||||
/* This file is automatically generated. Do not edit. */
|
||||
}
|
||||
|
||||
@@ -30,21 +30,19 @@ public interface TextureProvider
|
||||
|
||||
/**
|
||||
* Set the brightness for textures, clearing the texture cache.
|
||||
* @param brightness
|
||||
*
|
||||
* .9 is the darkest value available in the standard options
|
||||
* .6 is the brightest value
|
||||
*/
|
||||
void setBrightness(double brightness);
|
||||
|
||||
/**
|
||||
* Get all textures
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
Texture[] getTextures();
|
||||
|
||||
/**
|
||||
* Get the pixels for a texture
|
||||
* @param textureId
|
||||
* @return
|
||||
*/
|
||||
int[] load(int textureId);
|
||||
}
|
||||
|
||||
@@ -30,17 +30,10 @@ package net.runelite.api;
|
||||
public interface TileItem extends Entity
|
||||
{
|
||||
/**
|
||||
* Gets the items ID.
|
||||
*
|
||||
* @return the ID of the item
|
||||
* @see ItemID
|
||||
*/
|
||||
int getId();
|
||||
|
||||
/**
|
||||
* Gets the items quantity.
|
||||
*
|
||||
* @return the items quantity
|
||||
*/
|
||||
int getQuantity();
|
||||
}
|
||||
|
||||
@@ -32,88 +32,65 @@ import java.awt.Shape;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Represents an object that a tile holds.
|
||||
* Represents an object on a Tile
|
||||
*/
|
||||
public interface TileObject extends Locatable
|
||||
{
|
||||
/**
|
||||
* Gets the hashed value of this object.
|
||||
*
|
||||
* @return the object hash
|
||||
*/
|
||||
long getHash();
|
||||
|
||||
/**
|
||||
* Gets the x-axis coordinate of the object in local context.
|
||||
*
|
||||
* @return the x-axis coordinate
|
||||
* @see LocalPoint
|
||||
*/
|
||||
int getX();
|
||||
|
||||
/**
|
||||
* Gets the y-axis coordinate of the object in local context.
|
||||
*
|
||||
* @return the y-axis coordinate
|
||||
* @see LocalPoint
|
||||
*/
|
||||
int getY();
|
||||
|
||||
/**
|
||||
* Gets the plane of the tile that the object is on.
|
||||
*
|
||||
* @return the tile plane
|
||||
*/
|
||||
int getPlane();
|
||||
|
||||
/**
|
||||
* Gets the ID of the object.
|
||||
*
|
||||
* @return the object ID
|
||||
* @see ObjectID
|
||||
* @see NullObjectID
|
||||
*/
|
||||
int getId();
|
||||
|
||||
/**
|
||||
* Gets the location coordinate of the object in the world.
|
||||
*
|
||||
* @return the world location
|
||||
*/
|
||||
WorldPoint getWorldLocation();
|
||||
|
||||
/**
|
||||
* Gets the local location of the object.
|
||||
*
|
||||
* @return the local location
|
||||
*/
|
||||
LocalPoint getLocalLocation();
|
||||
|
||||
/**
|
||||
* Gets the upper-left canvas point where this object is drawn.
|
||||
*
|
||||
* @return the canvas location
|
||||
* Calculates the position of the center of this tile on the canvas
|
||||
*/
|
||||
Point getCanvasLocation();
|
||||
|
||||
/**
|
||||
* Gets the upper-left canvas point where this object is drawn,
|
||||
* offset by the passed value.
|
||||
* Calculates the position of the center of this tile on the canvas
|
||||
*
|
||||
* @param zOffset the z-axis offset
|
||||
* @return the canvas location
|
||||
* @param zOffset Vertical offset to apply before projection
|
||||
*/
|
||||
Point getCanvasLocation(int zOffset);
|
||||
|
||||
/**
|
||||
* Gets the polygon of the objects model as drawn on the canvas.
|
||||
*
|
||||
* @return the canvas polygon
|
||||
* Creates a polygon outlining the tile this object is on
|
||||
*/
|
||||
Polygon getCanvasTilePoly();
|
||||
|
||||
/**
|
||||
* Gets the text position on the canvas.
|
||||
* Calculates the canvas point to center {@code text} above the tile this object is on.
|
||||
*
|
||||
* @param graphics the client graphics
|
||||
* @param text the text to draw
|
||||
* @param zOffset the offset from ground plane
|
||||
* @param graphics the graphics to use for font size calculation
|
||||
* @param zOffset Vertical offset to apply before projection
|
||||
* @return the canvas point to draw the text at
|
||||
*/
|
||||
Point getCanvasTextLocation(Graphics2D graphics, String text, int zOffset);
|
||||
@@ -127,9 +104,7 @@ public interface TileObject extends Locatable
|
||||
Point getMinimapLocation();
|
||||
|
||||
/**
|
||||
* Get the on-screen clickable area of the object.
|
||||
*
|
||||
* @return the clickable area
|
||||
* Calculate the on-screen clickable area of the object.
|
||||
*/
|
||||
@Nullable
|
||||
Shape getClickbox();
|
||||
|
||||
@@ -28,7 +28,11 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* An enumeration of integer local variables.
|
||||
* Client side only, content-developer integers
|
||||
*
|
||||
* VarCInts are stored entirely in memory, or locally on a user's
|
||||
* machine in the preferences2.dat file depending on how Jagex
|
||||
* configured the variable
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -28,7 +28,11 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* An enumeration of string local variables.
|
||||
* Client side only, content-developer strings
|
||||
*
|
||||
* VarCInts are stored entirely in memory, or locally on a user's
|
||||
* machine in the preferences2.dat file depending on how Jagex
|
||||
* configured the variable
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -28,7 +28,12 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* An enumeration of local player variables.
|
||||
* Server controlled "content-developer" integers.
|
||||
*
|
||||
* VarPlayers are stored per RuneScape player save, and synchronized
|
||||
* from the server to the client. The client can change them preemptively
|
||||
* if it thinks they will change the next tick as a lag-hiding measure.
|
||||
* The client CANNOT directly make the server change a varbit.
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -28,7 +28,15 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* An enumeration of local client variables.
|
||||
* Server controlled "content-developer" integers.
|
||||
*
|
||||
* @see VarPlayer
|
||||
*
|
||||
* These differ from a {@link VarPlayer} in that VarBits can be
|
||||
* less than 32 bits. One or more VarBits can be assigned to a
|
||||
* backing VarPlayer, each with a static range of bits that it is
|
||||
* allowed to access. This allows a more compact representation
|
||||
* of small values, like booleans
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
|
||||
@@ -34,11 +34,12 @@ import lombok.Data;
|
||||
public class ScriptCallbackEvent implements Event
|
||||
{
|
||||
/**
|
||||
* The script being called.
|
||||
* The script that is currently being executed
|
||||
*/
|
||||
private Script script;
|
||||
|
||||
/**
|
||||
* The name of the event that triggered script execution.
|
||||
* The name passed to runelite_callback
|
||||
*/
|
||||
private String eventName;
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ import lombok.Value;
|
||||
|
||||
/**
|
||||
* An event where a client int var has changed.
|
||||
* @see net.runelite.api.VarClientInt
|
||||
*/
|
||||
@Value
|
||||
public class VarClientIntChanged implements Event
|
||||
|
||||
@@ -29,6 +29,7 @@ import lombok.Value;
|
||||
|
||||
/**
|
||||
* An event where a client var string has changed.
|
||||
* @see net.runelite.api.VarClientStr
|
||||
*/
|
||||
@Value
|
||||
public class VarClientStrChanged implements Event
|
||||
|
||||
@@ -30,6 +30,11 @@ import lombok.Data;
|
||||
|
||||
/**
|
||||
* An event when a varbit or varplayer has changed.
|
||||
*
|
||||
* If the client preemptively changes a varp and the server agrees
|
||||
* the next tick, VarbitChanged will only be posted when the client
|
||||
* changes the value, not the server. This can cause unintended effects
|
||||
* if the VarPlayer has special engine behavior assigned to it.
|
||||
*/
|
||||
@Data
|
||||
public class VarbitChanged implements Event
|
||||
|
||||
@@ -28,7 +28,7 @@ import net.runelite.api.widgets.WidgetInfo;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* An event where an option has been clicked in a {@link net.runelite.api.widgets.Widget}s menu.
|
||||
* A MenuManager widget menu was clicked. This event is NOT fired for non-MenuManager menu options
|
||||
*/
|
||||
@Data
|
||||
public class WidgetMenuOptionClicked implements Event
|
||||
|
||||
@@ -26,6 +26,10 @@ package net.runelite.api.widgets;
|
||||
|
||||
import net.runelite.api.ScriptEvent;
|
||||
|
||||
/**
|
||||
* An object that can be set as the first argument to a {@link Widget} listener
|
||||
* to handle ScriptEvents with Java code, rather than cs2.
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface JavaScriptCallback
|
||||
{
|
||||
|
||||
@@ -986,11 +986,11 @@ public class WidgetID
|
||||
static final int PVP_WIDGET_CONTAINER = 54; // OUTDATED?
|
||||
static final int SKULL = 56; // OUTDATED?
|
||||
static final int ATTACK_RANGE = 59; // OUTDATED?
|
||||
static final int BOUNTY_HUNTER_INFO = 18;
|
||||
static final int KILLDEATH_RATIO = 15;
|
||||
static final int SKULL_CONTAINER = 61;
|
||||
static final int SAFE_ZONE = 63;
|
||||
static final int WILDERNESS_LEVEL = 66; // this can also be the Deadman Mode "Protection" text
|
||||
static final int BOUNTY_HUNTER_INFO = 6;
|
||||
static final int KILLDEATH_RATIO = 33;
|
||||
static final int SKULL_CONTAINER = 53;
|
||||
static final int SAFE_ZONE = 55;
|
||||
static final int WILDERNESS_LEVEL = 57; // this can also be the Deadman Mode "Protection" text
|
||||
}
|
||||
|
||||
static class KourendFavour
|
||||
|
||||
@@ -223,7 +223,7 @@ public enum AgilityShortcut
|
||||
BRIMHAVEN_DUNGEON_VINE_EAST(87, "Vine", new WorldPoint(2672, 9582, 0), VINE_26880, VINE_26882),
|
||||
BRIMHAVEN_DUNGEON_VINE_WEST(87, "Vine", new WorldPoint(2606, 9584, 0), VINE_26880, VINE_26882),
|
||||
MOUNT_KARUULM_PIPE_SOUTH(88, "Pipe", new WorldPoint(1316, 10214, 0), MYSTERIOUS_PIPE),
|
||||
MOUNT_KARUULM_PIPE_NORTH(88, "Pipe", new WorldPoint(1346, 10231, 0), MYSTERIOUS_PIPE),
|
||||
MOUNT_KARUULM_PIPE_NORTH(88, "Pipe", new WorldPoint(1345, 10230, 0), MYSTERIOUS_PIPE),
|
||||
REVENANT_CAVES_CHAMBER_JUMP(89, "Jump", new WorldPoint(3240, 10144, 0), PILLAR_31561);
|
||||
|
||||
/**
|
||||
|
||||
@@ -216,6 +216,8 @@ public enum ItemMapping
|
||||
ITEM_HYDRA_TAIL(HYDRA_TAIL, BONECRUSHER_NECKLACE),
|
||||
ITEM_DRAGONBONE_NECKLACE(DRAGONBONE_NECKLACE, BONECRUSHER_NECKLACE),
|
||||
ITEM_BOTTOMLESS_COMPOST_BUCKET(BOTTOMLESS_COMPOST_BUCKET, BOTTOMLESS_COMPOST_BUCKET_22997),
|
||||
ITEM_BASILISK_JAW(BASILISK_JAW, NEITIZNOT_FACEGUARD),
|
||||
ITEM_HELM_OF_NEITIZNOT(HELM_OF_NEITIZNOT, NEITIZNOT_FACEGUARD),
|
||||
|
||||
// Crystal items
|
||||
ITEM_CRYSTAL_TOOL_SEED(CRYSTAL_TOOL_SEED, CRYSTAL_AXE, CRYSTAL_AXE_INACTIVE, CRYSTAL_HARPOON, CRYSTAL_HARPOON_INACTIVE, CRYSTAL_PICKAXE, CRYSTAL_PICKAXE_INACTIVE),
|
||||
|
||||
@@ -54,7 +54,7 @@ public class ItemVariationMapping
|
||||
|
||||
static void load() throws IOException
|
||||
{
|
||||
try (JsonReader reader = new JsonReader(new InputStreamReader(ItemVariationMapping.class.getResourceAsStream("/item_variations.json"), StandardCharsets.UTF_8)))
|
||||
try (JsonReader reader = new JsonReader(new InputStreamReader(ItemVariationMapping.class.getResourceAsStream("/item_variations.min.json"), StandardCharsets.UTF_8)))
|
||||
{
|
||||
ImmutableMap.Builder<Integer, Integer> builder = ImmutableMap.builderWithExpectedSize(5039);
|
||||
reader.beginObject();
|
||||
|
||||
+15
-1
@@ -129,6 +129,12 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse
|
||||
this.clientThread = clientThread;
|
||||
}
|
||||
|
||||
public ChatboxTextInput addCharValidator(IntPredicate validator)
|
||||
{
|
||||
this.charValidator = this.charValidator.and(validator);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChatboxTextInput lines(int lines)
|
||||
{
|
||||
this.lines = lines;
|
||||
@@ -151,7 +157,15 @@ public class ChatboxTextInput extends ChatboxInput implements KeyListener, Mouse
|
||||
|
||||
public ChatboxTextInput value(String value)
|
||||
{
|
||||
this.value = new StringBuffer(value);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (char c : value.toCharArray())
|
||||
{
|
||||
if (charValidator.test(c))
|
||||
{
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
this.value = sb;
|
||||
cursorAt(this.value.length());
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.ui.overlay.infobox.Counter;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
class AmmoCounter extends Counter
|
||||
{
|
||||
@@ -56,7 +56,7 @@ class AmmoCounter extends Counter
|
||||
@Override
|
||||
public String getText()
|
||||
{
|
||||
return StackFormatter.quantityToRSDecimalStack(getCount());
|
||||
return QuantityFormatter.quantityToRSDecimalStack(getCount());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -66,7 +66,7 @@ import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.banktags.tabs.BankSearch;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Bank",
|
||||
@@ -297,11 +297,11 @@ public class BankPlugin extends Plugin
|
||||
|
||||
if (this.showExact)
|
||||
{
|
||||
strCurrentTab += StackFormatter.formatNumber(gePrice) + ")";
|
||||
strCurrentTab += QuantityFormatter.formatNumber(gePrice) + ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
strCurrentTab += StackFormatter.quantityToStackSize(gePrice) + ")";
|
||||
strCurrentTab += QuantityFormatter.quantityToStackSize(gePrice) + ")";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,11 +316,11 @@ public class BankPlugin extends Plugin
|
||||
|
||||
if (this.showExact)
|
||||
{
|
||||
strCurrentTab += StackFormatter.formatNumber(haPrice) + ")";
|
||||
strCurrentTab += QuantityFormatter.formatNumber(haPrice) + ")";
|
||||
}
|
||||
else
|
||||
{
|
||||
strCurrentTab += StackFormatter.quantityToStackSize(haPrice) + ")";
|
||||
strCurrentTab += QuantityFormatter.quantityToStackSize(haPrice) + ")";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ public class BankPlugin extends Plugin
|
||||
long compare;
|
||||
try
|
||||
{
|
||||
compare = StackFormatter.stackSizeToQuantity(matcher.group("num"));
|
||||
compare = QuantityFormatter.parseQuantity(matcher.group("num"));
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
@@ -508,8 +508,8 @@ public class BankPlugin extends Plugin
|
||||
long compare1, compare2;
|
||||
try
|
||||
{
|
||||
compare1 = StackFormatter.stackSizeToQuantity(num1);
|
||||
compare2 = StackFormatter.stackSizeToQuantity(num2);
|
||||
compare1 = QuantityFormatter.parseQuantity(num1);
|
||||
compare2 = QuantityFormatter.parseQuantity(num2);
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
|
||||
+64
-4
@@ -37,6 +37,7 @@ import java.text.ParseException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Inject;
|
||||
@@ -79,10 +80,11 @@ import net.runelite.client.plugins.PluginDependency;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.banktags.tabs.BankSearch;
|
||||
import net.runelite.client.plugins.banktags.tabs.TabInterface;
|
||||
import static net.runelite.client.plugins.banktags.tabs.TabInterface.FILTERED_CHARS;
|
||||
import net.runelite.client.plugins.banktags.tabs.TabSprites;
|
||||
import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Bank Tags",
|
||||
@@ -147,6 +149,9 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
|
||||
private boolean shiftPressed = false;
|
||||
private int nextRowIndex = 0;
|
||||
@VisibleForTesting
|
||||
@@ -163,12 +168,66 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
{
|
||||
addSubscriptions();
|
||||
|
||||
cleanConfig();
|
||||
keyManager.registerKeyListener(this);
|
||||
mouseManager.registerMouseWheelListener(this);
|
||||
clientThread.invokeLater(tabInterface::init);
|
||||
spriteManager.addSpriteOverrides(TabSprites.values());
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private void cleanConfig()
|
||||
{
|
||||
removeInvalidTags("tagtabs");
|
||||
|
||||
List<String> tags = configManager.getConfigurationKeys(CONFIG_GROUP + ".item_");
|
||||
tags.forEach(s ->
|
||||
{
|
||||
String[] split = s.split("\\.", 2);
|
||||
removeInvalidTags(split[1]);
|
||||
});
|
||||
|
||||
List<String> icons = configManager.getConfigurationKeys(CONFIG_GROUP + ".icon_");
|
||||
icons.forEach(s ->
|
||||
{
|
||||
String[] split = s.split("\\.", 2);
|
||||
String replaced = split[1].replaceAll("[<>/]", "");
|
||||
if (!split[1].equals(replaced))
|
||||
{
|
||||
String value = configManager.getConfiguration(CONFIG_GROUP, split[1]);
|
||||
configManager.unsetConfiguration(CONFIG_GROUP, split[1]);
|
||||
if (replaced.length() > "icon_".length())
|
||||
{
|
||||
configManager.setConfiguration(CONFIG_GROUP, replaced, value);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
private void removeInvalidTags(final String key)
|
||||
{
|
||||
final String value = configManager.getConfiguration(CONFIG_GROUP, key);
|
||||
if (value == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String replaced = value.replaceAll("[<>/]", "");
|
||||
if (!value.equals(replaced))
|
||||
{
|
||||
replaced = Text.toCSV(Text.fromCSV(replaced));
|
||||
if (replaced.isEmpty())
|
||||
{
|
||||
configManager.unsetConfiguration(CONFIG_GROUP, key);
|
||||
}
|
||||
else
|
||||
{
|
||||
configManager.setConfiguration(CONFIG_GROUP, key, replaced);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutDown()
|
||||
{
|
||||
@@ -381,6 +440,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
String initialValue = Text.toCSV(tags);
|
||||
|
||||
chatboxPanelManager.openTextInput(name + " tags:<br>(append " + VAR_TAG_SUFFIX + " for variation tag)")
|
||||
.addCharValidator(FILTERED_CHARS)
|
||||
.value(initialValue)
|
||||
.onDone((newValue) ->
|
||||
clientThread.invoke(() ->
|
||||
@@ -529,7 +589,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
long compare;
|
||||
try
|
||||
{
|
||||
compare = StackFormatter.stackSizeToQuantity(matcher.group("num"));
|
||||
compare = QuantityFormatter.parseQuantity(matcher.group("num"));
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
@@ -558,8 +618,8 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener, KeyLis
|
||||
long compare1, compare2;
|
||||
try
|
||||
{
|
||||
compare1 = StackFormatter.stackSizeToQuantity(num1);
|
||||
compare2 = StackFormatter.stackSizeToQuantity(num2);
|
||||
compare1 = QuantityFormatter.parseQuantity(num1);
|
||||
compare2 = QuantityFormatter.parseQuantity(num2);
|
||||
}
|
||||
catch (ParseException e)
|
||||
{
|
||||
|
||||
+24
-2
@@ -45,6 +45,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Objects;
|
||||
import java.util.function.IntPredicate;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
@@ -94,6 +95,8 @@ import net.runelite.api.util.Text;
|
||||
@Singleton
|
||||
public class TabInterface
|
||||
{
|
||||
public static final IntPredicate FILTERED_CHARS = c -> "</>".indexOf(c) == -1;
|
||||
|
||||
private static final Color HILIGHT_COLOR = JagexColors.MENU_TARGET;
|
||||
private static final String SCROLL_UP = "Scroll up";
|
||||
private static final String SCROLL_DOWN = "Scroll down";
|
||||
@@ -253,6 +256,7 @@ public class TabInterface
|
||||
}
|
||||
|
||||
chatboxPanelManager.openTextInput((inventory ? "Inventory " : "Equipment ") + " tags:")
|
||||
.addCharValidator(FILTERED_CHARS)
|
||||
.onDone((newTags) ->
|
||||
clientThread.invoke(() ->
|
||||
{
|
||||
@@ -274,6 +278,7 @@ public class TabInterface
|
||||
{
|
||||
case NewTab.NEW_TAB:
|
||||
chatboxPanelManager.openTextInput("Tag name")
|
||||
.addCharValidator(FILTERED_CHARS)
|
||||
.onDone((tagName) -> clientThread.invoke(() ->
|
||||
{
|
||||
if (!Strings.isNullOrEmpty(tagName))
|
||||
@@ -286,7 +291,6 @@ public class TabInterface
|
||||
.build();
|
||||
break;
|
||||
case NewTab.IMPORT_TAB:
|
||||
|
||||
try
|
||||
{
|
||||
final String dataString = Toolkit
|
||||
@@ -297,7 +301,24 @@ public class TabInterface
|
||||
.trim();
|
||||
|
||||
final Iterator<String> dataIter = Text.fromCSV(dataString).iterator();
|
||||
final String name = dataIter.next();
|
||||
String name = dataIter.next();
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (char c : name.toCharArray())
|
||||
{
|
||||
if (FILTERED_CHARS.test(c))
|
||||
{
|
||||
sb.append(c);
|
||||
}
|
||||
}
|
||||
|
||||
if (sb.length() == 0)
|
||||
{
|
||||
notifier.notify("Failed to import tag tab from clipboard, invalid format.");
|
||||
return;
|
||||
}
|
||||
|
||||
name = sb.toString();
|
||||
|
||||
final String icon = dataIter.next();
|
||||
tabManager.setIcon(name, icon);
|
||||
|
||||
@@ -785,6 +806,7 @@ public class TabInterface
|
||||
private void renameTab(String oldTag)
|
||||
{
|
||||
chatboxPanelManager.openTextInput("Enter new tag name for tag \"" + oldTag + "\":")
|
||||
.addCharValidator(FILTERED_CHARS)
|
||||
.onDone((newTag) -> clientThread.invoke(() ->
|
||||
{
|
||||
if (!Strings.isNullOrEmpty(newTag) && !newTag.equalsIgnoreCase(oldTag))
|
||||
|
||||
+2
-2
@@ -40,7 +40,7 @@ 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.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@Singleton
|
||||
class BlastFurnaceCofferOverlay extends Overlay
|
||||
@@ -78,7 +78,7 @@ class BlastFurnaceCofferOverlay extends Overlay
|
||||
{
|
||||
sack.setHidden(true);
|
||||
|
||||
tableComponent.addRow("Coffer:", StackFormatter.quantityToStackSize(client.getVar(BLAST_FURNACE_COFFER)) + " gp");
|
||||
tableComponent.addRow("Coffer:", QuantityFormatter.quantityToStackSize(client.getVar(BLAST_FURNACE_COFFER)) + " gp");
|
||||
}
|
||||
|
||||
if (!tableComponent.isEmpty())
|
||||
|
||||
+4
-4
@@ -64,7 +64,7 @@ import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
import static net.runelite.api.util.Text.sanitize;
|
||||
import net.runelite.http.api.chat.ChatClient;
|
||||
import net.runelite.http.api.chat.Duels;
|
||||
@@ -861,11 +861,11 @@ public class ChatCommandsPlugin extends Plugin
|
||||
builder.append(ChatColorType.NORMAL);
|
||||
builder.append(": GE ");
|
||||
builder.append(ChatColorType.HIGHLIGHT);
|
||||
builder.append(StackFormatter.formatNumber(itemPrice));
|
||||
builder.append(QuantityFormatter.formatNumber(itemPrice));
|
||||
builder.append(ChatColorType.NORMAL);
|
||||
builder.append(": OSB ");
|
||||
builder.append(ChatColorType.HIGHLIGHT);
|
||||
builder.append(StackFormatter.formatNumber(osbresult.getOverall_average()));
|
||||
builder.append(QuantityFormatter.formatNumber(osbresult.getOverall_average()));
|
||||
|
||||
ItemDefinition itemComposition = itemManager.getItemDefinition(itemId);
|
||||
if (itemComposition != null)
|
||||
@@ -875,7 +875,7 @@ public class ChatCommandsPlugin extends Plugin
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(" HA value ")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(StackFormatter.formatNumber(alchPrice));
|
||||
.append(QuantityFormatter.formatNumber(alchPrice));
|
||||
}
|
||||
|
||||
String response = builder.build();
|
||||
|
||||
+1
-1
@@ -216,7 +216,7 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc
|
||||
new CrypticClue("Search the drawers in the house next to the Port Sarim mage shop.", DRAWERS, new WorldPoint(3024, 3259, 0), "House east of Betty's. Contains a cooking sink."),
|
||||
new CrypticClue("With a name like that, you'd expect a little more than just a few scimitars.", "Daga", new WorldPoint(2759, 2775, 0), "Speak to Daga on Ape Atoll."),
|
||||
new CrypticClue("Strength potions with red spiders' eggs? He is quite a herbalist.", "Apothecary", new WorldPoint(3194, 3403, 0), "Talk to Apothecary in the South-western Varrock. (the) apothecary is just north-west of the Varrock Swordshop."),
|
||||
new CrypticClue("Robin wishes to see your finest ranged equipment.", "Robin", new WorldPoint(3673, 3492, 0), "Robin at the inn in Port Phasmatys. Speak to him with +182 in ranged attack bonus."),
|
||||
new CrypticClue("Robin wishes to see your finest ranged equipment.", "Robin", new WorldPoint(3673, 3492, 0), "Robin at the inn in Port Phasmatys. Speak to him with +182 in ranged attack bonus. Bonus granted by the toxic blowpipe is ignored."),
|
||||
new CrypticClue("You will need to under-cook to solve this one.", CRATE_357, new WorldPoint(3219, 9617, 0), "Search the crate in the Lumbridge basement."),
|
||||
new CrypticClue("Search through some drawers found in Taverley's houses.", DRAWERS_350, new WorldPoint(2894, 3418, 0), "The south-eastern most house, south of Jatix's Herblore Shop."),
|
||||
new CrypticClue("Anger Abbot Langley.", "Abbot Langley", new WorldPoint(3058, 3487, 0), "Speak to Abbot Langley in the Edgeville Monastery while you have a negative prayer bonus (currently only possible with an Ancient staff)."),
|
||||
|
||||
+9
-9
@@ -58,7 +58,7 @@ import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
import net.runelite.http.api.examine.ExamineClient;
|
||||
import net.runelite.http.api.osbuddy.OSBGrandExchangeClient;
|
||||
|
||||
@@ -388,7 +388,7 @@ public class ExaminePlugin extends Plugin
|
||||
if (quantity > 1)
|
||||
{
|
||||
message
|
||||
.append(StackFormatter.formatNumber(quantity))
|
||||
.append(QuantityFormatter.formatNumber(quantity))
|
||||
.append(" x ");
|
||||
}
|
||||
|
||||
@@ -410,7 +410,7 @@ public class ExaminePlugin extends Plugin
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(" GE ")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(StackFormatter.formatNumber(gePrice * finalQuantity));
|
||||
.append(QuantityFormatter.formatNumber(gePrice * finalQuantity));
|
||||
|
||||
if (osbresult != null)
|
||||
{
|
||||
@@ -418,7 +418,7 @@ public class ExaminePlugin extends Plugin
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(" OSB ")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(StackFormatter.formatNumber(osbresult.getOverall_average() * finalQuantity));
|
||||
.append(QuantityFormatter.formatNumber(osbresult.getOverall_average() * finalQuantity));
|
||||
}
|
||||
|
||||
if (finalQuantity > 1)
|
||||
@@ -427,7 +427,7 @@ public class ExaminePlugin extends Plugin
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(" (")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(StackFormatter.formatNumber(gePrice))
|
||||
.append(QuantityFormatter.formatNumber(gePrice))
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append("ea)");
|
||||
}
|
||||
@@ -436,7 +436,7 @@ public class ExaminePlugin extends Plugin
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(" HA value ")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(StackFormatter.formatNumber(alchPrice * finalQuantity));
|
||||
.append(QuantityFormatter.formatNumber(alchPrice * finalQuantity));
|
||||
|
||||
if (finalQuantity > 1)
|
||||
{
|
||||
@@ -444,7 +444,7 @@ public class ExaminePlugin extends Plugin
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(" (")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(StackFormatter.formatNumber(alchPrice))
|
||||
.append(QuantityFormatter.formatNumber(alchPrice))
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append("ea)");
|
||||
}
|
||||
@@ -463,7 +463,7 @@ public class ExaminePlugin extends Plugin
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(" HA value ")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(StackFormatter.formatNumber(alchPrice * quantity));
|
||||
.append(QuantityFormatter.formatNumber(alchPrice * quantity));
|
||||
|
||||
if (quantity > 1)
|
||||
{
|
||||
@@ -471,7 +471,7 @@ public class ExaminePlugin extends Plugin
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(" (")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(StackFormatter.formatNumber(alchPrice))
|
||||
.append(QuantityFormatter.formatNumber(alchPrice))
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append("ea)");
|
||||
}
|
||||
|
||||
+4
-4
@@ -43,7 +43,7 @@ import javax.swing.border.EmptyBorder;
|
||||
import net.runelite.client.util.AsyncBufferedImage;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.util.LinkBrowser;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
/**
|
||||
* This panel displays an individual item result in the
|
||||
@@ -126,7 +126,7 @@ class GrandExchangeItemPanel extends JPanel
|
||||
JLabel gePriceLabel = new JLabel();
|
||||
if (gePrice > 0)
|
||||
{
|
||||
gePriceLabel.setText(StackFormatter.formatNumber(gePrice) + " gp");
|
||||
gePriceLabel.setText(QuantityFormatter.formatNumber(gePrice) + " gp");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -141,13 +141,13 @@ class GrandExchangeItemPanel extends JPanel
|
||||
|
||||
// Alch price
|
||||
JLabel haPriceLabel = new JLabel();
|
||||
haPriceLabel.setText(StackFormatter.formatNumber(haPrice) + " alch");
|
||||
haPriceLabel.setText(QuantityFormatter.formatNumber(haPrice) + " alch");
|
||||
haPriceLabel.setForeground(ColorScheme.GRAND_EXCHANGE_ALCH);
|
||||
alchAndLimitPanel.add(haPriceLabel, BorderLayout.WEST);
|
||||
|
||||
// GE Limit
|
||||
JLabel geLimitLabel = new JLabel();
|
||||
String limitLabelText = geItemLimit == 0 ? "" : "Limit " + StackFormatter.formatNumber(geItemLimit);
|
||||
String limitLabelText = geItemLimit == 0 ? "" : "Limit " + QuantityFormatter.formatNumber(geItemLimit);
|
||||
geLimitLabel.setText(limitLabelText);
|
||||
geLimitLabel.setForeground(ColorScheme.GRAND_EXCHANGE_LIMIT);
|
||||
geLimitLabel.setBorder(new CompoundBorder(geLimitLabel.getBorder(), new EmptyBorder(0, 0, 0, 7)));
|
||||
|
||||
+6
-6
@@ -57,7 +57,7 @@ import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.components.ThinProgressBar;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@Singleton
|
||||
class GrandExchangeOfferSlot extends JPanel
|
||||
@@ -228,17 +228,17 @@ class GrandExchangeOfferSlot extends JPanel
|
||||
|| newOffer.getState() == GrandExchangeOfferState.CANCELLED_BUY;
|
||||
|
||||
String offerState = (buying ? "Bought " : "Sold ")
|
||||
+ StackFormatter.quantityToRSDecimalStack(newOffer.getQuantitySold()) + " / "
|
||||
+ StackFormatter.quantityToRSDecimalStack(newOffer.getTotalQuantity());
|
||||
+ QuantityFormatter.quantityToRSDecimalStack(newOffer.getQuantitySold()) + " / "
|
||||
+ QuantityFormatter.quantityToRSDecimalStack(newOffer.getTotalQuantity());
|
||||
|
||||
offerInfo.setText(offerState);
|
||||
|
||||
itemPrice.setText(htmlLabel("Price each: ", StackFormatter.formatNumber(newOffer.getPrice())));
|
||||
itemPrice.setText(htmlLabel("Price each: ", QuantityFormatter.formatNumber(newOffer.getPrice())));
|
||||
|
||||
String action = buying ? "Spent: " : "Received: ";
|
||||
|
||||
offerSpent.setText(htmlLabel(action, StackFormatter.formatNumber(newOffer.getSpent()) + " / "
|
||||
+ StackFormatter.formatNumber(newOffer.getPrice() * newOffer.getTotalQuantity())));
|
||||
offerSpent.setText(htmlLabel(action, QuantityFormatter.formatNumber(newOffer.getSpent()) + " / "
|
||||
+ QuantityFormatter.formatNumber(newOffer.getPrice() * newOffer.getTotalQuantity())));
|
||||
|
||||
progressBar.setForeground(getProgressColor(newOffer));
|
||||
progressBar.setMaximumValue(newOffer.getTotalQuantity());
|
||||
|
||||
+5
-5
@@ -83,7 +83,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
import net.runelite.http.api.ge.GrandExchangeClient;
|
||||
@@ -504,11 +504,11 @@ public class GrandExchangePlugin extends Plugin
|
||||
|
||||
if (config.showExact())
|
||||
{
|
||||
titleBuilder.append(StackFormatter.formatNumber(total));
|
||||
titleBuilder.append(QuantityFormatter.formatNumber(total));
|
||||
}
|
||||
else
|
||||
{
|
||||
titleBuilder.append(StackFormatter.quantityToStackSize(total));
|
||||
titleBuilder.append(QuantityFormatter.quantityToStackSize(total));
|
||||
}
|
||||
|
||||
titleBuilder.append(')');
|
||||
@@ -573,7 +573,7 @@ public class GrandExchangePlugin extends Plugin
|
||||
// If we have item buy limit, append it
|
||||
if (itemLimit != null)
|
||||
{
|
||||
final String text = geText.getText() + BUY_LIMIT_GE_TEXT + StackFormatter.formatNumber(itemLimit);
|
||||
final String text = geText.getText() + BUY_LIMIT_GE_TEXT + QuantityFormatter.formatNumber(itemLimit);
|
||||
geText.setText(text);
|
||||
}
|
||||
}
|
||||
@@ -600,7 +600,7 @@ public class GrandExchangePlugin extends Plugin
|
||||
.subscribe(
|
||||
(osbresult) ->
|
||||
{
|
||||
final String text = geText.getText() + OSB_GE_TEXT + StackFormatter.formatNumber(osbresult.getOverall_average());
|
||||
final String text = geText.getText() + OSB_GE_TEXT + QuantityFormatter.formatNumber(osbresult.getOverall_average());
|
||||
if (geText.getText().contains(OSB_GE_TEXT))
|
||||
{
|
||||
// If there are multiple tasks queued and one of them have already added the price
|
||||
|
||||
+5
-5
@@ -59,7 +59,7 @@ import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.ui.overlay.components.BackgroundComponent;
|
||||
import net.runelite.client.ui.overlay.components.ProgressPieComponent;
|
||||
import net.runelite.client.ui.overlay.components.TextComponent;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@Singleton
|
||||
public class GroundItemsOverlay extends Overlay
|
||||
@@ -270,7 +270,7 @@ public class GroundItemsOverlay extends Overlay
|
||||
else
|
||||
{
|
||||
itemStringBuilder.append(" (")
|
||||
.append(StackFormatter.quantityToStackSize(item.getQuantity()))
|
||||
.append(QuantityFormatter.quantityToStackSize(item.getQuantity()))
|
||||
.append(")");
|
||||
}
|
||||
}
|
||||
@@ -280,14 +280,14 @@ public class GroundItemsOverlay extends Overlay
|
||||
if (item.getGePrice() > 0)
|
||||
{
|
||||
itemStringBuilder.append(" (EX: ")
|
||||
.append(StackFormatter.quantityToStackSize(item.getGePrice()))
|
||||
.append(QuantityFormatter.quantityToStackSize(item.getGePrice()))
|
||||
.append(" gp)");
|
||||
}
|
||||
|
||||
if (item.getHaPrice() > 0)
|
||||
{
|
||||
itemStringBuilder.append(" (HA: ")
|
||||
.append(StackFormatter.quantityToStackSize(item.getHaPrice()))
|
||||
.append(QuantityFormatter.quantityToStackSize(item.getHaPrice()))
|
||||
.append(" gp)");
|
||||
}
|
||||
}
|
||||
@@ -301,7 +301,7 @@ public class GroundItemsOverlay extends Overlay
|
||||
{
|
||||
itemStringBuilder
|
||||
.append(" (")
|
||||
.append(StackFormatter.quantityToStackSize(price))
|
||||
.append(QuantityFormatter.quantityToStackSize(price))
|
||||
.append(" gp)");
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -100,7 +100,7 @@ import net.runelite.client.plugins.grounditems.config.TimerDisplayMode;
|
||||
import net.runelite.client.plugins.grounditems.config.ValueCalculationMode;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Ground Items",
|
||||
@@ -1213,7 +1213,7 @@ public class GroundItemsPlugin extends Plugin
|
||||
else
|
||||
{
|
||||
notificationStringBuilder.append(" (")
|
||||
.append(StackFormatter.quantityToStackSize(item.getQuantity()))
|
||||
.append(QuantityFormatter.quantityToStackSize(item.getQuantity()))
|
||||
.append(")");
|
||||
}
|
||||
}
|
||||
|
||||
+25
-25
@@ -60,7 +60,7 @@ import net.runelite.client.ui.components.IconTextField;
|
||||
import net.runelite.client.ui.components.materialtabs.MaterialTab;
|
||||
import net.runelite.client.ui.components.materialtabs.MaterialTabGroup;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
import net.runelite.http.api.hiscore.HiscoreClient;
|
||||
import net.runelite.http.api.hiscore.HiscoreEndpoint;
|
||||
import net.runelite.http.api.hiscore.HiscoreResult;
|
||||
@@ -512,8 +512,8 @@ public class HiscorePanel extends PluginPanel
|
||||
+ result.getRanged().getExperience() + result.getPrayer().getExperience();
|
||||
|
||||
content += "<p><span style = 'color:white'>Skill:</span> Combat</p>";
|
||||
content += "<p><span style = 'color:white'>Exact Combat Level:</span> " + StackFormatter.formatNumber(combatLevel) + "</p>";
|
||||
content += "<p><span style = 'color:white'>Experience:</span> " + StackFormatter.formatNumber(combatExperience) + "</p>";
|
||||
content += "<p><span style = 'color:white'>Exact Combat Level:</span> " + QuantityFormatter.formatNumber(combatLevel) + "</p>";
|
||||
content += "<p><span style = 'color:white'>Experience:</span> " + QuantityFormatter.formatNumber(combatExperience) + "</p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -521,20 +521,20 @@ public class HiscorePanel extends PluginPanel
|
||||
{
|
||||
case CLUE_SCROLL_ALL:
|
||||
{
|
||||
String allRank = (result.getClueScrollAll().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getClueScrollAll().getRank());
|
||||
String beginnerRank = (result.getClueScrollBeginner().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getClueScrollBeginner().getRank());
|
||||
String easyRank = (result.getClueScrollEasy().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getClueScrollEasy().getRank());
|
||||
String mediumRank = (result.getClueScrollMedium().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getClueScrollMedium().getRank());
|
||||
String hardRank = (result.getClueScrollHard().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getClueScrollHard().getRank());
|
||||
String eliteRank = (result.getClueScrollElite().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getClueScrollElite().getRank());
|
||||
String masterRank = (result.getClueScrollMaster().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getClueScrollMaster().getRank());
|
||||
String all = (result.getClueScrollAll().getLevel() == -1 ? "0" : StackFormatter.formatNumber(result.getClueScrollAll().getLevel()));
|
||||
String beginner = (result.getClueScrollBeginner().getLevel() == -1 ? "0" : StackFormatter.formatNumber(result.getClueScrollBeginner().getLevel()));
|
||||
String easy = (result.getClueScrollEasy().getLevel() == -1 ? "0" : StackFormatter.formatNumber(result.getClueScrollEasy().getLevel()));
|
||||
String medium = (result.getClueScrollMedium().getLevel() == -1 ? "0" : StackFormatter.formatNumber(result.getClueScrollMedium().getLevel()));
|
||||
String hard = (result.getClueScrollHard().getLevel() == -1 ? "0" : StackFormatter.formatNumber(result.getClueScrollHard().getLevel()));
|
||||
String elite = (result.getClueScrollElite().getLevel() == -1 ? "0" : StackFormatter.formatNumber(result.getClueScrollElite().getLevel()));
|
||||
String master = (result.getClueScrollMaster().getLevel() == -1 ? "0" : StackFormatter.formatNumber(result.getClueScrollMaster().getLevel()));
|
||||
String allRank = (result.getClueScrollAll().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollAll().getRank());
|
||||
String beginnerRank = (result.getClueScrollBeginner().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollBeginner().getRank());
|
||||
String easyRank = (result.getClueScrollEasy().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollEasy().getRank());
|
||||
String mediumRank = (result.getClueScrollMedium().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollMedium().getRank());
|
||||
String hardRank = (result.getClueScrollHard().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollHard().getRank());
|
||||
String eliteRank = (result.getClueScrollElite().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollElite().getRank());
|
||||
String masterRank = (result.getClueScrollMaster().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getClueScrollMaster().getRank());
|
||||
String all = (result.getClueScrollAll().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollAll().getLevel()));
|
||||
String beginner = (result.getClueScrollBeginner().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollBeginner().getLevel()));
|
||||
String easy = (result.getClueScrollEasy().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollEasy().getLevel()));
|
||||
String medium = (result.getClueScrollMedium().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollMedium().getLevel()));
|
||||
String hard = (result.getClueScrollHard().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollHard().getLevel()));
|
||||
String elite = (result.getClueScrollElite().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollElite().getLevel()));
|
||||
String master = (result.getClueScrollMaster().getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(result.getClueScrollMaster().getLevel()));
|
||||
content += "<p><span style = 'color:white'>All:</span> " + all + " <span style = 'color:white'>Rank:</span> " + allRank + "</p>";
|
||||
content += "<p><span style = 'color:white'>Beginner:</span> " + beginner + " <span style = 'color:white'>Rank:</span> " + beginnerRank + "</p>";
|
||||
content += "<p><span style = 'color:white'>Easy:</span> " + easy + " <span style = 'color:white'>Rank:</span> " + easyRank + "</p>";
|
||||
@@ -546,27 +546,27 @@ public class HiscorePanel extends PluginPanel
|
||||
}
|
||||
case BOUNTY_HUNTER_ROGUE:
|
||||
{
|
||||
String rank = (result.getBountyHunterRogue().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getBountyHunterRogue().getRank());
|
||||
String rank = (result.getBountyHunterRogue().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getBountyHunterRogue().getRank());
|
||||
content += "<p><span style = 'color:white'>Rank:</span> " + rank + "</p>";
|
||||
break;
|
||||
}
|
||||
case BOUNTY_HUNTER_HUNTER:
|
||||
{
|
||||
String rank = (result.getBountyHunterHunter().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getBountyHunterHunter().getRank());
|
||||
String rank = (result.getBountyHunterHunter().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getBountyHunterHunter().getRank());
|
||||
content += "<p><span style = 'color:white'>Rank:</span> " + rank + "</p>";
|
||||
break;
|
||||
}
|
||||
case LAST_MAN_STANDING:
|
||||
{
|
||||
String rank = (result.getLastManStanding().getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(result.getLastManStanding().getRank());
|
||||
String rank = (result.getLastManStanding().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getLastManStanding().getRank());
|
||||
content += "<p><span style = 'color:white'>Rank:</span> " + rank + "</p>";
|
||||
break;
|
||||
}
|
||||
case OVERALL:
|
||||
{
|
||||
Skill requestedSkill = result.getSkill(skill);
|
||||
String rank = (requestedSkill.getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(requestedSkill.getRank());
|
||||
String exp = (requestedSkill.getExperience() == -1L) ? "Unranked" : StackFormatter.formatNumber(requestedSkill.getExperience());
|
||||
String rank = (requestedSkill.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getRank());
|
||||
String exp = (requestedSkill.getExperience() == -1L) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getExperience());
|
||||
content += "<p><span style = 'color:white'>Skill:</span> " + skill.getName() + "</p>";
|
||||
content += "<p><span style = 'color:white'>Rank:</span> " + rank + "</p>";
|
||||
content += "<p><span style = 'color:white'>Experience:</span> " + exp + "</p>";
|
||||
@@ -577,8 +577,8 @@ public class HiscorePanel extends PluginPanel
|
||||
Skill requestedSkill = result.getSkill(skill);
|
||||
final long experience = requestedSkill.getExperience();
|
||||
|
||||
String rank = (requestedSkill.getRank() == -1) ? "Unranked" : StackFormatter.formatNumber(requestedSkill.getRank());
|
||||
String exp = (experience == -1L) ? "Unranked" : StackFormatter.formatNumber(experience);
|
||||
String rank = (requestedSkill.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getRank());
|
||||
String exp = (experience == -1L) ? "Unranked" : QuantityFormatter.formatNumber(experience);
|
||||
String remainingXp;
|
||||
if (experience == -1L)
|
||||
{
|
||||
@@ -587,7 +587,7 @@ public class HiscorePanel extends PluginPanel
|
||||
else
|
||||
{
|
||||
int currentLevel = Experience.getLevelForXp((int) experience);
|
||||
remainingXp = (currentLevel + 1 <= Experience.MAX_VIRT_LEVEL) ? StackFormatter.formatNumber(Experience.getXpForLevel(currentLevel + 1) - experience) : "0";
|
||||
remainingXp = (currentLevel + 1 <= Experience.MAX_VIRT_LEVEL) ? QuantityFormatter.formatNumber(Experience.getXpForLevel(currentLevel + 1) - experience) : "0";
|
||||
}
|
||||
|
||||
content += "<p><span style = 'color:white'>Skill:</span> " + skill.getName() + "</p>";
|
||||
|
||||
+7
-7
@@ -46,7 +46,7 @@ import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.tooltip.Tooltip;
|
||||
import net.runelite.client.ui.overlay.tooltip.TooltipManager;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@Singleton
|
||||
class ItemPricesOverlay extends Overlay
|
||||
@@ -185,11 +185,11 @@ class ItemPricesOverlay extends Overlay
|
||||
// Special case for coins and platinum tokens
|
||||
if (id == ItemID.COINS_995)
|
||||
{
|
||||
return StackFormatter.formatNumber(qty) + " gp";
|
||||
return QuantityFormatter.formatNumber(qty) + " gp";
|
||||
}
|
||||
else if (id == ItemID.PLATINUM_TOKEN)
|
||||
{
|
||||
return StackFormatter.formatNumber(qty * 1000) + " gp";
|
||||
return QuantityFormatter.formatNumber(qty * 1000) + " gp";
|
||||
}
|
||||
|
||||
ItemDefinition itemDef = itemManager.getItemDefinition(id);
|
||||
@@ -236,12 +236,12 @@ class ItemPricesOverlay extends Overlay
|
||||
if (gePrice > 0)
|
||||
{
|
||||
itemStringBuilder.append("EX: ")
|
||||
.append(StackFormatter.quantityToStackSize(gePrice * qty))
|
||||
.append(QuantityFormatter.quantityToStackSize(gePrice * qty))
|
||||
.append(" gp");
|
||||
if (plugin.isShowEA() && qty > 1)
|
||||
{
|
||||
itemStringBuilder.append(" (")
|
||||
.append(StackFormatter.quantityToStackSize(gePrice))
|
||||
.append(QuantityFormatter.quantityToStackSize(gePrice))
|
||||
.append(" ea)");
|
||||
}
|
||||
}
|
||||
@@ -253,12 +253,12 @@ class ItemPricesOverlay extends Overlay
|
||||
}
|
||||
|
||||
itemStringBuilder.append("HA: ")
|
||||
.append(StackFormatter.quantityToStackSize(haValue * qty))
|
||||
.append(QuantityFormatter.quantityToStackSize(haValue * qty))
|
||||
.append(" gp");
|
||||
if (plugin.isShowEA() && qty > 1)
|
||||
{
|
||||
itemStringBuilder.append(" (")
|
||||
.append(StackFormatter.quantityToStackSize(haValue))
|
||||
.append(QuantityFormatter.quantityToStackSize(haValue))
|
||||
.append(" ea)");
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -62,7 +62,7 @@ import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.game.ItemMapping;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Items Kept on Death",
|
||||
@@ -586,7 +586,7 @@ public class ItemsKeptOnDeathPlugin extends Plugin
|
||||
total += (long) price * w.getItemQuantity();
|
||||
}
|
||||
final Widget lostValue = client.getWidget(WidgetInfo.ITEMS_LOST_VALUE);
|
||||
lostValue.setText(StackFormatter.quantityToStackSize(total) + " gp");
|
||||
lostValue.setText(QuantityFormatter.quantityToStackSize(total) + " gp");
|
||||
|
||||
// Update Max items kept
|
||||
final Widget max = client.getWidget(WidgetInfo.ITEMS_KEPT_MAX);
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.JagexColors;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
import net.runelite.http.api.item.ItemEquipmentStats;
|
||||
import net.runelite.http.api.item.ItemStats;
|
||||
|
||||
@@ -376,7 +376,7 @@ public class ItemStatPlugin extends Plugin
|
||||
|
||||
createSeparator(invContainer, invContainer.getHeight() - 40);
|
||||
|
||||
final String coinText = "You have " + StackFormatter.quantityToRSStackSize(getCurrentGP())
|
||||
final String coinText = "You have " + QuantityFormatter.quantityToStackSize(getCurrentGP())
|
||||
+ (getCurrentGP() == 1 ? " coin." : " coins.");
|
||||
|
||||
final Widget coinWidget = createText(invContainer, coinText, FontID.PLAIN_12, ORANGE_TEXT,
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ package net.runelite.client.plugins.kingdomofmiscellania;
|
||||
import java.awt.image.BufferedImage;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.client.ui.overlay.infobox.Counter;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@Singleton
|
||||
class KingdomCounter extends Counter
|
||||
@@ -55,7 +55,7 @@ class KingdomCounter extends Counter
|
||||
.append("/127")
|
||||
.append("</br>")
|
||||
.append("Coffer: ")
|
||||
.append(StackFormatter.quantityToRSStackSize(plugin.getCoffer()))
|
||||
.append(QuantityFormatter.quantityToStackSize(plugin.getCoffer()))
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
||||
+4
-4
@@ -55,8 +55,8 @@ import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
class LootTrackerBox extends JPanel
|
||||
{
|
||||
@@ -200,8 +200,8 @@ class LootTrackerBox extends JPanel
|
||||
{
|
||||
buildItems();
|
||||
|
||||
priceLabel.setText(StackFormatter.quantityToStackSize(totalPrice) + " gp");
|
||||
priceLabel.setToolTipText(StackFormatter.formatNumber(totalPrice) + " gp");
|
||||
priceLabel.setText(QuantityFormatter.quantityToStackSize(totalPrice) + " gp");
|
||||
priceLabel.setToolTipText(QuantityFormatter.formatNumber(totalPrice) + " gp");
|
||||
|
||||
final long kills = getTotalKills();
|
||||
if (kills > 1)
|
||||
@@ -373,6 +373,6 @@ class LootTrackerBox extends JPanel
|
||||
final int quantity = item.getQuantity();
|
||||
final long price = item.getPrice();
|
||||
final String ignoredLabel = item.isIgnored() ? " - Ignored" : "";
|
||||
return name + " x " + quantity + " (" + StackFormatter.quantityToStackSize(price) + ") " + ignoredLabel;
|
||||
return name + " x " + quantity + " (" + QuantityFormatter.quantityToStackSize(price) + ") " + ignoredLabel;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -60,7 +60,7 @@ import net.runelite.client.ui.PluginPanel;
|
||||
import net.runelite.client.ui.components.PluginErrorPanel;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
import net.runelite.http.api.loottracker.LootTrackerClient;
|
||||
|
||||
@Slf4j
|
||||
@@ -825,7 +825,7 @@ class LootTrackerPanel extends PluginPanel
|
||||
|
||||
private static String htmlLabel(String key, long value)
|
||||
{
|
||||
final String valueStr = StackFormatter.quantityToStackSize(value);
|
||||
final String valueStr = QuantityFormatter.quantityToStackSize(value);
|
||||
return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), key, valueStr);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -118,8 +118,8 @@ import net.runelite.client.task.Schedule;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
import net.runelite.http.api.RuneLiteAPI;
|
||||
import net.runelite.http.api.loottracker.GameItem;
|
||||
import net.runelite.http.api.loottracker.LootRecord;
|
||||
@@ -627,7 +627,7 @@ public class LootTrackerPlugin extends Plugin
|
||||
if (WorldType.isDeadmanWorld(client.getWorldType()) || WorldType.isHighRiskWorld(client.getWorldType()) ||
|
||||
WorldType.isPvpWorld(client.getWorldType()) || client.getVar(Varbits.IN_WILDERNESS) == 1)
|
||||
{
|
||||
final String totalValue = StackFormatter.quantityToRSStackSize(playerLootReceived.getItems().stream()
|
||||
final String totalValue = QuantityFormatter.quantityToStackSize(playerLootReceived.getItems().stream()
|
||||
.mapToInt(itemStack -> itemManager.getItemPrice(itemStack.getId()) * itemStack.getQuantity()).sum());
|
||||
|
||||
chatMessageManager.queue(QueuedMessage.builder().type(ChatMessageType.CONSOLE).runeLiteFormattedMessage(
|
||||
@@ -725,7 +725,7 @@ public class LootTrackerPlugin extends Plugin
|
||||
final ChatMessageBuilder message = new ChatMessageBuilder()
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append("Your loot is worth around ")
|
||||
.append(StackFormatter.formatNumber(chestPrice))
|
||||
.append(QuantityFormatter.formatNumber(chestPrice))
|
||||
.append(" coins.")
|
||||
.append(ChatColorType.NORMAL);
|
||||
|
||||
|
||||
+4
-4
@@ -45,7 +45,7 @@ import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
||||
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@Singleton
|
||||
class NightmareZoneOverlay extends Overlay
|
||||
@@ -109,12 +109,12 @@ class NightmareZoneOverlay extends Overlay
|
||||
|
||||
TableComponent tableComponent = new TableComponent();
|
||||
tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT);
|
||||
tableComponent.addRow("Points:", StackFormatter.formatNumber(currentPoints));
|
||||
tableComponent.addRow("Points/Hour:", StackFormatter.formatNumber(plugin.getPointsPerHour()));
|
||||
tableComponent.addRow("Points:", QuantityFormatter.formatNumber(currentPoints));
|
||||
tableComponent.addRow("Points/Hour:", QuantityFormatter.formatNumber(plugin.getPointsPerHour()));
|
||||
|
||||
if (plugin.isShowtotalpoints())
|
||||
{
|
||||
tableComponent.addRow("Total:", StackFormatter.formatNumber(totalPoints));
|
||||
tableComponent.addRow("Total:", QuantityFormatter.formatNumber(totalPoints));
|
||||
}
|
||||
|
||||
panelComponent.getChildren().add(tableComponent);
|
||||
|
||||
+3
-3
@@ -69,7 +69,7 @@ import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.util.PvPUtil;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
import net.runelite.http.api.discord.DiscordClient;
|
||||
import net.runelite.http.api.discord.DiscordEmbed;
|
||||
import net.runelite.http.api.discord.DiscordMessage;
|
||||
@@ -495,7 +495,7 @@ public class PlayerScouter extends Plugin
|
||||
|
||||
fieldList.add(FieldEmbed.builder()
|
||||
.name("Risk")
|
||||
.value(StackFormatter.quantityToRSDecimalStack(player.getRisk()))
|
||||
.value(QuantityFormatter.quantityToRSDecimalStack(player.getRisk()))
|
||||
.inline(true)
|
||||
.build());
|
||||
|
||||
@@ -561,7 +561,7 @@ public class PlayerScouter extends Plugin
|
||||
|
||||
fieldList.add(FieldEmbed.builder()
|
||||
.name(name)
|
||||
.value("Value: " + StackFormatter.quantityToRSDecimalStack(value))
|
||||
.value("Value: " + QuantityFormatter.quantityToRSDecimalStack(value))
|
||||
.inline(true)
|
||||
.build());
|
||||
}
|
||||
|
||||
+3
-3
@@ -63,8 +63,8 @@ import net.runelite.client.util.AsyncBufferedImage;
|
||||
import net.runelite.client.util.HotkeyListener;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.PvPUtil;
|
||||
import static net.runelite.client.util.StackFormatter.quantityToRSDecimalStack;
|
||||
import net.runelite.api.util.Text;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
@PluginDescriptor(
|
||||
@@ -536,7 +536,7 @@ public class PvpToolsPlugin extends Plugin
|
||||
}
|
||||
wealth += value;
|
||||
}
|
||||
panel.totalRiskLabel.setText(htmlLabel("Total risk: ", quantityToRSDecimalStack(wealth)));
|
||||
panel.totalRiskLabel.setText(htmlLabel("Total risk: ", QuantityFormatter.quantityToRSDecimalStack(wealth)));
|
||||
panel.totalRiskLabel.repaint();
|
||||
|
||||
int itemLimit = 0;
|
||||
@@ -572,7 +572,7 @@ public class PvpToolsPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
panel.riskProtectingItem.setText(htmlLabel("Risk Protecting Item: ",
|
||||
quantityToRSDecimalStack(descendingMap.keySet().stream().mapToInt(Integer::intValue).sum())));
|
||||
QuantityFormatter.quantityToRSDecimalStack(descendingMap.keySet().stream().mapToInt(Integer::intValue).sum())));
|
||||
panel.riskProtectingItem.repaint();
|
||||
|
||||
panel.biggestItemLabel.setText("Most Valuable Item: ");
|
||||
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
/*
|
||||
* Copyright (c) 2018, trimbe <github.com/trimbe>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.randomevents;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("randomevents")
|
||||
public interface RandomEventConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "removeMenuOptions",
|
||||
name = "Remove others' menu options",
|
||||
description = "Remove menu options from random events for other players.",
|
||||
position = 0
|
||||
)
|
||||
default boolean removeMenuOptions()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "notifyDunce",
|
||||
name = "Notify on Surprise Exam",
|
||||
description = "",
|
||||
position = 1
|
||||
)
|
||||
default boolean notifyDunce()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "notifyGenie",
|
||||
name = "Notify on Genie",
|
||||
description = "",
|
||||
position = 2
|
||||
)
|
||||
default boolean notifyGenie()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "notifyDemon",
|
||||
name = "Notify on Drill Demon",
|
||||
description = "",
|
||||
position = 3
|
||||
)
|
||||
default boolean notifyDemon()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "notifyForester",
|
||||
name = "Notify on Freaky Forester",
|
||||
description = "",
|
||||
position = 4
|
||||
)
|
||||
default boolean notifyForester()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "notifyFrog",
|
||||
name = "Notify on Kiss the Frog",
|
||||
description = "",
|
||||
position = 5
|
||||
)
|
||||
default boolean notifyFrog()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "notifyGravedigger",
|
||||
name = "Notify on Gravedigger",
|
||||
description = "",
|
||||
position = 6
|
||||
)
|
||||
default boolean notifyGravedigger()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "notifyMoM",
|
||||
name = "Notify on Mysterious Old Man",
|
||||
description = "",
|
||||
position = 7
|
||||
)
|
||||
default boolean notifyMoM()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "notifyBob",
|
||||
name = "Notify on Evil Bob",
|
||||
description = "",
|
||||
position = 8
|
||||
)
|
||||
default boolean notifyBob()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "notifyQuiz",
|
||||
name = "Notify on Quiz Master",
|
||||
description = "",
|
||||
position = 9
|
||||
)
|
||||
default boolean notifyQuiz()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "notifyAll",
|
||||
name = "Notify for all events",
|
||||
description = "",
|
||||
position = 10
|
||||
)
|
||||
default boolean notifyAllEvents()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+281
@@ -0,0 +1,281 @@
|
||||
/*
|
||||
* Copyright (c) 2018, trimbe <github.com/trimbe>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.randomevents;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Provides;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.MenuOpcode;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NpcID;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.InteractingChanged;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.api.events.NpcSpawned;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Random Events",
|
||||
description = "Notify when random events appear and remove talk/dismiss options on events that aren't yours.",
|
||||
enabledByDefault = false
|
||||
)
|
||||
public class RandomEventPlugin extends Plugin
|
||||
{
|
||||
private static final Set<Integer> EVENT_NPCS = ImmutableSet.of(
|
||||
NpcID.DR_JEKYLL, NpcID.DR_JEKYLL_314,
|
||||
NpcID.BEE_KEEPER_6747,
|
||||
NpcID.CAPT_ARNAV,
|
||||
NpcID.SERGEANT_DAMIEN_6743,
|
||||
NpcID.DRUNKEN_DWARF,
|
||||
NpcID.FREAKY_FORESTER_6748,
|
||||
NpcID.GENIE, NpcID.GENIE_327,
|
||||
NpcID.EVIL_BOB, NpcID.EVIL_BOB_6754,
|
||||
NpcID.POSTIE_PETE_6738,
|
||||
NpcID.LEO_6746,
|
||||
NpcID.MYSTERIOUS_OLD_MAN_6750, NpcID.MYSTERIOUS_OLD_MAN_6751,
|
||||
NpcID.MYSTERIOUS_OLD_MAN_6752, NpcID.MYSTERIOUS_OLD_MAN_6753,
|
||||
NpcID.PILLORY_GUARD,
|
||||
NpcID.FLIPPA_6744,
|
||||
NpcID.QUIZ_MASTER_6755,
|
||||
NpcID.RICK_TURPENTINE, NpcID.RICK_TURPENTINE_376,
|
||||
NpcID.SANDWICH_LADY,
|
||||
NpcID.DUNCE_6749,
|
||||
NpcID.NILES, NpcID.NILES_5439,
|
||||
NpcID.MILES, NpcID.MILES_5440,
|
||||
NpcID.GILES, NpcID.GILES_5441,
|
||||
NpcID.FROG_5429
|
||||
);
|
||||
private static final Set<String> EVENT_OPTIONS = ImmutableSet.of(
|
||||
"Talk-to",
|
||||
"Dismiss"
|
||||
);
|
||||
private static final int RANDOM_EVENT_TIMEOUT = 150;
|
||||
|
||||
private Map<NPC, Integer> spawnedNpcs = new HashMap<>();
|
||||
private NPC currentRandomEvent;
|
||||
// event npcs teleport to you to stay in range, we need to throttle spawns
|
||||
private int lastEventTick = -RANDOM_EVENT_TIMEOUT;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private Notifier notifier;
|
||||
|
||||
@Inject
|
||||
private RandomEventConfig config;
|
||||
|
||||
@Inject
|
||||
private EventBus eventBus;
|
||||
|
||||
private boolean notifyAllEvents;
|
||||
private boolean notifyDemon;
|
||||
private boolean notifyForester;
|
||||
private boolean notifyFrog;
|
||||
private boolean notifyGenie;
|
||||
private boolean notifyBob;
|
||||
private boolean notifyGravedigger;
|
||||
private boolean notifyMoM;
|
||||
private boolean notifyQuiz;
|
||||
private boolean notifyDunce;
|
||||
|
||||
@Provides
|
||||
RandomEventConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(RandomEventConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
updateConfig();
|
||||
addSubscriptions();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
eventBus.unregister(this);
|
||||
|
||||
lastEventTick = 0;
|
||||
currentRandomEvent = null;
|
||||
spawnedNpcs.clear();
|
||||
}
|
||||
|
||||
private void addSubscriptions()
|
||||
{
|
||||
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
|
||||
eventBus.subscribe(InteractingChanged.class, this, this::onInteractingChanged);
|
||||
eventBus.subscribe(GameTick.class, this, this::onGameTick);
|
||||
eventBus.subscribe(MenuEntryAdded.class, this, this::onMenuEntryAdded);
|
||||
eventBus.subscribe(ConfigChanged.class, this, this::onConfigChanged);
|
||||
}
|
||||
|
||||
|
||||
private void onNpcSpawned(NpcSpawned event)
|
||||
{
|
||||
NPC npc = event.getNpc();
|
||||
|
||||
if (!EVENT_NPCS.contains(npc.getId()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// only occasionally do event npcs spawn with non-null interacting
|
||||
if (npc.getInteracting() == client.getLocalPlayer())
|
||||
{
|
||||
if (client.getTickCount() - lastEventTick > RANDOM_EVENT_TIMEOUT)
|
||||
{
|
||||
currentRandomEvent = npc;
|
||||
lastEventTick = client.getTickCount();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnedNpcs.put(npc, client.getTickCount());
|
||||
}
|
||||
}
|
||||
|
||||
private void onInteractingChanged(InteractingChanged event)
|
||||
{
|
||||
Actor source = event.getSource();
|
||||
Actor target = event.getTarget();
|
||||
|
||||
if (spawnedNpcs.containsKey(source))
|
||||
{
|
||||
Player player = client.getLocalPlayer();
|
||||
if (player == target && client.getTickCount() - lastEventTick > RANDOM_EVENT_TIMEOUT)
|
||||
{
|
||||
currentRandomEvent = (NPC) source;
|
||||
if (shouldNotify(currentRandomEvent.getId()))
|
||||
{
|
||||
notifier.notify("Random event spawned: " + currentRandomEvent.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void onGameTick(GameTick event)
|
||||
{
|
||||
if (!spawnedNpcs.isEmpty())
|
||||
{
|
||||
// allow 2 ticks for interacting to get set
|
||||
spawnedNpcs.entrySet().removeIf(entry -> client.getTickCount() - entry.getValue() >= 2);
|
||||
}
|
||||
|
||||
if (client.getTickCount() - lastEventTick > RANDOM_EVENT_TIMEOUT)
|
||||
{
|
||||
currentRandomEvent = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
if (event.getOpcode() >= MenuOpcode.NPC_FIRST_OPTION.getId()
|
||||
&& event.getOpcode() <= MenuOpcode.NPC_FIFTH_OPTION.getId()
|
||||
&& EVENT_OPTIONS.contains(event.getOption()))
|
||||
{
|
||||
NPC npc = client.getCachedNPCs()[event.getIdentifier()];
|
||||
if (npc != null && EVENT_NPCS.contains(npc.getId()) && npc != currentRandomEvent && config.removeMenuOptions())
|
||||
{
|
||||
client.setMenuEntries(Arrays.copyOf(client.getMenuEntries(), client.getMenuEntries().length - 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean shouldNotify(int id)
|
||||
{
|
||||
if (this.notifyAllEvents)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (id)
|
||||
{
|
||||
case NpcID.SERGEANT_DAMIEN_6743:
|
||||
return this.notifyDemon;
|
||||
case NpcID.FREAKY_FORESTER_6748:
|
||||
return this.notifyForester;
|
||||
case NpcID.FROG_5429:
|
||||
return this.notifyFrog;
|
||||
case NpcID.GENIE:
|
||||
case NpcID.GENIE_327:
|
||||
return this.notifyGenie;
|
||||
case NpcID.EVIL_BOB:
|
||||
case NpcID.EVIL_BOB_6754:
|
||||
return this.notifyBob;
|
||||
case NpcID.LEO_6746:
|
||||
return this.notifyGravedigger;
|
||||
case NpcID.MYSTERIOUS_OLD_MAN_6750:
|
||||
case NpcID.MYSTERIOUS_OLD_MAN_6751:
|
||||
case NpcID.MYSTERIOUS_OLD_MAN_6752:
|
||||
case NpcID.MYSTERIOUS_OLD_MAN_6753:
|
||||
return this.notifyMoM;
|
||||
case NpcID.QUIZ_MASTER_6755:
|
||||
return this.notifyQuiz;
|
||||
case NpcID.DUNCE_6749:
|
||||
return this.notifyDunce;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (!"randomevents".equals(event.getGroup()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
updateConfig();
|
||||
}
|
||||
|
||||
private void updateConfig()
|
||||
{
|
||||
this.notifyAllEvents = config.notifyAllEvents();
|
||||
this.notifyDemon = config.notifyDemon();
|
||||
this.notifyForester = config.notifyForester();
|
||||
this.notifyFrog = config.notifyFrog();
|
||||
this.notifyGenie = config.notifyGenie();
|
||||
this.notifyBob = config.notifyBob();
|
||||
this.notifyGravedigger = config.notifyGravedigger();
|
||||
this.notifyMoM = config.notifyMoM();
|
||||
this.notifyQuiz = config.notifyQuiz();
|
||||
this.notifyDunce = config.notifyDunce();
|
||||
}
|
||||
}
|
||||
@@ -633,7 +633,7 @@ public class SlayerPlugin extends Plugin
|
||||
forcedWait--;
|
||||
}
|
||||
|
||||
if (infoTimer != null)
|
||||
if (infoTimer != null && config.statTimeout() != 0)
|
||||
{
|
||||
Duration timeSinceInfobox = Duration.between(infoTimer, Instant.now());
|
||||
Duration statTimeout = Duration.ofMinutes(this.statTimeout);
|
||||
|
||||
+2
-2
@@ -22,7 +22,7 @@ import net.runelite.client.ui.PluginPanel;
|
||||
import net.runelite.client.ui.components.PluginErrorPanel;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@Singleton
|
||||
public class SlayerTaskPanel extends PluginPanel
|
||||
@@ -367,7 +367,7 @@ public class SlayerTaskPanel extends PluginPanel
|
||||
|
||||
private static String htmlLabel(String key, int value)
|
||||
{
|
||||
String valueStr = StackFormatter.quantityToRSDecimalStack(value);
|
||||
String valueStr = QuantityFormatter.quantityToRSDecimalStack(value);
|
||||
return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR),
|
||||
key, valueStr);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.ui.DynamicGridLayout;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.components.ProgressBar;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@Singleton
|
||||
class TaskBox extends JPanel
|
||||
@@ -301,7 +301,7 @@ class TaskBox extends JPanel
|
||||
|
||||
private static String htmlLabel(int value)
|
||||
{
|
||||
String valueStr = StackFormatter.quantityToRSDecimalStack(value);
|
||||
String valueStr = QuantityFormatter.quantityToRSDecimalStack(value);
|
||||
return String.format(HTML_LABEL_TEMPLATE, valueStr);
|
||||
}
|
||||
}
|
||||
+5
-5
@@ -42,7 +42,7 @@ import net.runelite.client.plugins.loottracker.localstorage.LTItemEntry;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.components.shadowlabel.JShadowedLabel;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@Getter
|
||||
class ItemPanel extends JPanel
|
||||
@@ -84,7 +84,7 @@ class ItemPanel extends JPanel
|
||||
labelName.setForeground(getRSValueColor(this.record.getPrice()));
|
||||
labelName.setVerticalAlignment(SwingUtilities.BOTTOM);
|
||||
|
||||
final JShadowedLabel labelValue = new JShadowedLabel(StackFormatter.quantityToStackSize(total) + " gp");
|
||||
final JShadowedLabel labelValue = new JShadowedLabel(QuantityFormatter.quantityToStackSize(total) + " gp");
|
||||
labelValue.setFont(FontManager.getRunescapeSmallFont());
|
||||
labelValue.setForeground(getRSValueColor(total));
|
||||
labelValue.setVerticalAlignment(SwingUtilities.TOP);
|
||||
@@ -113,9 +113,9 @@ class ItemPanel extends JPanel
|
||||
final int quantity = record.getQuantity();
|
||||
final long price = record.getPrice();
|
||||
|
||||
return "<html>" + name + " x " + StackFormatter.formatNumber(quantity)
|
||||
+ "<br/>Price: " + StackFormatter.quantityToStackSize(price)
|
||||
+ "<br/>Total: " + StackFormatter.quantityToStackSize(quantity * price) + "</html>";
|
||||
return "<html>" + name + " x " + QuantityFormatter.formatNumber(quantity)
|
||||
+ "<br/>Price: " + QuantityFormatter.quantityToStackSize(price)
|
||||
+ "<br/>Total: " + QuantityFormatter.quantityToStackSize(quantity * price) + "</html>";
|
||||
}
|
||||
|
||||
private static Color getRSValueColor(long val)
|
||||
|
||||
+4
-4
@@ -33,7 +33,7 @@ import javax.swing.border.EmptyBorder;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.plugins.loottracker.localstorage.LTItemEntry;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
class LootGrid extends JPanel
|
||||
{
|
||||
@@ -81,8 +81,8 @@ class LootGrid extends JPanel
|
||||
final int quantity = item.getQuantity();
|
||||
final long price = item.getPrice();
|
||||
|
||||
return "<html>" + name + " x " + StackFormatter.formatNumber(quantity)
|
||||
+ "<br/>Price: " + StackFormatter.quantityToStackSize(price)
|
||||
+ "<br/>Total: " + StackFormatter.quantityToStackSize(quantity * price) + "</html>";
|
||||
return "<html>" + name + " x " + QuantityFormatter.formatNumber(quantity)
|
||||
+ "<br/>Price: " + QuantityFormatter.quantityToStackSize(price)
|
||||
+ "<br/>Total: " + QuantityFormatter.quantityToStackSize(quantity * price) + "</html>";
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -35,7 +35,7 @@ import javax.swing.SwingConstants;
|
||||
import javax.swing.border.Border;
|
||||
import lombok.Getter;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@Getter
|
||||
class TextPanel extends JPanel
|
||||
@@ -58,7 +58,7 @@ class TextPanel extends JPanel
|
||||
totalText.setForeground(Color.WHITE);
|
||||
|
||||
// Item Values (Colored off Total Value of item)
|
||||
final JLabel total = new JLabel(StackFormatter.quantityToStackSize(totalValue) + " gp", SwingConstants.LEFT);
|
||||
final JLabel total = new JLabel(QuantityFormatter.quantityToStackSize(totalValue) + " gp", SwingConstants.LEFT);
|
||||
total.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
|
||||
total.setForeground(getRSValueColor(totalValue));
|
||||
|
||||
@@ -74,7 +74,7 @@ class TextPanel extends JPanel
|
||||
c.gridy = 0;
|
||||
c.ipady = 20;
|
||||
|
||||
panel.setToolTipText(StackFormatter.formatNumber(totalValue));
|
||||
panel.setToolTipText(QuantityFormatter.formatNumber(totalValue));
|
||||
|
||||
this.add(panel, c);
|
||||
}
|
||||
|
||||
+4
-4
@@ -43,7 +43,7 @@ import net.runelite.client.plugins.stonedtracker.data.UniqueItem;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.util.AsyncBufferedImage;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@Getter
|
||||
class UniqueItemPanel extends JPanel
|
||||
@@ -108,15 +108,15 @@ class UniqueItemPanel extends JPanel
|
||||
String s = "<html>" + item.getName();
|
||||
if (qty > 0)
|
||||
{
|
||||
s += " x " + StackFormatter.formatNumber(qty);
|
||||
s += " x " + QuantityFormatter.formatNumber(qty);
|
||||
}
|
||||
if (item.getPrice() > 0)
|
||||
{
|
||||
s += "<br/>Price: " + StackFormatter.quantityToStackSize(item.getPrice());
|
||||
s += "<br/>Price: " + QuantityFormatter.quantityToStackSize(item.getPrice());
|
||||
// Check for qty here as well as we should only show Total if the item has a value as well
|
||||
if (qty > 0)
|
||||
{
|
||||
s += "<br/>Total: " + StackFormatter.quantityToStackSize(qty * item.getPrice()) + "</html";
|
||||
s += "<br/>Total: " + QuantityFormatter.quantityToStackSize(qty * item.getPrice()) + "</html";
|
||||
}
|
||||
}
|
||||
s += "</html>";
|
||||
|
||||
+4
-4
@@ -46,7 +46,7 @@ import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.util.AsyncBufferedImage;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@Singleton
|
||||
class SuppliesBox extends JPanel
|
||||
@@ -166,8 +166,8 @@ class SuppliesBox extends JPanel
|
||||
{
|
||||
buildItems();
|
||||
|
||||
priceLabel.setText(StackFormatter.quantityToStackSize(totalPrice) + " gp");
|
||||
priceLabel.setToolTipText(StackFormatter.formatNumber(totalPrice) + " gp");
|
||||
priceLabel.setText(QuantityFormatter.quantityToStackSize(totalPrice) + " gp");
|
||||
priceLabel.setToolTipText(QuantityFormatter.formatNumber(totalPrice) + " gp");
|
||||
|
||||
final long supplies = getTotalSupplies();
|
||||
if (supplies > 0)
|
||||
@@ -341,7 +341,7 @@ class SuppliesBox extends JPanel
|
||||
ItemDefinition item = this.itemManager.getItemDefinition(itemId);
|
||||
final String name = item.getName();
|
||||
final long price = item.getPrice();
|
||||
return name + " x " + qty + " (" + StackFormatter.quantityToStackSize(price * qty) + ") ";
|
||||
return name + " x " + qty + " (" + QuantityFormatter.quantityToStackSize(price * qty) + ") ";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -45,7 +45,7 @@ import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.PluginPanel;
|
||||
import net.runelite.client.ui.components.PluginErrorPanel;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
@Singleton
|
||||
class SuppliesTrackerPanel extends PluginPanel
|
||||
@@ -154,7 +154,7 @@ class SuppliesTrackerPanel extends PluginPanel
|
||||
*/
|
||||
private static String htmlLabel(String key, long value)
|
||||
{
|
||||
final String valueStr = StackFormatter.quantityToStackSize(value);
|
||||
final String valueStr = QuantityFormatter.quantityToStackSize(value);
|
||||
return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), key, valueStr);
|
||||
}
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@ public class TimersPlugin extends Plugin
|
||||
private static final int POISON_TICK_LENGTH = 30;
|
||||
private static final String SUPER_ANTIVENOM_DRINK_MESSAGE = "You drink some of your super antivenom potion";
|
||||
private static final String KILLED_TELEBLOCK_OPPONENT_TEXT = "<col=4f006f>Your Tele Block has been removed because you killed ";
|
||||
private static final String PRAYER_ENHANCE_EXPIRED = "<col=ff0000>Your prayer enhance effect has worn off.</col>";
|
||||
private static final Pattern DEADMAN_HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+)\\. It will expire in 1 minute, 15 seconds\\.</col>");
|
||||
private static final Pattern FULL_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+)\\. It will expire in 5 minutes, 0 seconds\\.</col>");
|
||||
private static final Pattern HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+)\\. It will expire in 2 minutes, 30 seconds\\.</col>");
|
||||
@@ -628,6 +629,11 @@ public class TimersPlugin extends Plugin
|
||||
createGameTimer(PRAYER_ENHANCE);
|
||||
}
|
||||
|
||||
if (this.showPrayerEnhance && event.getMessage().equals(PRAYER_ENHANCE_EXPIRED))
|
||||
{
|
||||
removeGameTimer(PRAYER_ENHANCE);
|
||||
}
|
||||
|
||||
if (this.showCharge && event.getMessage().equals(CHARGE_MESSAGE))
|
||||
{
|
||||
createGameTimer(CHARGE);
|
||||
|
||||
+2
-2
@@ -30,7 +30,7 @@ import java.time.format.TextStyle;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Locale;
|
||||
import javax.swing.JPanel;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
public abstract class TabContentPanel extends JPanel
|
||||
{
|
||||
@@ -82,7 +82,7 @@ public abstract class TabContentPanel extends JPanel
|
||||
sb.append(endTime.getDayOfWeek().getDisplayName(TextStyle.FULL, Locale.getDefault())).append(" ");
|
||||
}
|
||||
|
||||
sb.append("at ").append(StackFormatter.getPlatformTimeStringFromLocalDateTime(endTime));
|
||||
sb.append("at ").append(QuantityFormatter.getPlatformTimeStringFromLocalDateTime(endTime));
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -131,7 +131,8 @@ enum TeleportLocationData
|
||||
NEITIZNOT_LYRE(TeleportType.OTHER, "Enchanted Lyre", "Neitiznot", new WorldPoint(2336, 3801, 0), "enchanted_lyre_teleport_icon.png"),
|
||||
JATIZSO_LYRE(TeleportType.OTHER, "Enchanted Lyre", "Jatizso", new WorldPoint(2409, 3809, 0), "enchanted_lyre_teleport_icon.png"),
|
||||
WEISS_ICY_BASALT(TeleportType.OTHER, "Icy Basalt", "Weiss", new WorldPoint(2846, 3940, 0), "icy_basalt_teleport_icon.png"),
|
||||
TROLL_STRONGHOLD_STONY_BASALT(TeleportType.OTHER, "Stony Basalt", "Troll Stronghold", new WorldPoint(2838, 3693, 0), "stony_basalt_teleport_icon.png"),
|
||||
TROLL_STRONGHOLD_STONY_BASALT(TeleportType.OTHER, "Stony Basalt", "Troll Stronghold (with 73 Agility)", new WorldPoint(2838, 3693, 0), "stony_basalt_teleport_icon.png"),
|
||||
TROLL_STRONGHOLD_STONY_BASALT_OUTSIDE(TeleportType.OTHER, "Stony Basalt", "Troll Stronghold", new WorldPoint(2844, 3693, 0), "stony_basalt_teleport_icon.png"),
|
||||
KHAREDSTS_MEMOIRS_HOSIDIUS(TeleportType.OTHER, "Kharedst's Memoirs", "Lunch by the Lancalliums (Hosidius)", new WorldPoint(1713, 3612, 0), "kharedsts_memoirs_teleport_icon.png"),
|
||||
KHAREDSTS_MEMOIRS_PISCARILIUS(TeleportType.OTHER, "Kharedst's Memoirs", "The Fisher's Flute (Piscarilius)", new WorldPoint(1802, 3748, 0), "kharedsts_memoirs_teleport_icon.png"),
|
||||
KHAREDSTS_MEMOIRS_SHAYZIEN(TeleportType.OTHER, "Kharedst's Memoirs", "History and Hearsay (Shayzien)", new WorldPoint(1476, 3580, 0), "kharedsts_memoirs_teleport_icon.png"),
|
||||
|
||||
+5
-4
@@ -37,9 +37,10 @@ import javax.annotation.Nullable;
|
||||
enum TransportationPointLocation
|
||||
{
|
||||
//Ships
|
||||
ARDOUGNE_TO_BRIMHAVEN("Ship to Brimhaven", new WorldPoint(2675, 3275, 0), new WorldPoint(2772, 3234, 0)),
|
||||
ARDOUGNE_TO_BRIMHAVEN("Ship to Brimhaven / Rimmington", new WorldPoint(2675, 3275, 0)),
|
||||
ARDOUGNE_TO_FISHINGPLAT("Ship to Fishing Platform", new WorldPoint(2722, 3304, 0), new WorldPoint(2779, 3271, 0)),
|
||||
BRIMHAVEN_TO_ARDOUGNE("Ship to Ardougne", new WorldPoint(2772, 3234, 0), new WorldPoint(2675, 3275, 0)),
|
||||
BRIMHAVEN_TO_ARDOUGNE("Ship to Ardougne / Rimmington", new WorldPoint(2772, 3234, 0)),
|
||||
RIMMINGTON_TO_ARDOUGNE("Ship to Ardougne / Brimhaven", new WorldPoint(2915, 3224, 0)),
|
||||
CATHERBY_TO_KEEP_LE_FAYE("Ship to Keep Le Faye", new WorldPoint(2804, 3421, 0), new WorldPoint(2769, 3402, 0)),
|
||||
CORSAIR_TO_RIMMINGTON("Ship to Rimmington", new WorldPoint(2577, 2839, 0), new WorldPoint(2909, 3227, 0 )),
|
||||
DRAGONTOOTH_TO_PHASMATYS("Ship to Port Phasmatys", new WorldPoint(3791, 3561, 0), new WorldPoint(3703, 3487, 0)),
|
||||
@@ -50,7 +51,7 @@ enum TransportationPointLocation
|
||||
ICEBERG_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2657, 3988, 0), new WorldPoint(2707, 3735, 0)),
|
||||
ISLAND_TO_APE_ATOLL("Ship to Ape Atoll", new WorldPoint(2891, 2726, 0), new WorldPoint(2802, 2706, 0)),
|
||||
JATIZSO_TO_RELLEKKA("Ship to Rellekka", new WorldPoint(2420, 3780, 0), new WorldPoint(2639, 3710, 0)),
|
||||
KARAMJA_TO_PORT_SARIM("Ship to Port Sarim", new WorldPoint(2955, 3144, 0), new WorldPoint(3029, 3218, 0)),
|
||||
KARAMJA_TO_PORT_SARIM("Ship to Port Sarim", new WorldPoint(2955, 3145, 0), new WorldPoint(3029, 3218, 0)),
|
||||
KARAMJA_TO_PORT_KHAZARD("Ship to Port Khazard", new WorldPoint(2763, 2957, 0), new WorldPoint(2653, 3166, 0)),
|
||||
LANDSEND_TO_PORTSARIM_PORTPISCARILIUS("Ship to Port Sarim/Port Piscarilius", new WorldPoint(1503, 3398, 0)),
|
||||
LUNAR_ISLE_TO_PIRATES_COVE("Ship to Pirates' Cove", new WorldPoint(2137, 3899, 0), new WorldPoint(2223, 3796, 0)),
|
||||
@@ -108,7 +109,7 @@ enum TransportationPointLocation
|
||||
CHARTER_BRIMHAVEN("Charter Ship", new WorldPoint(2760, 3238, 0)),
|
||||
CHARTER_CATHERBY("Charter Ship", new WorldPoint(2791, 3415, 0)),
|
||||
CHARTER_CORSAIR_("Charter Ship", new WorldPoint(2589, 2851, 0)),
|
||||
CHARTER_KARAMJA_NORTH("Charter Ship", new WorldPoint(2954, 3159, 0)),
|
||||
CHARTER_KARAMJA_NORTH("Charter Ship", new WorldPoint(2954, 3158, 0)),
|
||||
CHARTER_KARAMJA_EAST("Charter Ship", new WorldPoint(2999, 3032, 0)),
|
||||
CHARTER_KHAZARD("Charter Ship", new WorldPoint(2673, 3143, 0)),
|
||||
CHARTER_MOSLE_HARMLESS("Charter Ship", new WorldPoint(3669, 2931, 0)),
|
||||
|
||||
@@ -59,7 +59,7 @@ import net.runelite.client.ui.SkillColor;
|
||||
import net.runelite.client.ui.components.ProgressBar;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.LinkBrowser;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
class XpInfoBox extends JPanel
|
||||
{
|
||||
@@ -364,7 +364,7 @@ class XpInfoBox extends JPanel
|
||||
|
||||
static String htmlLabel(String key, int value)
|
||||
{
|
||||
String valueStr = StackFormatter.quantityToRSDecimalStack(value, true);
|
||||
String valueStr = QuantityFormatter.quantityToRSDecimalStack(value, true);
|
||||
return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), key, valueStr);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -46,7 +46,7 @@ import net.runelite.client.ui.overlay.components.LineComponent;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
import net.runelite.client.ui.overlay.components.ProgressBarComponent;
|
||||
import net.runelite.client.ui.overlay.components.SplitComponent;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
import net.runelite.client.util.QuantityFormatter;
|
||||
|
||||
class XpInfoBoxOverlay extends Overlay
|
||||
{
|
||||
@@ -119,7 +119,7 @@ class XpInfoBoxOverlay extends Overlay
|
||||
|
||||
final LineComponent xpLine = LineComponent.builder()
|
||||
.left(leftStr + ":")
|
||||
.right(StackFormatter.quantityToRSDecimalStack(rightNum, true))
|
||||
.right(QuantityFormatter.quantityToRSDecimalStack(rightNum, true))
|
||||
.build();
|
||||
|
||||
final String bottemLeftStr;
|
||||
@@ -140,7 +140,7 @@ class XpInfoBoxOverlay extends Overlay
|
||||
|
||||
final LineComponent xpLineBottom = LineComponent.builder()
|
||||
.left(bottemLeftStr + ":")
|
||||
.right(StackFormatter.quantityToRSDecimalStack(bottomRightNum, true))
|
||||
.right(QuantityFormatter.quantityToRSDecimalStack(bottomRightNum, true))
|
||||
.build();
|
||||
|
||||
final SplitComponent xpSplit = SplitComponent.builder()
|
||||
|
||||
@@ -51,7 +51,6 @@ public class WidgetOverlay extends Overlay
|
||||
.put(WidgetInfo.PEST_CONTROL_INFO, OverlayPosition.TOP_LEFT)
|
||||
.put(WidgetInfo.ZEAH_MESS_HALL_COOKING_DISPLAY, OverlayPosition.TOP_LEFT)
|
||||
.put(WidgetInfo.PVP_BOUNTY_HUNTER_INFO, OverlayPosition.TOP_RIGHT)
|
||||
.put(WidgetInfo.PVP_KILLDEATH_COUNTER, OverlayPosition.TOP_LEFT)
|
||||
.put(WidgetInfo.SKOTIZO_CONTAINER, OverlayPosition.TOP_LEFT)
|
||||
.put(WidgetInfo.KOUREND_FAVOUR_OVERLAY, OverlayPosition.TOP_CENTER)
|
||||
.put(WidgetInfo.MULTICOMBAT_FIXED, OverlayPosition.BOTTOM_RIGHT)
|
||||
|
||||
@@ -21,7 +21,6 @@ import net.runelite.api.Varbits;
|
||||
import net.runelite.api.WorldType;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import static net.runelite.client.util.StackFormatter.quantityToRSDecimalStack;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
/**
|
||||
@@ -106,7 +105,7 @@ public class PvPUtil
|
||||
}
|
||||
wealth += value;
|
||||
}
|
||||
return Integer.parseInt(quantityToRSDecimalStack(priceMap.keySet().stream().mapToInt(Integer::intValue).sum()));
|
||||
return Integer.parseInt(QuantityFormatter.quantityToRSDecimalStack(priceMap.keySet().stream().mapToInt(Integer::intValue).sum()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+48
-102
@@ -37,10 +37,9 @@ import java.util.regex.Pattern;
|
||||
import net.runelite.client.RuneLite;
|
||||
|
||||
/**
|
||||
* A set of utility functions to use when
|
||||
* formatting numbers for to stack sizes.
|
||||
* A set of utility functions to use when formatting quantities
|
||||
*/
|
||||
public class StackFormatter
|
||||
public class QuantityFormatter
|
||||
{
|
||||
/**
|
||||
* A list of suffixes to use when formatting stack sizes.
|
||||
@@ -52,44 +51,18 @@ public class StackFormatter
|
||||
*/
|
||||
private static final Pattern SUFFIX_PATTERN = Pattern.compile("^-?[0-9,.]+([a-zA-Z]?)$");
|
||||
|
||||
/**
|
||||
* A number formatter
|
||||
*/
|
||||
private static final NumberFormat NUMBER_FORMATTER = NumberFormat.getInstance(Locale.ENGLISH);
|
||||
|
||||
/**
|
||||
* A decimal number formatter
|
||||
*/
|
||||
private static final NumberFormat DECIMAL_FORMATTER = new DecimalFormat(
|
||||
"#,###.#",
|
||||
DecimalFormatSymbols.getInstance(Locale.ENGLISH)
|
||||
);
|
||||
|
||||
/**
|
||||
* A more precise decimal number formatter, outputting thousandths
|
||||
*/
|
||||
private static final NumberFormat PRECISE_DECIMAL_FORMATTER = new DecimalFormat(
|
||||
"#,###.###",
|
||||
DecimalFormatSymbols.getInstance(Locale.ENGLISH)
|
||||
);
|
||||
|
||||
/**
|
||||
* Attempts to call the platform to get a localized time string based on
|
||||
* the users preferences. Falls back on using locale default if it is on a
|
||||
* platform that has no consistent way of obtaining this information.
|
||||
*
|
||||
* @param localDateTime The LocalDateTime object to format as a string
|
||||
* @return The formatted string.
|
||||
*/
|
||||
public static String getPlatformTimeStringFromLocalDateTime(LocalDateTime localDateTime)
|
||||
{
|
||||
if (OSType.getOSType() == OSType.Windows)
|
||||
{
|
||||
return WinApi.getTimeFormatString(localDateTime);
|
||||
}
|
||||
return StackFormatter.getLocalizedDateTimeFormatter(FormatStyle.SHORT).format(localDateTime.toLocalTime());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a localized DateTimeFormatter for use.
|
||||
*
|
||||
@@ -101,15 +74,17 @@ public class StackFormatter
|
||||
return DateTimeFormatter.ofLocalizedTime(formatStyle).withLocale(RuneLite.SYSTEM_LOCALE);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a quantity to a nicely formatted stack size.
|
||||
* See the StackFormatterTest to see expected output.
|
||||
* Convert a quantity to a short, comma separated, SI-prefix style string
|
||||
*
|
||||
* example: {@code 9,450}, {@code 2.14B}, {@code 100K}
|
||||
|
||||
*
|
||||
* @param quantity The quantity to convert.
|
||||
* @return A condensed version, with commas, K, M or B
|
||||
* as needed to 3 significant figures.
|
||||
* @return a 6 or less character string, possibly with a decimal point, commas or K/M/B suffix
|
||||
*/
|
||||
public static String quantityToStackSize(long quantity)
|
||||
public static synchronized String quantityToStackSize(long quantity)
|
||||
{
|
||||
if (quantity < 0)
|
||||
{
|
||||
@@ -147,49 +122,12 @@ public class StackFormatter
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a quantity to stack size as it would
|
||||
* appear in RuneScape.
|
||||
*
|
||||
* @param quantity The quantity to convert.
|
||||
* @return The stack size as it would appear in RS,
|
||||
* with K after 100,000 and M after 10,000,000
|
||||
*/
|
||||
public static String quantityToRSStackSize(int quantity)
|
||||
{
|
||||
if (quantity == Integer.MIN_VALUE)
|
||||
{
|
||||
// Integer.MIN_VALUE = Integer.MIN_VALUE * -1 so we need to correct for it.
|
||||
return "-" + quantityToRSStackSize(Integer.MAX_VALUE);
|
||||
}
|
||||
else if (quantity < 0)
|
||||
{
|
||||
return "-" + quantityToRSStackSize(-quantity);
|
||||
}
|
||||
else if (quantity < 100_000)
|
||||
{
|
||||
return Integer.toString(quantity);
|
||||
}
|
||||
else if (quantity < 10_000_000)
|
||||
{
|
||||
return quantity / 1_000 + "K";
|
||||
}
|
||||
else
|
||||
{
|
||||
return quantity / 1_000_000 + "M";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a quantity to stack size as it would
|
||||
* appear in RuneScape. (with decimals)
|
||||
* <p>
|
||||
* This differs from quantityToRSStack in that it displays
|
||||
* decimals. Ex: 27100 is 27.1k (not 27k)
|
||||
* <p>
|
||||
*
|
||||
* @param quantity The quantity to convert.
|
||||
* @return The stack size as it would appear in RS, with decimals,
|
||||
* Convert a quantity to a short SI-prefix style string, possibly with a decimal,
|
||||
* with K after 100,000 and M after 10,000,000
|
||||
*
|
||||
* example: {@code 9,450}, {@code 2.1B}, {@code 100K}
|
||||
*
|
||||
* @see #quantityToRSDecimalStack(int, boolean)
|
||||
*/
|
||||
public static String quantityToRSDecimalStack(int quantity)
|
||||
{
|
||||
@@ -197,19 +135,16 @@ public class StackFormatter
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert a quantity to stack size as it would
|
||||
* appear in RuneScape. (with decimals)
|
||||
* <p>
|
||||
* This differs from quantityToRSStack in that it displays
|
||||
* decimals. Ex: 27100 is 27.1k (not 27k)
|
||||
* <p>
|
||||
*
|
||||
* @param quantity The quantity to convert.
|
||||
* @param precise If true, the returned string will have thousandths precision if quantity is larger than 1 million.
|
||||
* @return The stack size as it would appear in RS, with decimals,
|
||||
* Convert a quantity to a short SI-prefix style string, possibly with decimals,
|
||||
* with K after 100,000 and M after 10,000,000
|
||||
*
|
||||
* example without {@code precise}: {@code 9,450}, {@code 2.1B}, {@code 8.4M}
|
||||
* example with {@code precise}: {@code 9,450}, {@code 2.147B}, {@code 8.32M}
|
||||
*
|
||||
* @param precise If true, allow thousandths precision if {@code quantity} is larger than 1 million.
|
||||
* Otherwise have at most a single decimal
|
||||
*/
|
||||
public static String quantityToRSDecimalStack(int quantity, boolean precise)
|
||||
public static synchronized String quantityToRSDecimalStack(int quantity, boolean precise)
|
||||
{
|
||||
String quantityStr = String.valueOf(quantity);
|
||||
if (quantityStr.length() <= 4)
|
||||
@@ -234,7 +169,7 @@ public class StackFormatter
|
||||
* @param string The string to convert.
|
||||
* @return A long representation of it.
|
||||
*/
|
||||
public static long stackSizeToQuantity(String string) throws ParseException
|
||||
public static synchronized long parseQuantity(String string) throws ParseException
|
||||
{
|
||||
int multiplier = getMultiplier(string);
|
||||
float parsedValue = NUMBER_FORMATTER.parse(string).floatValue();
|
||||
@@ -242,29 +177,23 @@ public class StackFormatter
|
||||
}
|
||||
|
||||
/**
|
||||
* Specialization of format.
|
||||
* Formats a number to be comma delimited. No suffixes are given
|
||||
*
|
||||
* @param number the long number to format
|
||||
* @return the formatted String
|
||||
* @throws ArithmeticException if rounding is needed with rounding
|
||||
* mode being set to RoundingMode.UNNECESSARY
|
||||
* @see java.text.Format#format
|
||||
* example: {@code 10,123,351}, {@code 5}
|
||||
*/
|
||||
public static String formatNumber(final long number)
|
||||
public static synchronized String formatNumber(final long number)
|
||||
{
|
||||
return NUMBER_FORMATTER.format(number);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specialization of format.
|
||||
* Formats a number to be comma delimited. No suffixes are given. Has at
|
||||
* most 3 decimal places
|
||||
*
|
||||
* @param number the double number to format
|
||||
* @return the formatted String
|
||||
* @throws ArithmeticException if rounding is needed with rounding
|
||||
* mode being set to RoundingMode.UNNECESSARY
|
||||
* @see java.text.Format#format
|
||||
* example: {@code 10,123,351}, {@code 5.612}
|
||||
*/
|
||||
public static String formatNumber(double number)
|
||||
public static synchronized String formatNumber(double number)
|
||||
{
|
||||
return NUMBER_FORMATTER.format(number);
|
||||
}
|
||||
@@ -307,4 +236,21 @@ public class StackFormatter
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to call the platform to get a localized time string based on
|
||||
* the users preferences. Falls back on using locale default if it is on a
|
||||
* platform that has no consistent way of obtaining this information.
|
||||
*
|
||||
* @param localDateTime The LocalDateTime object to format as a string
|
||||
* @return The formatted string.
|
||||
*/
|
||||
public static String getPlatformTimeStringFromLocalDateTime(LocalDateTime localDateTime)
|
||||
{
|
||||
if (OSType.getOSType() == OSType.Windows)
|
||||
{
|
||||
return WinApi.getTimeFormatString(localDateTime);
|
||||
}
|
||||
return QuantityFormatter.getLocalizedDateTimeFormatter(FormatStyle.SHORT).format(localDateTime.toLocalTime());
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+5
@@ -28,6 +28,7 @@ package net.runelite.client.plugins.banktags;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.testing.fieldbinder.Bind;
|
||||
import com.google.inject.testing.fieldbinder.BoundFieldModule;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ItemDefinition;
|
||||
@@ -105,6 +106,10 @@ public class ItemValueSearchTest
|
||||
@Bind
|
||||
private RuneLiteConfig runeLiteConfig;
|
||||
|
||||
@Mock
|
||||
@Bind
|
||||
private ScheduledExecutorService scheduledExecutorService;
|
||||
|
||||
@Before
|
||||
public void before()
|
||||
{
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
* Copyright (c) 2018, arlyon <https://github.com/arlyon>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client.util;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Locale;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class QuantityFormatterTest
|
||||
{
|
||||
@Before
|
||||
public void setUp()
|
||||
{
|
||||
Locale.setDefault(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void quantityToRSDecimalStackSize()
|
||||
{
|
||||
assertEquals("0", QuantityFormatter.quantityToRSDecimalStack(0));
|
||||
assertEquals("8500", QuantityFormatter.quantityToRSDecimalStack(8_500));
|
||||
assertEquals("10K", QuantityFormatter.quantityToRSDecimalStack(10_000));
|
||||
assertEquals("21.7K", QuantityFormatter.quantityToRSDecimalStack(21_700));
|
||||
assertEquals("100K", QuantityFormatter.quantityToRSDecimalStack(100_000));
|
||||
assertEquals("100.3K", QuantityFormatter.quantityToRSDecimalStack(100_300));
|
||||
assertEquals("1M", QuantityFormatter.quantityToRSDecimalStack(1_000_000));
|
||||
assertEquals("8.4M", QuantityFormatter.quantityToRSDecimalStack(8_450_000));
|
||||
assertEquals("10M", QuantityFormatter.quantityToRSDecimalStack(10_000_000));
|
||||
assertEquals("12.8M", QuantityFormatter.quantityToRSDecimalStack(12_800_000));
|
||||
assertEquals("100M", QuantityFormatter.quantityToRSDecimalStack(100_000_000));
|
||||
assertEquals("250.1M", QuantityFormatter.quantityToRSDecimalStack(250_100_000));
|
||||
assertEquals("1B", QuantityFormatter.quantityToRSDecimalStack(1_000_000_000));
|
||||
assertEquals("1.5B", QuantityFormatter.quantityToRSDecimalStack(1500_000_000));
|
||||
assertEquals("2.1B", QuantityFormatter.quantityToRSDecimalStack(Integer.MAX_VALUE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void quantityToStackSize()
|
||||
{
|
||||
assertEquals("0", QuantityFormatter.quantityToStackSize(0));
|
||||
assertEquals("999", QuantityFormatter.quantityToStackSize(999));
|
||||
assertEquals("1,000", QuantityFormatter.quantityToStackSize(1000));
|
||||
assertEquals("9,450", QuantityFormatter.quantityToStackSize(9450));
|
||||
assertEquals("14.5K", QuantityFormatter.quantityToStackSize(14_500));
|
||||
assertEquals("99.9K", QuantityFormatter.quantityToStackSize(99_920));
|
||||
assertEquals("100K", QuantityFormatter.quantityToStackSize(100_000));
|
||||
assertEquals("10M", QuantityFormatter.quantityToStackSize(10_000_000));
|
||||
assertEquals("2.14B", QuantityFormatter.quantityToStackSize(Integer.MAX_VALUE));
|
||||
assertEquals("100B", QuantityFormatter.quantityToStackSize(100_000_000_000L));
|
||||
|
||||
assertEquals("0", QuantityFormatter.quantityToStackSize(-0));
|
||||
assertEquals("-400", QuantityFormatter.quantityToStackSize(-400));
|
||||
assertEquals("-400K", QuantityFormatter.quantityToStackSize(-400_000));
|
||||
assertEquals("-40M", QuantityFormatter.quantityToStackSize(-40_000_000));
|
||||
assertEquals("-2.14B", QuantityFormatter.quantityToStackSize(Integer.MIN_VALUE));
|
||||
assertEquals("-400B", QuantityFormatter.quantityToStackSize(-400_000_000_000L));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void quantityToPreciseStackSize()
|
||||
{
|
||||
assertEquals("0", QuantityFormatter.quantityToRSDecimalStack(0));
|
||||
assertEquals("8500", QuantityFormatter.quantityToRSDecimalStack(8_500, true));
|
||||
assertEquals("10K", QuantityFormatter.quantityToRSDecimalStack(10_000, true));
|
||||
assertEquals("21.7K", QuantityFormatter.quantityToRSDecimalStack(21_710, true));
|
||||
assertEquals("100K", QuantityFormatter.quantityToRSDecimalStack(100_000, true));
|
||||
assertEquals("100.3K", QuantityFormatter.quantityToRSDecimalStack(100_310, true));
|
||||
assertEquals("1M", QuantityFormatter.quantityToRSDecimalStack(1_000_000, true));
|
||||
assertEquals("8.45M", QuantityFormatter.quantityToRSDecimalStack(8_450_000, true));
|
||||
assertEquals("8.451M", QuantityFormatter.quantityToRSDecimalStack(8_451_000, true));
|
||||
assertEquals("10M", QuantityFormatter.quantityToRSDecimalStack(10_000_000, true));
|
||||
assertEquals("12.8M", QuantityFormatter.quantityToRSDecimalStack(12_800_000, true));
|
||||
assertEquals("12.85M", QuantityFormatter.quantityToRSDecimalStack(12_850_000, true));
|
||||
assertEquals("12.851M", QuantityFormatter.quantityToRSDecimalStack(12_851_000, true));
|
||||
assertEquals("100M", QuantityFormatter.quantityToRSDecimalStack(100_000_000, true));
|
||||
assertEquals("250.1M", QuantityFormatter.quantityToRSDecimalStack(250_100_000, true));
|
||||
assertEquals("250.151M", QuantityFormatter.quantityToRSDecimalStack(250_151_000, true));
|
||||
assertEquals("1B", QuantityFormatter.quantityToRSDecimalStack(1_000_000_000, true));
|
||||
assertEquals("1.5B", QuantityFormatter.quantityToRSDecimalStack(1500_000_000, true));
|
||||
assertEquals("1.55B", QuantityFormatter.quantityToRSDecimalStack(1550_000_000, true));
|
||||
assertEquals("2.147B", QuantityFormatter.quantityToRSDecimalStack(Integer.MAX_VALUE, true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stackSizeToQuantity() throws ParseException
|
||||
{
|
||||
assertEquals(0, QuantityFormatter.parseQuantity("0"));
|
||||
assertEquals(907, QuantityFormatter.parseQuantity("907"));
|
||||
assertEquals(1200, QuantityFormatter.parseQuantity("1200"));
|
||||
assertEquals(10_500, QuantityFormatter.parseQuantity("10,500"));
|
||||
assertEquals(10_500, QuantityFormatter.parseQuantity("10.5K"));
|
||||
assertEquals(33_560_000, QuantityFormatter.parseQuantity("33.56M"));
|
||||
assertEquals(2_000_000_000, QuantityFormatter.parseQuantity("2B"));
|
||||
|
||||
assertEquals(0, QuantityFormatter.parseQuantity("-0"));
|
||||
assertEquals(-400, QuantityFormatter.parseQuantity("-400"));
|
||||
assertEquals(-400_000, QuantityFormatter.parseQuantity("-400k"));
|
||||
assertEquals(-40_543_000, QuantityFormatter.parseQuantity("-40.543M"));
|
||||
|
||||
try
|
||||
{
|
||||
QuantityFormatter.parseQuantity("0L");
|
||||
fail("Should have thrown an exception for invalid suffix.");
|
||||
}
|
||||
catch (ParseException ignore)
|
||||
{
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
QuantityFormatter.parseQuantity("badstack");
|
||||
fail("Should have thrown an exception for improperly formatted stack.");
|
||||
}
|
||||
catch (ParseException ignore)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,159 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2018, arlyon <https://github.com/arlyon>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.client.util;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.util.Locale;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
public class StackFormatterTest
|
||||
{
|
||||
@Before
|
||||
public void setUp()
|
||||
{
|
||||
Locale.setDefault(Locale.ENGLISH);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void quantityToRSDecimalStackSize()
|
||||
{
|
||||
assertEquals("0", StackFormatter.quantityToRSDecimalStack(0));
|
||||
assertEquals("8500", StackFormatter.quantityToRSDecimalStack(8_500));
|
||||
assertEquals("10K", StackFormatter.quantityToRSDecimalStack(10_000));
|
||||
assertEquals("21.7K", StackFormatter.quantityToRSDecimalStack(21_700));
|
||||
assertEquals("100K", StackFormatter.quantityToRSDecimalStack(100_000));
|
||||
assertEquals("100.3K", StackFormatter.quantityToRSDecimalStack(100_300));
|
||||
assertEquals("1M", StackFormatter.quantityToRSDecimalStack(1_000_000));
|
||||
assertEquals("8.4M", StackFormatter.quantityToRSDecimalStack(8_450_000));
|
||||
assertEquals("10M", StackFormatter.quantityToRSDecimalStack(10_000_000));
|
||||
assertEquals("12.8M", StackFormatter.quantityToRSDecimalStack(12_800_000));
|
||||
assertEquals("100M", StackFormatter.quantityToRSDecimalStack(100_000_000));
|
||||
assertEquals("250.1M", StackFormatter.quantityToRSDecimalStack(250_100_000));
|
||||
assertEquals("1B", StackFormatter.quantityToRSDecimalStack(1_000_000_000));
|
||||
assertEquals("1.5B", StackFormatter.quantityToRSDecimalStack(1500_000_000));
|
||||
assertEquals("2.1B", StackFormatter.quantityToRSDecimalStack(Integer.MAX_VALUE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void quantityToRSStackSize()
|
||||
{
|
||||
assertEquals("0", StackFormatter.quantityToRSStackSize(0));
|
||||
assertEquals("99999", StackFormatter.quantityToRSStackSize(99_999));
|
||||
assertEquals("100K", StackFormatter.quantityToRSStackSize(100_000));
|
||||
assertEquals("10M", StackFormatter.quantityToRSStackSize(10_000_000));
|
||||
assertEquals("2147M", StackFormatter.quantityToRSStackSize(Integer.MAX_VALUE));
|
||||
|
||||
assertEquals("0", StackFormatter.quantityToRSStackSize(-0));
|
||||
assertEquals("-400", StackFormatter.quantityToRSStackSize(-400));
|
||||
assertEquals("-400K", StackFormatter.quantityToRSStackSize(-400_000));
|
||||
assertEquals("-40M", StackFormatter.quantityToRSStackSize(-40_000_000));
|
||||
assertEquals("-2147M", StackFormatter.quantityToRSStackSize(Integer.MIN_VALUE));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void quantityToStackSize()
|
||||
{
|
||||
assertEquals("0", StackFormatter.quantityToStackSize(0));
|
||||
assertEquals("999", StackFormatter.quantityToStackSize(999));
|
||||
assertEquals("1,000", StackFormatter.quantityToStackSize(1000));
|
||||
assertEquals("9,450", StackFormatter.quantityToStackSize(9450));
|
||||
assertEquals("14.5K", StackFormatter.quantityToStackSize(14_500));
|
||||
assertEquals("99.9K", StackFormatter.quantityToStackSize(99_920));
|
||||
assertEquals("100K", StackFormatter.quantityToStackSize(100_000));
|
||||
assertEquals("10M", StackFormatter.quantityToStackSize(10_000_000));
|
||||
assertEquals("2.14B", StackFormatter.quantityToStackSize(Integer.MAX_VALUE));
|
||||
assertEquals("100B", StackFormatter.quantityToStackSize(100_000_000_000L));
|
||||
|
||||
assertEquals("0", StackFormatter.quantityToStackSize(-0));
|
||||
assertEquals("-400", StackFormatter.quantityToStackSize(-400));
|
||||
assertEquals("-400K", StackFormatter.quantityToStackSize(-400_000));
|
||||
assertEquals("-40M", StackFormatter.quantityToStackSize(-40_000_000));
|
||||
assertEquals("-2.14B", StackFormatter.quantityToStackSize(Integer.MIN_VALUE));
|
||||
assertEquals("-400B", StackFormatter.quantityToStackSize(-400_000_000_000L));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void quantityToPreciseStackSize()
|
||||
{
|
||||
assertEquals("0", StackFormatter.quantityToRSDecimalStack(0));
|
||||
assertEquals("8500", StackFormatter.quantityToRSDecimalStack(8_500, true));
|
||||
assertEquals("10K", StackFormatter.quantityToRSDecimalStack(10_000, true));
|
||||
assertEquals("21.7K", StackFormatter.quantityToRSDecimalStack(21_710, true));
|
||||
assertEquals("100K", StackFormatter.quantityToRSDecimalStack(100_000, true));
|
||||
assertEquals("100.3K", StackFormatter.quantityToRSDecimalStack(100_310, true));
|
||||
assertEquals("1M", StackFormatter.quantityToRSDecimalStack(1_000_000, true));
|
||||
assertEquals("8.45M", StackFormatter.quantityToRSDecimalStack(8_450_000, true));
|
||||
assertEquals("8.451M", StackFormatter.quantityToRSDecimalStack(8_451_000, true));
|
||||
assertEquals("10M", StackFormatter.quantityToRSDecimalStack(10_000_000, true));
|
||||
assertEquals("12.8M", StackFormatter.quantityToRSDecimalStack(12_800_000, true));
|
||||
assertEquals("12.85M", StackFormatter.quantityToRSDecimalStack(12_850_000, true));
|
||||
assertEquals("12.851M", StackFormatter.quantityToRSDecimalStack(12_851_000, true));
|
||||
assertEquals("100M", StackFormatter.quantityToRSDecimalStack(100_000_000, true));
|
||||
assertEquals("250.1M", StackFormatter.quantityToRSDecimalStack(250_100_000, true));
|
||||
assertEquals("250.151M", StackFormatter.quantityToRSDecimalStack(250_151_000, true));
|
||||
assertEquals("1B", StackFormatter.quantityToRSDecimalStack(1_000_000_000, true));
|
||||
assertEquals("1.5B", StackFormatter.quantityToRSDecimalStack(1500_000_000, true));
|
||||
assertEquals("1.55B", StackFormatter.quantityToRSDecimalStack(1550_000_000, true));
|
||||
assertEquals("2.147B", StackFormatter.quantityToRSDecimalStack(Integer.MAX_VALUE, true));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void stackSizeToQuantity() throws ParseException
|
||||
{
|
||||
assertEquals(0, StackFormatter.stackSizeToQuantity("0"));
|
||||
assertEquals(907, StackFormatter.stackSizeToQuantity("907"));
|
||||
assertEquals(1200, StackFormatter.stackSizeToQuantity("1200"));
|
||||
assertEquals(10_500, StackFormatter.stackSizeToQuantity("10,500"));
|
||||
assertEquals(10_500, StackFormatter.stackSizeToQuantity("10.5K"));
|
||||
assertEquals(33_560_000, StackFormatter.stackSizeToQuantity("33.56M"));
|
||||
assertEquals(2_000_000_000, StackFormatter.stackSizeToQuantity("2B"));
|
||||
|
||||
assertEquals(0, StackFormatter.stackSizeToQuantity("-0"));
|
||||
assertEquals(-400, StackFormatter.stackSizeToQuantity("-400"));
|
||||
assertEquals(-400_000, StackFormatter.stackSizeToQuantity("-400k"));
|
||||
assertEquals(-40_543_000, StackFormatter.stackSizeToQuantity("-40.543M"));
|
||||
|
||||
try
|
||||
{
|
||||
StackFormatter.stackSizeToQuantity("0L");
|
||||
fail("Should have thrown an exception for invalid suffix.");
|
||||
}
|
||||
catch (ParseException ignore)
|
||||
{
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
StackFormatter.stackSizeToQuantity("badstack");
|
||||
fail("Should have thrown an exception for improperly formatted stack.");
|
||||
}
|
||||
catch (ParseException ignore)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user