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;
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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[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")]
[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.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class AllowNullAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, Inherited = false)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class DisallowNullAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class DoesNotReturnAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class DoesNotReturnIfAttribute : Attribute
{
public bool ParameterValue { get; }
public DoesNotReturnIfAttribute(bool parameterValue)
{
ParameterValue = parameterValue;
}
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class MaybeNullAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class MaybeNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public MaybeNullWhenAttribute(bool returnValue)
{
ReturnValue = returnValue;
}
}
[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;
}
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, Inherited = false)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class NotNullAttribute : Attribute
{
}
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class NotNullIfNotNullAttribute : Attribute
{
public string ParameterName { get; }
public NotNullIfNotNullAttribute(string parameterName)
{
ParameterName = parameterName;
}
}
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
[ExcludeFromCodeCoverage]
[DebuggerNonUserCode]
internal sealed class NotNullWhenAttribute : Attribute
{
public bool ReturnValue { get; }
public NotNullWhenAttribute(bool returnValue)
{
ReturnValue = returnValue;
}
}
}
namespace HealthbarImmune
{
[BepInPlugin("com.DestroyedClone.HealthbarImmune", "Healthbar Immune", "1.0.2")]
[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
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: 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();
}
BodyCatalog.Init += new hook_Init(BodyCatalog_Init);
}
private void BodyCatalog_Init(orig_Init orig)
{
orig.Invoke();
SetupDictionary();
}
public static void SetupDictionary()
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Invalid comparison between Unknown and I4
//IL_0095: 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(new char[1] { ',' });
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_025c: Unknown result type (might be due to invalid IL or missing references)
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_030a: Unknown result type (might be due to invalid IL or missing references)
//IL_0314: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: 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 = "";
}
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();
}
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)1
}));
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();
}
}
}