using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using Abilities; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameplayEntities; using HarmonyLib; using LLBML; using LLBML.GameEvents; using LLBML.Math; using LLBML.Messages; using LLBML.Networking; using LLBML.Players; using LLBML.States; using LLBML.Texture; using LLBML.Utils; using LLHandlers; using LLScreen; using Multiplayer; using TarUtils; using TextureMod.CustomSkins; using TextureMod.Effects; using TextureMod.Showcase; using TextureMod.TMPlayer; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("c2070354-d05f-4ed9-b31f-ad07edbbb360")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyTitle("TextureMod (no.mrgentle.plugins.llb.texturemod)")] [assembly: AssemblyProduct("TextureMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.4.1.0")] [module: UnverifiableCode] namespace TextureMod { public static class CustomStyle { private static Dictionary texColors = new Dictionary(); public static GUIStyle border = new GUIStyle { padding = new RectOffset(10, 10, 24, 10), fontSize = 136 }; public static GUIStyle mainStyle { get { //IL_0000: 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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown GUIStyle val = new GUIStyle { padding = new RectOffset(4, 4, 4, 4) }; val.normal.background = texColors["Black"]; return val; } } public static GUIStyle labStyle { get { //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_0017: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = 16, alignment = (TextAnchor)4 }; val.normal.textColor = new Color(1f, 0.968f, 0.3f); return val; } } public static GUIStyle windStyle { get { //IL_0000: 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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_0014: 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_002a: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown GUIStyle val = new GUIStyle { padding = new RectOffset(4, 4, 4, 4), alignment = (TextAnchor)1, fontSize = 20, fontStyle = (FontStyle)1 }; val.normal.background = texColors["Black"]; val.normal.textColor = new Color(1f, 1f, 1f); return val; } } public static GUIStyle button { get { //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_0017: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0034: 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_0044: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0099: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.button) { fontSize = 15, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, padding = new RectOffset(4, 4, 4, 4) }; val.normal.textColor = Color.black; val.hover.textColor = Color.black; val.active.textColor = Color.white; val.normal.background = texColors["Yellow"]; val.hover.background = texColors["LightYellow"]; return val; } } public static GUIStyle box { get { //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_0017: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0034: 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_0044: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0099: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.box) { fontSize = 15, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, padding = new RectOffset(4, 4, 4, 4) }; val.normal.textColor = Color.black; val.hover.textColor = Color.black; val.active.textColor = Color.white; val.normal.background = texColors["Yellow"]; val.hover.background = texColors["Yellow"]; return val; } } public static GUIStyle headerBox { get { //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_0017: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0034: 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_0044: 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_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: 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_0099: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.box) { fontSize = 18, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, padding = new RectOffset(4, 4, 4, 4) }; val.normal.textColor = Color.black; val.hover.textColor = Color.black; val.active.textColor = Color.white; val.normal.background = texColors["Yellow"]; val.hover.background = texColors["Yellow"]; return val; } } public static GUIStyle versionBox { get { //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_0017: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0034: 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_0053: 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) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.box) { fontSize = 15, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, padding = new RectOffset(4, 4, 4, 4) }; val.normal.textColor = new Color(1f, 0.968f, 0.3f); val.hover.textColor = new Color(1f, 0.968f, 0.3f); val.active.textColor = new Color(1f, 0.968f, 0.3f); val.normal.background = texColors["Black"]; val.hover.background = texColors["Black"]; return val; } } public static GUIStyle _sliderThumbStyle { get { //IL_0000: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown GUIStyle val = new GUIStyle { fontSize = 24, fontStyle = (FontStyle)1, alignment = (TextAnchor)4, stretchHeight = true, fixedWidth = 40f }; val.normal.background = texColors["Black"]; val.hover.background = texColors["Black"]; val.active.background = texColors["LightGray"]; return val; } } public static GUIStyle _sliderBackgroundStyle { get { //IL_0000: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //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_002a: Expected O, but got Unknown //IL_002a: 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_005e: 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_0093: Expected O, but got Unknown GUIStyle val = new GUIStyle { stretchWidth = true, padding = new RectOffset(2, 2, 2, 2), margin = new RectOffset(0, 0, 7, 0) }; val.normal.background = texColors["Yellow"]; val.hover.background = texColors["Yellow"]; val.active.background = texColors["Yellow"]; val.focused.background = texColors["Yellow"]; return val; } } public static GUIStyle _textFieldStyle { get { //IL_0000: 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_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_002b: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown GUIStyle val = new GUIStyle { fontSize = 16, padding = new RectOffset(4, 4, 4, 4), margin = new RectOffset(0, 0, 5, 0) }; val.normal.textColor = new Color(1f, 0.968f, 0.3f); val.normal.background = texColors["Black"]; return val; } } public static GUIStyle readStyle { get { //IL_0000: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0025: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown GUIStyle val = new GUIStyle { alignment = (TextAnchor)3, fontSize = 16, margin = new RectOffset(25, 25, 0, 0), wordWrap = true }; val.normal.textColor = Color.white; return val; } } public static void InitStyle() { //IL_0019: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00f3: Unknown result type (might be due to invalid IL or missing references) texColors.Add("Yellow", ColorToTexture2D(Color32.op_Implicit(new Color(1f, 0.968f, 0.3f)))); texColors.Add("LightYellow", ColorToTexture2D(Color32.op_Implicit(new Color(1f, 1f, 0.5f)))); texColors.Add("DarkGray", ColorToTexture2D(Color32.op_Implicit(new Color(0.145f, 0.145f, 0.145f)))); texColors.Add("LightGray", ColorToTexture2D(Color32.op_Implicit(new Color(0.5f, 0.5f, 0.5f)))); texColors.Add("Black", ColorToTexture2D(new Color32((byte)12, (byte)12, (byte)12, (byte)100))); texColors.Add("White", ColorToTexture2D(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue))); } private static Texture2D ColorToTexture2D(Color32 color) { //IL_0004: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); val.SetPixel(0, 0, Color32.op_Implicit(color)); val.Apply(); return val; } } public static class ExchangeClient { private enum TexModMessages { TEXMOD_SKINCHECK = 4040, TEXMOD_SKINNOTICE, TEXMOD_SKINREQUEST, TEXMOD_SKIN } private static int transactionIDCounter; private static ManualLogSource Logger => TextureMod.Log; public static void Init() { PluginInfo info = ((BaseUnityPlugin)TextureMod.Instance).Info; MessageApi.RegisterCustomMessage(info, (ushort)4042, TexModMessages.TEXMOD_SKINREQUEST.ToString(), (Action)ReceiveSkinRequest); MessageApi.RegisterCustomMessage(info, (ushort)4041, TexModMessages.TEXMOD_SKINNOTICE.ToString(), (Action)ReceiveSkinNotice); MessageApi.RegisterCustomMessage(info, (ushort)4043, TexModMessages.TEXMOD_SKIN.ToString(), (Action)ReceiveSkinFromMessage); PlayerLobbyState.RegisterPayload(info, (Func)OnSendPayload, (Action)OnReceivePayload); NetworkApi.RegisterModPacketCallback(info, (Action)OnReceiveModPacket); } public static byte[] OnSendPayload(PlayerLobbyState pls) { if (!TextureMod.sendSkinsToOpponents.Value) { return null; } TexModPlayer player = TexModPlayerManager.GetPlayer(pls.playerNr); TextureMod.Log.LogDebug((object)("Test: " + ((object)pls).ToString())); if (player.Player.isLocal) { if (player.HasCustomSkin()) { List list = new List(); byte[] array = (byte[])(Hash)player.CustomSkin.SkinHash; list.Add((byte)array.Length); list.AddRange(array); return list.ToArray(); } return null; } return null; } public static void OnReceivePayload(PlayerLobbyState pls, byte[] payload) { BinaryReader binaryReader = new BinaryReader(new MemoryStream(payload)); int num = binaryReader.ReadByte(); if (num == 0) { return; } byte[] data = binaryReader.ReadBytes(num); if (!TextureMod.receiveSkinsFromOpponents.Value) { return; } try { SkinHash skinHash = new SkinHash(data); ProcessSkinHash(pls.playerNr, skinHash); } catch (Exception ex) { Logger.LogError((object)("Caught Exception trying to receive lobby state: " + ex)); } } public static void SendSkinNotice(SkinHash skinHash) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) TextureMod.Log.LogDebug((object)("Sending skin notice for hash: " + (object)skinHash)); P2P.SendOthers(new Message((Msg)4041, ((Peer)P2P.localPeer).playerNr, 0, (object)((Hash)skinHash).Bytes, ((Hash)skinHash).Bytes.Length)); } public static void ReceiveSkinNotice(Message msg) { //IL_000d: 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_0052: Unknown result type (might be due to invalid IL or missing references) if (TextureMod.receiveSkinsFromOpponents.Value && msg.playerNr != ((Peer)P2P.localPeer).playerNr) { SkinHash skinHash = new SkinHash((byte[])msg.ob); TextureMod.Log.LogDebug((object)("Received skin notice for hash: " + (object)skinHash)); ProcessSkinHash(msg.playerNr, skinHash); } } private static void ProcessSkinHash(int fromNr, SkinHash skinHash) { TexModPlayer player = TexModPlayerManager.GetPlayer(fromNr); Logger.LogDebug((object)($"Player {player.Player.nr} has custom skin: " + (object)skinHash)); CustomSkinHandler handlerFromHash = SkinsManager.skinCache.GetHandlerFromHash(skinHash); if (handlerFromHash != null) { Logger.LogDebug((object)"Skin is known, applying."); player.SetCustomSkin(handlerFromHash); GameStatesLobbyUtils.RefreshPlayerState(player.Player); } else { Logger.LogDebug((object)"Skin is not known, requesting."); SendSkinRequest(player.Player.nr, skinHash); } } public static void SendSkinRequest(int playerNrToRequest, SkinHash skinHash) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) TextureMod.Log.LogDebug((object)("Requesting skin with hash: " + (object)skinHash)); NetworkApi.SendMessageToPlayer(playerNrToRequest, new Message((Msg)4042, ((Peer)P2P.localPeer).playerNr, transactionIDCounter++, (object)((Hash)skinHash).Bytes, ((Hash)skinHash).Bytes.Length)); } public static void ReceiveSkinRequest(Message msg) { //IL_0000: 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) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (msg.playerNr != ((Peer)P2P.localPeer).playerNr) { SkinHash skinHash = new SkinHash((byte[])msg.ob); TextureMod.Log.LogDebug((object)("Received skin request for hash: " + (object)skinHash)); CustomSkin skinFromHash = SkinsManager.skinCache.GetSkinFromHash(skinHash); if (skinFromHash != null) { SendSkin(msg.playerNr, msg.index, skinFromHash); } } } public static void SendSkin(int playerNrToSendSkin, int requestID, CustomSkin skin) { TextureMod.Log.LogDebug((object)$"Sending skin {skin.Name} to player {playerNrToSendSkin}"); byte[] array = skin.ToBytes(); NetworkApi.SendModPacket(((BaseUnityPlugin)TextureMod.Instance).Info, Player.GetPlayer(playerNrToSendSkin), array); } public static void OnReceiveModPacket(Peer sender, byte[] data) { ReceiveSkin(Player.GetPlayer(sender.playerNr), CustomSkin.FromBytes(data)); } public static void ReceiveSkinFromMessage(Message msg) { //IL_0000: 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) ReceiveSkin(Player.GetPlayer(msg.playerNr), CustomSkin.FromBytes((byte[])msg.ob)); } public static void ReceiveSkin(Player sender, CustomSkin receivedSkin) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) TextureMod.Log.LogDebug((object)string.Format("Received skin from player {0}, is it null? {1}", sender.nr, (receivedSkin == null) ? "Yes" : "No")); if (receivedSkin != null) { TextureMod.Log.LogDebug((object)$"Successfuly received {receivedSkin.Name} from player {sender.nr}"); CustomSkinHandler customSkinHandler = new CustomSkinHandler(receivedSkin) { IsRemote = true }; ((GenericCache)SkinsManager.skinCache).Add(customSkinHandler.CustomSkin.Character, customSkinHandler); TexModPlayerManager.Instance.tmPlayers[sender.nr].SetCustomSkin(customSkinHandler); } } } public class ModDebugging : MonoBehaviour { public Dictionary> windows = new Dictionary>(); public Dictionary windowRects = new Dictionary(); public bool showHud = true; public List enabledWindows = new List(); public Rect windowSelectionWindowRect = new Rect(10f, 10f, 100f, 100f); private void OnGUI() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Expected O, but got Unknown //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Expected O, but got Unknown //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) if (!TextureMod.showDebugInfo.Value) { return; } GUIStyle window = new GUIStyle(GUIStyle.op_Implicit("Box")); GUI.skin.window = window; GUI.skin.window.fontSize = 20; GUI.skin.window.padding.top = 35; GUI.skin.window.contentOffset = new Vector2(0f, -25f); GUI.skin.window.alignment = (TextAnchor)1; if (enabledWindows.Count < windows.Count) { do { enabledWindows.Add(item: false); Debug.Log((object)"did it"); } while (enabledWindows.Count < windows.Count); } int num = -1; string text = ""; foreach (KeyValuePair> window2 in windows) { string text2 = window2.Key + ": "; if (text2.Length > num) { num = text2.Length; text = text2; } } GUIContent val = new GUIContent(text); if (showHud) { windowSelectionWindowRect = GUILayout.Window(909089, new Rect(0f, 0f, GUI.skin.window.CalcSize(val).x + 100f, ((Rect)(ref windowSelectionWindowRect)).height), new WindowFunction(WindowSelectionWindow), "Debug Windows (Shift + D)", (GUILayoutOption[])(object)new GUILayoutOption[0]); } int num2 = 909090; foreach (KeyValuePair> window3 in windows) { if (enabledWindows[num2 - 909090]) { int num3 = -1; string text3 = ""; foreach (KeyValuePair item in window3.Value) { string text4 = item.Key + " = " + item.Value; if (text4.Length > num3) { num3 = text4.Length; text3 = text4; } } GUIContent val2 = new GUIContent(text3); if (!windowRects.ContainsKey(window3.Key)) { windowRects.Add(window3.Key, new Rect(0f, 0f, 100f, 20f)); } Dictionary dictionary = windowRects; string key = window3.Key; int num4 = num2; Rect val3 = windowRects[window3.Key]; float x = ((Rect)(ref val3)).x; val3 = windowRects[window3.Key]; float y = ((Rect)(ref val3)).y; float num5 = GUI.skin.window.CalcSize(val2).x + 50f; val3 = windowRects[window3.Key]; dictionary[key] = GUILayout.Window(num4, new Rect(x, y, num5, ((Rect)(ref val3)).height), new WindowFunction(DebugWindow), window3.Key, (GUILayoutOption[])(object)new GUILayoutOption[0]); } num2++; } } private void Update() { if ((Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)) && Input.GetKeyDown((KeyCode)100)) { showHud = !showHud; } } private void WindowSelectionWindow(int _windowId) { GUI.skin.label.fontSize = 16; GUI.skin.label.alignment = (TextAnchor)3; GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[0]); int num = 0; if (windows.Count > 0) { foreach (KeyValuePair> window in windows) { GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.FlexibleSpace(); GUILayout.Label(window.Key + ": ", (GUILayoutOption[])(object)new GUILayoutOption[0]); if (GUILayout.Button(enabledWindows[num].ToString(), (GUILayoutOption[])(object)new GUILayoutOption[0])) { enabledWindows[num] = !enabledWindows[num]; } GUILayout.FlexibleSpace(); GUILayout.EndHorizontal(); num++; } } GUILayout.EndVertical(); GUILayout.EndHorizontal(); } private void DebugWindow(int _windowId) { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) Dictionary value = windows.ElementAt(_windowId - 909090).Value; GUI.skin.label.fontSize = 16; GUI.skin.label.alignment = (TextAnchor)3; GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[0]); foreach (KeyValuePair item in value) { GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(item.Key + " = " + item.Value, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndHorizontal(); } GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUI.DragWindow(new Rect(0f, 0f, 10000f, 10000f)); } public void AddToWindow(string windowName, string varName, string varValue) { if (windows.ContainsKey(windowName)) { if (windows[windowName].ContainsKey(varName)) { windows[windowName][varName] = varValue; } else { windows[windowName].Add(varName, varValue); } } else { windows.Add(windowName, new Dictionary()); windows[windowName].Add(varName, varValue); } } private Texture2D ColorToTexture2D(Color color) { //IL_0004: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); val.SetPixel(0, 0, color); val.Apply(); return val; } } public class SmoothMouseLook : MonoBehaviour { public enum RotationAxes { MouseXAndY, MouseX, MouseY } public float speed = 3f; private Vector3 moveDirection = Vector3.zero; public Vector3 movementMultiplier; public RotationAxes axes; public float sensitivityX = 1f; public float sensitivityY = 1f; public float minimumX = -360f; public float maximumX = 360f; public float minimumY = -60f; public float maximumY = 60f; private float rotationX; private float rotationY; private List rotArrayX = new List(); private float rotAverageX; private List rotArrayY = new List(); private float rotAverageY; public float frameCounter = 20f; private Quaternion originalRotation; public bool isActive; private void Update() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: 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_0547: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_045d: 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_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0470: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) if (!isActive) { return; } moveDirection = new Vector3(movementMultiplier.x, movementMultiplier.y, movementMultiplier.z); moveDirection = ((Component)this).transform.TransformDirection(moveDirection); moveDirection *= speed; movementMultiplier.x = 0f; movementMultiplier.z = 0f; movementMultiplier.y = 0f; if (Input.GetKey((KeyCode)100)) { movementMultiplier.x += 1f; movementMultiplier.z += 0f; } if (Input.GetKey((KeyCode)97)) { movementMultiplier.x += -1f; movementMultiplier.z += 0f; } if (Input.GetKey((KeyCode)115)) { movementMultiplier.x += 0f; movementMultiplier.z += -1f; } if (Input.GetKey((KeyCode)119)) { movementMultiplier.x += 0f; movementMultiplier.z += 1f; } if (Input.GetKey((KeyCode)113)) { movementMultiplier.y += 0.5f; } if (Input.GetKey((KeyCode)101)) { movementMultiplier.y -= 0.5f; } Transform transform = ((Component)this).transform; transform.position += moveDirection * Time.deltaTime; if (axes == RotationAxes.MouseXAndY) { rotAverageY = 0f; rotAverageX = 0f; rotationY += Input.GetAxis("Mouse Y") * sensitivityY; rotationX += Input.GetAxis("Mouse X") * sensitivityX; rotArrayY.Add(rotationY); rotArrayX.Add(rotationX); if ((float)rotArrayY.Count >= frameCounter) { rotArrayY.RemoveAt(0); } if ((float)rotArrayX.Count >= frameCounter) { rotArrayX.RemoveAt(0); } for (int i = 0; i < rotArrayY.Count; i++) { rotAverageY += rotArrayY[i]; } for (int j = 0; j < rotArrayX.Count; j++) { rotAverageX += rotArrayX[j]; } rotAverageY /= rotArrayY.Count; rotAverageX /= rotArrayX.Count; rotAverageY = ClampAngle(rotAverageY, minimumY, maximumY); rotAverageX = ClampAngle(rotAverageX, minimumX, maximumX); Quaternion val = Quaternion.AngleAxis(rotAverageY, Vector3.left); Quaternion val2 = Quaternion.AngleAxis(rotAverageX, Vector3.up); ((Component)this).transform.localRotation = originalRotation * val2 * val; } else if (axes == RotationAxes.MouseX) { rotAverageX = 0f; rotationX += Input.GetAxis("Mouse X") * sensitivityX; rotArrayX.Add(rotationX); if ((float)rotArrayX.Count >= frameCounter) { rotArrayX.RemoveAt(0); } for (int k = 0; k < rotArrayX.Count; k++) { rotAverageX += rotArrayX[k]; } rotAverageX /= rotArrayX.Count; rotAverageX = ClampAngle(rotAverageX, minimumX, maximumX); Quaternion val3 = Quaternion.AngleAxis(rotAverageX, Vector3.up); ((Component)this).transform.localRotation = originalRotation * val3; } else { rotAverageY = 0f; rotationY += Input.GetAxis("Mouse Y") * sensitivityY; rotArrayY.Add(rotationY); if ((float)rotArrayY.Count >= frameCounter) { rotArrayY.RemoveAt(0); } for (int l = 0; l < rotArrayY.Count; l++) { rotAverageY += rotArrayY[l]; } rotAverageY /= rotArrayY.Count; rotAverageY = ClampAngle(rotAverageY, minimumY, maximumY); Quaternion val4 = Quaternion.AngleAxis(rotAverageY, Vector3.left); ((Component)this).transform.localRotation = originalRotation * val4; } } private void Start() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) Rigidbody component = ((Component)this).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { component.freezeRotation = true; } originalRotation = ((Component)this).transform.localRotation; } public static float ClampAngle(float angle, float min, float max) { angle %= 360f; if (angle >= -360f && angle <= 360f) { if (angle < -360f) { angle += 360f; } if (angle > 360f) { angle -= 360f; } } return Mathf.Clamp(angle, min, max); } } [BepInPlugin("no.mrgentle.plugins.llb.texturemod", "TextureMod", "2.4.1")] [BepInProcess("LLBlaze.exe")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class TextureMod : BaseUnityPlugin { private const string modVersion = "2.4.1"; private const string repositoryOwner = "Daioutzu"; private const string repositoryName = "LLBMM-TextureMod"; public TexModPlayerManager tmpl; public SkinsManager sm; public ModDebugging md; public EffectChanger effectChanger; public ShowcaseStudio showcaseStudio; public static string loadingText = "TextureMod is loading External Textures..."; public static ConfigEntry holdKey1; public static ConfigEntry nextSkin; public static ConfigEntry previousSkin; public static ConfigEntry cancelKey; public static ConfigEntry reloadCustomSkin; public static ConfigEntry reloadEntireSkinLibrary; public static ConfigEntry useOnlySetKey; public static ConfigEntry sendSkinsToOpponents; public static ConfigEntry receiveSkinsFromOpponents; public static ConfigEntry showDebugInfo; public static ConfigEntry randomSkinOnRandomSelect; public static ConfigEntry reloadCustomSkinOnInterval; public static ConfigEntry skinReloadIntervalInFrames; public static ConfigEntry assignFirstSkinOnCharacterSelection; public static TextureMod Instance { get; private set; } = null; public static ManualLogSource Log { get; private set; } = null; public static DirectoryInfo ModdingFolder { get; private set; } public static string ResourceFolder { get; private set; } public static string EffectFolder { get; private set; } internal static bool IsSkinKeyDown() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) return Input.GetKey(holdKey1.Value); } public void Awake() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) ((BaseUnityPlugin)this).Logger.LogInfo((object)"Hello, World!"); Instance = this; Log = ((BaseUnityPlugin)this).Logger; InitConfig(); InitFolders(); Harmony val = new Harmony("no.mrgentle.plugins.llb.texturemod"); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Patching SkinSelect_Patches"); val.PatchAll(typeof(SkinSelect_Patches)); } private void Start() { SkinsManager.LoadLibrary(); EffectsHandler.Init(); ExchangeClient.Init(); ModDependenciesUtils.RegisterToModMenu(((BaseUnityPlugin)this).Info, new List { "Wondering how to assign skins and in what part of the game you can do so?", "Simply hold the 'Enable Skin Changer' button and press either the `Next skin` or the `Previous Skin` buttons to cycle skins", "Skins can be assigned in Ranked Lobbies, 1v1 Lobbies, FFA Lobbies(Only for player 1 and 2) and in the skin unlock screen for a character or in ShowcaseStudio", "If you select random in the lobby and try to assign a custom skin you will be given a random character and random skin. In online lobbies you will be set to ready, and your buttons will become unavailable unless you've deactivated 'Lock Buttons On Random'", " ", "If you wish to real time edit your skins, use the F5 button to reload your skin whenever you're in training mode or in the character skin unlock screen", "You can also enable the interval mode and have it automatically reload the current custom skin every so often. Great for dual screen, or windowed mode setups (Does not work in training mode)", "This mod was written by MrGentle" }); tmpl = ((Component)this).gameObject.AddComponent(); sm = ((Component)this).gameObject.AddComponent(); } private void Update() { if ((Object)(object)md == (Object)null) { md = ((Component)this).gameObject.AddComponent(); } if ((Object)(object)effectChanger == (Object)null) { effectChanger = ((Component)this).gameObject.AddComponent(); } if ((Object)(object)showcaseStudio == (Object)null) { showcaseStudio = ((Component)this).gameObject.AddComponent(); } } public static byte[] External_GetSkinHashFromPlayer(int nr) { return ((Hash)(TexModPlayerManager.GetPlayer(nr) ?? throw new NullReferenceException("Player is not assigned")).CustomSkin?.SkinHash).Bytes; } public static void External_AssignSkinToPlayer(int nr, byte[] skinHash) { try { CustomSkinHandler handlerFromHash = SkinsManager.skinCache.GetHandlerFromHash(new SkinHash(skinHash)); TexModPlayerManager.GetPlayer(nr)?.SetCustomSkin(handlerFromHash); } catch (Exception arg) { Log.LogWarning((object)$"Caught Exception while trying to assign a skin to player {nr}: {arg}"); } } private void OnGUI() { } private void InitConfig() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Expected O, but got Unknown //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown ConfigFile config = ((BaseUnityPlugin)Instance).Config; config.Bind("TextureChanger", "lobby_settings_header", "Lobby Settings:", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" })); holdKey1 = config.Bind("TextureChanger", "holdKey1", (KeyCode)304, (ConfigDescription)null); nextSkin = config.Bind("TextureChanger", "nextSkin", (KeyCode)323, (ConfigDescription)null); previousSkin = config.Bind("TextureChanger", "previousSkin", (KeyCode)324, (ConfigDescription)null); cancelKey = config.Bind("TextureChanger", "cancelKey", (KeyCode)97, (ConfigDescription)null); useOnlySetKey = config.Bind("TextureChanger", "useOnlySetKey", false, (ConfigDescription)null); sendSkinsToOpponents = config.Bind("TextureChanger", "sendSkinsToOpponents", true, (ConfigDescription)null); receiveSkinsFromOpponents = config.Bind("TextureChanger", "receiveSkinsFromOpponents", true, (ConfigDescription)null); randomSkinOnRandomSelect = config.Bind("TextureChanger", "randomSkinOnRandomSelect", true, (ConfigDescription)null); assignFirstSkinOnCharacterSelection = config.Bind("TextureChanger", "assignFirstSkinOnCharacterSelection", false, (ConfigDescription)null); config.Bind("TextureChanger", "gap1", 20, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_gap" })); config.Bind("TextureChanger", "rt_skin_edit_header", "Real-time Skin editing:", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" })); reloadCustomSkin = config.Bind("TextureChanger", "reloadCustomSkin", (KeyCode)286, (ConfigDescription)null); reloadEntireSkinLibrary = config.Bind("TextureChanger", "reloadEntireSkinLibrary", (KeyCode)290, (ConfigDescription)null); reloadCustomSkinOnInterval = config.Bind("TextureChanger", "reloadCustomSkinOnInterval", false, (ConfigDescription)null); skinReloadIntervalInFrames = config.Bind("TextureChanger", "skinReloadIntervalInFrames", 60, (ConfigDescription)null); config.Bind("TextureChanger", "gap2", 20, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_gap" })); config.Bind("TextureChanger", "general_header", "General:", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" })); showDebugInfo = config.Bind("TextureChanger", "showDebugInfo", false, (ConfigDescription)null); config.Bind("TextureChanger", "gap3", 20, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_gap" })); } private void InitFolders() { ResourceFolder = Utility.CombinePaths(new string[2] { Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "TextureModResources" }); ModdingFolder = ModdingFolder.GetModSubFolder(((BaseUnityPlugin)this).Info); EffectFolder = Utility.CombinePaths(new string[2] { ModdingFolder.FullName, "Effects" }); if (!Directory.Exists(EffectFolder)) { ExtractEffects(EffectFolder); } } private void ExtractEffects(string path) { FileInfo[] files = new DirectoryInfo(ResourceFolder).GetFiles("*effects.tar.gz"); if (files.Length == 0) { ((BaseUnityPlugin)this).Logger.LogError((object)"Failed to find the effects archive."); return; } DirectoryInfo directoryInfo = Directory.CreateDirectory(path); FileInfo[] array = files; foreach (FileInfo fileInfo in array) { ((BaseUnityPlugin)this).Logger.LogDebug((object)("Extracting effects: " + fileInfo.FullName + ".")); TarUtils.ExtractTarGz(fileInfo.FullName, directoryInfo.FullName); } } } internal static class PluginInfos { public const string PLUGIN_NAME = "TextureMod"; public const string PLUGIN_ID = "no.mrgentle.plugins.llb.texturemod"; public const string PLUGIN_VERSION = "2.4.1"; } public static class VariantHelper { public static List DefaultModelVariants = new List { (CharacterVariant)0, (CharacterVariant)1, (CharacterVariant)2, (CharacterVariant)3, (CharacterVariant)4, (CharacterVariant)5, (CharacterVariant)6, (CharacterVariant)7, (CharacterVariant)8 }; public static List AltModelVariants = new List { (CharacterVariant)9, (CharacterVariant)10 }; public static List DLCModelVariants = new List { (CharacterVariant)11, (CharacterVariant)12 }; public static bool VariantMatch(CharacterVariant characterVariant, ModelVariant modelVariant) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 switch (modelVariant) { case ModelVariant.Default: return (int)characterVariant < 8; case ModelVariant.Alternative: if ((int)characterVariant != 9) { return (int)characterVariant == 10; } return true; case ModelVariant.DLC: if ((int)characterVariant != 11) { return (int)characterVariant == 12; } return true; default: return false; } } public static ModelVariant GetModelVariantFromFilePath(string path) { string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(path); if (fileNameWithoutExtension.Contains("_ALT2")) { return ModelVariant.DLC; } if (fileNameWithoutExtension.Contains("_ALT")) { return ModelVariant.Alternative; } return ModelVariant.Default; } public static ModelVariant GetModelVariant(CharacterVariant characterVariant) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (DefaultModelVariants.Contains(characterVariant)) { return ModelVariant.Default; } if (AltModelVariants.Contains(characterVariant)) { return ModelVariant.Alternative; } if (DLCModelVariants.Contains(characterVariant)) { return ModelVariant.DLC; } return ModelVariant.None; } public static CharacterVariant GetDefaultVariantForModel(ModelVariant variantType) { //IL_001c: 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_0034: Unknown result type (might be due to invalid IL or missing references) return (CharacterVariant)(variantType switch { ModelVariant.Default => DefaultModelVariants[0], ModelVariant.Alternative => AltModelVariants[0], ModelVariant.DLC => DLCModelVariants[0], _ => 0, }); } public static List GetVariantsForModel(ModelVariant variantType) { return variantType switch { ModelVariant.Default => DefaultModelVariants, ModelVariant.Alternative => AltModelVariants, ModelVariant.DLC => DLCModelVariants, _ => null, }; } public static CharacterVariant GetNextVariantForModel(ModelVariant variantType, CharacterVariant characterVariant) { //IL_0007: 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_0023: Unknown result type (might be due to invalid IL or missing references) List variantsForModel = GetVariantsForModel(variantType); if (VariantMatch(characterVariant, variantType)) { int num = variantsForModel.IndexOf(characterVariant); return variantsForModel[(num + 1) % variantsForModel.Count]; } return (CharacterVariant)8; } } public enum ModelVariant { None, Default, Alternative, DLC } public static class RendererHelper { public static void AssignTextureToHud(Texture2D texture, PlayerEntity playerEntity) { //IL_0042: 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) ScreenBase obj = ScreenApi.CurrentScreens[0]; ScreenGameHud val = (ScreenGameHud)(object)((obj is ScreenGameHud) ? obj : null); if (val != null) { Player val2 = Player.op_Implicit(((AbilityEntity)playerEntity).player); Renderer[] componentsInChildren = ((Component)((Component)val.playerInfos[val2.nr]).gameObject.transform).GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { AssignTextureToRenderer(componentsInChildren[i], texture, ((MovableEntity)playerEntity).character, ((MovableEntity)playerEntity).variant); } } } public static void AssignTextureToIngameCharacter(PlayerEntity playerEntity, Texture2D texture) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Invalid comparison between Unknown and I4 //IL_0057: Unknown result type (might be due to invalid IL or missing references) foreach (Renderer skinRenderer in ((VisualEntity)playerEntity).skinRenderers) { AssignTextureToRenderer(skinRenderer, texture, ((MovableEntity)playerEntity).character, ((MovableEntity)playerEntity).variant); } if ((int)((MovableEntity)playerEntity).character == 10) { EffectsHandler.AssignToxicEffectColors(((AbilityEntity)playerEntity).player.CJFLMDNNMIE, texture, ((MovableEntity)playerEntity).variant); } } public static void AssignSkinToWinnerModel(PostScreen postScreen, PlayerEntity playerEntity, Texture2D texture) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) AssignTextureToCharacterModelRenderers(postScreen.winnerModel, ((MovableEntity)playerEntity).character, ((MovableEntity)playerEntity).variant, texture); } public static void AssignTextureToPostGameHud(PostScreen postScreen, Texture2D texture, int playerNr) { //IL_0028: 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) Player player = Player.GetPlayer(playerNr); Renderer[] componentsInChildren = ((Component)((Component)postScreen.playerBarsByPlayer[playerNr]).gameObject.transform).GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { AssignTextureToRenderer(componentsInChildren[i], texture, player.Character, player.CharacterVariant); } } public static void AssignTextureToCharacterModelRenderers(CharacterModel model, Character character, CharacterVariant variant, Texture2D texture) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) GameObject curModel = model.curModel; Renderer[] array = (Renderer[])(((object)((curModel != null) ? ((Component)curModel.transform).GetComponentsInChildren() : null)) ?? ((object)new Renderer[0])); for (int i = 0; i < array.Length; i++) { AssignTextureToRenderer(array[i], texture, character, variant); } } public static void AssignTextureToRenderer(Renderer r, Texture2D texture, Character character, CharacterVariant characterVariant) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Invalid comparison between Unknown and I4 //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Invalid comparison between Unknown and I4 //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Invalid comparison between Unknown and I4 //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Invalid comparison between Unknown and I4 //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Invalid comparison between Unknown and I4 //IL_0035: 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_0038: Invalid comparison between Unknown and I4 //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Invalid comparison between Unknown and I4 //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Invalid comparison between Unknown and I4 //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Invalid comparison between Unknown and I4 //IL_003d: 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_0119: Invalid comparison between Unknown and I4 //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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_011e: Invalid comparison between Unknown and I4 //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Invalid comparison between Unknown and I4 //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Invalid comparison between Unknown and I4 //IL_0100: 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_00fe: Invalid comparison between Unknown and I4 if (!((Object)((Component)r).gameObject).name.EndsWith("Outline")) { if ((int)characterVariant == 8 && ((Object)r.material).name.Contains("ScreenSpaceNoise")) { AOOJOMIECLD val = JPLELOFJOOH.NEBGBODHHCG(character, (CharacterVariant)(((int)characterVariant != 8) ? ((int)characterVariant) : 0)); r.material = ((AOOJOMIECLD)(ref val)).DMAMFHLFOJF(0, false); } foreach (string item in from texName in r.material.GetTexturePropertyNames() where EffectsHandler.validMainTexNames.Contains(texName) select texName) { r.material.SetTexture(item, (Texture)(object)texture); } } if ((int)character == 10) { if ((int)characterVariant == 11 || (int)characterVariant == 12) { EffectsHandler.AssignNurseToxicCanisters(r, texture); } } else if ((int)character == 9) { if ((int)characterVariant == 9 || (int)characterVariant == 10) { EffectsHandler.AssignJetScubaVisor(r, texture); } } else if ((int)character == 6) { if ((int)characterVariant == 9 || (int)characterVariant == 10) { EffectsHandler.AssignOmegaDoomboxSmearsAndArms(r, texture); } else if ((int)characterVariant == 11 || (int)characterVariant == 12) { EffectsHandler.AssignVisualizer(character, r, texture); } } else if ((int)character == 11) { EffectsHandler.AssignAshesOutlineColor(r, characterVariant, texture); } else if ((int)character == 3 && ((int)characterVariant == 11 || (int)characterVariant == 12)) { EffectsHandler.AssignVisualizer(character, r, texture); } } } public static class SkinSelect_Patches { [HarmonyPatch(typeof(OGKPCMDOMPF), "ProcessMsg")] [HarmonyPrefix] public static bool GameStatesUnlocks_ProcessMsh_Prefix(JOFJHDJHJGI OHBPPCEFBHI, Message EIMJOIEPMNA) { if (!TextureMod.IsSkinKeyDown()) { ShowcaseStudio.Instance.SetCustomSkin(null); } return true; } [HarmonyPatch(typeof(PlayersSelection), "m__4")] [HarmonyPrefix] public static bool BtSkin_OnClick_Prefix(int pNr) { if (!TextureMod.IsSkinKeyDown()) { ClearSkinFor(pNr); return true; } NextSkinFor(pNr, (Character)101); return false; } [HarmonyPatch(typeof(PlayersCharacterButton), "m__0")] [HarmonyPrefix] public static bool BtCharacter_OnClick_Prefix(int pNr, PlayersCharacterButton __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (!TextureMod.IsSkinKeyDown()) { ClearSkinFor(pNr); return true; } NextSkinFor(pNr, __instance.character); return false; } [HarmonyPatch(typeof(ScreenPlayers), "m__5")] [HarmonyPrefix] public static bool Player_ForEach_Prefix(ALDOKEMAOMB p, ScreenPlayers __instance) { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: 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_00b8: 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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_0123: 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) Player val = Player.op_Implicit(p); int nr = val.nr; Controller controller; if (!TextureMod.IsSkinKeyDown()) { controller = val.controller; if (!((Controller)(ref controller)).GetButtonDown(InputAction.SHLEFT)) { controller = val.controller; if (!((Controller)(ref controller)).GetButtonDown(InputAction.SHRIGHT)) { goto IL_0045; } } ClearSkinFor(nr); goto IL_0045; } controller = val.controller; if (((Controller)(ref controller)).GetButtonDown(InputAction.SHLEFT) || (val.nr == Player.LocalPlayerNumber && Input.GetKeyDown(TextureMod.previousSkin.Value))) { PreviousSkinFor(nr, (Character)101); } controller = val.controller; if (((Controller)(ref controller)).GetButtonDown(InputAction.SHRIGHT) || (val.nr == Player.LocalPlayerNumber && Input.GetKeyDown(TextureMod.nextSkin.Value))) { NextSkinFor(nr, (Character)101); } if (CGLLJHHAJAK.GIGAKBJGFDI.hasMouseKeyboard) { controller = val.controller; if (((Controller)(ref controller)).IncludesMouse()) { if (Input.mouseScrollDelta.y > 0.8f) { PreviousSkinFor(nr, (Character)101); } if (Input.mouseScrollDelta.y < -0.8f) { NextSkinFor(nr, (Character)101); } } } return false; IL_0045: if (CGLLJHHAJAK.GIGAKBJGFDI.hasMouseKeyboard) { controller = val.controller; if (((Controller)(ref controller)).IncludesMouse()) { if (Input.mouseScrollDelta.y > 0.8f) { ClearSkinFor(nr); } if (Input.mouseScrollDelta.y < -0.8f) { ClearSkinFor(nr); } } } return true; } public static void ClearSkinFor(int nr) { int num = ((nr != -1) ? nr : Player.GetLocalPlayer().nr); TexModPlayer player = TexModPlayerManager.GetPlayer(num); if (player?.Player != null && player.Player.selected && player is LocalTexModPlayer localTexModPlayer) { TextureMod.Log.LogDebug((object)$"Removing skin from player {num}"); localTexModPlayer.RemoveCustomSkin(); } } public static void NextSkinFor(int nr, Character character = (Character)101) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) int num = ((nr != -1) ? nr : Player.GetLocalPlayer().nr); TexModPlayer player = TexModPlayerManager.GetPlayer(num); if (player?.Player != null && player.Player.selected && player is LocalTexModPlayer localTexModPlayer) { TextureMod.Log.LogDebug((object)$"Selecting new skin for player {num}, next"); localTexModPlayer.NextSkin(character); } } public static void PreviousSkinFor(int nr, Character character = (Character)101) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) int num = ((nr != -1) ? nr : Player.GetLocalPlayer().nr); TexModPlayer player = TexModPlayerManager.GetPlayer(num); if (player?.Player != null && player.Player.selected && player is LocalTexModPlayer localTexModPlayer) { TextureMod.Log.LogDebug((object)$"Selecting new skin for player {num}, previous"); localTexModPlayer.PreviousSkin(character); } } } public static class RandomSkinSelect_Patches { } public class ModelHandler { public readonly Character character; public readonly CharacterVariant variant; private List models = new List(); public Texture2D texture; public ScreenType type; private ManualLogSource Logger => TextureMod.Log; public List Renderers { get; private set; } = new List(); public ModelHandler(Character character, CharacterVariant variant, ScreenType type = (ScreenType)0) { //IL_001d: 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_0024: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) this.character = character; this.variant = variant; this.type = type; } public void Add(IEnumerable renderers) { Renderers.AddRange(renderers); } public void Add(Func> renderersCallback) { ((MonoBehaviour)TextureMod.Instance).StartCoroutine(WaitForRenderers(renderersCallback)); } public void Add(CharacterModel model) { models.Add(model); ((MonoBehaviour)TextureMod.Instance).StartCoroutine(WaitForRenderers(model)); } public IEnumerator WaitForRenderers(CharacterModel model) { return WaitForRenderers((Func>)delegate { CharacterModel obj = model; if (obj == null) { return (IEnumerable)null; } GameObject curModel = obj.curModel; if (curModel == null) { return (IEnumerable)null; } Transform transform = curModel.transform; return (transform == null) ? null : ((Component)transform).GetComponentsInChildren(); }); } public IEnumerator WaitForRenderers(Func> renderersCallback) { IEnumerable rs = null; yield return (object)new WaitUntil((Func)delegate { if (IsObsolete()) { return true; } rs = renderersCallback(); if (rs != null) { foreach (Renderer item in rs) { if (item.enabled && item.isVisible) { return true; } } } return false; }); Renderers.AddRange(rs); } public void Update() { //IL_006e: 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) if (GameStates.IsInLobby()) { models.ForEach(delegate(CharacterModel model) { model.SetSilhouette(false); }); } if (!((Object)(object)texture != (Object)null)) { return; } foreach (Renderer renderer in Renderers) { if ((Object)(object)renderer != (Object)null && renderer.isVisible) { RendererHelper.AssignTextureToRenderer(renderer, texture, character, variant); } } } public bool IsObsolete() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (ScreenApi.CurrentScreens[0]?.screenType != (ScreenType?)type && ScreenApi.CurrentScreens[1]?.screenType != (ScreenType?)type) { return true; } return false; } public bool ValidCharacter(Character character, CharacterVariant variant = (CharacterVariant)0) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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) if (character == this.character && VariantHelper.VariantMatch(variant, VariantHelper.GetModelVariant(this.variant))) { return true; } return false; } public static ModelHandler GetCurrentModelHandler(int playerNr = -1) { //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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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_0188: 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_009c: 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_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) ScreenBase val = ScreenApi.CurrentScreens[0]; ScreenBase val2 = ScreenApi.CurrentScreens[1]; if (playerNr >= 0) { ScreenPlayers val3 = (ScreenPlayers)(object)((val is ScreenPlayers) ? val : null); if (val3 != null) { CharacterModel characterModel = val3.playerSelections[playerNr].characterModel; ModelHandler modelHandler = new ModelHandler(characterModel.character, characterModel.characterVariant, ((ScreenBase)val3).screenType); modelHandler.Add(characterModel); return modelHandler; } ScreenGameHud val4 = (ScreenGameHud)(object)((val is ScreenGameHud) ? val : null); if (val4 != null) { Player player = Player.GetPlayer(playerNr); GameHudPlayerInfo playerInfo = val4.playerInfos[player.nr]; ModelHandler modelHandler2 = new ModelHandler(player.Character, player.CharacterVariant, ((ScreenBase)val4).screenType); modelHandler2.Add((Func>)(() => ((Component)((Component)playerInfo).gameObject.transform).GetComponentsInChildren())); modelHandler2.Add((Func>)(() => ((VisualEntity)player.playerEntity).skinRenderers)); return modelHandler2; } PostScreen val5 = (PostScreen)(object)((val is PostScreen) ? val : null); if (val5 != null) { Player player2 = Player.GetPlayer(playerNr); PostSceenPlayerBar playerBar = val5.playerBarsByPlayer[player2.nr]; ModelHandler modelHandler3 = new ModelHandler(player2.Character, player2.CharacterVariant, ((ScreenBase)val5).screenType); if (val5.winner.CJFLMDNNMIE == player2.nr) { modelHandler3.Add(val5.winnerModel); } modelHandler3.Add((Func>)(() => ((Component)((Component)playerBar).gameObject.transform).GetComponentsInChildren())); return modelHandler3; } } else if (playerNr < 0) { ScreenUnlocksSkins val6 = (ScreenUnlocksSkins)(object)((val2 is ScreenUnlocksSkins) ? val2 : null); if (val6 != null) { ModelHandler modelHandler4 = new ModelHandler(val6.previewModel.character, val6.previewModel.characterVariant, ((ScreenBase)val6).screenType); modelHandler4.Add(val6.previewModel); return modelHandler4; } ScreenUnlocksCharacters val7 = (ScreenUnlocksCharacters)(object)((val2 is ScreenUnlocksCharacters) ? val2 : null); if (val7 != null) { ModelHandler modelHandler5 = new ModelHandler(val7.previewModel.character, val7.previewModel.characterVariant, ((ScreenBase)val7).screenType); modelHandler5.Add(val7.previewModel); return modelHandler5; } } return null; } } public enum ModelHandlerType { None, Lobby, Game, Results, ShowcasePreview, ShowcaseSkins } } namespace TextureMod.Showcase { public class ShowcaseStudio : MonoBehaviour { private ConfigEntry enterShowcaseStudio; private ConfigEntry showcaseStudioHideHud; private ConfigEntry showcaseStudioRotateCharacter; private ConfigEntry showcaseStudioMoveLight; private ConfigEntry showcaseStudioMoveCamera; public bool showUI = true; public int refreshTimer; private bool hideGUI; private bool showControls; private ScreenUnlocksSkins SUS; private List gameObjects = new List(); private GameObject cameraController; private Camera camControllerCam; private Camera lightControllerCam; private GameObject lightController; private CharacterModel characterModel; private CustomSkinHandler skinHandler; private ModelHandler modelHandler; private Shader mainShader = Shader.Find("LethalLeague/GameplayOpaque"); private Vector3 originalCharacterRendPos; private bool enableLight = true; private bool bgColorSelection; private byte bgR = 50; private byte bgG = 50; private byte bgB = 50; private Vector2 animSelectionPos = Vector2.zero; public List animList = new List(); private string currentAnimation = "idle"; private float animationSpeed = 60f; private int selectedGridAnim; private float animationTime; private float animationPos; private bool animate = true; public static ShowcaseStudio Instance { get; private set; } public static ManualLogSource Logger => TextureMod.Log; public string SkinName => CustomSkin?.Name ?? "N/A"; public bool RefreshMode => TextureMod.reloadCustomSkinOnInterval.Value; private CustomSkin CustomSkin => skinHandler?.CustomSkin; private void Awake() { Instance = this; } private void Start() { ConfigFile config = ((BaseUnityPlugin)TextureMod.Instance).Config; enterShowcaseStudio = config.Bind("ShowcaseStudio", "enterShowcaseStudio", (KeyCode)9, (ConfigDescription)null); showcaseStudioHideHud = config.Bind("ShowcaseStudio", "showcaseStudioHideHud", (KeyCode)284, (ConfigDescription)null); showcaseStudioRotateCharacter = config.Bind("ShowcaseStudio", "showcaseStudioRotateCharacter", (KeyCode)323, (ConfigDescription)null); showcaseStudioMoveLight = config.Bind("ShowcaseStudio", "showcaseStudioMoveLight", (KeyCode)326, (ConfigDescription)null); showcaseStudioMoveCamera = config.Bind("ShowcaseStudio", "showcaseStudioMoveCamera", (KeyCode)325, (ConfigDescription)null); CustomStyle.InitStyle(); } private void OnGUI() { //IL_0057: 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_0077: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) GUI.skin.box.alignment = (TextAnchor)4; if (!showUI && !hideGUI) { GUI.skin.box.fontSize = 18; GUI.Window(777, new Rect(10f, 10f, (float)(Screen.width / 7), (float)(Screen.height - 20)), new WindowFunction(AnimationSelectionWindow), "Showcase Studio", CustomStyle.windStyle); if (showControls) { GUI.Window(778, new Rect((float)(20 + Screen.width / 7), 10f, (float)(10 + Screen.width / 7 * 2), (float)(Screen.height / 3)), new WindowFunction(ControlsWindow), "Controls", CustomStyle.windStyle); } } else if ((Object)(object)SUS != (Object)null && !hideGUI) { GUI.skin.box.fontSize = 22; GUI.Box(new Rect(10f, 10f, 600f, 35f), "Press [" + ((object)enterShowcaseStudio.Value/*cast due to .constrained prefix*/).ToString() + "] to enter Showcase Studio"); } } private void ShowStudio() { //IL_0351: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Expected O, but got Unknown //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) showUI = !showUI; GameObject[] array = Object.FindObjectsOfType(); GameObject[] array2; if (!showUI) { originalCharacterRendPos = ((Component)SUS.characterRenderer).transform.position; ((Component)SUS.characterRenderer).transform.position = new Vector3(0f, 0f, 0f); array2 = array; foreach (GameObject val in array2) { if (((Object)val).name.Contains("btFirst")) { gameObjects.Add(val); } if (((Object)val).name.Contains("btQuit")) { gameObjects.Add(val); } if (((Object)val).name.Contains("btPose")) { gameObjects.Add(val); } if (((Object)val).name.Contains("characterCamera")) { ((Behaviour)val.GetComponent()).enabled = false; } if (((Object)val).name.Contains("cameraController")) { cameraController = new GameObject("cameraControllerGentle"); cameraController.transform.position = new Vector3(-2.5f, -302f, -4.4f); cameraController.transform.eulerAngles = new Vector3(3f, 132f, 0f); camControllerCam = cameraController.AddComponent(); ((Behaviour)cameraController.GetComponent()).enabled = true; cameraController.AddComponent(); } if (!((Object)val).name.Contains("characterLight")) { continue; } lightController = new GameObject("lightControllerGentle"); GameObject[] array3 = array; foreach (GameObject val2 in array3) { if (((Object)val2).name.Contains("characterCamera")) { lightController.transform.position = val2.transform.position; lightController.transform.rotation = val2.transform.rotation; } } Light obj = lightController.AddComponent(); Light component = val.GetComponent(); obj.type = component.type; obj.color = component.color; lightControllerCam = lightController.AddComponent(); lightController.AddComponent(); ((Behaviour)val.GetComponent()).enabled = false; } for (int k = 0; k < gameObjects.Count; k++) { gameObjects[k].SetActive(false); } if ((Object)(object)characterModel == (Object)null) { characterModel = SUS.previewModel; return; } Animation componentInChildren = ((Component)characterModel).gameObject.GetComponentInChildren(); int num = 0; { foreach (AnimationState item in componentInChildren) { AnimationState val3 = item; animList.Add(val3.name); if (val3.name == "idle") { selectedGridAnim = num; } num++; } return; } } ((Component)SUS.characterRenderer).transform.position = originalCharacterRendPos; for (int l = 0; l < gameObjects.Count; l++) { gameObjects[l].SetActive(true); } gameObjects.Clear(); animList.Clear(); if ((Object)(object)lightController != (Object)null) { Object.Destroy((Object)(object)lightController); } if ((Object)(object)cameraController != (Object)null) { Object.Destroy((Object)(object)cameraController); } array2 = array; foreach (GameObject val4 in array2) { if (((Object)val4).name.Contains("characterCamera")) { ((Behaviour)val4.GetComponent()).enabled = true; } if (((Object)val4).name.Contains("characterLight")) { ((Behaviour)val4.GetComponent()).enabled = true; } } } private void Update() { //IL_006d: 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_0038: Invalid comparison between Unknown and I4 //IL_00b4: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_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_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)SUS == (Object)null) { modelHandler = null; characterModel = null; skinHandler = null; ScreenBase obj = ScreenApi.CurrentScreens[1]; if (obj != null && (int)obj.screenType == 11) { ref ScreenUnlocksSkins sUS = ref SUS; ScreenBase obj2 = ScreenApi.CurrentScreens[1]; sUS = (ScreenUnlocksSkins)(object)((obj2 is ScreenUnlocksSkins) ? obj2 : null); } return; } ShowcaseSkinSelection.Update(); if ((RefreshMode && refreshTimer <= 0) || Input.GetKeyDown(TextureMod.reloadCustomSkin.Value)) { skinHandler?.ReloadSkin(); refreshTimer = TextureMod.skinReloadIntervalInFrames.Value; } refreshTimer--; UpdateModel(); if (Input.GetKeyDown(showcaseStudioHideHud.Value)) { hideGUI = !hideGUI; } Renderer[] array = Object.FindObjectsOfType(); foreach (Renderer val in array) { if ((Object)(object)val.material.shader != (Object)(object)mainShader && ((Object)val).name.Contains("Effect")) { val.material.shader = mainShader; } } if (!Input.GetKeyDown(enterShowcaseStudio.Value)) { if (showUI) { goto IL_018a; } Controller all = Controller.all; if (!((Controller)(ref all)).GetButtonDown(InputAction.ESC)) { all = Controller.all; if (!((Controller)(ref all)).GetButtonDown(InputAction.BACK)) { all = Controller.all; if (!((Controller)(ref all)).GetButtonDown(InputAction.OK) && !Input.GetKeyDown((KeyCode)324)) { goto IL_018a; } } } } ShowStudio(); goto IL_018a; IL_018a: if ((Object)(object)characterModel == (Object)null) { characterModel = SUS.previewModel; } else { Animation componentInChildren = ((Component)characterModel).gameObject.GetComponentInChildren(); if ((Object)(object)componentInChildren == (Object)null) { Logger.LogError((object)$"characterModel {characterModel} has no Animation components"); } else { if (((Object)componentInChildren.clip).name != currentAnimation && !showUI) { componentInChildren.clip = componentInChildren[currentAnimation].clip; } if (animate) { if (animationTime >= componentInChildren[currentAnimation].length) { animationTime = 0f; } animationTime += animationSpeed / 60f * Time.deltaTime; componentInChildren[currentAnimation].normalizedTime = animationTime / componentInChildren[currentAnimation].length; } else { componentInChildren[currentAnimation].normalizedTime = animationPos; } } } if ((Object)(object)lightController != (Object)null) { ((Behaviour)lightController.GetComponent()).enabled = enableLight; } if ((Object)(object)camControllerCam != (Object)null) { camControllerCam.backgroundColor = Color32.op_Implicit(new Color32(bgR, bgG, bgB, byte.MaxValue)); } if ((Object)(object)lightControllerCam != (Object)null) { lightControllerCam.backgroundColor = new Color(0.5f, 0.5f, 0.5f); } } public void UpdateModel() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (modelHandler == null || modelHandler.IsObsolete() || !modelHandler.ValidCharacter(SUS.previewModel.character, SUS.previewModel.characterVariant)) { modelHandler = ModelHandler.GetCurrentModelHandler(); } if (modelHandler != null) { modelHandler.Update(); modelHandler.texture = CustomSkin?.Texture; } } public void SetCustomSkin(CustomSkinHandler skinHandler) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected I4, but got Unknown this.skinHandler = skinHandler; if (CustomSkin != null) { GameStates.DirectProcess((Msg)55, -1, (int)VariantHelper.GetDefaultVariantForModel(CustomSkin.ModelVariant)); } } private void FixedUpdate() { //IL_0014: 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_00cf: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: 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_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)cameraController != (Object)null) { if (Input.GetKey(showcaseStudioMoveCamera.Value)) { cameraController.GetComponent().isActive = true; } else { cameraController.GetComponent().isActive = false; } } if ((Object)(object)lightController != (Object)null) { if (Input.GetKey(showcaseStudioMoveLight.Value)) { ((Behaviour)lightControllerCam).enabled = true; ((Behaviour)camControllerCam).enabled = false; lightController.GetComponent().isActive = true; } else { ((Behaviour)lightControllerCam).enabled = false; ((Behaviour)camControllerCam).enabled = true; lightController.GetComponent().isActive = false; } } if ((Object)(object)characterModel != (Object)null && Input.GetKey(showcaseStudioRotateCharacter.Value)) { int num = 3; if (Input.GetKey((KeyCode)97)) { ((Component)characterModel).transform.Rotate(Vector3.up * (float)num); } if (Input.GetKey((KeyCode)115)) { ((Component)characterModel).transform.Rotate(Vector3.right * (float)num); ((Component)characterModel).transform.Rotate(Vector3.forward * (float)num); } if (Input.GetKey((KeyCode)119)) { ((Component)characterModel).transform.Rotate(-Vector3.right * (float)num); ((Component)characterModel).transform.Rotate(-Vector3.forward * (float)num); } if (Input.GetKey((KeyCode)100)) { ((Component)characterModel).transform.Rotate(-Vector3.up * (float)num); } if (Input.GetKey((KeyCode)113)) { ((Component)characterModel).transform.Rotate(Vector3.right * (float)num); ((Component)characterModel).transform.Rotate(-Vector3.forward * (float)num); } if (Input.GetKey((KeyCode)101)) { ((Component)characterModel).transform.Rotate(-Vector3.right * (float)num); ((Component)characterModel).transform.Rotate(Vector3.forward * (float)num); } } } private void AnimationSelectionWindow(int winID) { //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_046a: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(30f); GUILayout.Box("General Options", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Show controls: ", (GUILayoutOption[])(object)new GUILayoutOption[0]); if (GUILayout.Button(showControls.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[0])) { showControls = !showControls; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Skin Name: ", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(SkinName, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Skin Refresh: ", (GUILayoutOption[])(object)new GUILayoutOption[0]); if (!RefreshMode) { GUILayout.Label("Off", (GUILayoutOption[])(object)new GUILayoutOption[0]); } else { GUILayout.Label("On [" + refreshTimer + "]", (GUILayoutOption[])(object)new GUILayoutOption[0]); } GUILayout.EndHorizontal(); GUILayout.Space(20f); GUILayout.Box("BG and Lighting Options", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Enable Lighting: ", (GUILayoutOption[])(object)new GUILayoutOption[0]); if (GUILayout.Button(enableLight.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[0])) { enableLight = !enableLight; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Show BG Color select: ", (GUILayoutOption[])(object)new GUILayoutOption[0]); if (GUILayout.Button(bgColorSelection.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[0])) { bgColorSelection = !bgColorSelection; } GUILayout.EndHorizontal(); if (bgColorSelection) { GUILayout.Label("RGB: [" + bgR + ", " + bgG + ", " + bgB + "]", (GUILayoutOption[])(object)new GUILayoutOption[0]); bgR = (byte)GUILayout.HorizontalSlider((float)(int)bgR, 0f, 255f, (GUILayoutOption[])(object)new GUILayoutOption[0]); bgG = (byte)GUILayout.HorizontalSlider((float)(int)bgG, 0f, 255f, (GUILayoutOption[])(object)new GUILayoutOption[0]); bgB = (byte)GUILayout.HorizontalSlider((float)(int)bgB, 0f, 255f, (GUILayoutOption[])(object)new GUILayoutOption[0]); } GUILayout.Space(20f); GUILayout.Box("Animation Options", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Current Animation:", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(currentAnimation, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if ((Object)(object)characterModel != (Object)null) { Animation componentInChildren = ((Component)characterModel).gameObject.GetComponentInChildren(); GUILayout.Label("Animation time:", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(decimal.Round((decimal)animationTime, 2) + "s / " + decimal.Round((decimal)componentInChildren[currentAnimation].length, 2) + "s", (GUILayoutOption[])(object)new GUILayoutOption[0]); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Play Animation", (GUILayoutOption[])(object)new GUILayoutOption[0]); if (GUILayout.Button(animate.ToString(), (GUILayoutOption[])(object)new GUILayoutOption[0])) { animate = !animate; } GUILayout.EndHorizontal(); if (animate) { GUILayout.Space(5f); GUILayout.Label("Animation speed: " + decimal.Round((decimal)animationSpeed) + " FPS", (GUILayoutOption[])(object)new GUILayoutOption[0]); animationSpeed = GUILayout.HorizontalSlider(animationSpeed, 0f, 60f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(5f); } else { GUILayout.Space(5f); GUILayout.Label("Animation step:", (GUILayoutOption[])(object)new GUILayoutOption[0]); animationPos = GUILayout.HorizontalSlider(animationPos, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(5f); } animSelectionPos = GUILayout.BeginScrollView(animSelectionPos, false, true, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (animList.Count > 0) { selectedGridAnim = GUILayout.SelectionGrid(selectedGridAnim, animList.ToArray(), 1, (GUILayoutOption[])(object)new GUILayoutOption[0]); } currentAnimation = animList[selectedGridAnim]; GUILayout.EndScrollView(); GUILayout.EndVertical(); } private void ControlsWindow(int wid) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(30f); GUILayout.Box("General", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Hide GUI: [" + ((object)showcaseStudioHideHud.Value/*cast due to .constrained prefix*/).ToString() + "]", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Exit ShowcaseStudio: [" + ((object)enterShowcaseStudio.Value/*cast due to .constrained prefix*/).ToString() + ", ESC or Right Click]", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Reload current skin [" + ((object)TextureMod.reloadCustomSkin.Value/*cast due to .constrained prefix*/).ToString() + "]", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Reimport skin library [" + ((object)TextureMod.reloadEntireSkinLibrary.Value/*cast due to .constrained prefix*/).ToString() + "]", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(20f); GUILayout.Box("Camera Movement", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Hold [" + ((object)showcaseStudioMoveCamera.Value/*cast due to .constrained prefix*/).ToString() + "] and move the mouse to tilt the camera (Bindable in mod settings)", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("While holding [" + ((object)showcaseStudioMoveCamera.Value/*cast due to .constrained prefix*/).ToString() + "] you can press WASD, left shift and space to move the camera around", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(20f); GUILayout.Box("Light Movement", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Hold [" + ((object)showcaseStudioMoveLight.Value/*cast due to .constrained prefix*/).ToString() + "] and move the mouse to tilt the light (Bindable in mod settings)", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("While holding [" + ((object)showcaseStudioMoveLight.Value/*cast due to .constrained prefix*/).ToString() + "] you can press WASD, left shift and space to move the light around", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(20f); GUILayout.Box("Character Rotation", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Hold [" + ((object)showcaseStudioRotateCharacter.Value/*cast due to .constrained prefix*/).ToString() + "] (Bindable in mod settings) and press WASD, left shift and space to rotate the model", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndVertical(); } } public static class ShowcaseSkinSelection { private static int skinCounter; private static ManualLogSource Logger => TextureMod.Log; public static ScreenUnlocksSkins SUS { get { ScreenBase screen = UIScreen.GetScreen(1); ScreenUnlocksSkins val = (ScreenUnlocksSkins)(object)((screen is ScreenUnlocksSkins) ? screen : null); if (val == null) { return null; } return val; } } public static void Update() { //IL_002b: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)SUS == (Object)null) { skinCounter = 0; } else { if (!TextureMod.IsSkinKeyDown()) { return; } if (!InputHandler.MouseOrTouchDown() && !Input.GetKeyDown((KeyCode)116)) { Controller all = Controller.all; if (!((Controller)(ref all)).GetButtonDown(InputAction.SHRIGHT)) { if (!Input.GetKeyDown((KeyCode)116)) { all = Controller.all; if (!((Controller)(ref all)).GetButtonDown(InputAction.SHLEFT)) { return; } } PreviousSkin(); return; } } NextSkin(); } } public static void NextSkin() { skinCounter++; ChangeSkin(skinCounter); } public static void PreviousSkin() { skinCounter--; ChangeSkin(skinCounter); } public static void ChangeSkin(int index) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) List usableHandlers = SkinsManager.skinCache.GetUsableHandlers(SUS.previewModel.character); if (usableHandlers != null) { Logger.LogDebug((object)$"Counter: {skinCounter}, skin length: {usableHandlers.Count}"); if (usableHandlers.Count > 0) { ShowcaseStudio.Instance.SetCustomSkin(usableHandlers?[mod(index, usableHandlers.Count)]); } } } private static int mod(int x, int m) { int num = x % m; if (num >= 0) { return num; } return num + m; } private static void GetSkinForUnlocksModel(ScreenUnlocksCharacters screen, sbyte next = 0) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) Character character = screen.previewModel.character; _ = screen.previewModel.characterVariant; if (((GenericCache)SkinsManager.skinCache)[character].Count == 0) { Logger.LogInfo((object)$"No skins for {character}"); } } private static void SetSkinForUnlocksModel(ScreenUnlocksSkins screenUnlocksSkins, sbyte next = 0) { //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_000c: 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) Character character = screenUnlocksSkins.character; if (((GenericCache)SkinsManager.skinCache)[character].Count == 0) { Logger.LogInfo((object)$"No skins for {character}"); } } } } namespace TextureMod.CustomSkins { public class CustomSkin { private static ManualLogSource Logger => TextureMod.Log; public SkinHash SkinHash { get; private set; } public Character Character { get; private set; } public ModelVariant ModelVariant { get; private set; } public Texture2D Texture { get; private set; } public string Author { get; private set; } public string Name { get; private set; } public CustomSkin(Character _character, ModelVariant _variant, string _name, string _author, Texture2D texture) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Character = _character; ModelVariant = _variant; Author = _author; Texture = texture; Name = (((Object)Texture).name = _name); RegenerateSkinHash(); } public bool IsForVariant(CharacterVariant characterVariant) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return VariantHelper.VariantMatch(characterVariant, ModelVariant); } public string GetSkinLabel() { StringBuilder stringBuilder = new StringBuilder(Name); if (Author != null) { stringBuilder.Append(" by " + Author); } return stringBuilder.ToString(); } public byte[] ToBytes() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) using MemoryStream memoryStream = new MemoryStream(); using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream)) { binaryWriter.Write((byte)Character); binaryWriter.Write((byte)ModelVariant); binaryWriter.Write(Author ?? "Unknown"); binaryWriter.Write(Name ?? "Unknown"); byte[] array = ImageConversion.EncodeToPNG(Texture); binaryWriter.Write(array.Length); binaryWriter.Write(array); } return memoryStream.ToArray(); } public static CustomSkin FromBytes(byte[] bytes) { CustomSkin customSkin = null; using MemoryStream input = new MemoryStream(bytes); using BinaryReader binaryReader = new BinaryReader(input); byte num = binaryReader.ReadByte(); ModelVariant variant = (ModelVariant)binaryReader.ReadByte(); string author = binaryReader.ReadString(); string name = binaryReader.ReadString(); int count = binaryReader.ReadInt32(); byte[] array = binaryReader.ReadBytes(count); Texture2D val = TextureUtils.DefaultTexture(512, 512, (TextureFormat)4); ((Object)val).name = name; ImageConversion.LoadImage(val, array); return new CustomSkin((Character)num, variant, name, author, val); } public void SetTexture(Texture2D texture) { Texture = texture; RegenerateSkinHash(); } public void RegenerateSkinHash() { SkinHash = new SkinHash(this); } public override string ToString() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) return $""; } } public class CustomSkinCache : GenericCache { public static readonly Regex altRegex = new Regex("((_ALT\\d?$)|(^\\d+#))"); protected static ManualLogSource Logger => TextureMod.Log; public void LoadSkins(DirectoryInfo texLibPath) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_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) Resources.UnloadUnusedAssets(); foreach (Character playableCharacter in CharacterApi.GetPlayableCharacters()) { DirectoryInfo characterDirPath = texLibPath.CreateSubdirectory(StringUtils.GetCharacterSafeName(playableCharacter).ToUpper()); LoadSkins(playableCharacter, characterDirPath); } } public void LoadSkins(Character character, DirectoryInfo characterDirPath) { //IL_0016: 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) FileInfo[] files = characterDirPath.GetFiles("*.png", SearchOption.TopDirectoryOnly); foreach (FileInfo skinFile in files) { LoadSkin(character, skinFile); } DirectoryInfo[] directories = characterDirPath.GetDirectories(); foreach (DirectoryInfo obj in directories) { string name = obj.Name; name = altRegex.Replace(name, (Match m) => ""); files = obj.GetFiles("*.png", SearchOption.TopDirectoryOnly); foreach (FileInfo skinFile2 in files) { LoadSkin(character, skinFile2, name); } } } public void LoadSkin(Character character, FileInfo skinFile, string authorName = null) { //IL_0043: 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) ModelVariant modelVariantFromFilePath = VariantHelper.GetModelVariantFromFilePath(skinFile.Name); string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(skinFile.Name); fileNameWithoutExtension = altRegex.Replace(fileNameWithoutExtension, (Match m) => ""); CustomSkinHandler customSkinHandler = new CustomSkinHandler(character, modelVariantFromFilePath, fileNameWithoutExtension, authorName, skinFile.FullName); ((GenericCache)this).Add(character, customSkinHandler); } public void ReloadSkins(Character character = (Character)12) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0035: 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) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if ((int)character == 12) { foreach (Character playableCharacter in CharacterApi.GetPlayableCharacters()) { ReloadSkins(playableCharacter); } return; } foreach (CustomSkinHandler handler in GetHandlers(character)) { handler.ReloadSkin(); } } public override void Add(Character key, CustomSkinHandler newSkin) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (GetHandlerFromHash(newSkin.CustomSkin.SkinHash) != null) { Logger.LogWarning((object)$"There's already a skin with the following hash in cache: {newSkin.CustomSkin.SkinHash}. Couldn't add {newSkin.CustomSkin.Name} to the cache"); } else { base.Add(key, newSkin); } } public unsafe List GetHandlers(Character key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (((GenericCache)this).ContainsKey(key)) { return ((GenericCache)this)[key]; } Logger.LogWarning((object)("No skins for " + ((object)(*(Character*)(&key))/*cast due to .constrained prefix*/).ToString() + ".")); return null; } public CustomSkinHandler GetHandler(Character key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return GetHandlers(key)?[0]; } public List GetSkins(Character key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return GetHandlers(key)?.Select((CustomSkinHandler csh) => csh.CustomSkin).ToList(); } public CustomSkin GetSkin(Character key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return GetHandler(key)?.CustomSkin; } public List GetUsableHandlers(Character key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return GetHandlers(key)?.Where((CustomSkinHandler csh) => csh.CanBeUsed()).ToList(); } public List GetUsableSkins(Character key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return (from csh in GetHandlers(key)?.Where((CustomSkinHandler csh) => csh.CanBeUsed()) select csh.CustomSkin).ToList(); } public CustomSkin GetUsableSkin(Character key) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return GetUsableSkins(key)?[0]; } public CustomSkinHandler GetHandlerFromHash(SkinHash hash) { foreach (List value in base.cache.Values) { foreach (CustomSkinHandler item in value) { if ((Hash)item.CustomSkin.SkinHash == (Hash)hash) { return item; } } } return null; } public CustomSkin GetSkinFromHash(SkinHash hash) { return GetHandlerFromHash(hash)?.CustomSkin; } } public class CustomSkinHandler { private static ManualLogSource Logger => TextureMod.Log; public CustomSkin CustomSkin { get; private set; } public bool InUse { get; private set; } public bool Enabled { get; private set; } = true; public bool InMemory { get; private set; } public bool IsRemote { get; set; } public FileInfo FileLocation { get; private set; } public CustomSkinHandler(CustomSkin skin) { InMemory = true; FileLocation = null; CustomSkin = skin; } public CustomSkinHandler(Character character, ModelVariant modelVariant, string skinName, string author, Texture2D texture) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) Logger.LogDebug((object)$"Creating skin: {character} | {modelVariant} | {skinName} | {author} | InMemory"); InMemory = true; FileLocation = null; CustomSkin = new CustomSkin(character, modelVariant, skinName, author, texture); } public CustomSkinHandler(Character character, ModelVariant modelVariant, string skinName, string author, string filePath) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) Logger.LogDebug((object)$"Creating skin: {character} | {modelVariant} | {skinName} | {author} | {filePath}"); FileLocation = new FileInfo(filePath); CustomSkin = new CustomSkin(character, modelVariant, skinName, author, TextureUtils.LoadPNG(FileLocation)); } public CustomSkinHandler(Character character, ModelVariant modelVariant, string skinName, string author, FileInfo file) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) Logger.LogDebug((object)$"Creating skin: {character} | {modelVariant} | {skinName} | {author} | {file.FullName}"); FileLocation = file; CustomSkin = new CustomSkin(character, modelVariant, skinName, author, TextureUtils.LoadPNG(FileLocation)); } public void ReloadSkin() { if (!InMemory) { Logger.LogInfo((object)$"Loading Texture at: {FileLocation}"); CustomSkin.SetTexture(TextureUtils.LoadPNG(FileLocation)); } } public void SaveToDisk(string newFilePath = null) { if (newFilePath != null) { if (FileLocation != null) { Logger.LogWarning((object)("Overriting existing path for texture " + CustomSkin.Name + ": \n" + $"\t - Old one: {FileLocation}\n" + "\t - New one: " + newFilePath)); } FileLocation = new FileInfo(newFilePath); } else if (FileLocation == null) { throw new FileNotFoundException("Skin '" + CustomSkin.Name + "' doesn't have a file registered and none was given"); } File.WriteAllBytes(FileLocation.FullName, ImageConversion.EncodeToPNG(CustomSkin.Texture)); } public bool CanBeUsed() { //IL_001e: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (IsRemote) { return false; } if (CustomSkin.ModelVariant == ModelVariant.DLC) { DLC val = EPCDKLCABNC.LEMKFOAAMKA(CustomSkin.Character, (CharacterVariant)11); if ((int)val != 0 && !CGLLJHHAJAK.GIGAKBJGFDI.EMPDGJDAGKO(val)) { Logger.LogWarning((object)("You tried to use a skin for which you do not have the DLC: " + ((object)CustomSkin.Character/*cast due to .constrained prefix*/).ToString() + ". Couldn't add " + CustomSkin.Name + " to the cache")); return false; } } return true; } } public class SkinHash : Hash { static SkinHash() { Hash.HashLength = 16; } public SkinHash(byte[] data) : base(data) { } public SkinHash(Texture2D tex, Character character, ModelVariant variant) : base(Compute(tex, character, variant)) { }//IL_0002: Unknown result type (might be due to invalid IL or missing references) public SkinHash(CustomSkin skin) : base(Compute(skin.Texture, skin.Character, skin.ModelVariant)) { }//IL_0008: Unknown result type (might be due to invalid IL or missing references) private static byte[] Compute(Texture2D tex, Character character, ModelVariant variant) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) MD5 mD = MD5.Create(); byte[] buffer = ArrayExtension.Add(tex.GetRawTextureData(), new byte[2] { (byte)character, (byte)variant }); mD.ComputeHash(buffer); byte[] hash = mD.Hash; if (hash.Length != Hash.HashLength) { throw new NotSupportedException($"Computed hash length is {hash.Length} but supported hash length is {Hash.HashLength}"); } return hash; } public static explicit operator SkinHash(byte[] a) { return new SkinHash(a); } public override bool Equals(CustomSkin other) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return BinaryUtils.ByteArraysEqual(base.Bytes, Compute(other.Texture, other.Character, other.ModelVariant)); } } public class SkinsManager : MonoBehaviour { public static CustomSkinCache skinCache = new CustomSkinCache(); private static ManualLogSource Logger => TextureMod.Log; public static void LoadLibrary() { try { ((GenericCache)skinCache).Clear(); Resources.UnloadUnusedAssets(); DirectoryInfo directoryInfo = TextureMod.ModdingFolder.CreateSubdirectory("Characters"); Logger.LogInfo((object)$"Loading Modding folder at: {directoryInfo}"); skinCache.LoadSkins(directoryInfo); } catch (Exception ex) { TextureMod.loadingText = "TextureMod failed to load textures."; Logger.LogError((object)$"TextureMod failed to load textures: {ex}"); throw ex; } } private void LateUpdate() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(TextureMod.reloadEntireSkinLibrary.Value)) { LoadLibrary(); } } } } namespace TextureMod.Effects { public static class EffectsHandler { public static readonly List validMainTexNames = new List { "_MainTex", "_MainTexture" }; private static Texture2D candySplashWhite; private static Texture2D gridStartBG; private static Texture2D gridStartFG; private static Texture2D gridTrail; private static Texture2D gridArrive; private static Texture2D bubbleBG; private static Texture2D bubbleFG; private static Texture2D bubblePopBG; private static Texture2D bubblePopFG; private static int lastCandyBallPlayerIndex = -1; public static string EffectsFolder => TextureMod.EffectFolder; public static void Init() { LoadEffects(); } private static void LoadEffects() { candySplashWhite = TextureUtils.LoadPNG(Path.Combine(EffectsFolder, "candySplashWhite.png")); gridStartBG = TextureUtils.LoadPNG(Utility.CombinePaths(new string[3] { EffectsFolder, "GridSpecial", "gridStartBG.png" })); gridStartFG = TextureUtils.LoadPNG(Utility.CombinePaths(new string[3] { EffectsFolder, "GridSpecial", "gridStartFG.png" })); gridTrail = TextureUtils.LoadPNG(Utility.CombinePaths(new string[3] { EffectsFolder, "GridSpecial", "gridTrail.png" })); gridArrive = TextureUtils.LoadPNG(Utility.CombinePaths(new string[3] { EffectsFolder, "GridSpecial", "gridArrive.png" })); bubbleBG = TextureUtils.LoadPNG(Utility.CombinePaths(new string[3] { EffectsFolder, "JetSpecial", "bubbleBG.png" })); bubbleFG = TextureUtils.LoadPNG(Utility.CombinePaths(new string[3] { EffectsFolder, "JetSpecial", "bubbleFG.png" })); bubblePopBG = TextureUtils.LoadPNG(Utility.CombinePaths(new string[3] { EffectsFolder, "JetSpecial", "bubblePopBG.png" })); bubblePopFG = TextureUtils.LoadPNG(Utility.CombinePaths(new string[3] { EffectsFolder, "JetSpecial", "bubblePopFG.png" })); } public static Texture2D GetGrayscaledCopy(Texture2D texture) { //IL_003c: 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) Texture2D val = TextureUtils.DefaultTexture(((Texture)texture).width, ((Texture)texture).height, (TextureFormat)4); Color[] pixels = val.GetPixels(); for (int i = 0; i < pixels.Length; i++) { float grayscale = ((Color)(ref pixels[i])).grayscale; pixels[i] = new Color(grayscale, grayscale, grayscale, pixels[i].a); } val.SetPixels(pixels); val.Apply(); return val; } public static Texture2D GetColoredCopy(Texture2D texture, Color color) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) Texture2D val = TextureUtils.DefaultTexture(((Texture)texture).width, ((Texture)texture).height, (TextureFormat)4); Color[] pixels = val.GetPixels(); for (int i = 0; i < pixels.Length; i++) { ref Color reference = ref pixels[i]; reference *= color; } val.SetPixels(pixels); val.Apply(); return val; } public static void SetBallColors() { if (GameStates.IsInMatch()) { SetBallColors(BallHandler.instance.GetBall(0)); } } public static void SetBallColors(BallEntity ballEntity) { //IL_0000: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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) Color grey = Color.grey; ((VisualEntity)ballEntity).GetVisual("main").renderers[2].materials[0].color = grey; ((VisualEntity)ballEntity).SetColorOutlinesColor(grey); for (int i = 0; i < ((VisualEntity)ballEntity).GetVisual("main2D").meshRendererTrail.Length; i++) { grey.a = ((Renderer)((VisualEntity)ballEntity).GetVisual("main2D").meshRendererTrail[i]).material.color.a; ((Renderer)((VisualEntity)ballEntity).GetVisual("main2D").meshRendererTrail[i]).material.color = grey; } } public static void AshesIngameEffects(TexModPlayer tmPlayer) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 if ((Object)(object)tmPlayer.PlayerEntity != (Object)null && (Object)(object)tmPlayer.CustomSkin?.Texture != (Object)null && (int)((MovableEntity)tmPlayer.PlayerEntity).character == 11) { AssignAshesOutlineColor(tmPlayer.PlayerEntity, tmPlayer.Texture); } } public static void AssignAshesOutlineColor(PlayerEntity pe, Texture2D tex) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) foreach (Renderer skinRenderer in ((VisualEntity)pe).skinRenderers) { AssignAshesOutlineColor(skinRenderer, ((MovableEntity)pe).variant, tex); } } public static void AssignAshesOutlineColor(Renderer r, CharacterVariant variant, Texture2D tex) { //IL_001b: 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_0057: 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_0020: Invalid comparison between Unknown and I4 //IL_006f: 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_0022: 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_003b: Expected I4, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) Color relativePixel = default(Color); ((Color)(ref relativePixel))..ctor(1f, 1f, 1f, 1f); if ((int)variant != 0) { if ((int)variant != 1) { switch (variant - 9) { case 0: relativePixel = Texture2DExtension.GetRelativePixel(tex, 69, 298, 512, 512); break; case 1: relativePixel = Texture2DExtension.GetRelativePixel(tex, 69, 298, 512, 512); break; case 2: relativePixel = Texture2DExtension.GetRelativePixel(tex, 113, 334, 512, 512); break; case 3: relativePixel = Texture2DExtension.GetRelativePixel(tex, 113, 334, 512, 512); break; } } else { relativePixel = Texture2DExtension.GetRelativePixel(tex, 58, 438, 512, 512); } } else { relativePixel = Texture2DExtension.GetRelativePixel(tex, 58, 438, 512, 512); } if (((Object)r).name != "mesh1Outline" && ((Object)r).name != "mesh1MetalOutline" && ((Object)r).name != "mesh1TenguOutline" && ((Object)r).name.Contains("Outline")) { r.material.color = relativePixel; } } public static void CandymanIngameEffects(TexModPlayer tmPlayer) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 BallEntity ball = BallApi.GetBall(0); if (((int)((HitableData)((GetHitBallEntity)ball).ballData).hitstunState == 4 || (int)((BouncingData)((GetHitBallEntity)ball).ballData).ballState == 7) && (int)((MovableEntity)((HitableEntity)ball).GetLastPlayerHitter()).character == 2) { if ((Object)(object)((HitableEntity)ball).GetLastPlayerHitter() == (Object)(object)tmPlayer.PlayerEntity && tmPlayer.CustomSkin != null) { AssignSkinToCandyball(ball, tmPlayer.PlayerEntity, tmPlayer.Texture); } else { AssignSkinToCandyball(ball, ((HitableEntity)ball).GetLastPlayerHitter(), null); } } AssignSkinColorToCandySplash(tmPlayer); } public static void AssignSkinToCandyball(BallEntity ball, PlayerEntity pe, Texture2D tex) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected I4, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if ((Object)(object)tex == (Object)null) { tex = (Texture2D)((VisualEntity)pe).skinRenderers.First().material.mainTexture; } ((VisualEntity)ball).GetVisual($"candyBall{(int)((MovableEntity)pe).variant}Visual").mainRenderer.material.mainTexture = (Texture)(object)tex; } public static void AssignSkinColorToCandySplash(TexModPlayer tmPlayer) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) BallEntity ball = BallApi.GetBall(0); EffectEntity[] array = Object.FindObjectsOfType(); if ((int)((BouncingData)((GetHitBallEntity)ball).ballData).ballState == 7) { lastCandyBallPlayerIndex = ((AbilityEntity)((HitableEntity)ball).GetLastPlayerHitter()).playerIndex; } if (array == null) { return; } for (int i = 0; i < array.Length; i++) { EffectEntity val = array[i]; if (!(((Object)val).name == "candySplash")) { continue; } Texture2D val2 = CheckPlayerOrMainBallSplashEffect(tmPlayer.PlayerEntity, val, tmPlayer.CustomSkin.Texture) ?? null; if (!((Object)(object)val2 != (Object)null)) { continue; } SetCandySplashEffect(((MovableEntity)tmPlayer.PlayerEntity).variant, array[i], val2); for (int j = 0; j < array.Length; j++) { if (array[j].effectData.graphicName == "candySplash" && ((EntityData)array[j].effectData).active) { SetCandySplashEffect(((MovableEntity)tmPlayer.PlayerEntity).variant, array[j], val2); } } } } public static Texture2D CheckPlayerOrMainBallSplashEffect(PlayerEntity playerEntity, EffectEntity effect, Texture2D characterTex) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //IL_0026: 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_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_003e: 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_0058: 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) //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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) if (playerEntity != null && (int)((MovableEntity)playerEntity).character == 2 && (Object)(object)characterTex != (Object)null) { BallEntity ball = BallApi.GetBall(0); Vector2f val = Vector2f.op_Implicit(IBGCBLLKIHA.FCKBPDNEAOG(((Entity)playerEntity).GetPosition(), ((Entity)effect).GetPosition())); bool num = ((Vector2f)(ref val)).magnitude < Floatf.op_Implicit(0.2m); val = Vector2f.op_Implicit(IBGCBLLKIHA.FCKBPDNEAOG(((Entity)ball).GetPosition(), ((Entity)effect).GetPosition())); bool flag = ((Vector2f)(ref val)).magnitude < Floatf.op_Implicit(0.6m); if (num && !((IBGCBLLKIHA)(ref ((EntityData)((MovableEntity)playerEntity).moveableData).velocity)).HCBCKAHGJCA(IBGCBLLKIHA.GCPFGINDGEM()) && ((MovableData)((AbilityEntity)playerEntity).abilityData).abilityState.Contains("CROUCH")) { return characterTex; } if (flag && lastCandyBallPlayerIndex == ((AbilityEntity)playerEntity).playerIndex) { return characterTex; } } return null; } public static void SetCandySplashEffect(CharacterVariant variant, EffectEntity effect, Texture2D tex) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0067: Unknown result type (might be due to invalid IL or missing references) Renderer mainRenderer = ((VisualEntity)effect).GetVisual("main").mainRenderer; mainRenderer.material.mainTexture = (Texture)(object)candySplashWhite; if ((int)variant == 11 || (int)variant == 12) { mainRenderer.material.color = Texture2DExtension.GetRelativePixel(tex, 130, 92, 512, 512); } else { mainRenderer.material.color = Texture2DExtension.GetRelativePixel(tex, 103, 473, 512, 512); } ((Object)effect).name = "candySplashModified"; } public static void GridIngameEffects(TexModPlayer tmPlayer) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 BallEntity ball = BallApi.GetBall(0); if (!((Object)(object)tmPlayer.PlayerEntity != (Object)null) || tmPlayer.CustomSkin == null) { return; } if ((ball != null && (int)((HitableData)((GetHitBallEntity)ball).ballData).hitstunState == 10) || (ball != null && (int)((HitableData)((GetHitBallEntity)ball).ballData).hitstunState == 29)) { if ((Object)(object)((HitableEntity)ball).GetLastPlayerHitter() == (Object)(object)tmPlayer.PlayerEntity) { AssignGridSpecialColor(tmPlayer.PlayerEntity, tmPlayer.Texture); } return; } Ability currentAbility = ((AbilityEntity)tmPlayer.PlayerEntity).GetCurrentAbility(); if (currentAbility != null) { currentAbility.name.Contains("ELECTROCHARGE"); if (true) { AssignGridSpecialColor(tmPlayer.PlayerEntity, tmPlayer.Texture); } } } public static void AssignGridSpecialColor(PlayerEntity pe, Texture2D tex) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0056: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) Color color = default(Color); ((Color)(ref color))..ctor(1f, 1f, 1f, 1f); color = (((int)((MovableEntity)pe).variant <= 10) ? Texture2DExtension.GetRelativePixel(tex, 451, 454, 512, 512) : Texture2DExtension.GetRelativePixel(tex, 442, 484, 512, 512)); VisualEntity[] array = Object.FindObjectsOfType(); foreach (VisualEntity val in array) { if (((Object)val).name == "gridStart1") { Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren(); foreach (Renderer val2 in componentsInChildren) { val2.material.mainTexture = (Texture)(object)gridStartFG; Material material = val2.material; Material val3 = new Material(val2.material.shader); val3.mainTexture = (Texture)(object)gridStartBG; Material[] materials = (Material[])(object)new Material[2] { material, val3 }; val2.materials = materials; val2.materials[0].color = color; } } if (((Object)val).name == "gridArrive") { Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren(); foreach (Renderer obj in componentsInChildren) { obj.material.mainTexture = (Texture)(object)gridArrive; obj.materials[0].color = color; } } if (((Object)val).name == "gridTrail") { Renderer[] componentsInChildren = ((Component)val).GetComponentsInChildren(); foreach (Renderer obj2 in componentsInChildren) { obj2.material.mainTexture = (Texture)(object)gridTrail; obj2.materials[0].color = color; } } } } public static void DBEffects(TexModPlayer tmPlayer) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (tmPlayer.CustomSkin != null && tmPlayer.ModelHandler.Renderers.Count != 0) { switch (tmPlayer.CustomSkin.ModelVariant) { case ModelVariant.Alternative: AssignOmegaDoomboxSmearsAndArms(tmPlayer.ModelHandler.Renderers[0], tmPlayer.Texture); break; case ModelVariant.DLC: AssignVisualizer(tmPlayer.ModelHandler.character, tmPlayer.ModelHandler.Renderers[0], tmPlayer.Texture); break; } } } public static void AssignOmegaDoomboxSmearsAndArms(PlayerEntity pe, Texture2D tex) { AssignOmegaDoomboxSmearsAndArms(((VisualEntity)pe).GetVisual("main").mainRenderer, tex); } public static void AssignOmegaDoomboxSmearsAndArms(Renderer r, Texture2D tex) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: 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_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) Color relativePixel = Texture2DExtension.GetRelativePixel(tex, 28, 336, 512, 512); Color relativePixel2 = Texture2DExtension.GetRelativePixel(tex, 113, 336, 512, 512); Color relativePixel3 = Texture2DExtension.GetRelativePixel(tex, 28, 325, 512, 512); Color relativePixel4 = Texture2DExtension.GetRelativePixel(tex, 113, 325, 512, 512); Color relativePixel5 = Texture2DExtension.GetRelativePixel(tex, 178, 332, 512, 512); Material[] materials = r.materials; foreach (Material val in materials) { if (((Object)val).name.Contains("bossOmegaGlass")) { foreach (string item in from texName in val.GetTexturePropertyNames() where validMainTexNames.Contains(texName) select texName) { val.SetTexture(item, (Texture)(object)tex); } val.SetColor("_LitColor", new Color(relativePixel.r, relativePixel.g, relativePixel.b, relativePixel2.r)); val.SetColor("_ShadowColor", new Color(relativePixel3.r, relativePixel3.g, relativePixel3.b, relativePixel4.r)); val.SetFloat("_Transparency", relativePixel5.r); } else if (((Object)val).name.Contains("bossOmegaEffect") || ((Object)val).name.Contains("bossOmega2Effect")) { val.SetColor("_LitColor", new Color(relativePixel.r, relativePixel.g, relativePixel.b, relativePixel2.r)); val.SetColor("_ShadowColor", new Color(relativePixel3.r, relativePixel3.g, relativePixel3.b, relativePixel4.r)); val.SetFloat("_Transparency", relativePixel5.r); } } } public static void SonataEffects(TexModPlayer tmPlayer) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (tmPlayer.CustomSkin != null && tmPlayer.CustomSkin.ModelVariant == ModelVariant.DLC) { AssignVisualizer(tmPlayer.ModelHandler.character, tmPlayer.ModelHandler.Renderers[0], tmPlayer.Texture); } } public static void AssignVisualizer(PlayerEntity pe, Texture2D tex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) AssignVisualizer(((MovableEntity)pe).character, ((VisualEntity)pe).GetVisual("main").mainRenderer, tex); } public static void AssignVisualizer(Character character, Renderer r, Texture2D tex) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_005b: Invalid comparison between Unknown and I4 //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) FNDGCLEDHAD componentInParent = ((Component)r).gameObject.GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)tex != (Object)null) { Color val = (((int)character == 6) ? Texture2DExtension.GetRelativePixel(tex, 493, 510, 512, 512) : Texture2DExtension.GetRelativePixel(tex, 82, 10, 512, 512)); Color val2 = (((int)character == 6) ? Texture2DExtension.GetRelativePixel(tex, 508, 510, 512, 512) : Texture2DExtension.GetRelativePixel(tex, 96, 10, 512, 512)); Material fHAMOPAJHNJ = componentInParent.FHAMOPAJHNJ; try { fHAMOPAJHNJ.mainTexture = (Texture)(object)tex; fHAMOPAJHNJ.SetColor("_AmpColor0", val); fHAMOPAJHNJ.SetColor("_AmpColor1", val2); } catch { Debug.Log((object)"Visulizer Broke for a moment and I don't know why ``\\_(-.-)_/``"); } } } public static void ToxicIngameEffects(TexModPlayer tmPlayer) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)tmPlayer.PlayerEntity == (Object)null) && tmPlayer.CustomSkin != null) { if ((int)((MovableEntity)tmPlayer.PlayerEntity).variant == 11 || (int)((MovableEntity)tmPlayer.PlayerEntity).variant == 12) { AssignNurseToxicCanisters(tmPlayer.PlayerEntity, tmPlayer.Texture); } AssignToxicEffectColors(tmPlayer.Player.nr, tmPlayer.Texture, tmPlayer.Player.CharacterVariant); } } public static void AssignNurseToxicCanisters(PlayerEntity pe, Texture2D tex) { AssignNurseToxicCanisters(((VisualEntity)pe).GetVisual("main").mainRenderer, tex); } public static void AssignNurseToxicCanisters(Renderer r, Texture2D tex) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0122: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) Color relativePixel = Texture2DExtension.GetRelativePixel(tex, 158, 414, 512, 512); Color relativePixel2 = Texture2DExtension.GetRelativePixel(tex, 158, 406, 512, 512); Color relativePixel3 = Texture2DExtension.GetRelativePixel(tex, 158, 397, 512, 512); Color relativePixel4 = Texture2DExtension.GetRelativePixel(tex, 158, 389, 512, 512); Color relativePixel5 = Texture2DExtension.GetRelativePixel(tex, 158, 380, 512, 512); Material[] materials = r.materials; foreach (Material val in materials) { if (!((Object)val).name.Contains("grafNurseGlass")) { continue; } foreach (string item in from texName in r.material.GetTexturePropertyNames() where validMainTexNames.Contains(texName) select texName) { r.material.SetTexture(item, (Texture)(object)tex); } val.SetColor("_LitColor", new Color(relativePixel.r, relativePixel.g, relativePixel.b, relativePixel3.r)); val.SetColor("_ShadowColor", new Color(relativePixel2.r, relativePixel2.g, relativePixel2.b, relativePixel4.r)); val.SetFloat("_Transparency", relativePixel5.r); } } public static void AssignToxicEffectColors(int playerId, Texture2D tex, CharacterVariant cv) { //IL_0031: 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_005d: 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_006e: 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) //IL_0070: Unknown result type (might be due to invalid IL or missing references) GrafPlayer[] array = Object.FindObjectsOfType(); foreach (GrafPlayer val in array) { if (((AbilityEntity)val).player.CJFLMDNNMIE == playerId) { Color32 val2 = Color32.op_Implicit(Texture2DExtension.GetRelativePixel(tex, 258, 345, 512, 512)); val2.a = byte.MaxValue; ((VisualEntity)val).GetVisual("paintBlobVisual").mainRenderer.material.color = Color32.op_Implicit(val2); val.outfitEffectColors[cv] = val2; } } } public static void JetIngameEffects(TexModPlayer tmPlayer) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Invalid comparison between Unknown and I4 if ((Object)(object)((HitableEntity)BallApi.GetBall(0)).GetLastPlayerHitter() == (Object)(object)tmPlayer.PlayerEntity && tmPlayer.CustomSkin != null) { AssignBubbleVisual(((MovableEntity)tmPlayer.PlayerEntity).variant, tmPlayer.Texture); } if (Object.op_Implicit((Object)(object)tmPlayer.PlayerEntity) && tmPlayer.CustomSkin != null && ((int)((MovableEntity)tmPlayer.PlayerEntity).variant == 9 || (int)((MovableEntity)tmPlayer.PlayerEntity).variant == 10)) { AssignJetScubaVisor(tmPlayer.PlayerEntity, tmPlayer.Texture); } } public static void AssignJetScubaVisor(PlayerEntity pe, Texture2D tex) { AssignJetScubaVisor(((VisualEntity)pe).GetVisual("main").mainRenderer, tex); } public static void AssignJetScubaVisor(Renderer r, Texture2D tex) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e0: 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_00ec: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_0115: 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_0121: 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) Color relativePixel = Texture2DExtension.GetRelativePixel(tex, 60, 328, 512, 512); Color relativePixel2 = Texture2DExtension.GetRelativePixel(tex, 60, 325, 512, 512); Color relativePixel3 = Texture2DExtension.GetRelativePixel(tex, 60, 322, 512, 512); Material[] materials = r.materials; foreach (Material val in materials) { if (!((Object)val).name.Contains("skateScubaGlass")) { continue; } foreach (string item in from texName in r.material.GetTexturePropertyNames() where validMainTexNames.Contains(texName) select texName) { r.material.SetTexture(item, (Texture)(object)tex); } val.SetColor("_LitColor", new Color(relativePixel.r, relativePixel.g, relativePixel.b, relativePixel3.g)); val.SetColor("_ShadowColor", new Color(relativePixel2.r, relativePixel2.g, relativePixel2.b, relativePixel3.b)); val.SetFloat("_Transparency", relativePixel3.r); } } public static void AssignBubbleVisual(CharacterVariant variant, Texture2D tex) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 //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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_003c: Invalid comparison between Unknown and I4 //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Invalid comparison between Unknown and I4 //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown //IL_01a0: Unknown result type (might be due to invalid IL or missing references) Color relativePixel = default(Color); ((Color)(ref relativePixel))..ctor(0f, 1f, 1f); if ((int)variant <= 7) { relativePixel = Texture2DExtension.GetRelativePixel(tex, 59, 326, 512, 512); } else if ((int)variant == 9 || (int)variant == 10) { relativePixel = Texture2DExtension.GetRelativePixel(tex, 59, 306, 512, 512); } else if ((int)variant == 11 || (int)variant == 12) { relativePixel = Texture2DExtension.GetRelativePixel(tex, 59, 388, 512, 512); } MeshRenderer[] array = Object.FindObjectsOfType(); foreach (MeshRenderer val in array) { if (((Object)val).name == "bubbleVisual") { ((Renderer)val).material.mainTexture = (Texture)(object)bubbleBG; Material material = ((Renderer)val).material; Material val2 = new Material(((Renderer)val).material.shader); val2.mainTexture = (Texture)(object)bubbleFG; Material[] materials = (Material[])(object)new Material[2] { material, val2 }; ((Renderer)val).materials = materials; ((Renderer)val).materials[0].color = relativePixel; break; } } VisualEntity[] array2 = Object.FindObjectsOfType(); foreach (VisualEntity val3 in array2) { if (((Object)val3).name == "bubblePop") { Renderer[] componentsInChildren = ((Component)val3).GetComponentsInChildren(); int num = 0; if (num < componentsInChildren.Length) { Renderer val4 = componentsInChildren[num]; val4.material.mainTexture = (Texture)(object)bubblePopFG; Material material2 = val4.material; Material val5 = new Material(val4.material.shader); val5.mainTexture = (Texture)(object)bubblePopBG; Material[] materials2 = (Material[])(object)new Material[2] { material2, val5 }; val4.materials = materials2; val4.materials[1].color = relativePixel; } } } } public static void NitroIngameEffects(TexModPlayer tmPlayer) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (Object.op_Implicit((Object)(object)tmPlayer.PlayerEntity) && tmPlayer.CustomSkin != null) { AssignNitroChain((CopPlayer)tmPlayer.PlayerEntity, tmPlayer.Texture); } } public static void AssignNitroChain(CopPlayer cop, Texture2D tex) { Renderer[] componentsInChildren = cop.chain.chainLink.GetComponentsInChildren(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].material.mainTexture = (Texture)(object)tex; } } } public class EffectChanger : MonoBehaviour { public static string EffectsFolder = TextureMod.EffectFolder; private Texture2D parryActiveBG; private Texture2D parryActiveMG; private Texture2D parryActiveFG; private Texture2D parryEndBG; private Texture2D parryEndMG; private Texture2D parryEndFG; private Texture2D parrySuccessBG; private Texture2D parrySuccessMG; private Texture2D parrySuccessFG; private Texture2D clashBG; private Texture2D clashFG; private ConfigEntry parryFirstColorR; private ConfigEntry parryFirstColorG; private ConfigEntry parryFirstColorB; private ConfigEntry parrySecondColorR; private ConfigEntry parrySecondColorG; private ConfigEntry parrySecondColorB; private ConfigEntry parryThirdColorR; private ConfigEntry parryThirdColorG; private ConfigEntry parryThirdColorB; private ConfigEntry enableCustomParry; private void Start() { //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Expected O, but got Unknown //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Expected O, but got Unknown //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Expected O, but got Unknown //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Expected O, but got Unknown //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Expected O, but got Unknown //IL_02dd: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Expected O, but got Unknown //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Expected O, but got Unknown //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Expected O, but got Unknown //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Expected O, but got Unknown //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03a9: Expected O, but got Unknown string path = Path.Combine(EffectsFolder, "Parry"); parryActiveBG = TextureUtils.LoadPNG(Path.Combine(path, "parryActiveBG.png")); parryActiveMG = TextureUtils.LoadPNG(Path.Combine(path, "parryActiveMG.png")); parryActiveFG = TextureUtils.LoadPNG(Path.Combine(path, "parryActiveFG.png")); parryEndBG = TextureUtils.LoadPNG(Path.Combine(path, "parryEndBG.png")); parryEndMG = TextureUtils.LoadPNG(Path.Combine(path, "parryEndMG.png")); parryEndFG = TextureUtils.LoadPNG(Path.Combine(path, "parryEndFG.png")); parrySuccessBG = TextureUtils.LoadPNG(Path.Combine(path, "parrySuccessBG.png")); parrySuccessMG = TextureUtils.LoadPNG(Path.Combine(path, "parrySuccessMG.png")); parrySuccessFG = TextureUtils.LoadPNG(Path.Combine(path, "parrySuccessFG.png")); string path2 = Path.Combine(EffectsFolder, "Clash"); clashBG = TextureUtils.LoadPNG(Path.Combine(path2, "clashEffectBG.png")); clashFG = TextureUtils.LoadPNG(Path.Combine(path2, "clashEffectFG.png")); ConfigFile config = ((BaseUnityPlugin)TextureMod.Instance).Config; config.Bind("EffectChanger", "parry_header", "Parry Settings:", new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_header" })); enableCustomParry = config.Bind("EffectChanger", "enableCustomParryAndClash", false, (ConfigDescription)null); parryFirstColorR = config.Bind("EffectChanger", "parryFirstColorR", 0, new ConfigDescription("Parry's first color red amount", (AcceptableValueBase)(object)new AcceptableValueRange(0, 255), new object[0])); parryFirstColorG = config.Bind("EffectChanger", "parryFirstColorG", 0, new ConfigDescription("Parry's first color green amount", (AcceptableValueBase)(object)new AcceptableValueRange(0, 255), new object[0])); parryFirstColorB = config.Bind("EffectChanger", "parryFirstColorB", 0, new ConfigDescription("Parry's first color blue amount", (AcceptableValueBase)(object)new AcceptableValueRange(0, 255), new object[0])); config.Bind("EffectChanger", "parry_gap1", 20, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_gap" })); parrySecondColorR = config.Bind("EffectChanger", "parrySecondColorR", 0, new ConfigDescription("Parry's second color red amount", (AcceptableValueBase)(object)new AcceptableValueRange(0, 255), new object[0])); parrySecondColorG = config.Bind("EffectChanger", "parrySecondColorG", 0, new ConfigDescription("Parry's second color green amount", (AcceptableValueBase)(object)new AcceptableValueRange(0, 255), new object[0])); parrySecondColorB = config.Bind("EffectChanger", "parrySecondColorB", 0, new ConfigDescription("Parry's second color blue amount", (AcceptableValueBase)(object)new AcceptableValueRange(0, 255), new object[0])); config.Bind("EffectChanger", "parry_gap2", 20, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_gap" })); parryThirdColorR = config.Bind("EffectChanger", "parryThirdColorR", 0, new ConfigDescription("Parry's third color red amount", (AcceptableValueBase)(object)new AcceptableValueRange(0, 255), new object[0])); parryThirdColorG = config.Bind("EffectChanger", "parryThirdColorG", 0, new ConfigDescription("Parry's third color green amount", (AcceptableValueBase)(object)new AcceptableValueRange(0, 255), new object[0])); parryThirdColorB = config.Bind("EffectChanger", "parryThirdColorB", 0, new ConfigDescription("Parry's third color blue amount", (AcceptableValueBase)(object)new AcceptableValueRange(0, 255), new object[0])); config.Bind("EffectChanger", "parry_gap3", 20, new ConfigDescription("", (AcceptableValueBase)null, new object[1] { "modmenu_gap" })); } private void Update() { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0163: 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_0177: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Expected O, but got Unknown //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Expected O, but got Unknown //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Expected O, but got Unknown //IL_0416: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Expected O, but got Unknown //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Expected O, but got Unknown //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_026e: 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_0282: Unknown result type (might be due to invalid IL or missing references) if (!enableCustomParry.Value) { return; } Color32 val = default(Color32); ((Color32)(ref val))..ctor((byte)parryFirstColorR.Value, (byte)parryFirstColorG.Value, (byte)parryFirstColorB.Value, byte.MaxValue); Color32 val2 = default(Color32); ((Color32)(ref val2))..ctor((byte)parrySecondColorR.Value, (byte)parrySecondColorG.Value, (byte)parrySecondColorB.Value, byte.MaxValue); Color32 val3 = default(Color32); ((Color32)(ref val3))..ctor((byte)parryThirdColorR.Value, (byte)parryThirdColorG.Value, (byte)parryThirdColorB.Value, byte.MaxValue); MeshRenderer[] array = Object.FindObjectsOfType(); foreach (MeshRenderer val4 in array) { if (((Object)val4).name == "parryVisual") { ((Renderer)val4).material.mainTexture = (Texture)(object)parryActiveBG; Material material = ((Renderer)val4).material; Material val5 = new Material(((Renderer)val4).material.shader); Material val6 = new Material(((Renderer)val4).material.shader); val5.mainTexture = (Texture)(object)parryActiveMG; val6.mainTexture = (Texture)(object)parryActiveFG; Material[] materials = (Material[])(object)new Material[3] { material, val5, val6 }; ((Renderer)val4).materials = materials; ((Renderer)val4).materials[0].color = Color32.op_Implicit(val); ((Renderer)val4).materials[1].color = Color32.op_Implicit(val2); ((Renderer)val4).materials[2].color = Color32.op_Implicit(val3); } } VisualEntity[] array2 = Object.FindObjectsOfType(); foreach (VisualEntity val7 in array2) { if (((Object)val7).name == "parryEnd") { Renderer[] componentsInChildren = ((Component)val7).GetComponentsInChildren(); foreach (Renderer val8 in componentsInChildren) { val8.material.mainTexture = (Texture)(object)parryEndBG; Material material2 = val8.material; Material val9 = new Material(val8.material.shader); Material val10 = new Material(val8.material.shader); val9.mainTexture = (Texture)(object)parryEndMG; val10.mainTexture = (Texture)(object)parryEndFG; Material[] materials2 = (Material[])(object)new Material[3] { material2, val9, val10 }; val8.materials = materials2; val8.materials[0].color = Color32.op_Implicit(val); val8.materials[1].color = Color32.op_Implicit(val2); val8.materials[2].color = Color32.op_Implicit(val3); } } if (((Object)val7).name == "parrySuccess") { Renderer val11 = ((Component)val7).GetComponentsInChildren().First(); val11.material.mainTexture = (Texture)(object)parrySuccessBG; Material material3 = val11.material; Material val12 = new Material(val11.material.shader); Material val13 = new Material(val11.material.shader); val12.CopyPropertiesFromMaterial(material3); val13.CopyPropertiesFromMaterial(material3); val12.mainTexture = (Texture)(object)parrySuccessMG; val13.mainTexture = (Texture)(object)parrySuccessFG; Material[] materials3 = (Material[])(object)new Material[3] { material3, val12, val13 }; val11.materials = materials3; val11.materials[0].color = Color32.op_Implicit(val); val11.materials[1].color = Color32.op_Implicit(val2); val11.materials[2].color = Color32.op_Implicit(val3); } if (((Object)val7).name == "clashEffect") { Renderer val14 = ((Component)val7).GetComponentsInChildren().First(); val14.material.mainTexture = (Texture)(object)clashBG; Material material4 = val14.material; Material val15 = new Material(val14.material.shader); val15.CopyPropertiesFromMaterial(material4); val15.mainTexture = (Texture)(object)clashFG; Material[] materials4 = (Material[])(object)new Material[2] { material4, val15 }; val14.materials = materials4; val14.materials[0].color = Color32.op_Implicit(val); val14.materials[1].color = Color32.op_Implicit(val3); } } } public Texture2D Combine(Texture2D background, Texture2D overlay) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_002e: 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_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) int num = 0; int num2 = ((Texture)background).height - ((Texture)overlay).height; for (int i = num; i < ((Texture)background).width; i++) { for (int j = num2; j < ((Texture)background).height; j++) { Color pixel = background.GetPixel(i, j); Color pixel2 = overlay.GetPixel(i - num, j - num2); Color val = Color.Lerp(pixel, pixel2, pixel2.a / 1f); background.SetPixel(i, j, val); } } background.Apply(); return background; } } } namespace TextureMod.TMPlayer { public class TexModPlayer { private Vector3 labelScreenPos; public ModelHandler ModelHandler; public CustomSkinHandler skinHandler; private Texture2D _texture; protected static ManualLogSource Logger => TextureMod.Log; public Player Player { get; protected set; } public PlayerEntity PlayerEntity { get { Player player = Player; if (player == null) { return null; } return player.playerEntity; } } public CustomSkin CustomSkin => skinHandler?.CustomSkin; public Texture2D Texture { get { if (SkinColorOverride == SkinColorFilter.NONE) { return CustomSkin?.Texture; } return _texture; } private set { _texture = value; } } public Character CustomSkinCharacter => (Character)(((??)CustomSkin?.Character) ?? 101); public ModelVariant CustomSkinModelVariant => CustomSkin?.ModelVariant ?? ModelVariant.None; public bool ShouldRefreshSkin { get; set; } public SkinColorFilter SkinColorOverride { get; private set; } = SkinColorFilter.NONE; public TexModPlayer(Player player, CustomSkin skin = null) { Player = player; skinHandler = new CustomSkinHandler(skin); } public bool HasCustomSkin() { return skinHandler?.CustomSkin != null; } public void SetPlayer(Player player) { Player = player; } public virtual void Update() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown //IL_0132: Unknown result type (might be due to invalid IL or missing references) //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_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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Expected I4, but got Unknown //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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Invalid comparison between Unknown and I4 if ((EnumWrapper)(object)Player.playerStatus == (EnumWrapper)(object)PlayerStatus.NONE) { if (HasCustomSkin()) { RemoveCustomSkin(); } return; } if (HasCustomSkin()) { UpdateModel(); } if (GameStates.IsInLobby()) { if (HasCustomSkin()) { bool flag = !Player.CharacterSelectedIsRandom && (Player.CharacterSelected != CustomSkinCharacter || !VariantHelper.VariantMatch(Player.CharacterVariant, CustomSkinModelVariant)); if (ShouldRefreshSkin && flag) { Player.CharacterSelected = CustomSkinCharacter; Player.CharacterVariant = VariantHelper.GetDefaultVariantForModel(CustomSkin.ModelVariant); GameStatesLobbyUtils.RefreshLocalPlayerState(); } Character character = ModelHandler.character; if ((int)character != 3) { if ((int)character == 6) { EffectsHandler.DBEffects(this); } } else { EffectsHandler.SonataEffects(this); } } ScreenBase obj = ScreenApi.CurrentScreens[0]; ScreenPlayers val = (ScreenPlayers)(object)((obj is ScreenPlayers) ? obj : null); if (val != null) { Camera main = Camera.main; if ((Object)(object)main != (Object)null) { RectTransform val2 = (RectTransform)((Component)val.playerSelections[Player.nr].btTeam).transform; labelScreenPos = main.WorldToScreenPoint(((Transform)val2).position); ref float y = ref labelScreenPos.y; float num = y; Rect rect = val2.rect; y = num - ((Rect)(ref rect)).height; } } } else if (GameStates.IsInMatch() && HasCustomSkin() && (Object)(object)PlayerEntity != (Object)null && Player.IsInMatch) { Character character = ModelHandler.character; switch (character - 2) { case 0: EffectsHandler.CandymanIngameEffects(this); break; case 9: EffectsHandler.AshesIngameEffects(this); break; case 8: EffectsHandler.ToxicIngameEffects(this); break; case 6: EffectsHandler.GridIngameEffects(this); break; case 7: EffectsHandler.JetIngameEffects(this); break; case 4: EffectsHandler.DBEffects(this); break; case 5: EffectsHandler.NitroIngameEffects(this); break; case 1: EffectsHandler.SonataEffects(this); break; case 2: case 3: break; } } } public void OnGUI() { if (GameStates.IsInLobby() && HasCustomSkin()) { ShowSkinNametags(); } } public void CheckMirrors() { throw new NotImplementedException(); } public void UpdateModel() { //IL_0014: 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) bool flag = ModelHandler != null && !ModelHandler.ValidCharacter(Player.Character, Player.CharacterVariant); if (ModelHandler == null || ModelHandler.IsObsolete() || (GameStates.IsInLobby() && flag)) { string text = $"TmPlayer {Player.nr} is updating their modelhandler. " + "It was " + ((ModelHandler == null) ? "null" : "not null") + "."; if (ModelHandler != null) { text = text + " It " + (ModelHandler.IsObsolete() ? "was" : "wasn't") + " obsolete."; } if (flag) { text += " It had the wrong model."; } ModelHandler = ModelHandler.GetCurrentModelHandler(Player.nr); } if (ModelHandler != null) { ModelHandler.texture = Texture; ModelHandler.Update(); } } public void SetColorFilter(SkinColorFilter filter) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if (SkinColorOverride != filter) { switch (filter) { case SkinColorFilter.NONE: Texture = null; break; case SkinColorFilter.GRAY: Texture = EffectsHandler.GetGrayscaledCopy(CustomSkin.Texture); break; case SkinColorFilter.BLUE: Texture = EffectsHandler.GetColoredCopy(CustomSkin.Texture, new Color(0f, 0f, 255f)); break; case SkinColorFilter.GREEN: Texture = EffectsHandler.GetColoredCopy(CustomSkin.Texture, new Color(0f, 255f, 0f)); break; case SkinColorFilter.RED: Texture = EffectsHandler.GetColoredCopy(CustomSkin.Texture, new Color(255f, 0f, 0f)); break; case SkinColorFilter.YELLOW: Texture = EffectsHandler.GetColoredCopy(CustomSkin.Texture, new Color(0f, 255f, 255f)); break; } SkinColorOverride = filter; } } private void SetUnlocksCharacterModel(Texture2D tex) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) CharacterModel[] array = Object.FindObjectsOfType(); if (array.Length != 0) { CharacterModel[] array2 = array; foreach (CharacterModel obj in array2) { obj.SetSilhouette(false); RendererHelper.AssignTextureToCharacterModelRenderers(obj, ((MovableEntity)PlayerEntity).character, ((MovableEntity)PlayerEntity).variant, Texture); } } } public void SetCustomSkin(CustomSkinHandler skinHandler) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_008a: 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) this.skinHandler = skinHandler; if (CustomSkin == null) { return; } SetCharacter(CustomSkin.Character, VariantHelper.GetDefaultVariantForModel(CustomSkin.ModelVariant)); if (GameStates.IsInLobby()) { bool flag = (int)StateApi.CurrentGameMode == 1 && Player.nr == 1; ScreenBase obj = ScreenApi.CurrentScreens[0]; ScreenPlayers val = (ScreenPlayers)(object)((obj is ScreenPlayers) ? obj : null); if (val != null) { val.playerSelections[Player.nr].characterModel.SetCharacterLobby(Player.nr, Player.Character, Player.CharacterVariant, flag); } GameStatesLobbyUtils.RefreshPlayerState(Player); } } public void SetRandomCustomSkin() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) List usableHandlers = SkinsManager.skinCache.GetUsableHandlers(Player.Character); if (usableHandlers == null) { return; } List list = usableHandlers.Where((CustomSkinHandler skinHandler) => VariantHelper.VariantMatch(Player.CharacterVariant, skinHandler.CustomSkin.ModelVariant)).ToList(); if (list.Count > 0) { SetCustomSkin(list[Random.Range(0, list.Count)]); if (GameStates.IsInOnlineLobby()) { GameStatesLobbyUtils.SendPlayerState(Player); } } } public void RemoveCustomSkin() { if (CustomSkin != null) { skinHandler = null; } } public void SetCharacter(Character character, CharacterVariant characterVariant = (CharacterVariant)0) { //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) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) if (!GameStates.IsInLobby()) { return; } TexModPlayerManager.ForAllTexmodPlayers(delegate(TexModPlayer tmPlayer) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0038: 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) if (tmPlayer.Player.Character == character && tmPlayer.Player.CharacterVariant == characterVariant) { characterVariant = VariantHelper.GetNextVariantForModel(CustomSkin.ModelVariant, characterVariant); } }); Player.Character = character; Player.CharacterVariant = characterVariant; } protected virtual void ShowSkinNametags() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0079: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: 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_00b5: Unknown result type (might be due to invalid IL or missing references) if (CustomSkin != null) { string skinLabel = CustomSkin.GetSkinLabel(); GUI.skin.box.wordWrap = false; GUIContent val = new GUIContent(skinLabel); GUI.skin.box.alignment = (TextAnchor)4; GUI.skin.box.fontSize = 22; ScreenBase val2 = ScreenApi.CurrentScreens[0]; _ = ScreenApi.CurrentScreens[1]; if (GameStates.IsInLobby() && val2 is ScreenPlayers) { Vector2 val3 = GUI.skin.box.CalcSize(val); GUI.Box(new Rect(labelScreenPos.x - val3.x / 2f, (float)Screen.height - labelScreenPos.y, val3.x, val3.y), skinLabel); } } } } public enum SkinColorFilter { RED, BLUE, YELLOW, GREEN, NONE, GRAY } public class LocalTexModPlayer : TexModPlayer { private int skinCounter; public static int localPlayerNr => ((Peer)(P2P.localPeer?)).playerNr ?? 0; public static Player LocalLobbyPlayer => Player.GetPlayer(localPlayerNr); public static PlayerEntity LocalGamePlayerEntity { get { Player localLobbyPlayer = LocalLobbyPlayer; if (localLobbyPlayer == null) { return null; } return localLobbyPlayer.playerEntity; } } public LocalTexModPlayer(Player player, CustomSkin skin = null) : base(player, skin) { } public void NextSkin(Character character = (Character)101, bool random = false) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0078: Unknown result type (might be due to invalid IL or missing references) if ((int)character == 101) { character = base.Player.CharacterSelected; } if (base.CustomSkin?.Character != (Character?)base.Player.CharacterSelected || character != base.Player.CharacterSelected) { skinCounter = 0; } else { skinCounter++; } ChangeSkin(character, skinCounter, random); } public void PreviousSkin(Character character = (Character)101, bool random = false) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_0078: Unknown result type (might be due to invalid IL or missing references) if ((int)character == 101) { character = base.Player.CharacterSelected; } if (base.CustomSkin?.Character != (Character?)base.Player.CharacterSelected || character != base.Player.CharacterSelected) { skinCounter = -1; } else { skinCounter--; } ChangeSkin(character, skinCounter, random); } public void ChangeSkin(Character character, int index, bool random = false) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) List usableHandlers = SkinsManager.skinCache.GetUsableHandlers(character); if (usableHandlers == null) { return; } TexModPlayer.Logger.LogDebug((object)$"Counter: {skinCounter}, skin length: {usableHandlers.Count}"); if (usableHandlers.Count > 0) { SetCustomSkin(usableHandlers?[mod(index, usableHandlers.Count)]); if (GameStates.IsInOnlineLobby()) { GameStatesLobbyUtils.SendPlayerState(base.Player); } } } private int mod(int x, int m) { int num = x % m; if (num >= 0) { return num; } return num + m; } } public class RemoteTexModPlayer : TexModPlayer { public RemoteTexModPlayer(Player player, CustomSkin skin = null) : base(player, skin) { } public override void Update() { base.Update(); if (base.Player != null) { _ = ModelHandler; } } } public class TexModPlayerManager : MonoBehaviour { private static int reloadCustomSkinTimer; public List tmPlayers = new List(new TexModPlayer[Player.MAX_PLAYERS]); public static TexModPlayerManager Instance { get; private set; } private static ManualLogSource Logger => TextureMod.Log; public List Opponents => tmPlayers.Where((TexModPlayer tmPlayer) => tmPlayer != null && (object)tmPlayer.GetType() == typeof(RemoteTexModPlayer)).Cast().ToList(); public TexModPlayer localPlayer { get { if (Player.LocalPlayerNumber >= tmPlayers.Count) { return null; } return tmPlayers[Player.LocalPlayerNumber]; } set { tmPlayers[Player.LocalPlayerNumber] = value; } } private void Awake() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown Instance = this; LobbyEvents.OnLobbyReady += new OnLobbyReadyHandler(LobbyEvents_OnLobbyReady); GameStateEvents.OnStateChange += new OnStateChangeHandler(GameEvents_OnGameIntro); } private void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown LobbyEvents.OnLobbyReady -= new OnLobbyReadyHandler(LobbyEvents_OnLobbyReady); GameStateEvents.OnStateChange -= new OnStateChangeHandler(GameEvents_OnGameIntro); } private void LobbyEvents_OnLobbyReady(object source, LobbyReadyArgs e) { Player.ForAll((Action)delegate(Player p) { if (p.isLocal) { tmPlayers[p.nr] = new LocalTexModPlayer(p); } else { tmPlayers[p.nr] = new RemoteTexModPlayer(p); } }); } private void GameEvents_OnGameIntro(object source, OnStateChangeArgs e) { if (!((EnumWrapper)(object)e.newState == (EnumWrapper)(object)GameState.GAME_INTRO)) { return; } ForAllLocalTexmodPlayers(delegate(LocalTexModPlayer tmPlayer) { if (tmPlayer.Player.CharacterSelectedIsRandom && TextureMod.randomSkinOnRandomSelect.Value) { tmPlayer.SetRandomCustomSkin(); if (NetworkApi.IsOnline && tmPlayer.HasCustomSkin() && TextureMod.sendSkinsToOpponents.Value) { ExchangeClient.SendSkinNotice(tmPlayer.CustomSkin.SkinHash); } } }); } private void Update() { for (int i = 0; i < Player.MAX_PLAYERS; i++) { Player player = Player.GetPlayer(i); if (player == null || (EnumWrapper)(object)player.playerStatus == (EnumWrapper)(object)PlayerStatus.NONE) { tmPlayers[i] = null; } else if (tmPlayers[i] == null) { if (player.isLocal) { tmPlayers[i] = new LocalTexModPlayer(player); } else { tmPlayers[i] = new RemoteTexModPlayer(player); } } } UpdatePlayers(); CheckForSkinReload(); } private void UpdatePlayers() { foreach (TexModPlayer tmPlayer in tmPlayers) { tmPlayer?.Update(); } } private void OnGUI() { foreach (TexModPlayer tmPlayer in tmPlayers) { tmPlayer?.OnGUI(); } } public void HandleMirrorSkins() { ForAllTexmodPlayers(delegate(TexModPlayer tmp) { if (tmp.Player.nr != localPlayer.Player.nr && tmp.HasCustomSkin() && (Hash)(tmp.CustomSkin?.SkinHash) == (Hash)(localPlayer.CustomSkin?.SkinHash)) { tmp.SetColorFilter((SkinColorFilter)tmp.Player.nr); } }); } public static TexModPlayer GetPlayer(int nr) { return Instance.tmPlayers[nr]; } public static void ForAllTexmodPlayers(Action action) { foreach (TexModPlayer tmPlayer in Instance.tmPlayers) { if (tmPlayer != null) { action(tmPlayer); } } } public static void ForAllLocalTexmodPlayers(Action action) { foreach (TexModPlayer tmPlayer in Instance.tmPlayers) { if (tmPlayer != null && tmPlayer is LocalTexModPlayer obj) { action(obj); } } } public static void ForAllRemoteTexmodPlayers(Action action) { foreach (TexModPlayer tmPlayer in Instance.tmPlayers) { if (tmPlayer != null && tmPlayer is RemoteTexModPlayer obj) { action(obj); } } } public static void ForAllTexModPlayersInMatch(Action action) { foreach (TexModPlayer tmPlayer in Instance.tmPlayers) { if (tmPlayer.Player.IsInMatch) { action(tmPlayer); } } } private void CheckForSkinReload() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(TextureMod.reloadCustomSkin.Value)) { ReloadCurrentSkins(); } else if (TextureMod.reloadCustomSkinOnInterval.Value && !NetworkApi.IsOnline) { if (reloadCustomSkinTimer > 0) { reloadCustomSkinTimer--; return; } ReloadCurrentSkins(); reloadCustomSkinTimer = TextureMod.skinReloadIntervalInFrames.Value; } } public static bool InPostGame() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0008: 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_0015: Invalid comparison between Unknown and I4 if ((int)StateApi.CurrentGameMode == 1 || (int)StateApi.CurrentGameMode == 0 || (int)StateApi.CurrentGameMode == 2) { return (EnumWrapper)(object)GameStates.GetCurrent() == (EnumWrapper)(object)GameState.GAME_RESULT; } return false; } public static void ReloadCurrentSkins() { ForAllLocalTexmodPlayers(delegate(LocalTexModPlayer tmp) { try { tmp?.skinHandler?.ReloadSkin(); } catch { AudioHandler.PlaySfx((Sfx)7); } }); } } }