Fix drawing over click to play interface
* fix xp globe drawing on start screen and only draw once actual xp gained not logon events * only draw fps when we have an x value for the xp orb
This commit is contained in:
@@ -31,6 +31,7 @@ class WidgetID
|
|||||||
static final int PESTRCONTROL_GROUP_ID = 408;
|
static final int PESTRCONTROL_GROUP_ID = 408;
|
||||||
static final int CLAN_CHAT_GROUP_ID = 7;
|
static final int CLAN_CHAT_GROUP_ID = 7;
|
||||||
static final int MINIMAP_GROUP_ID = 160;
|
static final int MINIMAP_GROUP_ID = 160;
|
||||||
|
static final int LOGIN_CLICK_TO_PLAY_GROUP_ID = 378;
|
||||||
|
|
||||||
static class PestControl
|
static class PestControl
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,7 +49,9 @@ public enum WidgetInfo
|
|||||||
|
|
||||||
BANK_ITEM_CONTAINER(WidgetID.BANK_GROUP_ID, WidgetID.Bank.ITEM_CONTAINER),
|
BANK_ITEM_CONTAINER(WidgetID.BANK_GROUP_ID, WidgetID.Bank.ITEM_CONTAINER),
|
||||||
|
|
||||||
MINIMAP_XP_ORG(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.XP_ORB);
|
MINIMAP_XP_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.XP_ORB),
|
||||||
|
|
||||||
|
LOGIN_CLICK_TO_PLAY_SCREEN(WidgetID.LOGIN_CLICK_TO_PLAY_GROUP_ID, 0);
|
||||||
|
|
||||||
|
|
||||||
private final int groupId;
|
private final int groupId;
|
||||||
|
|||||||
@@ -68,13 +68,17 @@ public class FPSOverlay extends Overlay
|
|||||||
FontMetrics fm = graphics.getFontMetrics();
|
FontMetrics fm = graphics.getFontMetrics();
|
||||||
String str = String.valueOf(client.getFPS());
|
String str = String.valueOf(client.getFPS());
|
||||||
|
|
||||||
Widget xpOrb = client.getWidget(WidgetInfo.MINIMAP_XP_ORG);
|
Widget xpOrb = client.getWidget(WidgetInfo.MINIMAP_XP_ORB);
|
||||||
if (xpOrb == null)
|
if (xpOrb == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle2D bounds = xpOrb.getBounds().getBounds2D();
|
Rectangle2D bounds = xpOrb.getBounds().getBounds2D();
|
||||||
|
if (bounds.getX() <= 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
int x = (int) (bounds.getX() + ((bounds.getWidth() / 2) - (fm.stringWidth(str) / 2)));
|
int x = (int) (bounds.getX() + ((bounds.getWidth() / 2) - (fm.stringWidth(str) / 2)));
|
||||||
int y = (int) (bounds.getY() - (fm.getHeight() / 2));
|
int y = (int) (bounds.getY() - (fm.getHeight() / 2));
|
||||||
|
|||||||
@@ -96,6 +96,12 @@ public class GroundItemsOverlay extends Overlay
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if the player is logged in but viewing the click to play screen exit
|
||||||
|
if (client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN) != null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
//Widget bank = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER);
|
//Widget bank = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER);
|
||||||
//if (bank != null && !bank.isHidden())
|
//if (bank != null && !bank.isHidden())
|
||||||
//{
|
//{
|
||||||
|
|||||||
@@ -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