Decompiled source of SplashText v2.0.0

Mods/SplashText.dll

Decompiled 3 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BoneLib;
using BoneLib.BoneMenu;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSLZ.Bonelab.SaveData;
using Il2CppSLZ.Marrow.SceneStreaming;
using Il2CppSLZ.Marrow.Warehouse;
using Il2CppSystem;
using Il2CppTMPro;
using MelonLoader;
using MelonLoader.Preferences;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
using WeatherElectric.SplashText;
using WeatherElectric.SplashText.Melon;
using WeatherElectric.SplashText.Menu;
using WeatherElectric.SplashText.Scripts;
using WeatherElectric.SplashText.Scripts.Helpers;
using WeatherElectric.SplashText.Scripts.Lists;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Adds splash text to Void G114's menu.")]
[assembly: AssemblyDescription("Adds splash text to Void G114's menu.")]
[assembly: AssemblyCompany("Weather Electric")]
[assembly: AssemblyProduct("SplashText")]
[assembly: AssemblyCopyright("Developed by SoulWithMae")]
[assembly: AssemblyTrademark("Weather Electric")]
[assembly: AssemblyFileVersion("2.0.0")]
[assembly: MelonInfo(typeof(Main), "SplashText", "2.0.0", "SoulWithMae", "https://bonelab.thunderstore.io/package/SoulWithMae/SplashText/")]
[assembly: MelonColor(255, 255, 198, 0)]
[assembly: MelonGame("Stress Level Zero", "BONELAB")]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyVersion("2.0.0.0")]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace WeatherElectric.SplashText
{
	public class Main : MelonMod
	{
		internal const string Name = "SplashText";

		internal const string Description = "Adds splash text to Void G114's menu.";

		internal const string Author = "SoulWithMae";

		internal const string Company = "Weather Electric";

		internal const string Version = "2.0.0";

		internal const string DownloadLink = "https://bonelab.thunderstore.io/package/SoulWithMae/SplashText/";

		internal static Save SaveData;

		public override void OnInitializeMelon()
		{
			ModConsole.Setup(((MelonBase)this).LoggerInstance);
			Preferences.Setup();
			BoneMenu.Setup();
			UserData.Setup();
			SaveData = DataManager.ActiveSave;
			Hooking.OnUIRigCreated += OnUIRigCreated;
		}

		private static void OnUIRigCreated()
		{
			if (!(((Scannable)SceneStreamer.Session.Level).Barcode.ID != "fa534c5a868247138f50c62e424c4144.Level.VoidG114"))
			{
				TextManager.Start();
			}
		}
	}
}
namespace WeatherElectric.SplashText.Scripts
{
	internal static class TextManager
	{
		private static GameObject _splashTextHost;

		private static TextMeshPro _textMeshPro;

		public static void Start()
		{
			CreateGameObject();
			SetGameObjectPosition();
			SetText();
		}

		private static void CreateGameObject()
		{
			GameObject val = FuckYouSLZ("//-----UI");
			ModConsole.Msg("Found UI root: " + ((Object)val).name, 1);
			Transform obj = val.transform.Find("CANVAS_UX");
			ModConsole.Msg("Found canvas root", 1);
			Transform val2 = obj.Find("MENU");
			ModConsole.Msg("Found menu root", 1);
			GameObject gameObject = ((Component)val2.Find("txt_buildInfo")).gameObject;
			ModConsole.Msg("Found build info object", 1);
			_splashTextHost = Object.Instantiate<GameObject>(gameObject, ((Component)val2).transform);
			ModConsole.Msg("Created splash text host", 1);
			static GameObject FuckYouSLZ(string name)
			{
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				Scene activeScene = SceneManager.GetActiveScene();
				return ((IEnumerable<GameObject>)Il2CppArrayBase<GameObject>.op_Implicit((Il2CppArrayBase<GameObject>)(object)((Scene)(ref activeScene)).GetRootGameObjects())).FirstOrDefault((Func<GameObject, bool>)((GameObject rootObject) => ((Object)rootObject).name == name));
			}
		}

