Make special attack orb look a little nicer

This commit is contained in:
UniquePassive
2017-12-17 02:25:36 +01:00
parent 270ed11d1a
commit 044502da78
7 changed files with 67 additions and 10 deletions

View File

@@ -50,8 +50,12 @@ public interface Widget
int getRelativeX();
void setRelativeX(int x);
int getRelativeY();
void setRelativeY(int y);
String getText();
void setText(String text);

View File

@@ -136,7 +136,9 @@ class WidgetID
static class Minimap
{
static final int XP_ORB = 1;
static final int QUICK_PRAYER_ORB = 14;
static final int PRAYER_ORB = 12;
static final int QUICK_PRAYER_ORB = 14; // Has the "Quick-prayers" name
static final int RUN_ORB = 20;
}
static class Viewport

View File

@@ -88,6 +88,8 @@ public enum WidgetInfo
SHOP_INVENTORY_ITEMS_CONTAINER(WidgetID.SHOP_INVENTORY_GROUP_ID, WidgetID.Shop.INVENTORY_ITEM_CONTAINER),
MINIMAP_XP_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.XP_ORB),
MINIMAP_PRAYER_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.PRAYER_ORB),
MINIMAP_RUN_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.RUN_ORB),
LOGIN_CLICK_TO_PLAY_SCREEN(WidgetID.LOGIN_CLICK_TO_PLAY_GROUP_ID, 0),

View File

@@ -44,8 +44,8 @@ public class SpecOrbOverlay extends Overlay
{
private static final int RECHARGE_TIME_TICKS = 51;
private static final int ORB_X_OFFSET = 60;
private static final int ORB_Y_OFFSET = 123;
private static final int ORB_X_OFFSET = 33;
private static final int ORB_Y_OFFSET = 25;
private static final Color SPECIAL_ORB_BACKGROUND_COLOR = new Color(51, 102, 255);
private static final Color SPECIAL_ORB_RECHARGE_COLOR = new Color(153, 204, 255, 50);
@@ -72,19 +72,60 @@ public class SpecOrbOverlay extends Overlay
return null;
}
Widget xpOrb = client.getWidget(WidgetInfo.MINIMAP_XP_ORB);
if (xpOrb == null)
Widget prayerOrb = client.getWidget(WidgetInfo.MINIMAP_PRAYER_ORB);
if (prayerOrb == null)
{
return null;
}
Widget runOrb = client.getWidget(WidgetInfo.MINIMAP_RUN_ORB);
if (runOrb == null)
{
return null;
}
if (client.isResized())
{
if (prayerOrb.getRelativeY() != 73)
{
prayerOrb.setRelativeY(73);
}
if (runOrb.getRelativeX() != 12)
{
runOrb.setRelativeX(12);
}
if (runOrb.getRelativeY() != 108)
{
runOrb.setRelativeY(108);
}
}
else
{
if (prayerOrb.getRelativeY() != 71)
{
prayerOrb.setRelativeY(71);
}
if (runOrb.getRelativeX() != 12)
{
runOrb.setRelativeX(12);
}
if (runOrb.getRelativeY() != 103)
{
runOrb.setRelativeY(103);
}
}
graphics.setColor(SPECIAL_ORB_BACKGROUND_COLOR);
boolean specialAttackEnabled = client.getSetting(Varbits.SPECIAL_ATTACK_ENABLED) == 1;
// draw relative to the xp orb
Point xpOrbPoint = xpOrb.getCanvasLocation();
Point specOrbPoint = new Point(xpOrbPoint.getX() + ORB_X_OFFSET, xpOrbPoint.getY() + ORB_Y_OFFSET);
// draw relative to run orb
Point runOrbPoint = runOrb.getCanvasLocation();
Point specOrbPoint = new Point(runOrbPoint.getX() + ORB_X_OFFSET, runOrbPoint.getY() + ORB_Y_OFFSET);
double specialPercent = client.getSetting(Varbits.SPECIAL_ATTACK_PERCENT) / 1000.0;
double specialRechargePercent = tickCounter / (double) RECHARGE_TIME_TICKS;

View File

@@ -94,7 +94,7 @@ public class OverlayUtil
// draw background
graphics.drawImage(minimapOrbBackground, pos.getX(), pos.getY(), null);
// draw overlay
graphics.drawImage(overlayImage, pos.getX() + 32, pos.getY() + 9, null);
graphics.drawImage(overlayImage, pos.getX() + 33, pos.getY() + 10, null);
drawOrbAmount(graphics, pos, amount);//draw number on orb
@@ -117,7 +117,7 @@ public class OverlayUtil
FontMetrics fm = graphics.getFontMetrics();
String numberString = Integer.toString(amount);
Point numberPos = new Point(pos.getX() + 22 - fm.stringWidth(numberString), pos.getY() + 26);
Point numberPos = new Point(pos.getX() + 24 - fm.stringWidth(numberString), pos.getY() + 27);
graphics.setColor(Color.black);
graphics.drawString(numberString, numberPos.getX() + 1, numberPos.getY() + 1);//black shadow on text
graphics.setColor(Color.green);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@@ -82,10 +82,18 @@ public interface RSWidget extends Widget
@Override
int getRelativeX();
@Import("relativeX")
@Override
void setRelativeX(int x);
@Import("relativeY")
@Override
int getRelativeY();
@Import("relativeY")
@Override
void setRelativeY(int y);
@Import("width")
@Override
int getWidth();