public static bool Prefix(ref GameObject go, long senderID, Vector3 pos, Talker.Type type, ref string user, ref string text) { if (senderID == Player.m_localPlayer.GetPlayerID()) { // InputText_Patch.PrintOut("Not processing own message" + text); return(true); } if (text.StartsWith("START_") && text.EndsWith("#END")) { ReceivedPackets.Add(text); if (ReceivedPackets.Count == PacketNum) { InputText_Patch.PrintOut("1/4 Merging exploration data."); AssembleMapData(); InputText_Patch.PrintOut("data parsed, exploration content: " + ExplorationData.Where(x => x).Count()); DataReadyForMerge = true; InputText_Patch.PrintOut("2/4 Data reassembly done."); } } else { } return(true); }
// Token: 0x06000003 RID: 3 RVA: 0x00002084 File Offset: 0x00000284 public static bool Prefix(global::Console __instance) { string text = global::Console.instance.m_input.text; Assembly val = typeof(Player).Assembly; string[] array = text.Split(new char[] { ' ' }); if (text.Equals("qol.debug")) { InputText_Patch.PrintOut("Usage: qol.debug <class>"); } else if (text.Contains("qol.debug")) { try { string _class = text.Split(' ')[1]; ModUtils.Log(_class); Type type = val.GetType(_class); if (type != null) { BindingFlags bindingFlags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static; InputText_Patch.PrintOut($"\n======== {type} ========="); foreach (FieldInfo field in type.GetFields(bindingFlags)) { InputText_Patch.PrintOut($"{field.Name}"); } } else { InputText_Patch.PrintOut($"{text.Split(' ')[1]} class not found"); } } catch (Exception e) { ModUtils.Log(e); } } return(true); }
public static bool Prefix(ref bool[] ___m_explored, ref Texture2D ___m_fogTexture, ref List <ZNet.PlayerInfo> ___m_tempPlayerInfo) { if (ChatDataReceiver.DataReadyForMerge) { ChatDataReceiver.DataReadyForMerge = false; int explored = ___m_explored.Where(x => x).Count(); int friendExplord = ChatDataReceiver.ExplorationData.Where(x => x).Count(); if (___m_explored.Length != ChatDataReceiver.ExplorationData.Length) { InputText_Patch.PrintOut("Map data resolution error."); } else { InputText_Patch.PrintOut("Your resoluations are the same: " + ___m_explored.Length); } int num1 = 2048, num2 = 2048; ///only for me!!!! Color32[] array = new Color32[num1 * num2]; for (int i = 0; i < array.Length; i++) { array[i] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); } ___m_fogTexture.SetPixels32(array); ___m_fogTexture.Apply(); for (int i = 0; i < ___m_explored.Length; i++) { ___m_explored[i] = ___m_explored[i] || ChatDataReceiver.ExplorationData[i]; //merge int x = i % num2; int y = i / num2; if (___m_explored[y * num2 + x]) { ___m_fogTexture.SetPixel(x, y, new Color(0, 0, 0, 0)); } } InputText_Patch.PrintOut("3/4 Map data merge completed."); ___m_fogTexture.Apply(); ___m_fogTexture.Apply(true, false); InputText_Patch.PrintOut("4/4 Map texture data refreshed"); ChatDataReceiver.Clear(); } if (cooldownTimer <= 0) ////1000 { cooldownTimer = cooldownTimerBase; Chat c = Chat.instance; var packetNum = 1000; int dataPerPackage = ___m_explored.Length / packetNum; //4194 string dataPack = ""; int limit = dataPerPackage; int remainder = ___m_explored.Length - dataPerPackage * packetNum; for (int i = 0; i <= packetNum; i++) { dataPack = "START_" + i + "#"; int oneStreak = 0, zeroStreak = 0; if (i == packetNum) { limit = remainder; } for (int j = 0; j < limit; j++) { if (___m_explored[i * dataPerPackage + j]) { if (zeroStreak > 0) { dataPack += zeroStreak + "x0,"; zeroStreak = 0; } oneStreak++; } else { if (oneStreak > 0) { dataPack += oneStreak + "x1,"; oneStreak = 0; } zeroStreak++; } } if (zeroStreak > 0) { dataPack += zeroStreak + "x0"; zeroStreak = 0; } if (oneStreak > 0) { dataPack += zeroStreak + "x1"; oneStreak = 0; } dataPack += "#END"; c.SendText(Talker.Type.Whisper, dataPack); } } if (cooldownTimerResolution <= 0) ////1000 { cooldownTimerResolution = cooldownTimerResolutionBase; InputText_Patch.PrintOut("Resolution:" + ___m_explored.Length); } cooldownTimer -= Time.deltaTime; cooldownTimerResolution -= Time.deltaTime; return(true); }