		private static void SetGameObjectPosition()
		{
			//IL_0033: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)_splashTextHost == (Object)null))
			{
				RectTransform component = _splashTextHost.GetComponent<RectTransform>();
				ModConsole.Msg("Got splash text rect", 1);
				((Transform)component).position = new Vector3(28.1982f, 2.1303f, -3.7628f);
				ModConsole.Msg("Set splash text position", 1);
				((Transform)component).rotation = Quaternion.Euler(0f, -180f, 30f);
				ModConsole.Msg("Set splash text rotation", 1);
				((Transform)component).localScale = new Vector3(10f, 10f, 10f);
				ModConsole.Msg("Set splash text scale", 1);
				((Object)_splashTextHost).name = "SplashTextHost";
				ModConsole.Msg("Renamed splash text host", 1);
				_textMeshPro = _splashTextHost.GetComponent<TextMeshPro>();
				((Graphic)_textMeshPro).color = Color.yellow;
			}
		}

		public static void SetText()
		{
			if (!((Object)(object)_textMeshPro == (Object)null))
			{
				switch (Preferences.SplashMode.Value)
				{
				case SplashMode.Minecraft:
					((TMP_Text)_textMeshPro).text = MinecraftSplashes.GetRandomSplash();
					break;
				case SplashMode.UserEntries:
					((TMP_Text)_textMeshPro).text = EntryHelper.GetRandomEntry();
					break;
				case SplashMode.Bonelab:
					SetBonelabSplash();
					break;
				case SplashMode.Terraria:
					((TMP_Text)_textMeshPro).text = TerrariaSplashes.GetRandomSplash();
					break;
				default:
					ModConsole.Error("Invalid splash mode! Defaulting to BONELAB.");
					SetBonelabSplash();
					break;
				}
			}
		}

		private static void SetBonelabSplash()
		{
			if (Preferences.OfflineMode.Value)
			{
				((TMP_Text)_textMeshPro).text = BonelabSplashes.GetRandomOfflineSplash();
			}
			else
			{
				BonelabSplashes.GetRandomOnlineSplash(Boobs);
			}
			static void Boobs(string text)
			{
				((TMP_Text)_textMeshPro).text = text;
			}
		}
	}
}
namespace WeatherElectric.SplashText.Scripts.Lists
{
	public static class BonelabSplashes
	{
		public delegate void FetchTextCallback(string fetchedText);

		private static readonly string[] Splashes = new string[49]
		{
			"Into the void with you!", "What up, son!", "Thursday, Yes, This Thursday!", "how i get spiderlab?", "bring back bonetome", "zonelab", "cam PLEAS give me the mono build", "why'd they make this game il2cpp", "Sadly On Quest!", "Also try Boneworks!",
			"Also try Duck Season!", "Also try Hover Junkers!", "Also try Half Life Alyx!", "Also try Nervbox!", "the blankbox entity is here", "rigmanager's null lol", "Fuck you Rican!", "today i will sync physics; duplicalte camera", "The new source of bodycam footage for edgy kids!", "I bet my life it'll be Thursday!",
			"evil brandon be like: i WILL release a update on thursday", "cant wait for project 4!", "MissingMethodException: Default constructor not found for type UnityEngine.Video.VideoPlayer", "TargetException: Instance constructor requires a target", "il2cpp compiler removing all useful components", "Invalid pallet.json!", "There you go!", "Pick it up!", "Put it down!", "Don't fence me in!",
			"Stuck inside this desert hell!", "Dogs are gonna get what you hold dear!", "Nulla Molles Accentus", "Faciem Coegi Vos", "I'm feelin so strange", "Ima Say Ma Namowa!", "Never enough photons.", "NEP.Paranoia.Scripts.Managers.ParanoiaManager!", "breadsoup's cooking \ud83d\udd25", "6 hour buffer fucking SUCKS",
			"i'm gonna put 9 realtime lights in the scene, suffer", "Only [PalletCount] mods installed? smh", "[CurrentAvatar]? what a lame avatar", "oh cool, [CurrentAvatar], thats a good avatar", "lol [Height]", "you really use [RandomFavoriteSpawnable]?", "you liked [RandomFavoriteAvatar] enough to put it in your BODYLOG?", "Holy shit, Patch 4 really came out!", "quest code modding died, rest in piss"
		};

		private const string SplashAPI = "https://splashtext.weatherelectric.xyz/";

		public static void GetRandomOnlineSplash(FetchTextCallback callback)
		{
			MelonCoroutines.Start(FetchText(callback));
		}

