using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Unity.IL2CPP;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem;
using Microsoft.CodeAnalysis;
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("LanternPercent")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LanternPercent")]
[assembly: AssemblyTitle("LanternPercent")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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]
[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 BigWalkLanternPercent
{
[BepInPlugin("com.tetraflash.bigwalk.BigWalkLanternPercent", "Lantern Percent", "1.0.2")]
public class LanternPercentPlugin : BasePlugin
{
public override void Load()
{
((BasePlugin)this).Log.LogInfo((object)"Lantern Percent Mod has loaded!");
ClassInjector.RegisterTypeInIl2Cpp<TextBehaviour>();
((BasePlugin)this).AddComponent<TextBehaviour>();
}
}
public class TextBehaviour : MonoBehaviour
{
private int litBuoys = 0;
private int totalBuoys = 0;
private string displayText = "Initializing Scanner...";
private float timer = 0f;
private float updateInterval = 0.5f;
private int currentFontSize = 36;
private bool showPercentage = false;
public TextBehaviour(IntPtr handle)
: base(handle)
{
}
private void Update()
{
if (Input.GetKey((KeyCode)308) || Input.GetKey((KeyCode)307))
{
if (Input.GetKeyDown((KeyCode)61) || Input.GetKeyDown((KeyCode)270))
{
currentFontSize += 2;
}
else if (Input.GetKeyDown((KeyCode)45) || Input.GetKeyDown((KeyCode)269))
{
currentFontSize = Mathf.Max(10, currentFontSize - 2);
}
}
if ((Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)) && Input.GetKeyDown((KeyCode)53))
{
showPercentage = !showPercentage;
UpdateBuoyCount();
}
timer += Time.deltaTime;
if (timer >= updateInterval)
{
timer = 0f;
UpdateBuoyCount();
}
}
private void UpdateBuoyCount()
{
try
{
Il2CppArrayBase<PropKernal> val = Object.FindObjectsOfType<PropKernal>();
if (val == null)
{
return;
}
int num = 0;
int num2 = 0;
foreach (PropKernal item in val)
{
Transform val2 = ((Component)item).transform.Find("buoy");
Transform val3 = ((Component)item).transform.Find("bouyLight");
if ((Object)(object)val2 != (Object)null)
{
num++;
if ((Object)(object)val3 != (Object)null && ((Component)val3).gameObject.activeInHierarchy)
{
num2++;
}
}
}
totalBuoys = num;
litBuoys = num2;
int num3 = ((totalBuoys > 0) ? Mathf.RoundToInt((float)litBuoys / (float)totalBuoys * 100f) : 0);
if (litBuoys == totalBuoys && totalBuoys > 0)
{
string input = "Congratulations on Completing Lantern Percent!!!";
displayText = MakeRainbowText(input);
return;
}
displayText = $"Lit Buoys: {litBuoys} / {totalBuoys}";
if (showPercentage)
{
displayText += $" ({num3}%)";
}
}
catch (Exception ex)
{
Debug.LogError(Object.op_Implicit("Error counting buoys: " + ex.Message));
}
}
private string MakeRainbowText(string input)
{
string[] array = new string[6] { "#FF0000", "#FF7F00", "#FFFF00", "#00FF00", "#0000FF", "#9400D3" };
string text = "";
int num = 0;
for (int i = 0; i < input.Length; i++)
{
char c = input[i];
if (c == ' ')
{
text += c;
continue;
}
text += $"<color={array[num]}>{c}</color>";
num = (num + 1) % array.Length;
}
return text;
}
private void OnGUI()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_003d: 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_0064: Expected O, but got Unknown
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: 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)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
if (totalBuoys != 0)
{
GUIStyle val = new GUIStyle();
val.fontSize = currentFontSize;
val.normal.textColor = new Color(1f, 0.5f, 0f);
val.alignment = (TextAnchor)4;
val.richText = true;
GUIContent val2 = new GUIContent(displayText);
Vector2 val3 = val.CalcSize(val2);
float num = val3.x + 20f;
float num2 = val3.y + 10f;
float num3 = (float)Screen.width - num - 20f;
float num4 = 20f;
Rect val4 = default(Rect);
((Rect)(ref val4))..ctor(num3, num4, num, num2);
Color color = GUI.color;
GUI.color = new Color(0f, 0f, 0f, 0.6f);
GUI.DrawTexture(val4, (Texture)(object)Texture2D.whiteTexture);
GUI.color = color;
GUI.Label(val4, val2, val);
}
}
}
}