Merge pull request #9113 from Hydrox6/interface-styles-hd-healthbar-fix
interface styles: fix HD Healthbar
@@ -1503,14 +1503,6 @@ public interface Client extends GameEngine
|
|||||||
*/
|
*/
|
||||||
NodeCache getWidgetSpriteCache();
|
NodeCache getWidgetSpriteCache();
|
||||||
|
|
||||||
/**
|
|
||||||
* Overrides health bar sprites with the sprites from the specified override.
|
|
||||||
* Pass in {@code null} to revert the health bars back to their default.
|
|
||||||
*
|
|
||||||
* @param override the health bar override
|
|
||||||
*/
|
|
||||||
void setHealthBarOverride(HealthBarOverride override);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the current server tick count.
|
* Gets the current server tick count.
|
||||||
*
|
*
|
||||||
@@ -1639,5 +1631,5 @@ public interface Client extends GameEngine
|
|||||||
|
|
||||||
void draw2010Menu();
|
void draw2010Menu();
|
||||||
|
|
||||||
NodeCache getHealthBarCache();
|
void resetHealthBarCaches();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,5 +30,7 @@ public interface HealthBar
|
|||||||
|
|
||||||
SpritePixels getHealthBarBackSprite();
|
SpritePixels getHealthBarBackSprite();
|
||||||
|
|
||||||
|
int getHealthBarFrontSpriteId();
|
||||||
|
|
||||||
void setPadding(int padding);
|
void setPadding(int padding);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019, Lotto <https://github.com/devLotto>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
*
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package net.runelite.api;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class HealthBarOverride
|
|
||||||
{
|
|
||||||
public final SpritePixels frontSprite;
|
|
||||||
public final SpritePixels backSprite;
|
|
||||||
public final SpritePixels frontSpriteLarge;
|
|
||||||
public final SpritePixels backSpriteLarge;
|
|
||||||
}
|
|
||||||
@@ -1564,6 +1564,25 @@ public final class SpriteID
|
|||||||
public static final int MOBILE_FUNCTION_MODE_DISABLED = 1624;
|
public static final int MOBILE_FUNCTION_MODE_DISABLED = 1624;
|
||||||
public static final int MOBILE_YELLOW_TOUCH_ANIMATION_1 = 1625;
|
public static final int MOBILE_YELLOW_TOUCH_ANIMATION_1 = 1625;
|
||||||
public static final int MOBILE_YELLOW_TOUCH_ANIMATION_2 = 1626;
|
public static final int MOBILE_YELLOW_TOUCH_ANIMATION_2 = 1626;
|
||||||
|
/* Unmapped: 1627~1707 */
|
||||||
public static final int TAB_MAGIC_SPELLBOOK_ARCEUUS_UNUSED = 1708;
|
public static final int TAB_MAGIC_SPELLBOOK_ARCEUUS_UNUSED = 1708;
|
||||||
|
/* Unmapped: 1709, 1710 */
|
||||||
public static final int TAB_MAGIC_SPELLBOOK_ARCEUUS = 1711;
|
public static final int TAB_MAGIC_SPELLBOOK_ARCEUUS = 1711;
|
||||||
|
/* Unmapped: 1712~2175 */
|
||||||
|
public static final int HEALTHBAR_DEFAULT_FRONT_30PX = 2176;
|
||||||
|
public static final int HEALTHBAR_DEFAULT_BACK_30PX = 2177;
|
||||||
|
public static final int HEALTHBAR_DEFAULT_FRONT_50PX = 2178;
|
||||||
|
public static final int HEALTHBAR_DEFAULT_BACK_50PX = 2179;
|
||||||
|
public static final int HEALTHBAR_DEFAULT_FRONT_60PX = 2180;
|
||||||
|
public static final int HEALTHBAR_DEFAULT_BACK_60PX = 2181;
|
||||||
|
public static final int HEALTHBAR_DEFAULT_FRONT_80PX = 2182;
|
||||||
|
public static final int HEALTHBAR_DEFAULT_BACK_80PX = 2183;
|
||||||
|
public static final int HEALTHBAR_DEFAULT_FRONT_100PX = 2184;
|
||||||
|
public static final int HEALTHBAR_DEFAULT_BACK_100PX = 2185;
|
||||||
|
public static final int HEALTHBAR_DEFAULT_FRONT_120PX = 2186;
|
||||||
|
public static final int HEALTHBAR_DEFAULT_BACK_120PX = 2187;
|
||||||
|
public static final int HEALTHBAR_DEFAULT_FRONT_140PX = 2188;
|
||||||
|
public static final int HEALTHBAR_DEFAULT_BACK_140PX = 2189;
|
||||||
|
public static final int HEALTHBAR_DEFAULT_FRONT_160PX = 2190;
|
||||||
|
public static final int HEALTHBAR_DEFAULT_BACK_160PX = 2191;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019 Hydrox6 <ikada@protonmail.ch>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.client.plugins.interfacestyles;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import static net.runelite.api.SpriteID.*;
|
||||||
|
import net.runelite.client.game.SpriteOverride;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
enum HealthbarOverride implements SpriteOverride
|
||||||
|
{
|
||||||
|
BACK_30PX(HEALTHBAR_DEFAULT_BACK_30PX, "back_30px.png"),
|
||||||
|
BACK_50PX(HEALTHBAR_DEFAULT_BACK_50PX, "back_30px.png"),
|
||||||
|
BACK_60PX(HEALTHBAR_DEFAULT_BACK_60PX, "back_30px.png"),
|
||||||
|
BACK_80PX(HEALTHBAR_DEFAULT_BACK_80PX, "back_90px.png"),
|
||||||
|
BACK_100PX(HEALTHBAR_DEFAULT_BACK_100PX, "back_90px.png"),
|
||||||
|
BACK_120PX(HEALTHBAR_DEFAULT_BACK_120PX, "back_90px.png"),
|
||||||
|
BACK_140PX(HEALTHBAR_DEFAULT_BACK_140PX, "back_90px.png"),
|
||||||
|
BACK_160PX(HEALTHBAR_DEFAULT_BACK_160PX, "back_90px.png"),
|
||||||
|
|
||||||
|
FRONT_30PX(HEALTHBAR_DEFAULT_FRONT_30PX, "front_30px.png"),
|
||||||
|
FRONT_50PX(HEALTHBAR_DEFAULT_FRONT_50PX, "front_30px.png"),
|
||||||
|
FRONT_60PX(HEALTHBAR_DEFAULT_FRONT_60PX, "front_30px.png"),
|
||||||
|
FRONT_80PX(HEALTHBAR_DEFAULT_FRONT_80PX, "front_90px.png"),
|
||||||
|
FRONT_100PX(HEALTHBAR_DEFAULT_FRONT_100PX, "front_90px.png"),
|
||||||
|
FRONT_120PX(HEALTHBAR_DEFAULT_FRONT_120PX, "front_90px.png"),
|
||||||
|
FRONT_140PX(HEALTHBAR_DEFAULT_FRONT_140PX, "front_90px.png"),
|
||||||
|
FRONT_160PX(HEALTHBAR_DEFAULT_FRONT_160PX, "front_90px.png");
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private final int spriteId;
|
||||||
|
|
||||||
|
private final String fileName;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private int padding = 1;
|
||||||
|
|
||||||
|
private static final Map<Integer, HealthbarOverride> MAP;
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
ImmutableMap.Builder<Integer, HealthbarOverride> builder = new ImmutableMap.Builder<>();
|
||||||
|
|
||||||
|
for (HealthbarOverride override : values())
|
||||||
|
{
|
||||||
|
builder.put(override.spriteId, override);
|
||||||
|
}
|
||||||
|
|
||||||
|
MAP = builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
static HealthbarOverride get(int spriteID)
|
||||||
|
{
|
||||||
|
return MAP.get(spriteID);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFileName()
|
||||||
|
{
|
||||||
|
return Skin.AROUND_2010.toString() + "/healthbar/" + this.fileName;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,8 +32,6 @@ import javax.inject.Inject;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.HealthBar;
|
import net.runelite.api.HealthBar;
|
||||||
import net.runelite.api.HealthBarOverride;
|
|
||||||
import net.runelite.api.NodeCache;
|
|
||||||
import net.runelite.api.SpriteID;
|
import net.runelite.api.SpriteID;
|
||||||
import net.runelite.api.SpritePixels;
|
import net.runelite.api.SpritePixels;
|
||||||
import net.runelite.api.events.BeforeMenuRender;
|
import net.runelite.api.events.BeforeMenuRender;
|
||||||
@@ -71,8 +69,6 @@ public class InterfaceStylesPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private SpriteManager spriteManager;
|
private SpriteManager spriteManager;
|
||||||
|
|
||||||
private HealthBarOverride healthBarOverride;
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
InterfaceStylesConfig provideConfig(ConfigManager configManager)
|
InterfaceStylesConfig provideConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
@@ -92,10 +88,7 @@ public class InterfaceStylesPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
restoreWidgetDimensions();
|
restoreWidgetDimensions();
|
||||||
removeGameframe();
|
removeGameframe();
|
||||||
healthBarOverride = null;
|
restoreHealthBars();
|
||||||
client.setHealthBarOverride(null);
|
|
||||||
NodeCache heathBarCache = client.getHealthBarCache();
|
|
||||||
heathBarCache.reset(); // invalidate healthbar cache so padding resets
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,19 +110,19 @@ public class InterfaceStylesPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onPostHealthBar(PostHealthBar postHealthBar)
|
public void onPostHealthBar(PostHealthBar postHealthBar)
|
||||||
{
|
{
|
||||||
if (healthBarOverride == null || !config.hdHealthBars())
|
if (!config.hdHealthBars())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
HealthBar healthBar = postHealthBar.getHealthBar();
|
HealthBar healthBar = postHealthBar.getHealthBar();
|
||||||
SpritePixels frontSprite = healthBar.getHealthBarFrontSprite();
|
HealthbarOverride override = HealthbarOverride.get(healthBar.getHealthBarFrontSpriteId());
|
||||||
|
|
||||||
// Check if this is the health bar we are replacing
|
// Check if this is the health bar we are replacing
|
||||||
if (frontSprite == healthBarOverride.getFrontSprite() || frontSprite == healthBarOverride.getFrontSpriteLarge())
|
if (override != null)
|
||||||
{
|
{
|
||||||
// Increase padding to show some more green at very low hp percentages
|
// Increase padding to show some more green at very low hp percentages
|
||||||
healthBar.setPadding(1);
|
healthBar.setPadding(override.getPadding());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -272,31 +265,24 @@ public class InterfaceStylesPlugin extends Plugin
|
|||||||
|
|
||||||
private void overrideHealthBars()
|
private void overrideHealthBars()
|
||||||
{
|
{
|
||||||
// Reset health bar cache to reset applied padding
|
|
||||||
NodeCache healthBarCache = client.getHealthBarCache();
|
|
||||||
healthBarCache.reset();
|
|
||||||
|
|
||||||
if (config.hdHealthBars())
|
if (config.hdHealthBars())
|
||||||
{
|
{
|
||||||
String fileBase = Skin.AROUND_2010.toString() + "/healthbar/";
|
spriteManager.addSpriteOverrides(HealthbarOverride.values());
|
||||||
|
// Reset health bar caches to apply the override
|
||||||
SpritePixels frontSprite = getFileSpritePixels(fileBase + "front.png");
|
clientThread.invokeLater(client::resetHealthBarCaches);
|
||||||
SpritePixels backSprite = getFileSpritePixels(fileBase + "back.png");
|
|
||||||
|
|
||||||
SpritePixels frontSpriteLarge = getFileSpritePixels(fileBase + "front_large.png");
|
|
||||||
SpritePixels backSpriteLarge = getFileSpritePixels(fileBase + "back_large.png");
|
|
||||||
|
|
||||||
HealthBarOverride override = new HealthBarOverride(frontSprite, backSprite, frontSpriteLarge, backSpriteLarge);
|
|
||||||
healthBarOverride = override;
|
|
||||||
client.setHealthBarOverride(override);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
healthBarOverride = null;
|
restoreHealthBars();
|
||||||
client.setHealthBarOverride(null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void restoreHealthBars()
|
||||||
|
{
|
||||||
|
spriteManager.removeSpriteOverrides(HealthbarOverride.values());
|
||||||
|
clientThread.invokeLater(client::resetHealthBarCaches);
|
||||||
|
}
|
||||||
|
|
||||||
private void restoreWidgetDimensions()
|
private void restoreWidgetDimensions()
|
||||||
{
|
{
|
||||||
for (WidgetOffset widgetOffset : WidgetOffset.values())
|
for (WidgetOffset widgetOffset : WidgetOffset.values())
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 280 B After Width: | Height: | Size: 280 B |
|
Before Width: | Height: | Size: 305 B After Width: | Height: | Size: 305 B |
|
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 371 B |
|
Before Width: | Height: | Size: 444 B After Width: | Height: | Size: 444 B |
@@ -42,7 +42,6 @@ import net.runelite.api.GameState;
|
|||||||
import net.runelite.api.GrandExchangeOffer;
|
import net.runelite.api.GrandExchangeOffer;
|
||||||
import net.runelite.api.GraphicsObject;
|
import net.runelite.api.GraphicsObject;
|
||||||
import net.runelite.api.HashTable;
|
import net.runelite.api.HashTable;
|
||||||
import net.runelite.api.HealthBarOverride;
|
|
||||||
import net.runelite.api.HintArrowType;
|
import net.runelite.api.HintArrowType;
|
||||||
import net.runelite.api.Ignore;
|
import net.runelite.api.Ignore;
|
||||||
import net.runelite.api.IndexDataBase;
|
import net.runelite.api.IndexDataBase;
|
||||||
@@ -190,9 +189,6 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
.maximumSize(64)
|
.maximumSize(64)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@Inject
|
|
||||||
private static HealthBarOverride healthBarOverride;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public RSClientMixin()
|
public RSClientMixin()
|
||||||
{
|
{
|
||||||
@@ -1253,13 +1249,6 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
client.getCallbacks().post(new UsernameChanged());
|
client.getCallbacks().post(new UsernameChanged());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
|
||||||
@Override
|
|
||||||
public void setHealthBarOverride(HealthBarOverride override)
|
|
||||||
{
|
|
||||||
healthBarOverride = override;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Inject
|
@Inject
|
||||||
public int getTickCount()
|
public int getTickCount()
|
||||||
@@ -1550,4 +1539,12 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
enumCache.put(id, rsEnum);
|
enumCache.put(id, rsEnum);
|
||||||
return rsEnum;
|
return rsEnum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Override
|
||||||
|
public void resetHealthBarCaches()
|
||||||
|
{
|
||||||
|
getHealthBarCache().reset();
|
||||||
|
getHealthBarSpriteCache().reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -24,84 +24,21 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.mixins;
|
package net.runelite.mixins;
|
||||||
|
|
||||||
import net.runelite.api.HealthBarOverride;
|
|
||||||
import net.runelite.api.events.PostHealthBar;
|
import net.runelite.api.events.PostHealthBar;
|
||||||
import net.runelite.api.mixins.Copy;
|
|
||||||
import net.runelite.api.mixins.Inject;
|
import net.runelite.api.mixins.Inject;
|
||||||
import net.runelite.api.mixins.MethodHook;
|
import net.runelite.api.mixins.MethodHook;
|
||||||
import net.runelite.api.mixins.Mixin;
|
import net.runelite.api.mixins.Mixin;
|
||||||
import net.runelite.api.mixins.Replace;
|
|
||||||
import net.runelite.api.mixins.Shadow;
|
import net.runelite.api.mixins.Shadow;
|
||||||
import net.runelite.rs.api.RSBuffer;
|
import net.runelite.rs.api.RSBuffer;
|
||||||
import net.runelite.rs.api.RSClient;
|
import net.runelite.rs.api.RSClient;
|
||||||
import net.runelite.rs.api.RSHealthBar;
|
import net.runelite.rs.api.RSHealthBar;
|
||||||
import net.runelite.rs.api.RSSpritePixels;
|
|
||||||
|
|
||||||
@Mixin(RSHealthBar.class)
|
@Mixin(RSHealthBar.class)
|
||||||
public abstract class RSHealthBarMixin implements RSHealthBar
|
public abstract class RSHealthBarMixin implements RSHealthBar
|
||||||
{
|
{
|
||||||
// Larger values are used for bosses like Corporeal Beast
|
|
||||||
private static final int DEFAULT_HEALTH_SCALE = 30;
|
|
||||||
|
|
||||||
@Shadow("clientInstance")
|
@Shadow("clientInstance")
|
||||||
private static RSClient client;
|
private static RSClient client;
|
||||||
|
|
||||||
@Shadow("healthBarOverride")
|
|
||||||
private static HealthBarOverride healthBarOverride;
|
|
||||||
|
|
||||||
@Copy("getHealthBarBackSprite")
|
|
||||||
abstract RSSpritePixels rs$getHealthBarBackSprite();
|
|
||||||
|
|
||||||
@Replace("getHealthBarBackSprite")
|
|
||||||
public RSSpritePixels rl$getHealthBarBackSprite()
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* If this combat info already uses sprites for health bars,
|
|
||||||
* use those instead, and don't override.
|
|
||||||
*/
|
|
||||||
RSSpritePixels pixels = rs$getHealthBarBackSprite();
|
|
||||||
if (pixels != null)
|
|
||||||
{
|
|
||||||
return pixels;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (healthBarOverride == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return getHealthScale() == DEFAULT_HEALTH_SCALE
|
|
||||||
? (RSSpritePixels) healthBarOverride.backSprite
|
|
||||||
: (RSSpritePixels) healthBarOverride.backSpriteLarge;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Copy("getHealthBarFrontSprite")
|
|
||||||
abstract RSSpritePixels rs$getHealthBarFrontSprite();
|
|
||||||
|
|
||||||
@Replace("getHealthBarFrontSprite")
|
|
||||||
public RSSpritePixels rl$getHealthBarFrontSprite()
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* If this combat info already uses sprites for health bars,
|
|
||||||
* use those instead, and don't override.
|
|
||||||
*/
|
|
||||||
RSSpritePixels pixels = rs$getHealthBarFrontSprite();
|
|
||||||
if (pixels != null)
|
|
||||||
{
|
|
||||||
return pixels;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (healthBarOverride == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 30 is the default size, large is for bosses like Corporeal Beast
|
|
||||||
return getHealthScale() == DEFAULT_HEALTH_SCALE
|
|
||||||
? (RSSpritePixels) healthBarOverride.frontSprite
|
|
||||||
: (RSSpritePixels) healthBarOverride.frontSpriteLarge;
|
|
||||||
}
|
|
||||||
|
|
||||||
@MethodHook(value = "read", end = true)
|
@MethodHook(value = "read", end = true)
|
||||||
@Inject
|
@Inject
|
||||||
public void onRead(RSBuffer buffer)
|
public void onRead(RSBuffer buffer)
|
||||||
|
|||||||
@@ -982,6 +982,8 @@ public interface RSClient extends RSGameEngine, Client
|
|||||||
void RasterizerDrawCircle(int x, int y, int r, int rgb);
|
void RasterizerDrawCircle(int x, int y, int r, int rgb);
|
||||||
|
|
||||||
@Import("healthbarCache")
|
@Import("healthbarCache")
|
||||||
@Override
|
|
||||||
RSNodeCache getHealthBarCache();
|
RSNodeCache getHealthBarCache();
|
||||||
|
|
||||||
|
@Import("healthBarSpriteCache")
|
||||||
|
RSNodeCache getHealthBarSpriteCache();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,10 @@ public interface RSHealthBar extends RSCacheableNode, HealthBar
|
|||||||
@Import("healthScale")
|
@Import("healthScale")
|
||||||
int getHealthScale();
|
int getHealthScale();
|
||||||
|
|
||||||
|
@Import("healthBarFrontSpriteId")
|
||||||
|
@Override
|
||||||
|
int getHealthBarFrontSpriteId();
|
||||||
|
|
||||||
@Import("getHealthBarFrontSprite")
|
@Import("getHealthBarFrontSprite")
|
||||||
@Override
|
@Override
|
||||||
RSSpritePixels getHealthBarFrontSprite();
|
RSSpritePixels getHealthBarFrontSprite();
|
||||||
|
|||||||