		private static IEnumerator FetchText(FetchTextCallback callback)
		{
			UnityWebRequest request = UnityWebRequest.Get("https://splashtext.weatherelectric.xyz/");
			UnityWebRequestAsyncOperation asyncOperation = request.SendWebRequest();
			while (!((AsyncOperation)asyncOperation).isDone)
			{
				yield return null;
			}
			if ((int)request.result == 1)
			{
				Random random = new Random();
				string text = request.downloadHandler.text;
				ModConsole.Msg("Text recieved: " + text, 1);
				if (text.Contains("[UserName]"))
				{
					text = text.Replace("[UserName]", Environment.UserName);
				}
				if (text.Contains("[PalletCount]"))
				{
					text = text.Replace("[PalletCount]", AssetWarehouse.Instance.GetPallets().Count.ToString());
				}
				if (text.Contains("[CurrentAvatar]"))
				{
					AvatarCrateReference val = new AvatarCrateReference(Main.SaveData.PlayerSettings.CurrentAvatar);
					text = text.Replace("[CurrentAvatar]", ((Scannable)((CrateReferenceT<AvatarCrate>)(object)val).Crate).Title);
				}
				if (text.Contains("[Height]"))
				{
					float playerHeight = Main.SaveData.PlayerSettings.PlayerHeight;
					int num = (int)playerHeight;
					float value = playerHeight - (float)num;
					text = text.Replace("[Height]", $"{num}'{value}\"");
				}
				if (text.Contains("[RandomFavoriteSpawnable]"))
				{
					SpawnableCrateReference val2 = new SpawnableCrateReference((Barcode)Object.op_Implicit(Main.SaveData.PlayerSettings.FavoriteSpawnables[random.Next(Main.SaveData.PlayerSettings.FavoriteSpawnables.Count)]));
					text = text.Replace("[RandomFavoriteSpawnable]", ((Scannable)((CrateReferenceT<SpawnableCrate>)(object)val2).Crate).Title);
				}
				if (text.Contains("[RandomFavoriteAvatar]"))
				{
					AvatarCrateReference val3 = new AvatarCrateReference((Barcode)Object.op_Implicit(Main.SaveData.PlayerSettings.FavoriteAvatars[random.Next(Main.SaveData.PlayerSettings.FavoriteAvatars.Count)]));
					text = text.Replace("[RandomFavoriteAvatar]", ((Scannable)((CrateReferenceT<AvatarCrate>)(object)val3).Crate).Title);
				}
				callback(text);
			}
			else
			{
				ModConsole.Error("Failed to fetch random text. Webserver is likely offline. Using backup method.");
				Result result = request.result;
				ModConsole.Error("Webrequest Result: " + ((object)(Result)(ref result)).ToString());
				result = request.result;
				if (result - 2 <= 1)
				{
					ModConsole.Error("Error: " + request.error);
				}
				callback(GetRandomOfflineSplash());
			}
		}

