using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2.UI;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.UI;
using TMPro;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("HealthbarImmune")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Mod for Risk of Rain 2")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+bdda01a9f77d6bcf5c42919c7308530eb6bf04fb")]
[assembly: AssemblyProduct("HealthbarImmune")]
[assembly: AssemblyTitle("HealthbarImmune")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
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;
}
}
}
namespace System.Diagnostics.CodeAnalysis
{
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class MemberNotNullAttribute : Attribute
{
public string[] Members { get; }
public MemberNotNullAttribute(string member)
{
Members = new string[1] { member };
}
public MemberNotNullAttribute(params string[] members)
{
Members = members;
}
}
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class MemberNotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public string[] Members { get; }
public MemberNotNullWhenAttribute(bool returnValue, string member)
{
ReturnValue = returnValue;
Members = new string[1] { member };
}
public MemberNotNullWhenAttribute(bool returnValue, params string[] members)
{
ReturnValue = returnValue;
Members = members;
}
}
}
namespace HealthbarImmune
{
[BepInPlugin("com.DestroyedClone.HealthbarImmune", "Healthbar Immune", "1.0.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class HealthbarImmunePlugin : BaseUnityPlugin
{
public static ConfigEntry<string> cfgCharacterBlacklist;
public static Color ImmuneColor = Color.yellow;
public static string token = "IMMUNE_TO_DAMAGE_HITMARKER";
public static string currentLanguageToken = "NOHIT";
internal static ManualLogSource _logger;
public static List<BodyIndex> bannedBodies = new List<BodyIndex>();
public void Awake()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
_logger = ((BaseUnityPlugin)this).Logger;
cfgCharacterBlacklist = ((BaseUnityPlugin)this).Config.Bind<string>("", "Character Blacklist", "", "Blacklisted characters if needed. Use body name, and seperate by commas.\n CommandoBody,HuntressBody");
HealthBar.UpdateBarInfos += new hook_UpdateBarInfos(HealthBar_UpdateBarInfos);
Language.onCurrentLanguageChanged += Language_onCurrentLanguageChanged;
if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
{
ModSupport_RiskOfOptions.Initialize();
}
((ResourceAvailability)(ref BodyCatalog.availability)).CallWhenAvailable((Action)SetupDictionary);
}
public static void SetupDictionary()
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Invalid comparison between Unknown and I4
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
_logger.LogMessage((object)"Setting up banned bodies.");
bannedBodies.Clear();
string[] array = cfgCharacterBlacklist.Value.Split(',');
List<string> list = new List<string>();
List<string> list2 = new List<string>();
if (array.Length == 0)
{
return;
}
string[] array2 = array;
foreach (string text in array2)
{
if (!Utility.IsNullOrWhiteSpace(text))
{
BodyIndex val = BodyCatalog.FindBodyIndex(text);
if ((int)val == -1)
{
list2.Add(text);
continue;
}
bannedBodies.Add(val);
list.Add(text);
}
}
if (list.Count > 0)
{
string text2 = "Successfully blacklisted: ";
foreach (string item in list)
{
text2 = text2 + item + ", ";
}
_logger.LogMessage((object)text2);
}
if (list2.Count <= 0)
{
return;
}
string text3 = "Failed to blacklist: ";
foreach (string item2 in list2)
{
text3 = text3 + item2 + ", ";
}
_logger.LogMessage((object)text3);
}
private void Language_onCurrentLanguageChanged()
{
if (Language.currentLanguage != null)
{
currentLanguageToken = Language.GetString(token);
}
}
private static void HealthBar_UpdateBarInfos(orig_UpdateBarInfos orig, HealthBar self)
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_036d: Unknown result type (might be due to invalid IL or missing references)
//IL_0377: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
if (!Object.op_Implicit((Object)(object)self.source) || !Object.op_Implicit((Object)(object)self.source.body) || bannedBodies.Contains(self.source.body.bodyIndex))
{
return;
}
Transform val = ((Component)self).transform.Find("Slash");
if (!Object.op_Implicit((Object)(object)val))
{
return;
}
HGTextMeshProUGUI component = ((Component)val).GetComponent<HGTextMeshProUGUI>();
if (!Object.op_Implicit((Object)(object)component))
{
return;
}
if (((TMP_Text)component).text == currentLanguageToken)
{
if (self.source.godMode || self.source.body.HasBuff(Buffs.HiddenInvincibility) || self.source.body.HasBuff(Buffs.Immune))
{
if (Object.op_Implicit((Object)(object)self.currentHealthText))
{
((TMP_Text)self.currentHealthText).text = "";
}
if (Object.op_Implicit((Object)(object)self.fullHealthText))
{
((TMP_Text)self.fullHealthText).text = "";
}
if (Object.op_Implicit((Object)(object)self.spriteAsNumberManager))
{
((Component)self.spriteAsNumberManager).gameObject.SetActive(false);
}
((Component)val).gameObject.SetActive(true);
self.barInfoCollection.trailingOverHealthbarInfo.color = ImmuneColor;
return;
}
((TMP_Text)component).text = "/";
if (Object.op_Implicit((Object)(object)self.currentHealthText))
{
float num = (self.displayStringCurrentHealth = Mathf.Ceil(self.source.combinedHealth));
((TMP_Text)self.currentHealthText).text = num.ToString();
}
if (Object.op_Implicit((Object)(object)self.fullHealthText))
{
float num2 = (self.displayStringFullHealth = Mathf.Ceil(self.source.fullHealth));
((TMP_Text)self.fullHealthText).text = num2.ToString();
}
if (Object.op_Implicit((Object)(object)self.spriteAsNumberManager))
{
((Component)self.spriteAsNumberManager).gameObject.SetActive(true);
}
((Component)val).gameObject.SetActive(false);
return;
}
bool flag = false;
HealthComponent source = self._source;
if (Object.op_Implicit((Object)(object)source))
{
CharacterBody body = source.body;
if (Object.op_Implicit((Object)(object)body))
{
flag = source.godMode || body.HasBuff(Buffs.HiddenInvincibility) || body.HasBuff(Buffs.Immune);
}
}
if (flag)
{
self.barInfoCollection.trailingOverHealthbarInfo.color = ImmuneColor;
((TMP_Text)((Component)((Component)self).transform.Find("Slash")).GetComponent<HGTextMeshProUGUI>()).text = currentLanguageToken;
if (Object.op_Implicit((Object)(object)self.currentHealthText))
{
((TMP_Text)self.currentHealthText).text = "";
}
if (Object.op_Implicit((Object)(object)self.fullHealthText))
{
((TMP_Text)self.fullHealthText).text = "";
}
if (self.scaleHealthbarWidth)
{
float num3 = Util.Remap(self.maxHealthbarWidth, self.minHealthbarHealth, self.maxHealthbarHealth, self.minHealthbarWidth, self.maxHealthbarWidth);
self.rectTransform.sizeDelta = new Vector2(num3, self.rectTransform.sizeDelta.y);
}
}
}
}
public static class ModSupport_RiskOfOptions
{
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void Initialize()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Expected O, but got Unknown
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
ModSettingsManager.SetModDescription("Makes the healthbar look like how it does in ROR1 when immune", "com.DestroyedClone.HealthbarImmune", "Healthbar Immune");
ModSettingsManager.AddOption((BaseOption)new StringInputFieldOption(HealthbarImmunePlugin.cfgCharacterBlacklist, new InputFieldConfig
{
submitOn = (SubmitEnum)6
}));
HealthbarImmunePlugin.cfgCharacterBlacklist.SettingChanged += CfgCharacterBlacklist_SettingChanged;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private static void CfgCharacterBlacklist_SettingChanged(object sender, EventArgs e)
{
string value = HealthbarImmunePlugin.cfgCharacterBlacklist.Value.Trim();
HealthbarImmunePlugin.cfgCharacterBlacklist.Value = value;
HealthbarImmunePlugin.SetupDictionary();
}
}
}