Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of BreakwaterIsland v0.1.0
Breakwater.Runtime.dll
Decompiled 6 days 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.Globalization; 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.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.Json; using System.Text.RegularExpressions; using Breakwater; using HarmonyLib; using Il2Cpp; using Il2CppFishNet; using Il2CppFishNet.Connection; using Il2CppFishNet.Managing; using Il2CppFishNet.Managing.Client; using Il2CppFishNet.Managing.Logging; using Il2CppFishNet.Managing.Object; using Il2CppFishNet.Managing.Server; using Il2CppFishNet.Object; using Il2CppFishNet.Observing; using Il2CppFishNet.Transporting; using Il2CppFishNet.Transporting.Multipass; using Il2CppFishNet.Transporting.Tugboat; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppRootMotion.FinalIK; using Il2CppScheduleOne; using Il2CppScheduleOne.Avatar; using Il2CppScheduleOne.Avatar.Impostors; using Il2CppScheduleOne.Avatar.Tools; using Il2CppScheduleOne.AvatarFramework; using Il2CppScheduleOne.AvatarFramework.Animation; using Il2CppScheduleOne.AvatarFramework.Impostors; using Il2CppScheduleOne.Building; using Il2CppScheduleOne.CharacterCreator; using Il2CppScheduleOne.Core.Avatar; using Il2CppScheduleOne.Core.Avatar.Properties; using Il2CppScheduleOne.Core.Items.Framework; using Il2CppScheduleOne.Core.Weather; using Il2CppScheduleOne.Cutscenes; using Il2CppScheduleOne.Delivery; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.Dialogue; using Il2CppScheduleOne.Doors; using Il2CppScheduleOne.Economy; using Il2CppScheduleOne.EntityFramework; using Il2CppScheduleOne.Equipping; using Il2CppScheduleOne.GameTime; using Il2CppScheduleOne.Graffiti; using Il2CppScheduleOne.Interaction; using Il2CppScheduleOne.ItemFramework; using Il2CppScheduleOne.Law; using Il2CppScheduleOne.Map; using Il2CppScheduleOne.Messaging; using Il2CppScheduleOne.Misc; using Il2CppScheduleOne.Money; using Il2CppScheduleOne.NPCs; using Il2CppScheduleOne.NPCs.Behaviour; using Il2CppScheduleOne.NPCs.Framework; using Il2CppScheduleOne.NPCs.Other; using Il2CppScheduleOne.NPCs.Relation; using Il2CppScheduleOne.NPCs.Schedules; using Il2CppScheduleOne.Networking; using Il2CppScheduleOne.ObjectScripts; using Il2CppScheduleOne.Persistence; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.Police; using Il2CppScheduleOne.Product; using Il2CppScheduleOne.Product.Packaging; using Il2CppScheduleOne.Property; using Il2CppScheduleOne.Quests; using Il2CppScheduleOne.SpecialCustomers; using Il2CppScheduleOne.Storage; using Il2CppScheduleOne.Tiles; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.UI.MainMenu; using Il2CppScheduleOne.UI.Phone; using Il2CppScheduleOne.UI.Phone.ContactsApp; using Il2CppScheduleOne.UI.Phone.Delivery; using Il2CppScheduleOne.UI.Phone.Map; using Il2CppScheduleOne.UI.Phone.Messages; using Il2CppScheduleOne.UI.Relations; using Il2CppScheduleOne.UI.Shop; using Il2CppScheduleOne.Variables; using Il2CppScheduleOne.Vehicles; using Il2CppScheduleOne.VoiceOver; using Il2CppSteamworks; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Reflection; using Il2CppTMPro; using MelonLoader; using MelonLoader.Utils; using Unity.AI.Navigation; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.Rendering.Universal; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(BreakwaterMod), "Breakwater Island Runtime", "0.1.0", "SimonAchton", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: MelonGame("TVGS", "Schedule I Breakwater Test")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] namespace Breakwater; public static class ActionProbe { private static string Ev(UnityEventBase e) { if (e == null) { return "-"; } StringBuilder stringBuilder = new StringBuilder(); int num = 0; try { num = e.GetPersistentEventCount(); } catch { return "?"; } for (int i = 0; i < num; i++) { string value = "?"; string value2 = "?"; try { Object persistentTarget = e.GetPersistentTarget(i); value = ((persistentTarget == (Object)null) ? "null" : (((MemberInfo)((Object)persistentTarget).GetIl2CppType()).Name + ":" + persistentTarget.name)); } catch { } try { value2 = e.GetPersistentMethodName(i); } catch { } StringBuilder stringBuilder2 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(3, 2, stringBuilder2); handler.AppendFormatted(value); handler.AppendLiteral("."); handler.AppendFormatted(value2); handler.AppendLiteral("; "); stringBuilder2.Append(ref handler); } if (num != 0) { return stringBuilder.ToString(); } return "-"; } public static IEnumerator Run() { float t0 = Time.realtimeSinceStartup; if ((Object)(object)Island.Root == (Object)null) { yield return Island.Load(); } while (((Object)(object)Island.Root == (Object)null || Island.Loading || !IslandNpcs.Ready) && Time.realtimeSinceStartup - t0 < 400f) { yield return Util.Wait(1f); } yield return Util.Wait(5f); Dictionary<string, List<string>> dictionary = new Dictionary<string, List<string>>(); int num = 0; int num2 = 0; HashSet<IntPtr> hashSet = new HashSet<IntPtr>(); foreach (IslandNpcs.Rec item in IslandNpcs.All) { if ((Object)(object)item.npc != (Object)null) { hashSet.Add(((Il2CppObjectBase)item.npc).Pointer); } } foreach (NPC item2 in Object.FindObjectsOfType<NPC>(true)) { if ((Object)(object)item2 == (Object)null) { continue; } bool flag = hashSet.Contains(((Il2CppObjectBase)item2).Pointer); if (!flag) { num++; } foreach (NPCEvent_LocationBasedAction componentsInChild in ((Component)item2).GetComponentsInChildren<NPCEvent_LocationBasedAction>(true)) { num2++; string text = (flag ? "ISLAND " : "native ") + "start[" + Ev((UnityEventBase)(object)componentsInChild.onStartAction) + "] end[" + Ev((UnityEventBase)(object)componentsInChild.onEndAction) + "]"; string key = Regex.Replace(text, ":[^.;\\]]*\\.", ":*."); if (!dictionary.TryGetValue(key, out var value)) { value = (dictionary[key] = new List<string>()); } if (value.Count < 6) { value.Add($"{item2.FullName}/'{((Object)((Component)componentsInChild).gameObject).name}' {text}"); } else { value.Add(null); } } } Util.R($"INFO native NPCs {num}, location actions {num2}, patterns {dictionary.Count}"); foreach (KeyValuePair<string, List<string>> item3 in dictionary) { Util.R($"PATTERN x{item3.Value.Count}: {item3.Key}"); foreach (string item4 in item3.Value) { if (item4 != null) { Util.R(" e.g. " + item4); } } } foreach (IslandNpcs.Rec item5 in IslandNpcs.All) { if ((Object)(object)item5.npc == (Object)null || item5.role != "customer") { continue; } foreach (var (slot, val) in item5.actions) { if (slot.kind != "stand") { continue; } StringBuilder stringBuilder = new StringBuilder($"INFO {item5.Name} stand action '{((Object)((Component)val).gameObject).name}' components:"); foreach (Component component in ((Component)val).GetComponents<Component>()) { stringBuilder.Append(" " + ((MemberInfo)((Object)component).GetIl2CppType()).Name); } for (int i = 0; i < ((Component)val).transform.childCount; i++) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(9, 1, stringBuilder2); handler.AppendLiteral(" child '"); handler.AppendFormatted(((Object)((Component)val).transform.GetChild(i)).name); handler.AppendLiteral("'"); stringBuilder3.Append(ref handler); } Util.R(stringBuilder.ToString()); break; } break; } Scene scene; try { foreach (FlockController item6 in Resources.FindObjectsOfTypeAll<FlockController>()) { if ((Object)(object)item6 == (Object)null) { continue; } DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(82, 13); defaultInterpolatedStringHandler.AppendLiteral("INFO flock '"); defaultInterpolatedStringHandler.AppendFormatted(((Object)item6).name); defaultInterpolatedStringHandler.AppendLiteral("' scene '"); scene = ((Component)item6).gameObject.scene; defaultInterpolatedStringHandler.AppendFormatted(((Scene)(ref scene)).name); defaultInterpolatedStringHandler.AppendLiteral("' path "); defaultInterpolatedStringHandler.AppendFormatted(Util.Path(((Component)item6).transform)); defaultInterpolatedStringHandler.AppendLiteral(" at "); defaultInterpolatedStringHandler.AppendFormatted(Util.V(((Component)item6).transform.position)); defaultInterpolatedStringHandler.AppendLiteral(" amount "); defaultInterpolatedStringHandler.AppendFormatted(item6._childAmount); defaultInterpolatedStringHandler.AppendLiteral(" speed "); defaultInterpolatedStringHandler.AppendFormatted(item6._minSpeed); defaultInterpolatedStringHandler.AppendLiteral("-"); defaultInterpolatedStringHandler.AppendFormatted(item6._maxSpeed); defaultInterpolatedStringHandler.AppendLiteral(" scale "); defaultInterpolatedStringHandler.AppendFormatted(item6._minScale); defaultInterpolatedStringHandler.AppendLiteral("-"); defaultInterpolatedStringHandler.AppendFormatted(item6._maxScale); defaultInterpolatedStringHandler.AppendLiteral(" posSphere "); defaultInterpolatedStringHandler.AppendFormatted(item6._positionSphere); defaultInterpolatedStringHandler.AppendLiteral("/"); defaultInterpolatedStringHandler.AppendFormatted(item6._positionSphereHeight); defaultInterpolatedStringHandler.AppendLiteral("/"); defaultInterpolatedStringHandler.AppendFormatted(item6._positionSphereDepth); defaultInterpolatedStringHandler.AppendLiteral(" spawnSphere "); defaultInterpolatedStringHandler.AppendFormatted(item6._spawnSphere); StringBuilder stringBuilder4 = new StringBuilder(defaultInterpolatedStringHandler.ToStringAndClear()); FlockChild childPrefab = item6._childPrefab; StringBuilder stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler; if ((Object)(object)childPrefab != (Object)null) { stringBuilder2 = stringBuilder4; StringBuilder stringBuilder5 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(10, 1, stringBuilder2); handler.AppendLiteral(" child '"); handler.AppendFormatted(((Object)childPrefab).name); handler.AppendLiteral("':"); stringBuilder5.Append(ref handler); foreach (SkinnedMeshRenderer componentsInChild2 in ((Component)childPrefab).GetComponentsInChildren<SkinnedMeshRenderer>(true)) { stringBuilder2 = stringBuilder4; StringBuilder stringBuilder6 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(18, 2, stringBuilder2); handler.AppendLiteral(" skinned '"); Mesh sharedMesh = componentsInChild2.sharedMesh; handler.AppendFormatted((sharedMesh != null) ? ((Object)sharedMesh).name : null); handler.AppendLiteral("' mat '"); Material sharedMaterial = ((Renderer)componentsInChild2).sharedMaterial; handler.AppendFormatted((sharedMaterial != null) ? ((Object)sharedMaterial).name : null); handler.AppendLiteral("'"); stringBuilder6.Append(ref handler); } foreach (MeshFilter componentsInChild3 in ((Component)childPrefab).GetComponentsInChildren<MeshFilter>(true)) { stringBuilder2 = stringBuilder4; StringBuilder stringBuilder7 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(8, 1, stringBuilder2); handler.AppendLiteral(" mesh '"); Mesh sharedMesh2 = componentsInChild3.sharedMesh; handler.AppendFormatted((sharedMesh2 != null) ? ((Object)sharedMesh2).name : null); handler.AppendLiteral("'"); stringBuilder7.Append(ref handler); } } stringBuilder2 = stringBuilder4; StringBuilder stringBuilder8 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(17, 1, stringBuilder2); handler.AppendLiteral(" active children "); handler.AppendFormatted(item6._roamers?.Count); stringBuilder8.Append(ref handler); Util.R(stringBuilder4.ToString()); } foreach (FlockChild item7 in Resources.FindObjectsOfTypeAll<FlockChild>()) { if ((Object)(object)item7 != (Object)null) { DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(34, 3); defaultInterpolatedStringHandler.AppendLiteral("INFO flock child '"); defaultInterpolatedStringHandler.AppendFormatted(((Object)item7).name); defaultInterpolatedStringHandler.AppendLiteral("' scene '"); scene = ((Component)item7).gameObject.scene; defaultInterpolatedStringHandler.AppendFormatted(((Scene)(ref scene)).name); defaultInterpolatedStringHandler.AppendLiteral("' path "); defaultInterpolatedStringHandler.AppendFormatted(Util.Path(((Component)item7).transform)); Util.R(defaultInterpolatedStringHandler.ToStringAndClear()); } } foreach (Mesh item8 in Resources.FindObjectsOfTypeAll<Mesh>()) { if ((Object)(object)item8 != (Object)null && ((Object)item8).name.ToLowerInvariant().Contains("gull")) { Util.R($"INFO mesh '{((Object)item8).name}' verts {item8.vertexCount}"); } } foreach (GameObject item9 in Resources.FindObjectsOfTypeAll<GameObject>()) { if ((Object)(object)item9 != (Object)null && ((Object)item9).name.ToLowerInvariant().Contains("gull")) { DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(41, 4); defaultInterpolatedStringHandler.AppendLiteral("INFO object '"); defaultInterpolatedStringHandler.AppendFormatted(((Object)item9).name); defaultInterpolatedStringHandler.AppendLiteral("' scene '"); scene = item9.scene; defaultInterpolatedStringHandler.AppendFormatted(((Scene)(ref scene)).name); defaultInterpolatedStringHandler.AppendLiteral("' path "); defaultInterpolatedStringHandler.AppendFormatted(Util.Path(item9.transform)); defaultInterpolatedStringHandler.AppendLiteral(" components "); defaultInterpolatedStringHandler.AppendFormatted(string.Join(",", ((IEnumerable<Component>)item9.GetComponents<Component>()).Select((Component c) => ((MemberInfo)((Object)c).GetIl2CppType()).Name))); Util.R(defaultInterpolatedStringHandler.ToStringAndClear()); } } } catch (Exception ex) { Util.R("INFO birds: " + ex.Message); } try { foreach (Quest item10 in Resources.FindObjectsOfTypeAll<Quest>()) { if ((Object)(object)item10 == (Object)null) { continue; } scene = ((Component)item10).gameObject.scene; if (((Scene)(ref scene)).name != "Main") { continue; } StringBuilder stringBuilder9 = new StringBuilder($"QUEST '{item10.title}' class {((Object)item10).GetIl2CppType().FullName} guid {item10.StaticGUID} entries {item10.Entries?.Count} autostart {item10.AutoStartFirstEntry} autocomplete {item10.AutoCompleteOnAllEntriesComplete} icon {(((Object)(object)item10.IconPrefab != (Object)null) ? ((Object)item10.IconPrefab).name : "null")} state {item10.State}:"); if (item10.Entries != null) { Enumerator<QuestEntry> enumerator15 = item10.Entries.GetEnumerator(); while (enumerator15.MoveNext()) { QuestEntry current15 = enumerator15.Current; if ((Object)(object)current15 != (Object)null) { StringBuilder stringBuilder2 = stringBuilder9; StringBuilder stringBuilder10 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(34, 5, stringBuilder2); handler.AppendLiteral(" ["); handler.AppendFormatted(((MemberInfo)((Object)current15).GetIl2CppType()).Name); handler.AppendLiteral(" '"); handler.AppendFormatted(current15.EntryTitle); handler.AppendLiteral("' autoPoI "); handler.AppendFormatted(current15.AutoCreatePoI); handler.AppendLiteral(" poi "); handler.AppendFormatted(((Object)(object)current15.PoILocation != (Object)null) ? Util.V(current15.PoILocation.position) : "-"); handler.AppendLiteral(" autocomplete "); handler.AppendFormatted(current15.AutoComplete); handler.AppendLiteral("]"); stringBuilder10.Append(ref handler); } } } StringBuilder stringBuilder11 = new StringBuilder(); foreach (Component component2 in ((Component)item10).GetComponents<Component>()) { stringBuilder11.Append(((MemberInfo)((Object)component2).GetIl2CppType()).Name + " "); } stringBuilder9.Append(" components " + stringBuilder11); Util.R(stringBuilder9.ToString()); } } catch (Exception ex2) { Util.R("INFO quests: " + ex2.Message); } Util.R("PASS action probe done"); } } public static class Ambience { private class Rec { public string id { get; set; } public string kind { get; set; } public string clip { get; set; } public List<string> clips { get; set; } public string file { get; set; } public float[] rect { get; set; } public float fade { get; set; } = 25f; public float[] pos { get; set; } public float maxDistance { get; set; } = 14f; public float minDistance { get; set; } = 2f; public float volume { get; set; } = 0.5f; public float fadeSeconds { get; set; } = 4f; public bool nightOnly { get; set; } public bool music { get; set; } public float[] interval { get; set; } } private class Src { public Rec r; public AudioSource a; public float vol; public float next; public List<AudioClip> pool = new List<AudioClip>(); public int last = -1; } private static readonly List<Src> srcs = new List<Src>(); private static GameObject root; private static float nextNight; private static bool night; public static string Report = "no ambience"; private static AudioClip LoadWav(string path) { byte[] array = File.ReadAllBytes(path); if (array.Length < 44 || array[0] != 82 || array[1] != 73 || array[2] != 70 || array[3] != 70) { throw new Exception("not a RIFF file"); } int num = 12; int num2 = 1; int num3 = 2; int num4 = 48000; int num5 = 16; int num6 = -1; int num7 = 0; while (num + 8 <= array.Length) { string text = Encoding.ASCII.GetString(array, num, 4); int num8 = BitConverter.ToInt32(array, num + 4); num += 8; if (text == "fmt ") { num2 = BitConverter.ToUInt16(array, num); num3 = BitConverter.ToUInt16(array, num + 2); num4 = BitConverter.ToInt32(array, num + 4); num5 = BitConverter.ToUInt16(array, num + 14); if (num2 == 65534 && num8 >= 26) { num2 = BitConverter.ToUInt16(array, num + 24); } } else if (text == "data") { num6 = num; num7 = Math.Min(num8, array.Length - num); break; } num += num8 + (num8 & 1); } if (num6 < 0) { throw new Exception("no data chunk"); } int num9 = num5 / 8; int num10 = num7 / num9; Il2CppStructArray<float> val = new Il2CppStructArray<float>((long)num10); int num11 = 0; int num12 = num6; while (num11 < num10) { float num13 = ((num2 == 3 && num5 == 32) ? BitConverter.ToSingle(array, num12) : (num5 switch { 16 => (float)BitConverter.ToInt16(array, num12) / 32768f, 24 => (float)(array[num12] | (array[num12 + 1] << 8) | ((sbyte)array[num12 + 2] << 16)) / 8388608f, 32 => (float)BitConverter.ToInt32(array, num12) / 2.1474836E+09f, _ => (float)(array[num12] - 128) / 128f, })); ((Il2CppArrayBase<float>)(object)val)[num11] = num13; num11++; num12 += num9; } AudioClip obj = AudioClip.Create("BW_" + Path.GetFileNameWithoutExtension(path), num10 / num3, num3, num4, false); obj.SetData(val, 0); Island.Own((Object)(object)obj); return obj; } public static void Load(string islandDir, Transform parent) { //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Expected O, but got Unknown //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Expected O, but got Unknown //IL_0545: Unknown result type (might be due to invalid IL or missing references) Clear(); string path = Path.Combine(islandDir, "ambience.json"); if (!File.Exists(path)) { Report = "no ambience.json"; return; } List<Rec> list; try { list = JsonSerializer.Deserialize<List<Rec>>(File.ReadAllText(path)); } catch (Exception ex) { Report = "ambience.json: " + ex.Message; BreakwaterMod.Log.Warning(Report); return; } Dictionary<string, AudioClip> dictionary = new Dictionary<string, AudioClip>(); AudioMixerGroup val = null; AudioMixerGroup val2 = null; string text = ""; try { foreach (AudioClip item in Resources.FindObjectsOfTypeAll<AudioClip>()) { if ((Object)(object)item != (Object)null && !dictionary.ContainsKey(((Object)item).name)) { dictionary[((Object)item).name] = item; } } } catch (Exception ex2) { BreakwaterMod.Log.Warning("ambience clips: " + ex2.Message); } try { foreach (AudioSource item2 in Resources.FindObjectsOfTypeAll<AudioSource>()) { if ((Object)(object)item2 == (Object)null) { continue; } AudioMixerGroup outputAudioMixerGroup = item2.outputAudioMixerGroup; if (!((Object)(object)outputAudioMixerGroup == (Object)null)) { string text2 = ((Object)outputAudioMixerGroup).name ?? ""; if ((Object)(object)val == (Object)null && (text2.ToLowerInvariant().Contains("ambient") || text2.ToLowerInvariant().Contains("ambience") || ((Object)(object)item2.clip != (Object)null && ((Object)item2.clip).name == "Urban noise loop FIXED"))) { val = outputAudioMixerGroup; } if ((Object)(object)val2 == (Object)null && text2.ToLowerInvariant().Contains("music")) { val2 = outputAudioMixerGroup; } if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null) { break; } } } HashSet<string> hashSet = new HashSet<string>(); foreach (AudioSource item3 in Resources.FindObjectsOfTypeAll<AudioSource>()) { if ((Object)(object)item3 != (Object)null && (Object)(object)item3.outputAudioMixerGroup != (Object)null) { hashSet.Add(((Object)item3.outputAudioMixerGroup).name); } if (hashSet.Count > 14) { break; } } text = $"mixer groups: ambient '{(((Object)(object)val != (Object)null) ? ((Object)val).name : "-")}', music '{(((Object)(object)val2 != (Object)null) ? ((Object)val2).name : "-")}' (the game has: {string.Join(", ", hashSet)})"; } catch (Exception ex3) { text = "mixer groups: " + ex3.Message; } root = new GameObject("BW_Ambience"); root.transform.SetParent(parent, false); StringBuilder stringBuilder = new StringBuilder(); int num = 0; foreach (Rec item4 in list) { try { Src src = new Src { r = item4 }; AudioClip value = null; if (item4.file != null) { string path2 = Path.Combine(islandDir, item4.file); if (File.Exists(path2)) { value = LoadWav(path2); goto IL_0439; } StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(17, 2, stringBuilder2); handler.AppendFormatted(item4.id); handler.AppendLiteral(": file "); handler.AppendFormatted(item4.file); handler.AppendLiteral(" missing; "); stringBuilder3.Append(ref handler); } else { if (item4.clip == null || dictionary.TryGetValue(item4.clip, out value)) { goto IL_0439; } StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(34, 2, stringBuilder2); handler.AppendFormatted(item4.id); handler.AppendLiteral(": the game has no clip '"); handler.AppendFormatted(item4.clip); handler.AppendLiteral("' loaded; "); stringBuilder4.Append(ref handler); } goto end_IL_0338; IL_0439: if (item4.clips != null) { foreach (string clip in item4.clips) { if (dictionary.TryGetValue(clip, out var value2)) { src.pool.Add(value2); } } } if ((Object)(object)value == (Object)null && src.pool.Count == 0) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder5 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(19, 1, stringBuilder2); handler.AppendFormatted(item4.id); handler.AppendLiteral(": nothing to play; "); stringBuilder5.Append(ref handler); continue; } GameObject val3 = new GameObject("BW_ambience_" + item4.id); val3.transform.SetParent(root.transform, false); if (item4.pos != null && item4.pos.Length == 3) { val3.transform.position = new Vector3(item4.pos[0], item4.pos[1], item4.pos[2]); } AudioSource val4 = val3.AddComponent<AudioSource>(); val4.playOnAwake = false; val4.clip = value; val4.loop = item4.kind != "gulls"; val4.volume = 0f; val4.dopplerLevel = 0f; val4.priority = 200; bool flag = item4.kind == "point" || item4.kind == "gulls"; val4.spatialBlend = (flag ? 1f : 0f); val4.rolloffMode = (AudioRolloffMode)1; val4.minDistance = item4.minDistance; val4.maxDistance = item4.maxDistance; val4.spread = (flag ? 60f : 0f); AudioMixerGroup val5 = ((item4.music && (Object)(object)val2 != (Object)null) ? val2 : val); if ((Object)(object)val5 != (Object)null) { val4.outputAudioMixerGroup = val5; } src.a = val4; srcs.Add(src); num++; end_IL_0338:; } catch (Exception ex4) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder6 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(4, 2, stringBuilder2); handler.AppendFormatted(item4.id); handler.AppendLiteral(": "); handler.AppendFormatted(ex4.Message); handler.AppendLiteral("; "); stringBuilder6.Append(ref handler); } } Report = $"ambience: {num} of {list.Count} sources ready; {text}; {stringBuilder}"; BreakwaterMod.Log.Msg(Report); } public static void Update() { //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) //IL_018c: 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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) if (srcs.Count == 0) { return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } Vector3 position = ((Component)main).transform.position; float num = Mathf.Min(Time.unscaledDeltaTime, 0.1f); if (Time.unscaledTime > nextNight) { nextNight = Time.unscaledTime + 2f; night = DevKeys.IsNight(); } foreach (Src src in srcs) { Rec r = src.r; if ((Object)(object)src.a == (Object)null) { continue; } float num2 = r.volume; if (r.nightOnly && !night) { num2 = 0f; } if (r.rect != null && r.rect.Length == 4) { float num3 = Mathf.Max(new float[3] { r.rect[0] - position.x, 0f, position.x - r.rect[2] }); float num4 = Mathf.Max(new float[3] { r.rect[1] - position.z, 0f, position.z - r.rect[3] }); float num5 = Mathf.Sqrt(num3 * num3 + num4 * num4); num2 *= Mathf.Clamp01(1f - num5 / Mathf.Max(r.fade, 1f)); if (position.y > 45f) { num2 *= 0.4f; } } else if (r.pos != null) { Vector3 val = position - ((Component)src.a).transform.position; if (((Vector3)(ref val)).sqrMagnitude > (r.maxDistance + 10f) * (r.maxDistance + 10f)) { num2 = 0f; } } src.vol = Mathf.MoveTowards(src.vol, num2, r.volume * num / Mathf.Max(r.fadeSeconds, 0.2f)); if (r.kind == "gulls") { if (src.vol < 0.05f || src.pool.Count == 0) { src.next = 0f; continue; } if (src.next <= 0f) { src.next = Time.time + Random.Range(3f, 9f); } if (Time.time >= src.next && !src.a.isPlaying) { float num6 = ((r.interval != null && r.interval.Length == 2) ? r.interval[0] : 9f); float num7 = ((r.interval != null && r.interval.Length == 2) ? r.interval[1] : 21f); src.next = Time.time + Random.Range(num6, num7); int num8 = Random.Range(0, src.pool.Count); if (num8 == src.last && src.pool.Count > 1) { num8 = (num8 + 1) % src.pool.Count; } src.last = num8; float num9 = Random.Range(0f, 6.283f); float num10 = Random.Range(14f, 38f); ((Component)src.a).transform.position = position + new Vector3(Mathf.Cos(num9) * num10, Random.Range(6f, 16f), Mathf.Sin(num9) * num10); src.a.maxDistance = 90f; src.a.minDistance = 8f; src.a.clip = src.pool[num8]; src.a.volume = src.vol * Random.Range(0.7f, 1f); src.a.pitch = Random.Range(0.94f, 1.06f); src.a.Play(); } continue; } src.a.volume = src.vol; if (src.vol > 0.002f) { if (!src.a.isPlaying) { src.a.Play(); } } else if (src.a.isPlaying) { src.a.Stop(); } } } public static string State() { StringBuilder stringBuilder = new StringBuilder(); foreach (Src src in srcs) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(4, 3, stringBuilder2); handler.AppendFormatted(src.r.id); handler.AppendLiteral(" "); handler.AppendFormatted(((Object)(object)src.a != (Object)null && src.a.isPlaying) ? "playing" : "silent"); handler.AppendLiteral(" "); handler.AppendFormatted(src.vol, "F2"); handler.AppendLiteral("; "); stringBuilder2.Append(ref handler); } return stringBuilder.ToString(); } public static void Clear() { srcs.Clear(); if ((Object)(object)root != (Object)null) { Object.Destroy((Object)(object)root); } root = null; Report = "no ambience"; } } public static class Approach { private static NavMeshData data; private static NavMeshDataInstance inst; public static string Report = ""; private static readonly List<NavMeshLinkInstance> rampLinks = new List<NavMeshLinkInstance>(); private static NavMeshBuildSource Box(Vector3 top, Vector3 bottom, float width, float th) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) Vector3 val = bottom - top; Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up); Vector3 val3 = (top + bottom) / 2f - val2 * Vector3.up * (th / 2f); NavMeshBuildSource result = default(NavMeshBuildSource); ((NavMeshBuildSource)(ref result)).shape = (NavMeshBuildSourceShape)2; ((NavMeshBuildSource)(ref result)).size = new Vector3(width, th, ((Vector3)(ref val)).magnitude + 0.12f); ((NavMeshBuildSource)(ref result)).transform = Matrix4x4.TRS(val3, val2, Vector3.one); ((NavMeshBuildSource)(ref result)).area = 0; return result; } public static void Build() { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_021a: 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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0271: 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_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: 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_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_0135: 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) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) Remove(); Stopwatch stopwatch = Stopwatch.StartNew(); GameObject val = GameObject.Find("Map/Hyland Point/Overpass"); if ((Object)(object)val == (Object)null) { Report = "approach: Overpass root not found"; BreakwaterMod.Log.Warning(Report); return; } OverpassSurface.Apply(((Object)(object)Island.Root != (Object)null) ? Island.Root.transform : null); List<NavMeshBuildSource> val2 = new List<NavMeshBuildSource>(); int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; foreach (BoxCollider componentsInChild in val.GetComponentsInChildren<BoxCollider>(true)) { if ((Object)(object)componentsInChild == (Object)null || ((Collider)componentsInChild).isTrigger) { continue; } if (IsBlocker(((Component)componentsInChild).transform)) { num3++; continue; } if (Under(((Component)componentsInChild).transform, "Overpass Ramp") && ((Object)((Component)componentsInChild).gameObject).name != "Concrete") { num4++; continue; } Vector3 val3 = ((Component)componentsInChild).transform.TransformPoint(componentsInChild.center); if (!(val3.z < -100f) && !(val3.z > 147f) && !(val3.x < -34f) && !(val3.x > 8f)) { if (val3.x > -14f && val3.x < -8f && val3.z > -95f && val3.z < -80f && val3.y > 10f) { num2++; continue; } NavMeshBuildSource val4 = default(NavMeshBuildSource); ((NavMeshBuildSource)(ref val4)).shape = (NavMeshBuildSourceShape)2; ((NavMeshBuildSource)(ref val4)).size = componentsInChild.size; ((NavMeshBuildSource)(ref val4)).transform = ((Component)componentsInChild).transform.localToWorldMatrix * Matrix4x4.Translate(componentsInChild.center); ((NavMeshBuildSource)(ref val4)).area = 0; val2.Add(val4); num++; } } foreach (var (top, bottom) in OverpassSurface.RampSegments) { val2.Add(Box(top, bottom, 9.8f, 0.35f)); } NavMeshBuildSettings settingsByID = NavMesh.GetSettingsByID(0); Bounds val5 = default(Bounds); ((Bounds)(ref val5))..ctor(new Vector3(-13f, 2f, 22f), new Vector3(46f, 30f, 256f)); data = NavMeshBuilder.BuildNavMeshData(settingsByID, val2, val5, Vector3.zero, Quaternion.identity); if ((Object)(object)data != (Object)null) { inst = NavMesh.AddNavMeshData(data); } string value = AddRampLinks(); stopwatch.Stop(); Report = $"approach navmesh: {num} overpass boxes ({OverpassSurface.SlabsLowered} deck slabs at visible road height, {num2} junction parapet boxes left open, {num3} road-blocker and {num4} native ramp boxes excluded) + {OverpassSurface.RampSegments.Count} ramp profile segments, valid={((NavMeshDataInstance)(ref inst)).valid}, {value}, {stopwatch.ElapsedMilliseconds} ms"; BreakwaterMod.Log.Msg(Report); } private static bool Under(Transform t, string name) { Transform val = t; while ((Object)(object)val != (Object)null) { if (((Object)val).name == name) { return true; } val = val.parent; } return false; } private static bool IsBlocker(Transform t) { Transform val = t; while ((Object)(object)val != (Object)null) { if (((Object)val).name.StartsWith("RoadBlocker4")) { return true; } val = val.parent; } return false; } private static void Pair(Vector3 a, Vector3 b) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NavMeshLinkData val = default(NavMeshLinkData); ((NavMeshLinkData)(ref val)).startPosition = a; ((NavMeshLinkData)(ref val)).endPosition = b; ((NavMeshLinkData)(ref val)).width = 2f; ((NavMeshLinkData)(ref val)).costModifier = -1f; ((NavMeshLinkData)(ref val)).bidirectional = true; ((NavMeshLinkData)(ref val)).area = 0; ((NavMeshLinkData)(ref val)).agentTypeID = 0; NavMeshLinkData val2 = val; rampLinks.Add(NavMesh.AddLink(val2)); NavMeshLinkData val3 = val2; ((NavMeshLinkData)(ref val3)).startPosition = b; ((NavMeshLinkData)(ref val3)).endPosition = a; rampLinks.Add(NavMesh.AddLink(val3)); LinkTraverser.Register(a, b); } public static string AddRampLinks() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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) RemoveRampLink(); if (!Gate.S.bridgeRepaired) { return "ramp link withheld (bridge closed: NPCs stay off the overpass)"; } if (!((NavMeshDataInstance)(ref inst)).valid) { return "approach navmesh missing"; } NavMeshQueryFilter val = new NavMeshQueryFilter { agentTypeID = 0, areaMask = -1 }; NavMeshHit val2 = default(NavMeshHit); if (!NavMesh.SamplePosition(new Vector3(-3f, 0.05f, -42.5f), ref val2, 1.5f, val)) { return "no native Humanoid road at the ramp foot"; } Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(-3f, 0.1f, -46.5f); Pair(((NavMeshHit)(ref val2)).position, val3); string text = ""; NavMeshHit val4 = default(NavMeshHit); NavMeshHit val5 = default(NavMeshHit); if (NavMesh.SamplePosition(new Vector3(-6.5f, 10.2f, -86.5f), ref val4, 2f, val) && NavMesh.SamplePosition(new Vector3(-14.5f, 10.2f, -86.5f), ref val5, 2f, val)) { Pair(((NavMeshHit)(ref val4)).position, ((NavMeshHit)(ref val5)).position); text = "; ramp top " + Util.V(((NavMeshHit)(ref val4)).position) + " <-> deck " + Util.V(((NavMeshHit)(ref val5)).position); } else { text = "; ramp top link: no navmesh at one end"; } int num = 0; foreach (NavMeshLinkInstance rampLink in rampLinks) { NavMeshLinkInstance current = rampLink; if (((NavMeshLinkInstance)(ref current)).valid) { num++; } } return $"ramp links {num}/{rampLinks.Count} valid: road {Util.V(((NavMeshHit)(ref val2)).position)} <-> ramp {Util.V(val3)}{text}"; } public static void RemoveRampLink() { //IL_000f: 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_001e: Unknown result type (might be due to invalid IL or missing references) foreach (NavMeshLinkInstance rampLink in rampLinks) { NavMeshLinkInstance current = rampLink; if (((NavMeshLinkInstance)(ref current)).valid) { NavMesh.RemoveLink(current); } } rampLinks.Clear(); } public static NavMeshLinkInstance AddTestLink(Vector3 a, Vector3 b, float width) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000a: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) NavMeshLinkData val = default(NavMeshLinkData); ((NavMeshLinkData)(ref val)).startPosition = a; ((NavMeshLinkData)(ref val)).endPosition = b; ((NavMeshLinkData)(ref val)).width = width; ((NavMeshLinkData)(ref val)).costModifier = -1f; ((NavMeshLinkData)(ref val)).bidirectional = true; ((NavMeshLinkData)(ref val)).area = 0; ((NavMeshLinkData)(ref val)).agentTypeID = 0; return NavMesh.AddLink(val); } public static void Remove() { //IL_0020: 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) RemoveRampLink(); if (((NavMeshDataInstance)(ref inst)).valid) { NavMesh.RemoveNavMeshData(inst); } inst = default(NavMeshDataInstance); if ((Object)(object)data != (Object)null) { Object.Destroy((Object)(object)data); data = null; } OverpassSurface.Restore(); } } public static class AutoTest { private static Dictionary<string, string> cfg; public const string WorldName = "Breakwater Test"; public static bool Quiet; public static string Cfg(string key, string def) { if (cfg == null) { cfg = new Dictionary<string, string>(); string[] array = File.ReadAllLines(Path.Combine(BreakwaterMod.Dir, "autotest.cfg")); foreach (string text in array) { int num = text.IndexOf('='); if (num > 0) { cfg[text.Substring(0, num).Trim()] = text.Substring(num + 1).Trim(); } } } if (!cfg.TryGetValue(key, out var value)) { return def; } return value; } public static IEnumerator Run() { Util.Report.Clear(); Util.R("autotest start " + DateTime.Now.ToString("s") + " mode=" + Cfg("mode", "probe")); int slot = int.Parse(Cfg("slot", "0")); string mode = Cfg("mode", "probe"); if (mode.StartsWith("coop")) { Application.runInBackground = true; } if (mode == "coopguest") { yield return Guard(CoopProbe.Guest()); Util.R("autotest done"); if (Cfg("quit", "1") == "1") { yield return Util.Wait(2f); Application.Quit(); } yield break; } float t0 = Time.realtimeSinceStartup; SetupScreen setup = null; while (Time.realtimeSinceStartup - t0 < 180f) { Il2CppArrayBase<SetupScreen> val = Resources.FindObjectsOfTypeAll<SetupScreen>(); if (val != null && val.Length > 0 && (Object)(object)Singleton<LoadManager>.Instance != (Object)null) { setup = val[0]; break; } yield return Util.Wait(1f); } if ((Object)(object)setup == (Object)null) { Util.R("FAIL: SetupScreen not found"); yield break; } yield return Util.Wait(4f); Safety.CheckSavePaths(); if (!BreakwaterMod.Enabled) { yield break; } LoadManager lm = Singleton<LoadManager>.Instance; bool fresh = true; try { Il2CppReferenceArray<SaveInfo> saveGames = LoadManager.SaveGames; if (saveGames != null && slot < ((Il2CppArrayBase<SaveInfo>)(object)saveGames).Length && ((Il2CppArrayBase<SaveInfo>)(object)saveGames)[slot] != null) { if (((Il2CppArrayBase<SaveInfo>)(object)saveGames)[slot].OrganisationName != "Breakwater Test") { Util.R($"FAIL: slot {slot} is '{((Il2CppArrayBase<SaveInfo>)(object)saveGames)[slot].OrganisationName}', refusing"); yield break; } fresh = false; Util.R("reusing disposable world: " + ((Il2CppArrayBase<SaveInfo>)(object)saveGames)[slot].SavePath); lm.StartGame(((Il2CppArrayBase<SaveInfo>)(object)saveGames)[slot], false, false); } else { setup.Initialize(slot); if ((Object)(object)setup.InputField != (Object)null) { setup.InputField.text = "Breakwater Test"; } if ((Object)(object)setup.SkipIntroToggle != (Object)null) { setup.SkipIntroToggle.isOn = true; } Util.R($"creating disposable world in isolated slot {slot}"); setup.StartGame(); } } catch (Exception ex) { Util.R("FAIL starting game: " + ex); yield break; } t0 = Time.realtimeSinceStartup; while (Time.realtimeSinceStartup - t0 < 300f && (!lm.IsGameLoaded || !((Object)(object)Player.Local != (Object)null) || !((Object)(object)PlayerSingleton<PlayerMovement>.Instance != (Object)null))) { yield return Util.Wait(1f); } if (!lm.IsGameLoaded || (Object)(object)Player.Local == (Object)null) { Util.R("FAIL: game did not load"); yield break; } Util.R("game loaded (" + (fresh ? "new" : "reused") + ") at " + lm.LoadedGameFolderPath); if (LoadHold.Showing) { Util.R("the loading screen is being held for the island: " + Island.ProgressText); yield return Util.ScreenShot("load-hold"); } Safety.CheckSavePaths(); if (!BreakwaterMod.Enabled) { yield break; } yield return FinishIntro(); yield return Util.Wait(float.Parse(Cfg("settle", "8"))); IEnumerator enumerator = null; try { switch (mode) { case "probe": enumerator = Probe.Run(); break; case "navprobe": enumerator = Probe.NavProbe(); break; case "builders": enumerator = BuildersTests.Run(); break; case "navdebug": enumerator = Probe.NavDebug(); break; case "route": enumerator = BuildersTests.RunRoute(); break; case "overpass": enumerator = OverpassTests.Run(); break; case "slice": enumerator = SliceTests.Run(); break; case "drive": enumerator = DriveTest.Run(); break; case "shops": enumerator = ShopTest.Run(); break; case "interiors": enumerator = InteriorTest.Run(); break; case "propprobe": enumerator = PropertyProbe.Run(); break; case "propexp": enumerator = PropertyProbe.Experiment(); break; case "properties": enumerator = PropertyTest.Run(); break; case "blunder": enumerator = BlunderTest.Run(); break; case "scamazon": enumerator = ScamazonTest.Run(); break; case "people": enumerator = PeopleTest.Run(); break; case "police": enumerator = PoliceTest.Run(); break; case "launderprobe": enumerator = LaunderProbe.Run(); break; case "npcprobe": enumerator = NpcProbe.Run(); break; case "actionprobe": enumerator = ActionProbe.Run(); break; case "gangs": enumerator = GangTest.Run(); break; case "lowtide": enumerator = LowTideTest.Run(); break; case "bridge": enumerator = BridgeTest.Run(); break; case "lookprobe": enumerator = LookProbe.Run(); break; case "sprayprobe": enumerator = SprayProbe.Run(); break; case "gapprobe": enumerator = GapProbe.Run(); break; case "region": enumerator = RegionTest.Run(); break; case "coophost": enumerator = CoopProbe.Host(); break; case "spray": enumerator = SprayTest.Run(); break; case "gasprobe": enumerator = GasProbe.Run(); break; default: Util.R("unknown mode " + mode); break; } } catch (Exception ex2) { Util.R("FAIL mode setup: " + ex2); } if (enumerator != null) { yield return Guard(enumerator); } Util.R("autotest done"); if (Cfg("quit", "1") == "1") { yield return Util.Wait(2f); Application.Quit(); } } private static bool CloseCreator() { bool result = false; foreach (CharacterCreator item in Resources.FindObjectsOfTypeAll<CharacterCreator>()) { if ((Object)(object)item != (Object)null && item.IsOpen) { try { item.Done(); result = true; } catch (Exception ex) { Util.R("creator Done failed: " + ex.Message); } } } return result; } private static bool IntroPlaying() { foreach (IntroManager item in Resources.FindObjectsOfTypeAll<IntroManager>()) { if ((Object)(object)item != (Object)null && item.IsPlaying) { return true; } } return false; } public static IEnumerator FinishIntro() { float t0 = Time.realtimeSinceStartup; bool did = false; bool intro = IntroPlaying(); while (intro && !did && Time.realtimeSinceStartup - t0 < 200f) { did = CloseCreator(); if (!did) { yield return Util.Wait(1f); } } if (did) { Util.R($"character creator closed with Done() after {Time.realtimeSinceStartup - t0:F0}s"); yield return Util.Wait(8f); } MelonCoroutines.Start(CreatorWatch()); Util.R($"intro={intro} creatorDone={did}; player at {Util.V(((Component)Player.Local).transform.position)}"); yield return Util.Wait(2f); } private static IEnumerator CreatorWatch() { while ((Object)(object)Player.Local != (Object)null) { if (!Quiet && CloseCreator()) { BreakwaterMod.Log.Msg("watcher closed character creator"); } yield return Util.Wait(1f); } } public static IEnumerator Guard(IEnumerator e) { Stack<IEnumerator> stack = new Stack<IEnumerator>(); stack.Push(e); while (stack.Count > 0) { IEnumerator enumerator = stack.Peek(); bool flag; object obj; try { flag = enumerator.MoveNext(); obj = (flag ? enumerator.Current : null); } catch (Exception ex) { Util.R("FAIL exception: " + ex); break; } if (!flag) { stack.Pop(); } else if (obj is IEnumerator item) { stack.Push(item); } else { yield return obj; } } } } public static class AvatarDedupe { public static int Renderers(GameObject go) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 int num = 0; HashSet<string> hashSet = new HashSet<string>(); foreach (SkinnedMeshRenderer componentsInChild in go.GetComponentsInChildren<SkinnedMeshRenderer>(false)) { if (!((Object)(object)componentsInChild == (Object)null) && ((Renderer)componentsInChild).enabled && !((Object)(object)componentsInChild.sharedMesh == (Object)null) && (int)((Renderer)componentsInChild).shadowCastingMode != 3) { string item = ((Object)componentsInChild.sharedMesh).GetInstanceID() + "@" + (((Object)(object)componentsInChild.rootBone != (Object)null) ? ((Object)componentsInChild.rootBone).GetInstanceID() : 0); if (!hashSet.Add(item)) { ((Renderer)componentsInChild).enabled = false; num++; } } } return num; } public static int Run(GameObject go) { int num = 0; HashSet<string> hashSet = new HashSet<string>(); foreach (AvatarObject componentsInChild in go.GetComponentsInChildren<AvatarObject>(true)) { if (!((Object)(object)componentsInChild == (Object)null)) { Transform transform = ((Component)componentsInChild).transform; string item = (((Object)(object)transform.parent != (Object)null) ? ((Object)transform.parent).GetInstanceID().ToString() : "-") + "/" + ((Object)transform).name; if (!hashSet.Add(item)) { Object.DestroyImmediate((Object)(object)((Component)componentsInChild).gameObject); num++; } } } return num; } } public static class Birds { public static string Report = "no birds"; private static readonly List<GameObject> flocks = new List<GameObject>(); private static readonly (string name, Vector3 at, float radius, int birds)[] Places = new(string, Vector3, float, int)[2] { ("docks", new Vector3(80f, 345f, 6f), 45f, 6), ("beach", new Vector3(200f, 430f, 8f), 50f, 5) }; public static void Setup(Transform parent) { //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) Clear(); FlockController val = null; foreach (FlockController item in Resources.FindObjectsOfTypeAll<FlockController>()) { if ((Object)(object)item != (Object)null) { Scene scene = ((Component)item).gameObject.scene; if (((Scene)(ref scene)).name == "Main" && (Object)(object)item._childPrefab != (Object)null) { val = item; break; } } } if ((Object)(object)val == (Object)null) { Report = "birds: no flock in the game"; return; } StringBuilder stringBuilder = new StringBuilder($"birds from '{((Object)val).name}' (bird '{((Object)val._childPrefab).name}', sphere {val._positionSphere}):"); (string, Vector3, float, int)[] places = Places; for (int i = 0; i < places.Length; i++) { var (text, b, positionSphere, num) = places[i]; try { GameObject val2 = new GameObject("BW holder (birds)"); val2.SetActive(false); GameObject val3 = Object.Instantiate<GameObject>(((Component)val).gameObject, val2.transform); ((Object)val3).name = "BW gulls " + text; for (int num2 = val3.transform.childCount - 1; num2 >= 0; num2--) { Transform child = val3.transform.GetChild(num2); if (((Object)child).name.EndsWith("(Clone)")) { Object.DestroyImmediate((Object)(object)((Component)child).gameObject); } } FlockController component = val3.GetComponent<FlockController>(); val3.transform.position = Util.FromBlender(b); component._childAmount = num; component._positionSphere = positionSphere; component._birdAvoid = false; component._spawnSphere = Mathf.Min(component._spawnSphere, 10f); try { component._roamers?.Clear(); } catch { } val3.transform.SetParent(parent, true); Object.Destroy((Object)(object)val2); flocks.Add(val3); StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(8, 3, stringBuilder2); handler.AppendLiteral(" "); handler.AppendFormatted(text); handler.AppendLiteral(" at "); handler.AppendFormatted(Util.V(val3.transform.position)); handler.AppendLiteral(" x"); handler.AppendFormatted(num); handler.AppendLiteral(";"); stringBuilder3.Append(ref handler); } catch (Exception ex) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(4, 2, stringBuilder2); handler.AppendLiteral(" "); handler.AppendFormatted(text); handler.AppendLiteral(": "); handler.AppendFormatted(ex.Message.Split('\n')[0]); handler.AppendLiteral(";"); stringBuilder4.Append(ref handler); } } Report = stringBuilder.ToString(); BreakwaterMod.Log.Msg(Report); } public static string Count(out int total) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) total = 0; StringBuilder stringBuilder = new StringBuilder(); foreach (GameObject flock in flocks) { if ((Object)(object)flock == (Object)null) { continue; } int num = 0; float num2 = 0f; foreach (FlockChild componentsInChild in flock.GetComponentsInChildren<FlockChild>(true)) { num++; float num3 = num2; Vector3 val = ((Component)componentsInChild).transform.position - flock.transform.position; num2 = Mathf.Max(num3, ((Vector3)(ref val)).magnitude); } total += num; StringBuilder stringBuilder2 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(24, 3, stringBuilder2); handler.AppendLiteral(" ["); handler.AppendFormatted(((Object)flock).name); handler.AppendLiteral(": "); handler.AppendFormatted(num); handler.AppendLiteral(" birds, farthest "); handler.AppendFormatted(num2, "F0"); handler.AppendLiteral(" m]"); stringBuilder2.Append(ref handler); } return stringBuilder.ToString(); } public static Vector3 Centre(int i) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (i >= flocks.Count || !((Object)(object)flocks[i] != (Object)null)) { return Vector3.zero; } return flocks[i].transform.position; } public static void Clear() { foreach (GameObject flock in flocks) { if ((Object)(object)flock != (Object)null) { Object.Destroy((Object)(object)flock); } } flocks.Clear(); Report = "no birds"; } } public class BlunderModel { public class Tranche { public float add { get; set; } public int matures { get; set; } } public class Op { public float amount { get; set; } public float reserved { get; set; } public int week { get; set; } public float pct { get; set; } } public static readonly float[] LevelRevenue = new float[6] { 20000f, 30000f, 40000f, 55000f, 75000f, 100000f }; public static readonly float[] LevelLaunder = new float[6] { 6600f, 9900f, 13200f, 18150f, 24750f, 33000f }; public static readonly int[] LevelStaff = new int[6] { 2, 4, 6, 10, 12, 14 }; public static readonly string[] LevelName = new string[6] { "Small Branch", "Growing Branch", "Established Branch", "Regional Office", "Major Branch", "Flagship Office" }; public static readonly string[][] Hires = new string[6][] { new string[2] { "Penny Beasley (reception)", "Mitchell Scarf (branch manager)" }, new string[2] { "Jamie Halberd", "Dwain Shroot" }, new string[2] { "Omar Martinez", "Agnes Martin" }, new string[4] { "Stanford Huxley", "Felicity Vance", "Gavin Mallone", "Marla Palmer" }, new string[2] { "Trevor Flendell", "Callie Kapoor" }, new string[2] { "Riley Howard", "Clyde Bracken" } }; public const float Ceiling = 100000f; public const float AbsorbShare = 0.25f; public const float GrowthPerDollar = 2f; public const float OwnerShare = 0.4f; public int purchaseDay { get; set; } = -1; public float revenue { get; set; } = LevelRevenue[0]; public List<Tranche> pending { get; set; } = new List<Tranche>(); public Dictionary<string, float> weekBase { get; set; } = new Dictionary<string, float>(); public Dictionary<string, float> committed { get; set; } = new Dictionary<string, float>(); public List<Op> ops { get; set; } = new List<Op>(); public int lastPaidDay { get; set; } = -1; public float totalPaid { get; set; } public float totalGrowth { get; set; } public int lastPct { get; set; } public int levelAnnounced { get; set; } = 1; public int Level { get { int result = 1; for (int i = 0; i < LevelRevenue.Length; i++) { if (revenue >= LevelRevenue[i] - 0.5f) { result = i + 1; } } return result; } } public float LaunderCap => LevelLaunder[Level - 1]; public int Staff => LevelStaff[Level - 1]; public float DailyIncome => revenue * 0.4f / 7f; public float PendingAdd { get { float num = 0f; foreach (Tranche item in pending) { num += item.add; } return num; } } public int Week(int day) { return Math.Max(0, (day - purchaseDay) / 7); } public float WeekAllowance(int day) { string key = Week(day).ToString(); if (!weekBase.TryGetValue(key, out var value)) { value = revenue * 0.25f; weekBase[key] = value; } return value; } public float Reserved(int week) { float num = 0f; foreach (Op op in ops) { if (op.week == week) { num += op.reserved; } } return num; } public float Available(int day) { if (purchaseDay < 0) { return 0f; } int num = Week(day); int num2 = day - purchaseDay - num * 7; float num3 = WeekAllowance(day) * (float)Mathf.Min(7, num2 + 1) / 7f; committed.TryGetValue(num.ToString(), out var value); float num4 = (100000f - revenue - PendingAdd) / 2f - Reserved(num); return Mathf.Max(0f, Mathf.Min(num3 - value - Reserved(num), num4)); } public Op Reserve(int day, float amount, float pct) { float num = amount * Mathf.Clamp(pct, 0f, 100f) / 100f; Op op = new Op { amount = amount, pct = pct, week = Week(day), reserved = Mathf.Floor(Mathf.Min(num, Available(day)) * 100f) / 100f }; ops.Add(op); return op; } public float Complete(Op op) { ops.Remove(op); if (op.reserved <= 0f) { return 0f; } string key = op.week.ToString(); committed.TryGetValue(key, out var value); committed[key] = value + op.reserved; pending.Add(new Tranche { add = op.reserved * 2f, matures = purchaseDay + 7 * (op.week + 2) }); totalGrowth += op.reserved; return op.reserved; } public void Cancel(Op op) { ops.Remove(op); } public float PassDay(int day) { float dailyIncome = DailyIncome; totalPaid += dailyIncome; lastPaidDay = day; for (int num = pending.Count - 1; num >= 0; num--) { if (pending[num].matures <= day) { revenue = Mathf.Min(100000f, revenue + pending[num].add); pending.RemoveAt(num); } } return dailyIncome; } public string NextLevel() { int level = Level; if (level >= 6) { return "flagship - fully grown"; } float value = LevelRevenue[level] - revenue; return $"level {level + 1} ({LevelName[level]}) at ${LevelRevenue[level]:N0}/week revenue, ${value:N0} to go"; } } public static class Blunder { public const string UnitId = "channel"; public static BlunderModel M; private static string loadedKey; private static Properties.Unit unit; private static bool wasSaving; private static readonly Dictionary<IntPtr, BlunderModel.Op> live = new Dictionary<IntPtr, BlunderModel.Op>(); private static Vector3 terminal; private static Vector3 terminalLook; private static bool hasTerminal; public static bool Near; public static bool Open; private static float amount = 1000f; private static int pct; private static string message = ""; private static float nextPoll; public static int DayOffset; public static string Report = "blunder not set up"; private static GUIStyle box; private static GUIStyle title; private static GUIStyle line; public static readonly SharedRecord<BlunderFlat> Rec = new SharedRecord<BlunderFlat>("BM"); public static string LoadReport = ""; private static TextMeshProUGUI paperLine; public static string SummaryText = ""; private static Business Biz { get { Properties.Unit obj = unit; if (obj == null) { return null; } Property prop = obj.prop; if (prop == null) { return null; } return ((Il2CppObjectBase)prop).TryCast<Business>(); } } public static int Today { get { try { return NetworkSingleton<TimeManager>.Instance.ElapsedDays + DayOffset; } catch { return DayOffset; } } } private static int ClockTime { get { try { return NetworkSingleton<TimeManager>.Instance.CurrentTime; } catch { return 1200; } } } private static MoneyManager Money => NetworkSingleton<MoneyManager>.Instance; public static float Cash { get { try { return Money.cashBalance; } catch { return 0f; } } } public static void Setup(string islandDir) { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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) unit = Properties.Find("channel"); M = null; loadedKey = null; live.Clear(); Open = false; Near = false; hasTerminal = false; if (unit == null) { Report = "blunder: the office is not a property"; return; } try { using JsonDocument jsonDocument = JsonDocument.Parse(File.ReadAllText(Path.Combine(islandDir, "properties.json"))); foreach (JsonElement item in jsonDocument.RootElement.GetProperty("units").GetProperty("channel").GetProperty("anchors") .EnumerateArray()) { if (item.GetProperty("name").GetString() == "laundering_terminal") { JsonElement property = item.GetProperty("position"); terminal = Util.FromBlender(new Vector3(property[0].GetSingle(), property[1].GetSingle(), property[2].GetSingle())); float num = item.GetProperty("yawDeg").GetSingle() * ((float)Math.PI / 180f); terminalLook = new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num)); hasTerminal = true; } } } catch (Exception ex) { BreakwaterMod.Log.Warning("blunder terminal: " + ex.Message); } try { Business biz = Biz; if ((Object)(object)biz != (Object)null) { BlunderTerminal.Build(biz); } } catch (Exception ex2) { BreakwaterMod.Log.Error("blunder terminal: " + ex2); } Report = "blunder: office ready; " + BlunderTerminal.Report; } public static string SaveKey() { string text = null; try { LoadManager instance = Singleton<LoadManager>.Instance; text = ((instance != null) ? instance.LoadedGameFolderPath : null); } catch { } if (string.IsNullOrEmpty(text)) { if (!Coop.IsHost) { return "guest"; } return null; } using MD5 mD = MD5.Create(); return BitConverter.ToString(mD.ComputeHash(Encoding.UTF8.GetBytes(text.Replace('\\', '/').ToLowerInvariant())), 0, 8).Replace("-", "").ToLowerInvariant(); } public static void RecInit() { } public static string StatePath(string key) { return Path.Combine(BreakwaterMod.Dir, "saves", key, "blunder.json"); } private static void LoadState() { string text = SaveKey(); if (text == null || !NativeState.Ready) { return; } if (!Coop.IsHost) { loadedKey = text; M = Rec.Pull()?.To(); } else { if (text == loadedKey) { return; } loadedKey = text; live.Clear(); M = Rec.Pull()?.To(); string value = "the game's save variables"; if (M == null && File.Exists(StatePath(text))) { try { M = JsonSerializer.Deserialize<BlunderModel>(File.ReadAllText(StatePath(text))); value = "the old file beside the save"; } catch (Exception ex) { BreakwaterMod.Log.Warning("blunder state: " + ex.Message); } } Rec.Resend(); Rec.Push(BlunderFlat.From(M, Today)); if (M != null) { BlunderTerminal.SetPct(M.lastPct); } LoadReport = ((M != null) ? $"blunder: company loaded from {value} - level {M.Level}, revenue ${M.revenue:N0}/week, {M.pending.Count} growth tranches maturing, {M.ops.Count} operations" : "blunder: no company in this save"); BreakwaterMod.Log.Msg(LoadReport); } } public static void SaveState() { if (Coop.IsHost && loadedKey != null) { Rec.Push(BlunderFlat.From(M, Today)); } } private static void Notify(string title, string text) { try { Singleton<NotificationsManager>.Instance.SendNotification(title, text, (Sprite)null, 6f, true); } catch { } BreakwaterMod.Log.Msg("blunder: " + title + " - " + text); } public static void Update() { if ((Object)(object)unit?.prop == (Object)null) { return; } if (Time.unscaledTime >= nextPoll) { nextPoll = Time.unscaledTime + 1f; LoadState(); Business biz = Biz; bool flag = false; try { flag = Singleton<LoadManager>.Instance.IsGameLoaded; } catch { } if (Coop.IsHost && flag && (Object)(object)biz != (Object)null && !((Property)biz).IsOwned && M != null && loadedKey != null) { BreakwaterMod.Log.Msg("blunder: the office is not owned in this save - company record dropped"); M = null; } if (Coop.IsHost && flag && (Object)(object)biz != (Object)null && ((Property)biz).IsOwned && M == null && loadedKey != null) { M = new BlunderModel { purchaseDay = Today, lastPaidDay = Today }; Notify("Blunder Misfits Paper Company", "The branch is yours. Paper sales pay out every morning."); } if (M != null && (Object)(object)biz != (Object)null && Coop.IsHost) { if (Mathf.Abs(biz.LaunderCapacity - M.LaunderCap) > 0.5f) { biz.LaunderCapacity = M.LaunderCap; } TrackOperations(biz); if (Today > M.lastPaidDay && (ClockTime >= 700 || Today > M.lastPaidDay + 1)) { PayDays(); } } SaveState(); } BlunderTerminal.Update(); try { SummaryLine(); } catch { } Near = (Object)(object)BlunderTerminal.UI != (Object)null && BlunderTerminal.UI.IsOpen; } public static void SetOpen(bool open) { Open = open; message = ""; try { PlayerSingleton<PlayerMovement>.Instance.CanMove = !open; PlayerSingleton<PlayerCamera>.Instance.SetCanLook(!open); } catch { } if (open && M != null) { pct = M.lastPct; amount = Mathf.Clamp(Mathf.Max(amount, 100f), 0f, MaxDeposit()); } } public static float RoomToday() { Business biz = Biz; if ((Object)(object)biz == (Object)null) { return 0f; } float num = 0f; try { num = biz.currentLaunderTotal; } catch { } return Mathf.Max(0f, biz.LaunderCapacity - num); } private static float MaxDeposit() { return Mathf.Floor(Mathf.Min(Cash, RoomToday())); } public static bool Launder(float amt, int share) { Business biz = Biz; if ((Object)(object)biz == (Object)null || M == null) { message = "The office is not yours."; return false; } int num = 1; try { num = LaunderingInterface.MinLaunderAmount; } catch { } amt = Mathf.Floor(amt); if (amt < (float)num) { message = $"Deposit at least ${num:N0}."; return false; } if (amt > Cash) { message = "Not enough cash on you."; return false; } if (amt > RoomToday()) { message = $"The branch can take ${RoomToday():N0} more today."; return false; } BlunderModel.Op op = M.Reserve(Today, amt, share); M.lastPct = share; try { Money.ChangeCashBalance(0f - amt, true, true); biz.StartLaunderingOperation(amt, 0); } catch (Exception ex) { M.Cancel(op); message = "Laundering failed: " + ex.Message; return false; } float num2 = amt * (float)share / 100f; message = $"${amt:N0} is being laundered (24 h)." + ((share <= 0) ? "" : ((op.reserved + 0.5f < num2) ? $" Operations: ${op.reserved:N0} of the ${num2:N0} asked for - the branch can take no more growth funding today; the rest is paid out." : $" ${op.reserved:N0} goes to business operations when it completes.")); amount = Mathf.Min(amount, MaxDeposit()); return true; } private static void TrackOperations(Business biz) { List<LaunderingOperation> launderingOperations = biz.LaunderingOperations; HashSet<IntPtr> hashSet = new HashSet<IntPtr>(); if (launderingOperations != null) { Enumerator<LaunderingOperation> enumerator = launderingOperations.GetEnumerator(); while (enumerator.MoveNext()) { LaunderingOperation current = enumerator.Current; if (current == null) { continue; } hashSet.Add(((Il2CppObjectBase)current).Pointer); if (live.ContainsKey(((Il2CppObjectBase)current).Pointer)) { continue; } BlunderModel.Op op = null; foreach (BlunderModel.Op op3 in M.ops) { if (Mathf.Abs(op3.amount - current.amount) < 0.5f && !live.ContainsValue(op3)) { op = op3; break; } } if (op == null && current.minutesSinceStarted < 10 && BlunderTerminal.Pct > 0) { op = M.Reserve(Today, current.amount, BlunderTerminal.Pct); M.lastPct = BlunderTerminal.Pct; } live[((Il2CppObjectBase)current).Pointer] = op; } } foreach (IntPtr item in new List<IntPtr>(live.Keys)) { if (hashSet.Contains(item)) { continue; } BlunderModel.Op op2 = live[item]; live.Remove(item); if (op2 == null) { continue; } float num = M.Complete(op2); if (num > 0f) { try { Money.CreateOnlineTransaction("Blunder Misfits - business operations", 0f - num, 1f, "growth funding from a laundering deposit"); } catch { } Notify("Blunder Misfits", $"${num:N0} spent on business operations - growth in progress"); } } } private static void PayDays() { int level = M.Level; float num = 0f; int num2 = 0; while (M.lastPaidDay < Today) { num += M.PassDay(M.lastPaidDay + 1); num2++; } if (num > 0f) { try { Money.CreateOnlineTransaction("Blunder Misfits paper sales", num, 1f, $"{num2} day(s) of owner income"); } catch { } Notify("Blunder Misfits paper sales", $"+${num:N0} owner income ({M.LevelNameNow()})"); } if (M.Level > level) { for (int i = level + 1; i <= M.Level; i++) { Notify($"Blunder Misfits - level {i}: {BlunderModel.LevelName[i - 1]}", "New hires: " + string.Join(", ", BlunderModel.Hires[i - 1]) + $". Laundering ${BlunderModel.LevelLaunder[i - 1]:N0}/day."); M.levelAnnounced = i; } } } private static void SummaryLine() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) DailySummary instance = NetworkSingleton<DailySummary>.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.Canvas == (Object)null) { return; } bool flag = ((Behaviour)instance.Canvas).enabled && M != null; if (flag && (Object)(object)paperLine == (Object)null && (Object)(object)instance.DealerEarningsLabel != (Object)null) { TextMeshProUGUI dealerEarningsLabel = instance.DealerEarningsLabel; GameObject obj = Object.Instantiate<GameObject>(((Component)dealerEarningsLabel).gameObject, ((TMP_Text)dealerEarningsLabel).transform.parent); ((Object)obj).name = "BW paper sales"; paperLine = obj.GetComponent<TextMeshProUGUI>(); RectTransform rectTransform = ((TMP_Text)paperLine).rectTransform; Vector2 anchoredPosition = ((TMP_Text)dealerEarningsLabel).rectTransform.anchoredPosition; Rect rect = ((TMP_Text)dealerEarningsLabel).rectTransform.rect; rectTransform.anchoredPosition = anchoredPosition - new Vector2(0f, ((Rect)(ref rect)).height + 6f); } if (!((Object)(object)paperLine == (Object)null)) { ((Component)paperLine).gameObject.SetActive(flag); if (flag) { SummaryText = $"Paper sales: +${M.DailyIncome:N0}"; ((TMP_Text)paperLine).text = SummaryText; } } } public static void OnGUI() { } public static void Clear() { BlunderTerminal.Clear(); paperLine = null; unit = null; M = null; loadedKey = null; live.Clear(); Open = false; Near = false; } } public class BlunderFlat { public int purchaseDay { get; set; } = -1; public float revenue { get; set; } public int lastPaidDay { get; set; } = -1; public float totalPaid { get; set; } public float totalGrowth { get; set; } public int lastPct { get; set; } public int levelAnnounced { get; set; } = 1; public int wbWeek { get; set; } = -1; public float wbBase { get; set; } public int cmWeek { get; set; } = -1; public float cmAmt { get; set; } public float p0add { get; set; } public int p0mat { get; set; } public float p1add { get; set; } public int p1mat { get; set; } public float p2add { get; set; } public int p2mat { get; set; } public float o0amt { get; set; } public float o0res { get; set; } public int o0week { get; set; } public int o0pct { get; set; } public float o1amt { get; set; } public float o1res { get; set; } public int o1week { get; set; } public int o1pct { get; set; } public float o2amt { get; set; } public float o2res { get; set; } public int o2week { get; set; } public int o2pct { get; set; } public float o3amt { get; set; } public float o3res { get; set; } public int o3week { get; set; } public int o3pct { get; set; } public static BlunderFlat From(BlunderModel m, int day) { if (m == null) { return null; } BlunderFlat blunderFlat = new BlunderFlat { purchaseDay = m.purchaseDay, revenue = m.revenue, lastPaidDay = m.lastPaidDay, totalPaid = m.totalPaid, totalGrowth = m.totalGrowth, lastPct = m.lastPct, levelAnnounced = m.levelAnnounced }; int num = (blunderFlat.wbWeek = m.Week(day)); blunderFlat.wbBase = m.WeekAllowance(day); blunderFlat.cmWeek = num; m.committed.TryGetValue(num.ToString(), out var value); blunderFlat.cmAmt = value; SortedDictionary<int, float> sortedDictionary = new SortedDictionary<int, float>(); foreach (BlunderModel.Tranche item in m.pending) { sortedDictionary.TryGetValue(item.matures, out var value2); sortedDictionary[item.matures] = value2 + item.add; } int num3 = 0; foreach (KeyValuePair<int, float> item2 in sortedDictionary) { switch (num3) { case 0: blunderFlat.p0add = item2.Value; blunderFlat.p0mat = item2.Key; break; case 1: blunderFlat.p1add = item2.Value; blunderFlat.p1mat = item2.Key; break; default: blunderFlat.p2add += item2.Value; blunderFlat.p2mat = Math.Max(blunderFlat.p2mat, item2.Key); break; } num3++; } for (int i = 0; i < Math.Min(4, m.ops.Count); i++) { BlunderModel.Op op = m.ops[i]; if (i == 0) { blunderFlat.o0amt = op.amount; blunderFlat.o0res = op.reserved; blunderFlat.o0week = op.week; blunderFlat.o0pct = (int)op.pct; } if (i == 1) { blunderFlat.o1amt = op.amount; blunderFlat.o1res = op.reserved; blunderFlat.o1week = op.week; blunderFlat.o1pct = (int)op.pct; } if (i == 2) { blunderFlat.o2amt = op.amount; blunderFlat.o2res = op.reserved; blunderFlat.o2week = op.week; blunderFlat.o2pct = (int)op.pct; } if (i == 3) { blunderFlat.o3amt = op.amount; blunderFlat.o3res = op.reserved; blunderFlat.o3week = op.week; blunderFlat.o3pct = (int)op.pct; } } return blunderFlat; } public BlunderModel To() { BlunderModel blunderModel = new BlunderModel { purchaseDay = purchaseDay, revenue = revenue, lastPaidDay = lastPaidDay, totalPaid = totalPaid, totalGrowth = totalGrowth, lastPct = lastPct, levelAnnounced = levelAnnounced }; if (wbWeek >= 0) { blunderModel.weekBase[wbWeek.ToString()] = wbBase; } if (cmWeek >= 0 && cmAmt > 0f) { blunderModel.committed[cmWeek.ToString()] = cmAmt; } if (p0add > 0f) { blunderModel.pending.Add(new BlunderModel.Tranche { add = p0add, matures = p0mat }); } if (p1add > 0f) { blunderModel.pending.Add(new BlunderModel.Tranche { add = p1add, matures = p1mat }); } if (p2add > 0f) { blunderModel.pending.Add(new BlunderModel.Tranche { add = p2add, matures = p2mat }); } if (o0amt > 0f) { blunderModel.ops.Add(new BlunderModel.Op { amount = o0amt, reserved = o0res, week = o0week, pct = o0pct }); } if (o1amt > 0f) { blunderModel.ops.Add(new BlunderModel.Op { amount = o1amt, reserved = o1res, week = o1week, pct = o1pct }); } if (o2amt > 0f) { blunderModel.ops.Add(new BlunderModel.Op { amount = o2amt, reserved = o2res, week = o2week, pct = o2pct }); } if (o3amt > 0f) { blunderModel.ops.Add(new BlunderModel.Op { amount = o3amt, reserved = o3res, week = o3week, pct = o3pct }); } return blunderModel; } } public static class BlunderModelExt { public static string LevelNameNow(this BlunderModel m) { return $"level {m.Level}, {BlunderModel.LevelName[m.Level - 1]}"; } } public static class BlunderTerminal { private static readonly Vector3 ScreenCentreB = new Vector3(83.987f, 402.343f, -2.49f); private static readonly Vector3 ScreenNormalB = new Vector3(-0.148f, 0.989f, 0f); private static readonly Vector3 CanvasOnStation = new Vector3(0f, 0.78f, 0.025f); public static GameObject Root; public static LaunderingInterface UI; private static Business biz; public static int Pct; public static int Tab; public static string Report = "terminal not built"; private static RectTransform container; private static RectTransform current; private static RectTransform opList; private static readonly List<GameObject> pages = new List<GameObject>(); private static readonly List<TextMeshProUGUI> pageText = new List<TextMeshProUGUI>(); private static readonly List<Image> tabImg = new List<Image>(); private static Slider opsSlider; private static TextMeshProUGUI opsLabel; private static TextMeshProUGUI opsValue; private static float nextText; private static readonly string[] TabNames = new string[4] { "Laundering", "Company", "Growth", "Staff" }; private static Color tabOn = new Color(1f, 0.637f, 0.241f); private static Color tabOff = new Color(0.36f, 0.43f, 0.51f); public static void Build(Business business) { //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_01fa: 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_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) Clear(); biz = business; ItemDefinition item = Registry.GetItem("launderingstation"); BuildableItemDefinition val = ((item != null) ? ((Il2CppObjectBase)item).TryCast<BuildableItemDefinition>() : null); if ((Object)(object)val == (Object)null || (Object)(object)val.BuiltItem == (Object)null) { Report = "terminal: no laundering station in the registry"; return; } GameObject val2 = new GameObject("BW holder (terminal)"); val2.SetActive(false); GameObject val3 = Object.Instantiate<GameObject>(((Component)val.BuiltItem).gameObject, val2.transform); ((Object)val3).name = "Blunder Misfits terminal"; UI = val3.GetComponentInChildren<LaunderingInterface>(true); foreach (Component component in val3.GetComponents<Component>()) { if (!((Object)(object)component == (Object)null)) { string name = ((MemberInfo)((Object)component).GetIl2CppType()).Name; if (name == "LaunderingStation" || name == "PredictedSpawn") { Object.DestroyImmediate((Object)(object)component); } } } foreach (Component component2 in val3.GetComponents<Component>()) { if (!((Object)(object)component2 == (Object)null) && ((MemberInfo)((Object)component2).GetIl2CppType()).Name == "NetworkObject") { Object.DestroyImmediate((Object)(object)component2); } } foreach (Renderer componentsInChild in val3.GetComponentsInChildren<Renderer>(true)) { componentsInChild.enabled = false; } foreach (Collider componentsInChild2 in val3.GetComponentsInChildren<Collider>(true)) { if ((Object)(object)((Component)componentsInChild2).GetComponentInParent<InteractableObject>() == (Object)null) { componentsInChild2.enabled = false; } } foreach (CashCounter componentsInChild3 in val3.GetComponentsInChildren<CashCounter>(true)) { ((Component)componentsInChild3).gameObject.SetActive(false); } Vector3 val7 = Util.FromBlender(ScreenNormalB); Vector3 normalized = ((Vector3)(ref val7)).normalized; Vector3 val8 = Util.FromBlender(ScreenCentreB); Quaternion val9 = Quaternion.LookRotation(normalized, Vector3.up); val3.transform.rotation = val9; val3.transform.position = val8 - val9 * CanvasOnStation + normalized * 0.006f; val3.transform.SetParent((Transform)null, true); Object.Destroy((Object)(object)val2); Root = val3; try { UI.Initialize(biz); } catch (Exception ex) { Report = "terminal: Initialize " + ex.Message; } try { BuildTabs(); } catch (Exception ex2) { BreakwaterMod.Log.Error("terminal tabs: " + ex2); } try { BuildOpsSlider(); } catch (Exception ex3) { BreakwaterMod.Log.Error("terminal slider: " + ex3); } Root.SetActive(((Property)biz).IsOwned); Report = $"terminal: the game's laundering screen on the manager's monitor at {Util.V(val8)}, tabs {pages.Count + 1}, operations slider {(Object)(object)opsSlider != (Object)null}"; BreakwaterMod.Log.Msg(Report); } private static T Clone<T>(Component src, Transform parent, string name) where T : Component { GameObject obj = Object.Instantiate<GameObject>(src.gameObject, parent); ((Object)obj).name = name; obj.SetActive(true); return obj.GetComponent<T>(); } private static void Place(RectTransform rt, Vector2 aMin, Vector2 aMax, Vector2 pos, Vector2 size, Vector2? pivot = null) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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) rt.anchorMin = aMin; rt.anchorMax = aMax; rt.pivot = (Vector2)(((??)pivot) ?? new Vector2(0.5f, 0.5f)); rt.anchoredPosition = pos; rt.sizeDelta = size; } private static void OnClick(Button b, Action a) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown b.onClick = new ButtonClickedEvent(); ((UnityEvent)b.onClick).AddListener(DelegateSupport.ConvertDelegate<UnityAction>((Delegate)a)); } private static void BuildTabs() { //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_02f7: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_0333: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_036d: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) container = UI.container; if ((Object)(object)container == (Object)null) { return; } Transform obj = ((Transform)container).Find("CurrentOperations"); current = ((obj != null) ? ((Component)obj).GetComponent<RectTransform>() : null); Transform obj2 = ((Transform)container).Find("OperationList"); opList = ((obj2 != null) ? ((Component)obj2).GetComponent<RectTransform>() : null); Transform val = ((Transform)container).Find("Topbar"); object obj3; if (val == null) { obj3 = null; } else { Transform obj4 = val.Find("Text (TMP)"); obj3 = ((obj4 != null) ? ((Component)obj4).GetComponent<TextMeshProUGUI>() : null); } TextMeshProUGUI val2 = (TextMeshProUGUI)obj3; if ((Object)(object)val2 != (Object)null) { ((TMP_Text)val2).text = "Blunder Misfits"; } Button launderButton = UI.launderButton; RectTransform obj5 = opList; object obj6; if (obj5 == null) { obj6 = null; } else { Transform obj7 = ((Transform)obj5).Find("Title"); obj6 = ((obj7 != null) ? ((Component)obj7).GetComponent<TextMeshProUGUI>() : null); } TextMeshProUGUI val3 = (TextMeshProUGUI)obj6; RectTransform obj8 = opList; object obj9; if (obj8 == null) { obj9 = null; } else { Transform obj10 = ((Transform)obj8).Find("Background"); obj9 = ((obj10 != null) ? ((Component)obj10).GetComponent<Image>() : null); } Image val4 = (Image)obj9; if ((Object)(object)launderButton == (Object)null || (Object)(object)val3 == (Object)null || (Object)(object)val4 == (Object)null || (Object)(object)val == (Object)null) { Report = "terminal: screen parts not found"; return; } for (int i = 0; i < TabNames.Length; i++) { Button val5 = Clone<Button>((Component)(object)launderButton, val, "Tab " + TabNames[i]); Place(((Component)val5).GetComponent<RectTransform>(), new Vector2(1f, 0.5f), new Vector2(1f, 0.5f), new Vector2(-6f - (float)(TabNames.Length - 1 - i) * 54f, 0f), new Vector2(52f, 18f), (Vector2?)new Vector2(1f, 0.5f)); TextMeshProUGUI componentInChildren = ((Component)val5).GetComponentInChildren<TextMeshProUGUI>(true); if ((Object)(object)componentInChildren != (Object)null) { ((TMP_Text)componentInChildren).text = TabNames[i]; ((TMP_Text)componentInChildren).fontSize = 8f; } Transform val6 = ((Component)val5).transform.Find("Selected Frame"); if ((Object)(object)val6 != (Object)null) { ((Component)val6).gameObject.SetActive(false); } int k = i; OnClick(val5, delegate { ShowTab(k); }); tabImg.Add(((Component)val5).GetComponent<Image>()); } for (int num = 1; num < TabNames.Length; num++) { GameObject val7 = Object.Instantiate<GameObject>(((Component)opList).gameObject, (Transform)(object)container); ((Object)val7).name = "Page " + TabNames[num]; RectTransform component = val7.GetComponent<RectTransform>(); for (int num2 = ((Transform)component).childCount - 1; num2 >= 0; num2--) { Transform child = ((Transform)component).GetChild(num2); if (((Object)child).name != "Background" && ((Object)child).name != "Title") { Object.DestroyImmediate((Object)(object)((Component)child).gameObject); } } Place(component, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0f, -38f), new Vector2(-20f, 222f), (Vector2?)new Vector2(0.5f, 1f)); Transform obj11 = ((Transform)component).Find("Background"); RectTransform val8 = ((obj11 != null) ? ((Component)obj11).GetComponent<RectTransform>() : null); if ((Object)(object)val8 != (Object)null) { Place(val8, Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero); } Transform obj12 = ((Transform)component).Find("Title"); TextMeshProUGUI val9 = ((obj12 != null) ? ((Component)obj12).GetComponent<TextMeshProUGUI>() : null); Place(((TMP_Text)val9).rectTransform, Vector2.zero, Vector2.one, new Vector2(0f, 0f), new Vector2(-20f, -14f)); ((Object)val9).name = "Text"; ((TMP_Text)val9).fontSize = 8.5f; ((TMP_Text)val9).enableWordWrapping = true; ((TMP_Text)val9).alignment = (TextAlignmentOptions)257; ((TMP_Text)val9).richText = true; ((TMP_Text)val9).text = ""; val7.SetActive(false); pages.Add(val7); pageText.Add(val9); } ShowTab(0); } private static void BuildOpsSlider() { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_01a7: 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_024f: Unknown result type (might be due to invalid IL or missing referenc