		public static string GetRandomOfflineSplash()
		{
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0157: Expected O, but got Unknown
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bb: Expected O, but got Unknown
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: Expected O, but got Unknown
			Random random = new Random();
			string text = Splashes[random.Next(Splashes.Length)];
			if (text.Contains("[PalletCount]"))
			{
				text = text.Replace("[PalletCount]", AssetWarehouse.Instance.GetPallets().Count.ToString());
			}
			if (text.Contains("[CurrentAvatar]"))
			{
				AvatarCrateReference val = new AvatarCrateReference(Main.SaveData.PlayerSettings.CurrentAvatar);
				text = text.Replace("[CurrentAvatar]", ((Scannable)((CrateReferenceT<AvatarCrate>)(object)val).Crate).Title);
			}
			if (text.Contains("[Height"))
			{
				float playerHeight = Main.SaveData.PlayerSettings.PlayerHeight;
				int num = (int)playerHeight;
				float value = playerHeight - (float)num;
				text = text.Replace("[Height]", $"{num}'{value}\"");
			}
			if (text.Contains("[UserName]"))
			{
				text = text.Replace("[UserName]", Environment.UserName);
			}
			if (text.Contains("[RandomFavoriteSpawnable]"))
			{
				SpawnableCrateReference val2 = new SpawnableCrateReference((Barcode)Object.op_Implicit(Main.SaveData.PlayerSettings.FavoriteSpawnables[random.Next(Main.SaveData.PlayerSettings.FavoriteSpawnables.Count)]));
				text = text.Replace("[RandomFavoriteSpawnable]", ((Scannable)((CrateReferenceT<SpawnableCrate>)(object)val2).Crate).Title);
			}
			if (text.Contains("[RandomFavoriteAvatar]"))
			{
				AvatarCrateReference val3 = new AvatarCrateReference((Barcode)Object.op_Implicit(Main.SaveData.PlayerSettings.FavoriteAvatars[random.Next(Main.SaveData.PlayerSettings.FavoriteAvatars.Count)]));
				text = text.Replace("[RandomFavoriteAvatar]", ((Scannable)((CrateReferenceT<AvatarCrate>)(object)val3).Crate).Title);
			}
			return text;
		}
	}
	public static class MinecraftSplashes
	{
		private static readonly string[] Splashes = new string[242]
		{
			"...!", ".party()!", "IS YOU! I HAVE MY FRIEND", "1% sugar!", "100% pure!", "10 years of Mining and Crafting! It’s a Minecraft anniversary!", "12 herbs and spices! It’s a parody of KFC?!", "12345 is a bad password! What should you do?", "150 bpm for 400000 minutes!", "150% hyperbole!",
			"20 GOTO 10!", "4815162342 lines of code!", "90% bug free!", "90210!", "A skeleton popped out!", "Absolutely fixed relatively broken coordinates?", "Absolutely no memes!", "Afraid of the big, black bat! You gonna run away", "Age of Wonders is better!", "Ahhhhhh!",
			"All inclusive!", "All is full of love! Even the Icelanders", "All rumors are true!", "\"Almost never\" is an interesting concept!", "Also try Braid!", "Also try Limbo!", "Also try Mount And Blade!", "Also try Pixeljunk Shooter!", "Also try Project Zomboid!", "Also try Super Meat Boy!",
			"Also try Terraria!", "Also try VVVVVV!", "Also try World of Goo!", "An illusion! What are you hiding?", "Any computer is a laptop if you're brave enough!", "A riddle, wrapped in a mystery!", "As seen on TV! “What the heck is this?!”", "Ask your doctor! If you have a syndrome,severe,headache etc", "\"Autological\" is…", "Autonomous!",
			"Awesome community!", "Awesome game design right there!", "Awesome! This is Cool", "Bees, bees, bees, bees!", "Bekarton guards the gate!", "Best in class!", "Big Pointy Teeth!", "Bigger than a bread box!", "Blue warrior shot the food!", "Boats FTW",
			"Boots with the fur!", "Bread is pain!", "Bring it on!", "Bring me Ray Cokes!", "Bringing home the bacon!", "BTAF used to be good!", "Buckets of lava!", "Buzzy Bees!", "Call your mother!", "Casual gaming!",
			"Ceci n'est pas une title screen!", "Check it out!", "Check out the far lands!", "Child's play!", "Classy!", "Closed source!", "Cloud computing!", "Cogito ergo sum!", "Collaborate and listen!", "Colormatic",
			"Complex cellular automata!", "Consummate V's!", "Conventional!", "Cow Tools!", "Create!", "Cruising streets for gold!", "Cześć Polsko!", "Déjà vu!", "Déjà vu!", "Do it all, everything!",
			"Do not distribute!", "Do you want to join my server?", "Does barrel rolls!", "Doesn't avoid double negatives!", "Doesn't use the U-word!", "Don't bother with the clones!", "Don't feed avocados to parrots!", "Don't feed chocolate to parrots!", "Don't look directly at the bugs!", "Don’t worry, be happy!",
			"doot doot", "Double buffered!", "Down with O.P.P.!", "DRR! DRR! DRR!", "Dungeon!", "DungeonQuest is unfair!", "Engage!", "Enhanced!", "Eple (original edit)!", "Euclidian!",
			"Excitement!", "Exclusive!", "Exploding creepers!", "Extra things!", "Falling off cliffs!", "Falling with style!", "Fan fiction!", "Fantasy!", "Fat free!", "Feature packed!",
			"Finally complete!", "Finally with ladders!", "Finger-licking!", "Flashing letters!", "Flavor with no seasoning!", "Flaxkikare!", "Fnord!", "Follow the train, CJ!", "Freaky!", "Free dental!",
			"From the streets of Södermalm!", "Full of stars!", "Funk soul brother!", "FUNKY LOL", "Gargamel plays it!", "Gasp!", "Getting ready to drop!", "Getting ready to freak!", "Getting ready to know!", "Getting ready to shock!",
			"Getting ready to show!", "Getting ready to speak!", "Ghoughpteighbteau tchoghs!", "Replaced molten cheese with blood?", "Representing Edsbyn!", "Reticulating splines!", "Ride the pig!", "Rise from your grave!", "Rita is the new top dog!", "Rule #1: it's never my fault",
			"Run, coward! I hunger!", "Ryan also has amazing hair!", "Scary!", "See you next Friday or so!", "Seecret Friday update!", "Sensational!", "Sexy!", "Should not be played while driving", "Singleplayer!", "Slow acting portals!",
			"So fresh, so clean!", "Something funny!", "Something's not quite right...", "So sweet, like a nice bon bon!", "Spiders everywhere!", "sqrt(-1) love you!", "Stay a while, stay forever!", "Stay a while and listen!", "Stop being reasonable, this is the Internet!", "Stop, hammertime!",
			"Strange, but not a stranger!", "Sublime!", "Supercalifragilisticexpialidocious!", "Survive!", "Switches and ores!", "SWM forever!", "Swords for everyone!", "Synecdoche!", "Take an eggbeater and beat it against a skillet!", "Take frequent breaks!",
			"Take her pillow!", "Take the elevator to the mezzanine!", "Technically good!", "Technologic!", "Teetsuuuuoooo!", "Tell your friends!", "Terrestrial!", "Testificates!", "Thank you for the fish!", "That's no moon!",
			"That's Numberwang!", "That's super!", "The bee's knees!", "The creeper is a spy!", "The sky is the limit!", "The sum of its parts!", "The true meaning of covfefe", "There's no stopping the Trollmaso", "This is good for Realms.", "This is my true form!",
			"This message will never appear on the splash screen, isn't that weird?", "This text is hard to read if you play the game at the default resolution, but at 1080p it's fine!", "Thousands of colors!", "Throw a blanket over it!", "Throw yourself at the ground and miss", "Tip your waiter!", "Totally forgot about Dre!", "Tougher than diamonds, rich like cream!", "Treatment for your rash!", "Truly gone fishing!",
			"Try it!", "Try the mushroom stew!", "Try the Nether!", "Twittered about!", "Turing complete!", "Tyrion would love it!", "Ultimate edition!", "umop-apisdn!", "Undefeated!", "Undocumented!",
			"Une baguette!", "Uninflammable!", "Uses LWJGL!", "Verlet intregration!", "Very fun!", "Very influential in its circle!", "Vote for net neutrality!", "Warning! A huge battleship \"STEVE\" is approaching fast!", "Water bottle!", "Water proof!",
			"Welcome to your Doom!", "What do you expect?", "What’s the question?", "What's up, Doc?", "Where there is not light, there can spider!", "Who put it there?", "Whoa, dude!", "Woah.", "Woo, /v/!", "Woo, facepunch!",
			"Woo, reddit!", "Woo, 2pp!", "Woo, somethingawful!", "Woo, tigsource!", "Woo, worldofminecraft!", "Wow!", "Yaaay!", "Yay, puppies for everyone!", "Yes, sir!", "You can't explain that!",
			"You're going too fast!", "You've got a brand new key!"
		};

