Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Carturs Portal Network v0.1.0
CarturPortalNetwork.dll
Decompiled 4 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.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Splatform; using TMPro; using UnityEngine; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("CarturPortalNetwork")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0+697d4026e8166dfd4a9e0078b71c29d2b8b723bc")] [assembly: AssemblyProduct("CarturPortalNetwork")] [assembly: AssemblyTitle("CarturPortalNetwork")] [assembly: AssemblyVersion("0.1.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Worldgate { internal static class Access { public enum Reason { None, Mine, Public, Shared, Ward, Admin, Legacy } public sealed class Who { public string Id = ""; public string Name = ""; public long PlayerId; public bool Admin; } public const string OwnerKey = "wg_owner"; public const string OwnerNameKey = "wg_owner_name"; public const string PublicKey = "wg_public"; public const string WardKey = "wg_ward"; public const string ShareKey = "wg_share"; public const string LegacyKey = "wg_legacy"; public const string SeenKey = "wg_seen"; public const string InitKey = "wg_init"; private const string WardPrefab = "guard_stone"; private const int MaxShares = 64; private const int MaxFieldLength = 80; private static List<ZDO> wards = new List<ZDO>(); private static float wardsAt = -10f; private static float wardRadius = -1f; public const int OpPublic = 1; public const int OpWard = 2; public const int OpAddShare = 3; public const int OpRemoveShare = 4; public const int OpLegacy = 5; public unsafe static Who WhoIs(long sender) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) Who who = new Who(); PlatformUserID val2; if (sender == ZDOMan.GetSessionID()) { IDistributionPlatform distributionPlatform = PlatformManager.DistributionPlatform; ILocalUser val = ((distributionPlatform != null) ? distributionPlatform.LocalUser : null); if (val != null) { val2 = ((IUser)val).PlatformUserID; who.Id = ((object)(*(PlatformUserID*)(&val2))/*cast due to .constrained prefix*/).ToString(); } who.Name = (((Object)(object)Player.m_localPlayer != (Object)null) ? Player.m_localPlayer.GetPlayerName() : ""); who.PlayerId = (((Object)(object)Player.m_localPlayer != (Object)null) ? Player.m_localPlayer.GetPlayerID() : 0); who.Admin = ZNet.instance.IsServer() || ZNet.instance.LocalPlayerIsAdminOrHost(); return who; } foreach (PlayerInfo player in ZNet.instance.GetPlayerList()) { ZDOID characterID = player.m_characterID; if (((ZDOID)(ref characterID)).UserID == sender) { who.Id = Clean(player.m_userInfo.m_id); who.Name = player.m_name ?? ""; ZDO zDO = ZDOMan.instance.GetZDO(player.m_characterID); who.PlayerId = ((zDO != null) ? zDO.GetLong(ZDOVars.s_playerID, 0L) : 0); val2 = player.m_userInfo.m_id; int admin; if (((PlatformUserID)(ref val2)).IsValid) { ZNet instance = ZNet.instance; val2 = player.m_userInfo.m_id; admin = (instance.IsAdmin(((object)(*(PlatformUserID*)(&val2))/*cast due to .constrained prefix*/).ToString()) ? 1 : 0); } else { admin = 0; } who.Admin = (byte)admin != 0; break; } } return who; } private unsafe static string Clean(PlatformUserID id) { if (!((PlatformUserID)(ref id)).IsValid) { return ""; } return ((object)(*(PlatformUserID*)(&id))/*cast due to .constrained prefix*/).ToString(); } public static void Write(ZDO z, Action<ZDO> change) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) long owner = z.GetOwner(); long sessionID = ZDOMan.GetSessionID(); z.SetOwner(sessionID); change(z); ZDOMan.instance.ForceSendZDO(z.m_uid); if (owner != 0L && owner != sessionID) { z.SetOwner(owner); } } public static string OwnerId(ZDO z) { return z.GetString("wg_owner", ""); } public static string OwnerName(ZDO z) { return z.GetString("wg_owner_name", ""); } public static bool IsPublic(ZDO z) { return z.GetInt("wg_public", 0) == 1; } public static bool WardsAllowed(ZDO z) { return z.GetInt("wg_ward", 1) != 0; } public static bool IsLegacy(ZDO z) { return z.GetInt("wg_legacy", 0) == 1; } public static List<KeyValuePair<string, string>> Shares(ZDO z) { List<KeyValuePair<string, string>> list = new List<KeyValuePair<string, string>>(); string[] array = z.GetString("wg_share", "").Split(new char[1] { '\n' }); foreach (string text in array) { if (text.Length != 0) { int num = text.IndexOf('|'); list.Add((num < 0) ? new KeyValuePair<string, string>("", text) : new KeyValuePair<string, string>(text.Substring(0, num), text.Substring(num + 1))); } } return list; } private static void SaveShares(ZDO z, List<KeyValuePair<string, string>> list) { z.Set("wg_share", string.Join("\n", list.Select((KeyValuePair<string, string> e) => e.Key + "|" + e.Value))); } public static bool CanManage(ZDO z, Who w) { if (!w.Admin) { if (w.Id.Length > 0) { return OwnerId(z) == w.Id; } return false; } return true; } public static bool CanRename(ZDO z, Who w) { if (!CanManage(z, w)) { if (OwnerId(z).Length == 0) { return CanUse(z, w); } return false; } return true; } public static Reason Why(ZDO z, Who w) { //IL_0101: Unknown result type (might be due to invalid IL or missing references) if (w.Admin) { return Reason.Admin; } if (z.GetInt("wg_seen", 0) != 1) { if (w.PlayerId == 0L || z.GetLong(ZDOVars.s_creator, 0L) != w.PlayerId) { return Reason.None; } return Reason.Mine; } if (w.Id.Length > 0 && OwnerId(z) == w.Id) { return Reason.Mine; } if (IsPublic(z)) { if (!IsLegacy(z)) { return Reason.Public; } return Reason.Legacy; } foreach (KeyValuePair<string, string> item in Shares(z)) { if ((item.Key.Length > 0 && item.Key == w.Id) || (item.Key.Length == 0 && w.Name.Length > 0 && string.Equals(item.Value, w.Name, StringComparison.OrdinalIgnoreCase))) { return Reason.Shared; } } if (WardsAllowed(z) && InWardOf(z.GetPosition(), w.PlayerId)) { return Reason.Ward; } return Reason.None; } public static bool CanUse(ZDO z, Who w) { return Why(z, w) != Reason.None; } private static void RefreshWards() { if (!(Time.realtimeSinceStartup - wardsAt < 2f)) { wardsAt = Time.realtimeSinceStartup; List<ZDO> list = new List<ZDO>(); int num = 0; while (!ZDOMan.instance.GetAllZDOsWithPrefabIterative("guard_stone", list, ref num)) { } wards = list; if (wardRadius < 0f) { GameObject prefab = ZNetScene.instance.GetPrefab("guard_stone"); PrivateArea val = ((prefab != null) ? prefab.GetComponent<PrivateArea>() : null); wardRadius = (((Object)(object)val != (Object)null) ? val.m_radius : 10f); } } } private static bool InWardOf(Vector3 at, long playerId) { //IL_0034: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (playerId == 0L) { return false; } RefreshWards(); foreach (ZDO ward in wards) { if (!ward.GetBool(ZDOVars.s_enabled, false)) { continue; } Vector3 position = ward.GetPosition(); Vector2 val = new Vector2(position.x - at.x, position.z - at.z); if (((Vector2)(ref val)).magnitude >= wardRadius) { continue; } if (ward.GetLong(ZDOVars.s_creator, 0L) == playerId) { return true; } int num = ward.GetInt(ZDOVars.s_permitted, 0); for (int i = 0; i < num; i++) { if (ward.GetLong("pu_id" + i, 0L) == playerId) { return true; } } } return false; } private static string Owner(ZDO z, out string name) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) name = ""; if (z.GetLong(ZDOVars.s_creator, 0L) == 0L) { return ""; } int num = z.GetInt(ZDOVars.s_creatorIndex, -1); List<CrossNetworkUserInfo> list = ZNet.World?.m_playerHistory; if (list == null || num < 0 || num >= list.Count) { return ""; } name = list[num].m_displayName ?? ""; return Clean(list[num].m_id); } public static void Stamp(List<ZDO> all) { bool first = !ZoneSystem.instance.GetGlobalKey("wg_init"); foreach (ZDO item in all) { if (item.GetInt("wg_seen", 0) == 1) { continue; } string name; string owner = Owner(item, out name); Write(item, delegate(ZDO w) { if (owner.Length > 0) { w.Set("wg_owner", owner); w.Set("wg_owner_name", name); } if (first) { w.Set("wg_legacy", 1); } w.Set("wg_public", (first || owner.Length == 0) ? 1 : 0); w.Set("wg_seen", 1); }); } if (first) { ZoneSystem.instance.SetGlobalKey("wg_init"); } } public unsafe static void UpgradeNameShares(List<ZDO> all) { //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) List<PlayerInfo> list = (from p in ZNet.instance.GetPlayerList() where ((PlatformUserID)(ref p.m_userInfo.m_id)).IsValid && !string.IsNullOrEmpty(p.m_name) select p).ToList(); if (list.Count == 0) { return; } foreach (ZDO item in all) { List<KeyValuePair<string, string>> list2 = Shares(item); bool flag = false; int i; for (i = 0; i < list2.Count; i++) { if (list2[i].Key.Length <= 0) { List<PlayerInfo> list3 = list.FindAll((PlayerInfo p) => string.Equals(p.m_name, list2[i].Value, StringComparison.OrdinalIgnoreCase)); if (list3.Count == 1) { List<KeyValuePair<string, string>> list4 = list2; int index = i; PlayerInfo val = list3[0]; list4[index] = new KeyValuePair<string, string>(((object)(*(PlatformUserID*)(&val.m_userInfo.m_id))/*cast due to .constrained prefix*/).ToString(), list2[i].Value); flag = true; } } } if (flag) { Write(item, delegate(ZDO w) { SaveShares(w, list2); }); } } } public static bool Apply(ZDO z, int op, string a, string b) { a = Cut(a); b = Cut(b); switch (op) { case 1: z.Set("wg_public", (a == "1") ? 1 : 0); z.Set("wg_legacy", 0); break; case 2: z.Set("wg_ward", (a == "1") ? 1 : 0); break; case 5: if (!IsLegacy(z)) { return false; } if (a == "private") { z.Set("wg_public", 0); } z.Set("wg_legacy", 0); break; case 3: { List<KeyValuePair<string, string>> list2 = Shares(z); if (list2.Count >= 64 || (a.Length == 0 && b.Length == 0)) { return false; } if (list2.Any((KeyValuePair<string, string> e) => (a.Length <= 0) ? (e.Key.Length == 0 && string.Equals(e.Value, b, StringComparison.OrdinalIgnoreCase)) : (e.Key == a))) { return false; } list2.Add(new KeyValuePair<string, string>(a, b.Replace('\n', ' ').Replace('|', ' '))); SaveShares(z, list2); break; } case 4: { List<KeyValuePair<string, string>> list = Shares(z); if (list.RemoveAll((KeyValuePair<string, string> e) => (a.Length <= 0) ? (e.Key.Length == 0 && string.Equals(e.Value, b, StringComparison.OrdinalIgnoreCase)) : (e.Key == a)) == 0) { return false; } SaveShares(z, list); break; } default: return false; } Write(z, delegate { ZDOMan.instance.SetDirtyPortals(); }); return true; } private static string Cut(string s) { if (!string.IsNullOrEmpty(s)) { if (s.Length <= 80) { return s; } return s.Substring(0, 80); } return ""; } public static List<KeyValuePair<string, string>> Roster(Who except) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_0061: Unknown result type (might be due to invalid IL or missing references) List<KeyValuePair<string, string>> list = new List<KeyValuePair<string, string>>(); List<CrossNetworkUserInfo> list2 = ZNet.World?.m_playerHistory; if (list2 == null) { return list; } foreach (CrossNetworkUserInfo item in list2) { string text = Clean(item.m_id); if (text.Length <= 0 || !(text == except.Id)) { string text2 = (string.IsNullOrEmpty(item.m_displayName) ? item.m_serverAssignedDisplayName : item.m_displayName); if (!string.IsNullOrEmpty(text2)) { list.Add(new KeyValuePair<string, string>(text, Cut(text2))); } } } return list; } } internal static class Admin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<ZDO, string> <>9__12_0; public static Func<ZDO, bool> <>9__13_0; public static Func<ZDO, bool> <>9__13_1; public static ConsoleEvent <>9__15_0; public static ConsoleEvent <>9__15_1; public static ConsoleEvent <>9__15_2; internal string <List>b__12_0(ZDO x) { return NameOf(x); } internal bool <Status>b__13_0(ZDO z) { return z.GetInt(Plugin.SelKey, 0) == 1; } internal bool <Status>b__13_1(ZDO z) { //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) return z.GetConnectionZDOID((ConnectionType)1) != ZDOID.None; } internal void <AddCommands>b__15_0(ConsoleEventArgs a) { Send("list"); } internal void <AddCommands>b__15_1(ConsoleEventArgs a) { Send("status"); } internal void <AddCommands>b__15_2(ConsoleEventArgs a) { Send("unlink " + string.Join(" ", a.Args.Skip(1))); } } public const string Ask = "WG_Admin"; public const string Say = "WG_AdminText"; private static readonly Dictionary<long, float> last = new Dictionary<long, float>(); public static void Register() { ZRoutedRpc.instance.Register<string>("WG_Admin", (Action<long, string>)OnAsk); ZRoutedRpc.instance.Register<string>("WG_AdminText", (Action<long, string>)OnSay); } public static void Reset() { last.Clear(); } private static void Send(string cmd) { if ((Object)(object)ZNet.instance == (Object)null || ZRoutedRpc.instance == null) { Print("Not in a world."); return; } ZRoutedRpc.instance.InvokeRoutedRPC("WG_Admin", new object[1] { cmd }); } private static void Print(string text) { Console instance = Console.instance; if (!((Object)(object)instance == (Object)null)) { string[] array = text.Split(new char[1] { '\n' }); foreach (string text2 in array) { instance.Print(text2); } } } private static void OnSay(long sender, string text) { if (Menu.FromServer(sender)) { Print(text); } } private static void Reply(long to, string text) { ZRoutedRpc.instance.InvokeRoutedRPC(to, "WG_AdminText", new object[1] { text }); } private static void OnAsk(long sender, string cmd) { if (!ZNet.instance.IsServer()) { return; } float realtimeSinceStartup = Time.realtimeSinceStartup; if (last.TryGetValue(sender, out var value) && realtimeSinceStartup - value < 1f) { return; } last[sender] = realtimeSinceStartup; if (!Access.WhoIs(sender).Admin) { Reply(sender, "Portal Network: only an admin can use wg_ commands."); return; } cmd = (cmd ?? "").Trim(); int num = cmd.IndexOf(' '); string text = ((num < 0) ? cmd : cmd.Substring(0, num)); string name = ((num < 0) ? "" : cmd.Substring(num + 1).Trim()); List<ZDO> all = Net.AllPortals(); StringBuilder stringBuilder = new StringBuilder(); switch (text) { case "list": List(all, stringBuilder); break; case "status": Status(all, stringBuilder); break; case "unlink": Unlink(all, name, stringBuilder); break; default: stringBuilder.Append("Portal Network: wg_list, wg_status, wg_unlink <portal name>"); break; } Reply(sender, stringBuilder.ToString().TrimEnd(new char[1] { '\n' })); } private static string NameOf(ZDO z) { if (z != null) { if (z.GetString(ZDOVars.s_tag, "").Length != 0) { return z.GetString(ZDOVars.s_tag, ""); } return "(unnamed)"; } return "-"; } private static ZDO Dest(ZDO z) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return ZDOMan.instance.GetZDO(z.GetConnectionZDOID((ConnectionType)1)); } private static void List(List<ZDO> all, StringBuilder sb) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) sb.Append("Portal Network: ").Append(all.Count).Append(" portals\n"); int num = 0; foreach (ZDO item in all.OrderBy<ZDO, string>((ZDO x) => NameOf(x), StringComparer.OrdinalIgnoreCase)) { Vector3 position = item.GetPosition(); ZDO z = Dest(item); sb.Append(++num).Append(". ").Append(NameOf(item)) .Append(" at ") .Append(Mathf.RoundToInt(position.x)) .Append(',') .Append(Mathf.RoundToInt(position.z)) .Append(" owner ") .Append((Access.OwnerName(item).Length == 0) ? "-" : Access.OwnerName(item)) .Append(" ") .Append(Access.IsPublic(item) ? "everyone" : "private") .Append(Access.WardsAllowed(item) ? "" : ", wards off") .Append(" -> ") .Append((item.GetInt(Plugin.SelKey, 0) == 1) ? "" : "(vanilla pairing) ") .Append(NameOf(z)) .Append('\n'); } } private static void Status(List<ZDO> all, StringBuilder sb) { int value = all.Count((ZDO z) => z.GetInt(Plugin.SelKey, 0) == 1); int value2 = all.Count((ZDO z) => z.GetConnectionZDOID((ConnectionType)1) != ZDOID.None); sb.Append("Portal Network ").Append("0.1.0").Append(", protocol ") .Append(1) .Append('\n') .Append(all.Count) .Append(" portals, ") .Append(value2) .Append(" linked, ") .Append(value) .Append(" with a destination chosen in the screen\n") .Append("travel check ") .Append(Rules.ServerTravelCheck ? "on" : "off") .Append(", ") .Append(ZNet.instance.GetPeerConnections()) .Append(" peers connected"); } private static void Unlink(List<ZDO> all, string name, StringBuilder sb) { if (name.Length == 0) { sb.Append("Portal Network: wg_unlink <portal name>"); return; } List<ZDO> list = all.FindAll((ZDO z) => string.Equals(z.GetString(ZDOVars.s_tag, ""), name, StringComparison.OrdinalIgnoreCase)); foreach (ZDO item in list) { Net.Unlink(item); } sb.Append("Portal Network: ").Append(list.Count).Append(" portal(s) named \"") .Append(name) .Append("\" unlinked"); } public static void AddCommands() { //IL_0033: 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) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown object obj = <>c.<>9__15_0; if (obj == null) { ConsoleEvent val = delegate { Send("list"); }; <>c.<>9__15_0 = val; obj = (object)val; } new ConsoleCommand("wg_list", "Portal Network (admin): every portal with its owner, sharing and destination", (ConsoleEvent)obj, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj2 = <>c.<>9__15_1; if (obj2 == null) { ConsoleEvent val2 = delegate { Send("status"); }; <>c.<>9__15_1 = val2; obj2 = (object)val2; } new ConsoleCommand("wg_status", "Portal Network (admin): version, protocol and counts", (ConsoleEvent)obj2, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj3 = <>c.<>9__15_2; if (obj3 == null) { ConsoleEvent val3 = delegate(ConsoleEventArgs a) { Send("unlink " + string.Join(" ", a.Args.Skip(1))); }; <>c.<>9__15_2 = val3; obj3 = (object)val3; } new ConsoleCommand("wg_unlink", "Portal Network (admin): wg_unlink <portal name> removes the destination of every portal with that name", (ConsoleEvent)obj3, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } } [HarmonyPatch(typeof(Terminal), "InitTerminal")] internal static class AddAdminCommands { private static void Postfix() { Admin.AddCommands(); } } internal sealed class ArrivalLock : MonoBehaviour { private sealed class Hold { public ZDOID Portal; public Vector3 Pos; public long Traveller; public float OpenUntil; public float Appeared = -1f; } private const float Feet = 0.3048f; private const float WaitForTraveller = 25f; private static readonly List<Hold> holds = new List<Hold>(); private static ArrivalLock inst; private bool jumping; private float searchUntil; private Vector3 jumpFrom; private Vector3 jumpPortal; private static float lastNotice; private void Awake() { inst = this; } public static void Jumped(Player p, TeleportWorld from) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_003e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)inst == (Object)null)) { inst.jumping = true; inst.jumpFrom = ((Component)p).transform.position; inst.jumpPortal = ((Component)from).transform.position; } } private void Update() { //IL_007d: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { jumping = false; searchUntil = 0f; holds.Clear(); return; } for (int num = holds.Count - 1; num >= 0; num--) { if (!Alive(holds[num])) { holds.RemoveAt(num); } } if (jumping && !((Character)localPlayer).IsTeleporting()) { jumping = false; Vector3 val = ((Component)localPlayer).transform.position - jumpFrom; if (((Vector3)(ref val)).sqrMagnitude >= 9f) { searchUntil = Time.time + 6f; } } if (searchUntil <= 0f) { return; } if (Time.time >= searchUntil) { searchUntil = 0f; return; } TeleportWorld val2 = Nearest(((Component)localPlayer).transform.position); if (!((Object)(object)val2 == (Object)null)) { searchUntil = 0f; Prefs.Jumped(jumpPortal, ((Component)val2).transform.position); Expect(((Component)val2).GetComponent<ZNetView>().GetZDO().m_uid, localPlayer.GetPlayerID(), 0f); } } private static TeleportWorld Nearest(Vector3 pos) { //IL_0034: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) TeleportWorld result = null; float num = 36f; TeleportWorld[] array = Object.FindObjectsByType<TeleportWorld>((FindObjectsSortMode)0); foreach (TeleportWorld val in array) { ZNetView component = ((Component)val).GetComponent<ZNetView>(); if (((component != null) ? component.GetZDO() : null) != null) { Vector3 val2 = ((Component)val).transform.position - pos; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = val; } } } return result; } public static void Expect(ZDOID portal, long traveller, float previewSeconds) { //IL_0007: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) if (Plugin.ArrivalClosedSeconds.Value <= 0f) { return; } ZDO zDO = ZDOMan.instance.GetZDO(portal); if (zDO != null) { holds.RemoveAll((Hold h) => h.Portal == portal); holds.Add(new Hold { Portal = portal, Pos = zDO.GetPosition(), Traveller = traveller, OpenUntil = Time.time + previewSeconds }); } } private static Player Find(long id) { if (id == 0L) { return null; } foreach (Player allPlayer in Player.GetAllPlayers()) { if (allPlayer.GetPlayerID() == id) { return allPlayer; } } return null; } private static bool Alive(Hold h) { //IL_0037: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) if (Time.time < h.OpenUntil) { return true; } Player val = Find(h.Traveller); Vector3 val2; if (h.Appeared < 0f) { if ((Object)(object)val != (Object)null) { val2 = ((Component)val).transform.position - h.Pos; if (((Vector3)(ref val2)).magnitude <= Plugin.OpenRange.Value) { h.Appeared = Time.time; } } return Time.time <= h.OpenUntil + 25f; } if (Time.time - h.Appeared < Plugin.ArrivalClosedSeconds.Value && (Object)(object)val != (Object)null) { val2 = ((Component)val).transform.position - h.Pos; return ((Vector3)(ref val2)).magnitude <= Plugin.ArrivalClosedFeet.Value * 0.3048f; } return false; } private static Hold Running(TeleportWorld tw) { //IL_003e: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (holds.Count == 0) { return null; } ZNetView component = ((Component)tw).GetComponent<ZNetView>(); ZDOID id = (ZDOID)(((??)((component == null) ? ((ZDOID?)null) : component.GetZDO()?.m_uid)) ?? ZDOID.None); return holds.Find((Hold h) => h.Portal == id); } private static bool Shut(TeleportWorld tw) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_0063: Unknown result type (might be due to invalid IL or missing references) Hold hold = (((Object)(object)tw == (Object)null) ? null : Running(tw)); if (hold == null || Time.time < hold.OpenUntil) { return false; } foreach (Player allPlayer in Player.GetAllPlayers()) { if (allPlayer.GetPlayerID() != hold.Traveller) { Vector3 val = ((Component)allPlayer).transform.position - ((Component)tw).transform.position; if (((Vector3)(ref val)).magnitude <= Plugin.OpenRange.Value) { return false; } } } return true; } public static bool Holds(EffectFade fade) { return Shut(((Component)fade).GetComponentInParent<TeleportWorld>()); } public static bool Blocks(TeleportWorld portal) { Player localPlayer = Player.m_localPlayer; Hold hold = (((Object)(object)portal == (Object)null || (Object)(object)localPlayer == (Object)null) ? null : Running(portal)); if (hold == null || hold.Traveller != localPlayer.GetPlayerID() || Time.time < hold.OpenUntil) { return false; } if (Time.time - lastNotice > 3f) { lastNotice = Time.time; ((Character)localPlayer).Message((MessageType)2, Tr.T("t_locked"), 0, (Sprite)null, false); } return true; } public static void Release(TeleportWorld portal) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) Player me = Player.m_localPlayer; ? val; if (!((Object)(object)portal == (Object)null)) { ZNetView component = ((Component)portal).GetComponent<ZNetView>(); val = ((??)((component == null) ? ((ZDOID?)null) : component.GetZDO()?.m_uid)) ?? ZDOID.None; } else { val = ZDOID.None; } ZDOID id = (ZDOID)val; if ((Object)(object)me != (Object)null) { holds.RemoveAll((Hold h) => h.Portal == id && h.Traveller == me.GetPlayerID()); } } } [HarmonyPatch(typeof(EffectFade), "SetActive")] internal static class KeepArrivalShut { private static void Prefix(EffectFade __instance, ref bool active) { if (active && ArrivalLock.Holds(__instance)) { active = false; } } } [HarmonyPatch(typeof(TeleportWorld), "Teleport")] internal static class NoteJump { private static void Postfix(TeleportWorld __instance, Player player) { if ((Object)(object)player != (Object)null && (Object)(object)player == (Object)(object)Player.m_localPlayer && ((Character)player).IsTeleporting()) { ArrivalLock.Jumped(player, __instance); } } } [HarmonyPatch(typeof(TeleportWorld), "GetHoverText")] internal static class HoverShowsDestination { private static readonly FieldInfo NView = AccessTools.Field(typeof(TeleportWorld), "m_nview"); private static void Postfix(TeleportWorld __instance, ref string __result) { //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_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_0056: Unknown result type (might be due to invalid IL or missing references) object? obj = NView?.GetValue(__instance); object? obj2 = ((obj is ZNetView) ? obj : null); ZDO val = ((obj2 != null) ? ((ZNetView)obj2).GetZDO() : null); if (val == null || val.GetInt(Plugin.SelKey, 0) != 1) { return; } Vector3 vec = val.GetVec3("wg_target_pos", Vector3.zero); if (!(vec == Vector3.zero)) { string text = Net.NameAt(vec); if (text != null) { __result = __result + "\n" + Tr.T("hover_goes", (text.Length == 0) ? Tr.T("unnamed") : StringExtensionMethods.RemoveRichTextTags(text)); } } } } [HarmonyPatch(typeof(Piece), "SetCreator")] internal static class NewPortalGetsDefault { private static void Postfix(Piece __instance, long uid) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && uid == localPlayer.GetPlayerID() && ((Object)__instance).name.StartsWith("portal_network")) { ZNetView component = ((Component)__instance).GetComponent<ZNetView>(); ZDOID id = (ZDOID)(((??)((component == null) ? ((ZDOID?)null) : component.GetZDO()?.m_uid)) ?? ZDOID.None); if (!((ZDOID)(ref id)).IsNone() && Prefs.GetDefault(out var p)) { ((MonoBehaviour)Plugin.Instance).StartCoroutine(Later(id, p)); } } } private static IEnumerator Later(ZDOID id, Vector3 dest) { //IL_0007: 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_000e: 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) yield return (object)new WaitForSeconds(3f); if (ZRoutedRpc.instance != null && (Object)(object)Player.m_localPlayer != (Object)null) { ZRoutedRpc.instance.InvokeRoutedRPC("WG_SelectAt", new object[2] { id, dest }); } } } internal static class ClashLog { private static bool done; public static void Run() { if (done) { return; } done = true; List<MethodBase> source = new List<MethodBase> { AccessTools.Method(typeof(TeleportWorld), "Teleport", (Type[])null, (Type[])null), AccessTools.Method(typeof(TeleportWorld), "Interact", (Type[])null, (Type[])null), AccessTools.Method(typeof(TeleportWorld), "GetHoverText", (Type[])null, (Type[])null), AccessTools.Method(typeof(TeleportWorld), "HaveTarget", (Type[])null, (Type[])null), AccessTools.Method(typeof(ZDOMan), "GetPortalList", (Type[])null, (Type[])null), AccessTools.Method(typeof(ZDOMan), "ConnectPortals", (Type[])null, (Type[])null), AccessTools.Method(typeof(Game), "ConnectPortals", (Type[])null, (Type[])null) }; List<string> list = new List<string>(); foreach (MethodBase item in source.Where((MethodBase m) => m != null)) { Patches patchInfo = Harmony.GetPatchInfo(item); if (patchInfo != null) { List<string> list2 = (from x in patchInfo.Prefixes.Concat(patchInfo.Postfixes).Concat(patchInfo.Transpilers).Concat(patchInfo.Finalizers) select x.owner into o where o != "com.cartur.portalnetwork" select o).Distinct().ToList(); if (list2.Count > 0) { list.Add(item.DeclaringType.Name + "." + item.Name + " (" + string.Join(", ", list2.ToArray()) + ")"); } } } if (list.Count > 0) { Plugin.Log.LogWarning((object)("Portal Network: other mods also patch portal code, which can clash with it: " + string.Join("; ", list.ToArray()))); } } } internal sealed class Dive : MonoBehaviour { private enum Phase { Idle, In, Hold, Out } private const float CalmIn = 0.35f; private const float TimeIn = 1.1f; private const float TimeOut = 1.2f; private const float ArrivalHold = 1f; private const float Close = 0.9f; private const float StopAt = 3f; private const float GiveUp = 60f; private const float MovedAway = 3f; private const float CoverFade = 0.35f; private const float DollyInto = 0.14f; private const float FovRush = 105f; private const float FovHold = 70f; private const float FovBurst = 112f; private const float PictureFov = 75f; private static readonly Vector3 Pocket = new Vector3(0f, 3000f, 0f); private static Dive inst; public static string Last = ""; private Phase phase; private float phaseAt; private bool freeze; private bool testOut; private bool testCover; private float frozenT; private Player player; private Vector3 startPlayer; private TeleportWorld source; private Vector3 sourcePos; private Vector3 startPos; private Quaternion startRot; private bool haveStart; private float stopDist = 3f; private float rollSign = 1f; private Vector3 holdC; private Vector3 holdF; private float holdSide; private float holdDist; private int savedMask; private bool hidden; private bool burst; private bool whooshed; private bool outHide; private Transform arrival; private Material arrivalMat; private Vector3 arrivalScale; private float arrivalPhase; private DiveFx fx; private Material coverMat; private Material backMat; private Material sparkMat; private Mesh coverMesh; private GameObject cover; private Transform coverCam; private Transform copyRoot; private ParticleSystem loadSparks; private List<Material> copyMats = new List<Material>(); private float coverPhase; private float holdAt; private AudioClip humClip; private AudioMixerGroup humMixer; private float humVolume = 0.8f; private AudioSource hum; private int coverLayer = -1; private bool coverBitWasOn; private bool calm; private float holdFov = 70f; private CanvasGroup hudGroup; private float hudWas = 1f; private bool hudAdded; private bool awaiting; private float awaitDeadline; private bool silenced; private bool holdingInput; private static readonly FieldInfo SkyCamera = AccessTools.Field(typeof(GameCamera), "m_skyCamera"); private static readonly FieldInfo CameraDistance = AccessTools.Field(typeof(GameCamera), "m_distance"); private static readonly int Characters = LayerMask.GetMask(new string[5] { "character", "character_net", "character_ghost", "character_noenv", "ghost" }); private float HumV => humVolume * Plugin.SoundVolume.Value; private float InT { get { if (!calm) { return 1.1f; } return 0.35f; } } public static bool Awaiting { get { if ((Object)(object)inst != (Object)null) { return inst.awaiting; } return false; } } public static bool HoldingInput { get { if ((Object)(object)inst != (Object)null) { return inst.holdingInput; } return false; } } private static bool FirstPerson(GameCamera game) { if (CameraDistance != null && CameraDistance.GetValue(game) is float num) { return num <= 0f; } return false; } private void Awake() { inst = this; fx = ((Component)this).gameObject.AddComponent<DiveFx>(); } private static float Smooth(float t) { t = Mathf.Clamp01(t); return t * t * (3f - 2f * t); } private static float Cubic(float t) { t = Mathf.Clamp01(t); return 1f - (1f - t) * (1f - t) * (1f - t); } private static bool Opening(TeleportWorld tw, out Vector3 center, out Vector3 fwd) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006d: 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_0077: 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) center = (fwd = Vector3.zero); Transform val = (((Object)(object)tw == (Object)null) ? null : ((Component)tw).transform.Find("_target_found_red/WG_Vortex")); MeshFilter val2 = (((Object)(object)val == (Object)null) ? null : ((Component)val).GetComponent<MeshFilter>()); if ((Object)(object)val2 == (Object)null || (Object)(object)val2.sharedMesh == (Object)null) { return false; } Bounds bounds = val2.sharedMesh.bounds; center = val.TransformPoint(((Bounds)(ref bounds)).center); fwd = val.forward; return true; } private static void Near(Vector3 center, Vector3 fwd, float side, float away, out Vector3 pos, out Quaternion rot) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //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_0033: Unknown result type (might be due to invalid IL or missing references) pos = center + fwd * side * away; rot = Quaternion.LookRotation(center - pos, Vector3.up); } private Quaternion Wobble(float shake, float roll) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) float t = (freeze ? frozenT : Time.unscaledTime); return Quaternion.Euler(n(0.3f, 7f) * shake, n(1.7f, 7f) * shake, roll + n(3.1f, 5f) * shake); float n(float seed, float rate) { return (Mathf.PerlinNoise(t * rate, seed) - 0.5f) * 2f; } } private void Prepare(TeleportWorld portal, Player p) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown End(); player = p; source = portal; sourcePos = ((Component)portal).transform.position; startPlayer = ((Component)p).transform.position; haveStart = false; hidden = false; burst = (whooshed = false); rollSign = ((Random.value < 0.5f) ? (-1f) : 1f); Transform val = ((Component)portal).transform.Find("_target_found_red/WG_Vortex"); coverMat = new Material(((Component)val).GetComponent<Renderer>().sharedMaterial); coverMesh = ((Component)val).GetComponent<MeshFilter>().sharedMesh; Transform obj = ((Component)portal).transform.Find("_target_found_red/WG_Mist"); object obj2; if (obj == null) { obj2 = null; } else { ParticleSystemRenderer component = ((Component)obj).GetComponent<ParticleSystemRenderer>(); obj2 = ((component != null) ? ((Renderer)component).sharedMaterial : null); } sparkMat = (Material)obj2; Transform obj3 = ((Component)portal).transform.Find("_target_found_red/SFX"); AudioSource val2 = ((obj3 != null) ? ((Component)obj3).GetComponent<AudioSource>() : null); humClip = (((Object)(object)Sfx.Loop != (Object)null) ? Sfx.Loop : (((Object)(object)val2 == (Object)null) ? null : val2.clip)); humMixer = (((Object)(object)val2 == (Object)null) ? null : val2.outputAudioMixerGroup); humVolume = (((Object)(object)val2 == (Object)null) ? 0.8f : Mathf.Max(val2.volume, 0.5f)); } public static bool Begin(TeleportWorld portal, Player p, bool beforeTeleport = false) { if ((Object)(object)inst == (Object)null) { return false; } Last = "begin: phase=" + inst.phase.ToString() + " zoom=" + Plugin.PortalZoom.Value + " animate=" + Plugin.Animate + " camera=" + ((Object)(object)Camera.main != (Object)null) + " opening=" + Opening(portal, out var center, out var fwd); if (inst.phase != Phase.Idle || !Plugin.PortalZoom.Value || (Object)(object)Camera.main == (Object)null) { return false; } if (!Opening(portal, out center, out fwd)) { return false; } inst.Prepare(portal, p); inst.calm = !Plugin.Animate; inst.phase = Phase.In; inst.phaseAt = Time.unscaledTime; inst.freeze = false; if (!inst.calm) { inst.Play(Rush(), 0.9f, 1f); } if (beforeTeleport) { inst.awaiting = true; inst.awaitDeadline = Time.unscaledTime + 5f; inst.holdingInput = true; } return true; } public static void TeleportStarted() { if ((Object)(object)inst != (Object)null && inst.awaiting) { inst.awaiting = false; inst.holdingInput = false; Last = Last + " | teleport called " + (Time.unscaledTime - inst.phaseAt).ToString("0.00") + " s in"; } } public static void Abort() { if ((Object)(object)inst != (Object)null && inst.awaiting) { inst.End(); } } public static void Test(TeleportWorld tw, float t, string mode) { if (!((Object)(object)inst == (Object)null) && Opening(tw, out var _, out var _)) { inst.Prepare(tw, Player.m_localPlayer); inst.freeze = true; inst.testOut = mode == "out"; inst.testCover = mode == "cover"; inst.calm = false; inst.frozenT = ((mode == "cover") ? (1.1f + t) : t); inst.phase = ((!(mode == "out")) ? Phase.In : Phase.Out); inst.outHide = mode == "out"; inst.phaseAt = 0f; } } public static void Stop() { if ((Object)(object)inst != (Object)null) { inst.End(); } } private void End() { if (phase != Phase.Idle) { Last = Last + " | ended in " + phase.ToString() + " after " + (Time.unscaledTime - phaseAt).ToString("0.00") + " s, from " + new StackTrace(1, fNeedFileInfo: false).GetFrame(0).GetMethod().Name + "/" + new StackTrace(2, fNeedFileInfo: false).GetFrame(0).GetMethod().Name; } Unhide(); Silence(on: false); HudRestore(); DestroyCover(); DestroyArrival(); if ((Object)(object)fx != (Object)null) { fx.Wash = (fx.Rush = (fx.Chroma = 0f)); } holdingInput = false; if ((Object)(object)coverMat != (Object)null) { Object.Destroy((Object)(object)coverMat); coverMat = null; } phase = Phase.Idle; freeze = (testOut = (testCover = false)); awaiting = false; } private void Unhide() { if (hidden && (Object)(object)Camera.main != (Object)null) { Camera.main.cullingMask = savedMask; } hidden = false; } private void Hum() { if (!((Object)(object)hum == (Object)null)) { bool flag = phase == Phase.Hold; float num = (flag ? HumV : 0f); hum.volume = Mathf.MoveTowards(hum.volume, num, Time.unscaledDeltaTime * Mathf.Max(HumV, 0.05f) / (flag ? 0.3f : 1.2f)); hum.pitch = Mathf.MoveTowards(hum.pitch, flag ? 1f : 1.35f, Time.unscaledDeltaTime * (flag ? 1f : 0.5f)); if (!flag && hum.volume <= 0.001f) { Object.Destroy((Object)(object)((Component)hum).gameObject); hum = null; } } } private void HudFade(float a) { GameObject val = (((Object)(object)Hud.instance == (Object)null) ? null : Hud.instance.m_rootObject); if ((Object)(object)val == (Object)null) { return; } if ((Object)(object)hudGroup == (Object)null) { hudGroup = val.GetComponent<CanvasGroup>(); hudAdded = (Object)(object)hudGroup == (Object)null; if (hudAdded) { hudGroup = val.AddComponent<CanvasGroup>(); } hudWas = (hudAdded ? 1f : hudGroup.alpha); } hudGroup.alpha = hudWas * Mathf.Clamp01(a); } private void HudRestore() { if ((Object)(object)hudGroup != (Object)null) { hudGroup.alpha = hudWas; if (hudAdded) { Object.Destroy((Object)(object)hudGroup); } } hudGroup = null; hudAdded = false; } private void Silence(bool on) { if (on != silenced) { silenced = on; AudioListener.pause = on; Last = Last + " | other sound " + (on ? "paused" : "back") + " (listener pause now " + AudioListener.pause + ") at " + Time.unscaledTime.ToString("0.0"); } } private void StartHum() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown if (!((Object)(object)humClip == (Object)null) && !((Object)(object)hum != (Object)null)) { GameObject val = new GameObject("WorldgateHum"); val.transform.SetParent(((Component)this).transform, false); hum = val.AddComponent<AudioSource>(); hum.clip = humClip; hum.loop = true; hum.spatialBlend = 0f; hum.volume = 0f; hum.pitch = 0.8f; hum.ignoreListenerPause = true; hum.outputAudioMixerGroup = humMixer; hum.Play(); } } private void Update() { Hum(); if (phase != Phase.Idle && !freeze && ((Object)(object)player == (Object)null || ((Character)player).IsDead() || Time.unscaledTime - phaseAt > 60f)) { End(); } } public static void Steer(GameCamera game) { if ((Object)(object)inst == (Object)null || inst.phase == Phase.Idle) { return; } try { inst.Apply(((Component)game).transform); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Portal Network: the portal zoom failed, normal camera restored: " + ex.Message)); inst.End(); } } private static void SetFov(GameCamera game, float fov) { Camera main = Camera.main; if ((Object)(object)main != (Object)null) { main.fieldOfView = fov; } object? obj = SkyCamera?.GetValue(game); Camera val = (Camera)((obj is Camera) ? obj : null); if ((Object)(object)val != (Object)null) { val.fieldOfView = fov; } } private void Apply(Transform cam) { //IL_003e: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) GameCamera component = ((Component)cam).GetComponent<GameCamera>(); float nat = (((Object)(object)Camera.main != (Object)null) ? Camera.main.fieldOfView : 65f); float num = Mathf.Max(0.25f, Plugin.UiSpeed.Value); Pose val = default(Pose); ((Pose)(ref val))..ctor(cam.position, cam.rotation); Vector3 fwd; if (!haveStart) { startPos = val.position; startRot = val.rotation; haveStart = true; if (Opening(source, out var center, out fwd)) { stopDist = Mathf.Clamp(Mathf.Min(3f, Vector3.Distance(startPos, center)), 1.2f, 3f); } } float num2 = (freeze ? frozenT : ((Time.unscaledTime - phaseAt) * num)); if (phase == Phase.In || phase == Phase.Hold) { if (!freeze) { fwd = ((Component)player).transform.position - startPlayer; bool flag = ((Vector3)(ref fwd)).sqrMagnitude > 9f; if (awaiting && Time.unscaledTime > awaitDeadline) { End(); return; } if (!awaiting && !((Character)player).IsTeleporting() && num2 > 0.2f) { if (flag) { StartOut(); num2 = 0f; } else { End(); } if (phase == Phase.Idle) { return; } } } if (phase == Phase.In && (num2 >= InT || (freeze && testCover))) { EnterHold(num2); } if (phase == Phase.In || phase == Phase.Hold) { InAndHold(cam, component, nat, num2); return; } } if (phase == Phase.Out) { OutPhase(cam, component, val, nat, num2); } } private void InAndHold(Transform cam, GameCamera game, float nat, float t) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_024e: 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_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) Vector3 center; Vector3 fwd; float side; if (phase == Phase.Hold) { center = holdC; fwd = holdF; side = holdSide; } else { if ((Object)(object)source == (Object)null || !Opening(source, out center, out fwd)) { End(); return; } side = Mathf.Sign(Vector3.Dot(startPos - center, fwd)); } if (!calm && !hidden && (Object)(object)Camera.main != (Object)null) { savedMask = Camera.main.cullingMask; Camera main = Camera.main; main.cullingMask &= ~Characters; hidden = true; } if (phase == Phase.In) { if (calm) { cam.SetPositionAndRotation(startPos, startRot); HudFade(1f - Smooth(t / 0.35f)); return; } HudFade(1f - Smooth(t / 0.5f)); float num = Mathf.Clamp01(t / 1.1f); float num2 = Smooth(num); Near(center, fwd, side, stopDist, out var pos, out var rot); Vector3 val = Vector3.Lerp(startPos, pos, num2); Quaternion val2 = Quaternion.Slerp(startRot, rot, num2) * Wobble(0.45f * num * num, 4.5f * rollSign * Mathf.Sin((float)Math.PI * num)); cam.SetPositionAndRotation(val, val2); SetFov(game, (num < 0.65f) ? Mathf.Lerp(nat, 105f, Smooth(num / 0.65f)) : Mathf.Lerp(105f, 70f, Smooth((num - 0.65f) / 0.35f))); fx.Rush = num2 * num2; fx.Direction = 1; fx.Chroma = 0.7f * num2; fx.Wash = 0.18f * num * num * num; return; } float num3 = t - InT; HudFade(0f); Vector3 pos2; Quaternion rot2; if (calm) { holdDist = stopDist; pos2 = startPos; rot2 = startRot; } else { holdDist = Mathf.Lerp(stopDist, stopDist * 0.55f, Smooth(num3 / 5f)); Near(center, fwd, side, holdDist, out pos2, out rot2); } if (num3 < 0.45f) { cam.SetPositionAndRotation(pos2, rot2); } SetFov(game, holdFov); AnimateCover(num3, pos2, rot2); if (!calm) { fx.Rush = Mathf.Lerp(1f, 0.12f, Smooth(num3 / 0.6f)); fx.Direction = 1; fx.Chroma = 0.7f * (1f - Smooth(num3 / 0.4f)); fx.Wash = 0.45f * (1f - Cubic(num3 / 0.4f)); } } private void EnterHold(float t) { //IL_0030: 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) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)source == (Object)null || !Opening(source, out holdC, out holdF)) { End(); return; } holdSide = Mathf.Sign(Vector3.Dot(startPos - holdC, holdF)); holdDist = stopDist; holdAt = t; holdFov = ((calm && (Object)(object)Camera.main != (Object)null) ? Camera.main.fieldOfView : 70f); if (!StartCover(holdC, holdF, holdSide)) { End(); return; } phase = Phase.Hold; if (!freeze) { phaseAt = Time.unscaledTime - t / Mathf.Max(0.25f, Plugin.UiSpeed.Value); } } private void StartOut() { Unhide(); Silence(on: false); phase = Phase.Out; phaseAt = Time.unscaledTime; outHide = true; } private void OutPhase(Transform cam, GameCamera game, Pose natural, float nat, float t) { //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018a: 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_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0288: 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_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: 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_03ae: Unknown result type (might be due to invalid IL or missing references) //IL_03b0: 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_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Unknown result type (might be due to invalid IL or missing references) //IL_0410: Unknown result type (might be due to invalid IL or missing references) //IL_0412: Unknown result type (might be due to invalid IL or missing references) if (FirstPerson(game)) { holdingInput = false; if (!calm) { fx.Wash = 0.5f * (1f - Cubic(t / 0.45f)); fx.Rush = 0.7f * (1f - Cubic(t / 0.45f)); fx.Direction = 1; fx.Chroma = 0.5f * (1f - Cubic(t / 0.45f)); } if (!burst) { burst = true; if (!calm) { Play(Boom(), 0.9f, 1f); } } HudFade(Smooth(t / 0.45f)); if ((Object)(object)cover != (Object)null) { DestroyCover(); } if (!freeze && t >= 0.45f) { End(); } return; } TeleportWorld val = (testOut ? source : Arrival()); if ((Object)(object)val == (Object)null || !Opening(val, out var center, out var fwd)) { End(); return; } if ((Object)(object)cover != (Object)null && calm) { DestroyCover(); } if ((Object)(object)cover != (Object)null) { float away = Mathf.Lerp(holdDist, 0.9f, Smooth(t / 0.14f)); Near(holdC + Pocket, holdF, holdSide, away, out var pos, out var rot); AnimateCover(1f, pos, rot, pose: true); if (t >= 0.14f) { DestroyCover(); } } if (!burst) { burst = true; if (!calm) { Play(Boom(), 1f, 1f); Burst(center, fwd, 1f); OpenSwirl(val, 1f); } } float num = t - 1f; holdingInput = !freeze && num < 0f; float num2 = ((num <= 0f) ? 0f : Cubic(num / 1.2f)); if (num >= 0f && !whooshed) { whooshed = true; if (!calm) { Play(Whoosh(), 0.9f, 1f); } } Transform transform = ((Component)val).transform; Vector3 val2 = transform.position + transform.forward * 1.2f + Vector3.up * 1.7f; Quaternion val3 = Quaternion.LookRotation(transform.forward, Vector3.up); if (outHide && !hidden && (Object)(object)Camera.main != (Object)null) { savedMask = Camera.main.cullingMask; Camera main = Camera.main; main.cullingMask &= ~Characters; hidden = true; } outHide = false; if (hidden && num > 0.36f) { Unhide(); } AnimateArrival(t, num); float num3 = 1f - Smooth(t / 1.4f); float num4 = (calm ? 0f : Mathf.Sin((float)Math.PI * num2)); HudFade((num <= 0f) ? 0f : Smooth(num / 0.96000004f)); Vector3 val4 = Vector3.Lerp(val2, natural.position, num2) + Vector3.up * (2.4f * num4); Quaternion val5 = Quaternion.Slerp(val3, natural.rotation, Smooth(num2)) * (calm ? Quaternion.identity : Wobble(0.7f * num3 + 0.35f * num4, 5f * rollSign * (1f - Smooth(t / 0.6f)))); cam.SetPositionAndRotation(val4, val5); SetFov(game, (!(num <= 0f)) ? (Mathf.Lerp(75f, nat, num2) + 10f * num4) : (calm ? 75f : Mathf.Lerp(112f, 75f, Smooth(t / 0.5f)))); if (calm) { if (!freeze && num >= 1.2f) { End(); } return; } fx.Wash = ((t < 0.14f) ? Mathf.Lerp(0.2f, 0.6f, Smooth(t / 0.14f)) : (0.6f * (1f - Cubic((t - 0.14f) / 0.45f)))); fx.Rush = Mathf.Max(Mathf.Lerp(1f, 0.1f, Smooth(t / 1.2f)), 0.8f * num4); fx.Direction = ((!(num > 0f)) ? 1 : (-1)); fx.Chroma = Mathf.Max(0.8f * (1f - Smooth(t / 0.8f)), 0.45f * num4); if (!freeze && num >= 1.2f) { End(); } } private static int FreeLayer() { for (int num = 31; num >= 8; num--) { if (string.IsNullOrEmpty(LayerMask.LayerToName(num))) { return num; } } return -1; } private static void SetLayer(GameObject go, int layer) { Transform[] componentsInChildren = go.GetComponentsInChildren<Transform>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.layer = layer; } } private static void Mesh_(Transform parent, string name, Mesh mesh, Material mat, Transform like, int layer) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name) { layer = layer }; val.transform.SetParent(parent, false); val.transform.SetPositionAndRotation(like.position + Pocket, like.rotation); val.transform.localScale = like.lossyScale; val.AddComponent<MeshFilter>().sharedMesh = mesh; MeshRenderer obj = val.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterial = mat; ((Renderer)obj).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj).receiveShadows = false; } private bool StartCover(Vector3 c, Vector3 f, float side) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Expected O, but got Unknown //IL_006d: 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_007a: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0301: 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_030d: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected O, but got Unknown //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_0360: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: 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_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c4: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03ca: 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) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Expected O, but got Unknown //IL_0471: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Expected O, but got Unknown //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04c8: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Expected O, but got Unknown //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0502: Unknown result type (might be due to invalid IL or missing references) //IL_0518: Unknown result type (might be due to invalid IL or missing references) //IL_051d: Unknown result type (might be due to invalid IL or missing references) //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0571: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05a2: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05b8: Unknown result type (might be due to invalid IL or missing references) //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_0670: Unknown result type (might be due to invalid IL or missing references) //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_067a: Unknown result type (might be due to invalid IL or missing references) //IL_0654: Unknown result type (might be due to invalid IL or missing references) //IL_0659: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Unknown result type (might be due to invalid IL or missing references) //IL_0620: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_062d: Unknown result type (might be due to invalid IL or missing references) //IL_0691: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_06a0: Unknown result type (might be due to invalid IL or missing references) //IL_06a2: Unknown result type (might be due to invalid IL or missing references) coverLayer = FreeLayer(); if (coverLayer < 0 || (Object)(object)Camera.main == (Object)null || (Object)(object)coverMat == (Object)null || (Object)(object)coverMesh == (Object)null) { return false; } int num = coverLayer; coverPhase = 0f; cover = new GameObject("WorldgateCover") { layer = num }; GameObject val = new GameObject("CopyCamera") { layer = num }; val.transform.SetParent(cover.transform, false); coverCam = val.transform; Camera obj = val.AddComponent<Camera>(); obj.CopyFrom(Camera.main); obj.clearFlags = (CameraClearFlags)3; obj.cullingMask = 1 << num; obj.depth = Camera.main.depth + 10f; obj.nearClipPlane = 0.05f; obj.farClipPlane = 80f; obj.fieldOfView = holdFov; obj.allowMSAA = false; coverBitWasOn = (Camera.main.cullingMask & (1 << num)) != 0; Camera main = Camera.main; main.cullingMask &= ~(1 << num); copyRoot = new GameObject("PortalCopy") { layer = num }.transform; copyRoot.SetParent(cover.transform, false); Transform val2 = ((Component)source).transform.Find("New/small_portal"); MeshFilter val3 = (((Object)(object)val2 == (Object)null) ? null : ((Component)val2).GetComponent<MeshFilter>()); Renderer val4 = (((Object)(object)val2 == (Object)null) ? null : ((Component)val2).GetComponent<Renderer>()); if ((Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null && (Object)(object)val3.sharedMesh != (Object)null) { Material val5 = new Material(val4.sharedMaterial); copyMats.Add(val5); Mesh_(copyRoot, "Housing", val3.sharedMesh, val5, val2, num); } Transform like = ((Component)source).transform.Find("_target_found_red/WG_Vortex"); Mesh_(copyRoot, "Swirl", coverMesh, coverMat, like, num); ParticleSystem[] componentsInChildren = ((Component)source).GetComponentsInChildren<ParticleSystem>(true); foreach (ParticleSystem val6 in componentsInChildren) { if (((Object)val6).name.StartsWith("WG_Mist")) { GameObject obj2 = Object.Instantiate<GameObject>(((Component)val6).gameObject, copyRoot); obj2.transform.SetPositionAndRotation(((Component)val6).transform.position + Pocket, ((Component)val6).transform.rotation); SetLayer(obj2, num); ParticleSystem component = obj2.GetComponent<ParticleSystem>(); EmissionModule emission = component.emission; ((EmissionModule)(ref emission)).enabled = true; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit((((Object)val6).name == "WG_Mist") ? 10f : 4f); component.Play(); } } GameObject val7 = new GameObject("Sun") { layer = num }; val7.transform.SetParent(copyRoot, false); Light obj3 = val7.AddComponent<Light>(); obj3.type = (LightType)1; obj3.cullingMask = 1 << num; obj3.shadows = (LightShadows)0; Light sun = RenderSettings.sun; obj3.color = (Color)(((Object)(object)sun != (Object)null) ? sun.color : new Color(0.95f, 0.9f, 0.8f)); obj3.intensity = 0.7f; val7.transform.rotation = Quaternion.Euler(48f, -35f, 0f); GameObject val8 = new GameObject("Glow") { layer = num }; val8.transform.SetParent(copyRoot, false); val8.transform.position = c + Pocket + f * side * 0.8f; Light obj4 = val8.AddComponent<Light>(); obj4.type = (LightType)2; obj4.cullingMask = 1 << num; obj4.shadows = (LightShadows)0; obj4.color = new Color(0.25f, 0.65f, 1f); obj4.intensity = 1.3f; obj4.range = 8f; Shader val9 = Shader.Find("UI/Default") ?? Shader.Find("Sprites/Default"); if ((Object)(object)val9 != (Object)null) { backMat = new Material(val9); GameObject val10 = new GameObject("Backdrop") { layer = num }; val10.transform.SetParent(coverCam, false); val10.transform.localPosition = new Vector3(0f, 0f, 25f); val10.transform.localScale = new Vector3(120f, 120f, 1f); Mesh val11 = new Mesh { name = "wg_cover_quad" }; val11.vertices = (Vector3[])(object)new Vector3[4] { new Vector3(-0.5f, -0.5f, 0f), new Vector3(0.5f, -0.5f, 0f), new Vector3(-0.5f, 0.5f, 0f), new Vector3(0.5f, 0.5f, 0f) }; val11.uv = (Vector2[])(object)new Vector2[4] { new Vector2(0f, 0f), new Vector2(1f, 0f), new Vector2(0f, 1f), new Vector2(1f, 1f) }; val11.triangles = new int[6] { 0, 2, 1, 2, 3, 1 }; val11.RecalculateBounds(); val10.AddComponent<MeshFilter>().sharedMesh = val11; MeshRenderer obj5 = val10.AddComponent<MeshRenderer>(); ((Renderer)obj5).sharedMaterial = backMat; ((Renderer)obj5).shadowCastingMode = (ShadowCastingMode)0; } if ((Object)(object)sparkMat != (Object)null && !calm) { loadSparks = Sparks(c + Pocket, f * side, num, bursting: false); } StartHum(); Silence(on: true); Vector3 pos; Quaternion rot; if (calm) { pos = startPos + Pocket; rot = startRot; } else { Near(c + Pocket, f, side, stopDist, out pos, out rot); } coverCam.SetPositionAndRotation(pos, rot); AnimateCover(0f, pos, rot); return true; } private void AnimateCover(float th, Vector3 gamePos, Quaternion gameRot, bool pose = false) { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)cover == (Object)null)) { coverPhase += Time.unscaledDeltaTime; coverMat.SetFloat("_Phase", coverPhase * 1.3f + 6f); coverMat.SetFloat("_Alive", Plugin.Alive.Value); coverMat.SetFloat("_Night", 1f - Preview.Dayness()); coverMat.SetFloat("_Rim", 1f); coverMat.SetFloat("_Window", 1f); coverMat.SetFloat("_Flash", 0f); Quaternion val = Wobble(0.05f, 0f); coverCam.SetPositionAndRotation(pose ? gamePos : (gamePos + Pocket), pose ? gameRot : (gameRot * val)); if ((Object)(object)backMat != (Object)null) { backMat.color = new Color(0.01f, 0.015f, 0.025f, pose ? 1f : Smooth(th / 0.35f)); } if ((Object)(object)loadSparks != (Object)null) { EmissionModule emission = loadSparks.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(34f * Smooth(th / 0.6f)); } } } private ParticleSystem Sparks(Vector3 at, Vector3 dir, int layer, bool bursting) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0023: 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_0030: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_021c: 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_0232: 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_0245: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(bursting ? "WG_Burst" : "WG_Sparks") { layer = layer }; val.transform.position = at; val.transform.rotation = Quaternion.LookRotation(dir); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); val2.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val2.main; ((MainModule)(ref main)).loop = !bursting; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).startLifetime = (bursting ? new MinMaxCurve(0.9f, 1.8f) : new MinMaxCurve(1.6f, 2.8f)); ((MainModule)(ref main)).startSpeed = (bursting ? new MinMaxCurve(3f, 9f) : new MinMaxCurve(0.5f, 1.6f)); ((MainModule)(ref main)).startSize = (bursting ? new MinMaxCurve(0.05f, 0.13f) : new MinMaxCurve(0.025f, 0.065f)); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 400; ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.45f, 0.95f, 1f, 0.95f), new Color(1f, 1f, 1f, 0.95f)); EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); if (bursting) { ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)150) }); } ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)4; ((ShapeModule)(ref shape)).angle = (bursting ? 38f : 12f); ((ShapeModule)(ref shape)).radius = 0.95f; ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val3 = new Gradient(); val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(1f, 0.15f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val3); ((Renderer)val.GetComponent<ParticleSystemRenderer>()).sharedMaterial = sparkMat; val2.Play(); return val2; } private void Burst(Vector3 c, Vector3 f, float side) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)sparkMat == (Object)null)) { Object.Destroy((Object)(object)((Component)Sparks(c, f * side, 0, bursting: true)).gameObject, 4f); } } private void OpenSwirl(TeleportWorld dest, float side) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_0078: 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) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) Transform val = (((Object)(object)dest == (Object)null) ? null : ((Component)dest).transform.Find("_target_found_red/WG_Vortex")); if (!((Object)(object)val == (Object)null) && !((Object)(object)coverMesh == (Object)null) && !((Object)(object)coverMat == (Object)null)) { arrivalMat = new Material(coverMat); GameObject val2 = new GameObject("WG_ArrivalSwirl"); arrival = val2.transform; Transform obj = arrival; Bounds bounds = coverMesh.bounds; obj.position = val.TransformPoint(((Bounds)(ref bounds)).center); arrival.rotation = val.rotation * ((side < 0f) ? Quaternion.Euler(0f, 180f, 0f) : Quaternion.identity); arrivalScale = val.lossyScale; arrival.localScale = arrivalScale * 0.5f; GameObject val3 = new GameObject("Mesh"); val3.transform.SetParent(arrival, false); Transform transform = val3.transform; bounds = coverMesh.bounds; transform.localPosition = -((Bounds)(ref bounds)).center; val3.AddComponent<MeshFilter>().sharedMesh = coverMesh; MeshRenderer obj2 = val3.AddComponent<MeshRenderer>(); ((Renderer)obj2).sharedMaterial = arrivalMat; ((Renderer)obj2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)obj2).receiveShadows = false; Vortex.Window(arrivalMat, (Texture)(object)(((Object)(object)Preview.I == (Object)null) ? null : Preview.I.Get(sourcePos, 0)), (Texture)(object)(((Object)(object)Preview.I == (Object)null) ? null : Preview.I.Get(sourcePos, 1))); arrivalPhase = 6f; } } private void AnimateArrival(float t, float th) { //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)arrival == (Object)null)) { if (th >= 0.6f) { DestroyArrival(); return; } arrivalPhase += Time.unscaledDeltaTime * ((t < 0.6f) ? 4.5f : 1.6f); arrivalMat.SetFloat("_Phase", arrivalPhase); arrivalMat.SetFloat("_Alive", Plugin.Alive.Value); arrivalMat.SetFloat("_Night", 1f - Preview.Dayness()); arrivalMat.SetFloat("_Rim", 1f); arrivalMat.SetFloat("_Window", Smooth(t / 0.45f) * ((th > 0f) ? (1f - Smooth(th / 0.4f)) : 1f)); arrivalMat.SetFloat("_Flash", Mathf.Clamp01(1f - t / 0.6f)); float num = Mathf.Lerp(0.5f, 1f, Cubic(t / 0.3f)); float num2 = ((th > 0f) ? (1f - Cubic(th / 0.6f)) : 1f); arrival.localScale = arrivalScale * num * num2; } } private void DestroyArrival() { if ((Object)(object)arrival != (Object)null) { Object.Destroy((Object)(object)((Component)arrival).gameObject); } if ((Object)(object)arrivalMat != (Object)null) { Object.Destroy((Object)(object)arrivalMat); } arrival = null; arrivalMat = null; } private void DestroyCover() { if (coverLayer >= 0 && (Object)(object)Camera.main != (Object)null && coverBitWasOn) { Camera main = Camera.main; main.cullingMask |= 1 << coverLayer; } coverLayer = -1; if ((Object)(object)cover != (Object)null) { Object.Destroy((Object)(object)cover); } if ((Object)(object)backMat != (Object)null) { Object.Destroy((Object)(object)backMat); } foreach (Material copyMat in copyMats) { if ((Object)(object)copyMat != (Object)null) { Object.Destroy((Object)(object)copyMat); } } copyMats.Clear(); cover = null; backMat = null; coverCam = (copyRoot = null); loadSparks = null; } private static AudioClip Rush() { return Sfx.Named("jump_rush.wav"); } private static AudioClip Boom() { return Sfx.Named("jump_boom.wav"); } private static AudioClip Whoosh() { return Sfx.Named("jump_whoosh.wav"); } private void Play(AudioClip clip, float volume, float pitch) { //IL_0016: 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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown if (!((Object)(object)clip == (Object)null) && !Application.isBatchMode) { GameObject val = new GameObject("WorldgateFxSound"); val.transform.SetParent(((Component)this).transform, false); AudioSource obj = val.AddComponent<AudioSource>(); obj.clip = clip; obj.spatialBlend = 0f; obj.pitch = pitch; obj.outputAudioMixerGroup = humMixer; obj.ignoreListenerPause = true; obj.volume = Mathf.Clamp01(volume * Plugin.SoundVolume.Value / 0.56f); obj.Play(); Object.Destroy((Object)val, clip.length + 0.2f); } } private TeleportWorld Arrival() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) TeleportWorld result = null; float num = 36f; TeleportWorld[] array = Object.FindObjectsByType<TeleportWorld>((FindObjectsSortMode)0); foreach (TeleportWorld val in array) { if (!((Object)val).name.StartsWith("portal_network")) { continue; } ZNetView component = ((Component)val).GetComponent<ZNetView>(); if (((component != null) ? component.GetZDO() : null) != null) { Vector3 val2 = ((Component)val).transform.position - ((Component)player).transform.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = val; } } } return result; } public static void ClearBlack(Hud hud) { if (!((Object)(object)inst == (Object)null) && !((Object)(object)hud == (Object)null) && (inst.phase == Phase.In || inst.phase == Phase.Hold || (Object)(object)inst.cover != (Object)null)) { if ((Object)(object)hud.m_loadingScreen != (Object)null) { hud.m_loadingScreen.alpha = 0f; } if ((Object)(object)hud.m_teleportingProgress !