From 21a9bd45f7f1b156a2b347d6af34e56a022241e6 Mon Sep 17 00:00:00 2001 From: Kruithne Date: Fri, 25 May 2018 22:23:46 +0100 Subject: [PATCH 1/3] skill calculator: allow XP values up to 200,000,000 rather than 188,884,740 --- .../plugins/skillcalculator/SkillCalculator.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java index 86cd510e71..9042edf13e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java @@ -52,6 +52,12 @@ import net.runelite.client.ui.FontManager; class SkillCalculator extends JPanel { + private static final int MAX_XP = 200_000_000; + private static final DecimalFormat XP_FORMAT = new DecimalFormat("#.#"); + + static SpriteManager spriteManager; + static ItemManager itemManager; + private Client client; private SkillData skillData; private List uiActionSlots = new ArrayList<>(); @@ -59,9 +65,6 @@ class SkillCalculator extends JPanel private CacheSkillData cacheSkillData = new CacheSkillData(); - static SpriteManager spriteManager; - static ItemManager itemManager; - private UICombinedActionSlot combinedActionSlot = new UICombinedActionSlot(); private ArrayList combinedActionSlots = new ArrayList<>(); @@ -71,10 +74,6 @@ class SkillCalculator extends JPanel private int targetXP = Experience.getXpForLevel(targetLevel); private float xpFactor = 1.0f; - private static int MAX_XP = Experience.getXpForLevel(Experience.MAX_VIRT_LEVEL); - - private static DecimalFormat XP_FORMAT = new DecimalFormat("#.#"); - SkillCalculator(Client client, UICalculatorInputArea uiInput) { this.client = client; @@ -313,4 +312,4 @@ class SkillCalculator extends JPanel { return Math.min(MAX_XP, Math.max(0, input)); } -} +} \ No newline at end of file From 4f129da6987a1a9eb0df45826827ddfbc88263f7 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 27 May 2018 16:36:17 -0400 Subject: [PATCH 2/3] skill calculator: lombok some of UIActionSlot --- .../skillcalculator/SkillCalculator.java | 15 +++---- .../plugins/skillcalculator/UIActionSlot.java | 41 +++++++++++++++---- 2 files changed, 40 insertions(+), 16 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java index 9042edf13e..8e6a864d14 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java @@ -151,7 +151,7 @@ class SkillCalculator extends JPanel double xp = 0; for (UIActionSlot slot : combinedActionSlots) - xp += slot.value; + xp += slot.getValue(); if (neededXP > 0) actionCount = (int) Math.ceil(neededXP / xp); @@ -216,12 +216,12 @@ class SkillCalculator extends JPanel if (!e.isShiftDown()) clearCombinedSlots(); - if (slot.isSelected) + if (slot.isSelected()) combinedActionSlots.remove(slot); else combinedActionSlots.add(slot); - slot.setSelected(!slot.isSelected); + slot.setSelected(!slot.isSelected()); updateCombinedAction(); } }); @@ -238,14 +238,15 @@ class SkillCalculator extends JPanel { int actionCount = 0; int neededXP = targetXP - currentXP; - double xp = (slot.action.isIgnoreBonus()) ? slot.action.getXp() : slot.action.getXp() * xpFactor; + SkillDataEntry action = slot.getAction(); + double xp = (action.isIgnoreBonus()) ? action.getXp() : action.getXp() * xpFactor; if (neededXP > 0) actionCount = (int) Math.ceil(neededXP / xp); - slot.setText("Lvl. " + slot.action.getLevel() + " (" + formatXPActionString(xp, actionCount, "exp) - ")); - slot.setAvailable(currentLevel >= slot.action.getLevel()); - slot.value = xp; + slot.setText("Lvl. " + action.getLevel() + " (" + formatXPActionString(xp, actionCount, "exp) - ")); + slot.setAvailable(currentLevel >= action.getLevel()); + slot.setValue((int) xp); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UIActionSlot.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UIActionSlot.java index 640afa5af5..8a33d709cf 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UIActionSlot.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UIActionSlot.java @@ -39,6 +39,9 @@ import javax.swing.JPanel; import javax.swing.border.Border; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; +import lombok.AccessLevel; +import lombok.Getter; +import lombok.Setter; import net.runelite.client.plugins.skillcalculator.beans.SkillDataEntry; import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.FontManager; @@ -54,15 +57,27 @@ class UIActionSlot extends JPanel BorderFactory.createMatteBorder(0, 4, 0, 0, (ColorScheme.PROGRESS_ERROR_COLOR).darker()), BorderFactory.createEmptyBorder(7, 12, 7, 7)); - SkillDataEntry action; - private JShadowedLabel uiLabelActions; + private static final Border ORANGE_BORDER = new CompoundBorder( + BorderFactory.createMatteBorder(0, 4, 0, 0, (ColorScheme.PROGRESS_INPROGRESS_COLOR).darker()), + BorderFactory.createEmptyBorder(7, 12, 7, 7)); + private static final Dimension ICON_SIZE = new Dimension(32, 32); + + @Getter(AccessLevel.PACKAGE) + private final SkillDataEntry action; + private final JShadowedLabel uiLabelActions; + private final JPanel uiInfo; - boolean isAvailable = false; - boolean isSelected = false; + @Getter(AccessLevel.PACKAGE) + private boolean isAvailable; - double value = 0; + @Getter(AccessLevel.PACKAGE) + private boolean isSelected; + + @Getter(AccessLevel.PACKAGE) + @Setter(AccessLevel.PACKAGE) + private int value = 0; UIActionSlot(SkillDataEntry action) { @@ -128,13 +143,13 @@ class UIActionSlot extends JPanel void setSelected(boolean selected) { isSelected = selected; - updateBackground(); + this.updateBackground(); } void setAvailable(boolean available) { isAvailable = available; - updateBackground(); + this.updateBackground(); } void setText(String text) @@ -144,8 +159,16 @@ class UIActionSlot extends JPanel private void updateBackground() { - setBorder(isAvailable ? GREEN_BORDER : RED_BORDER); - setBackground(isSelected ? ColorScheme.DARKER_GRAY_HOVER_COLOR.brighter() : ColorScheme.DARKER_GRAY_COLOR); + if (isAvailable) + { + this.setBorder(GREEN_BORDER); + } + else + { + this.setBorder(RED_BORDER); + } + + setBackground(this.isSelected() ? ColorScheme.DARKER_GRAY_HOVER_COLOR.brighter() : ColorScheme.DARKER_GRAY_COLOR); } @Override From 88474c102eaec8d96096a8d58e6b0fbe90b959d0 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 27 May 2018 16:36:28 -0400 Subject: [PATCH 3/3] skill calculator: turn indicators orange for actions that will become available before target --- .../plugins/skillcalculator/SkillCalculator.java | 1 + .../plugins/skillcalculator/UIActionSlot.java | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java index 8e6a864d14..5c750685b4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/SkillCalculator.java @@ -246,6 +246,7 @@ class SkillCalculator extends JPanel slot.setText("Lvl. " + action.getLevel() + " (" + formatXPActionString(xp, actionCount, "exp) - ")); slot.setAvailable(currentLevel >= action.getLevel()); + slot.setOverlapping(action.getLevel() < targetLevel); slot.setValue((int) xp); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UIActionSlot.java b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UIActionSlot.java index 8a33d709cf..4c4dac32cd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UIActionSlot.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/skillcalculator/UIActionSlot.java @@ -75,6 +75,9 @@ class UIActionSlot extends JPanel @Getter(AccessLevel.PACKAGE) private boolean isSelected; + @Getter(AccessLevel.PACKAGE) + private boolean isOverlapping; + @Getter(AccessLevel.PACKAGE) @Setter(AccessLevel.PACKAGE) private int value = 0; @@ -152,6 +155,12 @@ class UIActionSlot extends JPanel this.updateBackground(); } + void setOverlapping(boolean overlapping) + { + isOverlapping = overlapping; + this.updateBackground(); + } + void setText(String text) { uiLabelActions.setText(text); @@ -163,6 +172,10 @@ class UIActionSlot extends JPanel { this.setBorder(GREEN_BORDER); } + else if (isOverlapping) + { + this.setBorder(ORANGE_BORDER); + } else { this.setBorder(RED_BORDER);