		public static string GetRandomSplash()
		{
			Random random = new Random();
			string text = Splashes[random.Next(Splashes.Length)];
			if (text.Contains("IS YOU! I HAVE MY FRIEND"))
			{
				text = Environment.UserName + " IS YOU! I HAVE MY FRIEND";
			}
			return text;
		}
	}
	public static class TerrariaSplashes
	{
		private static readonly string[] Splashes = new string[68]
		{
			"Dig Peon, Dig!", "Epic Dirt", "Adaman-TIGHT!", "Sand is Overpowered", "Terraria Part 3: The Return of the Guide", "A Bunnies Tale", "Dr. Bones and the Temple of Blood Moon", "Slimeassic Park", "The Grass Is Greener on This Side", "Small Blocks, Not For Children Under the Age of 5",
			"Digger T' Blocks", "There is No Cow Layer", "Suspicious Looking Eyeballs", "Purple Grass!", "No one Dug Behind!", "The Water Fall Of Content!", "Earthbound", "Dig Dug Ain't Got Nuthin On Me", "Ore's Well That Ends Well", "Judgement Clay",
			"Terrestrial Trouble", "Obsessive-Compulsive Discovery Simulator", "Red Dev Redemption", "Rise of The Slimes", "Now with more things to kill you!", "Rumors of the Guide's death were greatly exaggerated", "I Pity the Tools...", "A spelunker says 'What'?", "So then I said 'Something about a PC update...'", "May the blocks be with you",
			"Better than life", "Now in 1D", "Coming soon to a computer near you", "Dividing by zero", "Now with SOUND", "Press alt-f4", "I Pity the Tools", "You sand bro?", "A good day to dig hard", "Can you Re-Dig-It?",
			"I don't know that-- aaaaa!", "What's that purple spiked thing?", "I wanna be the guide", "Cthulhu is mad.. and is missing an eye!", "NOT THE BEES!!!", "Legend of Maxx", "Cult of Cenx", "Terraria 2: Electric Boogaloo", "Also try Minecraft!", "Also try Edge of Space!",
			"Also try Breath of the Wild!", "I just wanna know where the gold at?", "Now with more ducks!", "9+1=11", "1+1=10", "Infinite Plantera", "Also try Stardew Valley!", "Also try Core Keeper!", "Also try Project Zomboid!", "Now with microtransactions!",
			"Built on Blockchain Teechnology", "Now with even less Ocram!", "Touch Grass Simulator", "Don't dig up!", "For the worthy!", "Now with even more Ocram!", "Shut Up and Dig Gaiden!", "Also try Don't Starve!"
		};

