skill calculator: use accessors
This commit is contained in:
@@ -172,12 +172,12 @@ class SkillCalculator extends JPanel
|
||||
|
||||
private void renderBonusOptions()
|
||||
{
|
||||
if (skillData.bonuses != null)
|
||||
if (skillData.getBonuses() != null)
|
||||
{
|
||||
for (SkillDataBonus bonus : skillData.bonuses)
|
||||
for (SkillDataBonus bonus : skillData.getBonuses())
|
||||
{
|
||||
JPanel uiOption = new JPanel(new BorderLayout());
|
||||
JLabel uiLabel = new JLabel(bonus.name);
|
||||
JLabel uiLabel = new JLabel(bonus.getName());
|
||||
JCheckBox uiCheckbox = new JCheckBox();
|
||||
|
||||
uiLabel.setForeground(Color.WHITE);
|
||||
@@ -187,7 +187,7 @@ class SkillCalculator extends JPanel
|
||||
uiOption.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
|
||||
// Adjust XP bonus depending on check-state of the boxes.
|
||||
uiCheckbox.addActionListener(e -> adjustXPBonus(uiCheckbox.isSelected(), bonus.value));
|
||||
uiCheckbox.addActionListener(e -> adjustXPBonus(uiCheckbox.isSelected(), bonus.getValue()));
|
||||
uiCheckbox.setBackground(ColorScheme.MEDIUM_GRAY_COLOR);
|
||||
|
||||
uiOption.add(uiLabel, BorderLayout.WEST);
|
||||
@@ -205,7 +205,7 @@ class SkillCalculator extends JPanel
|
||||
uiActionSlots.clear();
|
||||
|
||||
// Create new components for the action slots.
|
||||
for (SkillDataEntry action : skillData.actions)
|
||||
for (SkillDataEntry action : skillData.getActions())
|
||||
{
|
||||
UIActionSlot slot = new UIActionSlot(action);
|
||||
uiActionSlots.add(slot); // Keep our own reference.
|
||||
@@ -243,13 +243,13 @@ class SkillCalculator extends JPanel
|
||||
{
|
||||
int actionCount = 0;
|
||||
int neededXP = targetXP - currentXP;
|
||||
double xp = slot.action.xp * xpFactor;
|
||||
double xp = slot.action.getXp() * xpFactor;
|
||||
|
||||
if (neededXP > 0)
|
||||
actionCount = (int) Math.ceil(neededXP / xp);
|
||||
|
||||
slot.setText("Lvl. " + slot.action.level + " (" + formatXPActionString(xp, actionCount, "exp) - "));
|
||||
slot.setAvailable(currentLevel >= slot.action.level);
|
||||
slot.setText("Lvl. " + slot.action.getLevel() + " (" + formatXPActionString(xp, actionCount, "exp) - "));
|
||||
slot.setAvailable(currentLevel >= slot.action.getLevel());
|
||||
slot.value = xp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,10 +97,10 @@ class UIActionSlot extends JPanel
|
||||
|
||||
JLabel uiIcon = new JLabel();
|
||||
|
||||
if (action.icon != null)
|
||||
SkillCalculator.itemManager.getImage(action.icon).addTo(uiIcon);
|
||||
else if (action.sprite != null)
|
||||
SkillCalculator.spriteManager.addSpriteTo(uiIcon, action.sprite, 0);
|
||||
if (action.getIcon() != null)
|
||||
SkillCalculator.itemManager.getImage(action.getIcon()).addTo(uiIcon);
|
||||
else if (action.getSprite() != null)
|
||||
SkillCalculator.spriteManager.addSpriteTo(uiIcon, action.getSprite(), 0);
|
||||
|
||||
uiIcon.setMinimumSize(ICON_SIZE);
|
||||
uiIcon.setMaximumSize(ICON_SIZE);
|
||||
@@ -111,7 +111,7 @@ class UIActionSlot extends JPanel
|
||||
uiInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
uiInfo.setBorder(new EmptyBorder(0, 5, 0, 0));
|
||||
|
||||
JShadowedLabel uiLabelName = new JShadowedLabel(action.name);
|
||||
JShadowedLabel uiLabelName = new JShadowedLabel(action.getName());
|
||||
uiLabelName.setForeground(Color.WHITE);
|
||||
|
||||
uiLabelActions = new JShadowedLabel("Unknown");
|
||||
|
||||
@@ -24,8 +24,11 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.skillcalculator.beans;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class SkillData
|
||||
{
|
||||
public SkillDataEntry[] actions;
|
||||
public SkillDataBonus[] bonuses;
|
||||
private SkillDataEntry[] actions;
|
||||
private SkillDataBonus[] bonuses;
|
||||
}
|
||||
@@ -24,8 +24,11 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.skillcalculator.beans;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class SkillDataBonus
|
||||
{
|
||||
public String name;
|
||||
public float value;
|
||||
private String name;
|
||||
private float value;
|
||||
}
|
||||
@@ -24,11 +24,14 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.skillcalculator.beans;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class SkillDataEntry
|
||||
{
|
||||
public String name;
|
||||
public int level;
|
||||
public double xp;
|
||||
public Integer icon;
|
||||
public Integer sprite;
|
||||
private String name;
|
||||
private int level;
|
||||
private double xp;
|
||||
private Integer icon;
|
||||
private Integer sprite;
|
||||
}
|
||||
Reference in New Issue
Block a user