using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using CollapseDisplay;
using CollapseDisplay.Config;
using CollapseDisplay.Networking;
using CollapseDisplay.Properties;
using IL.RoR2.UI;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using On.RoR2.UI;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.UI;
using Unity;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.UI;
[assembly: AssemblyCompany("CollapseDisplay")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyInformationalVersion("1.0.0+4d2c00ffc2f6e71ae33de72d7717f82aa72edd2a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[assembly: AssemblyTitle("CollapseDisplay")]
[assembly: AssemblyProduct("CollapseDisplay")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[Microsoft.CodeAnalysis.Embedded]
[CompilerGenerated]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
[Microsoft.CodeAnalysis.Embedded]
[CompilerGenerated]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace CollapseDisplay
{
public class AcceptableValueMin<T> : AcceptableValueBase where T : IComparable
{
public T MinValue { get; }
public AcceptableValueMin(T minValue)
: base(typeof(T))
{
if (minValue == null)
{
throw new ArgumentNullException("minValue");
}
MinValue = minValue;
}
public override object Clamp(object value)
{
if (MinValue.CompareTo(value) > 0)
{
return MinValue;
}
return value;
}
public override bool IsValid(object value)
{
return MinValue.CompareTo(value) <= 0;
}
public override string ToDescriptionString()
{
return $"# Acceptable value range: Greater than or equal to {MinValue}";
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Gorakh.CollapseDisplay", "CollapseDisplay", "1.3.2")]
public class CollapseDisplayPlugin : BaseUnityPlugin
{
public const string PluginGUID = "Gorakh.CollapseDisplay";
public const string PluginAuthor = "Gorakh";
public const string PluginName = "CollapseDisplay";
public const string PluginVersion = "1.3.2";
private static Sprite _healthBarHighlight;
internal static CollapseDisplayPlugin Instance { get; private set; }
public static DelayedDamageDisplayOptions CollapseDisplayOptions { get; private set; }
public static DelayedDamageDisplayOptions WarpedEchoDisplayOptions { get; private set; }
private void Awake()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
Stopwatch stopwatch = Stopwatch.StartNew();
Log.Init(((BaseUnityPlugin)this).Logger);
Instance = SingletonHelper.Assign<CollapseDisplayPlugin>(Instance, this);
Texture2D val = new Texture2D(1, 1);
if (ImageConversion.LoadImage(val, Resources.HealthBarHighlight_Opaque))
{
_healthBarHighlight = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)1, new Vector4(4f, 3f, 3f, 4f));
((Object)_healthBarHighlight).name = "HealthBarHighlightOpaque";
}
else
{
Log.Error("Failed to load health bar overlay texture", "D:\\Git\\RoR2\\CollapseDisplay\\CollapseDisplay\\CollapseDisplayPlugin.cs", "Awake", 42);
_healthBarHighlight = null;
}
Sprite highlightSprite = (Object.op_Implicit((Object)(object)_healthBarHighlight) ? _healthBarHighlight : Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texUIHighlightExecute.png").WaitForCompletion());
CollapseDisplayOptions = new DelayedDamageDisplayOptions(highlightSprite, ((BaseUnityPlugin)this).Config, "Collapse", new Color(84f / 85f, 0.14509805f, 22f / 85f, 1f), 1f);
WarpedEchoDisplayOptions = new DelayedDamageDisplayOptions(highlightSprite, ((BaseUnityPlugin)this).Config, "Warped Echo", new Color(54f / 85f, 0.5921569f, 47f / 85f, 1f), 1f);
if (RiskOfOptionsCompat.Enabled)
{
RiskOfOptionsCompat.Initialize();
}
HealthBarTypeRegistration.Initialize();
HealthBarHooks.Initialize();
DelayedDamageProviderHooks.Initialize();
stopwatch.Stop();
Log.Info_NoCallerPrefix($"Initialized in {stopwatch.Elapsed.TotalSeconds:F2} seconds");
}
private void OnDestroy()
{
HealthBarTypeRegistration.Cleanup();
HealthBarHooks.Cleanup();
DelayedDamageProviderHooks.Cleanup();
Instance = SingletonHelper.Unassign<CollapseDisplayPlugin>(Instance, this);
}
}
public struct DelayedDamageInfo : IEquatable<DelayedDamageInfo>
{
public static readonly DelayedDamageInfo None = new DelayedDamageInfo(-1f, FixedTimeStamp.negativeInfinity);
public float Damage;
public Net_RunFixedTimeStampWrapper Wrap_DamageTimestamp;
public FixedTimeStamp DamageTimestamp
{
readonly get
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return Wrap_DamageTimestamp;
}
set
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
Wrap_DamageTimestamp = value;
}
}
public DelayedDamageInfo()
{
Damage = 0f;
Wrap_DamageTimestamp = default(Net_RunFixedTimeStampWrapper);
}
public DelayedDamageInfo(float damage, FixedTimeStamp damageTimestamp)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
Damage = damage;
Wrap_DamageTimestamp = damageTimestamp;
}
public readonly bool Equals(DelayedDamageInfo other)
{
if (Damage == other.Damage)
{
return Wrap_DamageTimestamp.Equals(other.Wrap_DamageTimestamp);
}
return false;
}
}
[DisallowMultipleComponent]
public class DelayedDamageProvider : NetworkBehaviour
{
[SyncVar]
private DelayedDamageInfo _collapseDamage;
[SyncVar]
private DelayedDamageInfo _warpedEchoDamage;
private CharacterBody _body;
private HealthComponent _healthComponent;
public DelayedDamageInfo CollapseDamage => _collapseDamage;
public DelayedDamageInfo WarpedEchoDamage => _warpedEchoDamage;
public DelayedDamageInfo Network_collapseDamage
{
get
{
return _collapseDamage;
}
[param: In]
set
{
((NetworkBehaviour)this).SetSyncVar<DelayedDamageInfo>(value, ref _collapseDamage, 1u);
}
}
public DelayedDamageInfo Network_warpedEchoDamage
{
get
{
return _warpedEchoDamage;
}
[param: In]
set
{
((NetworkBehaviour)this).SetSyncVar<DelayedDamageInfo>(value, ref _warpedEchoDamage, 2u);
}
}
private void Awake()
{
_body = ((Component)this).GetComponent<CharacterBody>();
_healthComponent = ((Component)this).GetComponent<HealthComponent>();
}
private void FixedUpdate()
{
if (NetworkServer.active)
{
fixedUpdateServer();
}
}
[Server]
private void fixedUpdateServer()
{
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Invalid comparison between Unknown and I4
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Expected O, but got Unknown
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
if (!NetworkServer.active)
{
Debug.LogWarning((object)"[Server] function 'System.Void CollapseDisplay.DelayedDamageProvider::fixedUpdateServer()' called on client");
return;
}
DelayedDamageInfo none = DelayedDamageInfo.None;
DelayedDamageInfo none2 = DelayedDamageInfo.None;
if (Object.op_Implicit((Object)(object)_body))
{
if (Object.op_Implicit((Object)(object)_healthComponent) && _healthComponent.alive)
{
DotController val = DotController.FindDotController(((Component)this).gameObject);
if (Object.op_Implicit((Object)(object)val) && val.HasDotActive((DotIndex)8))
{
float num = float.PositiveInfinity;
none.Damage = 0f;
foreach (DotStack dotStack in val.dotStackList)
{
if ((int)dotStack.dotIndex == 8)
{
num = Mathf.Min(num, dotStack.timer);
float damage = dotStack.damage;
DamageInfo damageInfo = new DamageInfo
{
attacker = dotStack.attackerObject,
damage = damage
};
modifyIncomingDamage(ref damage, damageInfo);
if (damage > 0f)
{
none.Damage += damage;
}
}
}
if (float.IsInfinity(num))
{
num = 0f;
}
none.DamageTimestamp = FixedTimeStamp.now + num;
}
}
if (_body.incomingDamageList.Count > 0)
{
float num2 = float.PositiveInfinity;
none2.Damage = 0f;
foreach (DelayedDamageInfo incomingDamage in _body.incomingDamageList)
{
num2 = Mathf.Min(num2, incomingDamage.timeUntilDamage);
DamageInfo halfDamage = incomingDamage.halfDamage;
float damage2 = halfDamage.damage;
modifyIncomingDamage(ref damage2, halfDamage);
if (damage2 > 0f)
{
none2.Damage += damage2;
}
}
if (float.IsInfinity(num2))
{
num2 = 0f;
}
none2.DamageTimestamp = FixedTimeStamp.now + num2;
}
}
Network_collapseDamage = none;
Network_warpedEchoDamage = none2;
}
private void modifyIncomingDamage(ref float damage, DamageInfo damageInfo)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
TeamIndex objectTeam = TeamComponent.GetObjectTeam(damageInfo.attacker);
if (objectTeam == _body.teamComponent.teamIndex)
{
TeamDef teamDef = TeamCatalog.GetTeamDef(objectTeam);
if (teamDef != null)
{
damage *= teamDef.friendlyFireScaling;
}
}
CharacterBody val = default(CharacterBody);
if (Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.attacker.TryGetComponent<CharacterBody>(ref val) && Object.op_Implicit((Object)(object)val.inventory))
{
if (_healthComponent.combinedHealth > _healthComponent.fullCombinedHealth * 0.9f)
{
int itemCount = val.inventory.GetItemCount(Items.Crowbar);
if (itemCount > 0)
{
damage *= 1f + 0.75f * (float)itemCount;
}
}
int itemCount2 = val.inventory.GetItemCount(Items.NearbyDamageBonus);
if (itemCount2 > 0)
{
Vector3 val2 = val.corePosition - _body.corePosition;
if (((Vector3)(ref val2)).sqrMagnitude <= 169f)
{
damage *= 1f + (float)itemCount2 * 0.2f;
}
}
int itemCount3 = val.inventory.GetItemCount(Items.FragileDamageBonus);
if (itemCount3 > 0)
{
damage *= 1f + (float)itemCount3 * 0.2f;
}
if (val.HasBuff(Buffs.LowerHealthHigherDamageBuff))
{
int itemCount4 = val.inventory.GetItemCount(Items.LowerHealthHigherDamage);
damage *= 1f + (float)itemCount4 * 0.2f;
}
if (_body.isBoss)
{
int itemCount5 = val.inventory.GetItemCount(Items.BossDamageBonus);
if (itemCount5 > 0)
{
damage *= 1f + 0.2f * (float)itemCount5;
}
}
}
if (_body.HasBuff(Buffs.DeathMark))
{
damage *= 1.5f;
}
float num = _body.armor + _healthComponent.adaptiveArmorValue;
float num2 = ((num >= 0f) ? (1f - num / (num + 100f)) : (2f - 100f / (100f - num)));
damage = Mathf.Max(1f, damage * num2);
if (Object.op_Implicit((Object)(object)_body.inventory))
{
int itemCount6 = _body.inventory.GetItemCount(Items.ArmorPlate);
if (itemCount6 > 0)
{
damage = Mathf.Max(1f, damage - 5f * (float)itemCount6);
}
}
if (_body.hasOneShotProtection)
{
float num3 = (_healthComponent.fullCombinedHealth + _healthComponent.barrier) * (1f - _body.oneShotProtectionFraction);
float num4 = Mathf.Max(0f, num3 - _healthComponent.serverDamageTakenThisUpdate);
damage = Mathf.Min(damage, num4);
}
if (_body.HasBuff(Buffs.LunarShell) && damage > _healthComponent.fullHealth * 0.1f)
{
damage = _healthComponent.fullHealth * 0.1f;
}
if (Object.op_Implicit((Object)(object)_body.inventory))
{
int itemCount7 = _body.inventory.GetItemCount(Items.MinHealthPercentage);
if (itemCount7 > 0)
{
float num5 = _healthComponent.fullCombinedHealth * ((float)itemCount7 / 100f);
damage = Mathf.Max(0f, Mathf.Min(damage, _healthComponent.combinedHealth - num5));
}
}
if (!damageInfo.delayedDamageSecondHalf && _body.HasBuff(Buffs.DelayedDamageBuff))
{
damage *= 0.5f;
}
}
private void UNetVersion()
{
}
public override bool OnSerialize(NetworkWriter writer, bool forceAll)
{
if (forceAll)
{
GeneratedNetworkCode._WriteDelayedDamageInfo_None(writer, _collapseDamage);
GeneratedNetworkCode._WriteDelayedDamageInfo_None(writer, _warpedEchoDamage);
return true;
}
bool flag = false;
if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
{
if (!flag)
{
writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
flag = true;
}
GeneratedNetworkCode._WriteDelayedDamageInfo_None(writer, _collapseDamage);
}
if ((((NetworkBehaviour)this).syncVarDirtyBits & 2u) != 0)
{
if (!flag)
{
writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
flag = true;
}
GeneratedNetworkCode._WriteDelayedDamageInfo_None(writer, _warpedEchoDamage);
}
if (!flag)
{
writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
}
return flag;
}
public override void OnDeserialize(NetworkReader reader, bool initialState)
{
if (initialState)
{
_collapseDamage = GeneratedNetworkCode._ReadDelayedDamageInfo_None(reader);
_warpedEchoDamage = GeneratedNetworkCode._ReadDelayedDamageInfo_None(reader);
return;
}
int num = (int)reader.ReadPackedUInt32();
if (((uint)num & (true ? 1u : 0u)) != 0)
{
_collapseDamage = GeneratedNetworkCode._ReadDelayedDamageInfo_None(reader);
}
if (((uint)num & 2u) != 0)
{
_warpedEchoDamage = GeneratedNetworkCode._ReadDelayedDamageInfo_None(reader);
}
}
}
internal static class DelayedDamageProviderHooks
{
[CompilerGenerated]
private static class <>O
{
public static hook_Awake <0>__HealthComponent_Awake;
}
public static void Initialize()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
object obj = <>O.<0>__HealthComponent_Awake;
if (obj == null)
{
hook_Awake val = HealthComponent_Awake;
<>O.<0>__HealthComponent_Awake = val;
obj = (object)val;
}
HealthComponent.Awake += (hook_Awake)obj;
}
public static void Cleanup()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
object obj = <>O.<0>__HealthComponent_Awake;
if (obj == null)
{
hook_Awake val = HealthComponent_Awake;
<>O.<0>__HealthComponent_Awake = val;
obj = (object)val;
}
HealthComponent.Awake -= (hook_Awake)obj;
}
private static void HealthComponent_Awake(orig_Awake orig, HealthComponent self)
{
orig.Invoke(self);
((Component)self).gameObject.AddComponent<DelayedDamageProvider>();
}
}
internal static class HealthBarHooks
{
private readonly struct AdditionalBarInfos
{
public static readonly FieldInfo[] BarInfoFields = (from f in typeof(AdditionalBarInfos).GetFields(BindingFlags.Instance | BindingFlags.Public)
where f.FieldType == typeof(BarInfo)
select f).ToArray();
public readonly BarInfo CollapseDamageBarInfo;
public readonly BarInfo WarpedEchoDamageBarInfo;
public readonly int EnabledBarCount;
public AdditionalBarInfos(BarInfo collapseDamageBarInfo, BarInfo warpedEchoDamageBarInfo)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
int num = 0;
CollapseDamageBarInfo = collapseDamageBarInfo;
if (CollapseDamageBarInfo.enabled)
{
num++;
}
WarpedEchoDamageBarInfo = warpedEchoDamageBarInfo;
if (WarpedEchoDamageBarInfo.enabled)
{
num++;
}
EnabledBarCount = num;
}
}
[CompilerGenerated]
private static class <>O
{
public static Manipulator <0>__HealthBar_ApplyBars;
public static Func<HealthBar, AdditionalBarInfos> <1>__collectBarInfos;
public static <>F{00000018}<int, AdditionalBarInfos, int> <2>__addDamageDisplayBarsToCount;
}
public static void Initialize()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
object obj = <>O.<0>__HealthBar_ApplyBars;
if (obj == null)
{
Manipulator val = HealthBar_ApplyBars;
<>O.<0>__HealthBar_ApplyBars = val;
obj = (object)val;
}
HealthBar.ApplyBars += (Manipulator)obj;
}
public static void Cleanup()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
object obj = <>O.<0>__HealthBar_ApplyBars;
if (obj == null)
{
Manipulator val = HealthBar_ApplyBars;
<>O.<0>__HealthBar_ApplyBars = val;
obj = (object)val;
}
HealthBar.ApplyBars -= (Manipulator)obj;
}
private static void HealthBar_ApplyBars(ILContext il)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Expected O, but got Unknown
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Expected O, but got Unknown
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
MethodReference handleBarMethod = null;
if (val.TryGotoNext(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref handleBarMethod) && nameStartsWith(handleBarMethod, "<ApplyBars>g__HandleBar|")
}))
{
int localsVarIndex = -1;
if (val.TryGotoPrev(new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdloca(x, ref localsVarIndex)
}))
{
VariableDefinition val2 = il.Method.Body.Variables[localsVarIndex];
val.Index = 0;
VariableDefinition val3 = new VariableDefinition(il.Import(typeof(AdditionalBarInfos)));
il.Method.Body.Variables.Add(val3);
val.Emit(OpCodes.Ldarg_0);
val.EmitDelegate<Func<HealthBar, AdditionalBarInfos>>((Func<HealthBar, AdditionalBarInfos>)collectBarInfos);
val.Emit(OpCodes.Stloc, val3);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<BarInfoCollection>(x, "GetActiveCount")
}))
{
val.Emit(OpCodes.Ldloca, val3);
val.EmitDelegate<<>F{00000018}<int, AdditionalBarInfos, int>>((<>F{00000018}<int, AdditionalBarInfos, int>)addDamageDisplayBarsToCount);
if (!val.TryGotoNext((MoveType)1, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchRet(x)
}))
{
Log.Error("Failed to find patch location", "D:\\Git\\RoR2\\CollapseDisplay\\CollapseDisplay\\HealthBarHooks.cs", "HealthBar_ApplyBars", 118);
return;
}
FieldInfo[] barInfoFields = AdditionalBarInfos.BarInfoFields;
foreach (FieldInfo fieldInfo in barInfoFields)
{
val.Emit(OpCodes.Ldarg_0);
val.Emit(OpCodes.Ldloca, val3);
val.Emit(OpCodes.Ldflda, fieldInfo);
val.Emit(OpCodes.Ldloca, val2);
val.Emit(OpCodes.Call, handleBarMethod);
}
}
else
{
Log.Error("Failed to find bar count patch location", "D:\\Git\\RoR2\\CollapseDisplay\\CollapseDisplay\\HealthBarHooks.cs", "HealthBar_ApplyBars", 111);
}
}
else
{
Log.Error("Failed to find locals variable", "D:\\Git\\RoR2\\CollapseDisplay\\CollapseDisplay\\HealthBarHooks.cs", "HealthBar_ApplyBars", 77);
}
}
else
{
Log.Error("Failed to find HandleBar method", "D:\\Git\\RoR2\\CollapseDisplay\\CollapseDisplay\\HealthBarHooks.cs", "HealthBar_ApplyBars", 83);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
static int addDamageDisplayBarsToCount(int activeCount, in AdditionalBarInfos damageDisplayBarInfos)
{
return activeCount + damageDisplayBarInfos.EnabledBarCount;
}
static bool nameStartsWith(MethodReference methodReference, string value)
{
if (methodReference == null || ((MemberReference)methodReference).Name == null)
{
return false;
}
return ((MemberReference)methodReference).Name.StartsWith(value);
}
}
private static AdditionalBarInfos collectBarInfos(HealthBar healthBar)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0185: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
HealthBarType barType = HealthBarType.Unknown;
HealthBarTypeProvider healthBarTypeProvider = default(HealthBarTypeProvider);
if (((Component)healthBar).TryGetComponent<HealthBarTypeProvider>(ref healthBarTypeProvider))
{
barType = healthBarTypeProvider.Type;
}
DelayedDamageBarStyle damageBarStyle = CollapseDisplayPlugin.CollapseDisplayOptions.GetDamageBarStyle(barType);
BarStyle barStyle = damageBarStyle.BarStyle;
BarInfo val = default(BarInfo);
val.enabled = false;
val.color = barStyle.baseColor;
val.sprite = barStyle.sprite;
val.imageType = barStyle.imageType;
val.sizeDelta = barStyle.sizeDelta;
val.normalizedXMin = 0f;
val.normalizedXMax = 0f;
BarInfo barInfo2 = val;
DelayedDamageBarStyle damageBarStyle2 = CollapseDisplayPlugin.WarpedEchoDisplayOptions.GetDamageBarStyle(barType);
BarStyle barStyle2 = damageBarStyle2.BarStyle;
val = default(BarInfo);
val.enabled = false;
val.color = barStyle2.baseColor;
val.sprite = barStyle2.sprite;
val.imageType = barStyle2.imageType;
val.sizeDelta = barStyle2.sizeDelta;
val.normalizedXMin = 0f;
val.normalizedXMax = 0f;
BarInfo barInfo3 = val;
HealthComponent source = healthBar.source;
DelayedDamageProvider delayedDamageProvider = default(DelayedDamageProvider);
float currentHealth;
float fullCombinedHealth;
float nonCurseFraction;
float totalBarDamageAmount;
if (Object.op_Implicit((Object)(object)source) && ((Component)source).TryGetComponent<DelayedDamageProvider>(ref delayedDamageProvider))
{
HealthBarValues healthBarValues = source.GetHealthBarValues();
currentHealth = source.combinedHealth;
fullCombinedHealth = source.fullCombinedHealth;
nonCurseFraction = 1f - healthBarValues.curseFraction;
totalBarDamageAmount = 0f;
FixedTimeStamp damageTimestamp;
if (damageBarStyle2.EnabledConfig.Value)
{
DelayedDamageInfo warpedEchoDamage = delayedDamageProvider.WarpedEchoDamage;
damageTimestamp = warpedEchoDamage.DamageTimestamp;
if (((FixedTimeStamp)(ref damageTimestamp)).timeUntil > 0f)
{
float num = warpedEchoDamage.Damage - source.barrier;
if (num > 0f)
{
addBar(ref barInfo3, num);
}
}
}
if (damageBarStyle.EnabledConfig.Value)
{
DelayedDamageInfo collapseDamage = delayedDamageProvider.CollapseDamage;
damageTimestamp = collapseDamage.DamageTimestamp;
if (((FixedTimeStamp)(ref damageTimestamp)).timeUntil > 0f)
{
float num2 = collapseDamage.Damage - source.barrier;
if (num2 > 0f)
{
addBar(ref barInfo2, num2);
}
}
}
}
return new AdditionalBarInfos(barInfo2, barInfo3);
void addBar(ref BarInfo barInfo, float damageAmount)
{
barInfo.enabled = true;
float num3 = (currentHealth - totalBarDamageAmount - damageAmount) / fullCombinedHealth * nonCurseFraction;
barInfo.normalizedXMin = Mathf.Clamp01(num3);
float num4 = (currentHealth - totalBarDamageAmount) / fullCombinedHealth * nonCurseFraction;
barInfo.normalizedXMax = Mathf.Clamp01(num4);
totalBarDamageAmount += damageAmount;
}
}
}
public enum HealthBarType
{
Unknown,
Hud,
Combat,
AllyList,
Count
}
public class HealthBarTypeProvider : MonoBehaviour
{
public HealthBarType Type;
}
internal static class HealthBarTypeRegistration
{
[CompilerGenerated]
private static class <>O
{
public static hook_Awake <0>__HealthBar_Awake;
}
private static readonly HealthBarStyle _combatHealthBarStyle = Addressables.LoadAssetAsync<HealthBarStyle>((object)"RoR2/Base/Common/CombatHealthBar.asset").WaitForCompletion();
private static readonly List<HealthBarTypeProvider> _addedPrefabProviders = new List<HealthBarTypeProvider>();
public static void Initialize()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
object obj = <>O.<0>__HealthBar_Awake;
if (obj == null)
{
hook_Awake val = HealthBar_Awake;
<>O.<0>__HealthBar_Awake = val;
obj = (object)val;
}
HealthBar.Awake += (hook_Awake)obj;
registerHealthBarPrefab("RoR2/Base/UI/HUDSimple.prefab", HealthBarType.Hud);
registerHealthBarPrefab("RoR2/Base/UI/CombatHealthbar.prefab", HealthBarType.Combat);
registerHealthBarPrefab("RoR2/Base/UI/AllyCard.prefab", HealthBarType.AllyList);
static void registerHealthBarPrefab(string assetPath, HealthBarType type)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)assetPath).WaitForCompletion();
if (!Object.op_Implicit((Object)(object)val2))
{
Log.Error("Invalid asset path '" + assetPath + "'", "D:\\Git\\RoR2\\CollapseDisplay\\CollapseDisplay\\HealthBarTypeRegistration.cs", "Initialize", 23);
}
else
{
int num = 0;
HealthBar[] componentsInChildren = val2.GetComponentsInChildren<HealthBar>(true);
foreach (HealthBar val3 in componentsInChildren)
{
if (!Object.op_Implicit((Object)(object)((Component)val3).GetComponent<HealthBarTypeProvider>()))
{
HealthBarTypeProvider healthBarTypeProvider = ((Component)val3).gameObject.AddComponent<HealthBarTypeProvider>();
healthBarTypeProvider.Type = type;
_addedPrefabProviders.Add(healthBarTypeProvider);
num++;
}
}
if (num == 0)
{
Log.Warning("No health bars found on asset '" + assetPath + "'", "D:\\Git\\RoR2\\CollapseDisplay\\CollapseDisplay\\HealthBarTypeRegistration.cs", "Initialize", 43);
}
}
}
}
public static void Cleanup()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
object obj = <>O.<0>__HealthBar_Awake;
if (obj == null)
{
hook_Awake val = HealthBar_Awake;
<>O.<0>__HealthBar_Awake = val;
obj = (object)val;
}
HealthBar.Awake -= (hook_Awake)obj;
foreach (HealthBarTypeProvider addedPrefabProvider in _addedPrefabProviders)
{
Object.Destroy((Object)(object)addedPrefabProvider);
}
_addedPrefabProviders.Clear();
}
private static void HealthBar_Awake(orig_Awake orig, HealthBar self)
{
if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<HealthBarTypeProvider>()))
{
HealthBarType healthBarType = HealthBarType.Unknown;
if ((Object)(object)self.style == (Object)(object)_combatHealthBarStyle)
{
healthBarType = HealthBarType.Combat;
}
Log.Info($"Health bar {self} is not registered, assuming bar type of {healthBarType}", "D:\\Git\\RoR2\\CollapseDisplay\\CollapseDisplay\\HealthBarTypeRegistration.cs", "HealthBar_Awake", 80);
((Component)self).gameObject.AddComponent<HealthBarTypeProvider>().Type = healthBarType;
}
orig.Invoke(self);
}
}
internal static class Log
{
internal static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
private static string getLogPrefix(string callerPath, string callerMemberName, int callerLineNumber)
{
int num = callerPath.LastIndexOf("CollapseDisplay\\");
if (num >= 0)
{
callerPath = callerPath.Substring(num + "CollapseDisplay\\".Length);
}
return $"{callerPath}:{callerLineNumber} ({callerMemberName}) ";
}
internal static void Error(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
{
_logSource.LogError((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
}
internal static void Error_NoCallerPrefix(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
{
_logSource.LogFatal((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
}
internal static void Fatal_NoCallerPrefix(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
{
_logSource.LogInfo((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
}
internal static void Info_NoCallerPrefix(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
{
_logSource.LogMessage((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
}
internal static void Message_NoCallerPrefix(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data, [CallerFilePath] string callerPath = "", [CallerMemberName] string callerMemberName = "", [CallerLineNumber] int callerLineNumber = -1)
{
_logSource.LogWarning((object)(getLogPrefix(callerPath, callerMemberName, callerLineNumber) + data));
}
internal static void Warning_NoCallerPrefix(object data)
{
_logSource.LogWarning(data);
}
}
internal static class RiskOfOptionsCompat
{
public static bool Enabled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions");
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void Initialize()
{
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Expected O, but got Unknown
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
addDisplayOptions(CollapseDisplayPlugin.CollapseDisplayOptions);
addDisplayOptions(CollapseDisplayPlugin.WarpedEchoDisplayOptions);
ModSettingsManager.SetModDescription("Options for Collapse Display", "Gorakh.CollapseDisplay", "Collapse Display");
FileInfo fileInfo = null;
DirectoryInfo directoryInfo = new DirectoryInfo(Path.GetDirectoryName(((BaseUnityPlugin)CollapseDisplayPlugin.Instance).Info.Location));
do
{
FileInfo[] files = directoryInfo.GetFiles("icon.png", SearchOption.TopDirectoryOnly);
if (files != null && files.Length != 0)
{
fileInfo = files[0];
break;
}
directoryInfo = directoryInfo.Parent;
}
while (directoryInfo != null && !string.Equals(directoryInfo.Name, "plugins", StringComparison.OrdinalIgnoreCase));
if (fileInfo != null)
{
Texture2D val = new Texture2D(256, 256);
if (ImageConversion.LoadImage(val, File.ReadAllBytes(fileInfo.FullName)))
{
Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f));
((Object)obj).name = "CollapseDisplayIcon";
ModSettingsManager.SetModIcon(obj, "Gorakh.CollapseDisplay", "Collapse Display");
}
}
static void addDamageBarStyle(DelayedDamageBarStyle damageBarStyle)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(damageBarStyle.EnabledConfig), "Gorakh.CollapseDisplay", "Collapse Display");
}
static void addDisplayOptions(DelayedDamageDisplayOptions displayOptions)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_0035: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new ColorOption(displayOptions.IndicatorColor), "Gorakh.CollapseDisplay", "Collapse Display");
ConfigEntry<float> indicatorScale = displayOptions.IndicatorScale;
FloatFieldConfig val2 = new FloatFieldConfig();
((NumericFieldConfig<float>)val2).Min = 0f;
ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(indicatorScale, val2), "Gorakh.CollapseDisplay", "Collapse Display");
addDamageBarStyle(displayOptions.HUDHealthBarStyle);
addDamageBarStyle(displayOptions.AllyListHealthBarStyle);
addDamageBarStyle(displayOptions.CombatHealthBarStyle);
}
}
}
}
namespace CollapseDisplay.Properties
{
[CompilerGenerated]
[DebuggerNonUserCode]
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
internal class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
resourceMan = new ResourceManager("CollapseDisplay.Properties.Resources", typeof(Resources).Assembly);
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal static byte[] HealthBarHighlight_Opaque => (byte[])ResourceManager.GetObject("HealthBarHighlight_Opaque", resourceCulture);
internal Resources()
{
}
}
}
namespace CollapseDisplay.Networking
{
public struct Net_RunFixedTimeStampWrapper : IEquatable<Net_RunFixedTimeStampWrapper>
{
public float t;
public Net_RunFixedTimeStampWrapper()
{
t = 0f;
}
public readonly bool Equals(Net_RunFixedTimeStampWrapper other)
{
return t == other.t;
}
public static implicit operator FixedTimeStamp(Net_RunFixedTimeStampWrapper wrapper)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
return new FixedTimeStamp(wrapper.t);
}
public static implicit operator Net_RunFixedTimeStampWrapper(FixedTimeStamp timeStamp)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
Net_RunFixedTimeStampWrapper result = new Net_RunFixedTimeStampWrapper();
result.t = timeStamp.t;
return result;
}
}
}
namespace CollapseDisplay.Config
{
public class DelayedDamageBarStyle
{
public readonly ConfigEntry<bool> EnabledConfig;
public readonly HealthBarType BarType;
private readonly DelayedDamageDisplayOptions _displayOptions;
private readonly float _baseSizeDelta;
private BarStyle _barStyle;
public BarStyle BarStyle => _barStyle;
public DelayedDamageBarStyle(ConfigFile file, string sectionName, HealthBarType type, BarStyle baseStyle, DelayedDamageDisplayOptions displayOptions)
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Expected O, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
BarType = type;
string text = type switch
{
HealthBarType.Hud => "Player HUD",
HealthBarType.AllyList => "Ally List",
HealthBarType.Combat => "Enemy",
_ => throw new NotImplementedException($"Bar type {type} is not implemented"),
};
EnabledConfig = file.Bind<bool>(sectionName, "Show on " + text, true, new ConfigDescription("If this damage indicator should display on " + text + " healthbars", (AcceptableValueBase)null, Array.Empty<object>()));
_barStyle = baseStyle;
_baseSizeDelta = _barStyle.sizeDelta;
_displayOptions = displayOptions;
_displayOptions.IndicatorColor.SettingChanged += IndicatorColor_SettingChanged;
updateBarColor();
_displayOptions.IndicatorScale.SettingChanged += IndicatorScale_SettingChanged;
updateBarSizeDelta();
}
private void IndicatorColor_SettingChanged(object sender, EventArgs e)
{
updateBarColor();
}
private void updateBarColor()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
_barStyle.baseColor = _displayOptions.IndicatorColor.Value;
}
private void IndicatorScale_SettingChanged(object sender, EventArgs e)
{
updateBarSizeDelta();
}
private void updateBarSizeDelta()
{
_barStyle.sizeDelta = Mathf.Max(0f, _baseSizeDelta * _displayOptions.IndicatorScale.Value);
}
}
public class DelayedDamageDisplayOptions
{
public readonly ConfigEntry<Color> IndicatorColor;
public readonly ConfigEntry<float> IndicatorScale;
public readonly DelayedDamageBarStyle HUDHealthBarStyle;
public readonly DelayedDamageBarStyle AllyListHealthBarStyle;
public readonly DelayedDamageBarStyle CombatHealthBarStyle;
public DelayedDamageBarStyle FallbackHealthBarStyle => CombatHealthBarStyle ?? AllyListHealthBarStyle ?? HUDHealthBarStyle;
public DelayedDamageDisplayOptions(Sprite highlightSprite, ConfigFile file, string sectionName, Color defaultColor, float defaultIndicatorScale)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
IndicatorColor = file.Bind<Color>(sectionName, "Indicator Color", defaultColor, new ConfigDescription("The color of this damage indicator", (AcceptableValueBase)null, Array.Empty<object>()));
IndicatorScale = file.Bind<float>(sectionName, "Indicator Scale", defaultIndicatorScale, new ConfigDescription("The scale of this damage indicator", (AcceptableValueBase)null, Array.Empty<object>()));
HUDHealthBarStyle = new DelayedDamageBarStyle(file, sectionName, HealthBarType.Hud, new BarStyle
{
enabled = true,
imageType = (Type)1,
sizeDelta = 5f,
sprite = highlightSprite
}, this);
AllyListHealthBarStyle = new DelayedDamageBarStyle(file, sectionName, HealthBarType.AllyList, new BarStyle
{
enabled = true,
imageType = (Type)1,
sizeDelta = 1f,
sprite = highlightSprite
}, this);
CombatHealthBarStyle = new DelayedDamageBarStyle(file, sectionName, HealthBarType.Combat, new BarStyle
{
enabled = true,
imageType = (Type)1,
sizeDelta = 1f,
sprite = highlightSprite
}, this);
}
public DelayedDamageBarStyle GetDamageBarStyle(HealthBarType barType)
{
return barType switch
{
HealthBarType.Hud => HUDHealthBarStyle,
HealthBarType.Combat => CombatHealthBarStyle,
HealthBarType.AllyList => AllyListHealthBarStyle,
HealthBarType.Unknown => FallbackHealthBarStyle,
_ => throw new NotImplementedException($"{barType} is not implemented"),
};
}
}
}
namespace Unity
{
[StructLayout(LayoutKind.Auto, CharSet = CharSet.Auto)]
public class GeneratedNetworkCode
{
public static void _WriteNet_RunFixedTimeStampWrapper_None(NetworkWriter writer, Net_RunFixedTimeStampWrapper value)
{
writer.Write(value.t);
}
public static void _WriteDelayedDamageInfo_None(NetworkWriter writer, DelayedDamageInfo value)
{
writer.Write(value.Damage);
_WriteNet_RunFixedTimeStampWrapper_None(writer, value.Wrap_DamageTimestamp);
}
public static Net_RunFixedTimeStampWrapper _ReadNet_RunFixedTimeStampWrapper_None(NetworkReader reader)
{
Net_RunFixedTimeStampWrapper result = default(Net_RunFixedTimeStampWrapper);
result.t = reader.ReadSingle();
return result;
}
public static DelayedDamageInfo _ReadDelayedDamageInfo_None(NetworkReader reader)
{
DelayedDamageInfo result = default(DelayedDamageInfo);
result.Damage = reader.ReadSingle();
result.Wrap_DamageTimestamp = _ReadNet_RunFixedTimeStampWrapper_None(reader);
return result;
}
}
}