		public static string GetRandomSplash()
		{
			Random random = new Random();
			return Splashes[random.Next(Splashes.Length)];
		}
	}
}
namespace WeatherElectric.SplashText.Scripts.Helpers
{
	internal static class EntryHelper
	{
		public static string GetRandomEntry()
		{
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Expected O, but got Unknown
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Expected O, but got Unknown
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Expected O, but got Unknown
			//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Expected O, but got Unknown
			//IL_01be: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Expected O, but got Unknown
			Random random = new Random();
			string[] array = File.ReadAllLines(UserData.EntriesPath);
			int num = random.Next(array.Length);
			string text = array[num];
			if (text.Contains("[UserName]"))
			{
				text = text.Replace("[UserName]", Environment.UserName);
			}
			if (text.Contains("[PalletCount]"))
			{
				text = text.Replace("[PalletCount]", AssetWarehouse.Instance.GetPallets().Count.ToString());
			}
			if (text.Contains("[CurrentAvatar]"))
			{
				AvatarCrateReference val = new AvatarCrateReference(Main.SaveData.PlayerSettings.CurrentAvatar);
				text = text.Replace("[CurrentAvatar]", ((Scannable)((CrateReferenceT<AvatarCrate>)(object)val).Crate).Title);
			}
			if (text.Contains("[Height"))
			{
				float playerHeight = Main.SaveData.PlayerSettings.PlayerHeight;
				int num2 = (int)playerHeight;
				float value = playerHeight - (float)num2;
				text = text.Replace("[Height]", $"{num2}'{value}\"");
			}
			if (text.Contains("[RandomFavoriteSpawnable]"))
			{
				SpawnableCrateReference val2 = new SpawnableCrateReference((Barcode)Object.op_Implicit(Main.SaveData.PlayerSettings.FavoriteSpawnables[random.Next(Main.SaveData.PlayerSettings.FavoriteSpawnables.Count)]));
				text = text.Replace("[RandomFavoriteSpawnable]", ((Scannable)((CrateReferenceT<SpawnableCrate>)(object)val2).Crate).Title);
			}
			if (text.Contains("[RandomFavoriteAvatar]"))
			{
				AvatarCrateReference val3 = new AvatarCrateReference((Barcode)Object.op_Implicit(Main.SaveData.PlayerSettings.FavoriteAvatars[random.Next(Main.SaveData.PlayerSettings.FavoriteAvatars.Count)]));
				text = text.Replace("[RandomFavoriteAvatar]", ((Scannable)((CrateReferenceT<AvatarCrate>)(object)val3).Crate).Title);
			}
			return text;
		}
	}
}
namespace WeatherElectric.SplashText.Melon
{
	internal static class ModConsole
	{
		private static Instance _logger;

