using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using NineSolsAPI;
using RCGMaker.Core;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HPNumbers")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Shows Yi's and Boss' HP numbers")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: AssemblyInformationalVersion("2.0.0+76ac5abfa7a0e13a3a377521b4658eca8157be75")]
[assembly: AssemblyProduct("HPNumbers")]
[assembly: AssemblyTitle("HPNumbers")]
[assembly: AssemblyVersion("2.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace HPNumbers
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("HPNumbers", "HPNumbers", "2.0.0")]
public class HPNumbers : BaseUnityPlugin
{
private float YiHealth;
private float YiInternalHealth;
private TMP_Text hpNumber;
private TMP_Text internalHpNumber;
private MonsterBase monster;
private TMP_Text bossHPNumber;
private float bossHealth;
private TMP_Text bossInternalHPNumber;
private float bossInternalHealth;
private ConfigEntry<Vector2> yiHPPos;
private ConfigEntry<int> yiHPFontSize;
private ConfigEntry<Color> yiHPColor;
private ConfigEntry<Vector2> yiInternalHPPos;
private ConfigEntry<int> yiInternalHPFontSize;
private ConfigEntry<Color> yiInternalHPColor;
private ConfigEntry<Vector2> bossHPPos;
private ConfigEntry<int> bossHPFontSize;
private ConfigEntry<Color> bossHPColor;
private ConfigEntry<Vector2> bossInternalPos;
private ConfigEntry<int> bossInternalHPFontSize;
private ConfigEntry<Color> bossInternalHPColor;
private void Awake()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_0351: Unknown result type (might be due to invalid IL or missing references)
//IL_0371: Unknown result type (might be due to invalid IL or missing references)
//IL_0376: Unknown result type (might be due to invalid IL or missing references)
//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
//IL_03f2: Unknown result type (might be due to invalid IL or missing references)
//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
//IL_041f: Unknown result type (might be due to invalid IL or missing references)
//IL_042a: Unknown result type (might be due to invalid IL or missing references)
//IL_042f: Unknown result type (might be due to invalid IL or missing references)
Log.Init(((BaseUnityPlugin)this).Logger);
RCGLifeCycle.DontDestroyForever(((Component)this).gameObject);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin HPNumbers is loaded!");
yiHPPos = ((BaseUnityPlugin)this).Config.Bind<Vector2>("General", "YiHPPosition", new Vector2(340f, 750f), "Position for Yi's HP number");
yiHPFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("General", "YiHPFontSize", 19, "Font Size for Yi's HP number");
yiHPColor = ((BaseUnityPlugin)this).Config.Bind<Color>("General", "YiHPColor", new Color(0f, 0f, 0f, 1f), "Color for Yi's HP number");
hpNumber = ShowHealth(YiHealth.ToString("F0"), Color.black);
((Transform)hpNumber.rectTransform).position = Vector2.op_Implicit(yiHPPos.Value);
hpNumber.fontSize = yiHPFontSize.Value;
((Graphic)hpNumber).color = yiHPColor.Value;
MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)hpNumber, false);
yiInternalHPPos = ((BaseUnityPlugin)this).Config.Bind<Vector2>("General", "YiInternalHPPosition", new Vector2(400f, 750f), "Position for Yi's Internal HP number");
yiInternalHPFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("General", "YiInternalHPFontSize", 19, "Font Size for Yi's Internal HP number");
yiInternalHPColor = ((BaseUnityPlugin)this).Config.Bind<Color>("General", "YiInternalHPColor", new Color(1f, 1f, 1f, 1f), "Color for Yi's Internal HP number");
internalHpNumber = ShowHealth(YiInternalHealth.ToString("F0"), Color.white);
((Transform)internalHpNumber.rectTransform).position = Vector2.op_Implicit(yiInternalHPPos.Value);
internalHpNumber.fontSize = yiInternalHPFontSize.Value;
((Graphic)internalHpNumber).color = yiInternalHPColor.Value;
MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)internalHpNumber, false);
bossHPPos = ((BaseUnityPlugin)this).Config.Bind<Vector2>("General", "BossHPPosition", new Vector2(850f, 70f), "Position for Boss HP number");
bossHPFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("General", "BossHPFontSize", 19, "Font Size for Boss HP number");
bossHPColor = ((BaseUnityPlugin)this).Config.Bind<Color>("General", "BossHPColor", new Color(1f, 1f, 1f, 1f), "Color for Boss HP number");
bossInternalPos = ((BaseUnityPlugin)this).Config.Bind<Vector2>("General", "BossInternalHPPosition", new Vector2(930f, 70f), "Position for Boss Internal HP number");
bossInternalHPFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("General", "BossInternalHPFontSize", 19, "Font Size for Boss Internal HP number");
bossInternalHPColor = ((BaseUnityPlugin)this).Config.Bind<Color>("General", "BossInternalHPColor", new Color(0.5f, 1f, 1f, 1f), "Color for Boss Internal HP number");
bossHPNumber = ShowHealth(bossHealth.ToString("F0"), Color.white);
((Transform)bossHPNumber.rectTransform).position = Vector2.op_Implicit(bossHPPos.Value);
bossHPNumber.fontSize = bossHPFontSize.Value;
((Graphic)bossHPNumber).color = bossHPColor.Value;
bossInternalHPNumber = ShowHealth(bossInternalHealth.ToString("F0"), new Color(0.5f, 1f, 1f, 1f));
((Transform)bossInternalHPNumber.rectTransform).position = Vector2.op_Implicit(bossInternalPos.Value);
bossInternalHPNumber.fontSize = bossInternalHPFontSize.Value;
TMP_Text obj = bossInternalHPNumber;
((Graphic)obj).color = ((Graphic)obj).color + bossInternalHPColor.Value;
MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)bossHPNumber, false);
MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)bossInternalHPNumber, false);
}
private void Update()
{
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0242: Unknown result type (might be due to invalid IL or missing references)
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Player.i != (Object)null)
{
YiHealth = ((Health)Player.i.health).currentValue;
YiInternalHealth = Player.i.health.CurrentInternalInjuryValue;
MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)hpNumber, true);
MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)internalHpNumber, true);
hpNumber.text = YiHealth.ToString("F0");
internalHpNumber.text = YiInternalHealth.ToString("F0");
}
monster = GetBossInstance();
if ((Object)(object)monster != (Object)null && monster.IsActive)
{
bossHealth = monster.postureSystem.CurrentHealthValue;
MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)bossHPNumber, true);
bossInternalHealth = monster.postureSystem.CurrentInternalInjury;
MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)bossInternalHPNumber, true);
bossHPNumber.text = bossHealth.ToString("F0");
bossInternalHPNumber.text = bossInternalHealth.ToString("F0");
}
else
{
MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)bossHPNumber, false);
MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)bossInternalHPNumber, false);
}
((Transform)hpNumber.rectTransform).position = Vector2.op_Implicit(yiHPPos.Value);
((Transform)internalHpNumber.rectTransform).position = Vector2.op_Implicit(yiInternalHPPos.Value);
((Transform)bossHPNumber.rectTransform).position = Vector2.op_Implicit(bossHPPos.Value);
((Transform)bossInternalHPNumber.rectTransform).position = Vector2.op_Implicit(bossInternalPos.Value);
hpNumber.fontSize = yiHPFontSize.Value;
internalHpNumber.fontSize = yiInternalHPFontSize.Value;
bossHPNumber.fontSize = bossHPFontSize.Value;
bossInternalHPNumber.fontSize = bossInternalHPFontSize.Value;
((Graphic)hpNumber).color = yiHPColor.Value;
((Graphic)internalHpNumber).color = yiInternalHPColor.Value;
((Graphic)bossHPNumber).color = bossHPColor.Value;
((Graphic)bossInternalHPNumber).color = bossInternalHPColor.Value;
if (YiHealth <= 0f)
{
MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)hpNumber, false);
MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)bossHPNumber, false);
MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)bossInternalHPNumber, false);
}
else if (bossHealth == 0f && bossInternalHealth == 0f)
{
MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)bossHPNumber, false);
MonoLifeTimeExtension.SetActive((MonoBehaviour)(object)bossInternalHPNumber, false);
}
}
private static TMP_Text ShowHealth(string str, Color color)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
Transform transform = ((Component)NineSolsAPICore.FullscreenCanvas).transform;
GameObject val = new GameObject();
val.transform.SetParent(transform);
TextMeshProUGUI obj = val.AddComponent<TextMeshProUGUI>();
((TMP_Text)obj).fontSize = 19f;
((TMP_Text)obj).text = str;
((Graphic)obj).color = color;
return (TMP_Text)(object)obj;
}
private MonsterBase GetBossInstance()
{
foreach (MonsterBase value in SingletonBehaviour<MonsterManager>.Instance.monsterDict.Values)
{
if (((Component)value).tag == "Boss" && ((Object)value).name != "_depre_StealthGameMonster_伏羲 Variant(Clone)" && ((Object)value).name != "StealthGameMonster_新女媧 Variant")
{
return value;
}
}
return null;
}
private void OnDestroy()
{
Object.Destroy((Object)(object)hpNumber);
Object.Destroy((Object)(object)internalHpNumber);
Object.Destroy((Object)(object)bossHPNumber);
Object.Destroy((Object)(object)bossInternalHPNumber);
}
}
internal static class Log
{
private static ManualLogSource? logSource;
internal static void Init(ManualLogSource logSource)
{
Log.logSource = logSource;
}
internal static void Debug(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogDebug(data);
}
}
internal static void Error(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogError(data);
}
}
internal static void Fatal(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogFatal(data);
}
}
internal static void Info(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogInfo(data);
}
}
internal static void Message(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogMessage(data);
}
}
internal static void Warning(object data)
{
ManualLogSource? obj = logSource;
if (obj != null)
{
obj.LogWarning(data);
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "HPNumbers";
public const string PLUGIN_NAME = "HPNumbers";
public const string PLUGIN_VERSION = "2.0.0";
}
}