Merge pull request #9980 from Nightfirecat/dont-show-boost-change-when-no-boosted-stats-shown
boosts: Hide restore timer when no boosts are visible
This commit is contained in:
@@ -87,11 +87,6 @@ public class BoostIndicator extends InfoBox
|
|||||||
@Override
|
@Override
|
||||||
public boolean render()
|
public boolean render()
|
||||||
{
|
{
|
||||||
if (config.displayInfoboxes() && plugin.canShowBoosts() && plugin.getShownSkills().contains(getSkill()))
|
return config.displayInfoboxes() && plugin.canShowBoosts() && plugin.getSkillsToDisplay().contains(getSkill());
|
||||||
{
|
|
||||||
return client.getBoostedSkillLevel(skill) != client.getRealSkillLevel(skill);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ package net.runelite.client.plugins.boosts;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.util.Set;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||||
@@ -89,18 +90,19 @@ class BoostsOverlay extends Overlay
|
|||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Set<Skill> boostedSkills = plugin.getSkillsToDisplay();
|
||||||
|
|
||||||
|
if (boostedSkills.isEmpty())
|
||||||
|
{
|
||||||
|
return panelComponent.render(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
if (plugin.canShowBoosts())
|
if (plugin.canShowBoosts())
|
||||||
{
|
{
|
||||||
for (Skill skill : plugin.getShownSkills())
|
for (Skill skill : boostedSkills)
|
||||||
{
|
{
|
||||||
final int boosted = client.getBoostedSkillLevel(skill);
|
final int boosted = client.getBoostedSkillLevel(skill);
|
||||||
final int base = client.getRealSkillLevel(skill);
|
final int base = client.getRealSkillLevel(skill);
|
||||||
|
|
||||||
if (boosted == base)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
final int boost = boosted - base;
|
final int boost = boosted - base;
|
||||||
final Color strColor = getTextColor(boost);
|
final Color strColor = getTextColor(boost);
|
||||||
String str;
|
String str;
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ package net.runelite.client.plugins.boosts;
|
|||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.EnumSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@@ -92,7 +92,9 @@ public class BoostsPlugin extends Plugin
|
|||||||
private SkillIconManager skillIconManager;
|
private SkillIconManager skillIconManager;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final Set<Skill> shownSkills = new HashSet<>();
|
private final Set<Skill> skillsToDisplay = EnumSet.noneOf(Skill.class);
|
||||||
|
|
||||||
|
private final Set<Skill> shownSkills = EnumSet.noneOf(Skill.class);
|
||||||
|
|
||||||
private boolean isChangedDown = false;
|
private boolean isChangedDown = false;
|
||||||
private boolean isChangedUp = false;
|
private boolean isChangedUp = false;
|
||||||
@@ -114,7 +116,6 @@ public class BoostsPlugin extends Plugin
|
|||||||
overlayManager.add(boostsOverlay);
|
overlayManager.add(boostsOverlay);
|
||||||
|
|
||||||
updateShownSkills();
|
updateShownSkills();
|
||||||
updateBoostedStats();
|
|
||||||
Arrays.fill(lastSkillLevels, -1);
|
Arrays.fill(lastSkillLevels, -1);
|
||||||
|
|
||||||
// Add infoboxes for everything at startup and then determine inside if it will be rendered
|
// Add infoboxes for everything at startup and then determine inside if it will be rendered
|
||||||
@@ -140,6 +141,7 @@ public class BoostsPlugin extends Plugin
|
|||||||
lastChangeUp = -1;
|
lastChangeUp = -1;
|
||||||
isChangedUp = false;
|
isChangedUp = false;
|
||||||
isChangedDown = false;
|
isChangedDown = false;
|
||||||
|
skillsToDisplay.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -282,6 +284,7 @@ public class BoostsPlugin extends Plugin
|
|||||||
shownSkills.addAll(BOOSTABLE_NON_COMBAT_SKILLS);
|
shownSkills.addAll(BOOSTABLE_NON_COMBAT_SKILLS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
updateBoostedStats();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBoostedStats()
|
private void updateBoostedStats()
|
||||||
@@ -289,11 +292,12 @@ public class BoostsPlugin extends Plugin
|
|||||||
// Reset is boosted
|
// Reset is boosted
|
||||||
isChangedDown = false;
|
isChangedDown = false;
|
||||||
isChangedUp = false;
|
isChangedUp = false;
|
||||||
|
skillsToDisplay.clear();
|
||||||
|
|
||||||
// Check if we are still boosted
|
// Check if we are still boosted
|
||||||
for (final Skill skill : Skill.values())
|
for (final Skill skill : Skill.values())
|
||||||
{
|
{
|
||||||
if (!BOOSTABLE_COMBAT_SKILLS.contains(skill) && !BOOSTABLE_NON_COMBAT_SKILLS.contains(skill))
|
if (!shownSkills.contains(skill))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -309,6 +313,11 @@ public class BoostsPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
isChangedDown = true;
|
isChangedDown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (boosted != base)
|
||||||
|
{
|
||||||
|
skillsToDisplay.add(skill);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user