Decompiled source of ShipLootPlus v1.1.0
BepInEx/patchers/ShipLootPlusPreloader.dll
Decompiled 8 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx.Logging; using HarmonyLib; using Mono.Cecil; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ShipLootPlusPreloader")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ShipLootPlusPreloader")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("f1697523-6464-4d07-91c7-7968cfc0b824")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace BepInEx.ShipLootPlusPreloader; public class NeuteredAssembly { public string Name; public string FullName; } public static class Patcher { internal static ManualLogSource Logger = Logger.CreateLogSource(Id); public static List<NeuteredAssembly> neuteredAssemblies = new List<NeuteredAssembly> { new NeuteredAssembly { Name = "ShipLoot", FullName = "ShipLoot.ShipLoot" } }; public static string Id => "ShipLootPlus.Preloader"; public static IEnumerable<string> TargetDLLs { get; } = new string[0]; public static void Initialize() { Logger.LogInfo((object)"Initializing preloader event hooks"); AppDomain.CurrentDomain.AssemblyLoad += CurrentDomain_AssemblyLoad; } private static void CurrentDomain_AssemblyLoad(object sender, AssemblyLoadEventArgs e) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown Harmony val = new Harmony(Id); Assembly loadedAssembly = e.LoadedAssembly; NeuteredAssembly neuteredAssembly = neuteredAssemblies.FirstOrDefault((NeuteredAssembly a) => Regex.IsMatch(loadedAssembly.FullName, "^" + Regex.Escape(a.Name) + ",", RegexOptions.IgnoreCase)); if (neuteredAssembly == null) { return; } Logger.LogMessage((object)("Found plugin to neuter: " + neuteredAssembly.Name + " (" + loadedAssembly.FullName + ")")); HarmonyMethod val2 = new HarmonyMethod(typeof(Patcher).GetMethod("Neuter", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy)); Type[] types = loadedAssembly.GetTypes(); foreach (Type type in types) { if (!(type.FullName == neuteredAssembly.FullName)) { continue; } MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == "Awake") { Logger.LogMessage((object)("Attempting to remove 'Awake' from: " + neuteredAssembly.Name + " (" + loadedAssembly.FullName + ")")); try { val.Patch((MethodBase)methodInfo, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Logger.LogMessage((object)("Successfully neutered: " + neuteredAssembly.Name + " (" + loadedAssembly.FullName + ")")); } catch (Exception ex) { Logger.LogError((object)("Failed to neuter: " + neuteredAssembly.Name + " (" + loadedAssembly.FullName + ")")); Logger.LogError((object)("Exception: " + ex.Message)); } } } } } private static bool Neuter() { return false; } public static void Patch(AssemblyDefinition _) { } }
BepInEx/plugins/Figgle.dll
Decompiled 8 months agousing System; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("Drew Noakes")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyCopyright("Copyright Drew Noakes 2017-2023")] [assembly: AssemblyDescription("ASCII banner generation for .NET")] [assembly: AssemblyFileVersion("0.5.1.0")] [assembly: AssemblyInformationalVersion("0.5.1+83b4a47d24d50442e09efa6c4a0d9a32c68e3f4d")] [assembly: AssemblyProduct("Figgle")] [assembly: AssemblyTitle("Figgle")] [assembly: AssemblyMetadata("RepositoryUrl", "https://github.com/drewnoakes/figgle.git")] [assembly: AssemblyVersion("0.5.1.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class IsReadOnlyAttribute : Attribute { } [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 Figgle { public sealed class FiggleException : Exception { public FiggleException(string message) : base(message) { } } internal readonly struct Line { public string Content { get; } public byte SpaceBefore { get; } public byte SpaceAfter { get; } public char FrontChar { get { if (Content.Length != SpaceBefore) { return Content[SpaceBefore]; } return ' '; } } public char BackChar { get { if (Content.Length != SpaceAfter) { return Content[Content.Length - SpaceAfter - 1]; } return ' '; } } public Line(string content, byte spaceBefore, byte spaceAfter) { Content = content; SpaceBefore = spaceBefore; SpaceAfter = spaceAfter; } } internal sealed class FiggleCharacter { public IReadOnlyList<Line> Lines { get; } public FiggleCharacter(IReadOnlyList<Line> lines) { Lines = lines; } } public enum FiggleTextDirection { LeftToRight, RightToLeft } public sealed class FiggleFont { private readonly IReadOnlyList<FiggleCharacter> _requiredCharacters; private readonly IReadOnlyDictionary<int, FiggleCharacter> _sparseCharacters; private readonly char _hardBlank; private readonly int _smushMode; private const int SM_SMUSH = 128; private const int SM_KERN = 64; private const int SM_HARDBLANK = 32; private const int SM_BIGX = 16; private const int SM_PAIR = 8; private const int SM_HIERARCHY = 4; private const int SM_LOWLINE = 2; private const int SM_EQUAL = 1; private const int SM_FULLWIDTH = 0; public int Height { get; } public int Baseline { get; } public FiggleTextDirection Direction { get; } internal FiggleFont(IReadOnlyList<FiggleCharacter> requiredCharacters, IReadOnlyDictionary<int, FiggleCharacter> sparseCharacters, char hardBlank, int height, int baseline, FiggleTextDirection direction, int smushMode) { _requiredCharacters = requiredCharacters; _sparseCharacters = sparseCharacters; _hardBlank = hardBlank; _smushMode = smushMode; Height = height; Baseline = baseline; Direction = direction; } private FiggleCharacter GetCharacter(char c) { if (c < '\0' || c > 'ÿ') { _sparseCharacters.TryGetValue(c, out FiggleCharacter value); return value ?? _requiredCharacters[0]; } return _requiredCharacters[c] ?? _requiredCharacters[0]; } public bool Contains(char c) { if (c < '\0' || c > 'ÿ') { return _sparseCharacters.ContainsKey(c); } return _requiredCharacters[c] != null; } public string Render(string message, int? smushOverride = null) { int smush = smushOverride ?? _smushMode; List<StringBuilder> list = (from _ in Enumerable.Range(0, Height) select new StringBuilder()).ToList(); FiggleCharacter figgleCharacter = null; foreach (char c in message) { FiggleCharacter character = GetCharacter(c); if (character == null) { continue; } int num = CalculateFitMove(figgleCharacter, character); for (int j = 0; j < Height; j++) { Line line = character.Lines[j]; StringBuilder stringBuilder = list[j]; if (num != 0) { int num2 = num; if (figgleCharacter != null) { byte spaceAfter = figgleCharacter.Lines[j].SpaceAfter; if (spaceAfter != 0) { int num3 = Math.Min(spaceAfter, num2); for (int k = 0; k < num3; k++) { if (stringBuilder[stringBuilder.Length - 1] != ' ') { break; } num2--; stringBuilder.Length--; } } } int num4 = stringBuilder.Length - 1; char l2 = stringBuilder[num4]; stringBuilder.Append((num2 == 0) ? line.Content : line.Content.Substring(num2)); if (num2 != 0 && stringBuilder.Length != 0 && character.Lines[j].Content.Length != 0) { char r2 = character.Lines[j].Content[num2 - 1]; char c2 = TrySmush(l2, r2); if (c2 != 0 && num4 >= 0) { stringBuilder[num4] = c2; } } } else { stringBuilder.Append(line.Content); } } figgleCharacter = character; } StringBuilder stringBuilder2 = new StringBuilder(); foreach (StringBuilder item in list) { stringBuilder2.AppendLine(item.Replace(_hardBlank, ' ').ToString()); } return stringBuilder2.ToString(); int CalculateFitMove(FiggleCharacter? l, FiggleCharacter r) { if (smush == 0) { return 0; } if (l == null) { return 0; } int num5 = int.MaxValue; for (int m = 0; m < Height; m++) { Line line2 = l.Lines[m]; Line line3 = r.Lines[m]; int num6 = line2.SpaceAfter + line3.SpaceBefore; if (TrySmush(line2.BackChar, line3.FrontChar) != 0) { num6++; } num6 = Math.Min(num6, line3.Content.Length); if (num6 < num5) { num5 = num6; } } return num5; } char TrySmush(char l, char r) { if (l == ' ') { return r; } if (r == ' ') { return l; } if ((_smushMode & 0x80) == 0) { return '\0'; } if ((_smushMode & 0x3F) == 0) { if (l == _hardBlank) { return r; } if (r == _hardBlank) { return l; } if (Direction != 0) { return l; } return r; } if (((uint)_smushMode & 0x20u) != 0 && l == _hardBlank && r == _hardBlank) { return l; } if (l == _hardBlank && r == _hardBlank) { return '\0'; } if (((uint)_smushMode & (true ? 1u : 0u)) != 0 && l == r) { return l; } if (((uint)_smushMode & 2u) != 0) { if (l == '_' && Enumerable.Contains("|/\\[]{}()<>", r)) { return r; } if (r == '_' && Enumerable.Contains("|/\\[]{}()<>", l)) { return l; } } if (((uint)_smushMode & 4u) != 0) { if (l == '|' && Enumerable.Contains("/\\[]{}()<>", r)) { return r; } if (r == '|' && Enumerable.Contains("/\\[]{}()<>", l)) { return l; } if (Enumerable.Contains("/\\", l) && Enumerable.Contains("[]{}()<>", r)) { return r; } if (Enumerable.Contains("/\\", r) && Enumerable.Contains("[]{}()<>", l)) { return l; } if (Enumerable.Contains("[]", l) && Enumerable.Contains("{}()<>", r)) { return r; } if (Enumerable.Contains("[]", r) && Enumerable.Contains("{}()<>", l)) { return l; } if (Enumerable.Contains("{}", l) && Enumerable.Contains("()<>", r)) { return r; } if (Enumerable.Contains("{}", r) && Enumerable.Contains("()<>", l)) { return l; } if (Enumerable.Contains("()", l) && Enumerable.Contains("<>", r)) { return r; } if (Enumerable.Contains("()", r) && Enumerable.Contains("<>", l)) { return l; } } if (((uint)_smushMode & 8u) != 0) { if (l == '[' && r == ']') { return '|'; } if (r == '[' && l == ']') { return '|'; } if (l == '{' && r == '}') { return '|'; } if (r == '{' && l == '}') { return '|'; } if (l == '(' && r == ')') { return '|'; } if (r == '(' && l == ')') { return '|'; } } if (((uint)_smushMode & 0x10u) != 0) { if (l == '/' && r == '\\') { return '|'; } if (r == '/' && l == '\\') { return 'Y'; } if (l == '>' && r == '<') { return 'X'; } } return '\0'; } } } public static class FiggleFontParser { private const int SM_SMUSH = 128; private const int SM_KERN = 64; private const int SM_FULLWIDTH = 0; private static readonly Regex _firstLinePattern = new Regex("^flf2 # signature\r\n a # always 'a'\r\n (?<hardblank>.) # any single character\r\n \\s(?<height>\\d+) # the number of rows, shared across all characters\r\n \\s(?<baseline>\\d+) # the number of rows from the top of the char to the baseline (excludes descenders)\r\n \\s(\\d+) # the maximum width of character data in the file, including endmarks\r\n \\s(?<layoutold>-?\\d+) # layout settings (old format)\r\n \\s(?<commentlinecount>\\d+) # number of comment lines after first line, before first character\r\n (\\s(?<direction>\\d+))? # print direction (0 is left-to-right, 1 is right-to-left)\r\n (\\s(?<layoutnew>\\d+))? # layout settings (new format)\r\n (\\s(\\d+))? # number of code-tagged (non-required) characters in the font, equal to total number of characters minus 102\r\n (\\s|$)", RegexOptions.Compiled | RegexOptions.IgnorePatternWhitespace); public static FiggleFont Parse(Stream stream, StringPool? pool = null) { StringPool pool2 = pool; if (stream == null) { throw new ArgumentNullException("stream"); } StreamReader reader = new StreamReader(stream); string text = reader.ReadLine(); if (text == null) { throw new FiggleException("Font file is empty."); } Match match = _firstLinePattern.Match(text); if (!match.Success) { throw new FiggleException("Font file has invalid first line."); } char hardBlank = match.Groups["hardblank"].Value[0]; int height = int.Parse(match.Groups["height"].Value); int baseline = int.Parse(match.Groups["baseline"].Value); int layoutOld = int.Parse(match.Groups["layoutold"].Value); int num = int.Parse(match.Groups["commentlinecount"].Value); Group group = match.Groups["layoutnew"]; int smushMode = (group.Success ? int.Parse(group.Value) : UpgradeLayout()); Group group2 = match.Groups["direction"]; FiggleTextDirection direction = (group2.Success ? ((FiggleTextDirection)int.Parse(group2.Value)) : FiggleTextDirection.LeftToRight); for (int i = 0; i < num; i++) { reader.ReadLine(); } if (pool2 == null) { pool2 = new StringPool(); } FiggleCharacter[] array = new FiggleCharacter[256]; for (int j = 32; j < 127; j++) { array[j] = ReadCharacter(); } array[196] = ReadCharacter(); array[214] = ReadCharacter(); array[220] = ReadCharacter(); array[228] = ReadCharacter(); array[246] = ReadCharacter(); array[252] = ReadCharacter(); array[223] = ReadCharacter(); Dictionary<int, FiggleCharacter> dictionary = new Dictionary<int, FiggleCharacter>(); while (true) { string text2 = reader.ReadLine(); if (text2 == null) { break; } if (!string.IsNullOrWhiteSpace(text2)) { if (!ParseUtil.TryParse(text2, out var i2)) { throw new FiggleException("Unsupported code-tagged character code string \"" + text2 + "\"."); } if (i2 >= 0 && i2 < 256) { array[i2] = ReadCharacter(); } else { dictionary[i2] = ReadCharacter(); } } } return new FiggleFont(array, dictionary, hardBlank, height, baseline, direction, smushMode); static byte CountEolSpaces(string s) { byte b = 0; int num2 = s.Length - 1; while (num2 > 0 && s[num2] == ' ') { num2--; b++; } return b; } static byte CountSolSpaces(string s) { byte b2 = 0; while (b2 < s.Length && s[b2] == ' ') { b2++; } return b2; } FiggleCharacter ReadCharacter() { Line[] array2 = new Line[height]; for (int k = 0; k < height; k++) { string text3 = reader.ReadLine(); if (text3 == null) { throw new FiggleException("Unexpected EOF in Font file."); } char c = text3[text3.Length - 1]; text3 = text3.TrimEnd(new char[1] { c }); array2[k] = new Line(pool2.Pool(text3), CountSolSpaces(text3), CountEolSpaces(text3)); } return new FiggleCharacter(array2); } int UpgradeLayout() { if (layoutOld == 0) { return 64; } if (layoutOld < 0) { return 0; } return (layoutOld & 0x1F) | 0x80; } } } public static class FiggleFonts { private static readonly ConcurrentDictionary<string, FiggleFont> _fontByName = new ConcurrentDictionary<string, FiggleFont>(StringComparer.Ordinal); private static readonly StringPool _stringPool = new StringPool(); public static FiggleFont OneRow => GetByName("1row"); public static FiggleFont ThreeD => GetByName("3-d"); public static FiggleFont ThreeDDiagonal => GetByName("3d_diagonal"); public static FiggleFont ThreeByFive => GetByName("3x5"); public static FiggleFont FourMax => GetByName("4max"); public static FiggleFont FiveLineOblique => GetByName("5lineoblique"); public static FiggleFont Acrobatic => GetByName("acrobatic"); public static FiggleFont Alligator => GetByName("alligator"); public static FiggleFont Alligator2 => GetByName("alligator2"); public static FiggleFont Alligator3 => GetByName("alligator3"); public static FiggleFont Alpha => GetByName("alpha"); public static FiggleFont Alphabet => GetByName("alphabet"); public static FiggleFont Amc3Line => GetByName("amc3line"); public static FiggleFont Amc3Liv1 => GetByName("amc3liv1"); public static FiggleFont AmcAaa01 => GetByName("amcaaa01"); public static FiggleFont AmcNeko => GetByName("amcneko"); public static FiggleFont AmcRazor2 => GetByName("amcrazo2"); public static FiggleFont AmcRazor => GetByName("amcrazor"); public static FiggleFont AmcSlash => GetByName("amcslash"); public static FiggleFont AmcSlder => GetByName("amcslder"); public static FiggleFont AmcThin => GetByName("amcthin"); public static FiggleFont AmcTubes => GetByName("amctubes"); public static FiggleFont AmcUn1 => GetByName("amcun1"); public static FiggleFont Arrows => GetByName("arrows"); public static FiggleFont AsciiNewroman => GetByName("ascii_new_roman"); public static FiggleFont Avatar => GetByName("avatar"); public static FiggleFont B1FF => GetByName("B1FF"); public static FiggleFont Banner => GetByName("banner"); public static FiggleFont Banner3 => GetByName("banner3"); public static FiggleFont Banner3D => GetByName("banner3-D"); public static FiggleFont Banner4 => GetByName("banner4"); public static FiggleFont BarbWire => GetByName("barbwire"); public static FiggleFont Basic => GetByName("basic"); public static FiggleFont Bear => GetByName("bear"); public static FiggleFont Bell => GetByName("bell"); public static FiggleFont Benjamin => GetByName("benjamin"); public static FiggleFont Big => GetByName("big"); public static FiggleFont BigChief => GetByName("bigchief"); public static FiggleFont BigFig => GetByName("bigfig"); public static FiggleFont Binary => GetByName("binary"); public static FiggleFont Block => GetByName("block"); public static FiggleFont Blocks => GetByName("blocks"); public static FiggleFont Bolger => GetByName("bolger"); public static FiggleFont Braced => GetByName("braced"); public static FiggleFont Bright => GetByName("bright"); public static FiggleFont Broadway => GetByName("broadway"); public static FiggleFont BroadwayKB => GetByName("broadway_kb"); public static FiggleFont Bubble => GetByName("bubble"); public static FiggleFont Bulbhead => GetByName("bulbhead"); public static FiggleFont Caligraphy2 => GetByName("calgphy2"); public static FiggleFont Caligraphy => GetByName("caligraphy"); public static FiggleFont Cards => GetByName("cards"); public static FiggleFont CatWalk => GetByName("catwalk"); public static FiggleFont Chiseled => GetByName("chiseled"); public static FiggleFont Chunky => GetByName("chunky"); public static FiggleFont Coinstak => GetByName("coinstak"); public static FiggleFont Cola => GetByName("cola"); public static FiggleFont Colossal => GetByName("colossal"); public static FiggleFont Computer => GetByName("computer"); public static FiggleFont Contessa => GetByName("contessa"); public static FiggleFont Contrast => GetByName("contrast"); public static FiggleFont Cosmic => GetByName("cosmic"); public static FiggleFont Cosmike => GetByName("cosmike"); public static FiggleFont Crawford => GetByName("crawford"); public static FiggleFont Crazy => GetByName("crazy"); public static FiggleFont Cricket => GetByName("cricket"); public static FiggleFont Cursive => GetByName("cursive"); public static FiggleFont CyberLarge => GetByName("cyberlarge"); public static FiggleFont CyberMedium => GetByName("cybermedium"); public static FiggleFont CyberSmall => GetByName("cybersmall"); public static FiggleFont Cygnet => GetByName("cygnet"); public static FiggleFont DANC4 => GetByName("DANC4"); public static FiggleFont DancingFont => GetByName("dancingfont"); public static FiggleFont Decimal => GetByName("decimal"); public static FiggleFont DefLeppard => GetByName("defleppard"); public static FiggleFont Diamond => GetByName("diamond"); public static FiggleFont DietCola => GetByName("dietcola"); public static FiggleFont Digital => GetByName("digital"); public static FiggleFont Doh => GetByName("doh"); public static FiggleFont Doom => GetByName("doom"); public static FiggleFont DosRebel => GetByName("dosrebel"); public static FiggleFont DotMatrix => GetByName("dotmatrix"); public static FiggleFont Double => GetByName("double"); public static FiggleFont DoubleShorts => GetByName("doubleshorts"); public static FiggleFont DRPepper => GetByName("drpepper"); public static FiggleFont DWhistled => GetByName("dwhistled"); public static FiggleFont EftiChess => GetByName("eftichess"); public static FiggleFont EftiFont => GetByName("eftifont"); public static FiggleFont EftiPiti => GetByName("eftipiti"); public static FiggleFont EftiRobot => GetByName("eftirobot"); public static FiggleFont EftiItalic => GetByName("eftitalic"); public static FiggleFont EftiWall => GetByName("eftiwall"); public static FiggleFont EftiWater => GetByName("eftiwater"); public static FiggleFont Epic => GetByName("epic"); public static FiggleFont Fender => GetByName("fender"); public static FiggleFont Filter => GetByName("filter"); public static FiggleFont FireFontK => GetByName("fire_font-k"); public static FiggleFont FireFontS => GetByName("fire_font-s"); public static FiggleFont Flipped => GetByName("flipped"); public static FiggleFont FlowerPower => GetByName("flowerpower"); public static FiggleFont FourTops => GetByName("fourtops"); public static FiggleFont Fraktur => GetByName("fraktur"); public static FiggleFont FunFace => GetByName("funface"); public static FiggleFont FunFaces => GetByName("funfaces"); public static FiggleFont Fuzzy => GetByName("fuzzy"); public static FiggleFont Georgia16 => GetByName("georgi16"); public static FiggleFont Georgia11 => GetByName("Georgia11"); public static FiggleFont Ghost => GetByName("ghost"); public static FiggleFont Ghoulish => GetByName("ghoulish"); public static FiggleFont Glenyn => GetByName("glenyn"); public static FiggleFont Goofy => GetByName("goofy"); public static FiggleFont Gothic => GetByName("gothic"); public static FiggleFont Graceful => GetByName("graceful"); public static FiggleFont Gradient => GetByName("gradient"); public static FiggleFont Graffiti => GetByName("graffiti"); public static FiggleFont Greek => GetByName("greek"); public static FiggleFont HeartLeft => GetByName("heart_left"); public static FiggleFont HeartRight => GetByName("heart_right"); public static FiggleFont Henry3d => GetByName("henry3d"); public static FiggleFont Hex => GetByName("hex"); public static FiggleFont Hieroglyphs => GetByName("hieroglyphs"); public static FiggleFont Hollywood => GetByName("hollywood"); public static FiggleFont HorizontalLeft => GetByName("horizontalleft"); public static FiggleFont HorizontalRight => GetByName("horizontalright"); public static FiggleFont ICL1900 => GetByName("ICL-1900"); public static FiggleFont Impossible => GetByName("impossible"); public static FiggleFont Invita => GetByName("invita"); public static FiggleFont Isometric1 => GetByName("isometric1"); public static FiggleFont Isometric2 => GetByName("isometric2"); public static FiggleFont Isometric3 => GetByName("isometric3"); public static FiggleFont Isometric4 => GetByName("isometric4"); public static FiggleFont Italic => GetByName("italic"); public static FiggleFont Ivrit => GetByName("ivrit"); public static FiggleFont Jacky => GetByName("jacky"); public static FiggleFont Jazmine => GetByName("jazmine"); public static FiggleFont Jerusalem => GetByName("jerusalem"); public static FiggleFont Katakana => GetByName("katakana"); public static FiggleFont Kban => GetByName("kban"); public static FiggleFont Keyboard => GetByName("keyboard"); public static FiggleFont Knob => GetByName("knob"); public static FiggleFont Konto => GetByName("konto"); public static FiggleFont KontoSlant => GetByName("kontoslant"); public static FiggleFont Larry3d => GetByName("larry3d"); public static FiggleFont Lcd => GetByName("lcd"); public static FiggleFont Lean => GetByName("lean"); public static FiggleFont Letters => GetByName("letters"); public static FiggleFont LilDevil => GetByName("lildevil"); public static FiggleFont LineBlocks => GetByName("lineblocks"); public static FiggleFont Linux => GetByName("linux"); public static FiggleFont LockerGnome => GetByName("lockergnome"); public static FiggleFont Madrid => GetByName("madrid"); public static FiggleFont Marquee => GetByName("marquee"); public static FiggleFont MaxFour => GetByName("maxfour"); public static FiggleFont Merlin1 => GetByName("merlin1"); public static FiggleFont Merlin2 => GetByName("merlin2"); public static FiggleFont Mike => GetByName("mike"); public static FiggleFont Mini => GetByName("mini"); public static FiggleFont Mirror => GetByName("mirror"); public static FiggleFont Mnemonic => GetByName("mnemonic"); public static FiggleFont Modular => GetByName("modular"); public static FiggleFont Morse => GetByName("morse"); public static FiggleFont Morse2 => GetByName("morse2"); public static FiggleFont Moscow => GetByName("moscow"); public static FiggleFont Mshebrew210 => GetByName("mshebrew210"); public static FiggleFont Muzzle => GetByName("muzzle"); public static FiggleFont NancyJ => GetByName("nancyj"); public static FiggleFont NancyJFancy => GetByName("nancyj-fancy"); public static FiggleFont NancyJImproved => GetByName("nancyj-improved"); public static FiggleFont NancyJUnderlined => GetByName("nancyj-underlined"); public static FiggleFont Nipples => GetByName("nipples"); public static FiggleFont NScript => GetByName("nscript"); public static FiggleFont NTGreek => GetByName("ntgreek"); public static FiggleFont NVScript => GetByName("nvscript"); public static FiggleFont O8 => GetByName("o8"); public static FiggleFont Octal => GetByName("octal"); public static FiggleFont Ogre => GetByName("ogre"); public static FiggleFont OldBanner => GetByName("oldbanner"); public static FiggleFont OS2 => GetByName("os2"); public static FiggleFont Pawp => GetByName("pawp"); public static FiggleFont Peaks => GetByName("peaks"); public static FiggleFont PeaksSlant => GetByName("peaksslant"); public static FiggleFont Pebbles => GetByName("pebbles"); public static FiggleFont Pepper => GetByName("pepper"); public static FiggleFont Poison => GetByName("poison"); public static FiggleFont Puffy => GetByName("puffy"); public static FiggleFont Puzzle => GetByName("puzzle"); public static FiggleFont Pyramid => GetByName("pyramid"); public static FiggleFont Rammstein => GetByName("rammstein"); public static FiggleFont Rectangles => GetByName("rectangles"); public static FiggleFont RedPhoenix => GetByName("red_phoenix"); public static FiggleFont Relief => GetByName("relief"); public static FiggleFont Relief2 => GetByName("relief2"); public static FiggleFont Rev => GetByName("rev"); public static FiggleFont Reverse => GetByName("reverse"); public static FiggleFont Roman => GetByName("roman"); public static FiggleFont Rot13 => GetByName("rot13"); public static FiggleFont Rotated => GetByName("rotated"); public static FiggleFont Rounded => GetByName("rounded"); public static FiggleFont RowanCap => GetByName("rowancap"); public static FiggleFont Rozzo => GetByName("rozzo"); public static FiggleFont Runic => GetByName("runic"); public static FiggleFont Runyc => GetByName("runyc"); public static FiggleFont SantaClara => GetByName("santaclara"); public static FiggleFont SBlood => GetByName("sblood"); public static FiggleFont Script => GetByName("script"); public static FiggleFont ScriptSlant => GetByName("slscript"); public static FiggleFont SerifCap => GetByName("serifcap"); public static FiggleFont Shadow => GetByName("shadow"); public static FiggleFont Shimrod => GetByName("shimrod"); public static FiggleFont Short => GetByName("short"); public static FiggleFont Slant => GetByName("slant"); public static FiggleFont Slide => GetByName("slide"); public static FiggleFont Small => GetByName("small"); public static FiggleFont SmallCaps => GetByName("smallcaps"); public static FiggleFont IsometricSmall => GetByName("smisome1"); public static FiggleFont KeyboardSmall => GetByName("smkeyboard"); public static FiggleFont PoisonSmall => GetByName("smpoison"); public static FiggleFont ScriptSmall => GetByName("smscript"); public static FiggleFont ShadowSmall => GetByName("smshadow"); public static FiggleFont SlantSmall => GetByName("smslant"); public static FiggleFont TengwarSmall => GetByName("smtengwar"); public static FiggleFont Soft => GetByName("soft"); public static FiggleFont Speed => GetByName("speed"); public static FiggleFont Spliff => GetByName("spliff"); public static FiggleFont SRelief => GetByName("s-relief"); public static FiggleFont Stacey => GetByName("stacey"); public static FiggleFont Stampate => GetByName("stampate"); public static FiggleFont Stampatello => GetByName("stampatello"); public static FiggleFont Standard => GetByName("standard"); public static FiggleFont Starstrips => GetByName("starstrips"); public static FiggleFont Starwars => GetByName("starwars"); public static FiggleFont Stellar => GetByName("stellar"); public static FiggleFont Stforek => GetByName("stforek"); public static FiggleFont Stop => GetByName("stop"); public static FiggleFont Straight => GetByName("straight"); public static FiggleFont SubZero => GetByName("sub-zero"); public static FiggleFont Swampland => GetByName("swampland"); public static FiggleFont Swan => GetByName("swan"); public static FiggleFont Sweet => GetByName("sweet"); public static FiggleFont Tanja => GetByName("tanja"); public static FiggleFont Tengwar => GetByName("tengwar"); public static FiggleFont Term => GetByName("term"); public static FiggleFont Test1 => GetByName("test1"); public static FiggleFont Thick => GetByName("thick"); public static FiggleFont Thin => GetByName("thin"); public static FiggleFont ThreePoint => GetByName("threepoint"); public static FiggleFont Ticks => GetByName("ticks"); public static FiggleFont TicksSlant => GetByName("ticksslant"); public static FiggleFont Tiles => GetByName("tiles"); public static FiggleFont TinkerToy => GetByName("tinker-toy"); public static FiggleFont Tombstone => GetByName("tombstone"); public static FiggleFont Train => GetByName("train"); public static FiggleFont Trek => GetByName("trek"); public static FiggleFont Tsalagi => GetByName("tsalagi"); public static FiggleFont Tubular => GetByName("tubular"); public static FiggleFont Twisted => GetByName("twisted"); public static FiggleFont TwoPoint => GetByName("twopoint"); public static FiggleFont Univers => GetByName("univers"); public static FiggleFont UsaFlag => GetByName("usaflag"); public static FiggleFont Varsity => GetByName("varsity"); public static FiggleFont Wavy => GetByName("wavy"); public static FiggleFont Weird => GetByName("weird"); public static FiggleFont WetLetter => GetByName("wetletter"); public static FiggleFont Whimsy => GetByName("whimsy"); public static FiggleFont Wow => GetByName("wow"); private static FiggleFont GetByName(string name) { return _fontByName.GetOrAdd(name, FontFactory); static FiggleFont FontFactory(string name) { return ParseEmbeddedFont(name) ?? throw new FiggleException("No embedded font exists with name \"" + name + "\"."); } } public static FiggleFont? TryGetByName(string name) { if (_fontByName.TryGetValue(name, out FiggleFont value)) { return value; } value = ParseEmbeddedFont(name); if (value != null) { _fontByName.TryAdd(name, value); } return value; } private static FiggleFont? ParseEmbeddedFont(string name) { using Stream stream = typeof(FiggleFonts).GetTypeInfo().Assembly.GetManifestResourceStream("Figgle.Fonts.zip"); if (stream == null) { throw new FiggleException("Unable to open embedded font archive."); } using ZipArchive zipArchive = new ZipArchive(stream, ZipArchiveMode.Read); ZipArchiveEntry entry = zipArchive.GetEntry(name + ".flf"); if (entry == null) { return null; } using Stream stream2 = entry.Open(); return FiggleFontParser.Parse(stream2, _stringPool); } } internal static class ParseUtil { public static bool TryParse(string s, out int i) { int num = 0; int num2 = 0; bool flag = false; foreach (char c in s) { switch (num) { case 0: case 1: switch (c) { case '0': num = 2; break; case '-': if (num == 0) { flag = true; num = 1; break; } i = 0; return false; default: if (char.IsDigit(c)) { num2 = c - 48; num = 3; } else if (num != 0 || !char.IsWhiteSpace(c)) { i = 0; return false; } break; } break; case 2: switch (c) { case 'X': case 'h': case 'x': num = 5; break; case ' ': i = 0; return true; default: if (char.IsDigit(c)) { num2 = c - 48; num = 4; break; } i = 0; return false; } break; case 3: if (char.IsDigit(c)) { num2 *= 10; num2 += c - 48; break; } if (char.IsWhiteSpace(c)) { i = (flag ? (-num2) : num2); return true; } i = 0; return false; case 4: { int num5 = c - 48; if (num5 >= 0 && num5 < 8) { num2 *= 8; num2 += num5; break; } if (char.IsWhiteSpace(c)) { i = (flag ? (-num2) : num2); return true; } i = 0; return false; } case 5: case 6: { if (c >= '0' && c <= '9') { num = 6; int num3 = c - 48; num2 *= 16; num2 += num3; break; } char c2 = char.ToLower(c); if (c2 >= 'a' && c <= 'f') { num = 6; int num4 = c2 - 97 + 10; num2 *= 16; num2 += num4; break; } if (num == 6 && char.IsWhiteSpace(c)) { i = (flag ? (-num2) : num2); return true; } i = 0; return false; } } } switch (num) { case 3: case 4: case 6: i = (flag ? (-num2) : num2); return true; case 2: i = 0; return true; default: i = 0; return false; } } } public sealed class StringPool { private readonly Dictionary<string, string> _pool = new Dictionary<string, string>(StringComparer.Ordinal); public string Pool(string s) { lock (_pool) { if (_pool.TryGetValue(s, out string value)) { return value; } _pool[s] = s; return s; } } } }
BepInEx/plugins/ShipLootPlus.dll
Decompiled 8 months ago
The result has been truncated due to the large size, download it to view full contents!
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.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Figgle; using GameNetcodeStuff; using HarmonyLib; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using ShipLootPlus.Patches; using ShipLootPlus.Utils; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ShipLootPlus")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ShipLootPlus")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("5b20d4e7-b524-4818-877d-931940d78212")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] public static class ExtensionHelpers { public static bool GetValueOrDefault(this bool? InputNullableBool) { return InputNullableBool.GetValueOrDefault(); } } public static class Ext { public static object GetValue(this Enum Item) { Fonts.EnumValue[] array = Item.GetType().GetField(Item.ToString()).GetCustomAttributes(typeof(Fonts.EnumValue), inherit: false) as Fonts.EnumValue[]; if (array.Length == 0) { return Item; } return array[0].Value; } public static string GetValueString(this Enum Item) { Fonts.EnumValue[] array = Item.GetType().GetField(Item.ToString()).GetCustomAttributes(typeof(Fonts.EnumValue), inherit: false) as Fonts.EnumValue[]; if (array.Length == 0) { return Item.ToString(); } return array[0].Value.ToString(); } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace ShipLootPlus { public class PluginMetadata { public const string Author = "PXC"; public const string Name = "ShipLootPlus"; public const string Id = "PXC.ShipLootPlus"; public const string Version = "1.1.0"; public string FullName => string.Format("{0} v{1}", "ShipLootPlus", "1.1.0"); } [BepInPlugin("PXC.ShipLootPlus", "ShipLootPlus", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ShipLootPlus : BaseUnityPlugin { public static PluginMetadata pluginMetadata = new PluginMetadata(); public static ManualLogSource Log = new ManualLogSource("PXC.ShipLootPlus"); public static ShipLootPlus Instance; public static Dictionary<string, int> UiElements = new Dictionary<string, int>(); public static string PluginFolder { get; set; } private void Awake() { Instance = Instance ?? this; Log = ((BaseUnityPlugin)this).Logger; Log.LogInfo((object)("Initializing plugin: " + pluginMetadata.FullName + " by PXC")); PluginFolder = Path.GetDirectoryName(typeof(ShipLootPlus).Assembly.Location); Fonts.Load(PluginFolder); Harmony.CreateAndPatchAll(typeof(DepositItemsDeskPatcher), (string)null); Log.LogInfo((object)"[Patched] DepositItemsDesk"); Harmony.CreateAndPatchAll(typeof(GrabbableObjectPatcher), (string)null); Log.LogInfo((object)"[Patched] GrabbableObjects"); Harmony.CreateAndPatchAll(typeof(HudManagerPatcher), (string)null); Log.LogInfo((object)"[Patched] HUDManager"); Harmony.CreateAndPatchAll(typeof(PlayerControllerBPatcher), (string)null); Log.LogInfo((object)"[Patched] PlayerControllerB"); Harmony.CreateAndPatchAll(typeof(RoundManagerPatcher), (string)null); Log.LogInfo((object)"[Patched] RoundManager"); Harmony.CreateAndPatchAll(typeof(StartOfRoundPatcher), (string)null); Log.LogInfo((object)"[Patched] StartOfRound"); Harmony.CreateAndPatchAll(typeof(TimeOfDayPatcher), (string)null); Log.LogInfo((object)"[Patched] TimeOfDay"); UiHelper.DataSubSet = new List<string>(); UiHelper.DataPoints = new List<ReplacementData> { new ReplacementData { Pattern = "%ShipLootValue%", Description = "Value of all scrap on ship" }, new ReplacementData { Pattern = "%MoonLootValue%", Description = "Value of all scrap on moon" }, new ReplacementData { Pattern = "%AllLootValue%", Description = "Value of all scrap total" }, new ReplacementData { Pattern = "%ShipLootCount%", Description = "Count of all scrap on ship" }, new ReplacementData { Pattern = "%MoonLootCount%", Description = "Count of all scrap on moon" }, new ReplacementData { Pattern = "%AllLootCount%", Description = "Count of all scrap total" }, new ReplacementData { Pattern = "%FulfilledValue%", Description = "Value of turned in scrap for quota" }, new ReplacementData { Pattern = "%QuotaValue%", Description = "Value of current quota" }, new ReplacementData { Pattern = "%CompanyRate%", Description = "Current company buy rate" }, new ReplacementData { Pattern = "%ExpectedProfit%", Description = "Expected profit from scap on ship at current company buy rate" }, new ReplacementData { Pattern = "%Deadline%", Description = "Quota deadline in days" }, new ReplacementData { Pattern = "%DayNumber%", Description = "Number of days in the ship/save (E.g. 1, 10)" }, new ReplacementData { Pattern = "%DayNumberHuman%", Description = "Human friendly days in the ship/save (E.g. 1st, 10th)" }, new ReplacementData { Pattern = "%Weather%", Description = "Current moons weather (full name)" }, new ReplacementData { Pattern = "%MoonName%", Description = "Current moons full name" } }; int num = 1; foreach (ReplacementData dataPoint in UiHelper.DataPoints) { dataPoint.Name = Regex.Replace(dataPoint.Pattern, "%", "", RegexOptions.IgnoreCase); Log.LogInfo((object)$"[DataPoint #{num:D2}] {dataPoint.Pattern} => {dataPoint.Description}"); num++; } ConfigSettings.Initialize(((BaseUnityPlugin)this).Config, $"Allows showing up to {UiHelper.DataPoints.Count} customizable data points on your HUD."); ConfigEvents.Initialize(); if (ConfigSettings.DebugMode.Value) { Log.LogWarning((object)("Loaded! (IN DEBUG)\n" + FiggleFonts.Doom.Render(pluginMetadata.FullName, (int?)null))); } else { Log.LogInfo((object)("Loaded!\n" + FiggleFonts.Doom.Render(pluginMetadata.FullName, (int?)null))); } } public static bool PluginExists(string Name, bool ShowWarning = true) { if (Chainloader.PluginInfos.ContainsKey(Name)) { KeyValuePair<string, PluginInfo> keyValuePair = Chainloader.PluginInfos.FirstOrDefault((KeyValuePair<string, PluginInfo> n) => n.Key == Name); if (ShowWarning) { Log.LogInfo((object)$"[SoftDependency] Found plugin: {keyValuePair.Value.Metadata.Name} ({keyValuePair.Value.Metadata.GUID}) v{keyValuePair.Value.Metadata.Version} - Initializing methods..."); } return true; } if (ShowWarning) { Log.LogWarning((object)("[SoftDependency] Unable to find plugin '" + Name + "' - Skipping its initialization!")); } return false; } } } namespace ShipLootPlus.Utils { public static class ConfigEvents { public static void Initialize() { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)"[ConfigEvents.Initialize] Initializing all 'SettingChanged' events"); } ConfigSettings.AlwaysShow.SettingChanged += ToggleUi_SettingChanged; ConfigSettings.AllCaps.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.ShowLine.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.LineColor.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.ShowLineOne.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.LineOneColor.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.LineOneFormat.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.ShowLineTwo.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.LineTwoColor.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.LineTwoFormat.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.ShowLineThree.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.LineThreeColor.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.LineThreeFormat.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.SelectedFont.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.CharacterSpacing.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.FontSize.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.LineAlpha.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.PosX.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.PosY.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.ScaleX.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.ScaleY.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.Rotation.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.TextAlignment.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.TextAlpha.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.WordSpacing.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.WidthAppend.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.DeadlineUseColors.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.DeadlineReplaceZero.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.DeadlineLastDay.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.DeadlineTwoColor.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.DeadlineOneColor.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.DeadlineZeroColor.SettingChanged += RedrawRequired_SettingChanged; ConfigSettings.MoonShowFullName.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.MoonReplaceCompany.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.MoonCompanyReplacement.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.WeatherNoneReplacement.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.WeatherUseColors.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.WeatherColorNone.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.WeatherColorDustClouds.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.WeatherColorRainy.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.WeatherColorStormy.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.WeatherColorFoggy.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.WeatherColorFlooded.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.WeatherColorEclipsed.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.WeatherColorHell.SettingChanged += RefreshUi_SettingChanged; ConfigSettings.DebugMode.SettingChanged += DebugMode_SettingChanged; ConfigSettings.DisableRpcHooks.SettingChanged += DisableRpcHooks_SettingChanged; } private static void RedrawRequired_SettingChanged(object sender, EventArgs e) { if (!((Object)(object)UiHelper.ContainerObject == (Object)null)) { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)"[ConfigEvents] UI setting requiring a redraw was changed"); } UiHelper.ResetUiElements(); } } private static void ToggleUi_SettingChanged(object sender, EventArgs e) { if (!((Object)(object)UiHelper.ContainerObject == (Object)null)) { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)"[ConfigEvents] UI setting which enables or disables the display has changed"); } UiHelper.ContainerObject.SetActive(ConfigSettings.AlwaysShow.Value); } } private static void RefreshUi_SettingChanged(object sender, EventArgs e) { if (!((Object)(object)UiHelper.ContainerObject == (Object)null)) { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)"[ConfigEvents] UI setting which requires a full data refresh has changed"); } UiHelper.RefreshElementValues(); } } private static void DebugMode_SettingChanged(object sender, EventArgs e) { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogWarning((object)("Enabling debug mode (expect performance drop!)\n" + FiggleFonts.Doom.Render("Debug Enabled!", (int?)null))); } else { ShipLootPlus.Log.LogWarning((object)("Disabling debug mode\n" + FiggleFonts.Doom.Render("Debug Disabled!", (int?)null))); } } private static void DisableRpcHooks_SettingChanged(object sender, EventArgs e) { if (ConfigSettings.DisableRpcHooks.Value) { ShipLootPlus.Log.LogWarning((object)"Disabling RPC Hooks - Data will now refresh slower!"); } else { ShipLootPlus.Log.LogWarning((object)"Enabling RPC Hooks - Data will now refresh normally!"); } } } public class ConfigSettings { public static ConfigEntry<bool> AlwaysShow; public static ConfigEntry<bool> AllowOutside; public static ConfigEntry<bool> AllowInside; public static ConfigEntry<float> PosX; public static ConfigEntry<float> PosY; public static ConfigEntry<float> ScaleX; public static ConfigEntry<float> ScaleY; public static ConfigEntry<float> Rotation; public static ConfigEntry<float> WidthAppend; public static ConfigEntry<float> DisplayDuration; public static ConfigEntry<bool> DisplayDurationReset; public static ConfigEntry<bool> RefreshOnScan; public static ConfigEntry<bool> ShowLine; public static ConfigEntry<string> LineColor; public static ConfigEntry<float> LineAlpha; public static ConfigEntry<bool> AllCaps; public static ConfigEntry<float> FontSize; public static ConfigEntry<float> CharacterSpacing; public static ConfigEntry<float> WordSpacing; public static ConfigEntry<Fonts.FontList> SelectedFont; public static ConfigEntry<TextAlignmentOptions> TextAlignment; public static ConfigEntry<float> TextAlpha; public static ConfigEntry<bool> ShowLineOne; public static ConfigEntry<string> LineOneColor; public static ConfigEntry<string> LineOneFormat; public static ConfigEntry<bool> ShowLineTwo; public static ConfigEntry<string> LineTwoColor; public static ConfigEntry<string> LineTwoFormat; public static ConfigEntry<bool> ShowLineThree; public static ConfigEntry<string> LineThreeColor; public static ConfigEntry<string> LineThreeFormat; public static ConfigEntry<bool> DeadlineUseColors; public static ConfigEntry<bool> DeadlineReplaceZero; public static ConfigEntry<string> DeadlineLastDay; public static ConfigEntry<string> DeadlineTwoColor; public static ConfigEntry<string> DeadlineOneColor; public static ConfigEntry<string> DeadlineZeroColor; public static ConfigEntry<bool> MoonShowFullName; public static ConfigEntry<bool> MoonReplaceCompany; public static ConfigEntry<string> MoonCompanyReplacement; public static ConfigEntry<string> WeatherNoneReplacement; public static ConfigEntry<bool> WeatherUseColors; public static ConfigEntry<string> WeatherColorDustClouds; public static ConfigEntry<string> WeatherColorEclipsed; public static ConfigEntry<string> WeatherColorFlooded; public static ConfigEntry<string> WeatherColorFoggy; public static ConfigEntry<string> WeatherColorNone; public static ConfigEntry<string> WeatherColorRainy; public static ConfigEntry<string> WeatherColorStormy; public static ConfigEntry<string> WeatherColorHell; public static ConfigEntry<bool> DebugMode; public static ConfigEntry<bool> DisableRpcHooks; public static void Initialize(ConfigFile config, string description) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Data Points:"); foreach (ReplacementData dataPoint in UiHelper.DataPoints) { stringBuilder.AppendLine(dataPoint.Pattern); stringBuilder.AppendLine(dataPoint.Description); stringBuilder.AppendLine(); } string text = "General"; AlwaysShow = config.Bind<bool>(text, "Always Show", false, "Should the hud elements be decoupled from the scanner? (Meaning it will always be shown on screen)"); AllowOutside = config.Bind<bool>(text, "Allow Outside", false, "Should the scanner hud be shown when scanning outside the ship?"); AllowInside = config.Bind<bool>(text, "Allow Inside Dungeon", false, "Should the scanner hud be shown when scanning inside the dungeon?"); text = "On Scan"; DisplayDuration = config.Bind<float>(text, "Display Duration", 5f, "How long in seconds should the items stay on screen. (This is ignored if Always Show is true)"); DisplayDurationReset = config.Bind<bool>(text, "Reset Duration Timer On Scan", false, "Should the duration timer get reset if you scan?"); RefreshOnScan = config.Bind<bool>(text, "Refresh Data On Scan", false, "Should a data refresh be forced when scanning?\n\nAll data is kept updated when events are triggered (player grabs an item, items get moved into the ship, etc.) so this isn't required.\n\n<b>IMPORTANT</B>: This could cause issues with any mod that makes the scanner always on"); text = "Layout"; PosX = config.Bind<float>(text, "Position: X (Left/Right)", 115f, "The X position of the UI element group"); PosY = config.Bind<float>(text, "Position: Y (Up/Down)", -169f, "The Y position of the UI element group"); ScaleX = config.Bind<float>(text, "Scale: X (Left/Right)", 0.6f, "The X scale of the UI element group"); ScaleY = config.Bind<float>(text, "Scale: Y (Up/Down)", 0.6f, "The Y scale of the UI element group"); Rotation = config.Bind<float>(text, "Rotation: Z (Tilt)", 356f, "This changes how much the UI element group is rotated on the screen"); WidthAppend = config.Bind<float>(text, "Text Field Width Offset", 0f, "This value allows you to offset the text field width if you want to show more or less characters on screen"); text = "Line Graphic"; ShowLine = config.Bind<bool>(text, "Show Line", true, "Shows the line element"); LineColor = config.Bind<string>(text, "Line Color", "2D5122", "Line color (hex code)"); LineAlpha = config.Bind<float>(text, "Transparency", 0.75f, "Make the line element more or less transparent"); text = "Font Settings"; AllCaps = config.Bind<bool>(text, "All Caps", false, "Should text be in all caps?"); SelectedFont = config.Bind<Fonts.FontList>(text, "Font", Fonts.FontList.Vanilla, "Font to use for the UI elements"); FontSize = config.Bind<float>(text, "Size", 19f, "Adjust the font size"); CharacterSpacing = config.Bind<float>(text, "Character Spacing", -6f, "Adjust the spacing between characters"); WordSpacing = config.Bind<float>(text, "Word Spacing", -20f, "Adjust the spacing between words"); TextAlignment = config.Bind<TextAlignmentOptions>(text, "Text Alignment", (TextAlignmentOptions)257, "Change the default text alignment for all elements\n\n<b>**IMPORTANT**</b> The elements are built to stay Top Left aligned, changing this may produce unwanted outcomes"); TextAlpha = config.Bind<float>(text, "Transparency", 0.95f, "Make the text elements more or less transparent"); text = "Line #1"; ShowLineOne = config.Bind<bool>(text, "Show", true, "Shows " + text + " on the hud."); LineOneColor = config.Bind<string>(text, "Color", "19D56C", text + " text color. (hex code)"); LineOneFormat = config.Bind<string>(text, "Format", "Ship: $%ShipLootValue%(%ShipLootCount%) / $%MoonLootValue%(%MoonLootCount%) <i>[%MoonName%:%Weather%]</i>", $"{text} text format.\n\n{stringBuilder}"); text = "Line #2"; ShowLineTwo = config.Bind<bool>(text, "Show", true, "Shows the " + text + " on the scan hud."); LineTwoColor = config.Bind<string>(text, "Color", "19D56C", text + " text color. (hex code)"); LineTwoFormat = config.Bind<string>(text, "Format", "Quota: $%FulfilledValue% / $%QuotaValue% - Profit: $%ExpectedProfit%(%CompanyRate%%)", $"{text} text format.\n\n{stringBuilder}"); text = "Line #3"; ShowLineThree = config.Bind<bool>(text, "Show", true, "Shows the " + text + " on the scan hud."); LineThreeColor = config.Bind<string>(text, "Color", "19D56C", text + " text color. (hex code)"); LineThreeFormat = config.Bind<string>(text, "Format", "Deadline: %Deadline% - %DayNumberHuman% day", $"{text} text format.\n\n{stringBuilder}"); text = "DataPoint: Deadline"; DeadlineUseColors = config.Bind<bool>(text, "Use Colors", false, "Enables color for the deadline number"); DeadlineReplaceZero = config.Bind<bool>(text, "Replace Zero", true, "Replace the number 0 with the custom text below, otherwise leave it as a number"); DeadlineLastDay = config.Bind<string>(text, "Zero Replacement", "<b>NOW!</b>", "Text to replace the number Zero if 'Replace Zero' is enabled"); DeadlineTwoColor = config.Bind<string>(text, "Color: 2+ days", "00FF00", "Color for when the deadline has two or more days remaining"); DeadlineOneColor = config.Bind<string>(text, "Color: 1 day", "FFA500", "Color for when the deadline has one day remaining"); DeadlineZeroColor = config.Bind<string>(text, "Color: Zero days", "FF0000", "Color for when the deadline is due"); text = "DataPoint: MoonName"; MoonShowFullName = config.Bind<bool>(text, "Show Full Name", false, "Show the full moon name (do not remove any leading numbers)"); MoonReplaceCompany = config.Bind<bool>(text, "Replace Company Name", true, "Replace the name used for the company moon"); MoonCompanyReplacement = config.Bind<string>(text, "Company Name Replacement", "Company Building", "Text to replace 'Gordion' if 'Replace Company Name' is enabled"); text = "DataPoint: Weather"; WeatherNoneReplacement = config.Bind<string>(text, "Clear Weather Text", "Clear", "Text to use instead of 'None' for when the weather is clear (set to blank if you want it to show None)"); WeatherUseColors = config.Bind<bool>(text, "Use Colors", false, "Enables color for each weather type"); WeatherColorNone = config.Bind<string>(text, "Color: Clear/None", "69FF6B", "Color for Clear/None weather"); WeatherColorDustClouds = config.Bind<string>(text, "Color: DustClouds", "B56C4C", "Color for DustClouds weather"); WeatherColorRainy = config.Bind<string>(text, "Color: Rainy", "FFFF00", "Color for Rainy weather"); WeatherColorStormy = config.Bind<string>(text, "Color: Stormy", "FF7700", "Color for Stormy weather"); WeatherColorFoggy = config.Bind<string>(text, "Color: Foggy", "666666", "Color for Foggy weather"); WeatherColorFlooded = config.Bind<string>(text, "Color: Flooded", "FF0000", "Color for Flooded weather"); WeatherColorEclipsed = config.Bind<string>(text, "Color: Eclipsed", "BA0B0B", "Color for Eclipsed weather"); WeatherColorHell = config.Bind<string>(text, "Color: Hell", "AA0000", "Color for Hell weather (from the mod 'HellWeather')"); text = "Debug Settings"; DebugMode = config.Bind<bool>(text, "Debug Mode", false, "Enables debug logging **IMPORTANT** This will DEFINITELY cause lag and stutters as it writes a lot of debug lines, only use this if asked to help troubleshoot a problem!"); DisableRpcHooks = config.Bind<bool>(text, "Disable RPC Hooks", false, "Disable all data point refresh RPC hooks. This will impact how often the data points are updated. You can always enable 'Refresh Data On Scan' below to make it refresh faster."); int num = 3; bool flag = false; Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(config, null); if (dictionary.Count > 0) { foreach (KeyValuePair<ConfigDefinition, string> item in dictionary) { switch (item.Key.Key) { case "Short Character Count": num = (int)ConvertToType(typeof(int), item.Value); ShipLootPlus.Log.LogMessage((object)("[ConfigConversion] Converting old '" + item.Key.Key + "' with value '" + item.Value + "' to new config item")); break; case "Show Line": ShipLootPlus.Log.LogMessage((object)("[ConfigConversion] Converting old '" + item.Key.Key + "' with value '" + item.Value + "' to new config item")); ShowLine.Value = (bool)ConvertToType(typeof(bool), item.Value); break; case "Line Color": ShipLootPlus.Log.LogMessage((object)("[ConfigConversion] Converting old '" + item.Key.Key + "' with value '" + item.Value + "' to new config item")); LineColor.Value = item.Value; break; case "All Caps": ShipLootPlus.Log.LogMessage((object)("[ConfigConversion] Converting old '" + item.Key.Key + "' with value '" + item.Value + "' to new config item")); AllCaps.Value = (bool)ConvertToType(typeof(bool), item.Value); break; case "Display Duration": ShipLootPlus.Log.LogMessage((object)("[ConfigConversion] Converting old '" + item.Key.Key + "' with value '" + item.Value + "' to new config item")); DisplayDuration.Value = (float)ConvertToType(typeof(float), item.Value); break; } } dictionary.Clear(); flag = true; } if (ConvertOldFormat("%DeadlineWithColors%", "%Deadline%")) { ShipLootPlus.Log.LogMessage((object)"[ConfigConversion] Enabling 'Use Colors' on Deadline data point as user wanted to use colors before"); DeadlineUseColors.Value = true; flag = true; } if (ConvertOldFormat("%MoonLongName%", "%MoonName%")) { flag = true; } if (ConvertOldFormat("%WeatherShort%", $"%Weather:{num}%")) { flag = true; } if (ConvertOldFormat("%MoonShortName%", $"%MoonName:{num}%")) { flag = true; } if (flag) { ShipLootPlus.Log.LogMessage((object)"[ConfigConversion] Saving config changes..."); config.Save(); } try { if (ShipLootPlus.PluginExists("ainavt.lc.lethalconfig")) { SetupLethalConfig(description); } } catch { } } public static bool ConvertOldFormat(string oldPattern, string newPattern, bool raw = false) { bool result = false; string pattern = Regex.Escape(oldPattern); if (raw) { pattern = oldPattern; } if (Regex.IsMatch(LineOneFormat.Value, pattern)) { ShipLootPlus.Log.LogMessage((object)("[ConfigConversion] Converting old datapoint '" + oldPattern + "' with new datapoint '" + newPattern + "' on Line #1 format")); LineOneFormat.Value = Regex.Replace(LineOneFormat.Value, pattern, newPattern, RegexOptions.IgnoreCase); result = true; } if (Regex.IsMatch(LineTwoFormat.Value, pattern)) { ShipLootPlus.Log.LogMessage((object)("[ConfigConversion] Converting old datapoint '" + oldPattern + "' with new datapoint '" + newPattern + "' on Line #2 format")); LineTwoFormat.Value = Regex.Replace(LineTwoFormat.Value, pattern, newPattern, RegexOptions.IgnoreCase); result = true; } if (Regex.IsMatch(LineThreeFormat.Value, pattern)) { ShipLootPlus.Log.LogMessage((object)("[ConfigConversion] Converting old datapoint '" + oldPattern + "' with new datapoint '" + newPattern + "' on Line #3 format")); LineThreeFormat.Value = Regex.Replace(LineThreeFormat.Value, pattern, newPattern, RegexOptions.IgnoreCase); result = true; } return result; } public static object ConvertToType(Type targetType, string value) { MethodInfo method = targetType.GetMethod("TryParse", new Type[2] { typeof(string), targetType.MakeByRefType() }); if (method != null) { object[] array = new object[2] { value, null }; if ((bool)method.Invoke(null, array)) { return array[1]; } ShipLootPlus.Log.LogWarning((object)("Failed to convert '" + value + "' to type " + targetType.Name)); } else { ShipLootPlus.Log.LogWarning((object)("Type " + targetType.Name + " does not support TryParse method")); } return value; } private static void SetupLethalConfig(string description) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Expected O, but got Unknown //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_011f: 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_012f: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Expected O, but got Unknown //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Expected O, but got Unknown //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Expected O, but got Unknown //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Expected O, but got Unknown //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Expected O, but got Unknown //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) //IL_01e2: Expected O, but got Unknown //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Expected O, but got Unknown //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Expected O, but got Unknown //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Expected O, but got Unknown //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Expected O, but got Unknown //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Expected O, but got Unknown //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Expected O, but got Unknown //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Expected O, but got Unknown //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Expected O, but got Unknown //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Expected O, but got Unknown //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Expected O, but got Unknown //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Expected O, but got Unknown //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Expected O, but got Unknown //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Expected O, but got Unknown //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Expected O, but got Unknown //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Expected O, but got Unknown //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Expected O, but got Unknown //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Expected O, but got Unknown //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Expected O, but got Unknown //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Expected O, but got Unknown //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Expected O, but got Unknown //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Expected O, but got Unknown //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Expected O, but got Unknown //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Expected O, but got Unknown //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Expected O, but got Unknown //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Expected O, but got Unknown //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Expected O, but got Unknown //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Expected O, but got Unknown //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Expected O, but got Unknown //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Expected O, but got Unknown //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Expected O, but got Unknown //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Expected O, but got Unknown //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03d2: Expected O, but got Unknown //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Expected O, but got Unknown //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03f2: Expected O, but got Unknown //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Expected O, but got Unknown //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Expected O, but got Unknown //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Expected O, but got Unknown //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Expected O, but got Unknown //IL_0438: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Expected O, but got Unknown //IL_0448: Unknown result type (might be due to invalid IL or missing references) //IL_0452: Expected O, but got Unknown //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Expected O, but got Unknown //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Expected O, but got Unknown //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Expected O, but got Unknown //IL_0488: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Expected O, but got Unknown //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Expected O, but got Unknown //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04b2: Expected O, but got Unknown //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Expected O, but got Unknown //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Expected O, but got Unknown LethalConfigManager.SetModDescription(description); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(AlwaysShow, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(AllowOutside, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(AllowInside, false)); ConfigEntry<float> displayDuration = DisplayDuration; FloatSliderOptions val = new FloatSliderOptions(); ((BaseRangeOptions<float>)val).Min = 1f; ((BaseRangeOptions<float>)val).Max = 60f; ((BaseOptions)val).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(displayDuration, val)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(DisplayDurationReset, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(RefreshOnScan, false)); ConfigEntry<float> posX = PosX; FloatSliderOptions val2 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val2).Min = -469f; ((BaseRangeOptions<float>)val2).Max = 333f; ((BaseOptions)val2).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(posX, val2)); ConfigEntry<float> posY = PosY; FloatSliderOptions val3 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val3).Min = -280f; ((BaseRangeOptions<float>)val3).Max = 190f; ((BaseOptions)val3).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(posY, val3)); ConfigEntry<float> scaleX = ScaleX; FloatSliderOptions val4 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val4).Min = 0.3f; ((BaseRangeOptions<float>)val4).Max = 1.2f; ((BaseOptions)val4).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(scaleX, val4)); ConfigEntry<float> scaleY = ScaleY; FloatSliderOptions val5 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val5).Min = 0.3f; ((BaseRangeOptions<float>)val5).Max = 1.2f; ((BaseOptions)val5).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(scaleY, val5)); ConfigEntry<float> rotation = Rotation; FloatSliderOptions val6 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val6).Min = 0f; ((BaseRangeOptions<float>)val6).Max = 360f; ((BaseOptions)val6).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(rotation, val6)); ConfigEntry<float> widthAppend = WidthAppend; FloatSliderOptions val7 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val7).Min = -300f; ((BaseRangeOptions<float>)val7).Max = 2000f; ((BaseOptions)val7).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(widthAppend, val7)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(ShowLine, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(LineColor, false)); ConfigEntry<float> lineAlpha = LineAlpha; FloatSliderOptions val8 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val8).Min = 0f; ((BaseRangeOptions<float>)val8).Max = 1f; ((BaseOptions)val8).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(lineAlpha, val8)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(AllCaps, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<Fonts.FontList>(SelectedFont, false)); ConfigEntry<float> fontSize = FontSize; FloatSliderOptions val9 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val9).Min = 1f; ((BaseRangeOptions<float>)val9).Max = 100f; ((BaseOptions)val9).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(fontSize, val9)); ConfigEntry<float> characterSpacing = CharacterSpacing; FloatSliderOptions val10 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val10).Min = -20f; ((BaseRangeOptions<float>)val10).Max = 10f; ((BaseOptions)val10).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(characterSpacing, val10)); ConfigEntry<float> wordSpacing = WordSpacing; FloatSliderOptions val11 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val11).Min = -70f; ((BaseRangeOptions<float>)val11).Max = 50f; ((BaseOptions)val11).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(wordSpacing, val11)); LethalConfigManager.AddConfigItem((BaseConfigItem)(object)new EnumDropDownConfigItem<TextAlignmentOptions>(TextAlignment, false)); ConfigEntry<float> textAlpha = TextAlpha; FloatSliderOptions val12 = new FloatSliderOptions(); ((BaseRangeOptions<float>)val12).Min = 0f; ((BaseRangeOptions<float>)val12).Max = 1f; ((BaseOptions)val12).RequiresRestart = false; LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(textAlpha, val12)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(ShowLineOne, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(LineOneColor, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(LineOneFormat, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(ShowLineTwo, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(LineTwoColor, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(LineTwoFormat, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(ShowLineThree, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(LineThreeColor, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(LineThreeFormat, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(DeadlineUseColors, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(DeadlineReplaceZero, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(DeadlineLastDay, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(DeadlineTwoColor, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(DeadlineOneColor, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(DeadlineZeroColor, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(MoonShowFullName, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(MoonReplaceCompany, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(MoonCompanyReplacement, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(WeatherNoneReplacement, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(WeatherUseColors, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(WeatherColorNone, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(WeatherColorDustClouds, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(WeatherColorRainy, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(WeatherColorStormy, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(WeatherColorFoggy, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(WeatherColorFlooded, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(WeatherColorEclipsed, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(WeatherColorHell, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(DebugMode, false)); LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(DisableRpcHooks, false)); } } public class Fonts { public class LcFont { public string Name; public TMP_FontAsset Asset; } public class EnumValue : Attribute { public object Value { get; } public EnumValue(object value) { Value = value; } } public enum FontList { [EnumValue("Default")] Vanilla, [EnumValue("Lethal Company (Fixed)")] Fixed, [EnumValue("Lethal Company (Fixed) Semi-Condensed")] FixedSemiCondensed, [EnumValue("Lethal Company (Fixed) Condensed")] FixedCondensed } public static List<LcFont> LcFontAssets = new List<LcFont>(); public static AssetBundle FontBundle { get; set; } public static string FontFile => "3270Fonts"; public static void Load(string path) { string text = Path.Combine(path, FontFile); LcFontAssets.Add(new LcFont { Name = "Default", Asset = null }); if (File.Exists(text)) { ShipLootPlus.Log.LogInfo((object)("[Fonts] Loading font assets from '" + text + "'")); FontBundle = AssetBundle.LoadFromFile(text); foreach (string item in from a in FontBundle.GetAllAssetNames() where Regex.IsMatch(a, "\\.asset$", RegexOptions.IgnoreCase) select a) { TMP_FontAsset val = FontBundle.LoadAsset<TMP_FontAsset>(item); ShipLootPlus.Log.LogInfo((object)("[Fonts] Loaded font: " + ((Object)val).name)); LcFontAssets.Add(new LcFont { Name = ((Object)val).name, Asset = val }); } ShipLootPlus.Log.LogInfo((object)"[Fonts] Unloading asset bundle..."); FontBundle.Unload(false); } else { ShipLootPlus.Log.LogWarning((object)("[Fonts] Unable to find font asset '" + text + "'")); } } public static LcFont GetFont(string name) { return LcFontAssets.FirstOrDefault((LcFont a) => Regex.IsMatch(a.Name, Regex.Escape(name) + "$", RegexOptions.IgnoreCase)); } } internal class ReplacementData { public string Name; public string Pattern; public string Description; public string Value; } internal class ShipLootPlusItem { public string name; public Vector3 offset = new Vector3(0.05f, -0.083f, 0f); public Color color; public string format; public GameObject gameOjbect; public TextMeshProUGUI textMeshProUGui; public bool enabled; public bool image; public string value; } internal class LootItem { public float Value; public int Count; } internal class UiHelper { public static bool FirstTimeSync; private static List<string> ItemsToIgnore => new List<string> { "ClipboardManual", "StickyNoteItem", "PlayerRagdoll", "RagdollGrabbableObject" }; public static List<string> DataSubSet { get; set; } public static List<ShipLootPlusItem> UiElementList { get; set; } public static List<ShipLootPlusItem> ElementsToUpdate { get; set; } public static List<ReplacementData> DataPoints { get; set; } public static GameObject ContainerObject { get; set; } public static Vector3 SlpLocalScale { get; set; } public static Vector3 SlpLocalPos { get; set; } public static float timeLeftDisplay { get; set; } public static float timeLeftUpdate { get; set; } public static bool IsUpdating { get; set; } public static bool IsRefreshing { get; set; } public static bool IsDisplaying { get; set; } public static bool UpdateReady { get; set; } private static List<ShipLootPlusItem> LoadObjectList() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) ShipLootPlus.Log.LogInfo((object)"[LoadObjectList] Adding HUD element object data from config values"); return new List<ShipLootPlusItem> { new ShipLootPlusItem { name = "LineImage", color = ConvertHexColor(ConfigSettings.LineColor.Value, ConfigSettings.LineAlpha.Value), enabled = ConfigSettings.ShowLine.Value, image = true }, new ShipLootPlusItem { name = "Line #1", color = ConvertHexColor(ConfigSettings.LineOneColor.Value), format = ConfigSettings.LineOneFormat.Value, value = ConfigSettings.LineOneFormat.Value, enabled = ConfigSettings.ShowLineOne.Value }, new ShipLootPlusItem { name = "Line #2", color = ConvertHexColor(ConfigSettings.LineTwoColor.Value), format = ConfigSettings.LineTwoFormat.Value, value = ConfigSettings.LineTwoFormat.Value, enabled = ConfigSettings.ShowLineTwo.Value }, new ShipLootPlusItem { name = "Line #3", color = ConvertHexColor(ConfigSettings.LineThreeColor.Value), format = ConfigSettings.LineThreeFormat.Value, value = ConfigSettings.LineThreeFormat.Value, enabled = ConfigSettings.ShowLineThree.Value } }; } private static void UpdateObjectSettings() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0165: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) ShipLootPlus.Log.LogInfo((object)"[UpdateObjectSettings] Updating HUD element object data from config values"); DataSubSet.Clear(); ContainerObject.transform.localPosition = new Vector3(ConfigSettings.PosX.Value, ConfigSettings.PosY.Value, 0f); ContainerObject.transform.localScale = new Vector3(ConfigSettings.ScaleX.Value, ConfigSettings.ScaleY.Value, 0.5f); ContainerObject.transform.rotation = new Quaternion(0f, 0f, 0f, 0f); ContainerObject.transform.Rotate(0f, 0f, ConfigSettings.Rotation.Value); foreach (ShipLootPlusItem uiElement in UiElementList) { switch (uiElement.name) { case "LineImage": uiElement.color = ConvertHexColor(ConfigSettings.LineColor.Value, ConfigSettings.LineAlpha.Value); uiElement.enabled = ConfigSettings.ShowLine.Value; break; case "Line #1": uiElement.color = ConvertHexColor(ConfigSettings.LineOneColor.Value); uiElement.format = ConfigSettings.LineOneFormat.Value; uiElement.enabled = ConfigSettings.ShowLineOne.Value; break; case "Line #2": uiElement.color = ConvertHexColor(ConfigSettings.LineTwoColor.Value); uiElement.format = ConfigSettings.LineTwoFormat.Value; uiElement.enabled = ConfigSettings.ShowLineTwo.Value; break; case "Line #3": uiElement.color = ConvertHexColor(ConfigSettings.LineThreeColor.Value); uiElement.format = ConfigSettings.LineThreeFormat.Value; uiElement.enabled = ConfigSettings.ShowLineThree.Value; break; } if (!uiElement.image) { ((TMP_Text)uiElement.textMeshProUGui).alignment = ConfigSettings.TextAlignment.Value; ((TMP_Text)uiElement.textMeshProUGui).alpha = ConfigSettings.TextAlpha.Value; ((TMP_Text)uiElement.textMeshProUGui).fontSize = ConfigSettings.FontSize.Value; ((TMP_Text)uiElement.textMeshProUGui).characterSpacing = ConfigSettings.CharacterSpacing.Value; ((TMP_Text)uiElement.textMeshProUGui).wordSpacing = ConfigSettings.WordSpacing.Value; } SetDataSubSet(uiElement.format); } ShipLootPlus.Log.LogWarning((object)string.Format("[DataSubset-Changed] Count: {0} => {1}", DataSubSet.Count, string.Join(";", DataSubSet))); } public static void CreateUiElements() { //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: 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) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Expected O, but got Unknown //IL_0469: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_0545: Unknown result type (might be due to invalid IL or missing references) //IL_0556: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_064f: Unknown result type (might be due to invalid IL or missing references) //IL_06ba: Unknown result type (might be due to invalid IL or missing references) if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)"[CreateUiElements] Creating UI objects"); } GameObject val = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD"); GameObject val2 = GameObject.Find("/Systems/UI/Canvas/IngamePlayerHUD/BottomMiddle/ValueCounter"); if (!Object.op_Implicit((Object)(object)val2)) { ShipLootPlus.Log.LogError((object)"Failed to find ValueCounter object to copy!"); return; } if (UiElementList == null) { UiElementList = LoadObjectList(); DataSubSet.Clear(); UiElementList.ForEach(delegate(ShipLootPlusItem s) { SetDataSubSet(s.format); }); ShipLootPlus.Log.LogWarning((object)string.Format("[DataSubset-Added] Count: {0} => {1}", DataSubSet.Count, string.Join(";", DataSubSet))); } IsUpdating = false; FirstTimeSync = false; Vector3 localPosition = default(Vector3); ((Vector3)(ref localPosition))..ctor(0f, 0f, 0f); Vector3 VecLocPos = Vector3.zero; Quaternion QuatLocRot = Quaternion.identity; Vector3 VecPos = Vector3.zero; Quaternion QuatRot = Quaternion.identity; LogPos(val2.gameObject, out VecPos, out QuatRot, out VecLocPos, out QuatLocRot); ContainerObject = Object.Instantiate<GameObject>(val2.gameObject, val2.transform.parent, false); ContainerObject.transform.SetParent(val.transform); ((Object)ContainerObject).name = "ShipLootPlus"; ContainerObject.AddComponent<CanvasGroup>(); RectTransform component = ContainerObject.GetComponent<RectTransform>(); component.pivot = new Vector2(0f, 0f); component.offsetMax = new Vector2(0f, 0f); component.offsetMin = new Vector2(0f, 0f); component.anchorMax = new Vector2(1f, 1f); component.anchorMin = new Vector2(1f, 0f); component.anchoredPosition = new Vector2(50f, 50f); ContainerObject.transform.Translate(0f, 1f, 0f); ContainerObject.transform.localPosition = new Vector3(ConfigSettings.PosX.Value, ConfigSettings.PosY.Value, 0f); ContainerObject.transform.rotation = new Quaternion(0f, 0f, 0f, 0f); ContainerObject.transform.Rotate(0f, 0f, ConfigSettings.Rotation.Value); TextMeshProUGUI componentInChildren = ContainerObject.GetComponentInChildren<TextMeshProUGUI>(); Fonts.LcFontAssets.FirstOrDefault((Fonts.LcFont a) => a.Name == "Default").Asset = ((TMP_Text)componentInChildren).font; ContainerObject.transform.localScale = new Vector3(ConfigSettings.ScaleX.Value, ConfigSettings.ScaleY.Value, 0.5f); LogPos(ContainerObject, out VecPos, out QuatRot, out VecLocPos, out QuatLocRot); Image componentInChildren2 = ContainerObject.GetComponentInChildren<Image>(); ShipLootPlusItem shipLootPlusItem = UiElementList.Where((ShipLootPlusItem e) => e.image).FirstOrDefault(); if (shipLootPlusItem != null) { ((Object)componentInChildren2).name = shipLootPlusItem.name; ((Graphic)componentInChildren2).color = shipLootPlusItem.color; RectTransform component2 = ((Component)componentInChildren2).GetComponent<RectTransform>(); Rect rect = component2.rect; float num = ((Rect)(ref rect)).width / 0.15f; rect = component2.rect; float height = ((Rect)(ref rect)).height; component2.sizeDelta = new Vector2(num, height); shipLootPlusItem.gameOjbect = ((Component)componentInChildren2).gameObject; ((Behaviour)componentInChildren2).enabled = shipLootPlusItem.enabled; ((Component)componentInChildren2).transform.localPosition = localPosition; ((Component)componentInChildren2).transform.localScale = new Vector3(1.3f, 1.3f, 1.3f); component2.pivot = new Vector2(0f, 0f); component2.anchorMax = new Vector2(0f, 0f); component2.anchorMin = new Vector2(0f, 0f); component2.anchoredPosition = new Vector2(30f, 38f); } GameObject val3 = new GameObject { name = "SLP" }; val3.transform.SetParent(ContainerObject.transform); val3.transform.position = ContainerObject.transform.position; val3.transform.localPosition = new Vector3(0f, -1f, 0f); RectTransform obj = val3.AddComponent<RectTransform>(); ((Transform)obj).SetParent(val3.transform, true); SlpLocalScale = new Vector3(90f, 90f, 90f); val3.transform.localScale = SlpLocalScale; obj.pivot = new Vector2(0f, 0f); obj.offsetMax = new Vector2(0f, 0f); obj.offsetMin = new Vector2(0f, 0f); obj.anchorMax = new Vector2(0f, 0f); obj.anchorMin = new Vector2(0f, 0f); obj.anchoredPosition = new Vector2(50f, 50f); SlpLocalPos = val3.transform.localPosition; IEnumerable<ShipLootPlusItem> enumerable = UiElementList.Where((ShipLootPlusItem e) => (Object)(object)e.gameOjbect == (Object)null && !e.image); enumerable.Count(); Fonts.LcFont font = Fonts.GetFont(ConfigSettings.SelectedFont.Value.GetValueString()); foreach (ShipLootPlusItem item in enumerable) { item.gameOjbect = Object.Instantiate<GameObject>(((Component)componentInChildren).gameObject, ((TMP_Text)componentInChildren).transform.parent); ((Object)item.gameOjbect).name = item.name; item.gameOjbect.transform.SetParent(val3.transform); item.textMeshProUGui = item.gameOjbect.GetComponentInChildren<TextMeshProUGUI>(); ((TMP_Text)item.textMeshProUGui).text = item.format; ((TMP_Text)item.textMeshProUGui).font = font.Asset; ((TMP_Text)item.textMeshProUGui).alignment = ConfigSettings.TextAlignment.Value; ((TMP_Text)item.textMeshProUGui).alpha = ConfigSettings.TextAlpha.Value; ((TMP_Text)item.textMeshProUGui).fontSize = ConfigSettings.FontSize.Value; ((TMP_Text)item.textMeshProUGui).characterSpacing = ConfigSettings.CharacterSpacing.Value; ((TMP_Text)item.textMeshProUGui).wordSpacing = ConfigSettings.WordSpacing.Value; ((Graphic)item.textMeshProUGui).color = item.color; ((TMP_Text)item.textMeshProUGui).overflowMode = (TextOverflowModes)1; ((TMP_Text)item.textMeshProUGui).enableWordWrapping = false; ((TMP_Text)item.textMeshProUGui).maxVisibleLines = 1; ((TMP_Text)item.textMeshProUGui).ForceMeshUpdate(false, false); } Object.Destroy((Object)(object)((Component)componentInChildren).gameObject); ResizeAndPositionElements(val3); ShipLootPlus.Log.LogWarning((object)"Fixing ship scrap tags on first join..."); (from s in Object.FindObjectsOfType<GrabbableObject>() where s.itemProperties.isScrap select s).ToList().ForEach(delegate(GrabbableObject s) { bool isInShipRoom = s.isInShipRoom; bool isInElevator = s.isInElevator; s.isInShipRoom = true; s.isInElevator = true; ShipLootPlus.Log.LogInfo((object)$"[{((Object)s).name}] isInShipRoom: {isInShipRoom} => {s.isInElevator} | isInElevator: {isInElevator} => {s.isInElevator}"); }); ElementsToUpdate = UiElementList.Where((ShipLootPlusItem e) => !e.image && (Object)(object)e.gameOjbect != (Object)null).ToList(); RefreshElementValues(); if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)"[CreateUiElements] Enabling UI objects"); } if (ConfigSettings.AlwaysShow.Value) { ContainerObject.SetActive(true); } } public static void ResizeAndPositionElements(GameObject GO) { //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: 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_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) IEnumerable<ShipLootPlusItem> enumerable = UiElementList.Where((ShipLootPlusItem e) => !e.enabled && !e.image); if (enumerable.Count() > 0) { foreach (ShipLootPlusItem item in enumerable) { if (ConfigSettings.AlwaysShow.Value) { item.gameOjbect.SetActive(false); } ((Behaviour)item.textMeshProUGui).enabled = false; } } IEnumerable<ShipLootPlusItem> enumerable2 = UiElementList.Where((ShipLootPlusItem e) => e.enabled && !e.image); if (enumerable2.Count() > 0) { foreach (ShipLootPlusItem item2 in enumerable2) { if (ConfigSettings.AlwaysShow.Value) { item2.gameOjbect.SetActive(true); } ((Behaviour)item2.textMeshProUGui).enabled = true; } } IEnumerable<TextMeshProUGUI> enumerable3 = from t in GO.GetComponentsInChildren<TextMeshProUGUI>() where ((Behaviour)t).enabled select t; int num = enumerable3.Count(); Vector3 localPosition = default(Vector3); ((Vector3)(ref localPosition))..ctor(0f, 0f, 0f); Vector3 slpLocalScale = SlpLocalScale; Vector3 slpLocalPos = SlpLocalPos; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 0f); float num2 = 0.1f; float num3 = -0.175f; int num4 = 1; int num5 = 0; float num6 = 30f; float num7 = 5f; float num8 = -18f; switch (num) { case 3: slpLocalScale = SlpLocalScale; slpLocalPos = SlpLocalPos; break; case 2: ((Vector3)(ref slpLocalScale))..ctor(SlpLocalScale.x + num6, SlpLocalScale.x + num6, SlpLocalScale.x + num6); ((Vector3)(ref slpLocalPos))..ctor(SlpLocalPos.x + num7, SlpLocalPos.y + num8, SlpLocalPos.z); break; case 1: ((Vector3)(ref slpLocalScale))..ctor(SlpLocalScale.x + num6 * 2f, SlpLocalScale.x + num6 * 2f, SlpLocalScale.x + num6 * 2f); ((Vector3)(ref slpLocalPos))..ctor(SlpLocalPos.x + num7 * 2f, SlpLocalPos.y + num8 * 2f, SlpLocalPos.z); break; } GO.transform.localScale = slpLocalScale; GO.transform.localPosition = slpLocalPos; foreach (TextMeshProUGUI item3 in enumerable3) { RectTransform component = ((Component)item3).GetComponent<RectTransform>(); Vector2 sizeDelta = component.sizeDelta; float num9 = CalculateRectWidth(num); num9 += ConfigSettings.WidthAppend.Value; ((Vector2)(ref sizeDelta))..ctor(num9, component.sizeDelta.y); ((TMP_Text)item3).transform.localPosition = localPosition; component.pivot = new Vector2(0f, 0f); component.sizeDelta = sizeDelta; float num10 = val.x + num2 * (float)num5; float num11 = val.y + num3 * (float)num5; component.anchoredPosition = new Vector2(num10, num11); num4++; num5++; } } public static float CalculateRectWidth(int count) { float num = 300f; float num2 = 440f; return count switch { 1 => num, 2 => (num2 + num) / 2f, _ => num2, }; } public static void ResetUiElements() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) if (UiElementList == null || (Object)(object)ContainerObject == (Object)null) { return; } UpdateObjectSettings(); Image componentInChildren = ContainerObject.GetComponentInChildren<Image>(); if ((Object)(object)componentInChildren != (Object)null) { ShipLootPlusItem shipLootPlusItem = UiElementList.Where((ShipLootPlusItem c) => c.name == "LineImage").FirstOrDefault(); if (shipLootPlusItem != null) { ((Behaviour)componentInChildren).enabled = shipLootPlusItem.enabled; ((Graphic)componentInChildren).color = shipLootPlusItem.color; } } Transform val = (from Transform child in (IEnumerable)ContainerObject.transform where ((Object)child).name == "SLP" select child).FirstOrDefault(); IEnumerable<TextMeshProUGUI> enumerable = from Transform child in (IEnumerable)val select ((Component)child).GetComponent<TextMeshProUGUI>() into component where (Object)(object)component != (Object)null select component; Fonts.LcFont font = Fonts.GetFont(ConfigSettings.SelectedFont.Value.GetValueString()); foreach (TextMeshProUGUI textItem in enumerable) { ShipLootPlusItem shipLootPlusItem2 = UiElementList.Where((ShipLootPlusItem c) => c.name == ((Object)textItem).name).FirstOrDefault(); if (shipLootPlusItem2 != null) { ((Behaviour)textItem).enabled = shipLootPlusItem2.enabled; ((Graphic)textItem).color = shipLootPlusItem2.color; ((TMP_Text)textItem).text = shipLootPlusItem2.format; ((TMP_Text)textItem).font = font.Asset; ((TMP_Text)textItem).alignment = ConfigSettings.TextAlignment.Value; ((TMP_Text)textItem).alpha = ConfigSettings.TextAlpha.Value; ((TMP_Text)textItem).fontSize = ConfigSettings.FontSize.Value; ((TMP_Text)textItem).characterSpacing = ConfigSettings.CharacterSpacing.Value; ((TMP_Text)textItem).wordSpacing = ConfigSettings.WordSpacing.Value; ((TMP_Text)textItem).ForceMeshUpdate(false, false); } } ResizeAndPositionElements(((Component)val).gameObject); ElementsToUpdate = UiElementList.Where((ShipLootPlusItem e) => !e.image && (Object)(object)e.gameOjbect != (Object)null).ToList(); RefreshElementValues(); } public static void SetDataSubSet(string LineItem) { if (string.IsNullOrEmpty(LineItem)) { return; } foreach (Match item in new Regex("%([^%]+)%").Matches(LineItem)) { string value = item.Groups[1].Value; string text = Regex.Replace(value, ":.*", ""); if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)("[SetDataSubSet] New Data Subset => " + value + " => " + text)); } if (!DataSubSet.Contains(text)) { DataSubSet.Add(text); } } } public static void RefreshElementValues() { //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Expected I4, but got Unknown if (ConfigSettings.DebugMode.Value) { MethodBase arg = (from frame in new StackTrace().GetFrames().Skip(1) select frame.GetMethod()).FirstOrDefault(); ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] Caller => {arg}"); } if (!IsUpdating) { IsUpdating = true; } if (UiElementList == null || (Object)(object)ContainerObject == (Object)null) { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogWarning((object)$"[RefreshElementValues:{IsUpdating}] UiElementList or ContainerObject is NULL!"); } return; } if (ElementsToUpdate == null || ElementsToUpdate.Count() <= 0) { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogWarning((object)$"[RefreshElementValues:{IsUpdating}] ElementsToUpdate is NULL or ZERO!"); } return; } if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] Elements to update: {ElementsToUpdate.Count()}"); } TimeOfDay tod = TimeOfDay.Instance; StartOfRound sor = StartOfRound.Instance; string format = "<color={0}>{1}</color>"; LevelWeatherType? val = sor.currentLevel?.currentWeather; string currentWeather = val.ToString(); if (val == (LevelWeatherType?)(-1) && !string.IsNullOrEmpty(ConfigSettings.WeatherNoneReplacement.Value)) { currentWeather = ConfigSettings.WeatherNoneReplacement.Value; } if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] Weather list"); foreach (object value in Enum.GetValues(typeof(LevelWeatherType))) { ShipLootPlus.Log.LogInfo((object)$"[Weather] {value}"); } ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] Current String: {currentWeather}"); ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] Current Enum : {val}"); ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] Current Type : {val.GetType()}"); ShipLootPlus.Log.LogMessage((object)""); } string arg2 = "#ffffffff"; if (ConfigSettings.WeatherUseColors.Value) { switch (val) { case 1L: arg2 = SanitizeHexColorString(ConfigSettings.WeatherColorDustClouds.Value, "ff"); break; case 6L: arg2 = SanitizeHexColorString(ConfigSettings.WeatherColorEclipsed.Value, "ff"); break; case 5L: arg2 = SanitizeHexColorString(ConfigSettings.WeatherColorFlooded.Value, "ff"); break; case 4L: arg2 = SanitizeHexColorString(ConfigSettings.WeatherColorFoggy.Value, "ff"); break; case 0L: arg2 = SanitizeHexColorString(ConfigSettings.WeatherColorNone.Value, "ff"); break; case 2L: arg2 = SanitizeHexColorString(ConfigSettings.WeatherColorRainy.Value, "ff"); break; case 3L: arg2 = SanitizeHexColorString(ConfigSettings.WeatherColorStormy.Value, "ff"); break; } if (Regex.IsMatch(currentWeather, "^Hell$", RegexOptions.IgnoreCase)) { arg2 = SanitizeHexColorString(ConfigSettings.WeatherColorHell.Value, "ff"); } currentWeather = string.Format(format, arg2, currentWeather); } string currentMoon = sor.currentLevel.PlanetName; if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] currentMoon: {currentMoon}"); ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] MoonShowFullName: {ConfigSettings.MoonShowFullName.Value}"); ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] MoonReplaceCompany: {ConfigSettings.MoonReplaceCompany.Value}"); ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] MoonCompanyReplacement: {ConfigSettings.MoonCompanyReplacement.Value}"); ShipLootPlus.Log.LogMessage((object)""); } if (!ConfigSettings.MoonShowFullName.Value) { currentMoon = Regex.Replace(currentMoon, "^\\d{1,} ?", "", RegexOptions.IgnoreCase); } if (ConfigSettings.MoonReplaceCompany.Value && Regex.IsMatch(currentMoon, "Gordion", RegexOptions.IgnoreCase)) { currentMoon = ConfigSettings.MoonCompanyReplacement.Value; } int num = 1; if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] Current Data Point values:"); foreach (ReplacementData dataPoint in DataPoints) { ShipLootPlus.Log.LogInfo((object)$"[DataPoint #{num:D2}] {dataPoint.Pattern} => {dataPoint.Value}"); num++; } ShipLootPlus.Log.LogMessage((object)""); } string deadlineDueText = tod.daysUntilDeadline.ToString(); string text = "#ffffffff"; if (ConfigSettings.DeadlineReplaceZero.Value && tod.daysUntilDeadline <= 0) { deadlineDueText = ConfigSettings.DeadlineLastDay.Value; } if (ConfigSettings.DeadlineUseColors.Value) { text = ((tod.daysUntilDeadline >= 2) ? SanitizeHexColorString(ConfigSettings.DeadlineTwoColor.Value, "ff") : ((tod.daysUntilDeadline != 1) ? SanitizeHexColorString(ConfigSettings.DeadlineZeroColor.Value, "ff") : SanitizeHexColorString(ConfigSettings.DeadlineOneColor.Value, "ff"))); deadlineDueText = string.Format(format, text, deadlineDueText); } LootItem shipLootValue = CalculateLootValue(ItemsToIgnore, "Ship"); LootItem moonLootValue = CalculateLootValue(ItemsToIgnore, "Moon"); LootItem allLootValue = CalculateLootValue(ItemsToIgnore, "All"); LootItem invLootValue = CalculateLootValue(ItemsToIgnore, "Inv"); int companyRate = (int)(sor.companyBuyingRate * 100f); double profitValue = Math.Round((shipLootValue.Value - (float)tod.quotaFulfilled) * sor.companyBuyingRate); if (shipLootValue.Value <= 0f) { profitValue = 0.0; } if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] shipLootValue: {shipLootValue.Value}"); ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] moonLootValue: {moonLootValue.Value}"); ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] allLootValue: {allLootValue.Value}"); ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] invLootValue: {invLootValue.Value}"); ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] deadlineDueColorText: {deadlineDueText} => {tod.daysUntilDeadline}"); ShipLootPlus.Log.LogMessage((object)""); } Parallel.ForEach(DataPoints, delegate(ReplacementData dataPoint) { string pattern = dataPoint.Pattern; if (pattern != null) { if (Regex.IsMatch(pattern, "ShipLootValue", RegexOptions.IgnoreCase)) { dataPoint.Value = shipLootValue.Value.ToString("F0"); } else if (Regex.IsMatch(pattern, "ShipLootCount", RegexOptions.IgnoreCase)) { dataPoint.Value = shipLootValue.Count.ToString(); } else if (Regex.IsMatch(pattern, "MoonLootValue", RegexOptions.IgnoreCase)) { dataPoint.Value = moonLootValue.Value.ToString("F0"); } else if (Regex.IsMatch(pattern, "MoonLootCount", RegexOptions.IgnoreCase)) { dataPoint.Value = moonLootValue.Count.ToString(); } else if (Regex.IsMatch(pattern, "AllLootValue", RegexOptions.IgnoreCase)) { dataPoint.Value = allLootValue.Value.ToString("F0"); } else if (Regex.IsMatch(pattern, "AllLootCount", RegexOptions.IgnoreCase)) { dataPoint.Value = allLootValue.Count.ToString(); } else if (Regex.IsMatch(pattern, "InventoryLootValue", RegexOptions.IgnoreCase)) { dataPoint.Value = invLootValue.Value.ToString("F0"); } else if (Regex.IsMatch(pattern, "InventoryLootCount", RegexOptions.IgnoreCase)) { dataPoint.Value = invLootValue.Count.ToString(); } else if (Regex.IsMatch(pattern, "FulfilledValue", RegexOptions.IgnoreCase)) { dataPoint.Value = tod.quotaFulfilled.ToString(); } else if (Regex.IsMatch(pattern, "QuotaValue", RegexOptions.IgnoreCase)) { dataPoint.Value = tod.profitQuota.ToString(); } else if (Regex.IsMatch(pattern, "CompanyRate", RegexOptions.IgnoreCase)) { dataPoint.Value = companyRate.ToString(); } else if (Regex.IsMatch(pattern, "ExpectedProfit", RegexOptions.IgnoreCase)) { dataPoint.Value = profitValue.ToString(); } else if (Regex.IsMatch(pattern, "Deadline.$", RegexOptions.IgnoreCase)) { dataPoint.Value = deadlineDueText; } else if (Regex.IsMatch(pattern, "DayNumber.$", RegexOptions.IgnoreCase)) { dataPoint.Value = sor.gameStats.daysSpent.ToString(); } else if (Regex.IsMatch(pattern, "DayNumberHuman", RegexOptions.IgnoreCase)) { dataPoint.Value = ConvertToHumanFriendly((float)sor.gameStats.daysSpent + 1f); } else if (Regex.IsMatch(pattern, "Weather.$", RegexOptions.IgnoreCase)) { dataPoint.Value = currentWeather; } else if (Regex.IsMatch(pattern, "MoonName", RegexOptions.IgnoreCase)) { dataPoint.Value = currentMoon; } } }); num = 1; if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] New Data Point values:"); foreach (ReplacementData dataPoint2 in DataPoints) { ShipLootPlus.Log.LogInfo((object)$"[DataPoint #{num:D2}]> {dataPoint2.Pattern} => {dataPoint2.Value}"); num++; } ShipLootPlus.Log.LogMessage((object)""); } Parallel.ForEach(ElementsToUpdate, delegate(ShipLootPlusItem slpi) { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)$"[RefreshElementValues:{IsUpdating}] Updating value for element: {slpi.name}"); } string text2 = ReplaceValues(slpi.format, DataPoints.Where((ReplacementData d) => DataSubSet.Contains(d.Name)).ToList()); if (ConfigSettings.AllCaps.Value) { text2 = text2.ToUpper(); } slpi.value = text2; }); IsUpdating = false; UpdateReady = true; } public static void UpdateUiObjects() { if (!UpdateReady && (Object)(object)ContainerObject == (Object)null) { return; } foreach (ShipLootPlusItem item in ElementsToUpdate.Where((ShipLootPlusItem g) => (Object)(object)g.gameOjbect != (Object)null)) { if (((TMP_Text)item.textMeshProUGui).text != item.value) { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)("[UpdateUiObjects] Updating text for element: " + item.name)); } ((TMP_Text)item.textMeshProUGui).text = item.value; } } UpdateReady = false; } public static void LogPos(GameObject InObj, out Vector3 VecPos, out Quaternion QuatRot, out Vector3 VecLocPos, out Quaternion QuatLocRot) { //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) //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) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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) VecLocPos = Vector3.zero; QuatLocRot = Quaternion.identity; VecPos = Vector3.zero; QuatRot = Quaternion.identity; InObj.transform.GetPositionAndRotation(ref VecPos, ref QuatRot); InObj.transform.GetLocalPositionAndRotation(ref VecLocPos, ref QuatLocRot); } public static void ScaleAroundRelative(GameObject target, Vector3 pivot, Vector3 scaleFactor) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) Vector3 val = target.transform.localPosition - pivot; ((Vector3)(ref val)).Scale(scaleFactor); target.transform.localPosition = pivot + val; Vector3 localScale = target.transform.localScale; ((Vector3)(ref localScale)).Scale(scaleFactor); target.transform.localScale = localScale; } public static string SanitizeHexColorString(string hColor, string alpha = "") { if (!Regex.IsMatch(hColor, "^#")) { hColor = "#" + hColor; } return hColor.Substring(0, 7) + alpha; } public static Color ConvertHexColor(string hColor, float alpha = 0.95f) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) hColor = SanitizeHexColorString(hColor); Color val = default(Color); if (ColorUtility.TryParseHtmlString(hColor, ref val)) { return new Color(val.r, val.g, val.b, alpha); } return new Color(25f, 213f, 108f, alpha); } public static void TryToggleUi(bool Timed = false) { if (ConfigSettings.AlwaysShow.Value && !Timed) { if (StartOfRound.Instance.inShipPhase) { ContainerObject.SetActive(true); } else if (GameNetworkManager.Instance.localPlayerController.isInsideFactory) { ContainerObject.SetActive(ConfigSettings.AllowInside.Value); } else if (!GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom && !GameNetworkManager.Instance.localPlayerController.isInsideFactory) { ContainerObject.SetActive(ConfigSettings.AllowOutside.Value); } else if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom) { ContainerObject.SetActive(true); } } else { if (!(!ConfigSettings.AlwaysShow.Value && Timed)) { return; } bool flag = true; if (!StartOfRound.Instance.inShipPhase) { flag = false; if (ConfigSettings.AllowInside.Value && GameNetworkManager.Instance.localPlayerController.isInsideFactory) { flag = true; } else if (ConfigSettings.AllowOutside.Value && !GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom && !GameNetworkManager.Instance.localPlayerController.isInsideFactory) { flag = true; } else if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom) { flag = true; } } if (!IsDisplaying && flag) { ((MonoBehaviour)GameNetworkManager.Instance).StartCoroutine(DisplayDataCoroutine()); } } } public static IEnumerator DisplayDataCoroutine() { if (!IsDisplaying) { IsDisplaying = true; } timeLeftDisplay = ConfigSettings.DisplayDuration.Value; if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)$"[DisplayDataCoroutine:{IsDisplaying}] Showing UI => timeLeftDisplay: {timeLeftDisplay} - {ConfigSettings.DisplayDuration.Value}"); } bool hadError = false; try { ContainerObject.SetActive(true); } catch { ShipLootPlus.Log.LogWarning((object)"Unable to show UI - Likely because we are not in a lobby anymore => Resetting states..."); hadError = true; } while (timeLeftDisplay > 0f) { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)$"[DisplayDataCoroutine:{IsDisplaying}]> timeLeftDisplay: {timeLeftDisplay} - {ConfigSettings.DisplayDuration.Value}"); } float num = timeLeftDisplay; timeLeftDisplay = 0f; yield return (object)new WaitForSeconds(num); } if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)$"[DisplayDataCoroutine:{IsDisplaying}] Hiding UI => timeLeftDisplay: {timeLeftDisplay} - {ConfigSettings.DisplayDuration.Value}"); } if (!hadError) { try { ContainerObject.SetActive(false); } catch { ShipLootPlus.Log.LogWarning((object)"Unable to hide UI - Likely because we are not in a lobby anymore => Resetting states..."); } } IsDisplaying = false; } public static IEnumerator UpdateDatapoints(float delay = 0f, int loop = 1) { if (!IsRefreshing) { IsRefreshing = true; } if (delay > 0f) { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogInfo((object)$"[UpdateDatapoints] Delaying datapoint refresh for [ {delay} ] seconds"); } yield return (object)new WaitForSeconds(delay); } timeLeftUpdate = 0.5f; if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)string.Format("[UpdateDatapoints:{0}] Callers: {1} => timeLeftUpdate: {2} => Loop: {3}", IsRefreshing, GetStackTraceInfo("Patcher"), timeLeftUpdate, loop)); } for (int i = 0; i < loop; i++) { RefreshElementValues(); if (loop > 1) { yield return (object)new WaitForSeconds(0.5f); } } while (timeLeftUpdate > 0f) { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)$"[UpdateDatapoints:{IsRefreshing}] Refreshing => timeLeftUpdate: {timeLeftUpdate}"); } float num = timeLeftUpdate; timeLeftUpdate = 0f; yield return (object)new WaitForSeconds(num); } if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)$"[UpdateDatapoints:{IsRefreshing}] Refresh complete => timeLeftUpdate: {timeLeftUpdate}"); } IsRefreshing = false; } private static string GetStackTraceInfo(string targetClassName) { StackTrace stackTrace = new StackTrace(); Regex classRegex = new Regex(targetClassName); StackFrame stackFrame = stackTrace.GetFrames().Skip(1).FirstOrDefault(delegate(StackFrame frame) { string input = frame.GetMethod().DeclaringType?.Name ?? "UnknownClass"; return classRegex.IsMatch(input); }); if (stackFrame != null) { string name = stackFrame.GetMethod().Name; int fileLineNumber = stackFrame.GetFileLineNumber(); return $"{targetClassName}.{name}() in {stackFrame.GetFileName()}:{fileLineNumber}"; } return "No matching frame found for class " + targetClassName; } public static LootItem CalculateLootValue(List<string> Ignored, string scope) { List<GrabbableObject> list = null; LootItem lootItem = new LootItem { Count = 0, Value = 0f }; GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>(); if (array == null || array.Length == 0) { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogWarning((object)"[CalculateLootValue] GrabbableObject list was null => Returning zeros..."); } return lootItem; } array = array.Where((GrabbableObject s) => (Object)(object)s != (Object)null && (Object)(object)s.itemProperties != (Object)null).ToArray(); array = array.Where((GrabbableObject s) => s.itemProperties.isScrap && !IsIgnored(Ignored, ((Object)s).name)).ToArray(); switch (scope) { case "All": list = array.ToList(); break; case "Ship": list = array.Where((GrabbableObject s) => s.isInShipRoom && s.isInElevator).ToList(); break; case "Moon": list = array.Where((GrabbableObject s) => !s.isInShipRoom && !s.isInElevator).ToList(); break; case "Inv": list = array.Where((GrabbableObject s) => (s.isHeld || s.isPocketed) && ((NetworkBehaviour)s.playerHeldBy).IsLocalPlayer).ToList(); break; } if (list == null) { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogWarning((object)("[CalculateLootValue] " + scope + " GrabbableObject list was null => Returning zeros...")); } return lootItem; } lootItem.Count = list.Count; lootItem.Value = list.Sum((GrabbableObject s) => s.scrapValue); if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)$"[CalculateLootValue] Calculating total {scope} scrap value => Valid item count: {lootItem.Count} => Value: ${lootItem.Value}"); list.ForEach(delegate(GrabbableObject s) { if ((Object)(object)s != (Object)null) { ShipLootPlus.Log.LogMessage((object)$"[CalculateLootValue] {((Object)s).name} - ${s.scrapValue}"); } else { ShipLootPlus.Log.LogMessage((object)"[CalculateLootValue] Item was NULL - Skipping..."); } }); ShipLootPlus.Log.LogMessage((object)""); } return lootItem; } public static bool IsIgnored(List<string> Ignored, string Item) { if (Ignored.FirstOrDefault((string i) => Regex.IsMatch(Item, i, RegexOptions.IgnoreCase)) != null) { return true; } return false; } private static string ConvertToHumanFriendly(float number) { int num = (int)number; if (num <= 0) { return "Zero"; } if (num % 100 >= 11 && num % 100 <= 13) { return $"{num}th"; } return (num % 10) switch { 1 => $"{num}st", 2 => $"{num}nd", 3 => $"{num}rd", _ => $"{num}th", }; } public static string ReplaceValues(string Line, List<ReplacementData> Data) { string text = Line; foreach (Match item in new Regex("%([^%]+)%").Matches(text)) { if (!item.Success) { continue; } string value = item.Groups[1].Value; int trunc = GetTrunc(value); string text2 = Regex.Replace(value, ":.*", "").Trim(); string rxPattern = Regex.Escape("%" + text2 + "%"); ReplacementData replacementData = Data.FirstOrDefault((ReplacementData v) => Regex.IsMatch(v.Pattern, rxPattern, RegexOptions.IgnoreCase)); if (replacementData != null) { string text3 = replacementData.Value; if (trunc > 0 && trunc < text3.Length) { text3 = text3.Substring(0, trunc); } string pattern = Regex.Escape("%" + value + "%"); text = Regex.Replace(text, pattern, text3, RegexOptions.IgnoreCase); } } return text; } public static int GetTrunc(string item) { if (!Regex.IsMatch(item, ":")) { return 0; } int result = 0; Match match = new Regex("(?<=:).*").Match(item); if (match.Success) { result = Convert.ToInt32(Regex.Replace(match.Value, "\\D", "")); } return result; } } } namespace ShipLootPlus.Patches { internal class DepositItemsDeskPatcher { [HarmonyPatch(typeof(DepositItemsDesk), "PlaceItemOnCounter")] [HarmonyPostfix] private static void PlaceItemOnCounter(PlayerControllerB __instance) { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)"[PlaceItemOnCounter] Item was deposited on the sell counter"); } UiHelper.RefreshElementValues(); } } internal class GrabbableObjectPatcher { [HarmonyPatch(typeof(GrabbableObject), "OnHitGround")] [HarmonyPostfix] private static void OnHitGround(GrabbableObject __instance) { if (ConfigSettings.DebugMode.Value) { ShipLootPlus.Log.LogMessage((object)"[OnHitGround] Item was thrown and hit the ground"); } if ((Object)(object)__instance != (Object)null && (Object)(object)__instance.itemProperties != (Object