public static bool DrawHealthBar(NPC npc, ref float scale)
{
Vector2 position = new Vector2(npc.position.X + npc.width / 2, npc.position.Y + npc.gfxOffY);
if (Main.HealthBarDrawSettings == 1)
{
position.Y += npc.height + 10f + Main.NPCAddHeight(npc.whoAmI);
}
else if (Main.HealthBarDrawSettings == 2)
{
position.Y -= 24f + Main.NPCAddHeight(npc.whoAmI) / 2f;
}
foreach (var hook in HookDrawHealthBar)
{
bool? result = hook(npc, Main.HealthBarDrawSettings, ref scale, ref position);
if (result.HasValue)
{
if (result.Value)
{
DrawHealthBar(npc, position, scale);
}
return false;
}
}
if (NPCLoader.IsModNPC(npc))
{
bool? result = npc.modNPC.DrawHealthBar(Main.HealthBarDrawSettings, ref scale, ref position);
if (result.HasValue)
{
if (result.Value)
{
DrawHealthBar(npc, position, scale);
}
return false;
}
}
return true;
}