Merge branch 'master' of https://github.com/runelite/runelite into upstream
Conflicts: runelite-api/src/main/java/net/runelite/api/Point.java runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/EmoteClue.java runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/hotcold/HotColdLocation.java runelite-client/src/main/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPlugin.java runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeConfig.java runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeOverlay.java runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargePlugin.java runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemChargeType.java runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemWithSlot.java runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatOverlay.java runelite-client/src/main/java/net/runelite/client/plugins/timestamp/TimestampConfig.java runelite-client/src/test/java/net/runelite/client/plugins/idlenotifier/IdleNotifierPluginTest.java runelite-client/src/test/java/net/runelite/client/plugins/woodcutting/WoodcuttingPluginTest.java
This commit is contained in:
@@ -37,13 +37,21 @@ public class Hitsplat
|
||||
public enum HitsplatType
|
||||
{
|
||||
/**
|
||||
* Blocking damage (blue).
|
||||
* Blocking damage by me (blue).
|
||||
*/
|
||||
BLOCK,
|
||||
BLOCK_ME,
|
||||
/**
|
||||
* Taking damage (red).
|
||||
* Blocking damage by others (blue).
|
||||
*/
|
||||
DAMAGE,
|
||||
BLOCK_OTHER,
|
||||
/**
|
||||
* Taking damage by me (red).
|
||||
*/
|
||||
DAMAGE_ME,
|
||||
/**
|
||||
* Taking damage by others (red).
|
||||
*/
|
||||
DAMAGE_OTHER,
|
||||
/**
|
||||
* Damage from poison (green).
|
||||
*/
|
||||
@@ -72,8 +80,10 @@ public class Hitsplat
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case 0: return BLOCK;
|
||||
case 1: return DAMAGE;
|
||||
case 12: return BLOCK_ME;
|
||||
case 13: return BLOCK_OTHER;
|
||||
case 16: return DAMAGE_ME;
|
||||
case 17: return DAMAGE_OTHER;
|
||||
case 2: return POISON;
|
||||
case 4: return DISEASE;
|
||||
case 5: return VENOM;
|
||||
|
||||
@@ -7347,7 +7347,7 @@ public final class ItemID
|
||||
public static final int ABSORPTION_2 = 11736;
|
||||
public static final int ABSORPTION_1 = 11737;
|
||||
public static final int HERB_BOX = 11738;
|
||||
public static final int OPENED_HERB_BOX = 11739;
|
||||
public static final int OPEN_HERB_BOX = 11739;
|
||||
public static final int SCROLL_OF_REDIRECTION = 11740;
|
||||
public static final int RIMMINGTON_TELEPORT = 11741;
|
||||
public static final int TAVERLEY_TELEPORT = 11742;
|
||||
@@ -7481,6 +7481,7 @@ public final class ItemID
|
||||
public static final int BOX_OF_CHOCOLATE_STRAWBERRIES = 11912;
|
||||
public static final int BOX_OF_CHOCOLATE_STRAWBERRIES_11914 = 11914;
|
||||
public static final int SLICE_OF_BIRTHDAY_CAKE = 11916;
|
||||
public static final int SLICE_OF_BIRTHDAY_CAKE_11917 = 11917;
|
||||
public static final int BIRTHDAY_PRESENT = 11918;
|
||||
public static final int COW_MASK = 11919;
|
||||
public static final int DRAGON_PICKAXE = 11920;
|
||||
@@ -11391,8 +11392,8 @@ public final class ItemID
|
||||
public static final int TWISTED_RELICHUNTER_T3_ARMOUR_SET = 24475;
|
||||
public static final int OPEN_HERB_SACK = 24478;
|
||||
public static final int SPICE_RACK = 24479;
|
||||
public static final int OPENED_COAL_BAG = 24480;
|
||||
public static final int OPENED_GEM_BAG = 24481;
|
||||
public static final int OPEN_COAL_BAG = 24480;
|
||||
public static final int OPEN_GEM_BAG = 24481;
|
||||
public static final int OPEN_SEED_BOX = 24482;
|
||||
public static final int PHOENIX_24483 = 24483;
|
||||
public static final int PHOENIX_24484 = 24484;
|
||||
@@ -11407,11 +11408,9 @@ public final class ItemID
|
||||
public static final int VOLATILE_ORB = 24514;
|
||||
public static final int ELDRITCH_ORB = 24517;
|
||||
public static final int VICTORS_CAPE_1000 = 24520;
|
||||
public static final int CAT_EARS = 24522;
|
||||
public static final int LOOSE_CAT_HAIR = 24523;
|
||||
public static final int GERTRUDES_COMB = 24524;
|
||||
public static final int CAT_EARS_24525 = 24525;
|
||||
public static final int CAT_EARS = 24525;
|
||||
public static final int HELL_CAT_EARS = 24527;
|
||||
public static final int LAMP_OF_THE_GATHERER = 24528;
|
||||
public static final int HARMONY = 24529;
|
||||
/* This file is automatically generated. Do not edit. */
|
||||
}
|
||||
|
||||
@@ -8429,6 +8429,15 @@ public final class NpcID
|
||||
public static final int SHURA = 9413;
|
||||
public static final int SHURA_9414 = 9414;
|
||||
public static final int ACORN = 9415;
|
||||
public static final int PHOSANIS_NIGHTMARE = 9416;
|
||||
public static final int PHOSANIS_NIGHTMARE_9417 = 9417;
|
||||
public static final int PHOSANIS_NIGHTMARE_9418 = 9418;
|
||||
public static final int PHOSANIS_NIGHTMARE_9419 = 9419;
|
||||
public static final int PHOSANIS_NIGHTMARE_9420 = 9420;
|
||||
public static final int PHOSANIS_NIGHTMARE_9421 = 9421;
|
||||
public static final int PHOSANIS_NIGHTMARE_9422 = 9422;
|
||||
public static final int PHOSANIS_NIGHTMARE_9423 = 9423;
|
||||
public static final int PHOSANIS_NIGHTMARE_9424 = 9424;
|
||||
public static final int THE_NIGHTMARE = 9425;
|
||||
public static final int THE_NIGHTMARE_9426 = 9426;
|
||||
public static final int THE_NIGHTMARE_9427 = 9427;
|
||||
@@ -8466,12 +8475,12 @@ public final class NpcID
|
||||
public static final int THE_NIGHTMARE_9463 = 9463;
|
||||
public static final int THE_NIGHTMARE_9464 = 9464;
|
||||
public static final int INFERNAL_PYRELORD = 9465;
|
||||
public static final int DRAUL_LEPTOC_9467 = 9467;
|
||||
public static final int HORACIO_9468 = 9468;
|
||||
public static final int WISE_OLD_MAN_9469 = 9469;
|
||||
public static final int HANS_9470 = 9470;
|
||||
public static final int KING_ROALD_9471 = 9471;
|
||||
public static final int ELLAMARIA_9472 = 9472;
|
||||
public static final int GNOME_CHILD_9473 = 9473;
|
||||
public static final int HUSK_9466 = 9466;
|
||||
public static final int HUSK_9467 = 9467;
|
||||
public static final int PARASITE_9468 = 9468;
|
||||
public static final int PARASITE_9469 = 9469;
|
||||
public static final int SLEEPWALKER_9470 = 9470;
|
||||
public static final int SISTER_SENGA = 9471;
|
||||
public static final int SISTER_SENGA_9472 = 9472;
|
||||
/* This file is automatically generated. Do not edit. */
|
||||
}
|
||||
|
||||
@@ -4321,7 +4321,6 @@ public final class NullItemID
|
||||
public static final int NULL_11911 = 11911;
|
||||
public static final int NULL_11913 = 11913;
|
||||
public static final int NULL_11915 = 11915;
|
||||
public static final int NULL_11917 = 11917;
|
||||
public static final int NULL_11921 = 11921;
|
||||
public static final int NULL_11925 = 11925;
|
||||
public static final int NULL_11927 = 11927;
|
||||
@@ -12906,6 +12905,10 @@ public final class NullItemID
|
||||
public static final int NULL_24518 = 24518;
|
||||
public static final int NULL_24519 = 24519;
|
||||
public static final int NULL_24521 = 24521;
|
||||
public static final int NULL_24522 = 24522;
|
||||
public static final int NULL_24523 = 24523;
|
||||
public static final int NULL_24524 = 24524;
|
||||
public static final int NULL_24526 = 24526;
|
||||
public static final int NULL_24530 = 24530;
|
||||
/* This file is automatically generated. Do not edit. */
|
||||
}
|
||||
|
||||
@@ -13894,7 +13894,8 @@ public final class NullObjectID
|
||||
public static final int NULL_29702 = 29702;
|
||||
public static final int NULL_29703 = 29703;
|
||||
public static final int NULL_29704 = 29704;
|
||||
public static final int NULL_29706 = 29706;
|
||||
public static final int NULL_29709 = 29709;
|
||||
public static final int NULL_29710 = 29710;
|
||||
public static final int NULL_29713 = 29713;
|
||||
public static final int NULL_29714 = 29714;
|
||||
public static final int NULL_29715 = 29715;
|
||||
@@ -18160,7 +18161,6 @@ public final class NullObjectID
|
||||
public static final int NULL_37722 = 37722;
|
||||
public static final int NULL_37723 = 37723;
|
||||
public static final int NULL_37724 = 37724;
|
||||
public static final int NULL_37725 = 37725;
|
||||
public static final int NULL_37732 = 37732;
|
||||
public static final int NULL_37733 = 37733;
|
||||
public static final int NULL_37734 = 37734;
|
||||
@@ -18329,34 +18329,5 @@ public final class NullObjectID
|
||||
public static final int NULL_37934 = 37934;
|
||||
public static final int NULL_37935 = 37935;
|
||||
public static final int NULL_37950 = 37950;
|
||||
public static final int NULL_37952 = 37952;
|
||||
public static final int NULL_37953 = 37953;
|
||||
public static final int NULL_37954 = 37954;
|
||||
public static final int NULL_37962 = 37962;
|
||||
public static final int NULL_37963 = 37963;
|
||||
public static final int NULL_37964 = 37964;
|
||||
public static final int NULL_37965 = 37965;
|
||||
public static final int NULL_37966 = 37966;
|
||||
public static final int NULL_37967 = 37967;
|
||||
public static final int NULL_37971 = 37971;
|
||||
public static final int NULL_37972 = 37972;
|
||||
public static final int NULL_37973 = 37973;
|
||||
public static final int NULL_37975 = 37975;
|
||||
public static final int NULL_37977 = 37977;
|
||||
public static final int NULL_37978 = 37978;
|
||||
public static final int NULL_37979 = 37979;
|
||||
public static final int NULL_37980 = 37980;
|
||||
public static final int NULL_37981 = 37981;
|
||||
public static final int NULL_37982 = 37982;
|
||||
public static final int NULL_37984 = 37984;
|
||||
public static final int NULL_37985 = 37985;
|
||||
public static final int NULL_37986 = 37986;
|
||||
public static final int NULL_37987 = 37987;
|
||||
public static final int NULL_37988 = 37988;
|
||||
public static final int NULL_37989 = 37989;
|
||||
public static final int NULL_37990 = 37990;
|
||||
public static final int NULL_37991 = 37991;
|
||||
public static final int NULL_37992 = 37992;
|
||||
public static final int NULL_37994 = 37994;
|
||||
/* This file is automatically generated. Do not edit. */
|
||||
}
|
||||
|
||||
@@ -15800,6 +15800,9 @@ public final class ObjectID
|
||||
public static final int CARVED_REDWOOD_29681 = 29681;
|
||||
public static final int CARVED_REDWOOD_29682 = 29682;
|
||||
public static final int CRACK_29705 = 29705;
|
||||
public static final int POOL_OF_NIGHTMARES = 29706;
|
||||
public static final int POOL_OF_NIGHTMARES_29707 = 29707;
|
||||
public static final int SCOREBOARD_29708 = 29708;
|
||||
public static final int NOTICEBOARD_29718 = 29718;
|
||||
public static final int BALLISTA_29719 = 29719;
|
||||
public static final int STAIRCASE_29720 = 29720;
|
||||
@@ -19580,16 +19583,5 @@ public final class ObjectID
|
||||
public static final int DOOR_37938 = 37938;
|
||||
public static final int SCOREBOARD_37949 = 37949;
|
||||
public static final int COFFIN_37951 = 37951;
|
||||
public static final int LIGHT_37955 = 37955;
|
||||
public static final int LIGHT_37956 = 37956;
|
||||
public static final int LIGHT_37957 = 37957;
|
||||
public static final int LIGHT_37958 = 37958;
|
||||
public static final int LIGHT_37959 = 37959;
|
||||
public static final int LIGHT_37960 = 37960;
|
||||
public static final int BANQUET_TABLE_37968 = 37968;
|
||||
public static final int PRESENT_TABLE = 37969;
|
||||
public static final int BIRTHDAY_HAT_TABLE = 37970;
|
||||
public static final int PARTY_BALLOONS = 37974;
|
||||
public static final int TABLE_37976 = 37976;
|
||||
/* This file is automatically generated. Do not edit. */
|
||||
}
|
||||
|
||||
@@ -24,46 +24,17 @@
|
||||
*/
|
||||
package net.runelite.api;
|
||||
|
||||
import lombok.Value;
|
||||
|
||||
/**
|
||||
* A two-dimensional coordinate on the canvas.
|
||||
*/
|
||||
@Value
|
||||
public class Point
|
||||
{
|
||||
private final int x;
|
||||
private final int y;
|
||||
|
||||
public Point(int x, int y)
|
||||
{
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString()
|
||||
{
|
||||
return "Point{" + "x=" + x + ", y=" + y + '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the x-axis coordinate of the point.
|
||||
*
|
||||
* @return the x-axis coordinate
|
||||
*/
|
||||
public int getX()
|
||||
{
|
||||
return x;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the y-axis coordinate of the point.
|
||||
*
|
||||
* @return the y-axis coordinate
|
||||
*/
|
||||
public int getY()
|
||||
{
|
||||
return y;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the distance between this point and another.
|
||||
*
|
||||
@@ -74,36 +45,4 @@ public class Point
|
||||
{
|
||||
return (int) Math.hypot(getX() - other.getX(), getY() - other.getY());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
int hash = 3;
|
||||
hash = 23 * hash + this.x;
|
||||
hash = 23 * hash + this.y;
|
||||
return hash;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
if (this == obj)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (obj == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (getClass() != obj.getClass())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
final Point other = (Point) obj;
|
||||
if (this.x != other.x)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return this.y == other.y;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1206,9 +1206,9 @@ public class WidgetID
|
||||
|
||||
static class Options
|
||||
{
|
||||
static final int MUSIC_SLIDER = 38;
|
||||
static final int SOUND_EFFECT_SLIDER = 44;
|
||||
static final int AREA_SOUND_SLIDER = 50;
|
||||
static final int MUSIC_SLIDER = 37;
|
||||
static final int SOUND_EFFECT_SLIDER = 43;
|
||||
static final int AREA_SOUND_SLIDER = 49;
|
||||
}
|
||||
|
||||
static class AchievementDiary
|
||||
|
||||
+9
-32
@@ -44,7 +44,6 @@ import net.runelite.client.ui.overlay.components.TooltipComponent;
|
||||
public class TooltipOverlay extends Overlay
|
||||
{
|
||||
private static final int UNDER_OFFSET = 24;
|
||||
private static final int ABOVE_OFFSET = -20;
|
||||
private static final int PADDING = 2;
|
||||
private final TooltipManager tooltipManager;
|
||||
private final Client client;
|
||||
@@ -84,50 +83,28 @@ public class TooltipOverlay extends Overlay
|
||||
|
||||
private Dimension renderTooltips(Graphics2D graphics, List<Tooltip> tooltips)
|
||||
{
|
||||
final Rectangle clientCanvasBounds = new Rectangle(client.getRealDimensions());
|
||||
final int canvasWidth = client.getCanvasWidth();
|
||||
final int canvasHeight = client.getCanvasHeight();
|
||||
final net.runelite.api.Point mouseCanvasPosition = client.getMouseCanvasPosition();
|
||||
final int offset = runeLiteConfig.tooltipPosition() == TooltipPositionType.UNDER_CURSOR ? UNDER_OFFSET : ABOVE_OFFSET;
|
||||
final Point mousePosition = new Point(mouseCanvasPosition.getX(), mouseCanvasPosition.getY() + offset);
|
||||
final Rectangle bounds = new Rectangle(getBounds());
|
||||
bounds.setLocation(mousePosition);
|
||||
final Rectangle prevBounds = getBounds();
|
||||
|
||||
if (!clientCanvasBounds.contains(bounds))
|
||||
{
|
||||
final int clientX = (int) clientCanvasBounds.getMaxX();
|
||||
final int clientY = (int) clientCanvasBounds.getMaxY();
|
||||
final int boundsX = (int) bounds.getMaxX();
|
||||
final int boundsY = (int) bounds.getMaxY();
|
||||
final int tooltipX = Math.min(canvasWidth - prevBounds.width, mouseCanvasPosition.getX());
|
||||
final int tooltipY = runeLiteConfig.tooltipPosition() == TooltipPositionType.ABOVE_CURSOR
|
||||
? Math.max(0, mouseCanvasPosition.getY() - prevBounds.height)
|
||||
: Math.min(canvasHeight - prevBounds.height, mouseCanvasPosition.getY() + UNDER_OFFSET);
|
||||
|
||||
if (boundsY > clientY)
|
||||
{
|
||||
graphics.translate(0, -bounds.height - offset);
|
||||
}
|
||||
|
||||
if (boundsX > clientX)
|
||||
{
|
||||
graphics.translate(-bounds.width + clientCanvasBounds.width - bounds.x, 0);
|
||||
}
|
||||
}
|
||||
|
||||
final Rectangle newBounds = new Rectangle(-1, -1, 0, 0);
|
||||
final Rectangle newBounds = new Rectangle(tooltipX, tooltipY, 0, 0);
|
||||
|
||||
for (Tooltip tooltip : tooltips)
|
||||
{
|
||||
final TooltipComponent tooltipComponent = new TooltipComponent();
|
||||
tooltipComponent.setModIcons(client.getModIcons());
|
||||
tooltipComponent.setText(tooltip.getText());
|
||||
tooltipComponent.setPosition(new Point(tooltipX, tooltipY + newBounds.height));
|
||||
|
||||
if (newBounds.contains(mousePosition))
|
||||
{
|
||||
mousePosition.move(mouseCanvasPosition.getX(), mouseCanvasPosition.getY() + offset + newBounds.height);
|
||||
}
|
||||
|
||||
tooltipComponent.setPosition(mousePosition);
|
||||
final Dimension dimension = tooltipComponent.render(graphics);
|
||||
|
||||
// Create incremental tooltip newBounds
|
||||
newBounds.x = newBounds.x != -1 ? Math.min(newBounds.x, mousePosition.x) : mousePosition.x;
|
||||
newBounds.y = newBounds.y != -1 ? Math.min(newBounds.y, mousePosition.y) : mousePosition.y;
|
||||
newBounds.height += dimension.height + PADDING;
|
||||
newBounds.width = Math.max(newBounds.width, dimension.width);
|
||||
}
|
||||
|
||||
@@ -1401,11 +1401,13 @@
|
||||
],
|
||||
"coal bag": [
|
||||
764,
|
||||
12019
|
||||
12019,
|
||||
24480
|
||||
],
|
||||
"gem bag": [
|
||||
766,
|
||||
12020
|
||||
12020,
|
||||
24481
|
||||
],
|
||||
"phoenix crossbow": [
|
||||
767,
|
||||
@@ -7609,6 +7611,10 @@
|
||||
11736,
|
||||
11737
|
||||
],
|
||||
"herb box": [
|
||||
11738,
|
||||
11739
|
||||
],
|
||||
"armadyl crossbow": [
|
||||
11785,
|
||||
23611
|
||||
@@ -7815,6 +7821,10 @@
|
||||
11912,
|
||||
11914
|
||||
],
|
||||
"slice of birthday cake": [
|
||||
11916,
|
||||
11917
|
||||
],
|
||||
"dragon pickaxe": [
|
||||
11920,
|
||||
12797,
|
||||
@@ -8271,6 +8281,10 @@
|
||||
13222,
|
||||
13224
|
||||
],
|
||||
"herb sack": [
|
||||
13226,
|
||||
24478
|
||||
],
|
||||
"eternal boots": [
|
||||
13235,
|
||||
23644
|
||||
@@ -8539,6 +8553,10 @@
|
||||
13576,
|
||||
20785
|
||||
],
|
||||
"seed box": [
|
||||
13639,
|
||||
24482
|
||||
],
|
||||
"farmers boro trousers": [
|
||||
13640,
|
||||
13641
|
||||
@@ -9692,9 +9710,5 @@
|
||||
24469,
|
||||
24472,
|
||||
24475
|
||||
],
|
||||
"cat ears": [
|
||||
24522,
|
||||
24525
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
15660E39A740C416BFD71621A448A96FA6B5C5E8AD212179F3D6785AE35CAA38
|
||||
A9BA4723E7D91AD151C1AB3ABEAF84971BFFD71AA8C23E763ECCC8981A8A1429
|
||||
@@ -47,7 +47,7 @@ LABEL23:
|
||||
get_varbit 8119
|
||||
iconst 1
|
||||
if_icmpeq LABEL42
|
||||
jump LABEL144
|
||||
jump LABEL146
|
||||
LABEL42:
|
||||
iconst 105
|
||||
iconst 115
|
||||
@@ -96,11 +96,13 @@ LABEL77:
|
||||
iload 4
|
||||
iconst 1
|
||||
if_icmpeq LABEL86
|
||||
jump LABEL101
|
||||
jump LABEL103
|
||||
LABEL86:
|
||||
iconst 60
|
||||
iconst 5
|
||||
iload 3
|
||||
add
|
||||
invoke 1045
|
||||
iconst 30
|
||||
iconst 0
|
||||
iconst 0
|
||||
@@ -112,8 +114,8 @@ LABEL86:
|
||||
iconst 2
|
||||
iconst 10616871
|
||||
if_setposition
|
||||
jump LABEL113
|
||||
LABEL101:
|
||||
jump LABEL115
|
||||
LABEL103:
|
||||
iconst 0
|
||||
iconst 30
|
||||
iconst 0
|
||||
@@ -126,26 +128,26 @@ LABEL101:
|
||||
iconst 2
|
||||
iconst 10616871
|
||||
if_setposition
|
||||
LABEL113:
|
||||
LABEL115:
|
||||
iload 3
|
||||
iconst 10616889
|
||||
if_getwidth
|
||||
if_icmpgt LABEL118
|
||||
jump LABEL124
|
||||
LABEL118:
|
||||
if_icmpgt LABEL120
|
||||
jump LABEL126
|
||||
LABEL120:
|
||||
iconst 2
|
||||
iconst 2
|
||||
iconst 0
|
||||
iconst 10616889
|
||||
if_settextalign
|
||||
jump LABEL129
|
||||
LABEL124:
|
||||
jump LABEL131
|
||||
LABEL126:
|
||||
iconst 0
|
||||
iconst 2
|
||||
iconst 0
|
||||
iconst 10616889
|
||||
if_settextalign
|
||||
LABEL129:
|
||||
LABEL131:
|
||||
iconst 10616889
|
||||
if_clearops
|
||||
iconst -1
|
||||
@@ -160,8 +162,8 @@ LABEL129:
|
||||
sconst ""
|
||||
iconst 10616889
|
||||
if_setonop
|
||||
jump LABEL185
|
||||
LABEL144:
|
||||
jump LABEL187
|
||||
LABEL146:
|
||||
iconst 105
|
||||
iconst 115
|
||||
iconst 1894
|
||||
@@ -203,7 +205,7 @@ LABEL144:
|
||||
sconst "ii"
|
||||
iconst 10616889
|
||||
if_setonop
|
||||
LABEL185:
|
||||
LABEL187:
|
||||
sload 2
|
||||
iconst 10616889
|
||||
if_settext
|
||||
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
/*
|
||||
* Copyright (c) 2020 Jordan <nightfirecat@protonmail.com>
|
||||
* 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.itemstats;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.testing.fieldbinder.Bind;
|
||||
import com.google.inject.testing.fieldbinder.BoundFieldModule;
|
||||
import java.awt.Color;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.EquipmentInventorySlot;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.util.Text;
|
||||
import net.runelite.http.api.item.ItemEquipmentStats;
|
||||
import net.runelite.http.api.item.ItemStats;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
import org.mockito.junit.MockitoJUnitRunner;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class ItemStatOverlayTest
|
||||
{
|
||||
// Weapon definitions
|
||||
private static final ItemStats ABYSSAL_DAGGER = new ItemStats(false, true, 0.453, 8,
|
||||
ItemEquipmentStats.builder()
|
||||
.slot(EquipmentInventorySlot.WEAPON.getSlotIdx())
|
||||
.astab(75)
|
||||
.aslash(40)
|
||||
.acrush(-4)
|
||||
.amagic(1)
|
||||
.dmagic(1)
|
||||
.str(75)
|
||||
.aspeed(4)
|
||||
.build());
|
||||
private static final ItemStats KATANA = new ItemStats(false, true, 0, 8,
|
||||
ItemEquipmentStats.builder()
|
||||
.slot(EquipmentInventorySlot.WEAPON.getSlotIdx())
|
||||
.astab(7)
|
||||
.aslash(45)
|
||||
.dstab(3)
|
||||
.dslash(7)
|
||||
.dcrush(7)
|
||||
.drange(-3)
|
||||
.str(40)
|
||||
.aspeed(4)
|
||||
.build());
|
||||
private static final ItemStats BLOWPIPE = new ItemStats(false, true, 0, 0,
|
||||
ItemEquipmentStats.builder()
|
||||
.slot(EquipmentInventorySlot.WEAPON.getSlotIdx())
|
||||
.arange(60)
|
||||
.rstr(40)
|
||||
.aspeed(3)
|
||||
.build());
|
||||
private static final ItemStats HEAVY_BALLISTA = new ItemStats(false, true, 4, 8,
|
||||
ItemEquipmentStats.builder()
|
||||
.slot(EquipmentInventorySlot.WEAPON.getSlotIdx())
|
||||
.arange(110)
|
||||
.aspeed(7)
|
||||
.build());
|
||||
|
||||
@Inject
|
||||
ItemStatOverlay overlay;
|
||||
|
||||
@Mock
|
||||
@Bind
|
||||
Client client;
|
||||
|
||||
@Mock
|
||||
@Bind
|
||||
ItemStatConfig config;
|
||||
|
||||
@Mock
|
||||
@Bind
|
||||
ItemManager itemManager;
|
||||
|
||||
@Before
|
||||
public void before()
|
||||
{
|
||||
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
|
||||
|
||||
when(config.colorBetterUncapped()).thenReturn(new Color(0));
|
||||
when(config.colorWorse()).thenReturn(new Color(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUnarmedAttackSpeed()
|
||||
{
|
||||
assertEquals(ItemStatOverlay.UNARMED.getEquipment().getAspeed(), ABYSSAL_DAGGER.getEquipment().getAspeed());
|
||||
assertEquals(ItemStatOverlay.UNARMED.getEquipment().getAspeed(), KATANA.getEquipment().getAspeed());
|
||||
assertEquals(-1, BLOWPIPE.getEquipment().getAspeed() - ItemStatOverlay.UNARMED.getEquipment().getAspeed());
|
||||
assertEquals(3, HEAVY_BALLISTA.getEquipment().getAspeed() - ItemStatOverlay.UNARMED.getEquipment().getAspeed());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBuildStatBonusString()
|
||||
{
|
||||
// Empty equipment (fully unarmed)
|
||||
final ItemContainer equipment = mock(ItemContainer.class);
|
||||
when(equipment.getItems()).thenReturn(new Item[0]);
|
||||
when(client.getItemContainer(InventoryID.EQUIPMENT)).thenReturn(equipment);
|
||||
|
||||
String tooltip;
|
||||
String sanitizedTooltip;
|
||||
|
||||
tooltip = overlay.buildStatBonusString(ABYSSAL_DAGGER);
|
||||
sanitizedTooltip = Text.sanitizeMultilineText(tooltip);
|
||||
assertTrue(sanitizedTooltip.contains("Stab: +75"));
|
||||
assertTrue(sanitizedTooltip.contains("Slash: +40"));
|
||||
assertTrue(sanitizedTooltip.contains("Crush: -4"));
|
||||
assertEquals(2, StringUtils.countMatches(sanitizedTooltip, "Magic: +1")); // Attack and defense
|
||||
assertTrue(sanitizedTooltip.contains("Melee Str: +75"));
|
||||
assertFalse(sanitizedTooltip.contains("Speed:"));
|
||||
|
||||
tooltip = overlay.buildStatBonusString(KATANA);
|
||||
sanitizedTooltip = Text.sanitizeMultilineText(tooltip);
|
||||
assertTrue(sanitizedTooltip.contains("Stab: +7"));
|
||||
assertTrue(sanitizedTooltip.contains("Slash: +45"));
|
||||
assertTrue(sanitizedTooltip.contains("Stab: +3")); // Defense
|
||||
assertTrue(sanitizedTooltip.contains("Slash: +7")); // Defense
|
||||
assertTrue(sanitizedTooltip.contains("Crush: +7")); // Defense
|
||||
assertTrue(sanitizedTooltip.contains("Range: -3")); // Defense
|
||||
assertTrue(sanitizedTooltip.contains("Melee Str: +40"));
|
||||
assertFalse(sanitizedTooltip.contains("Speed:"));
|
||||
|
||||
tooltip = overlay.buildStatBonusString(BLOWPIPE);
|
||||
sanitizedTooltip = Text.sanitizeMultilineText(tooltip);
|
||||
assertTrue(sanitizedTooltip.contains("Range: +60"));
|
||||
assertTrue(sanitizedTooltip.contains("Range Str: +40"));
|
||||
assertTrue(sanitizedTooltip.contains("Speed: -1"));
|
||||
assertFalse(sanitizedTooltip.contains("Stab:"));
|
||||
|
||||
tooltip = overlay.buildStatBonusString(HEAVY_BALLISTA);
|
||||
sanitizedTooltip = Text.sanitizeMultilineText(tooltip);
|
||||
assertTrue(sanitizedTooltip.contains("Range: +110"));
|
||||
assertTrue(sanitizedTooltip.contains("Speed: +3"));
|
||||
assertFalse(sanitizedTooltip.contains("Stab:"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user