		public static void Setup(Instance loggerInstance)
		{
			_logger = loggerInstance;
		}

		public static void Msg(object obj, int loggingMode = 0)
		{
			string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString());
			ConsoleColor consoleColor = ((loggingMode == 1) ? ConsoleColor.Yellow : ConsoleColor.Gray);
			if (Preferences.LoggingMode.Value >= loggingMode)
			{
				_logger.Msg(consoleColor, text);
			}
		}

		public static void Msg(string txt, int loggingMode = 0)
		{
			string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
			ConsoleColor consoleColor = ((loggingMode == 1) ? ConsoleColor.Yellow : ConsoleColor.Gray);
			if (Preferences.LoggingMode.Value >= loggingMode)
			{
				_logger.Msg(consoleColor, text);
			}
		}

		public static void Msg(ConsoleColor txtcolor, object obj, int loggingMode = 0)
		{
			string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString());
			if (Preferences.LoggingMode.Value >= loggingMode)
			{
				_logger.Msg(txtcolor, text);
			}
		}

		public static void Msg(ConsoleColor txtcolor, string txt, int loggingMode = 0)
		{
			string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
			if (Preferences.LoggingMode.Value >= loggingMode)
			{
				_logger.Msg(txtcolor, text);
			}
		}

		public static void Msg(string txt, int loggingMode = 0, params object[] args)
		{
			string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
			ConsoleColor consoleColor = ((loggingMode == 1) ? ConsoleColor.Yellow : ConsoleColor.Gray);
			if (Preferences.LoggingMode.Value >= loggingMode)
			{
				_logger.Msg(consoleColor, text, args);
			}
		}

		public static void Msg(ConsoleColor txtcolor, string txt, int loggingMode = 0, params object[] args)
		{
			string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
			if (Preferences.LoggingMode.Value >= loggingMode)
			{
				_logger.Msg(txtcolor, text, args);
			}
		}

		public static void Error(object obj, int loggingMode = 0)
		{
			string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString());
			if (Preferences.LoggingMode.Value >= loggingMode)
			{
				_logger.Error(text);
			}
		}

		public static void Error(string txt, int loggingMode = 0)
		{
			string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
			if (Preferences.LoggingMode.Value >= loggingMode)
			{
				_logger.Error(text);
			}
		}

		public static void Error(string txt, int loggingMode = 0, params object[] args)
		{
			string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
			if (Preferences.LoggingMode.Value >= loggingMode)
			{
				_logger.Error(text, args);
			}
		}

		public static void Warning(object obj, int loggingMode = 0)
		{
			string text = ((loggingMode == 1) ? $"[DEBUG] {obj}" : obj.ToString());
			if (Preferences.LoggingMode.Value >= loggingMode)
			{
				_logger.Warning(text);
			}
		}

		public static void Warning(string txt, int loggingMode = 0)
		{
			string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
			if (Preferences.LoggingMode.Value >= loggingMode)
			{
				_logger.Warning(text);
			}
		}

		public static void Warning(string txt, int loggingMode = 0, params object[] args)
		{
			string text = ((loggingMode == 1) ? ("[DEBUG] " + txt) : txt);
			if (Preferences.LoggingMode.Value >= loggingMode)
			{
				_logger.Warning(text, args);
			}
		}
	}
	internal static class Preferences
	{
		public static readonly MelonPreferences_Category GlobalCategory = MelonPreferences.CreateCategory("Global");

		public static readonly MelonPreferences_Category OwnCategory = MelonPreferences.CreateCategory("SplashText");

		public static MelonPreferences_Entry<int> LoggingMode { get; set; }

		public static MelonPreferences_Entry<bool> OfflineMode { get; set; }

		public static MelonPreferences_Entry<SplashMode> SplashMode { get; set; }

		public static void Setup()
		{
			LoggingMode = GlobalCategory.GetEntry<int>("LoggingMode") ?? GlobalCategory.CreateEntry<int>("LoggingMode", 0, "Logging Mode", "The level of logging to use. 0 = Important Only, 1 = All", false, false, (ValueValidator)null, (string)null);
			GlobalCategory.SetFilePath(MelonEnvironment.UserDataDirectory + "/WeatherElectric.cfg");
			GlobalCategory.SaveToFile(false);
			OfflineMode = OwnCategory.CreateEntry<bool>("OfflineMode", false, "Offline Mode", "If true, the mod will not fetch splash text from an external webserver. However, you will also not get any updates to the splash text list.", false, false, (ValueValidator)null, (string)null);
			SplashMode = OwnCategory.CreateEntry<SplashMode>("SplashMode", WeatherElectric.SplashText.Melon.SplashMode.Bonelab, "Splash Mode", "The mode to use for splash text. UserEntries = Use user entries, Minecraft = Use Minecraft splash text, Bonelab = Use Bonelab/Bonelab community related splash text. Terraria = Use Terraria splash text.", false, false, (ValueValidator)null, (string)null);
			OwnCategory.SetFilePath(MelonEnvironment.UserDataDirectory + "/WeatherElectric.cfg");
			OwnCategory.SaveToFile(false);
			ModConsole.Msg("Finished preferences setup for SplashText", 1);
		}
	}
	internal enum SplashMode
	{
		UserEntries,
		Minecraft,
		Bonelab,
		Terraria
	}
	internal static class UserData
	{
		private static readonly string WeatherElectricPath = Path.Combine(MelonEnvironment.UserDataDirectory, "Weather Electric");

		private static readonly string ModPath = Path.Combine(MelonEnvironment.UserDataDirectory, "Weather Electric/SplashText");

		public static readonly string EntriesPath = Path.Combine(ModPath, "UserEntries.txt");

		public static void Setup()
		{
			if (!Directory.Exists(WeatherElectricPath))
			{
				Directory.CreateDirectory(WeatherElectricPath);
			}
			if (!Directory.Exists(ModPath))
			{
				Directory.CreateDirectory(ModPath);
			}
			if (!File.Exists(EntriesPath))
			{
				File.Create(EntriesPath).Close();
			}
		}
	}
}
namespace WeatherElectric.SplashText.Menu
{
	internal static class BoneMenu
	{
		public static void Setup()
		{
			//IL_000a: 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_002c: Unknown result type (might be due to invalid IL or missing references)
			Page.Root.CreatePage("<color=#6FBDFF>Weather Electric</color>", Color.white, 0, true).CreatePage("Splash Text", Color.yellow, 0, true).CreateEnum("Splash Mode", Color.white, (Enum)Preferences.SplashMode.Value, (Action<Enum>)delegate(Enum v)
			{
				Preferences.SplashMode.Value = (SplashMode)(object)v;
				Preferences.OwnCategory.SaveToFile(false);
				TextManager.SetText();
			});
		}
	}
	internal static class BoneMenuExtensions
	{
		public static BoolElement CreateBoolPreference(this Page category, string name, Color color, MelonPreferences_Entry<bool> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			return category.CreateBool(name, color, pref.Value, (Action<bool>)delegate(bool v)
			{
				pref.Value = v;
				if (autoSave)
				{
					prefCategory.SaveToFile(false);
				}
			});
		}

		public static FloatElement CreateFloatPreference(this Page category, string name, Color color, float increment, float min, float max, MelonPreferences_Entry<float> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			return category.CreateFloat(name, color, pref.Value, increment, min, max, (Action<float>)delegate(float v)
			{
				pref.Value = v;
				if (autoSave)
				{
					prefCategory.SaveToFile(false);
				}
			});
		}

		public static IntElement CreateIntPreference(this Page category, string name, Color color, int increment, int min, int max, MelonPreferences_Entry<int> pref, MelonPreferences_Category prefCategory, bool autoSave = true)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			return category.CreateInt(name, color, pref.Value, increment, min, max, (Action<int>)delegate(int v)
			{
				pref.Value = v;
				if (autoSave)
				{
					prefCategory.SaveToFile(false);
				}
			});
		}

		public static EnumElement CreateEnumPreference(this Page category, string name, Color color, Enum pref, MelonPreferences_Category prefCategory, bool autoSave = true)
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			return category.CreateEnum(name, color, pref, (Action<Enum>)delegate(Enum v)
			{
				pref = v;
				if (autoSave)
				{
					prefCategory.SaveToFile(false);
				}
			});
		}
	}
}