fix xp globe drawing on start screen and only draw once actual xp gained not logon events
This commit is contained in:
@@ -38,13 +38,12 @@ public class XpGlobe
|
|||||||
private Instant time;
|
private Instant time;
|
||||||
private double skillProgressRadius;
|
private double skillProgressRadius;
|
||||||
|
|
||||||
public XpGlobe(Skill skill, int currentXp, int currentLevel, int goalXp, Instant time)
|
public XpGlobe(Skill skill, int currentXp, int currentLevel, int goalXp)
|
||||||
{
|
{
|
||||||
this.skill = skill;
|
this.skill = skill;
|
||||||
this.currentXp = currentXp;
|
this.currentXp = currentXp;
|
||||||
this.currentLevel = currentLevel;
|
this.currentLevel = currentLevel;
|
||||||
this.goalXp = goalXp;
|
this.goalXp = goalXp;
|
||||||
this.time = time;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Skill getSkill()
|
public Skill getSkill()
|
||||||
|
|||||||
@@ -105,13 +105,14 @@ public class XpGlobes extends Plugin
|
|||||||
cachedGlobe.setGoalXp(goalXp);
|
cachedGlobe.setGoalXp(goalXp);
|
||||||
cachedGlobe.setTime(Instant.now());
|
cachedGlobe.setTime(Instant.now());
|
||||||
cachedGlobe.setSkillProgressRadius(startingXp, currentXp, goalXp);
|
cachedGlobe.setSkillProgressRadius(startingXp, currentXp, goalXp);
|
||||||
|
|
||||||
|
this.addXpGlobe(globeCache[skillIdx], MAXIMUM_SHOWN_GLOBES);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
globeCache[skillIdx] = new XpGlobe(skill, currentXp, currentLevel, goalXp, Instant.now());
|
//dont draw non cached globes, this is triggered on login to setup all of the initial values
|
||||||
|
globeCache[skillIdx] = new XpGlobe(skill, currentXp, currentLevel, goalXp);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.addXpGlobe(globeCache[skillIdx], MAXIMUM_SHOWN_GLOBES);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<XpGlobe> getXpGlobes()
|
public List<XpGlobe> getXpGlobes()
|
||||||
|
|||||||
@@ -84,20 +84,20 @@ public class XpGlobesOverlay extends Overlay
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//check the width of the client if we can draw properly
|
||||||
|
int clientWidth = client.isResized() ? client.getClientWidth() : client.getViewportHeight();
|
||||||
|
if (clientWidth <= 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
int queueSize = plugin.getXpGlobesSize();
|
int queueSize = plugin.getXpGlobesSize();
|
||||||
if (queueSize > 0)
|
if (queueSize > 0)
|
||||||
{
|
{
|
||||||
List<XpGlobe> xpChangedQueue = plugin.getXpGlobes();
|
List<XpGlobe> xpChangedQueue = plugin.getXpGlobes();
|
||||||
int markersLength = (queueSize * (DEFAULT_CIRCLE_WIDTH)) + ((MINIMUM_STEP_WIDTH - DEFAULT_CIRCLE_WIDTH) * (queueSize - 1));
|
int markersLength = (queueSize * (DEFAULT_CIRCLE_WIDTH)) + ((MINIMUM_STEP_WIDTH - DEFAULT_CIRCLE_WIDTH) * (queueSize - 1));
|
||||||
int startDrawX;
|
int startDrawX = (clientWidth - markersLength) / 2;
|
||||||
if (client.isResized())
|
|
||||||
{
|
|
||||||
startDrawX = (client.getClientWidth() - markersLength) / 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
startDrawX = (client.getViewportHeight() - markersLength) / 2;
|
|
||||||
}
|
|
||||||
for (XpGlobe xpGlobe : xpChangedQueue)
|
for (XpGlobe xpGlobe : xpChangedQueue)
|
||||||
{
|
{
|
||||||
renderProgressCircle(graphics, xpGlobe, startDrawX, DEFAULT_START_Y);
|
renderProgressCircle(graphics, xpGlobe, startDrawX, DEFAULT_START_Y);
|
||||||
|
|||||||
Reference in New Issue
Block a user