xp drop plugin: Move text to use hidden icon's space

Closes runelite/runelite#2265
This commit is contained in:
Jordan Atwood
2018-07-05 15:57:16 -07:00
parent 54cce8209e
commit 817a7dd871
2 changed files with 19 additions and 3 deletions

View File

@@ -220,6 +220,11 @@ public enum Varbits
/**
* Experience tracker
*
* EXPERIENCE_TRACKER_POSITION expected values:
* 0 = Right
* 1 = Middle
* 2 = Left
*/
EXPERIENCE_TRACKER_POSITION(4692),
EXPERIENCE_TRACKER_COUNTER(4697),

View File

@@ -47,6 +47,8 @@ import net.runelite.client.plugins.PluginDescriptor;
)
public class XpDropPlugin extends Plugin
{
private static final int EXPERIENCE_DROP_SPRITE_WIDTH = 16;
@Inject
private Client client;
@@ -76,10 +78,19 @@ public class XpDropPlugin extends Plugin
return;
}
if (config.hideSkillIcons() && widget.getSpriteId() > 0)
if (config.hideSkillIcons())
{
widget.setHidden(true);
return;
if (widget.getSpriteId() > 0)
{
widget.setHidden(true);
return;
}
else if (!widget.getText().isEmpty())
{
// Align text left accordingly to take up hidden skill icon space
final int xpDropPosition = client.getVar(Varbits.EXPERIENCE_TRACKER_POSITION);
widget.setRelativeX(EXPERIENCE_DROP_SPRITE_WIDTH * xpDropPosition * -1 / 2);
}
}
PrayerType prayer = getActivePrayerType();