using System;
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.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Peak.Afflictions;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.github.Kirshoo.AfflictionsDebug")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.4.0.0")]
[assembly: AssemblyInformationalVersion("0.4.0+620176a0455ff86912312cd66506306f4fcc9e01")]
[assembly: AssemblyProduct("com.github.Kirshoo.AfflictionsDebug")]
[assembly: AssemblyTitle("AfflictionsDebug")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.4.0.0")]
[module: UnverifiableCode]
[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 BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
{
}
}
}
namespace AfflictionsDebug
{
[BepInPlugin("com.github.Kirshoo.AfflictionsDebug", "AfflictionsDebug", "0.4.0")]
public class Plugin : BaseUnityPlugin
{
private const int leftOffset = 10;
private const int topOffset = 25;
private static ConfigEntry<bool> showTicks;
private GUIStyle? fontStyle;
public const string Id = "com.github.Kirshoo.AfflictionsDebug";
internal static ManualLogSource Log { get; private set; }
public static string Name => "AfflictionsDebug";
public static string Version => "0.4.0";
private void Awake()
{
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)("Plugin " + Name + " is loaded!"));
showTicks = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DamageTicks", false, "If set to true, damage displayed in debug display will be converted to ticks. Otherwise will show damage in percentage.");
}
private void LoadFont()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
if (fontStyle == null)
{
fontStyle = new GUIStyle(GUI.skin.label);
fontStyle.fontSize = 12;
fontStyle.fontStyle = (FontStyle)1;
}
}
private void CreateLabelWithBorder(Rect rect, string text, GUIStyle style, int borderSize = 1)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
style.normal.textColor = Color.black;
for (int i = -borderSize; i <= borderSize; i++)
{
for (int j = -borderSize; j <= borderSize; j++)
{
if (i != 0 || j != 0)
{
GUI.Label(new Rect(((Rect)(ref rect)).x + (float)i, ((Rect)(ref rect)).y + (float)j, ((Rect)(ref rect)).width, ((Rect)(ref rect)).height), text, style);
}
}
}
style.normal.textColor = Color.white;
GUI.Label(rect, text, style);
}
private void CreateAfflictionLabel(Affliction affliction, int afflictionNum)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
CreateLabelWithBorder(new Rect(10f, (float)(25 * afflictionNum), 800f, 25f), FormatAffliction(affliction), fontStyle);
}
public void OnGUI()
{
if ((Object)(object)Character.localCharacter == (Object)null)
{
return;
}
LoadFont();
int num = 1;
foreach (Affliction affliction in Character.localCharacter.refs.afflictions.afflictionList)
{
CreateAfflictionLabel(affliction, num);
num++;
}
}
private string FormatAffliction(Affliction affliction)
{
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
if (affliction == null)
{
return "";
}
Affliction_PoisonOverTime val = (Affliction_PoisonOverTime)(object)((affliction is Affliction_PoisonOverTime) ? affliction : null);
if (val != null)
{
return FormatPoisonOverTime(val);
}
Affliction_AdjustColdOverTime val2 = (Affliction_AdjustColdOverTime)(object)((affliction is Affliction_AdjustColdOverTime) ? affliction : null);
if (val2 != null)
{
return FormatColdOverTime(val2);
}
Affliction_AdjustDrowsyOverTime val3 = (Affliction_AdjustDrowsyOverTime)(object)((affliction is Affliction_AdjustDrowsyOverTime) ? affliction : null);
if (val3 != null)
{
return FormatDrowsyOverTime(val3);
}
return $"{affliction.GetAfflictionType()}: {affliction.totalTime - affliction.timeElapsed:F1}s";
}
private float ConvertToTicks(float value)
{
return Mathf.Floor(value / 0.025f);
}
private string StringConcatInternal(string afflictionName, string statusTimeLeft, string statusPerSecond, string statusToBeApplied, string totalStatus)
{
return $"{afflictionName}: {statusTimeLeft}; {statusPerSecond}; {statusToBeApplied}; {totalStatus}";
}
private string FormatPoisonOverTime(Affliction_PoisonOverTime pot)
{
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
float num = ((((Affliction)pot).timeElapsed > pot.delayBeforeEffect) ? (((Affliction)pot).totalTime - ((Affliction)pot).timeElapsed) : (((Affliction)pot).totalTime - pot.delayBeforeEffect));
string statusTimeLeft = ((((Affliction)pot).timeElapsed < pot.delayBeforeEffect) ? $"Damage in {pot.delayBeforeEffect - ((Affliction)pot).timeElapsed:F1}s" : $"Take damage for {((Affliction)pot).totalTime - ((Affliction)pot).timeElapsed:F1}s");
float num2 = pot.statusPerSecond;
float num3 = pot.statusPerSecond * num;
float num4 = pot.statusPerSecond * (((Affliction)pot).totalTime - pot.delayBeforeEffect);
if (showTicks.Value)
{
num2 = ConvertToTicks(num2);
num3 = ConvertToTicks(num3);
num4 = ConvertToTicks(num4);
}
string text = (showTicks.Value ? $"{num2:F0} ticks" : $"{num2 * 100f:F1}%");
string text2 = (showTicks.Value ? $"{num3:F0} ticks" : $"{num3 * 100f:F1}%");
string text3 = (showTicks.Value ? $"{num4:F0} ticks" : $"{num4 * 100f:F1}%");
AfflictionType afflictionType = ((Affliction)pot).GetAfflictionType();
return StringConcatInternal(((object)(AfflictionType)(ref afflictionType)).ToString(), statusTimeLeft, "Damage per second: " + text, "Total damage to take: " + text2, "Total damage: " + text3);
}
private string FormatColdOverTime(Affliction_AdjustColdOverTime cot)
{
//IL_00f1: 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)
float num = cot.statusPerSecond;
float num2 = cot.statusPerSecond * (((Affliction)cot).totalTime - ((Affliction)cot).timeElapsed);
float num3 = cot.statusPerSecond * ((Affliction)cot).totalTime;
if (showTicks.Value)
{
num = ConvertToTicks(num);
num2 = ConvertToTicks(num2);
num3 = ConvertToTicks(num3);
}
string text = (showTicks.Value ? $"{num:F0} ticks" : $"{num * 100f:F1}%");
string text2 = (showTicks.Value ? $"{num2:F0} ticks" : $"{num2 * 100f:F1}%");
string text3 = (showTicks.Value ? $"{num3:F0} ticks" : $"{num3 * 100f:F1}%");
AfflictionType afflictionType = ((Affliction)cot).GetAfflictionType();
return StringConcatInternal(((object)(AfflictionType)(ref afflictionType)).ToString(), "Take cold for " + $"{((Affliction)cot).totalTime - ((Affliction)cot).timeElapsed:F1}s", "Cold per second: " + text, "Total cold to take: " + text2, "Total cold: " + text3);
}
private string FormatDrowsyOverTime(Affliction_AdjustDrowsyOverTime dot)
{
//IL_00f1: 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)
float num = dot.statusPerSecond;
float num2 = dot.statusPerSecond * (((Affliction)dot).totalTime - ((Affliction)dot).timeElapsed);
float num3 = dot.statusPerSecond * ((Affliction)dot).totalTime;
if (showTicks.Value)
{
num = ConvertToTicks(num);
num2 = ConvertToTicks(num2);
num3 = ConvertToTicks(num3);
}
string text = (showTicks.Value ? $"{num:F0} ticks" : $"{num * 100f:F1}%");
string text2 = (showTicks.Value ? $"{num2:F0} ticks" : $"{num2 * 100f:F1}%");
string text3 = (showTicks.Value ? $"{num3:F0} ticks" : $"{num3 * 100f:F1}%");
AfflictionType afflictionType = ((Affliction)dot).GetAfflictionType();
return StringConcatInternal(((object)(AfflictionType)(ref afflictionType)).ToString(), "Take drowsy for " + $"{((Affliction)dot).totalTime - ((Affliction)dot).timeElapsed:F1}s", "Drowsy per second: " + text, "Total drowsy to take: " + text2, "Total drowsy: " + text3);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}