using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Serialization;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CSync.Extensions;
using CSync.Lib;
using HarmonyLib;
using InteractiveTerminalAPI.UI;
using InteractiveTerminalAPI.UI.Application;
using InteractiveTerminalAPI.UI.Cursor;
using InteractiveTerminalAPI.UI.Page;
using InteractiveTerminalAPI.UI.Screen;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using WeatherProbe.Misc;
using WeatherProbe.Misc.UI.Application;
using WeatherProbe.NetcodePatcher;
using WeatherProbe.Patches;
using WeatherProbe.Patches.RoundComponents;
using WeatherProbe.Patches.TerminalComponents;
using WeatherProbe.Util;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace WeatherProbe
{
[BepInPlugin("com.github.WhiteSpike.WeatherProbe", "Weather Probe", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
internal static readonly Harmony harmony = new Harmony("com.github.WhiteSpike.WeatherProbe");
internal static readonly ManualLogSource mls = Logger.CreateLogSource("Weather Probe");
public static PluginConfig Config;
internal static GameObject networkPrefab;
private void Awake()
{
Config = new PluginConfig(((BaseUnityPlugin)this).Config);
IEnumerable<Type> enumerable;
try
{
enumerable = Assembly.GetExecutingAssembly().GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
enumerable = ex.Types.Where((Type t) => t != null);
}
foreach (Type item in enumerable)
{
MethodInfo[] methods = item.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array = methods;
foreach (MethodInfo methodInfo in array)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
PatchMainVersion();
networkPrefab = NetworkPrefabs.CreateNetworkPrefab("Weather Probe");
networkPrefab.AddComponent<WeatherProbeBehaviour>();
InteractiveTerminalManager.RegisterApplication<WeatherProbeApplication>("probe", false);
mls.LogInfo((object)"Weather Probe 1.0.0 has been loaded successfully.");
}
internal static void PatchMainVersion()
{
PatchVitalComponents();
}
private static void PatchVitalComponents()
{
harmony.PatchAll(typeof(StartOfRoundPatcher));
harmony.PatchAll(typeof(StartMatchLeverPatcher));
harmony.PatchAll(typeof(TerminalPatcher));
mls.LogInfo((object)"Game managers have been patched");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "WeatherProbe";
public const string PLUGIN_NAME = "ExtendDeadline";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace WeatherProbe.Util
{
internal static class Tools
{
private static Terminal terminal;
public static void FindCodeInstruction(ref int index, ref List<CodeInstruction> codes, object findValue, MethodInfo addCode, bool skip = false, bool requireInstance = false, bool notInstruction = false, bool andInstruction = false, bool orInstruction = false, string errorMessage = "Not found")
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Expected O, but got Unknown
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Expected O, but got Unknown
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Expected O, but got Unknown
bool flag = false;
while (index < codes.Count)
{
if (CheckCodeInstruction(codes[index], findValue))
{
flag = true;
if (!skip)
{
if (andInstruction)
{
codes.Insert(index + 1, new CodeInstruction(OpCodes.And, (object)null));
}
if (!andInstruction && orInstruction)
{
codes.Insert(index + 1, new CodeInstruction(OpCodes.Or, (object)null));
}
if (notInstruction)
{
codes.Insert(index + 1, new CodeInstruction(OpCodes.Not, (object)null));
}
codes.Insert(index + 1, new CodeInstruction(OpCodes.Call, (object)addCode));
if (requireInstance)
{
codes.Insert(index + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
}
}
break;
}
index++;
}
if (!flag)
{
Plugin.mls.LogError((object)errorMessage);
}
index++;
}
public static int FindLocalField(int index, ref List<CodeInstruction> codes, int localIndex, object addCode, bool skip = false, bool store = false, bool requireInstance = false, string errorMessage = "Not found")
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Expected O, but got Unknown
bool flag = false;
while (index < codes.Count)
{
if (CheckCodeInstruction(codes[index], localIndex, store))
{
flag = true;
if (!skip)
{
codes.Insert(index + 1, new CodeInstruction(OpCodes.Call, addCode));
if (requireInstance)
{
codes.Insert(index + 1, new CodeInstruction(OpCodes.Ldarg_0, (object)null));
}
}
break;
}
index++;
}
if (!flag)
{
Plugin.mls.LogError((object)errorMessage);
}
return index + 1;
}
public static void FindString(ref int index, ref List<CodeInstruction> codes, string findValue, MethodInfo addCode = null, bool skip = false, bool notInstruction = false, bool andInstruction = false, bool orInstruction = false, bool requireInstance = false, string errorMessage = "Not found")
{
FindCodeInstruction(ref index, ref codes, findValue, addCode, skip, requireInstance, notInstruction, andInstruction, orInstruction, errorMessage);
}
public static void FindField(ref int index, ref List<CodeInstruction> codes, FieldInfo findField, MethodInfo addCode = null, bool skip = false, bool notInstruction = false, bool andInstruction = false, bool orInstruction = false, bool requireInstance = false, string errorMessage = "Not found")
{
FindCodeInstruction(ref index, ref codes, findField, addCode, skip, requireInstance, notInstruction, andInstruction, orInstruction, errorMessage);
}
public static void FindMethod(ref int index, ref List<CodeInstruction> codes, MethodInfo findMethod, MethodInfo addCode = null, bool skip = false, bool notInstruction = false, bool andInstruction = false, bool orInstruction = false, bool requireInstance = false, string errorMessage = "Not found")
{
FindCodeInstruction(ref index, ref codes, findMethod, addCode, skip, requireInstance, notInstruction, andInstruction, orInstruction, errorMessage);
}
public static void FindFloat(ref int index, ref List<CodeInstruction> codes, float findValue, MethodInfo addCode = null, bool skip = false, bool notInstruction = false, bool andInstruction = false, bool orInstruction = false, bool requireInstance = false, string errorMessage = "Not found")
{
FindCodeInstruction(ref index, ref codes, findValue, addCode, skip, requireInstance, notInstruction, andInstruction, orInstruction, errorMessage);
}
public static void FindInteger(ref int index, ref List<CodeInstruction> codes, sbyte findValue, MethodInfo addCode = null, bool skip = false, bool notInstruction = false, bool andInstruction = false, bool orInstruction = false, bool requireInstance = false, string errorMessage = "Not found")
{
FindCodeInstruction(ref index, ref codes, findValue, addCode, skip, requireInstance, notInstruction, andInstruction, orInstruction, errorMessage);
}
public static void FindSub(ref int index, ref List<CodeInstruction> codes, MethodInfo addCode = null, bool skip = false, bool notInstruction = false, bool andInstruction = false, bool orInstruction = false, bool requireInstance = false, string errorMessage = "Not found")
{
object findValue = OpCodes.Sub;
bool notInstruction2 = notInstruction;
bool andInstruction2 = andInstruction;
bool orInstruction2 = orInstruction;
FindCodeInstruction(ref index, ref codes, findValue, addCode, skip, requireInstance, notInstruction2, andInstruction2, orInstruction2, errorMessage);
}
public static void FindDiv(ref int index, ref List<CodeInstruction> codes, MethodInfo addCode = null, bool skip = false, bool notInstruction = false, bool andInstruction = false, bool orInstruction = false, bool requireInstance = false, string errorMessage = "Not found")
{
object findValue = OpCodes.Div;
bool notInstruction2 = notInstruction;
bool andInstruction2 = andInstruction;
bool orInstruction2 = orInstruction;
FindCodeInstruction(ref index, ref codes, findValue, addCode, skip, requireInstance, notInstruction2, andInstruction2, orInstruction2, errorMessage);
}
public static void FindAdd(ref int index, ref List<CodeInstruction> codes, MethodInfo addCode = null, bool skip = false, bool notInstruction = false, bool andInstruction = false, bool orInstruction = false, bool requireInstance = false, string errorMessage = "Not found")
{
object findValue = OpCodes.Add;
bool notInstruction2 = notInstruction;
bool andInstruction2 = andInstruction;
bool orInstruction2 = orInstruction;
FindCodeInstruction(ref index, ref codes, findValue, addCode, skip, requireInstance, notInstruction2, andInstruction2, orInstruction2, errorMessage);
}
public static void FindMul(ref int index, ref List<CodeInstruction> codes, MethodInfo addCode = null, bool skip = false, bool notInstruction = false, bool andInstruction = false, bool orInstruction = false, bool requireInstance = false, string errorMessage = "Not found")
{
object findValue = OpCodes.Mul;
bool notInstruction2 = notInstruction;
bool andInstruction2 = andInstruction;
bool orInstruction2 = orInstruction;
FindCodeInstruction(ref index, ref codes, findValue, addCode, skip, requireInstance, notInstruction2, andInstruction2, orInstruction2, errorMessage);
}
private static bool CheckCodeInstruction(CodeInstruction code, int localIndex, bool store = false)
{
if (!store)
{
return localIndex switch
{
0 => code.opcode == OpCodes.Ldloc_0,
1 => code.opcode == OpCodes.Ldloc_1,
2 => code.opcode == OpCodes.Ldloc_2,
3 => code.opcode == OpCodes.Ldloc_3,
_ => code.opcode == OpCodes.Ldloc && (int)code.operand == localIndex,
};
}
return localIndex switch
{
0 => code.opcode == OpCodes.Stloc_0,
1 => code.opcode == OpCodes.Stloc_1,
2 => code.opcode == OpCodes.Stloc_2,
3 => code.opcode == OpCodes.Stloc_3,
_ => code.opcode == OpCodes.Stloc && (int)code.operand == localIndex,
};
}
private static bool CheckCodeInstruction(CodeInstruction code, object findValue)
{
if (findValue is sbyte)
{
return CheckIntegerCodeInstruction(code, findValue);
}
if (findValue is float)
{
return code.opcode == OpCodes.Ldc_R4 && code.operand.Equals(findValue);
}
if (findValue is string)
{
return code.opcode == OpCodes.Ldstr && code.operand.Equals(findValue);
}
if (findValue is MethodInfo)
{
return (code.opcode == OpCodes.Call || code.opcode == OpCodes.Callvirt) && code.operand == findValue;
}
if (findValue is FieldInfo)
{
return (code.opcode == OpCodes.Ldfld || code.opcode == OpCodes.Stfld) && code.operand == findValue;
}
if (findValue is OpCode)
{
return code.opcode == (OpCode)findValue;
}
return false;
}
private static bool CheckIntegerCodeInstruction(CodeInstruction code, object findValue)
{
return (sbyte)findValue switch
{
0 => code.opcode == OpCodes.Ldc_I4_0,
1 => code.opcode == OpCodes.Ldc_I4_1,
2 => code.opcode == OpCodes.Ldc_I4_2,
3 => code.opcode == OpCodes.Ldc_I4_3,
4 => code.opcode == OpCodes.Ldc_I4_4,
5 => code.opcode == OpCodes.Ldc_I4_5,
6 => code.opcode == OpCodes.Ldc_I4_6,
7 => code.opcode == OpCodes.Ldc_I4_7,
8 => code.opcode == OpCodes.Ldc_I4_8,
_ => code.opcode == OpCodes.Ldc_I4_S && code.operand.Equals(findValue),
};
}
public static void ShuffleList<T>(List<T> list)
{
if (list == null)
{
throw new ArgumentNullException("list");
}
Random random = new Random();
int num = list.Count;
while (num > 1)
{
num--;
int index = random.Next(num + 1);
T value = list[index];
list[index] = list[num];
list[num] = value;
}
}
public static bool SpawnMob(string mob, Vector3 position, int numToSpawn)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < RoundManager.Instance.currentLevel.Enemies.Count; i++)
{
if (RoundManager.Instance.currentLevel.Enemies[i].enemyType.enemyName == mob)
{
for (int j = 0; j < numToSpawn; j++)
{
RoundManager.Instance.SpawnEnemyOnServer(position, 0f, i);
}
return true;
}
}
return false;
}
internal static string GenerateInfoForUpgrade(string infoFormat, int initialPrice, int[] incrementalPrices, Func<int, float> infoFunction)
{
string text = string.Format(infoFormat, 1, initialPrice, infoFunction(0));
for (int i = 0; i < incrementalPrices.Length; i++)
{
float num = infoFunction(i + 1);
text = ((num % 1f != 0f) ? (text + string.Format(infoFormat, i + 2, incrementalPrices[i], num)) : (text + string.Format(infoFormat, i + 2, incrementalPrices[i], Mathf.RoundToInt(num))));
}
return text;
}
public static Color ConvertValueToColor(string hex, Color defaultValue)
{
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_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_003d: Unknown result type (might be due to invalid IL or missing references)
Color result = default(Color);
if (hex == null || !ColorUtility.TryParseHtmlString("#" + hex.Trim('#', ' '), ref result))
{
return defaultValue;
}
return result;
}
internal static string WrapText(string text, int availableLength, string leftPadding = "", string rightPadding = "", bool padLeftFirst = true)
{
int num = availableLength - leftPadding.Length - rightPadding.Length;
string text2 = "";
string text3 = "";
int num2 = 0;
int num3 = -1;
bool flag = true;
bool flag2 = false;
for (int i = 0; i < text.Length; i++)
{
char c = text[i];
if (c == '<')
{
flag2 = true;
}
if (c == ' ' && !flag2)
{
num3 = text3.Length;
}
if (c != '\n')
{
text3 += c;
if (!flag2)
{
num2++;
}
}
if (c == '>' && flag2)
{
flag2 = false;
}
if (num2 < num && c != '\n')
{
continue;
}
if (c != '\n' && c != ' ')
{
if (num3 != -1)
{
string text4 = ((padLeftFirst || !flag) ? leftPadding : "") + text3.Substring(0, num3) + new string(' ', Mathf.Max(0, num - num3)) + rightPadding;
text2 = text2 + text4 + "\n";
text3 = text3.Substring(num3 + 1);
}
else
{
string text5 = ((padLeftFirst || !flag) ? leftPadding : "") + text3 + rightPadding;
text2 = text2 + text5 + "\n";
text3 = "";
}
}
else
{
if (text3 != "")
{
text2 = text2 + ((padLeftFirst || !flag) ? leftPadding : "") + text3 + new string(' ', Mathf.Max(0, num - num2)) + rightPadding + "\n";
}
text3 = "";
}
num3 = -1;
flag = false;
num2 = text3.Length;
}
if (text3 != "")
{
text2 = text2 + ((padLeftFirst || !flag) ? leftPadding : "") + text3 + new string(' ', Mathf.Max(0, num - num2)) + rightPadding + "\n";
}
return text2;
}
internal static void SpawnExplosion(Vector3 explosionPosition, bool spawnExplosionEffect = false, float killRange = 1f, float damageRange = 1f, int nonLethalDamage = 50, float physicsForce = 0f, GameObject overridePrefab = null)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
Landmine.SpawnExplosion(explosionPosition, spawnExplosionEffect, killRange, damageRange, nonLethalDamage, physicsForce, overridePrefab, false);
}
internal static Terminal GetTerminal()
{
if ((Object)(object)terminal == (Object)null)
{
terminal = GameObject.Find("TerminalScript").GetComponent<Terminal>();
}
return terminal;
}
}
}
namespace WeatherProbe.Patches
{
[HarmonyPatch(typeof(StartMatchLever))]
internal static class StartMatchLeverPatcher
{
[HarmonyPostfix]
[HarmonyPatch("StartGame")]
private static void SyncHelmets()
{
WeatherProbeBehaviour.probedWeathers.Clear();
}
}
}
namespace WeatherProbe.Patches.TerminalComponents
{
[HarmonyPatch(typeof(Terminal))]
internal static class TerminalPatcher
{
[HarmonyPostfix]
[HarmonyPatch("ParsePlayerSentence")]
private static void CustomParser(ref Terminal __instance, ref TerminalNode __result)
{
string fullText = __instance.screenText.text.Substring(__instance.screenText.text.Length - __instance.textAdded);
CommandParser.ParseCommands(fullText, ref __instance, ref __result);
}
}
}
namespace WeatherProbe.Patches.RoundComponents
{
[HarmonyPatch(typeof(StartOfRound))]
internal static class StartOfRoundPatcher
{
[HarmonyPrefix]
[HarmonyPatch("Awake")]
private static void InitLguStore(StartOfRound __instance)
{
Plugin.mls.LogDebug((object)"Initiating components...");
if (((NetworkBehaviour)__instance).NetworkManager.IsHost || ((NetworkBehaviour)__instance).NetworkManager.IsServer)
{
GameObject val = Object.Instantiate<GameObject>(Plugin.networkPrefab);
((Object)val).hideFlags = (HideFlags)61;
val.GetComponent<NetworkObject>().Spawn(false);
Plugin.mls.LogDebug((object)"Spawned behaviour...");
}
}
[HarmonyPatch("SetPlanetsWeather")]
[HarmonyPostfix]
private static void SetPlanetsWeatherPostfix(StartOfRound __instance)
{
if (!((NetworkBehaviour)__instance).IsHost && !((NetworkBehaviour)__instance).IsServer && !((Object)(object)WeatherProbeBehaviour.Instance == (Object)null))
{
WeatherProbeBehaviour.Instance.SyncProbeWeathersServerRpc();
}
}
}
}
namespace WeatherProbe.Misc
{
internal static class CommandParser
{
private const string WEATHER_PROBE_HELP_COMMAND = ">PROBE\nSends out a weather probe to the specified moon and changes its current weather.\nIt will cost {0} Company credits for a randomized weather selection or {1} Company Credits when specifying the weather on a given moon.\nIt cannot change to a weather which is not possible to happen on that moon.\n";
private static TerminalNode DisplayTerminalMessage(string message, bool clearPreviousText = true)
{
TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
val.displayText = message;
val.clearPreviousText = clearPreviousText;
return val;
}
public static void ParseCommands(string fullText, ref Terminal terminal, ref TerminalNode outputNode)
{
string[] array = fullText.Split();
string text = array[0].ToLower();
string secondWord = ((array.Length > 1) ? array[1].ToLower() : "");
string text2 = text;
string text3 = text2;
if (text3 == "probe")
{
outputNode = ExecuteProbeCommand(secondWord, ref terminal, ref outputNode);
}
}
private static TerminalNode ExecuteProbeCommand(string secondWord, ref Terminal terminal, ref TerminalNode outputNode)
{
if (!string.IsNullOrEmpty(secondWord) && secondWord == "help")
{
return DisplayTerminalMessage($">PROBE\nSends out a weather probe to the specified moon and changes its current weather.\nIt will cost {Plugin.Config.RANDOM_PRICE.Value} Company credits for a randomized weather selection or {Plugin.Config.SPECIFIED_PRICE.Value} Company Credits when specifying the weather on a given moon.\nIt cannot change to a weather which is not possible to happen on that moon.\n");
}
return outputNode;
}
}
[DataContract]
public class PluginConfig : SyncedConfig2<PluginConfig>
{
[field: SyncedEntryField]
public SyncedEntry<int> RANDOM_PRICE { get; set; }
[field: SyncedEntryField]
public SyncedEntry<int> SPECIFIED_PRICE { get; set; }
[field: SyncedEntryField]
public SyncedEntry<bool> RANDOM_ALWAYS_CLEAR { get; set; }
public PluginConfig(ConfigFile cfg)
: base("com.github.WhiteSpike.WeatherProbe")
{
string text = "General";
RANDOM_PRICE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Price of Weather Probe", 300, "Price of the weather probe when a weather is not selected for the level");
SPECIFIED_PRICE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, text, "Price of Weather Probe with selected weather", 500, "This price is used when using the probe command with a weather");
RANDOM_ALWAYS_CLEAR = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, text, "Always pick clear weather", false, "When enabled, randomized weather probe will always clear out the weather present in the selected level");
ConfigManager.Register<PluginConfig>((SyncedConfig2<PluginConfig>)this);
}
}
internal static class Metadata
{
public const string GUID = "com.github.WhiteSpike.WeatherProbe";
public const string NAME = "Weather Probe";
public const string VERSION = "1.0.0";
}
public class WeatherProbeBehaviour : NetworkBehaviour
{
internal const string COMMAND_NAME = "Weather Probe";
internal static readonly Dictionary<string, LevelWeatherType> probedWeathers = new Dictionary<string, LevelWeatherType>();
internal static WeatherProbeBehaviour Instance { get; set; }
private static void SetInstance(WeatherProbeBehaviour instance)
{
Instance = instance;
}
private void Start()
{
SetInstance(this);
Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
}
[ServerRpc(RequireOwnership = false)]
internal void SyncWeatherServerRpc(string level, LevelWeatherType selectedWeather)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Invalid comparison between Unknown and I4
//IL_005f: 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_0088: 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_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(578768407u, val, (RpcDelivery)0);
bool flag = level != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(level, false);
}
((FastBufferWriter)(ref val2)).WriteValueSafe<LevelWeatherType>(ref selectedWeather, default(ForEnums));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 578768407u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
SyncWeatherClientRpc(level, selectedWeather);
}
}
[ClientRpc]
internal void SyncWeatherClientRpc(string level, LevelWeatherType selectedWeather)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Invalid comparison between Unknown and I4
//IL_005f: 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_0088: 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_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(748019939u, val, (RpcDelivery)0);
bool flag = level != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(level, false);
}
((FastBufferWriter)(ref val2)).WriteValueSafe<LevelWeatherType>(ref selectedWeather, default(ForEnums));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 748019939u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
SyncWeather(level, selectedWeather);
}
}
internal void SyncWeather(string level, LevelWeatherType selectedWeather)
{
//IL_0040: 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_0037: 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_0051: Unknown result type (might be due to invalid IL or missing references)
SelectableLevel[] levels = StartOfRound.Instance.levels;
SelectableLevel val = levels.First((SelectableLevel x) => x.PlanetName.Contains(level));
if (val.overrideWeather)
{
val.overrideWeatherType = selectedWeather;
}
else
{
val.currentWeather = selectedWeather;
}
probedWeathers[val.PlanetName] = selectedWeather;
if ((Object)(object)val == (Object)(object)StartOfRound.Instance.currentLevel)
{
StartOfRound.Instance.SetMapScreenInfoToCurrentLevel();
}
}
[ServerRpc(RequireOwnership = false)]
internal void SyncProbeWeathersServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2301826473u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2301826473u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
{
return;
}
foreach (string item in probedWeathers.Keys.ToList())
{
SyncWeatherClientRpc(item, probedWeathers[item]);
}
}
internal static (string, LevelWeatherType) RandomizeWeather(ref SelectableLevel level)
{
//IL_0043: 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_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: 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: Invalid comparison between Unknown and I4
//IL_00c3: 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)
if (SyncedEntry<bool>.op_Implicit(Plugin.Config.RANDOM_ALWAYS_CLEAR))
{
return (level.PlanetName, (LevelWeatherType)(-1));
}
LevelWeatherType selectedWeather = (level.overrideWeather ? level.overrideWeatherType : level.currentWeather);
LevelWeatherType[] array = (from x in level.randomWeathers
select x.weatherType into x
where x != selectedWeather
select x).ToArray();
int num = Random.Range(0, array.Length + 1);
if (num == array.Length)
{
if ((int)selectedWeather == -1)
{
LevelWeatherType item = array[Random.Range(0, array.Length)];
return (level.PlanetName, item);
}
return (level.PlanetName, (LevelWeatherType)(-1));
}
LevelWeatherType item2 = array[num];
return (level.PlanetName, item2);
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_WeatherProbeBehaviour()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(578768407u, new RpcReceiveHandler(__rpc_handler_578768407));
NetworkManager.__rpc_func_table.Add(748019939u, new RpcReceiveHandler(__rpc_handler_748019939));
NetworkManager.__rpc_func_table.Add(2301826473u, new RpcReceiveHandler(__rpc_handler_2301826473));
}
private static void __rpc_handler_578768407(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: 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_0067: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string level = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref level, false);
}
LevelWeatherType selectedWeather = default(LevelWeatherType);
((FastBufferReader)(ref reader)).ReadValueSafe<LevelWeatherType>(ref selectedWeather, default(ForEnums));
target.__rpc_exec_stage = (__RpcExecStage)1;
((WeatherProbeBehaviour)(object)target).SyncWeatherServerRpc(level, selectedWeather);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_748019939(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: 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_0067: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string level = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref level, false);
}
LevelWeatherType selectedWeather = default(LevelWeatherType);
((FastBufferReader)(ref reader)).ReadValueSafe<LevelWeatherType>(ref selectedWeather, default(ForEnums));
target.__rpc_exec_stage = (__RpcExecStage)2;
((WeatherProbeBehaviour)(object)target).SyncWeatherClientRpc(level, selectedWeather);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2301826473(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((WeatherProbeBehaviour)(object)target).SyncProbeWeathersServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "WeatherProbeBehaviour";
}
}
}
namespace WeatherProbe.Misc.Util
{
internal static class Constants
{
internal const string SELECT_WEATHER_FORMAT = "Select the available weathers for {0}:";
internal const string CURRENT_WEATHER_FORMAT = "Current weather: {0}";
internal const string CONFIRM_WEATHER_FORMAT = "Do you wish to change {0}'s weather to {1} for {2} credits?";
internal const string CONFIRM_RANDOM_WEATHER_FORMAT = "Do you wish to randomize {0}'s weather for {1} credits?";
internal const string CONFIRM_CLEAR_WEATHER_FORMAT = "Do you wish to clear {0}'s weather for {1} credits?";
internal const string WEATHER_CHANGED_FORMAT = "{0}'s weather has changed to {1}. Thank you for your purchase.";
internal const string NOT_ENOUGH_CREDITS_PROBE = "You do not have enough credits to purchase a randomized weather probe.";
internal const string NOT_ENOUGH_CREDITS_SPECIFIED_PROBE = "You do not have enough credits to purchase a specified weather probe.";
internal const string SAME_WEATHER_FORMAT = "Unable to change {0}'s weather due to already being the selected weather ({1}).";
internal const string CANCEL_PROMPT = "Abort";
internal const string WEATHER_PROBE_PRICE_KEY = "Price of Weather Probe";
internal const int WEATHER_PROBE_PRICE_DEFAULT = 300;
internal const string WEATHER_PROBE_PRICE_DESCRIPTION = "Price of the weather probe when a weather is not selected for the level";
internal const string WEATHER_PROBE_ALWAYS_CLEAR_KEY = "Always pick clear weather";
internal const bool WEATHER_PROBE_ALWAYS_CLEAR_DEFAULT = false;
internal const string WEATHER_PROBE_ALWAYS_CLEAR_DESCRIPTION = "When enabled, randomized weather probe will always clear out the weather present in the selected level";
internal const string WEATHER_PROBE_PICKED_WEATHER_PRICE_KEY = "Price of Weather Probe with selected weather";
internal const int WEATHER_PROBE_PICKED_WEATHER_PRICE_DEFAULT = 500;
internal const string WEATHER_PROBE_PICKED_WEATHER_PRICE_DESCRIPTION = "This price is used when using the probe command with a weather";
internal const string MAIN_WEATHER_PROBE_SCREEN_TITLE = "Weather Probe";
internal const string MAIN_WEATHER_PROBE_TOP_TEXT = "Select a moon you wish to alter the weather of:";
}
}
namespace WeatherProbe.Misc.UI.Application
{
internal class WeatherProbeApplication : PageApplication
{
public override void Initialization()
{
SelectableLevel[] array = StartOfRound.Instance.levels.Where((SelectableLevel x) => x.randomWeathers.Length != 0).ToArray();
(SelectableLevel[][], CursorMenu[], IScreen[]) pageEntries = ((PageApplication)this).GetPageEntries<SelectableLevel>(array);
SelectableLevel[][] item = pageEntries.Item1;
CursorMenu[] item2 = pageEntries.Item2;
IScreen[] item3 = pageEntries.Item3;
for (int i = 0; i < item.Length; i++)
{
SelectableLevel[] array2 = item[i];
CursorElement[] array3 = (CursorElement[])(object)new CursorElement[array2.Length];
item2[i] = CursorMenu.Create(0, '>', array3, (Func<CursorElement, CursorElement, int>[])null);
CursorMenu val = item2[i];
ITextElement[] array4 = (ITextElement[])(object)new ITextElement[3]
{
(ITextElement)TextElement.Create("Select a moon you wish to alter the weather of:"),
(ITextElement)TextElement.Create(" "),
(ITextElement)val
};
item3[i] = (IScreen)(object)BoxedScreen.Create("Weather Probe", array4);
for (int j = 0; j < array2.Length; j++)
{
SelectableLevel level = array2[j];
if (!((Object)(object)level == (Object)null))
{
array3[j] = CursorElement.Create(level.PlanetName, "", (Action)delegate
{
SelectedPlanet(level, ((TerminalApplication)this).PreviousScreen());
}, (Func<CursorElement, bool>)null, true);
}
}
}
base.currentPage = base.initialPage;
((BaseInteractiveApplication<CursorMenu, CursorElement>)this).currentCursorMenu = base.initialPage.GetCurrentCursorMenu();
((TerminalApplication)this).currentScreen = ((PageElement)base.initialPage).GetCurrentScreen();
}
private void SelectedPlanet(SelectableLevel level, Action cancelAction)
{
//IL_004c: 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: Expected O, but got Unknown
//IL_0059: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
//IL_007c: 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_009e: Expected O, but got Unknown
//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_00b2: Expected O, but got Unknown
//IL_00b4: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Invalid comparison between Unknown and I4
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: Expected O, but got Unknown
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Expected O, but got Unknown
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: 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_018a: Expected O, but got Unknown
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: 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_01e7: Expected O, but got Unknown
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Expected O, but got Unknown
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
//IL_0210: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Expected O, but got Unknown
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Expected O, but got Unknown
RandomWeatherWithVariables[] possibleWeathers = level.randomWeathers.Where((RandomWeatherWithVariables x) => x.weatherType != level.currentWeather).ToArray();
CursorElement[] array = (CursorElement[])(object)new CursorElement[possibleWeathers.Length + 3];
CursorMenu val = new CursorMenu();
((BaseCursorMenu<CursorElement>)val).elements = array;
CursorMenu val2 = val;
BoxedScreen val3 = new BoxedScreen();
val3.Title = level.PlanetName;
val3.elements = (ITextElement[])(object)new ITextElement[5]
{
(ITextElement)new TextElement
{
Text = $"Select the available weathers for {level.PlanetName}:"
},
(ITextElement)new TextElement
{
Text = " "
},
(ITextElement)new TextElement
{
Text = string.Format("Current weather: {0}", ((int)level.currentWeather == -1) ? "Clear" : ((object)level.currentWeather))
},
(ITextElement)new TextElement
{
Text = " "
},
(ITextElement)val2
};
IScreen val4 = (IScreen)(object)val3;
for (int i = 0; i < possibleWeathers.Length; i++)
{
RandomWeatherWithVariables weather = possibleWeathers[i];
array[i] = new CursorElement
{
Name = ((object)(LevelWeatherType)(ref weather.weatherType)).ToString(),
Action = delegate
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
BeforeChangeWeather(level, weather.weatherType);
},
Active = (CursorElement x) => CanSelectWeather(level, weather.weatherType, Plugin.Config.SPECIFIED_PRICE.Value)
};
}
array[possibleWeathers.Length] = new CursorElement
{
Name = "Clear",
Action = delegate
{
BeforeChangeWeather(level, (LevelWeatherType)(-1));
},
Active = (CursorElement x) => CanSelectWeather(level, (LevelWeatherType)(-1), SyncedEntry<bool>.op_Implicit(Plugin.Config.RANDOM_ALWAYS_CLEAR) ? Plugin.Config.RANDOM_PRICE.Value : Plugin.Config.SPECIFIED_PRICE.Value)
};
if (!SyncedEntry<bool>.op_Implicit(Plugin.Config.RANDOM_ALWAYS_CLEAR))
{
array[possibleWeathers.Length + 1] = new CursorElement
{
Name = "Random",
Action = delegate
{
BeforeRandomizeWeather(level);
},
Active = (CursorElement x) => CanSelectRandomWeather(possibleWeathers, Plugin.Config.RANDOM_PRICE.Value)
};
array[possibleWeathers.Length + 2] = new CursorElement
{
Name = "Abort",
Action = cancelAction
};
}
else
{
array[possibleWeathers.Length + 1] = new CursorElement
{
Name = "Abort",
Action = cancelAction
};
}
((BaseInteractiveApplication<CursorMenu, CursorElement>)(object)this).SwitchScreen(val4, val2, true);
}
private static bool CanSelectRandomWeather(RandomWeatherWithVariables[] weathers, int price)
{
int groupCredits = Tools.GetTerminal().groupCredits;
if (price > groupCredits)
{
return false;
}
return weathers.Length >= 1;
}
private static bool CanSelectWeather(SelectableLevel level, LevelWeatherType levelWeatherType, int price)
{
//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_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)
int groupCredits = Tools.GetTerminal().groupCredits;
if (price > groupCredits)
{
return false;
}
bool flag = level.currentWeather == levelWeatherType || (level.overrideWeather && level.overrideWeatherType == levelWeatherType);
return !flag;
}
private void BeforeChangeWeather(SelectableLevel level, LevelWeatherType type)
{
//IL_0015: 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_0069: 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_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Invalid comparison between Unknown and I4
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Invalid comparison between Unknown and I4
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
int groupCredits = ((TerminalApplication)this).terminal.groupCredits;
if (groupCredits < Plugin.Config.SPECIFIED_PRICE.Value)
{
((InteractiveTerminalApplication)this).ErrorMessage(level.PlanetName, ((TerminalApplication)this).PreviousScreen(), "You do not have enough credits to purchase a specified weather probe.");
return;
}
if (level.currentWeather == type || (level.overrideWeather && level.overrideWeatherType == type))
{
((InteractiveTerminalApplication)this).ErrorMessage(level.PlanetName, ((TerminalApplication)this).PreviousScreen(), string.Format("Unable to change {0}'s weather due to already being the selected weather ({1}).", level.PlanetName, ((int)type == -1) ? "clear" : ((object)type)));
return;
}
int num = (((int)type == -1 && SyncedEntry<bool>.op_Implicit(Plugin.Config.RANDOM_ALWAYS_CLEAR)) ? Plugin.Config.RANDOM_PRICE.Value : Plugin.Config.SPECIFIED_PRICE.Value);
((InteractiveTerminalApplication)this).Confirm(level.PlanetName, $"Do you wish to change {level.PlanetName}'s weather to {type} for {num} credits?", (Action)delegate
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
ChangeWeather(level, type);
}, ((TerminalApplication)this).PreviousScreen(), "");
}
private void ChangeWeather(SelectableLevel level, LevelWeatherType weatherType)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Invalid comparison between Unknown and I4
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Expected O, but got Unknown
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Expected O, but got Unknown
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Invalid comparison between Unknown and I4
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Expected O, but got Unknown
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Expected O, but got Unknown
int num = (((int)weatherType == -1 && SyncedEntry<bool>.op_Implicit(Plugin.Config.RANDOM_ALWAYS_CLEAR)) ? Plugin.Config.RANDOM_PRICE.Value : Plugin.Config.SPECIFIED_PRICE.Value);
Terminal terminal = ((TerminalApplication)this).terminal;
terminal.groupCredits -= num;
((TerminalApplication)this).terminal.SyncGroupCreditsServerRpc(((TerminalApplication)this).terminal.groupCredits, ((TerminalApplication)this).terminal.numberOfItemsInDropship);
WeatherProbeBehaviour.Instance.SyncWeatherServerRpc(level.PlanetName, weatherType);
CursorElement val = new CursorElement
{
Name = "Exit",
Action = ((TerminalApplication)this).PreviousScreen()
};
CursorMenu val2 = new CursorMenu();
((BaseCursorMenu<CursorElement>)(object)val2).elements = (CursorElement[])(object)new CursorElement[1] { val };
CursorMenu val3 = val2;
BoxedScreen val4 = new BoxedScreen();
val4.Title = level.PlanetName;
val4.elements = (ITextElement[])(object)new ITextElement[3]
{
(ITextElement)new TextElement
{
Text = string.Format("{0}'s weather has changed to {1}. Thank you for your purchase.", level.PlanetName, ((int)weatherType == -1) ? "clear" : ((object)weatherType))
},
(ITextElement)new TextElement
{
Text = " "
},
(ITextElement)val3
};
IScreen val5 = (IScreen)(object)val4;
((BaseInteractiveApplication<CursorMenu, CursorElement>)(object)this).SwitchScreen(val5, val3, false);
}
private void BeforeRandomizeWeather(SelectableLevel level)
{
int groupCredits = Tools.GetTerminal().groupCredits;
if (groupCredits < Plugin.Config.RANDOM_PRICE.Value)
{
((InteractiveTerminalApplication)this).ErrorMessage(level.PlanetName, ((TerminalApplication)this).PreviousScreen(), "You do not have enough credits to purchase a randomized weather probe.");
return;
}
((InteractiveTerminalApplication)this).Confirm(level.PlanetName, $"Do you wish to randomize {level.PlanetName}'s weather for {Plugin.Config.RANDOM_PRICE.Value} credits?", (Action)delegate
{
RandomizeWeather(level);
}, ((TerminalApplication)this).PreviousScreen(), "");
}
private void RandomizeWeather(SelectableLevel level)
{
//IL_0058: 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_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Expected O, but got Unknown
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Expected O, but got Unknown
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Expected O, but got Unknown
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Expected O, but got Unknown
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Expected O, but got Unknown
(string, LevelWeatherType) tuple = WeatherProbeBehaviour.RandomizeWeather(ref level);
Terminal terminal = ((TerminalApplication)this).terminal;
terminal.groupCredits -= Plugin.Config.RANDOM_PRICE.Value;
((TerminalApplication)this).terminal.SyncGroupCreditsServerRpc(((TerminalApplication)this).terminal.groupCredits, ((TerminalApplication)this).terminal.numberOfItemsInDropship);
WeatherProbeBehaviour.Instance.SyncWeatherServerRpc(level.PlanetName, tuple.Item2);
CursorElement val = new CursorElement
{
Name = "Exit",
Action = ((TerminalApplication)this).PreviousScreen()
};
CursorMenu val2 = new CursorMenu();
((BaseCursorMenu<CursorElement>)(object)val2).elements = (CursorElement[])(object)new CursorElement[1] { val };
CursorMenu val3 = val2;
BoxedScreen val4 = new BoxedScreen();
val4.Title = level.PlanetName;
val4.elements = (ITextElement[])(object)new ITextElement[3]
{
(ITextElement)new TextElement
{
Text = $"{level.PlanetName}'s weather has changed to {tuple.Item2}. Thank you for your purchase."
},
(ITextElement)new TextElement
{
Text = " "
},
(ITextElement)val3
};
IScreen val5 = (IScreen)(object)val4;
((BaseInteractiveApplication<CursorMenu, CursorElement>)(object)this).SwitchScreen(val5, val3, false);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace WeatherProbe.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}