Decompiled source of FFU Core v0.5.520
monomod/Assembly-CSharp.FFU_BR.mm.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using FFU_Beyond_Reach; using LitJson; using Microsoft.CodeAnalysis; using MonoMod; using Ostranauts.Core; using Ostranauts.Tools; using Ostranauts.Utils.Models; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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; } } } public class patch_JsonModInfo : JsonModInfo { public Dictionary<string, string[]> removeIds { get; set; } public Dictionary<string, Dictionary<string, string[]>> changesMap { get; set; } } public static class patch_DataHandler { public enum SyncArrayOp { None, Mod, Add, Ins, Del } public static string strModsPath = string.Empty; public static Dictionary<string, Dictionary<string, List<string>>> dictChangesMap; public static List<string> listLockedCOs = new List<string>(); [MonoModIgnore] public static Dictionary<string, patch_JsonModInfo> dictModInfos; public const string OP_MOD = "--MOD--"; public const string OP_ADD = "--ADD--"; public const string OP_INS = "--INS--"; public const string OP_DEL = "--DEL--"; [MonoModReplace] public static void Init() { //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_01d6: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Expected O, but got Unknown //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Expected O, but got Unknown //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Expected O, but got Unknown //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Expected O, but got Unknown //IL_0760: Unknown result type (might be due to invalid IL or missing references) //IL_0767: Expected O, but got Unknown //IL_05f9: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Expected O, but got Unknown DataHandler.loadLog.Length = 0; DataHandler.loadLogError.Length = 0; DataHandler.loadLogWarning.Length = 0; if (DataHandler.bInitialised) { List<CondOwner> list = new List<CondOwner>(DataHandler.mapCOs.Values); foreach (CondOwner item in list) { if (!((Object)(object)item == (Object)null)) { DataHandler.loadLogWarning.Append("Destroying leftover CO: "); DataHandler.loadLogWarning.Append(item.strName); DataHandler.loadLogWarning.AppendLine(); item.Destroy(); } } list.Clear(); list = null; DataHandler.mapCOs.Clear(); if (DataHandler.loadLogWarning.Length > 0) { Debug.LogWarning((object)DataHandler.loadLogWarning.ToString()); } return; } DataHandler.strAssetPath = Application.streamingAssetsPath + "/"; DataHandler.LoadBuildVersion(); TextAsset val = (TextAsset)Resources.Load("version", typeof(TextAsset)); Debug.Log((object)("Early Access Build: " + (((int)val != 0) ? val.text : null))); FFU_BR_Defs.InitConfig(); if (Object.op_Implicit((Object)(object)ObjReader.use)) { ObjReader.use.scaleFactor = new Vector3(0.0625f, 0.0625f, 0.0625f); ObjReader.use.objRotation = new Vector3(90f, 0f, 180f); } dictChangesMap = new Dictionary<string, Dictionary<string, List<string>>>(); DataHandler.SetupDicts(); if (DataHandler._interactionObjectTracker == null) { DataHandler._interactionObjectTracker = new InteractionObjectTracker(); } DataHandler.dictSettings["DefaultUserSettings"] = new JsonUserSettings(); DataHandler.dictSettings["DefaultUserSettings"].Init(); if (File.Exists(Application.persistentDataPath + "/settings.json")) { DataHandler.JsonToData<JsonUserSettings>(Application.persistentDataPath + "/settings.json", DataHandler.dictSettings); } else { DataHandler.loadLogWarning.Append("WARNING: settings.json not found. Resorting to default values."); DataHandler.loadLogWarning.AppendLine(); DataHandler.dictSettings["UserSettings"] = new JsonUserSettings(); DataHandler.dictSettings["UserSettings"].Init(); } if (!DataHandler.dictSettings.ContainsKey("UserSettings") || DataHandler.dictSettings["UserSettings"] == null) { DataHandler.loadLogError.Append("ERROR: Malformed settings.json. Resorting to default values."); DataHandler.loadLogError.AppendLine(); DataHandler.dictSettings["UserSettings"] = new JsonUserSettings(); DataHandler.dictSettings["UserSettings"].Init(); } DataHandler.dictSettings["DefaultUserSettings"].CopyTo(DataHandler.GetUserSettings()); DataHandler.dictSettings.Remove("DefaultUserSettings"); DataHandler.SaveUserSettings(); bool flag = false; DataHandler.strModFolder = DataHandler.dictSettings["UserSettings"].strPathMods; if (DataHandler.strModFolder == null || DataHandler.strModFolder == string.Empty) { DataHandler.strModFolder = Path.Combine(Application.dataPath, "Mods/"); DataHandler.loadLogWarning.Append("WARNING: Unrecognized mod folder. Setting mod path to "); DataHandler.loadLogWarning.Append(DataHandler.strModFolder); DataHandler.loadLogWarning.AppendLine(); } strModsPath = DataHandler.strModFolder.Replace("loading_order.json", string.Empty); string directoryName = Path.GetDirectoryName(DataHandler.strModFolder); directoryName = Path.Combine(directoryName, "loading_order.json"); JsonModInfo val2 = new JsonModInfo(); val2.strName = "Core"; DataHandler.dictModInfos["core"] = val2; bool flag2 = (Object)(object)ConsoleToGUI.instance != (Object)null; if (flag2) { ConsoleToGUI.instance.LogInfo("Attempting to load " + directoryName + "..."); } if (File.Exists(directoryName)) { if (flag2) { ConsoleToGUI.instance.LogInfo("loading_order.json found. Beginning mod load."); } DataHandler.JsonToData<JsonModList>(directoryName, DataHandler.dictModList); JsonModList value = null; if (DataHandler.dictModList.TryGetValue("Mod Loading Order", out value)) { if (value.aIgnorePatterns != null) { for (int i = 0; i < value.aIgnorePatterns.Length; i++) { value.aIgnorePatterns[i] = DataHandler.PathSanitize(value.aIgnorePatterns[i]); } } string[] aLoadOrder = value.aLoadOrder; string[] array = aLoadOrder; foreach (string text in array) { flag = true; if (text.IsCoreEntry()) { string text2 = "Loading core files: " + DataHandler.strAssetPath; DataHandler.loadLog.Append(text2); DataHandler.loadLog.AppendLine(); Debug.Log((object)("#Info# " + text2)); continue; } if (text == null || text == string.Empty) { DataHandler.loadLogError.Append("ERROR! Invalid mod folder specified: "); DataHandler.loadLogError.Append(text); DataHandler.loadLogError.Append("; Skipping..."); DataHandler.loadLogError.AppendLine(); continue; } string text3 = text.TrimStart(new char[1] { Path.DirectorySeparatorChar }); text3 = text.TrimStart(new char[1] { Path.AltDirectorySeparatorChar }) + "/"; string directoryName2 = Path.GetDirectoryName(DataHandler.strModFolder); directoryName2 = Path.Combine(directoryName2, text3); Dictionary<string, JsonModInfo> dictionary = new Dictionary<string, JsonModInfo>(); string text4 = Path.Combine(directoryName2, "mod_info.json"); if (File.Exists(text4)) { DataHandler.JsonToData<JsonModInfo>(text4, dictionary); } if (dictionary.Count < 1) { JsonModInfo val3 = new JsonModInfo(); val3.strName = text; dictionary[val3.strName] = val3; DataHandler.loadLogWarning.Append("WARNING: Missing mod_info.json in folder: "); DataHandler.loadLogWarning.Append(text); DataHandler.loadLogWarning.Append("; Using default name: "); DataHandler.loadLogWarning.Append(val3.strName); DataHandler.loadLogWarning.AppendLine(); } using Dictionary<string, JsonModInfo>.ValueCollection.Enumerator enumerator2 = dictionary.Values.GetEnumerator(); if (enumerator2.MoveNext()) { JsonModInfo current2 = enumerator2.Current; DataHandler.dictModInfos[text] = current2; string text5 = "Loading mod '" + DataHandler.dictModInfos[text].strName + "' from directory: " + text; if (flag2) { ConsoleToGUI.instance.LogInfo(text5); } else { Debug.Log((object)("#Info# " + text5)); } } } } SyncLoadMods(value.aIgnorePatterns); } if (!flag) { string text6 = "No loading_order.json found. Loading default game data from " + DataHandler.strAssetPath; if (flag2) { ConsoleToGUI.instance.LogInfo(text6); } Debug.Log((object)("#Info# " + text6)); JsonModList val4 = new JsonModList(); val4.strName = "Default"; val4.aLoadOrder = new string[1] { "core" }; val4.aIgnorePatterns = new string[0]; DataHandler.dictModList["Mod Loading Order"] = val4; SyncLoadMods(val4.aIgnorePatterns); } if (FFU_BR_Defs.ModSyncLoading) { foreach (KeyValuePair<string, JsonShip> dictShip in DataHandler.dictShips) { SwitchSlottedItems(dictShip.Value, isTemplate: true); RecoverMissingItems(dictShip.Value); } } Application.SetStackTraceLogType((LogType)3, (StackTraceLogType)0); if (DataHandler.loadLog.Length > 0) { Debug.Log((object)DataHandler.loadLog.ToString()); } Application.SetStackTraceLogType((LogType)3, (StackTraceLogType)1); if (DataHandler.loadLogWarning.Length > 0) { Debug.LogWarning((object)DataHandler.loadLogWarning.ToString()); } if (DataHandler.loadLogError.Length > 0) { Debug.LogError((object)DataHandler.loadLogError.ToString()); } DataHandler.bInitialised = true; if (DataHandler.InitComplete != null) { DataHandler.InitComplete(); } } private static void SyncLoadMods(string[] aIgnorePatterns) { //IL_1b7c: Unknown result type (might be due to invalid IL or missing references) //IL_1b82: Invalid comparison between Unknown and I4 foreach (KeyValuePair<string, JsonModInfo> dictModInfo in DataHandler.dictModInfos) { if (!dictModInfo.Key.IsCoreEntry()) { string text = Path.Combine(strModsPath, dictModInfo.Key); if (Directory.Exists(Path.Combine(text, "data/"))) { Debug.Log((object)("Data Mod Queued: " + dictModInfo.Key + " => " + text)); } else if (Directory.GetDirectories(text).Length != 0) { Debug.Log((object)("Asset Mod Queued: " + dictModInfo.Key + " => " + text)); } else if (File.Exists(Path.Combine(text, "mod_info.json"))) { Debug.Log((object)("Patch Mod Queued: " + dictModInfo.Key + " => " + text)); } else { Debug.LogWarning((object)("Attempted to queue invalid mod: " + dictModInfo.Key)); } } } bool flag = (Object)(object)ConsoleToGUI.instance != (Object)null; int num = 0; if (flag) { num = ConsoleToGUI.instance.ErrorCount; ConsoleToGUI.instance.LogInfo("Begin loading data from these paths:"); foreach (KeyValuePair<string, JsonModInfo> dictModInfo2 in DataHandler.dictModInfos) { if (!dictModInfo2.Key.IsCoreEntry()) { string path = Path.Combine(strModsPath, dictModInfo2.Key); string text2 = Path.Combine(path, "data/"); if (Directory.Exists(text2)) { ConsoleToGUI.instance.LogInfo(text2); } } } } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo3 in dictModInfos) { if (dictModInfo3.Key.IsCoreEntry() || dictModInfo3.Value?.changesMap == null) { continue; } foreach (KeyValuePair<string, Dictionary<string, string[]>> item in dictModInfo3.Value.changesMap) { if (!dictChangesMap.ContainsKey(item.Key)) { dictChangesMap[item.Key] = new Dictionary<string, List<string>>(); } if (item.Value == null) { continue; } foreach (KeyValuePair<string, string[]> item2 in item.Value) { bool flag2 = item2.Key.StartsWith("!"); string text3 = (flag2 ? item2.Key.Substring(1) : item2.Key); if (text3 != "~") { if (!dictChangesMap[item.Key].ContainsKey(text3)) { dictChangesMap[item.Key][text3] = new List<string>(); } if (flag2 && !dictChangesMap[item.Key][text3].Contains("*IsInverse*")) { dictChangesMap[item.Key][text3].Add("*IsInverse*"); } if (item2.Value == null || item2.Value.Length == 0) { continue; } if (item2.Value[0] != "~") { string[] value = item2.Value; foreach (string text4 in value) { if (text4.StartsWith("-")) { string cleanEntry = text4.Substring(1); string text5 = dictChangesMap[item.Key][text3].Find((string x) => x.StartsWith(cleanEntry)); if (!string.IsNullOrEmpty(text5)) { dictChangesMap[item.Key][text3].Remove(text5); } } else if (text4.StartsWith("*")) { string text6 = text4.Substring(1); string lookupKey = (text6.Contains("|") ? text6.Split(new char[1] { "|"[0] })[0] : (text6.Contains("=") ? text6.Split(new char[1] { "="[0] })[0] : text6)); string text7 = dictChangesMap[item.Key][text3].Find((string x) => x.StartsWith(lookupKey)); if (!string.IsNullOrEmpty(text7)) { int index = dictChangesMap[item.Key][text3].IndexOf(text7); dictChangesMap[item.Key][text3][index] = text6; } } else { dictChangesMap[item.Key][text3].Add(text4); } } } else { dictChangesMap[item.Key].Remove(text3); } } else { dictChangesMap.Remove(item.Key); if (item.Value.Count <= 1) { break; } dictChangesMap[item.Key] = new Dictionary<string, List<string>>(); } } } } if (FFU_BR_Defs.SyncLogging >= FFU_BR_Defs.SyncLogs.ModdedDump) { Debug.Log((object)("Dynamic Changes Map (Dump): " + JsonMapper.ToJson((object)dictChangesMap))); } foreach (KeyValuePair<string, JsonModInfo> dictModInfo4 in DataHandler.dictModInfos) { if (dictModInfo4.Key.IsCoreEntry()) { DataHandler.aModPaths.Insert(0, DataHandler.strAssetPath); } else { DataHandler.aModPaths.Insert(0, Path.Combine(strModsPath, dictModInfo4.Key) + "/"); } } Dictionary<string, JsonSimple> dictionary = new Dictionary<string, JsonSimple>(); Dictionary<string, JsonSimple> dictionary2 = new Dictionary<string, JsonSimple>(); Dictionary<string, JsonSimple> dictionary3 = new Dictionary<string, JsonSimple>(); Dictionary<string, JsonSimple> dictionary4 = new Dictionary<string, JsonSimple>(); Dictionary<string, JsonSimple> dictionary5 = new Dictionary<string, JsonSimple>(); Dictionary<string, JsonSimple> dictionary6 = new Dictionary<string, JsonSimple>(); Dictionary<string, JsonSimple> dictionary7 = new Dictionary<string, JsonSimple>(); Dictionary<string, JsonSimple> dictionary8 = new Dictionary<string, JsonSimple>(); Dictionary<string, JsonSimple> dataDict = new Dictionary<string, JsonSimple>(); Dictionary<string, JsonSimple> dictionary9 = new Dictionary<string, JsonSimple>(); Dictionary<string, JsonSimple> dictionary10 = new Dictionary<string, JsonSimple>(); Dictionary<string, JsonSimple> dictionary11 = new Dictionary<string, JsonSimple>(); foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo5 in dictModInfos) { SyncLoadJSONs(dictModInfo5, "ships/", DataHandler.dictShips, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo6 in dictModInfos) { SyncLoadJSONs(dictModInfo6, "ads/", DataHandler.dictAds, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo7 in dictModInfos) { SyncLoadJSONs(dictModInfo7, "ai_training/", DataHandler.dictAIPersonalities, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo8 in dictModInfos) { SyncLoadJSONs(dictModInfo8, "attackmodes/", DataHandler.dictAModes, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo9 in dictModInfos) { SyncLoadJSONs(dictModInfo9, "audioemitters/", DataHandler.dictAudioEmitters, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo10 in dictModInfos) { SyncLoadJSONs(dictModInfo10, "careers/", DataHandler.dictCareers, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo11 in dictModInfos) { SyncLoadJSONs(dictModInfo11, "chargeprofiles/", DataHandler.dictChargeProfiles, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo12 in dictModInfos) { SyncLoadJSONs(dictModInfo12, "colors/", DataHandler.dictJsonColors, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo13 in dictModInfos) { SyncLoadJSONs(dictModInfo13, "conditions/", DataHandler.dictConds, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo14 in dictModInfos) { SyncLoadJSONs(dictModInfo14, "conditions_simple/", dictionary, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo15 in dictModInfos) { SyncLoadJSONs(dictModInfo15, "condowners/", DataHandler.dictCOs, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo16 in dictModInfos) { SyncLoadJSONs(dictModInfo16, "condrules/", DataHandler.dictCondRules, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo17 in dictModInfos) { SyncLoadJSONs(dictModInfo17, "condtrigs/", DataHandler.dictCTs, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo18 in dictModInfos) { SyncLoadJSONs(dictModInfo18, "context/", DataHandler.dictContext, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo19 in dictModInfos) { SyncLoadJSONs(dictModInfo19, "cooverlays/", DataHandler.dictCOOverlays, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo20 in dictModInfos) { SyncLoadJSONs(dictModInfo20, "crewskins/", dictionary2, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo21 in dictModInfos) { SyncLoadJSONs(dictModInfo21, "crime/", DataHandler.dictCrimes, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo22 in dictModInfos) { SyncLoadJSONs(dictModInfo22, "gasrespires/", DataHandler.dictGasRespires, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo23 in dictModInfos) { SyncLoadJSONs(dictModInfo23, "guipropmaps/", DataHandler.dictGUIPropMapUnparsed, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo24 in dictModInfos) { SyncLoadJSONs(dictModInfo24, "headlines/", DataHandler.dictHeadlines, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo25 in dictModInfos) { SyncLoadJSONs(dictModInfo25, "homeworlds/", DataHandler.dictHomeworlds, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo26 in dictModInfos) { SyncLoadJSONs(dictModInfo26, "info/", DataHandler.dictInfoNodes, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo27 in dictModInfos) { SyncLoadJSONs(dictModInfo27, "installables/", DataHandler.dictInstallables, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo28 in dictModInfos) { SyncLoadJSONs(dictModInfo28, "interaction_overrides/", DataHandler.dictIAOverrides, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo29 in dictModInfos) { SyncLoadJSONs(dictModInfo29, "interactions/", DataHandler.dictInteractions, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo30 in dictModInfos) { SyncLoadJSONs(dictModInfo30, "items/", DataHandler.dictItemDefs, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo31 in dictModInfos) { SyncLoadJSONs(dictModInfo31, "jobitems/", DataHandler.dictJobitems, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo32 in dictModInfos) { SyncLoadJSONs(dictModInfo32, "jobs/", DataHandler.dictJobs, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo33 in dictModInfos) { SyncLoadJSONs(dictModInfo33, "ledgerdefs/", DataHandler.dictLedgerDefs, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo34 in dictModInfos) { SyncLoadJSONs(dictModInfo34, "lifeevents/", DataHandler.dictLifeEvents, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo35 in dictModInfos) { SyncLoadJSONs(dictModInfo35, "lights/", DataHandler.dictLights, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo36 in dictModInfos) { SyncLoadJSONs(dictModInfo36, "loot/", DataHandler.dictLoot, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo37 in dictModInfos) { SyncLoadJSONs(dictModInfo37, "manpages/", dictionary3, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo38 in dictModInfos) { SyncLoadJSONs(dictModInfo38, "market/", DataHandler.dictMarketConfigs, aIgnorePatterns, topOnly: true); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo39 in dictModInfos) { SyncLoadJSONs(dictModInfo39, "market/CoCollections/", DataHandler.dictSupersTemp, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo40 in dictModInfos) { SyncLoadJSONs(dictModInfo40, "market/Production/", DataHandler.dictProductionMaps, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo41 in dictModInfos) { SyncLoadJSONs(dictModInfo41, "market/CargoSpecs/", DataHandler.dictCargoSpecs, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo42 in dictModInfos) { SyncLoadJSONs(dictModInfo42, "music/", DataHandler.dictMusic, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo43 in dictModInfos) { SyncLoadJSONs(dictModInfo43, "names_first/", dictionary4, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo44 in dictModInfos) { SyncLoadJSONs(dictModInfo44, "names_full/", dictionary5, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo45 in dictModInfos) { SyncLoadJSONs(dictModInfo45, "names_last/", dictionary6, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo46 in dictModInfos) { SyncLoadJSONs(dictModInfo46, "names_robots/", dictionary7, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo47 in dictModInfos) { SyncLoadJSONs(dictModInfo47, "names_ship/", dictionary8, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo48 in dictModInfos) { SyncLoadJSONs(dictModInfo48, "names_ship_adjectives/", dataDict, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo49 in dictModInfos) { SyncLoadJSONs(dictModInfo49, "names_ship_nouns/", dictionary9, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo50 in dictModInfos) { SyncLoadJSONs(dictModInfo50, "parallax/", DataHandler.dictParallax, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo51 in dictModInfos) { SyncLoadJSONs(dictModInfo51, "pda_apps/", DataHandler.dictPDAAppIcons, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo52 in dictModInfos) { SyncLoadJSONs(dictModInfo52, "personspecs/", DataHandler.dictPersonSpecs, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo53 in dictModInfos) { SyncLoadJSONs(dictModInfo53, "pledges/", DataHandler.dictPledges, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo54 in dictModInfos) { SyncLoadJSONs(dictModInfo54, "plot_beat_overrides/", DataHandler.dictPlotBeatOverrides, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo55 in dictModInfos) { SyncLoadJSONs(dictModInfo55, "plot_beats/", DataHandler.dictPlotBeats, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo56 in dictModInfos) { SyncLoadJSONs(dictModInfo56, "plot_manager/", DataHandler.dictPlotManager, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo57 in dictModInfos) { SyncLoadJSONs(dictModInfo57, "plots/", DataHandler.dictPlots, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo58 in dictModInfos) { SyncLoadJSONs(dictModInfo58, "powerinfos/", DataHandler.dictPowerInfo, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo59 in dictModInfos) { SyncLoadJSONs(dictModInfo59, "racing/leagues/", DataHandler.dictRacingLeagues, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo60 in dictModInfos) { SyncLoadJSONs(dictModInfo60, "racing/tracks/", DataHandler.dictRaceTracks, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo61 in dictModInfos) { SyncLoadJSONs(dictModInfo61, "rooms/", DataHandler.dictRoomSpecsTemp, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo62 in dictModInfos) { SyncLoadJSONs(dictModInfo62, "shipspecs/", DataHandler.dictShipSpecs, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo63 in dictModInfos) { SyncLoadJSONs(dictModInfo63, "slot_effects/", DataHandler.dictSlotEffects, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo64 in dictModInfos) { SyncLoadJSONs(dictModInfo64, "slots/", DataHandler.dictSlots, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo65 in dictModInfos) { SyncLoadJSONs(dictModInfo65, "star_systems/", DataHandler.dictStarSystems, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo66 in dictModInfos) { SyncLoadJSONs(dictModInfo66, "strings/", dictionary10, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo67 in dictModInfos) { SyncLoadJSONs(dictModInfo67, "tickers/", DataHandler.dictTickers, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo68 in dictModInfos) { SyncLoadJSONs(dictModInfo68, "tips/", DataHandler.dictTips, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo69 in dictModInfos) { SyncLoadJSONs(dictModInfo69, "tokens/", DataHandler.dictJsonTokens, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo70 in dictModInfos) { SyncLoadJSONs(dictModInfo70, "traitscores/", dictionary11, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo71 in dictModInfos) { SyncLoadJSONs(dictModInfo71, "transit/", DataHandler.dictTransit, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo72 in dictModInfos) { SyncLoadJSONs(dictModInfo72, "verbs/", DataHandler.dictJsonVerbs, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo73 in dictModInfos) { SyncLoadJSONs(dictModInfo73, "wounds/", DataHandler.dictWounds, aIgnorePatterns); } foreach (KeyValuePair<string, patch_JsonModInfo> dictModInfo74 in dictModInfos) { SyncLoadJSONs(dictModInfo74, "zone_triggers/", DataHandler.dictZoneTriggers, aIgnorePatterns); } DataHandler.ParseGUIPropMaps(); DataHandler.ParseConditionsSimple(dictionary); DataHandler.ParseTraitScores(dictionary11); DataHandler.ParseSimpleIntoStringDict(dictionary10, DataHandler.dictStrings); DataHandler.ParseSimpleIntoStringDict(dictionary2, DataHandler.dictCrewSkins); DataHandler.ParseSimpleIntoStringDict(dictionary4, DataHandler.dictNamesFirst); DataHandler.ParseSimpleIntoStringDict(dictionary5, DataHandler.dictNamesFull); DataHandler.ParseSimpleIntoStringDict(dictionary6, DataHandler.dictNamesLast); DataHandler.ParseSimpleIntoStringDict(dictionary7, DataHandler.dictNamesRobots); DataHandler.ParseSimpleIntoStringDict(dictionary8, DataHandler.dictNamesShip); DataHandler.ParseSimpleIntoStringDict(dictionary9, DataHandler.dictNamesShipNouns); DataHandler.ParseManPages(dictionary3); DataHandler.ParseMusic(); foreach (KeyValuePair<string, JsonCondOwner> dictCO in DataHandler.dictCOs) { if (dictCO.Value.bSlotLocked) { listLockedCOs.Add(dictCO.Value.strName); } } foreach (KeyValuePair<string, JsonModInfo> dictModInfo75 in DataHandler.dictModInfos) { if ((int)dictModInfo75.Value.Status == 0) { dictModInfo75.Value.Status = (ModStatus)0; } else if (Object.op_Implicit((Object)(object)ConsoleToGUI.instance) && num < ConsoleToGUI.instance.ErrorCount) { dictModInfo75.Value.Status = (ModStatus)2; } else { dictModInfo75.Value.Status = (ModStatus)1; } } } private static void SyncLoadJSONs<TJson>(KeyValuePair<string, patch_JsonModInfo> refModInfo, string subFolder, Dictionary<string, TJson> dataDict, string[] aIgnorePatterns, bool topOnly = false) { bool flag = !refModInfo.Key.IsCoreEntry(); string text = subFolder.Remove(subFolder.Length - 1); string path = Path.Combine(flag ? Path.Combine(strModsPath, refModInfo.Key) : DataHandler.strAssetPath, "data/"); if (refModInfo.Value?.removeIds != null && refModInfo.Value.removeIds.ContainsKey(text)) { string[] array = refModInfo.Value.removeIds[text]; foreach (string text2 in array) { if (dataDict.Remove(text2)) { Debug.Log((object)("Removed existing '" + text + "' entry: " + text2)); } } } string path2 = Path.Combine(path, subFolder); if (!Directory.Exists(path2)) { return; } string[] files = Directory.GetFiles(path2, "*.json", (!topOnly) ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly); string[] array2 = files; foreach (string text3 in array2) { string text4 = DataHandler.PathSanitize(text3); bool flag2 = false; if (aIgnorePatterns != null) { foreach (string value in aIgnorePatterns) { if (text4.IndexOf(value) >= 0) { flag2 = true; break; } } } if (flag2) { Debug.LogWarning((object)("Ignore Pattern match: " + text4 + "; Skipping...")); } else { SyncToData(text4, text, flag, dataDict, text.IsExtedable()); } } } public static void SyncToData<TJson>(string strFile, string strType, bool isMod, Dictionary<string, TJson> dataDict, bool extData) { Debug.Log((object)("#Info# Loading JSON: " + strFile)); bool doLog = FFU_BR_Defs.SyncLogging >= FFU_BR_Defs.SyncLogs.ModChanges; bool flag = FFU_BR_Defs.SyncLogging >= FFU_BR_Defs.SyncLogs.DeepCopy; bool flag2 = FFU_BR_Defs.SyncLogging >= FFU_BR_Defs.SyncLogs.ModdedDump; bool flag3 = FFU_BR_Defs.SyncLogging >= FFU_BR_Defs.SyncLogs.ExtendedDump; bool flag4 = FFU_BR_Defs.SyncLogging >= FFU_BR_Defs.SyncLogs.ContentDump; bool flag5 = FFU_BR_Defs.SyncLogging >= FFU_BR_Defs.SyncLogs.SourceDump; string text = string.Empty; try { string text2 = File.ReadAllText(strFile, Encoding.UTF8); text += "Converting JSON into Array...\n"; string[] array = (isMod ? text2.Compressed().Split(new string[1] { "},{" }, StringSplitOptions.None) : null); TJson[] array2 = JsonMapper.ToObject<TJson[]>(text2); for (int i = 0; i < array2.Length; i++) { TJson val = array2[i]; string rawDataSet = (isMod ? array[i] : null); text += "Getting key: "; string text3 = null; string dataKey = null; PropertyInfo propertyInfo = val.GetType()?.GetProperty("strReference"); PropertyInfo propertyInfo2 = val.GetType()?.GetProperty("strName"); if ((object)propertyInfo2 == null) { JsonLogger.ReportProblem("strName is missing", (ReportTypes)1); continue; } object obj = propertyInfo?.GetValue(val, null); object value = propertyInfo2.GetValue(val, null); text3 = obj?.ToString(); dataKey = value.ToString(); text = text + dataKey + "\n"; if (isMod && dataDict.ContainsKey(dataKey)) { if (flag2) { Debug.Log((object)("Modification Data (Dump/Before): " + JsonMapper.ToJson((object)dataDict[dataKey]))); } try { SyncDataSafe(dataDict[dataKey], val, ref rawDataSet, strType, dataKey, extData, doLog); if (flag2) { Debug.Log((object)("Modification Data (Dump/After): " + JsonMapper.ToJson((object)dataDict[dataKey]))); } } catch (Exception ex) { Exception innerException = ex.InnerException; Debug.LogWarning((object)("Modification sync for Data Block [" + dataKey + "] has failed! Ignoring.\n" + ex.Message + "\n" + ex.StackTrace + ((innerException != null) ? ("\nInner: " + innerException.Message + "\n" + innerException.StackTrace) : ""))); } continue; } if (isMod && !dataDict.ContainsKey(dataKey)) { if (text3 != null && dataDict.ContainsKey(text3)) { string text4 = JsonMapper.ToJson((object)dataDict[text3]); if (flag3) { Debug.Log((object)("Reference Data (Dump/Before): " + text4)); } bool isDeepCopySuccess = false; text4 = Regex.Replace(text4, "(\"strName\":)\"[^\"]*\"", delegate(Match match) { isDeepCopySuccess = true; return match.Groups[1].Value + "\"" + dataKey + "\""; }); if (!isDeepCopySuccess) { continue; } TJson val2 = JsonMapper.ToObject<TJson>(text4); if (flag) { Debug.Log((object)("#Info# Modified Deep Copy Created: " + text3 + " => " + dataKey)); } try { SyncDataSafe(val2, val, ref rawDataSet, strType, dataKey, extData, flag); if (flag3) { Debug.Log((object)("Reference Data (Dump/After): " + JsonMapper.ToJson((object)val2))); } } catch (Exception ex2) { Exception innerException2 = ex2.InnerException; Debug.LogWarning((object)("Reference sync for Data Block [" + dataKey + "] has failed! Ignoring.\n" + ex2.Message + "\n" + ex2.StackTrace + ((innerException2 != null) ? ("\nInner: " + innerException2.Message + "\n" + innerException2.StackTrace) : ""))); } try { dataDict.Add(dataKey, val2); } catch (Exception ex3) { Exception innerException3 = ex3.InnerException; Debug.LogWarning((object)("Reference add of new Data Block [" + dataKey + "] has failed! Ignoring.\n" + ex3.Message + "\n" + ex3.StackTrace + ((innerException3 != null) ? ("\nInner: " + innerException3.Message + "\n" + innerException3.StackTrace) : ""))); } continue; } if (!string.IsNullOrEmpty(text3)) { Debug.LogWarning((object)("Reference key '" + text3 + "' in Data Block [" + dataKey + "] is invalid! Ignoring.")); continue; } if (flag4) { try { Debug.Log((object)("Addendum Data (Dump/Mod): " + JsonMapper.ToJson((object)val))); } catch (Exception ex4) { Exception innerException4 = ex4.InnerException; Debug.LogWarning((object)("Addendum Data (Dump/Mod) for Data Block [" + dataKey + "] has failed! Ignoring.\n" + ex4.Message + "\n" + ex4.StackTrace + ((innerException4 != null) ? ("\nInner: " + innerException4.Message + "\n" + innerException4.StackTrace) : ""))); } } try { dataDict.Add(dataKey, val); } catch (Exception ex5) { Exception innerException5 = ex5.InnerException; Debug.LogWarning((object)("Modded Add of new Data Block [" + dataKey + "] has failed! Ignoring.\n" + ex5.Message + "\n" + ex5.StackTrace + ((innerException5 != null) ? ("\nInner: " + innerException5.Message + "\n" + innerException5.StackTrace) : ""))); } continue; } if (flag5) { try { Debug.Log((object)("Addendum Data (Dump/Core): " + JsonMapper.ToJson((object)val))); } catch (Exception ex6) { Exception innerException6 = ex6.InnerException; Debug.LogWarning((object)("Addendum Data (Dump/Core) for Data Block [" + dataKey + "] has failed! Ignoring.\n" + ex6.Message + "\n" + ex6.StackTrace + ((innerException6 != null) ? ("\nInner: " + innerException6.Message + "\n" + innerException6.StackTrace) : ""))); } } try { dataDict.Add(dataKey, val); } catch (Exception ex7) { Exception innerException7 = ex7.InnerException; Debug.LogWarning((object)("Core Add of new Data Block [" + dataKey + "] has failed! Ignoring.\n" + ex7.Message + "\n" + ex7.StackTrace + ((innerException7 != null) ? ("\nInner: " + innerException7.Message + "\n" + innerException7.StackTrace) : ""))); } } array2 = null; text2 = null; } catch (Exception ex8) { JsonLogger.ReportProblem(strFile, (ReportTypes)0); if (text.Length > 1000) { text = text.Substring(text.Length - 1000); } Debug.LogError((object)(text + "\n" + ex8.Message + "\n" + ex8.StackTrace.ToString())); } if (strFile.IndexOf("osSGv1") >= 0) { Debug.Log((object)text); } } public static void SyncDataSafe<TJson>(TJson currDataSet, TJson newDataSet, ref string rawDataSet, string dataType, string dataKey, bool extData, bool doLog = false) { Type type = currDataSet.GetType(); Type type2 = newDataSet.GetType(); PropertyInfo[] properties = type.GetProperties(); foreach (PropertyInfo propertyInfo in properties) { if (!propertyInfo.CanWrite || propertyInfo.Name.IsForbidden()) { continue; } PropertyInfo property = type2.GetProperty(propertyInfo.Name); if ((object)property == null) { continue; } bool useCurrent = false; string name = propertyInfo.Name; object newValue = property.GetValue(newDataSet, null); object currValue = propertyInfo.GetValue(currDataSet, null); if (rawDataSet.IndexOf(name) < 0) { continue; } try { if (currValue != null && newValue is IDictionary) { SyncRecords(ref newValue, ref currValue, ref useCurrent, dataKey, name, dataType, extData, doLog); } else if (currValue != null && newValue is string[]) { SyncArrays(ref newValue, ref currValue, dataKey, name, extData, doLog); } else if (currValue != null && newValue is object[]) { SyncObjects(ref newValue, ref currValue, ref useCurrent, dataKey, name, dataType, extData, doLog); } else if (currValue != null && !(newValue is string) && newValue != null && newValue.GetType().IsClass) { string rawDataSet2 = JsonMapper.ToJson(currValue).Compressed(); SyncDataSafe(currValue, newValue, ref rawDataSet2, dataType, dataKey + "/" + name, extData, doLog); } else if (doLog) { Debug.Log((object)("#Info# Data Block [" + dataKey + "], Property " + $"[{name}]: {currValue.Sanitized()} => {newValue.Sanitized()}")); } if (useCurrent) { propertyInfo.SetValue(currDataSet, currValue, null); } else { propertyInfo.SetValue(currDataSet, newValue, null); } } catch (Exception ex) { Exception innerException = ex.InnerException; Debug.LogWarning((object)("Value sync for Data Block [" + dataKey + "], Property [" + name + "] has failed! Ignoring.\n" + ex.Message + "\n" + ex.StackTrace + ((innerException != null) ? ("\nInner: " + innerException.Message + "\n" + innerException.StackTrace) : ""))); } } BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public; FieldInfo[] fields = type.GetFields(bindingAttr); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.IsLiteral || fieldInfo.Name.IsForbidden()) { continue; } FieldInfo field = type2.GetField(fieldInfo.Name, bindingAttr); if ((object)field == null) { continue; } bool useCurrent2 = false; string name2 = fieldInfo.Name; object newValue2 = field.GetValue(newDataSet); object currValue2 = fieldInfo.GetValue(currDataSet); if (rawDataSet.IndexOf(name2) < 0) { continue; } try { if (currValue2 != null && newValue2 is IDictionary) { SyncRecords(ref newValue2, ref currValue2, ref useCurrent2, dataKey, name2, dataType, extData, doLog); } else if (currValue2 != null && newValue2 is string[]) { SyncArrays(ref newValue2, ref currValue2, dataKey, name2, extData, doLog); } else if (currValue2 != null && newValue2 is object[]) { SyncObjects(ref newValue2, ref currValue2, ref useCurrent2, dataKey, name2, dataType, extData, doLog); } else if (currValue2 != null && !(newValue2 is string) && newValue2 != null && newValue2.GetType().IsClass) { string rawDataSet3 = JsonMapper.ToJson(currValue2).Compressed(); SyncDataSafe(currValue2, newValue2, ref rawDataSet3, dataType, dataKey + "/" + name2, extData, doLog); } else if (doLog) { Debug.Log((object)("#Info# Data Block [" + dataKey + "], Property " + $"[{name2}]: {currValue2.Sanitized()} => {newValue2.Sanitized()}")); } if (useCurrent2) { fieldInfo.SetValue(currDataSet, currValue2); } else { fieldInfo.SetValue(currDataSet, newValue2); } } catch (Exception ex2) { Exception innerException2 = ex2.InnerException; Debug.LogWarning((object)("Value sync for Data Block [" + dataKey + "], Property [" + name2 + "] has failed! Ignoring.\n" + ex2.Message + "\n" + ex2.StackTrace + ((innerException2 != null) ? ("\nInner: " + innerException2.Message + "\n" + innerException2.StackTrace) : ""))); } } } public static void SyncObjects(ref object newValue, ref object currValue, ref bool useCurrent, string dataKey, string propName, string dataType, bool extData, bool doLog) { useCurrent = true; List<object> list = (newValue as Array).Cast<object>().ToList(); List<object> list2 = (currValue as Array).Cast<object>().ToList(); foreach (object item in list) { string targetID = item.GetIdentifier(); if (string.IsNullOrEmpty(targetID)) { if (doLog) { Debug.Log((object)("#Info# Data Block [" + dataKey + "], " + $"Property [{propName}]: {currValue} => {newValue}")); } useCurrent = false; return; } bool flag = targetID.StartsWith("~"); bool flag2 = targetID.StartsWith("*"); if (flag || flag2) { targetID = targetID.Substring(1); item.SetIdentifier(targetID); } int num = list2.FindIndex((object x) => x.GetIdentifier() == targetID); if (num >= 0) { string name = list2[num].GetName(); name = ((name != targetID && name != string.Empty) ? (name + ":" + targetID) : targetID); if (flag) { if (doLog) { Debug.Log((object)("#Info# Object [" + name + "] was removed from Data Block [" + dataKey + "/" + propName + "]")); } list2.RemoveAt(num); } else if (flag2) { if (doLog) { Debug.Log((object)("#Info# Object [" + name + "] was replaced in Data Block [" + dataKey + "/" + propName + "]")); } list2[num] = item; } else { string rawDataSet = JsonMapper.ToJson(item); SyncDataSafe(list2[num], item, ref rawDataSet, dataType, dataKey + "/" + propName + "/" + name, extData, doLog); } } else { string name2 = item.GetName(); name2 = ((name2 != targetID && name2 != string.Empty) ? (name2 + ":" + targetID) : targetID); if (doLog) { Debug.Log((object)("#Info# Object [" + name2 + "] was added to Data Block [" + dataKey + "/" + propName + "]")); } list2.Add(item); } } Array array = Array.CreateInstance(currValue.GetType().GetElementType(), list2.Count); for (int i = 0; i < list2.Count; i++) { array.SetValue(list2[i], i); } currValue = array; } public static void SyncRecords(ref object newValue, ref object currValue, ref bool useCurrent, string dataKey, string propName, string dataType, bool extData, bool doLog) { useCurrent = true; IDictionary dictionary = (IDictionary)newValue; IDictionary dictionary2 = (IDictionary)currValue; Type[] genericArguments = currValue.GetType().GetGenericArguments(); Type type = ((genericArguments.Count() > 1) ? genericArguments[1] : genericArguments[0]); bool flag = (object)type != typeof(string) && type.IsClass; foreach (object item in dictionary.Keys.Cast<object>().ToList()) { bool flag2 = item.ToString().StartsWith("~"); bool flag3 = item.ToString().StartsWith("*"); object obj = ((flag2 || flag3) ? item.ToString().Substring(1) : item); if (dictionary2.Contains(obj)) { if (flag2) { if (doLog) { Debug.Log((object)($"#Info# Property [{obj}] was removed " + "from Data Block [" + dataKey + "/" + propName + "]")); } dictionary2.Remove(obj); } else if (flag3) { if (doLog) { Debug.Log((object)($"#Info# Property [{obj}] was replaced " + "in Data Block [" + dataKey + "/" + propName + "]")); } dictionary2[obj] = dictionary[item]; } else if (flag) { string rawDataSet = JsonMapper.ToJson(dictionary[obj]); SyncDataSafe(dictionary2[obj], dictionary[obj], ref rawDataSet, dataType, $"{dataKey}/{propName}:{obj}", extData, doLog); } else { if (doLog) { Debug.Log((object)("#Info# Data Block [" + dataKey + "/" + propName + "], " + $"Property [{obj}]: {dictionary2[obj]} => {dictionary[obj]}")); } dictionary2[obj] = dictionary[obj]; } } else { if (doLog) { Debug.Log((object)($"#Info# Property [{obj}], Value [{dictionary[obj]}] " + "was added to Data Block [" + dataKey + "/" + propName + "]")); } dictionary2[obj] = dictionary[obj]; } } } public static void SyncArrays(ref object newValue, ref object currValue, string dataKey, string propName, bool extData, bool doLog) { SyncArrayOp arrayOp = (extData ? SyncArrayOp.Add : SyncArrayOp.None); List<string> list = (currValue as string[]).ToList(); List<string> list2 = (newValue as string[]).ToList(); List<string> list3 = new List<string>(list); bool noArrayOps = true; foreach (string item in list2) { if (string.IsNullOrEmpty(item) || !char.IsDigit(item[0]) || !Enumerable.Contains(item, '|')) { continue; } List<string> list4 = item.Split(new char[1] { '|' }).ToList(); int.TryParse(list4[0].Replace("=", ""), out var result); if (result > 0) { list4.RemoveAt(0); List<string> list5 = list[result - 1].Split(new char[1] { '|' }).ToList(); SyncArrayOps(list5, list4, ref noArrayOps, dataKey, $"{propName}#{result}", doLog, arrayOp); if (noArrayOps) { Debug.LogWarning((object)("You attempted to modify sub-array in Data Block " + $"[{dataKey}], Property [{propName}#{result}], but performed no array operations. " + "Assume that something went horribly wrong and game is likely to crash.")); } list[result - 1] = string.Join("|", list5.ToArray()); } } SyncArrayOps(list, list2, ref noArrayOps, dataKey, propName, doLog, arrayOp); if (noArrayOps) { if (doLog) { Debug.Log((object)("#Info# Data Block [" + dataKey + "], " + $"Property [{propName}]: String[{list3.Count}] => String[{list2.Count}]")); } newValue = list2.ToArray(); } else { newValue = list.ToArray(); } } public static void SyncArrayOps(List<string> modArray, List<string> refArray, ref bool noArrayOps, string dataKey, string propName, bool doLog, SyncArrayOp arrayOp = SyncArrayOp.None) { int result = 0; foreach (string item in refArray) { if (string.IsNullOrEmpty(item) || (char.IsDigit(item[0]) && Enumerable.Contains(item, '|'))) { continue; } if (item.StartsWith("--")) { switch (item.Substring(0, 7)) { case "--MOD--": arrayOp = SyncArrayOp.Mod; break; case "--ADD--": arrayOp = SyncArrayOp.Add; break; case "--INS--": arrayOp = SyncArrayOp.Ins; break; case "--DEL--": arrayOp = SyncArrayOp.Del; break; } if (arrayOp == SyncArrayOp.Ins) { int.TryParse(item.Replace("=", "").Substring(7), out result); result--; if (result < 0) { Debug.LogWarning((object)("The '--INS--' array operation in Data Block [" + dataKey + "], Property [" + propName + "] received invalid index! Using [0] index.")); result = 0; } } continue; } if (noArrayOps) { noArrayOps = arrayOp == SyncArrayOp.None; } if (noArrayOps) { break; } string[] array = item.Split(new char[1] { '=' }); if (array.Length == 2 && !Enumerable.Contains(item, '|') && !string.IsNullOrEmpty(array[1])) { switch (arrayOp) { case SyncArrayOp.Mod: OpModData(modArray, item, dataKey, propName, doLog); break; case SyncArrayOp.Add: OpAddData(modArray, item, dataKey, propName, doLog); break; case SyncArrayOp.Ins: OpInsData(modArray, ref result, item, dataKey, propName, doLog); break; case SyncArrayOp.Del: OpDelData(modArray, item, dataKey, propName, doLog); break; } continue; } switch (arrayOp) { case SyncArrayOp.Mod: Debug.LogWarning((object)("Non-data [" + item + "] in Data Block [" + dataKey + "], Property [" + propName + "] doesn't support '--MOD--' operation! Ignoring.")); break; case SyncArrayOp.Add: OpAddSimple(modArray, item, dataKey, propName, doLog); break; case SyncArrayOp.Ins: OpInsSimple(modArray, ref result, item, dataKey, propName, doLog); break; case SyncArrayOp.Del: OpDelSimple(modArray, item, dataKey, propName, doLog); break; } } } public static void OpModData(List<string> modArray, string refItem, string dataKey, string propName, bool doLog) { string[] array = refItem.Split(new char[1] { '=' }); bool flag = false; for (int i = 0; i < modArray.Count; i++) { string[] array2 = modArray[i].Split(new char[1] { '=' }); if (array2[0] == array[0]) { if (doLog) { Debug.Log((object)("#Info# Data Block [" + dataKey + "], Property [" + propName + "], Parameter [" + array[0] + "]: " + array2[1] + " => " + array[1])); } modArray[i] = refItem; flag = true; break; } } if (!flag) { Debug.LogWarning((object)("Parameter [" + array[0] + "] was not found in Data Block [" + dataKey + "], Property [" + propName + "]! Ignoring.")); } } public static void OpAddData(List<string> modArray, string refItem, string dataKey, string propName, bool doLog) { string[] array = refItem.Split(new char[1] { '=' }); if (doLog) { Debug.Log((object)("#Info# Parameter [" + array[0] + "], Value [" + array[1] + "] was added to Data Block [" + dataKey + "], Property [" + propName + "]")); } modArray.Add(refItem); } public static void OpInsData(List<string> modArray, ref int arrIndex, string refItem, string dataKey, string propName, bool doLog) { string[] array = refItem.Split(new char[1] { '=' }); if (doLog) { Debug.Log((object)("#Info# Parameter [" + array[0] + "], Value [" + array[1] + "] was inserted " + $"into Data Block [{dataKey}], Property [{propName}] at Index [{arrIndex}]")); } if (arrIndex >= modArray.Count) { Debug.LogWarning((object)($"Index [{arrIndex}] for Parameter [{array[0]}] in Data " + "Block [" + dataKey + "], Property [" + propName + "] is invalid! Adding instead.")); modArray.Add(refItem); } else { modArray.Insert(arrIndex, refItem); } arrIndex++; } public static void OpDelData(List<string> modArray, string refItem, string dataKey, string propName, bool doLog) { string[] array = refItem.Split(new char[1] { '=' }); bool flag = false; int index = 0; for (int i = 0; i < modArray.Count; i++) { string[] array2 = modArray[i].Split(new char[1] { '=' }); if (array2[0] == array[0]) { index = i; flag = true; break; } } if (flag) { if (doLog) { Debug.Log((object)("#Info# Parameter [" + array[0] + "] was removed from Data Block [" + dataKey + "], Property [" + propName + "]")); } modArray.RemoveAt(index); } else { Debug.LogWarning((object)("Parameter [" + array[0] + "] was not found in Data Block [" + dataKey + "], Property [" + propName + "]! Ignoring.")); } } public static void OpAddSimple(List<string> modArray, string refItem, string dataKey, string propName, bool doLog) { if (doLog) { Debug.Log((object)("#Info# Parameter [" + refItem + "] was added to Data Block [" + dataKey + "], Property [" + propName + "]")); } modArray.Add(refItem); } public static void OpInsSimple(List<string> modArray, ref int arrIndex, string refItem, string dataKey, string propName, bool doLog) { if (doLog) { Debug.Log((object)("#Info# Parameter [" + refItem + "] was inserted into " + $"Data Block [{dataKey}], Property [{propName}] at Index [{arrIndex}]")); } if (arrIndex >= modArray.Count) { Debug.LogWarning((object)($"Index [{arrIndex}] for Parameter [{refItem}] in Data " + "Block [" + dataKey + "], Property [" + propName + "] is invalid! Adding instead.")); modArray.Add(refItem); } else { modArray.Insert(arrIndex, refItem); } arrIndex++; } public static void OpDelSimple(List<string> modArray, string refItem, string dataKey, string propName, bool doLog) { bool flag = false; int index = 0; for (int i = 0; i < modArray.Count; i++) { if (modArray[i].StartsWith(refItem)) { index = i; flag = true; break; } } if (flag) { if (doLog) { Debug.Log((object)("#Info# Parameter [" + refItem + "] was removed from Data Block [" + dataKey + "], Property [" + propName + "]")); } modArray.RemoveAt(index); } else { Debug.LogWarning((object)("Parameter [" + refItem + "] was not found in Data Block [" + dataKey + "], Property [" + propName + "]!")); } } public static string GetName(this object refObject) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public; Type type = refObject.GetType(); string empty = string.Empty; empty = type.GetProperty("strName")?.GetValue(refObject, null)?.ToString() ?? string.Empty; if (string.IsNullOrEmpty(empty)) { empty = type.GetField("strName", bindingAttr)?.GetValue(refObject)?.ToString() ?? string.Empty; } return empty; } public static string GetIdentifier(this object refObject) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public; Type type = refObject.GetType(); string[] array = new string[2] { "strID", "strName" }; string text = string.Empty; string[] array2 = array; foreach (string name in array2) { text = type.GetProperty(name)?.GetValue(refObject, null)?.ToString() ?? string.Empty; if (string.IsNullOrEmpty(text)) { text = type.GetField(name, bindingAttr)?.GetValue(refObject)?.ToString() ?? string.Empty; } if (!string.IsNullOrEmpty(text)) { break; } } return text; } public static bool SetIdentifier(this object refObject, string newIdentifier) { BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public; Type type = refObject.GetType(); string[] array = new string[2] { "strID", "strName" }; bool result = false; string[] array2 = array; foreach (string name in array2) { PropertyInfo property = type.GetProperty(name); if ((object)property != null) { property.SetValue(refObject, newIdentifier, null); result = true; break; } FieldInfo field = type.GetField(name, bindingAttr); if ((object)field != null) { field.SetValue(refObject, newIdentifier); result = true; break; } } return result; } public static bool IsForbidden(this string strProp) { if (1 == 0) { } bool result; switch (strProp) { case "strID": case "strName": case "strReference": result = true; break; default: result = false; break; } if (1 == 0) { } return result; } public static object Sanitized(this object refObject) { if (refObject == null) { return "NULL"; } if (refObject is string text && text.Length == 0) { return "EMPTY"; } return refObject; } public static string Compressed(this string strValue) { return strValue.Replace("\n", "").Replace("\r", "").Replace("\t", "") .Replace(" ", ""); } public static bool IsCoreEntry(this string modKey) { return modKey == "core" || modKey == "Core"; } public static bool IsExtedable(this string dataKey) { if (1 == 0) { } bool result; switch (dataKey) { case "conditions_simple": case "names_last": case "names_robots": case "names_first": case "names_full": case "manpages": case "traitscores": case "strings": case "crewskins": case "names_ship": case "names_ship_adjectives": case "names_ship_nouns": result = true; break; default: result = false; break; } if (1 == 0) { } return result; } public static bool TryGetCOValue(string strName, out JsonCondOwner refCO) { if (DataHandler.dictCOs.TryGetValue(strName, out var value)) { refCO = value; return true; } if (DataHandler.dictCOOverlays.TryGetValue(strName, out var value2) && DataHandler.dictCOs.TryGetValue(value2.strCOBase, out var value3)) { refCO = value3; return true; } refCO = null; return false; } public static void SwitchSlottedItems(JsonShip aShipRef, bool isTemplate) { if (aShipRef == null) { return; } List<JsonItem> list = ((aShipRef.aItems != null) ? aShipRef.aItems.ToList() : null); List<JsonCondOwnerSave> list2 = ((aShipRef.aCOs != null) ? aShipRef.aCOs.ToList() : null); if (list == null) { return; } foreach (JsonItem aItem in list) { if (string.IsNullOrEmpty(aItem.strSlotParentID)) { continue; } JsonItem val = list.Find((JsonItem x) => x.strID == aItem.strSlotParentID); if (val == null || !dictChangesMap.ContainsKey(val.strName) || !dictChangesMap[val.strName].ContainsKey("Switch_Slotted") || dictChangesMap[val.strName]["Switch_Slotted"] == null) { continue; } Dictionary<string, string> dictionary = (from x in dictChangesMap[val.strName]["Switch_Slotted"] where x.Split(new char[1] { "="[0] }).Length == 2 select x.Split(new char[1] { "="[0] })).ToDictionary((string[] x) => x[0], (string[] x) => x[1]); if (!dictionary.ContainsKey(aItem.strName)) { continue; } string text = dictionary[aItem.strName]; if (string.IsNullOrEmpty(text)) { continue; } Debug.Log((object)("#Info# Found the mismatched CO [" + aItem.strName + ":" + aItem.strID + "] for the Parent CO [" + val.strName + ":" + val.strID + "] for remapping! Syncing to the CO [" + text + "] from the template.")); if (!TryGetCOValue(text, out var refCO)) { continue; } aItem.strName = refCO.strName; if (!isTemplate && list2 != null && TryGetCOValue(val.strName, out var refCO2)) { JsonCondOwnerSave val2 = list2.Find((JsonCondOwnerSave x) => x.strID == aItem.strID); if (val2 != null) { val2.strSlotName = refCO.mapSlotEffects.Intersect(refCO2.aSlotsWeHave).First(); val2.strCondID = refCO.strName + aItem.strID; val2.strFriendlyName = refCO.strNameFriendly; val2.strCODef = refCO.strName; } } } if (list2 != null) { aShipRef.aCOs = list2.ToArray(); } aShipRef.aItems = list.ToArray(); } public static void RecoverMissingItems(JsonShip aShipRef) { //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Expected O, but got Unknown if (aShipRef == null) { return; } List<JsonItem> list = ((aShipRef.aItems != null) ? aShipRef.aItems.ToList() : null); List<JsonItem> list2 = new List<JsonItem>(); if (list == null) { return; } foreach (JsonItem aItem in list) { if (!dictChangesMap.ContainsKey(aItem.strName) || !dictChangesMap[aItem.strName].ContainsKey("Recover_Missing") || dictChangesMap[aItem.strName]["Recover_Missing"] == null || !TryGetCOValue(aItem.strName, out var refCO)) { continue; } List<string> targetKeys = dictChangesMap[aItem.strName]["Recover_Missing"].ToList(); bool isInverse = targetKeys.Remove("*IsInverse*"); bool doAll = targetKeys.Count == 0; if (refCO.aSlotsWeHave == null || refCO.aSlotsWeHave.Length == 0 || refCO.strLoot == null || !DataHandler.dictLoot.ContainsKey(refCO.strLoot)) { continue; } List<string> second = (from x in list.FindAll((JsonItem x) => (x.strSlotParentID == aItem.strID && listLockedCOs.Contains(x.strName)) || targetKeys.Contains(x.strName)) select x.strName).ToList(); List<string> first = (from x in DataHandler.dictLoot[refCO.strLoot].GetAllLootNames() where (doAll && listLockedCOs.Contains(x)) || (!isInverse && targetKeys.Contains(x)) || (isInverse && !targetKeys.Contains(x) && listLockedCOs.Contains(x)) select x).ToList(); List<string> list3 = first.Except(second).ToList(); foreach (string item in list3) { JsonItem val = new JsonItem(); val.strName = item; val.fX = aItem.fX; val.fY = aItem.fY; val.fRotation = 0f; val.strID = Guid.NewGuid().ToString(); val.strSlotParentID = aItem.strID; val.bForceLoad = aItem.bForceLoad; Debug.Log((object)("#Info# Found the missing locked CO [" + item + "] for the Parent CO [" + aItem.strName + ":" + aItem.strID + "] in the list! New ID [" + val.strID + "], adding.")); list2.Add(val); } } list.AddRange(list2); aShipRef.aItems = list.ToArray(); } public static void RecoverMissingCOs(JsonShip aShipRef) { //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Expected O, but got Unknown if (aShipRef == null) { return; } List<JsonItem> list = ((aShipRef.aItems != null) ? aShipRef.aItems.ToList() : null); List<JsonCondOwnerSave> list2 = ((aShipRef.aCOs != null) ? aShipRef.aCOs.ToList() : null); if (list == null || list2 == null) { return; } foreach (JsonItem aItem in list) { if (list2.Find((JsonCondOwnerSave x) => x.strID == aItem.strID) != null || string.IsNullOrEmpty(aItem.strSlotParentID)) { continue; } JsonItem val = list.Find((JsonItem x) => x.strID == aItem.strSlotParentID); JsonCondOwnerSave val2 = list2.Find((JsonCondOwnerSave x) => x.strID == aItem.strSlotParentID); if (val == null || val2 == null) { continue; } if (TryGetCOValue(aItem.strName, out var refCO) && TryGetCOValue(val.strName, out var refCO2) && dictChangesMap.ContainsKey(val.strName) && dictChangesMap[val.strName].ContainsKey("Recover_Missing")) { Debug.Log((object)("#Info# Found the CO [" + aItem.strName + ":" + aItem.strID + "] with missing save data! Creating data from template.")); if (refCO.strType == "Item") { JsonCondOwnerSave val3 = new JsonCondOwnerSave(); val3.strID = aItem.strID; val3.strCODef = aItem.strName; val3.strCondID = aItem.strName + aItem.strID; val3.bAlive = true; val3.inventoryX = 0; val3.inventoryY = 0; val3.fDGasTemp = 0.0; val3.nDestTile = 0; val3.strIdleAnim = "Idle"; val3.fMSRedamageAmount = 0.0; val3.fLastICOUpdate = StarSystem.fEpoch; val3.aConds = refCO.aStartingConds.Concat(new string[1] { "DEFAULT" }).ToArray(); val3.strSlotName = refCO.mapSlotEffects.Intersect(refCO2.aSlotsWeHave).First(); JsonItemDef itemDef = DataHandler.GetItemDef(refCO.strItemDef); val3.strIMGPreview = ((itemDef != null) ? itemDef.strImg : null); if (val3.strIMGPreview == null) { val3.strIMGPreview = "blank"; } val3.strFriendlyName = refCO.strNameFriendly; val3.strRegIDLast = aShipRef.strRegID; list2.Add(val3); } else { Debug.LogWarning((object)("Warning! The [" + aItem.strName + "] isn't item CO and not supported! Ignoring.")); } } else { Debug.LogWarning((object)("Warning! Template CO [" + aItem.strName + "] for parent or item doesn't exist! Ignoring.")); } } aShipRef.aCOs = list2.ToArray(); } public static void SyncConditions(JsonShip aShipRef) { if (aShipRef == null) { return; } List<JsonCondOwnerSave> list = ((aShipRef.aCOs != null) ? aShipRef.aCOs.ToList() : null); if (list == null) { return; } foreach (JsonCondOwnerSave item in list) { if (item == null || !dictChangesMap.ContainsKey(item.strCODef) || !dictChangesMap[item.strCODef].ContainsKey("Sync_Conditions") || dictChangesMap[item.strCODef]["Sync_Conditions"] == null || !TryGetCOValue(item.strCODef, out var refCO)) { continue; } List<string> targetKeys = dictChangesMap[item.strCODef]["Sync_Conditions"].ToList(); bool isInverse = targetKeys.Remove("*IsInverse*"); bool doAll = targetKeys.Count == 0; if (refCO.aStartingConds == null || item.aConds == null || refCO.aStartingConds.Length == 0 || item.aConds.Length < 0) { continue; } List<string> list2 = item.aConds.ToList(); List<string> second = item.aConds.Select((string x) => x.Split(new char[1] { '=' })[0]).ToList(); List<string> first = (from x in refCO.aStartingConds select x.Split(new char[1] { '=' })[0] into x where doAll || (!isInverse && targetKeys.Contains(x)) || (isInverse && !targetKeys.Contains(x)) select x).ToList(); List<string> list3 = first.Except(second).ToList(); foreach (string newCondKey in list3) { string text = refCO.aStartingConds.ToList().Find((string x) => x.StartsWith(newCondKey + "=")); Debug.Log((object)("#Info# Saved CO [" + item.strCODef + ":" + item.strID + "] is missing [" + text + "] condition! Syncing to the CO from the template.")); list2.Insert(0, text); } if (list3.Count > 0) { item.aConds = list2.ToArray(); } } aShipRef.aCOs = list.ToArray(); } public static void UpdateConditions(JsonShip aShipRef) { if (aShipRef == null) { return; } List<JsonCondOwnerSave> list = ((aShipRef.aCOs != null) ? aShipRef.aCOs.ToList() : null); if (list == null) { return; } foreach (JsonCondOwnerSave item2 in list) { if (item2 == null || !dictChangesMap.ContainsKey(item2.strCODef) || !dictChangesMap[item2.strCODef].ContainsKey("Update_Conditions") || dictChangesMap[item2.strCODef]["Update_Conditions"] == null || !TryGetCOValue(item2.strCODef, out var refCO)) { continue; } List<string> targetKeys = dictChangesMap[item2.strCODef]["Update_Conditions"].ToList(); bool isInverse = targetKeys.Remove("*IsInverse*"); bool doAll = targetKeys.Count == 0; if (refCO.aStartingConds == null || item2.aConds == null || refCO.aStartingConds.Length == 0 || item2.aConds.Length < 0) { continue; } List<string> list2 = item2.aConds.ToList(); List<string> second = item2.aConds.Select((string x) => x.Split(new char[1] { '=' })[0]).ToList(); List<string> first = (from x in refCO.aStartingConds select x.Split(new char[1] { '=' })[0] into x where doAll || (!isInverse && targetKeys.Contains(x)) || (isInverse && !targetKeys.Contains(x)) select x).ToList(); List<string> list3 = first.Intersect(second).ToList(); foreach (string extCondKey in list3) { string value = refCO.aStartingConds.ToList().Find((string x) => x.StartsWith(extCondKey + "=")); string item = list2.Find((string x) => x.StartsWith(extCondKey + "=")); Debug.Log((object)("#Info# Saved CO [" + item2.strCODef + ":" + item2.strID + "] condition [" + extCondKey + "] received new value from the template CO.")); list2[list2.IndexOf(item)] = value; } if (list3.Count > 0) { item2.aConds = list2.ToArray(); } } aShipRef.aCOs = list.ToArray(); } public static void SyncSlotEffects(JsonShip aShipRef) { if (aShipRef == null) { return; } List<JsonItem> aItemList = ((aShipRef.aItems != null) ? aShipRef.aItems.ToList() : null); List<JsonCondOwnerSave> list = ((aShipRef.aCOs != null) ? aShipRef.aCOs.ToList() : null); if (aItemList == null || list == null) { return; } foreach (JsonCondOwnerSave aSavedCO in list) { if (aSavedCO == null || !dictChangesMap.ContainsKey(aSavedCO.strCODef) || !dictChangesMap[aSavedCO.strCODef].ContainsKey("Sync_Slot_Effects") || dictChangesMap[aSavedCO.strCODef]["Sync_Slot_Effects"] == null || dictChangesMap[aSavedCO.strCODef]["Sync_Slot_Effects"].Count <= 0 || !TryGetCOValue(aSavedCO.strCODef, out var _)) { continue; } List<string> list2 = dictChangesMap[aSavedCO.strCODef]["Sync_Slot_Effects"].Where((string x) => x.Contains("=")).ToList(); List<string> list3 = (from x in dictChangesMap[aSavedCO.strCODef]["Sync_Slot_Effects"] where x.StartsWith("!") select x.Substring(1)).ToList(); List<JsonCondOwnerSave> list4 = list.FindAll((JsonCondOwnerSave x) => aItemList.Any((JsonItem i) => i.strSlotParentID == aSavedCO.strID && i.strID == x.strID)); foreach (JsonCondOwnerSave item in list4) { List<string> list5 = ((item.aConds != null) ? item.aConds.ToList() : new List<string>()); foreach (string item2 in list2) { string text = item2.Split(new char[1] { "|"[0] })[0]; string addCondKey = text.Split(new char[1] { "="[0] })[0]; List<string> list6 = item2.Split(new char[1] { "|"[0] }).Skip(1).ToList(); if (!list5.Any((string x) => x.StartsWith(addCondKey + "=")) && (list6.Count == 0 || list6.Contains(item.strCODef))) { Debug.Log((object)("#Info# Saved CO [" + item.strCODef + ":" + item.strID + "] got condition [" + text + "] due to the Parent CO [" + aSavedCO.strCODef + ":" + aSavedCO.strID + "] slot effects.")); list5.Insert(0, text); } } foreach (string item3 in list3) { string text2 = item3.Split(new char[1] { "|"[0] })[0]; string remCondsKey = text2.Split(new char[1] { "="[0] })[0]; List<string> list7 = item3.Split(new char[1] { "|"[0] }).Skip(1).ToList(); if (list5.Any((string x) => x.StartsWith(remCondsKey + "=")) && (list7.Count == 0 || list7.Contains(item.strCODef))) { Debug.Log((object)("#Info# Saved CO [" + item.strCODef + ":" + item.strID + "] lost condition [" + text2 + "] due to the Parent CO [" + aSavedCO.strCODef + ":" + aSavedCO.strID + "] slot effects.")); list5.Remove(list5.Find((string x) => x.StartsWith(remCondsKey + "="))); } } if (list2.Count > 0 || list3.Count > 0) { item.aConds = list5.ToArray(); } } } } public static void SyncInvEffects(JsonShip aShipRef) { if (aShipRef == null) { return; } List<JsonItem> aItemList = ((aShipRef.aItems != null) ? aShipRef.aItems.ToList() : null); List<JsonCondOwnerSave> list = ((aShipRef.aCOs != null) ? aShipRef.aCOs.ToList() : null); if (aItemList == null || list == null) { return; } foreach (JsonCondOwnerSave aSavedCO in list) { if (aSavedCO == null || !dictChangesMap.ContainsKey(aSavedCO.strCODef) || !dictChangesMap[aSavedCO.strCODef].ContainsKey("Sync_Inv_Effects") || dictChangesMap[aSavedCO.strCODef]["Sync_Inv_Effects"] == null || dictChangesMap[aSavedCO.strCODef]["Sync_Inv_Effects"].Count <= 0 || !TryGetCOValue(aSavedCO.strCODef, out var _)) { continue; } List<string> list2 = dictChangesMap[aSavedCO.strCODef]["Sync_Inv_Effects"].Where((string x) => x.Contains("=")).ToList(); List<string> list3 = (from x in dictChangesMap[aSavedCO.strCODef]["Sync_Inv_Effects"] where x.StartsWith("!") select x.Substring(1)).ToList(); List<JsonCondOwnerSave> list4 = list.FindAll((JsonCondOwnerSave x) => aItemList.Any((JsonItem i) => i.strParentID == aSavedCO.strID && i.strID == x.strID)); foreach (JsonCondOwnerSave item in list4) { List<string> list5 = ((item.aConds != null) ? item.aConds.ToList() : new List<string>()); foreach (string item2 in list2) { string text = item2.Split(new char[1] { "|"[0] })[0]; string addCondKey = text.Split(new char[1] { "="[0] })[0]; List<string> list6 = item2.Split(new char[1] { "|"[0] }).Skip(1).ToList(); if (!list5.Any((string x) => x.StartsWith(addCondKey + "=")) && (list6.Count == 0 || list6.Contains(item.strCODef))) { Debug.Log((object)("#Info# Saved CO [" + item.strCODef + ":" + item.strID + "] got condition [" + text + "] due to the Parent CO [" + aSavedCO.strCODef + ":" + aSavedCO.strID + "] inventory effects.")); list5.Insert(0, text); } } foreach (string item3 in list3) { string text2 = item3.Split(new char[1] { "|"[0] })[0]; string remCondsKey = text2.Split(new char[1] { "="[0] })[0]; List<string> list7 = item3.Split(new char[1] { "|"[0] }).Skip(1).ToList(); if (list5.Any((string x) => x.StartsWith(remCondsKey + "=")) && (list7.Count == 0 || list7.Contains(item.strCODef))) { Debug.Log((object)("#Info# Saved CO [" + item.strCODef + ":" + item.strID + "] lost condition [" + text2 + "] due to the Parent CO [" + aSavedCO.strCODef + ":" + aSavedCO.strID + "] inventory effects.")); list5.Remove(list5.Find((string x) => x.StartsWith(remCondsKey + "="))); } } if (list2.Count > 0 || list3.Count > 0) { item.aConds = list5.ToArray(); } } } } } public class patch_Ship : Ship { [MonoModIgnore] public extern patch_Ship(GameObject go); public extern void orig_InitShip(bool bTemplateOnly, Loaded nLoad, string strRegIDNew = null); public void InitShip(bool bTemplateOnly, Loaded nLoad, string strRegIDNew = null) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (FFU_BR_Defs.ModSyncLoading && base.json != null) { patch_DataHandler.SwitchSlottedItems(base.json, bTemplateOnly); patch_DataHandler.RecoverMissingItems(base.json); if (!bTemplateOnly) { patch_DataHandler.RecoverMissingCOs(base.json); patch_DataHandler.SyncConditions(base.json); patch_DataHandler.UpdateConditions(base.json); patch_DataHandler.SyncSlotEffects(base.json); patch_DataHandler.SyncInvEffects(base.json); } } orig_InitShip(bTemplateOnly, nLoad, strRegIDNew); } } public class patch_JsonSimple : JsonSimple { public string strReference { get; set; } } public class patch_JsonColor : JsonColor { public string strReference { get; set; } } public class patch_JsonGasRespire : JsonGasRespire { public string strReference { get; set; } } public class patch_JsonPowerInfo : JsonPowerInfo { public string strReference { get; set; } } public class patch_JsonGUIPropMap : JsonGUIPropMap { public string strReference { get; set; } } public class patch_JsonCond : JsonCond { public string strReference { get; set; } } public class patch_JsonItemDef : JsonItemDef { public string strReference { get; set; } } public class patch_CondTrigger : CondTrigger { public string strReference { get; set; } } public class patch_JsonInteraction : JsonInteraction { public string strReference { get; set; } } public class patch_JsonCondOwner : JsonCondOwner { public string strReference { get; set; } } public class patch_JsonRoomSpec : JsonRoomSpec { public string strReference { get; set; } } public class patch_JsonShip : JsonShip { public string strReference { get; set; } } public class patch_Loot : Loot { public string strReference { get; set; } } public class patch_JsonProductionMap : JsonProductionMap { public string strReference { get; set; } } public class patch_JsonMarketActorConfig : JsonMarketActorConfig { public string strReference { get; set; } } public class patch_JsonCargoSpec : JsonCargoSpec { public string strReference { get; set; } } public class patch_JsonHomeworld : JsonHomeworld { public string strReference { get; set; } } public class patch_JsonCareer : JsonCareer { public string strReference { get; set; } } public class patch_JsonLifeEvent : JsonLifeEvent { public string strReference { get; set; } } public class patch_JsonPersonSpec : JsonPersonSpec { public string strReference { get; set; } } public class patch_JsonShipSpec : JsonShipSpec { public string strReference { get; set; } } public class patch_JsonSlotEffects : JsonSlotEffects { public string strReference { get; set; } } public class patch_JsonSlot : JsonSlot { public string strReference { get; set; } } public class patch_JsonTicker : JsonTicker { public string strReference { get; set; } } public class patch_CondRule : CondRule { public string strReference { get; set; } } public class patch_JsonAudioEmitter : JsonAudioEmitter { public string strReference { get; set; } } public class patch_JsonAd : JsonAd { public string strReference { get; set; } } public class patch_JsonHeadline : JsonHeadline { public string strReference { get; set; } } public class patch_JsonMusic : JsonMusic { public string strReference { get; set; } } public class patch_JsonCOOverlay : JsonCOOverlay { public string strReference { get; set; } } public class patch_JsonDCOCollection : JsonDCOCollection { public string strReference { get; set; } } public class patch_JsonLedgerDef : JsonLedgerDef { public string strReference { get; set; } } public class patch_JsonPledge : JsonPledge { public string strReference { get; set; } } public class patch_JsonJobItems : JsonJobItems { public string strReference { get; set; } } public class patch_JsonJob : JsonJob { public string strReference { get; set; } } public class patch_JsonAIPersonality : JsonAIPersonality { public string strReference { get; set; } } public class patch_JsonTransit : JsonTransit { public string strReference { get; set; } } public class patch_JsonPlotManagerSettings : JsonPlotManagerSettings { public string strReference { get; set; } } public class patch_JsonStarSystemSave : JsonStarSystemSave { public string strReference { get; set; } } public class patch_JsonParallax : JsonParallax { public string strReference { get; set; } } public class patch_JsonContext : JsonContext { public string strReference { get; set; } } public class patch_JsonChargeProfile : JsonChargeProfile { public string strReference { get; set; } } public class patch_JsonWound : JsonWound { public string strReference { get; set; } } public class patch_JsonAttackMode : JsonAttackMode { public string strReference { get; set; } } public class patch_JsonPDAAppIcon : JsonPDAAppIcon { public string strReference { get; set; } } public class patch_JsonZoneTrigger : JsonZoneTrigger { public string strReference { get; set; } } public class patch_JsonTip : JsonTip { public string strReference { get; set; } } public class patch_JsonCrime : JsonCrime { public string strReference { get; set; } } public class patch_JsonPlot : JsonPlot { public string strReference { get; set; } } public class patch_JsonPlotBeat : JsonPlotBeat { public string strReference { get; set; } } public class patch_JsonRaceTrack : JsonRaceTrack { public string strReference { get; set; } } public class patch_JsonRacingLeague : JsonRacingLeague { public string strReference { get; set; } } public class patch_JsonInfoNode : JsonInfoNode { public string strReference { get; set; } } public class patch_JsonInstallable : JsonInstallable { public string strReference { get; set; } } public class patch_JsonInteractionOverride : JsonInteractionOverride { public string strReference { get; set; } } public class patch_JsonPlotBeatOverride : JsonPlotBeatOverride { public string strReference { get; set; } } public class patch_JsonVerbs : JsonVerbs { public string strReference { get; set; } } public class patch_JsonCustomTokens : JsonCustomTokens { public string strReference { get; set; } } namespace LitJson { public class patch_JsonMapper : JsonMapper { [MonoModReplace] private static object ReadValue(Type inst_type, JsonReader reader) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Invalid comparison between Unknown and I4 //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Invalid comparison between Unknown and I4 //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Invalid comparison between Unknown and I4 //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Invalid comparison between Unknown and I4 //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Invalid comparison between Unknown and I4 //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Invalid comparison between Unknown and I4 //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Invalid comparison between Unknown and I4 //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Invalid comparison between Unknown and I4 //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: 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_028e: Invalid comparison between Unknown and I4 //IL_01de: Unknown result type (might be due to invalid IL or missing references) reader.Read(); if (JsonMapper.bVerbose && reader.Value != null) { Debug.Log((object)reader.Value.ToString()); } if ((int)reader.Token == 5) { return null; } Type underlyingType = Nullable.GetUnderlyingType(inst_type); Type type = underlyingType ?? inst_type; if ((int)reader.Token == 12) { if (inst_type.IsClass || (object)underlyingType != null) { return null; } throw new JsonException($"Can't assign null to an instance of type {inst_type}"); } if ((int)reader.Token == 8 || (int)reader.Token == 6 || (int)reader.Token == 9 || (int)reader.Token == 7 || (int)reader.Token == 10 || (int)reader.Token == 11) { Type type2 = reader.Value.GetType(); if (type.IsAssignableFrom(type2)) { return reader.Value; } if (JsonMapper.custom_importers_table.TryGetValue(type2, out var value) && value.TryGetValue(type, out var value2)) { return value2.Invoke(reader.Value); } if (JsonMapper.base_importers_table.TryGetValue(type2, out value) && value.TryGetValue(type, out value2)) { return value2.Invoke(reader.Value); } if (type.IsEnum) { return Enum.ToObject(type, reader.Value); } MethodInfo convOp = JsonMapper.GetConvOp(type, type2); if ((object)convOp != null) { return convOp.Invoke(null, new object[1] { reader.Value }); } throw new JsonException($"Can't assign value '{reader.Value}' (type {type2}) to type {inst_type}"); } object obj = null; if ((int)reader.Token == 4) { JsonMapper.AddArrayMetadata(inst_type); ArrayMetadata val = JsonMapper.array_metadata[inst_type]; if (!((ArrayMetadata)(ref val)).IsArray && !((ArrayMetadata)(ref val)).IsList) { throw new JsonException($"Type {inst_type} can't act as an array"); } IList list; Type elementType; if (!((ArrayMetadata)(ref val)).IsArray) { list = (IList)Activator.CreateInstance(inst_type); elementType = ((ArrayMetadata)(ref val)).ElementType; } else { list = new ArrayList(); elementType = inst_type.GetElementType(); } while (true) { object obj2 = ReadValue(elementType, reader); if (obj2 == null && (int)reader.Token == 5) { break; } list.Add(obj2); } if (((ArrayMetadata)(ref val)).IsArray) { int count = list.Count; obj = Array.CreateInstance(elementType, count); for (int i = 0; i < count; i++) { ((Array)obj).SetValue(list[i], i); } } else { obj = list; } } else if ((int)reader.Token == 1) { JsonMapper.AddObjectMetadata(type); ObjectMetadata val2 = JsonMapper.object_metadata[type]; obj = Activator.CreateInstance(type); while (true) { reader.Read(); if ((int)reader.Token == 3) { break; } string text = (string)reader.Value; if (((ObjectMetadata)(ref val2)).Properties.TryGetValue(text, out var value3)) { if (value3.IsField) { FieldInfo fieldInfo = (FieldInfo)value3.Info; if (!fieldInfo.IsLiteral) { fieldInfo.SetValue(obj, ReadValue(value3.Type, reader)); } else { ReadValue(value3.Type, reader); } } else { PropertyInfo propertyInfo = (PropertyInfo)value3.Info; if (propertyInfo.CanWrite) { propertyInfo.SetValue(obj, ReadValue(value3.Type, reader), null); } else { ReadValue(value3.Type, reader); } } } else if (!((ObjectMetadata)(ref val2)).IsDictionary) { if (!reader.SkipNonMembers) { throw new JsonException($"The type {inst_type} doesn't have the property '{text}'"); } JsonMapper.ReadSkip(reader); } else { ((IDictionary)obj).Add(text, ReadValue(((ObjectMetadata)(ref val2)).ElementType, reader)); } } } return obj; } [MonoModReplace] private static void WriteValue(object obj, JsonWriter writer, bool writer_is_private, int depth) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04e4: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_058c: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_0565: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_015e: 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_01a2: Unknown result type (might be due to invalid IL or missing references) if (depth > JsonMapper.max_nesting_depth) { throw new JsonException($"Max allowed object depth reached while trying to export from type {obj.GetType()}"); } if (obj == null) { writer.Write((string)null); return; } if (obj is IJsonWrapper) { if (writer_is_private) { writer.TextWriter.Write(((IJsonWrapper)obj).ToJson()); } else { ((IJsonWrapper)obj).ToJson(writer); } return; } if (obj is Vector2) { writer.Write((Vector2)obj); return; } if (obj is Vector3) { writer.Write((Vector3)obj); return; } if (obj is Vector4) { writer.Write((Vector4)obj); return; } if (obj is Quaternion) { writer.Write((Quaternion)obj); return; } if (obj is Matrix4x4) { writer.Write((Matrix4x4)obj); return; } if (obj is Ray) { writer.Write((Ray)obj); return; } if (obj is RaycastHit) { writer.Write((RaycastHit)obj); return; } if (obj is Color) { writer.Write((Color)obj); return; } if (obj is Point) { writer.WritePoint((Point)obj); return; } if (obj is string) { writer.Write((string)obj); return; } if (obj is float) { writer.Write((float)obj); return; } if (obj is double) { writer.Write((double)obj); return; } if (obj is int) { writer.Write((int)obj); return; } if (obj is bool) { writer.Write((bool)obj); return; } if (obj is long) { writer.Write((long)obj); return; } if (obj is Array) { writer.WriteArrayStart(); foreach (object item in (Array)obj) { WriteValue(item, writer, writer_is_private, depth + 1); } writer.WriteArrayEnd(); return; } if (obj is IList) { writer.WriteArrayStart(); foreach (object item2 in (IList)obj) { WriteValue(item2, writer, writer_is_private, depth + 1); } writer.WriteArrayEnd(); return; } if (obj is IDictionary) { writer.WriteObjectStart(); foreach (DictionaryEntry item3 in (IDictionary)obj) { writer.WritePropertyName((string)item3.Key); WriteValue(item3.Value, writer, writer_is_private, depth + 1); } writer.WriteObjectEnd(); return; } Type type = obj.GetType(); if (JsonMapper.custom_exporters_table.ContainsKey(type)) { ExporterFunc val = JsonMapper.custom_exporters_table[type]; val.Invoke(obj, writer); return; } if (JsonMapper.base_exporters_table.ContainsKey(type)) { ExporterFunc val2 = JsonMapper.base_exporters_table[type]; val2.Invoke(obj, writer); return; } if (obj is Enum) { Type underlyingType = Enum.GetUnderlyingType(type); if ((object)underlyingType == typeof(long) || (object)underlyingType == typeof(uint) || (object)underlyingType == typeof(ulong)) { writer.Write((ulong)obj); } else { writer.Write((int)obj); } return; } JsonMapper.AddTypeProperties(type); IList<PropertyMetadata> list = JsonMapper.type_properties[type]; writer.WriteObjectStart(); foreach (PropertyMetadata item4 in list) { if (item4.IsField) { FieldInfo fieldInfo = (FieldInfo)item4.Info; object value = fieldInfo.GetValue(obj); if (value != null && (!(value is Array) || ((Array)value).Length != 0) && (!(value is IList) || ((IList)value).Count != 0) && (!(value is IDictionary) || ((IDictionary)value).Count != 0)) { writer.WritePropertyName(item4.Info.Name); WriteValue(value, writer, writer_is_private, depth + 1); } continue; } PropertyInfo propertyInfo = (PropertyInfo)item4.Info; object obj2 = null; try { obj2 = propertyInfo.GetValue(obj, null); } catch { if (FFU_BR_Defs.JsonLogging) { string text = propertyInfo.DeclaringType?.FullName ?? "<unknown_type>"; string text2 = propertyInfo.Name ?? "<unnamed>"; string text3 = propertyInfo.GetGetMethod()?.Name ?? "<no_getter>"; string text4 = obj?.GetType()?.FullName ?? "<root_unknown>"; Debug.Log((object)("#Parser# Failed to Write: " + text + "." + text2 + " (getter: " + text3 + ") while serializing " + text4)); } continue; } if (obj2 != null && (!(obj2 is Array) || ((Array)obj2).Length != 0) && (!(obj2 is IList) || ((IList)obj2).Count != 0) && (!(obj2 is IDictionary) || ((IDictionary)obj2).Count != 0) && propertyInfo.CanRead) { writer.WritePropertyName(item4.Info.Name); WriteValue(obj2, writer, writer_is_private, depth + 1); } } writer.WriteObjectEnd(); } } } namespace FFU_Beyond_Reach { public class FFU_BR_Defs { public enum SyncLogs { None, ModChanges, DeepCopy, ModdedDump, ExtendedDump, ContentDump, SourceDump } public enum ActLogs { None, Interactions, Runtime } public static readonly string ModName = "Fight For Universe: Beyond Reach"; public static readonly string ModVersion = "0.5.5.2"; private static ConfigFile ModDefs = null; public static SyncLogs SyncLogging = SyncLogs.None; public static ActLogs ActLogging = ActLogs.None; public static bool JsonLogging = false; public static bool DynamicRandomRange = true; public static int MaxLogTextSize = 16382; public static bool ModSyncLoading = true; public static bool EnableCodeFixes = true; public static bool ModifyUpperLimit = false; public static float BonusUpperLimit = 1000f; public static float SuitOxygenNotify = 10f; public static float SuitPowerNotify = 15f; public static bool ShowEachO2Battery = true; public static bool StrictInvSorting = true; public static bool AltTempEnabled = true; public static string AltTempSymbol = "C"; public static float AltTempMult = 1f; public static float AltTempShift = -273.15f; public static bool TowBraceAllowsKeep = true; public static bool OrgInventoryMode = true; public static float[] OrgInventoryTweaks = new float[3] { -35f, 0f, 0f }; public static bool BetterInvTransfer = true; public static bool QuickBarPinning = false; public static float[] QuickBarTweaks = new float[3] { -495f, 340f, 1f }; public static bool NoSkillTraitCost = false; public static bool AllowSuperChars = false; public static float SuperCharMultiplier = 10f; public static string[] SuperCharacters = new string[2] { "Exact Char Name One", "Exact Char Name Two" }; public const string SYM_DIV = "|"; public const string SYM_EQU = "="; public const string SYM_IGN = "*"; public const string SYM_INV = "!"; public const string CMD_SWITCH_SLT = "Switch_Slotted"; public const string CMD_REC_MISSING = "Recover_Missing"; public const string CMD_CONDS_SYN = "Sync_Conditions"; public const string CMD_CONDS_UPD = "Update_Conditions"; public const string CMD_EFFECT_SLT = "Sync_Slot_Effects"; public const string CMD_EFFECT_INV = "Sync_Inv_Effects"; public const string FLAG_INVERSE = "*IsInverse*"; public const string OPT_DEL = "~"; public const string OPT_MOD = "*"; public const string OPT_REM = "-"; public static void InitConfig() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown ModDefs = new ConfigFile(Path.Combine(Paths.ConfigPath, "FFU_Beyond_Reach.cfg"), true); Debug.Log((object)(ModName + " v" + ModVersion)); Debug.Log((object)"Loading Mod Configuration..."); SyncLogging = ModDefs.Bind<SyncLogs>("ConfigSettings", "SyncLogging", SyncLogging, "Defines what changes will be shown in the log during sync loading.").Value; ActLogging = ModDefs.Bind<ActLogs>("ConfigSettings", "ActLogging", ActLogging, "Defines what activity will be shown in the log during gameplay/runtime.").Value; JsonLogging = ModDefs.Bind<bool>("ConfigSettings", "JsonLogging", JsonLogging, "Defines if JSON parsing errors will be shown in the log during loading.").Value; DynamicRandomRange = ModDefs.Bind<bool>("ConfigSettings", "DynamicRandomRange", DynamicRandomRange, "By default loot random range is limited to 1f, thus preventing use of loot tables, if total sum of their chances goes beyond 1f. This feature allows to increase max possible random range beyond 1f, to the total sum of all chances in the loot table.").Value; MaxLogTextSize = ModDefs.Bind<int>("ConfigSettings", "MaxLogTextSize", MaxLogTextSize, "Defines the max length of the text in the console. May impact performance.").Value; ModSyncLoading = ModDefs.Bind<bool>("ConfigSettings", "ModSyncLoading", ModSyncLoading, "Enables smart loading of modified COs and synchronizing of existing CO saved data with updated CO templates, if they are mapped in the mod info file.").Value; EnableCodeFixes = ModDefs.Bind<bool>("ConfigSettings", "EnableCodeFixes", EnableCodeFixes, "Enables various vanilla code fixes. Added for cross-version compatibility. If causes any issues, please disable. Option might have no effect in future versions.").Value; ModifyUpperLimit = ModDefs.Bind<bool>("GameplaySettings", "ModifyUpperLimit", ModifyUpperLimit, "Allows to change skill and trait modifier upper limit value.").Value; BonusUpperLimit = ModDefs.Bind<float>("GameplaySettings", "BonusUpperLimit", BonusUpperLimit, "Defines the upper limit for skill and trait modifier. Original value is 10.").Value; SuitOxygenNotify = ModDefs.Bind<float>("GameplaySettings", "SuitOxygenNotify", SuitOxygenNotify, "Specifies the oxygen level threshold (as a percentage) for the gauge of a sealed/airtight suit. When the oxygen level falls below this threshold, the wearer will receive a notification (via occasional beeps) about oxygen usage. If set to 0, no notification will be given at any time.").Value; SuitPowerNotify = ModDefs.Bind<float>("GameplaySettings", "SuitPowerNotify", SuitPowerNotify, "Specifies the power level threshold (as a percentage) for the gauge of a sealed/airtight suit. When the power level falls below this threshold, the wearer will receive a notification (via frequent beeps) about power usage. If set to 0, no notification will be given at any time.").Value; ShowEachO2Battery = ModDefs.Bind<bool>("GameplaySettings", "ShowEachO2Battery", ShowEachO2Battery, "Defines whether to show average percentage across all O2/Batteries or calculate each O2/Battery independently and summarize their percentages. Affects how soon notifications will begin.").Value; StrictInvSorting = ModDefs.Bind<bool>("GameplaySettings", "StrictInvSorting", StrictInvSorting, "Enables custom, order-based inventory windows sorting that enforces strict UI rendering order.").Value; Debug.Log((object)$"GameplaySettings => ModifyUpperLimit: {ModifyUpperLimit}"); Debug.Log((object)$"GameplaySettings => BonusUpperLimit: {BonusUpperLimit}"); Debug.Log((object)$"GameplaySettings => SuitOxygenNotify: {SuitOxygenNotify}%"); Debug.Log((object)$"GameplaySettings => SuitPowerNotify: {SuitPowerNotify}%"); Debug.Log((object)$"GameplaySettings => ShowEachO2Battery: {ShowEachO2Battery}"); Debug.Log((object)$"GameplaySettings => StrictInvSorting: {StrictInvSorting}"); AltTempEnabled = ModDefs.Bind<bool>("QualitySettings", "AltTempEnabled", AltTempEnabled, "Allows to show temperature in alternative measure beside Kelvin value.").Value; AltTempSymbol = ModDefs.Bind<string>("QualitySettings", "AltTempSymbol", AltTempSymbol, "What symbol will represent alternative temperature measure.").Value; AltTempMult = ModDefs.Bind<float>("QualitySettings", "AltTempMult", AltTempMult, "Alternative temperature multiplier for conversion from Kelvin.").Value; AltTempShift = ModDefs.Bind<float>("QualitySettings", "AltTempShift", AltTempShift, "Alternative temperature value shift f
monomod/Assembly-CSharp.FFU_BR_Extended.mm.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text; using FFU_Beyond_Reach; using Microsoft.CodeAnalysis; using MonoMod; using Ostranauts.Core; using Ostranauts.Core.Models; using Ostranauts.Objectives; using Ostranauts.Tools; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] 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; } } } public class patch_CondTrigger : CondTrigger { private JsonMathOp[] _aMathOps; public int nMaxDepth { get; set; } public string strMathCond { get; set; } public JsonMathOp[] aMathOps { get { return _aMathOps; } set { base._valuesWereChanged = true; _aMathOps = value; } } public string RulesInfo { [MonoModReplace] get { if (base.strFailReason != null) { return base.strFailReason; } Condition val = null; StringBuilder stringBuilder = new StringBuilder(); if (base.bAND) { for (int i = 0; i < ((CondTrigger)this).aReqs.Length; i++) { if (i == 0) { if (stringBuilder.Length > 0) { stringBuilder.Append(" "); } stringBuilder.Append("Is "); } else if (i == ((CondTrigger)this).aReqs.Length - 1) { stringBuilder.Append(", and "); } else if (i > 0) { stringBuilder.Append(", "); } val = DataHandler.GetCond(((CondTrigger)this).aReqs[i]); stringBuilder.Append(val.strNameFriendly); if (i == ((CondTrigger)this).aReqs.Length - 1) { stringBuilder.Append("."); } } for (int j = 0; j < ((CondTrigger)this).aForbids.Length; j++) { if (j == 0) { if (stringBuilder.Length > 0) { stringBuilder.Append(" "); } stringBuilder.Append("Is NOT "); } else if (j == ((CondTrigger)this).aForbids.Length - 1) { stringBuilder.Append(", and "); } else if (j > 0) { stringBuilder.Append(", "); } val = DataHandler.GetCond(((CondTrigger)this).aForbids[j]); stringBuilder.Append(val.strNameFriendly); if (j == ((CondTrigger)this).aForbids.Length - 1) { stringBuilder.Append("."); } } if (strMathCond != null && aMathOps.Length != 0) { val = DataHandler.GetCond(strMathCond); if (stringBuilder.Length > 0) { stringBuilder.Append(" And "); } stringBuilder.Append(val.strNameFriendly + " is"); for (int k = 0; k < aMathOps.Length; k++) { if (!string.IsNullOrEmpty(aMathOps[k].strID)) { if (k == 0) { stringBuilder.Append(" "); } else if (k == aMathOps.Length - 1) { stringBuilder.Append(", and "); } else if (k > 0) { stringBuilder.Append(", "); } if (aMathOps[k].strCond == null) { stringBuilder.Append(MathToString(aMathOps[k].nMathOp) + " "); stringBuilder.Append(aMathOps[k].fMathVal); } else { val = DataHandler.GetCond(aMathOps[k].strCond); stringBuilder.Append(MathToString(aMathOps[k].nMathOp) + " "); stringBuilder.Append(FormatTwoDecimals((double)aMathOps[k].fMathVal * 100.0) + "% of "); stringBuilder.Append(val.strNameFriendly); } if (k == aMathOps.Length - 1) { stringBuilder.Append("."); } } } } if (((CondTrigger)this).strHigherCond != null && ((CondTrigger)this).aLowerConds.Length != 0) { val = DataHandler.GetCond(((CondTrigger)this).strHigherCond); if (stringBuilder.Length > 0) { stringBuilder.Append(" And "); } stringBuilder.Append(val.strNameFriendly + " is higher than"); for (int l = 0; l < ((CondTrigger)this).aLowerConds.Length; l++) { if (l == 0) { stringBuilder.Append(" "); } else if (l == ((CondTrigger)this).aLowerConds.Length - 1) { stringBuilder.Append(", and "); } else if (l > 0) { stringBuilder.Append(", "); } val = DataHandler.GetCond(((CondTrigger)this).aLowerConds[l]); stringBuilder.Append(val.strNameFriendly); if (l == ((CondTrigger)this).aLowerConds.Length - 1) { stringBuilder.Append("."); } } } string[] aTriggers = ((CondTrigger)this).aTriggers; string[] array = aTriggers; foreach (string text in array) { if (stringBuilder.Length > 0) { stringBuilder.Append(" And "); } CondTrigger trigger = ((CondTrigger)this).GetTrigger(text, (CTDict)0); stringBuilder.Append("{" + trigger.RulesInfo + "}"); } } else { for (int n = 0; n < ((CondTrigger)this).aForbids.Length; n++) { if (n == 0) { if (stringBuilder.Length > 0) { stringBuilder.Append(" "); } stringBuilder.Append("Is NOT "); } else if (n == ((CondTrigger)this).aForbids.Length - 1) { stringBuilder.Append(", or "); } else if (n > 0) { stringBuilder.Append(", "); } val = DataHandler.GetCond(((CondTrigger)this).aForbids[n]); stringBuilder.Append(val.strNameFriendly); if (n == ((CondTrigger)this).aForbids.Length - 1) { stringBuilder.Append("."); } } for (int num = 0; num < ((CondTrigger)this).aReqs.Length; num++) { if (num == 0) { if (stringBuilder.Length > 0) { stringBuilder.Append(" "); } stringBuilder.Append("Is "); } else if (num == ((CondTrigger)this).aReqs.Length - 1) { stringBuilder.Append(", or "); } else if (num > 0) { stringBuilder.Append(", "); } val = DataHandler.GetCond(((CondTrigger)this).aReqs[num]); stringBuilder.Append(val.strNameFriendly); if (num == ((CondTrigger)this).aReqs.Length - 1) { stringBuilder.Append("."); } } if (strMathCond != null && aMathOps.Length != 0) { val = DataHandler.GetCond(strMathCond); if (stringBuilder.Length > 0) { stringBuilder.Append(" Or "); } stringBuilder.Append(val.strNameFriendly + " is"); for (int num2 = 0; num2 < aMathOps.Length; num2++) { if (!string.IsNullOrEmpty(aMathOps[num2].strID)) { if (num2 == 0) { stringBuilder.Append(" "); } else if (num2 == aMathOps.Length - 1) { stringBuilder.Append(", or "); } else if (num2 > 0) { stringBuilder.Append(", "); } if (aMathOps[num2].strCond == null) { stringBuilder.Append(MathToString(aMathOps[num2].nMathOp) + " "); stringBuilder.Append(aMathOps[num2].fMathVal); } else { val = DataHandler.GetCond(aMathOps[num2].strCond); stringBuilder.Append(MathToString(aMathOps[num2].nMathOp) + " "); stringBuilder.Append(FormatTwoDecimals((double)aMathOps[num2].fMathVal * 100.0) + "% of "); stringBuilder.Append(val.strNameFriendly); } if (num2 == aMathOps.Length - 1) { stringBuilder.Append("."); } } } } if (((CondTrigger)this).strHigherCond != null && ((CondTrigger)this).aLowerConds.Length != 0) { val = DataHandler.GetCond(((CondTrigger)this).strHigherCond); if (stringBuilder.Length > 0) { stringBuilder.Append(" Or "); } stringBuilder.Append(val.strNameFriendly + " is higher than"); for (int num3 = 0; num3 < ((CondTrigger)this).aLowerConds.Length; num3++) { if (num3 == 0) { stringBuilder.Append(" "); } else if (num3 == ((CondTrigger)this).aLowerConds.Length - 1) { stringBuilder.Append(", or "); } else if (num3 > 0) { stringBuilder.Append(", "); } val = DataHandler.GetCond(((CondTrigger)this).aLowerConds[num3]); stringBuilder.Append(val.strNameFriendly); if (num3 == ((CondTrigger)this).aLowerConds.Length - 1) { stringBuilder.Append("."); } } } string[] aTriggers2 = ((CondTrigger)this).aTriggers; string[] array2 = aTriggers2; foreach (string text2 in array2) { if (stringBuilder.Length > 0) { stringBuilder.Append(" Or "); } CondTrigger trigger2 = ((CondTrigger)this).GetTrigger(text2, (CTDict)0); stringBuilder.Append("{" + trigger2.RulesInfo + "}"); } string[] aTriggersForbid = ((CondTrigger)this).aTriggersForbid; string[] array3 = aTriggersForbid; foreach (string text3 in array3) { if (stringBuilder.Length > 0) { stringBuilder.Append(" Not "); } else { stringBuilder.Append("Not "); } CondTrigger trigger3 = ((CondTrigger)this).GetTrigger(text3, (CTDict)1); stringBuilder.Append("{" + trigger3.RulesInfo + "}"); } } base.strFailReason = stringBuilder.ToString(); return base.strFailReason; } } public string RulesInfoDev { get { Condition val = null; StringBuilder stringBuilder = new StringBuilder(); if (base.bAND) { for (int i = 0; i < ((CondTrigger)this).aReqs.Length; i++) { if (i == 0) { if (stringBuilder.Length > 0) { stringBuilder.Append(" "); } stringBuilder.Append("Is "); } else if (i == ((CondTrigger)this).aReqs.Length - 1) { stringBuilder.Append(", and "); } else if (i > 0) { stringBuilder.Append(", "); } val = DataHandler.GetCond(((CondTrigger)this).aReqs[i]); stringBuilder.Append(val.strName); if (i == ((CondTrigger)this).aReqs.Length - 1) { stringBuilder.Append("."); } } for (int j = 0; j < ((CondTrigger)this).aForbids.Length; j++) { if (j == 0) { if (stringBuilder.Length > 0) { stringBuilder.Append(" "); } stringBuilder.Append("Is NOT "); } else if (j == ((CondTrigger)this).aForbids.Length - 1) { stringBuilder.Append(", and "); } else if (j > 0) { stringBuilder.Append(", "); } val = DataHandler.GetCond(((CondTrigger)this).aForbids[j]); stringBuilder.Append(val.strName); if (j == ((CondTrigger)this).aForbids.Length - 1) { stringBuilder.Append("."); } } if (strMathCond != null && aMathOps.Length != 0) { val = DataHandler.GetCond(strMathCond); if (stringBuilder.Length > 0) { stringBuilder.Append(" And "); } stringBuilder.Append(val.strName + " is"); for (int k = 0; k < aMathOps.Length; k++) { if (!string.IsNullOrEmpty(aMathOps[k].strID)) { if (k == 0) { stringBuilder.Append(" "); } else if (k == aMathOps.Length - 1) { stringBuilder.Append(", and "); } else if (k > 0) { stringBuilder.Append(", "); } if (aMathOps[k].strCond == null) { stringBuilder.Append(MathToString(aMathOps[k].nMathOp) + " "); stringBuilder.Append(aMathOps[k].fMathVal); } else { val = DataHandler.GetCond(aMathOps[k].strCond); stringBuilder.Append(MathToString(aMathOps[k].nMathOp) + " "); stringBuilder.Append(FormatTwoDecimals((double)aMathOps[k].fMathVal * 100.0) + "% of "); stringBuilder.Append(val.strName); } if (k == aMathOps.Length - 1) { stringBuilder.Append("."); } } } } if (((CondTrigger)this).strHigherCond != null && ((CondTrigger)this).aLowerConds.Length != 0) { val = DataHandler.GetCond(((CondTrigger)this).strHigherCond); if (stringBuilder.Length > 0) { stringBuilder.Append(" And "); } stringBuilder.Append(val.strName + " is higher than"); for (int l = 0; l < ((CondTrigger)this).aLowerConds.Length; l++) { if (l == 0) { stringBuilder.Append(" "); } else if (l == ((CondTrigger)this).aLowerConds.Length - 1) { stringBuilder.Append(", and "); } else if (l > 0) { stringBuilder.Append(", "); } val = DataHandler.GetCond(((CondTrigger)this).aLowerConds[l]); stringBuilder.Append(val.strName); if (l == ((CondTrigger)this).aLowerConds.Length - 1) { stringBuilder.Append("."); } } } string[] aTriggers = ((CondTrigger)this).aTriggers; string[] array = aTriggers; foreach (string text in array) { if (stringBuilder.Length > 0) { stringBuilder.Append(" And "); } patch_CondTrigger patch_CondTrigger2 = ((CondTrigger)this).GetTrigger(text, (CTDict)0) as patch_CondTrigger; stringBuilder.Append("{" + patch_CondTrigger2.RulesInfoDev + "}"); } } else { for (int n = 0; n < ((CondTrigger)this).aForbids.Length; n++) { if (n == 0) { if (stringBuilder.Length > 0) { stringBuilder.Append(" "); } stringBuilder.Append("Is NOT "); } else if (n == ((CondTrigger)this).aForbids.Length - 1) { stringBuilder.Append(", or "); } else if (n > 0) { stringBuilder.Append(", "); } val = DataHandler.GetCond(((CondTrigger)this).aForbids[n]); stringBuilder.Append(val.strName); if (n == ((CondTrigger)this).aForbids.Length - 1) { stringBuilder.Append("."); } } for (int num = 0; num < ((CondTrigger)this).aReqs.Length; num++) { if (num == 0) { if (stringBuilder.Length > 0) { stringBuilder.Append(" "); } stringBuilder.Append("Is "); } else if (num == ((CondTrigger)this).aReqs.Length - 1) { stringBuilder.Append(", or "); } else if (num > 0) { stringBuilder.Append(", "); } val = DataHandler.GetCond(((CondTrigger)this).aReqs[num]); stringBuilder.Append(val.strName); if (num == ((CondTrigger)this).aReqs.Length - 1) { stringBuilder.Append("."); } } if (strMathCond != null && aMathOps.Length != 0) { val = DataHandler.GetCond(strMathCond); if (stringBuilder.Length > 0) { stringBuilder.Append(" Or "); } stringBuilder.Append(val.strName + " is"); for (int num2 = 0; num2 < aMathOps.Length; num2++) { if (!string.IsNullOrEmpty(aMathOps[num2].strID)) { if (num2 == 0) { stringBuilder.Append(" "); } else if (num2 == aMathOps.Length - 1) { stringBuilder.Append(", or "); } else if (num2 > 0) { stringBuilder.Append(", "); } if (aMathOps[num2].strCond == null) { stringBuilder.Append(MathToString(aMathOps[num2].nMathOp) + " "); stringBuilder.Append(aMathOps[num2].fMathVal); } else { val = DataHandler.GetCond(aMathOps[num2].strCond); stringBuilder.Append(MathToString(aMathOps[num2].nMathOp) + " "); stringBuilder.Append(FormatTwoDecimals((double)aMathOps[num2].fMathVal * 100.0) + "% of "); stringBuilder.Append(val.strName); } if (num2 == aMathOps.Length - 1) { stringBuilder.Append("."); } } } } if (((CondTrigger)this).strHigherCond != null && ((CondTrigger)this).aLowerConds.Length != 0) { val = DataHandler.GetCond(((CondTrigger)this).strHigherCond); if (stringBuilder.Length > 0) { stringBuilder.Append(" Or "); } stringBuilder.Append(val.strName + " is higher than"); for (int num3 = 0; num3 < ((CondTrigger)this).aLowerConds.Length; num3++) { if (num3 == 0) { stringBuilder.Append(" "); } else if (num3 == ((CondTrigger)this).aLowerConds.Length - 1) { stringBuilder.Append(", or "); } else if (num3 > 0) { stringBuilder.Append(", "); } val = DataHandler.GetCond(((CondTrigger)this).aLowerConds[num3]); stringBuilder.Append(val.strName); if (num3 == ((CondTrigger)this).aLowerConds.Length - 1) { stringBuilder.Append("."); } } } string[] aTriggers2 = ((CondTrigger)this).aTriggers; string[] array2 = aTriggers2; foreach (string text2 in array2) { if (stringBuilder.Length > 0) { stringBuilder.Append(" Or "); } patch_CondTrigger patch_CondTrigger3 = ((CondTrigger)this).GetTrigger(text2, (CTDict)0) as patch_CondTrigger; stringBuilder.Append("{" + patch_CondTrigger3.RulesInfoDev + "}"); } string[] aTriggersForbid = ((CondTrigger)this).aTriggersForbid; string[] array3 = aTriggersForbid; foreach (string text3 in array3) { if (stringBuilder.Length > 0) { stringBuilder.Append(" Not "); } else { stringBuilder.Append("Not "); } patch_CondTrigger patch_CondTrigger4 = ((CondTrigger)this).GetTrigger(text3, (CTDict)1) as patch_CondTrigger; stringBuilder.Append("{" + patch_CondTrigger4.RulesInfoDev + "}"); } } return stringBuilder.ToString(); } } private extern void orig_Init(); private void Init() { orig_Init(); aMathOps = new JsonMathOp[0]; base._valuesWereChanged = false; } public extern CondTrigger orig_Clone(); public CondTrigger Clone() { patch_CondTrigger patch_CondTrigger2 = orig_Clone() as patch_CondTrigger; patch_CondTrigger2.nMaxDepth = nMaxDepth; patch_CondTrigger2.strMathCond = strMathCond; patch_CondTrigger2.aMathOps = aMathOps; return (CondTrigger)(object)patch_CondTrigger2; } public extern CondTrigger orig_CloneDeep(string strFind, string strReplace); public CondTrigger CloneDeep(string strFind, string strReplace) { patch_CondTrigger patch_CondTrigger2 = orig_CloneDeep(strFind, strReplace) as patch_CondTrigger; if (aMathOps != null) { patch_CondTrigger2.aMathOps = new JsonMathOp[aMathOps.Length]; for (int i = 0; i < aMathOps.Length; i++) { patch_CondTrigger2.aMathOps[i] = new JsonMathOp(); patch_CondTrigger2.aMathOps[i].strID = aMathOps[i].strID; patch_CondTrigger2.aMathOps[i].strCond = CondTrigger.CloneDeep(aMathOps[i].strCond, strReplace, strFind); patch_CondTrigger2.aMathOps[i].nMathOp = aMathOps[i].nMathOp; patch_CondTrigger2.aMathOps[i].fMathVal = aMathOps[i].fMathVal; ((CondTrigger)patch_CondTrigger2)._isBlank = false; } } return (CondTrigger)(object)patch_CondTrigger2; } [MonoModReplace] public bool IsBlank() { if ((base._isBlank || base._valuesWereChanged) && ((double)((CondTrigger)this).fChance < 1.0 || ((CondTrigger)this).aReqs.Length != 0 || ((CondTrigger)this).aForbids.Length != 0 || ((CondTrigger)this).aTriggers.Length != 0 || ((CondTrigger)this).aTriggersForbid.Length != 0 || ((CondTrigger)this).aLowerConds.Length != 0 || aMathOps.Length != 0)) { base._isBlank = false; } return base._isBlank; } [MonoModReplace] public bool Triggered(CondOwner objOwner, string strIAStatsName = null, bool logOutcome = true) { if (base.logReason) { base.logReason = logOutcome; } base.strFailReasonLast = string.Empty; if ((Object)(object)objOwner == (Object)null) { return false; } if (nMaxDepth > 0 && GetDepth(objOwner) > nMaxDepth) { return false; } if (IsBlank()) { return true; } objOwner.ValidateParent(); SocialStats value = null; if (strIAStatsName != null && DataHandler.dictSocialStats.TryGetValue(strIAStatsName, out value)) { SocialStats obj = value; obj.nChecked++; } if (!CondTrigger.bChanceSkip && ((CondTrigger)this).fChance < 1f) { float num = MathUtils.Rand(0f, 1f, (RandType)0, (string)null); if (num > ((CondTrigger)this).fChance) { if (value != null) { SocialStats obj2 = value; obj2.nChecked++; } if (base.logReason) { base.strFailReasonLast = $"Chance: {num} / {((CondTrigger)this).fChance}"; } return false; } } Condition value2; if (base.bAND) { if (strMathCond != null) { value2 = null; double num2 = 0.0; objOwner.mapConds.TryGetValue(strMathCond, out value2); if (value2 != null) { num2 = value2.fCount; } JsonMathOp[] array = aMathOps; JsonMathOp[] array2 = array; foreach (JsonMathOp jsonMathOp in array2) { if (string.IsNullOrEmpty(jsonMathOp.strID)) { continue; } if (jsonMathOp.strCond == null) { int nMathOp = jsonMathOp.nMathOp; double num3 = jsonMathOp.fMathVal; if (!MathTrigger(nMathOp, num2, num3)) { if (base.logReason) { base.strFailReasonLast = "Math Lacking: " + $"{strMathCond} ({num2}) is {MathToString(nMathOp)} {num3}"; } return false; } } else { if (!objOwner.mapConds.TryGetValue(jsonMathOp.strCond, out value2)) { continue; } int nMathOp2 = jsonMathOp.nMathOp; double num4 = jsonMathOp.fMathVal; double num5 = value2.fCount * (double)jsonMathOp.fMathVal; if (!MathTrigger(nMathOp2, num2, num5)) { if (base.logReason) { base.strFailReasonLast = "Math Lacking: " + $"{strMathCond} ({num2}) is {MathToString(nMathOp2)} " + $"{FormatTwoDecimals(num4 * 100.0)}% of {jsonMathOp} ({num5})"; } return false; } } } } if (((CondTrigger)this).strHigherCond != null) { value2 = null; double num6 = 0.0; double num7 = 0.0; objOwner.mapConds.TryGetValue(((CondTrigger)this).strHigherCond, out value2); if (value2 != null) { num6 = value2.fCount; } string[] aLowerConds = ((CondTrigger)this).aLowerConds; string[] array3 = aLowerConds; foreach (string text in array3) { value2 = null; num7 = (objOwner.mapConds.TryGetValue(text, out value2) ? value2.fCount : 0.0); if (num7 > num6) { if (base.logReason) { base.strFailReasonLast = "Higher Lacking: " + $"{((CondTrigger)this).strHigherCond} ({num6}) is higher than {text} ({num7})"; } return false; } } } string[] aReqs = ((CondTrigger)this).aReqs; string[] array4 = aReqs; foreach (string text2 in array4) { if (!objOwner.mapConds.TryGetValue(text2, out value2)) { ((CondTrigger)this).StatsTrackReqs(strIAStatsName, text2, 1f); if (base.logReason) { base.strFailReasonLast = "Lacking: " + text2; } return false; } if (value2 == null || value2.fCount <= 0.0) { ((CondTrigger)this).StatsTrackReqs(strIAStatsName, text2, 1f); if (base.logReason) { base.strFailReasonLast = "Lacking: " + text2; } return false; } } value2 = null; string[] aForbids = ((CondTrigger)this).aForbids; string[] array5 = aForbids; foreach (string text3 in array5) { if (objOwner.mapConds.TryGetValue(text3, out value2) && value2.fCount > 0.0) { ((CondTrigger)this).StatsTrackForbids(strIAStatsName, text3, 1f); if (base.logReason) { base.strFailReasonLast = "Forbidden: " + text3; } return false; } } string[] aTriggers = ((CondTrigger)this).aTriggers; string[] array6 = aTriggers; foreach (string text4 in array6) { CondTrigger trigger = ((CondTrigger)this).GetTrigger(text4, (CTDict)0); if (!trigger.Triggered(objOwner, strIAStatsName, base.logReason)) { if (base.logReason) { base.strFailReasonLast = trigger.strFailReasonLast; } return false; } } return true; } string[] aForbids2 = ((CondTrigger)this).aForbids; string[] array7 = aForbids2; foreach (string text5 in array7) { if (objOwner.mapConds.TryGetValue(text5, out value2) && value2.fCount > 0.0) { ((CondTrigger)this).StatsTrackForbids(strIAStatsName, text5, 1f); if (base.logReason) { base.strFailReasonLast = "Forbidden: " + text5; } return false; } } string[] aTriggersForbid = ((CondTrigger)this).aTriggersForbid; string[] array8 = aTriggersForbid; foreach (string text6 in array8) { CondTrigger trigger2 = ((CondTrigger)this).GetTrigger(text6, (CTDict)1); if (!trigger2.Triggered(objOwner, strIAStatsName, base.logReason)) { if (base.logReason) { base.strFailReasonLast = trigger2.strFailReasonLast; } return false; } } string text7 = "Math Lacking: ("; bool flag = false; bool flag2 = false; if (strMathCond != null) { value2 = null; int mOperation = 0; double mTarget = 0.0; double num9 = 0.0; double num10 = 0.0; objOwner.mapConds.TryGetValue(strMathCond, out value2); if (value2 != null) { mTarget = value2.fCount; } JsonMathOp[] array9 = aMathOps; JsonMathOp[] array10 = array9; foreach (JsonMathOp jsonMathOp2 in array10) { if (string.IsNullOrEmpty(jsonMathOp2.strID)) { continue; } if (jsonMathOp2.strCond == null) { mOperation = jsonMathOp2.nMathOp; num10 = jsonMathOp2.fMathVal; if (MathTrigger(mOperation, mTarget, num10)) { return true; } } else if (objOwner.mapConds.TryGetValue(jsonMathOp2.strCond, out value2)) { mOperation = jsonMathOp2.nMathOp; num9 = jsonMathOp2.fMathVal; num10 = value2.fCount * num9; if (MathTrigger(mOperation, mTarget, num10)) { return true; } } if (base.logReason) { text7 = ((jsonMathOp2.strCond == null) ? ((!flag) ? (text7 + $"{strMathCond} is {MathToString(mOperation)} {num10}") : (text7 + ", " + $"{strMathCond} is {MathToString(mOperation)} {num10}")) : ((!flag) ? (text7 + strMathCond + " is " + MathToString(mOperation) + " " + $"{FormatTwoDecimals(num9 * 100.0)}% of {jsonMathOp2}") : (text7 + ", " + strMathCond + " is " + MathToString(mOperation) + " " + $"{FormatTwoDecimals(num9 * 100.0)}% of {jsonMathOp2}"))); } flag = true; } } else { flag2 = true; } if (flag && base.logReason) { base.strFailReasonLast = base.strFailReasonLast + ((base.strFailReasonLast.Length > 0) ? " " : "") + text7 + ")"; } if (base.logReason) { text7 = "Higher Lacking: ("; } flag = false; bool flag3 = false; if (((CondTrigger)this).strHigherCond != null) { value2 = null; double num12 = 0.0; objOwner.mapConds.TryGetValue(((CondTrigger)this).strHigherCond, out value2); if (value2 != null) { num12 = value2.fCount; } string[] aLowerConds2 = ((CondTrigger)this).aLowerConds; string[] array11 = aLowerConds2; foreach (string text8 in array11) { value2 = null; if (objOwner.mapConds.TryGetValue(text8, out value2) && value2.fCount <= num12) { return true; } if (base.logReason) { text7 = ((!flag) ? (text7 + ((CondTrigger)this).strHigherCond + " is higher than " + text8) : (text7 + ", " + ((CondTrigger)this).strHigherCond + " is higher than " + text8)); } flag = true; } } else { flag3 = true; } if (flag && base.logReason) { base.strFailReasonLast = base.strFailReasonLast + ((base.strFailReasonLast.Length > 0) ? " " : "") + text7 + ")"; } if (base.logReason) { text7 = "Reqs Lacking: ("; } flag = false; string[] aReqs2 = ((CondTrigger)this).aReqs; string[] array12 = aReqs2; foreach (string text9 in array12) { if (objOwner.mapConds.TryGetValue(text9, out value2) && value2 != null && value2.fCount > 0.0) { return true; } if (base.logReason) { text7 = ((!flag) ? (text7 + text9) : (text7 + ", " + text9)); } flag = true; } if (flag && base.logReason) { base.strFailReasonLast = base.strFailReasonLast + ((base.strFailReasonLast.Length > 0) ? " " : "") + text7 + ")"; } if (base.logReason) { text7 = "Triggers Lacking: ("; } flag = false; string[] aTriggers2 = ((CondTrigger)this).aTriggers; string[] array13 = aTriggers2; foreach (string text10 in array13) { CondTrigger trigger3 = ((CondTrigger)this).GetTrigger(text10, (CTDict)0); if (trigger3.Triggered(objOwner, strIAStatsName, base.logReason)) { return true; } if (base.logReason) { text7 = ((!flag) ? (text7 + text10 + " (" + trigger3.strFailReasonLast + ")") : (text7 + ", " + text10 + " (" + trigger3.strFailReasonLast + ")")); } flag = true; } if (flag && base.logReason) { base.strFailReasonLast = base.strFailReasonLast + ((base.strFailReasonLast.Length > 0) ? " " : "") + text7 + ")"; } if (((CondTrigger)this).aReqs.Length + ((CondTrigger)this).aTriggers.Length == 0 && flag2 && flag3) { return true; } string[] aReqs3 = ((CondTrigger)this).aReqs; string[] array14 = aReqs3; foreach (string text11 in array14) { ((CondTrigger)this).StatsTrackReqs(strIAStatsName, text11, 1f / (float)((CondTrigger)this).aReqs.Length); } return false; } public static int GetDepth(CondOwner objCO) { int num = 1; CondOwner objCOParent = objCO.objCOParent; while ((Object)(object)objCOParent != (Object)null) { objCOParent = objCOParent.objCOParent; num++; } return num; } public static bool MathTrigger(int mOperation, double mTarget, double mValue) { if (1 == 0) { } bool result = mOperation switch { 1 => mTarget != mValue, 2 => mTarget == mValue, 3 => mTarget > mValue, 4 => mTarget >= mValue, 5 => mTarget < mValue, 6 => mTarget <= mValue, _ => true, }; if (1 == 0) { } return result; } public static string MathToString(int mOperation) { if (1 == 0) { } string result = mOperation switch { 1 => "not equal to", 2 => "equal to", 3 => "greater than", 4 => "greater or equal to", 5 => "less than", 6 => "less or equal to", _ => "invalid for", }; if (1 == 0) { } return result; } public static string FormatTwoDecimals(double dVal) { double num = Math.Abs(dVal); if (num >= 1.0) { return dVal.ToString("0.##"); } if (dVal == 0.0) { return "0"; } int num2 = 0; int num3 = 0; double num4 = num; bool flag = false; while (num2 < 1 && num4 > 0.0 && !flag) { num4 *= 10.0; num3++; int num5 = (int)num4 % 10; if (num3 == 20) { flag = true; } if (num5 != 0) { num2++; num3++; } } if (flag) { return "0"; } string text = "0." + new string('#', num3); return dVal.ToString(text); } } [Serializable] public class JsonMathOp { public string strID { get; set; } public string strCond { get; set; } public int nMathOp { get; set; } public float fMathVal { get; set; } public override string ToString() { return strCond; } } public class patch_Heater : Heater { [MonoModReplace] private void Heat(double fTimePassed) { //IL_0128: 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) bool flag = false; CondOwner val = null; if (base.coUs.HasCond("IsOverrideOn")) { flag = true; } else if (base.coUs.HasCond("IsOverrideOff")) { flag = false; } else if (base.strRemoteID == null || base.strRemoteID == base.coUs.strID) { flag = base.coUs.HasCond(base.strSignalCond); val = base.coUs; } else { CondOwner cOByID = base.coUs.ship.GetCOByID(base.strRemoteID); if ((Object)(object)cOByID != (Object)null && cOByID.HasCond(base.strSignalCond)) { flag = true; val = cOByID; } } base.coUs.mapInfo.Remove("Status"); if (flag) { CondOwner val2 = null; CondOwner val3 = null; double num = 1.0; if (base.strAddPoint != "ignore") { List<CondOwner> list = new List<CondOwner>(); base.coUs.ship.GetCOsAtWorldCoords1(base.coUs.GetPos(base.strAddPoint, false), base.ct, false, false, list); if (list.Count != 0) { val2 = ((!list.Contains(base.coUs)) ? list[0] : base.coUs); } } if (base.strSubPoint != "ignore") { List<CondOwner> list2 = new List<CondOwner>(); base.coUs.ship.GetCOsAtWorldCoords1(base.coUs.GetPos(base.strSubPoint, false), base.ct, false, false, list2); if (list2.Count != 0) { val3 = ((!list2.Contains(base.coUs)) ? list2[0] : base.coUs); } } if ((Object)(object)val2 == (Object)null) { val2 = val3; num = 0.0 - num; val3 = null; } if ((Object)(object)val2 == (Object)null) { return; } string strCODef = val2.strCODef; if ((Object)(object)val3 != (Object)null) { strCODef = val3.strCODef; } double num2 = 20.7; double num3 = 0.9; double num4 = 5.67E-08; double num5 = 101.30000305175781; GasContainer gasContainer = val2.GasContainer; double condAmount = val2.GetCondAmount("StatGasTemp"); double condAmount2 = base.coUs.GetCondAmount("StatEmittedTemp"); if (condAmount2 == 0.0) { condAmount2 = base.coUs.GetCondAmount("StatSolidTemp"); } double condAmount3 = base.coUs.GetCondAmount("StatHeatArea"); double num6 = gasContainer.mapGasMols1["StatGasMolTotal"]; if (num6 == 0.0) { num6 = double.PositiveInfinity; } double num7 = condAmount2 * condAmount2 * condAmount2 * condAmount2 - condAmount * condAmount * condAmount * condAmount; double num8 = num3 * num4 * condAmount3 * num7; double condAmount4 = base.coUs.GetCondAmount("StatHeatVol"); double num9 = val2.GetCondAmount("StatVolume"); if (num9 == 0.0) { num9 = double.PositiveInfinity; } double num10 = condAmount4 / num9; double num11 = num8 / num2 / num6 * num10 * fTimePassed * num; double condAmount5 = val2.GetCondAmount("StatGasPressure"); if (condAmount5 < num5) { num11 *= condAmount5 / num5; } GasContainer obj = gasContainer; obj.fDGasTemp += num11; if ((Object)(object)val3 == (Object)null) { base.coUs.mapInfo["Status"] = "Heating"; return; } num = 0.0 - num; gasContainer = val3.GasContainer; condAmount = val3.GetCondAmount("StatGasTemp"); num6 = gasContainer.mapGasMols1["StatGasMolTotal"]; if (num6 == 0.0) { num6 = double.PositiveInfinity; } num9 = val3.GetCondAmount("StatVolume"); if (num9 == 0.0) { num9 = double.PositiveInfinity; } num10 = condAmount4 / num9; num11 = num8 / num2 / num6 * num10 * fTimePassed * num; condAmount5 = val3.GetCondAmount("StatGasPressure"); if (condAmount5 < num5) { num11 *= condAmount5 / num5; } GasContainer obj2 = gasContainer; obj2.fDGasTemp += num11; base.coUs.mapInfo["Status"] = "Cooling"; } else { base.coUs.mapInfo["Status"] = "Idle"; } } } public class patch_JsonInteraction : JsonInteraction { public bool bForceVerbose { get; set; } public bool bRoomLookup { get; set; } } public class patch_Interaction : Interaction { public bool bForceVerbose; public bool bRoomLookup; public bool bWriteToLog; private extern void orig_SetData(JsonInteraction jsonIn, JsonInteractionSave jis = null); private void SetData(JsonInteraction jsonIn, JsonInteractionSave jis = null) { orig_SetData(jsonIn, jis); if (jsonIn != null) { bForceVerbose = (jsonIn as patch_JsonInteraction).bForceVerbose; bRoomLookup = (jsonIn as patch_JsonInteraction).bRoomLookup; bWriteToLog = FFU_BR_Defs.ActLogging >= FFU_BR_Defs.ActLogs.Interactions && bForceVerbose; } } private extern void orig_AddFailReason(string strKey, string strReason); private void AddFailReason(string strKey, string strReason) { if (bWriteToLog && strReason != Interaction.STR_IA_FAIL_DEFAULT) { Debug.Log((object)("#Interaction# " + base.strName + " (US: " + (((Interaction)this).objUs?.strName ?? "N/A") + ", THEM: " + (((Interaction)this).objThem?.strName ?? "N/A") + ", 3RD: " + (((Interaction)this).obj3rd?.strName ?? "N/A") + ") => [Failed] " + strKey + ": " + (string.IsNullOrEmpty(strReason) ? "N/A" : strReason))); } orig_AddFailReason(strKey, strReason); } private extern bool orig_TriggeredInternal(CondOwner objUs, CondOwner objThem, bool bStats = false, bool bIgnoreItems = false, bool bCheckPath = false, bool bFetchItems = true, List<string> aForbid3rds = null); private bool TriggeredInternal(CondOwner objUs, CondOwner objThem, bool bStats = false, bool bIgnoreItems = false, bool bCheckPath = false, bool bFetchItems = true, List<string> aForbid3rds = null) { if (bForceVerbose) { base.bVerboseTrigger = true; } return orig_TriggeredInternal(objUs, objThem, bStats, bIgnoreItems, bCheckPath, bFetchItems, aForbid3rds); } [MonoModReplace] public void ApplyLogging(string strOwner, bool bTraitSuffix) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Expected I4, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) string text = null; if (bWriteToLog) { text = GrammarUtils.GenerateDescription((Interaction)(object)this, true); Debug.Log((object)("#Interaction# " + base.strName + " (US: " + (((Interaction)this).objUs?.strName ?? "N/A") + ", THEM: " + (((Interaction)this).objThem?.strName ?? "N/A") + ", 3RD: " + (((Interaction)this).obj3rd?.strName ?? "N/A") + ") => " + text)); } if ((int)base.nLogging == 0 || base.bLogged) { return; } if (text == null) { text = GrammarUtils.GenerateDescription((Interaction)(object)this, true); } List<CondOwner> list = new List<CondOwner>(); Logging nLogging = base.nLogging; Logging val = nLogging; switch (val - 1) { case 0: list.Add(((Interaction)this).objUs); if (base.strThemType == Interaction.TARGET_OTHER) { list.Add(((Interaction)this).objThem); } break; case 1: if (((Interaction)this).objUs.currentRoom != null) { list.AddRange(((Interaction)this).objUs.ship.GetPeopleInRoom(((Interaction)this).objUs.currentRoom, (CondTrigger)null)); } else if (bRoomLookup) { List<CondOwner> list2 = new List<CondOwner>(); CondTrigger condTrigger = DataHandler.GetCondTrigger("TIsRoom"); ((Interaction)this).objUs.ship.GetCOsAtWorldCoords1(((Interaction)this).objUs.GetPos((string)null, false), condTrigger, false, false, list2); ((Interaction)this).objUs.currentRoom = list2.First().currentRoom; list.AddRange(((Interaction)this).objUs.ship.GetPeopleInRoom(((Interaction)this).objUs.currentRoom, (CondTrigger)null)); } if (!list.Contains(((Interaction)this).objUs)) { list.Add(((Interaction)this).objUs); } if (!list.Contains(((Interaction)this).objThem)) { list.Add(((Interaction)this).objThem); } break; case 2: if (((Interaction)this).objUs.ship != null) { list.AddRange(((Interaction)this).objUs.ship.GetPeople(true)); } break; } foreach (CondOwner item in list) { item.LogMessage(text, base.strColor, strOwner); } base.bLogged = true; } } public class patch_JsonSlot : JsonSlot { public int? nSlotOrder { get; set; } } public class patch_Slot : Slot { public int nSlotOrder; [MonoModIgnore] public extern patch_Slot(JsonSlot jslot); [MonoModOriginal] public extern void orig_Slot(JsonSlot jslot); [MonoModConstructor] public void Slot(patch_JsonSlot jslot) { orig_Slot((JsonSlot)(object)jslot); nSlotOrder = (jslot.nSlotOrder.HasValue ? jslot.nSlotOrder.Value : ((JsonSlot)jslot).nDepth); } [MonoModReplace] public bool CanFit(CondOwner coFit, bool bAuto = true, bool bSub = false) { if (base.aCOs == null) { return false; } CondOwner[] aCOs = base.aCOs; foreach (CondOwner val in aCOs) { if (base.bHoldSlot && (Object)(object)val == (Object)null && coFit.mapSlotEffects.ContainsKey(base.strName) && (!bAuto || ((Slot)this).CanAutoSlot(coFit))) { return true; } CondOwner val2 = val; while ((Object)(object)val2 != (Object)null) { if ((Object)(object)coFit == (Object)(object)val2) { return false; } val2 = val2.objCOParent; } if ((Object)(object)val != (Object)null && (Object)(object)val.objContainer != (Object)null && val.objContainer.CanFit(coFit, bAuto, bSub)) { return true; } } return false; } } public class patch_GUIInventory : GUIInventory { [MonoModReplace] public GUIInventoryWindow SpawnInventoryWindow(patch_CondOwner CO, InventoryWindowType type, GUIInventoryWindow winParent, Vector3? vPos = null) { //IL_0022: 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_0073: 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_02b1: 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_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0353: 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_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_04d2: Unknown result type (might be due to invalid IL or missing references) //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Unknown result type (might be due to invalid IL or missing references) //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)CO == (Object)null) { return null; } CanvasManager.ShowCanvasGroup(base.canvasGroup); bool flag = (int)type == 0 || (Object)(object)((CondOwner)CO).objContainer != (Object)null || ((CondOwner)CO).dictSlotsLayout.Count > 0; GUIInventoryWindow val = null; for (int i = 0; i < base.activeWindows.Count; i++) { if (!flag) { break; } if ((Object)(object)base.activeWindows[i].CO == (Object)(object)CO && type == base.activeWindows[i].type) { flag = false; val = base.activeWindows[i]; } } if (flag) { GameObject val2 = Object.Instantiate<GameObject>(base.inventoryGridPrefab, ((Component)this).transform); GUIInventoryWindow component = val2.GetComponent<GUIInventoryWindow>(); base.activeWindows.Add(component); component.SetData((CondOwner)(object)CO, type); val = component; } List<Slot> list = (FFU_BR_Defs.StrictInvSorting ? CO.GetSortedSlots() : ((CondOwner)CO).GetSlots(true, (SortOrder)1)); List<CondOwner> list2 = new List<CondOwner>(); foreach (Slot item in list) { if (item.strName == "social") { CondOwner val3 = item.aCOs.FirstOrDefault(); ((GUIInventory)this).SpawnSocialMovesWindow(val3); } else { if (item.bHide) { continue; } CondOwner[] aCOs = item.aCOs; CondOwner[] array = aCOs; foreach (CondOwner val4 in array) { if ((Object)(object)val4 != (Object)null && GUIInventory.CTOpenInv.Triggered(val4, (string)null, true) && ((Object)(object)val4.objContainer != (Object)null || (val4.dictSlotsLayout != null && val4.dictSlotsLayout.Count != 0))) { GUIInventoryWindow val5 = null; if (((CondOwner)CO).dictSlotsLayout != null && ((CondOwner)CO).dictSlotsLayout.ContainsKey(item.strName)) { val5 = ((GUIInventory)this).SpawnInventoryWindow(val4, (InventoryWindowType)1, val, (Vector3?)((CondOwner)CO).dictSlotsLayout[item.strName]); val5.ToggleTab(false); } else { list2.Add(val4); } } } } } if (flag) { Rect rect; if (vPos.HasValue && (Object)(object)winParent != (Object)null) { ((Component)val).transform.localPosition = ((Component)winParent).transform.localPosition + vPos.GetValueOrDefault() * 1.5f * CanvasManager.CanvasRatio; ((Component)val).transform.SetParent(((Component)winParent).transform, true); if (FFU_BR_Defs.ActLogging >= FFU_BR_Defs.ActLogs.Runtime) { string text = $"#DEBUG# Windows/Parent Index: {base.activeWindows.IndexOf(val)}"; object arg = base.activeWindows.IndexOf(winParent); rect = val.gridBorderRect.rect; object arg2 = ((Rect)(ref rect)).x; rect = val.gridBorderRect.rect; string text2 = $"/{arg}, X: {arg2}, Y: {((Rect)(ref rect)).y}, Height: "; rect = val.gridBorderRect.rect; object arg3 = ((Rect)(ref rect)).height; rect = val.gridBorderRect.rect; Debug.Log((object)(text + text2 + $"{arg3}, Width: {((Rect)(ref rect)).width}, CO: {val.CO.strName}")); } } else { val.ResetBorder(); int num = base.activeWindows.IndexOf(val); GUIInventoryWindow val6 = winParent; if ((Object)(object)val6 == (Object)null && num > 0) { for (int num2 = num - 1; num2 >= 0; num2--) { if (!base.activeWindows[num2].IsChild && !base.activeWindows[num2].bCustomPos) { val6 = base.activeWindows[num2]; break; } } } ((Component)val).transform.localPosition = Vector2.op_Implicit(((GUIInventory)this).GetWindowPosition(val, val6) * 1.5f * CanvasManager.CanvasRatio); if (FFU_BR_Defs.ActLogging >= FFU_BR_Defs.ActLogs.Runtime) { string text3 = $"#DEBUG# Windows/Parent Index: {base.activeWindows.IndexOf(val)}"; object arg4 = base.activeWindows.IndexOf(val6); rect = val.gridBorderRect.rect; object arg5 = ((Rect)(ref rect)).x; rect = val.gridBorderRect.rect; string text4 = $"/{arg4}, X: {arg5}, Y: {((Rect)(ref rect)).y}, Height: "; rect = val.gridBorderRect.rect; object arg6 = ((Rect)(ref rect)).height; rect = val.gridBorderRect.rect; Debug.Log((object)(text3 + text4 + $"{arg6}, Width: {((Rect)(ref rect)).width}, CO: {val.CO.strName}")); } } CanvasManager.SetAnchorsToCorners(((Component)val).transform); if ((Object)(object)winParent == (Object)null) { ((MonoBehaviour)this).StartCoroutine(((GUIInventory)this).FlyIn(val)); } } foreach (CondOwner item2 in list2) { ((GUIInventory)this).SpawnInventoryWindow(item2, (InventoryWindowType)1, winParent, (Vector3?)null); } if (CrewSim.coPlayer.HasCond("TutorialLockerWaiting") && GUIInventory.instance.IsCOShown(CrewSim.coPlayer) && (((CondOwner)CO).HasCond("TutorialLockerTarget") || (((CondOwner)CO).HasCond("IsStorageFurniture") && CrewSim.coPlayer.HasCond("IsENCFirstDockOKLG")))) { CrewSim.coPlayer.ZeroCondAmount("TutorialLockerWaiting"); MonoSingleton<ObjectiveTracker>.Instance.CheckObjective(CrewSim.coPlayer.strID); } return val; } } public class patch_CondOwner : CondOwner { public JsonSlotEffects jsInvSlotEffect; public List<Slot> GetSortedSlots() { if ((Object)(object)((CondOwner)this).compSlots == (Object)null) { return CondOwner._emptySlotsResult ?? (CondOwner._emptySlotsResult = new List<Slot>()); } List<Slot> srtSlots2 = new List<Slot>(); GetSlotsRecursive(ref srtSlots2, ((IEnumerable<Slot>)((CondOwner)this).compSlots?.aSlots)?.ToList(), FFU_BR_Defs.ActLogging >= FFU_BR_Defs.ActLogs.Runtime); return srtSlots2; static void GetSlotsRecursive(ref List<Slot> srtSlots, List<Slot> refSlots, bool dLog, bool dSort = true, int sDepth = 0) { if (refSlots != null && refSlots.Count > 0) { refSlots.Sort(SortByDepth); foreach (Slot refSlot in refSlots) { if (dLog) { Debug.Log((object)("#Info# Sorted Slot " + string.Empty.PadLeft(sDepth, '=') + "> " + refSlot.strName)); } srtSlots.Add(refSlot); CondOwner[] aCOs = refSlot.aCOs; foreach (CondOwner val in aCOs) { List<Slot> refSlots2 = ((val != null) ? ((IEnumerable<Slot>)val.compSlots?.aSlots)?.ToList() : null); GetSlotsRecursive(ref srtSlots, refSlots2, dLog, dSort, sDepth + 1); } } } } static int SortByDepth(Slot s1, Slot s2) { if (!(s1 is patch_Slot) || !(s2 is patch_Slot)) { return 0; } return (s1 as patch_Slot).nSlotOrder.CompareTo((s2 as patch_Slot).nSlotOrder); } } public extern void orig_SetData(JsonCondOwner jid, bool bLoot, JsonCondOwnerSave jCOSIn); public void SetData(patch_JsonCondOwner jid, bool bLoot, JsonCondOwnerSave jCOSIn) { orig_SetData((JsonCondOwner)(object)jid, bLoot, jCOSIn); ParseInvEffects(jid); } public void ParseInvEffects(patch_JsonCondOwner jid) { if (jid.strInvSlotEffect == null) { return; } JsonSlotEffects slotEffect = DataHandler.GetSlotEffect(jid.strInvSlotEffect); if (slotEffect != null) { if (Container.GetSpace((CondOwner)(object)this) < 1) { Debug.LogWarning((object)("Can't assign 'invSlotEffect' for [" + base.strName + "] without inventory grid.")); } else { jsInvSlotEffect = slotEffect; } } } } public class patch_Container : Container { [MonoModIgnore] private patch_CondOwner CO => (patch_CondOwner)(object)((Container)this).CO; [MonoModReplace] public bool AllowedCO(CondOwner coIn) { if ((Object)(object)coIn == (Object)null || (Object)(object)coIn == (Object)(object)CO) { return false; } CondOwner val = (CondOwner)(object)CO; while ((Object)(object)val != (Object)null) { if ((Object)(object)coIn == (Object)(object)val) { return false; } val = val.objCOParent; } if (base.ctAllowed != null) { return base.ctAllowed.Triggered(coIn, (string)null, true); } return true; } [MonoModReplace] public void SetIsInContainer(CondOwner co) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown if ((Object)(object)CO == (Object)(object)this) { Debug.Log((object)"ERROR: Assigning self as own parent."); } co.objCOParent = (CondOwner)(object)CO; if ((Object)(object)co.coStackHead == (Object)null) { co.tf.SetParent(((CondOwner)CO).tf); co.tf.localPosition = new Vector3(0f, 0f, Container.fZSubOffset); co.Visible = false; } if (!((CondOwner)CO).HasCond("IsHuman")) { if (CO.jsInvSlotEffect != null) { ApplyContainerEffects(co, CO.jsInvSlotEffect); } co.AddCondAmount("IsInContainer", 1.0, 0.0, 0f); } CondOwner val = (CondOwner)(object)CO; while ((Object)(object)val != (Object)null) { if (val.HasCond("IsHuman") || val.HasCond("IsRobot")) { co.AddCondAmount("IsCarried", 1.0, 0.0, 0f); CondOwnerVisitorAddCond val2 = new CondOwnerVisitorAddCond(); val2.strCond = "IsCarried"; val2.fAmount = 1.0; co.VisitCOs((CondOwnerVisitor)(object)val2, true); break; } val = val.objCOParent; } } [MonoModReplace] public void ClearIsInContainer(CondOwner co) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown if (CO.jsInvSlotEffect != null) { ApplyContainerEffects(co, CO.jsInvSlotEffect, bRemove: true); } co.ZeroCondAmount("IsInContainer"); co.ZeroCondAmount("IsCarried"); CondOwnerVisitorZeroCond val = new CondOwnerVisitorZeroCond(); val.strCond = "IsCarried"; co.VisitCOs((CondOwnerVisitor)(object)val, true); co.objCOParent = null; } private void ApplyContainerEffects(CondOwner co, JsonSlotEffects jse, bool bRemove = false) { if (!((Object)(object)CO == (Object)null) && !((Object)(object)co == (Object)null) && jse != null) { co.ValidateParent(); Slots.ApplyIAEffects((CondOwner)(object)CO, co, jse, bRemove, false); } } } public class patch_JsonCondOwner : JsonCondOwner { public string strInvSlotEffect { get; set; } } public class patch_Loot : Loot { [MonoModReplace] public List<CondTrigger> GetCTLoot(CondTrigger objUs, string strRandID = null) { List<CondTrigger> list = new List<CondTrigger>(); int num = 0; float num2 = 0f; float num3 = 1f; foreach (List<LootUnit> aCOLootUnit in base.aCOLootUnits) { num2 = 0f; string text = strRandID; if (text != null) { text += num; } num++; if (FFU_BR_Defs.DynamicRandomRange) { float num4 = 0f; foreach (LootUnit item in aCOLootUnit) { num4 += item.fChance; } num3 = ((num4 > 1f) ? num4 : 1f); } float num5 = MathUtils.Rand(0f, num3, (RandType)0, text); foreach (LootUnit item2 in aCOLootUnit) { float num6 = item2.GetAmount(num2, num5); if (!item2.bPositive) { num6 = 0f - num6; } num2 += item2.fChance; if (num6 > 0f) { CondTrigger val = null; val = ((objUs == null || !(item2.strName == "[us]")) ? DataHandler.GetCondTrigger(item2.strName) : objUs.Clone()); CondTrigger obj = val; obj.fCount *= num6; list.Add(val); break; } } } num = 0; num3 = 1f; foreach (List<LootUnit> aOtherLootUnit in base.aOtherLootUnits) { num2 = 0f; string text2 = strRandID; if (text2 != null) { text2 += num; } num++; if (FFU_BR_Defs.DynamicRandomRange) { float num7 = 0f; foreach (LootUnit item3 in aOtherLootUnit) { num7 += item3.fChance; } num3 = ((num7 > 1f) ? num7 : 1f); } float num8 = MathUtils.Rand(0f, num3, (RandType)0, text2); foreach (LootUnit item4 in aOtherLootUnit) { float num9 = item4.GetAmount(num2, num8); if (!item4.bPositive) { num9 = 0f - num9; } num2 += item4.fChance; if (num9 <= 0f) { continue; } List<CondTrigger> cTLoot = DataHandler.GetLoot(item4.strName).GetCTLoot(objUs, strRandID); foreach (CondTrigger item5 in cTLoot) { item5.fCount *= num9; } list.AddRange(cTLoot); break; } } return list; } [MonoModReplace] public List<CondOwner> GetCOLoot(CondOwner objUs, bool bSuppressOverride, string strRandID = null) { List<CondOwner> list = new List<CondOwner>(); int num = 0; float num2 = 0f; float num3 = 1f; foreach (List<LootUnit> aCOLootUnit in base.aCOLootUnits) { num2 = 0f; string text = strRandID; if (text != null) { text += num; } num++; if (FFU_BR_Defs.DynamicRandomRange) { float num4 = 0f; foreach (LootUnit item in aCOLootUnit) { num4 += item.fChance; } num3 = ((num4 > 1f) ? num4 : 1f); } float num5 = MathUtils.Rand(0f, num3, (RandType)0, text); foreach (LootUnit item2 in aCOLootUnit) { float num6 = item2.GetAmount(num2, num5); if (!item2.bPositive) { num6 = 0f - num6; } num2 += item2.fChance; if (num6 <= 0f) { continue; } int num7 = Mathf.FloorToInt(num6); for (int i = 0; i < num7; i++) { if ((Object)(object)objUs != (Object)null && item2.strName == "[us]") { list.Add(objUs); } else { list.Add(DataHandler.GetCondOwner(item2.strName, (string)null, (string)null, !base.bSuppress || !bSuppressOverride, (string)null, (JsonCondOwnerSave)null, (string)null, (Transform)null)); } } break; } } num = 0; num3 = 1f; foreach (List<LootUnit> aOtherLootUnit in base.aOtherLootUnits) { num2 = 0f; string text2 = strRandID; if (text2 != null) { text2 += num; } num++; if (FFU_BR_Defs.DynamicRandomRange) { float num8 = 0f; foreach (LootUnit item3 in aOtherLootUnit) { num8 += item3.fChance; } num3 = ((num8 > 1f) ? num8 : 1f); } float num9 = MathUtils.Rand(0f, num3, (RandType)0, text2); foreach (LootUnit item4 in aOtherLootUnit) { float num10 = item4.GetAmount(num2, num9); if (!item4.bPositive) { num10 = 0f - num10; } num2 += item4.fChance; if (num10 <= 0f) { continue; } for (int j = 0; (float)j < num10; j++) { Loot loot = DataHandler.GetLoot(item4.strName); if (loot.strName != item4.strName) { Debug.Log((object)(((Loot)this).strName + " expected loot: " + item4.strName + " but got " + loot.strName)); } list.AddRange(loot.GetCOLoot(objUs, base.bSuppress && bSuppressOverride, strRandID)); } break; } } if (base.bNested) { for (int num11 = list.Count - 1; num11 > 0; num11--) { for (int num12 = num11 - 1; num12 >= 0; num12--) { list[num11] = list[num12].AddCO(list[num11], true, true, true); if ((Object)(object)list[num11] == (Object)null) { list.RemoveAt(num11); break; } } } } return list; } [MonoModReplace] public List<string> GetLootNames(string strRandID = null, bool bOnlyCOs = false, string type = null) { List<string> list = new List<string>(); int num = 0; float num2 = 0f; float num3 = 1f; foreach (List<LootUnit> aCOLootUnit in base.aCOLootUnits) { if (!string.IsNullOrEmpty(type) && base.strType != type) { break; } num2 = 0f; string text = strRandID; if (text != null) { text += num; } num++; if (FFU_BR_Defs.DynamicRandomRange) { float num4 = 0f; foreach (LootUnit item in aCOLootUnit) { num4 += item.fChance; } num3 = ((num4 > 1f) ? num4 : 1f); } float num5 = MathUtils.Rand(0f, num3, (RandType)0, text); foreach (LootUnit item2 in aCOLootUnit) { float num6 = item2.GetAmount(num2, num5); num2 += item2.fChance; string text2 = item2.strName; if (num6 < 0f) { text2 = "-" + text2; num6 = 0f - num6; } if (num6 > 0f) { for (int i = 0; (float)i < num6; i++) { list.Add(text2); } break; } } } if (bOnlyCOs) { return list; } num = 0; num3 = 1f; foreach (List<LootUnit> aOtherLootUnit in base.aOtherLootUnits) { num2 = 0f; string text3 = strRandID; if (text3 != null) { text3 += num; } num++; if (FFU_BR_Defs.DynamicRandomRange) { float num7 = 0f; foreach (LootUnit item3 in aOtherLootUnit) { num7 += item3.fChance; } num3 = ((num7 > 1f) ? num7 : 1f); } float num8 = MathUtils.Rand(0f, num3, (RandType)0, text3); foreach (LootUnit item4 in aOtherLootUnit) { float num9 = item4.GetAmount(num2, num8); num2 += item4.fChance; string strName = item4.strName; if (num9 < 0f) { strName = "-" + strName; num9 = 0f - num9; } if (num9 <= 0f) { continue; } for (int j = 0; (float)j < num9; j++) { Loot loot = DataHandler.GetLoot(item4.strName); if (string.IsNullOrEmpty(type) || !(loot.strType != type)) { list.AddRange(loot.GetLootNames(text3, false, (string)null)); } } break; } } return list; } [MonoModReplace] public void ApplyCondLoot(CondOwner coUs, float fCoeff, string strRandID = null, float fCondRuleTrack = 0f) { if ((Object)(object)coUs == (Object)null || base.strType != "condition") { return; } string[] aCOs = ((Loot)this).aCOs; string[] array = aCOs; foreach (string text in array) { coUs.ParseCondEquation(text, (double)fCoeff, fCondRuleTrack); } int num = 0; float num2 = 1f; foreach (List<LootUnit> aOtherLootUnit in base.aOtherLootUnits) { float num3 = 0f; string text2 = strRandID; if (text2 != null) { text2 += num; } num++; if (FFU_BR_Defs.DynamicRandomRange) { float num4 = 0f; foreach (LootUnit item in aOtherLootUnit) { num4 += item.fChance; } num2 = ((num4 > 1f) ? num4 : 1f); } float num5 = MathUtils.Rand(0f, num2, (RandType)0, text2); foreach (LootUnit item2 in aOtherLootUnit) { float num6 = item2.GetAmount(num3, num5); if (!item2.bPositive) { num6 = 0f - num6; } num3 += item2.fChance; if (num6 > 0f) { for (int j = 0; (float)j < num6; j++) { Loot loot = DataHandler.GetLoot(item2.strName); loot.ApplyCondLoot(coUs, fCoeff, (string)null, fCondRuleTrack); } break; } } } } [MonoModReplace] public Dictionary<string, double> GetCondLoot(float fCoeff, Dictionary<string, double> dictOut, string strRandID = null) { if (dictOut == null) { dictOut = new Dictionary<string, double>(); } if (base.strType != "condition") { return dictOut; } string[] aCOs = ((Loot)this).aCOs; string[] array = aCOs; foreach (string text in array) { KeyValuePair<string, Tuple<double, double>> keyValuePair = Loot.ParseCondEquation(text); double num = keyValuePair.Value.Item1; if (keyValuePair.Value.Item2 != num) { num = MathUtils.Rand(keyValuePair.Value.Item1, keyValuePair.Value.Item2, (RandType)0, (string)null); } if (keyValuePair.Key != string.Empty && num != 0.0) { if (!dictOut.ContainsKey(keyValuePair.Key)) { dictOut[keyValuePair.Key] = num * (double)fCoeff; } else { dictOut[keyValuePair.Key] += num * (double)fCoeff; } } } int num2 = 0; float num3 = 1f; foreach (List<LootUnit> aOtherLootUnit in base.aOtherLootUnits) { float num4 = 0f; string text2 = strRandID; if (text2 != null) { text2 += num2; } num2++; if (FFU_BR_Defs.DynamicRandomRange) { float num5 = 0f; foreach (LootUnit item in aOtherLootUnit) { num5 += item.fChance; } num3 = ((num5 > 1f) ? num5 : 1f); } float num6 = MathUtils.Rand(0f, num3, (RandType)0, text2); foreach (LootUnit item2 in aOtherLootUnit) { float num7 = item2.GetAmount(num4, num6); if (!item2.bPositive) { num7 = 0f - num7; } num4 += item2.fChance; if (num7 > 0f) { for (int j = 0; (float)j < num7; j++) { Loot loot = DataHandler.GetLoot(item2.strName); loot.GetCondLoot(fCoeff, dictOut, (string)null); } break; } } } return dictOut; } [MonoModReplace] private List<List<LootUnit>> ParseLootDef(string[] aIn) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown List<List<LootUnit>> list = new List<List<LootUnit>>(); foreach (string text in aIn) { string[] array = text.Split(new char[1] { '|' }); List<LootUnit> list2 = new List<LootUnit>(); string[] array2 = array; foreach (string text2 in array2) { LootUnit val = new LootUnit(); val.bPositive = true; string text3 = text2; if (text[0] == '-') { val.bPositive = false; text3 = text2.Substring(1); } string[] array3 = text3.Split(new char[1] { '=' }); val.strName = array3[0]; if (array3.Length < 2) { if (FFU_BR_Defs.SyncLogging >= FFU_BR_Defs.SyncLogs.ModChanges) { Debug.Log((object)("#Info# Loot entry '" + ((Loot)this).strName + "' is for patching only and not saved as permanent data.")); } return new List<List<LootUnit>>(); } array3 = array3[1].Split(new char[1] { 'x' }); float.TryParse(array3[0], out val.fChance); if (val.fChance < 0f) { JsonLogger.ReportProblem("[" + ((Loot)this).strName + "] " + text2 + " (loot definition chance can't be negative)", (ReportTypes)1); continue; } if (array3.Length < 2) { JsonLogger.ReportProblem("[" + ((Loot)this).strName + "] " + text2 + " (loot definition is shorter than expected)", (ReportTypes)1); continue; } float result = 0f; if (array3[1].StartsWith("-")) { JsonLogger.ReportProblem("[" + ((Loot)this).strName + "] " + text2 + " (loot definition base value can't be negative)", (ReportTypes)1); continue; } array3 = array3[1].Split(new char[1] { '-' }); if (float.TryParse(array3[0], out result)) { val.fMin = result; } if (array3.Length > 1) { result = 0f; if (array3.Length > 2) { JsonLogger.ReportProblem("[" + ((Loot)this).strName + "] " + text2 + " (loot definition value is longer than expected)", (ReportTypes)1); continue; } if (float.TryParse(array3[1], out result)) { val.fMax = result; } } if (val.fMax < val.fMin) { val.fMax = val.fMin; } list2.Add(val); } list.Add(list2); } return list; } } public class patch_Sensor : Sensor { [MonoModReplace] public void Run() { //IL_005b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)base.coUs == (Object)null || base.coUs.ship == null) { return; } bool flag = string.IsNullOrEmpty(base.strPoint); List<CondOwner> list = new List<CondOwner>(); if (!flag) { base.coUs.ship.GetCOsAtWorldCoords1(base.coUs.GetPos(base.strPoint, false), (CondTrigger)null, false, false, list); } foreach (KeyValuePair<string, string> mapTest in base.mapTests) { CondTrigger condTrigger = DataHandler.GetCondTrigger(mapTest.Key); if (!flag) { foreach (CondOwner item in list) { if (condTrigger.Triggered(item, (string)null, true)) { Interaction interaction = DataHandler.GetInteraction(mapTest.Value, (JsonInteractionSave)null, false); if (interaction != null && interaction.CTTestUs.Triggered(base.coUs, (string)null, true)) { base.coUs.QueueInteraction(item, interaction, false); } } } } else if (condTrigger.Triggered(base.coUs, (string)null, true)) { Interaction interaction2 = DataHandler.GetInteraction(mapTest.Value, (JsonInteractionSave)null, false); if (interaction2 != null && interaction2.CTTestUs.Triggered(base.coUs, (string)null, true)) { base.coUs.QueueInteraction(base.coUs, interaction2, false); } } } base.dfEpochLast = StarSystem.fEpoch; } [MonoModReplace] public void SetData(Dictionary<string, string> gpm) { if (gpm == null) { return; } base.strPoint = gpm["strPoint"]; string[] array = gpm["mapTests"].Split(new char[1] { ',' }); if (gpm.TryGetValue("dfUpdateInterval", out var value)) { double.TryParse(value, out var result); if (result > 0.0) { base.dfUpdateInterval = result; } } base.mapTests = DataHandler.ConvertStringArrayToDict(array, (Dictionary<string, string>)null); } } public class patch_JsonShipSpec : JsonShipSpec { public int nIsSameShipCO { get; set; } public extern bool orig_Matches(Ship ship, CondOwner coUs = null); public bool Matches(Ship ship, CondOwner coUs = null) { bool flag = orig_Matches(ship, coUs); if (flag && nIsSameShipCO != 0) { if ((Object)(object)coUs == (Object)null) { return false; } if (!((JsonShipSpec)this).IntMatchesBool(nIsSameShipCO, coUs.ship == ship)) { return false; } } return flag; } } namespace FFU_Beyond_Reach { [MonoModIgnore] public class FFU_BR_Defs { public enum SyncLogs { None, ModChanges, DeepCopy, ModdedDump, ExtendedDump, ContentDump, SourceDump } public enum ActLogs { None, Interactions, Runtime } public static SyncLogs SyncLogging; public static ActLogs ActLogging; public static bool JsonLogging; public static bool DynamicRandomRange; public static int MaxLogTextSize; public static bool ModSyncLoading; public static bool EnableCodeFixes; public static bool ModifyUpperLimit; public static float BonusUpperLimit; public static float SuitOxygenNotify; public static float SuitPowerNotify; public static bool ShowEachO2Battery; public static bool StrictInvSorting; public static bool AltTempEnabled; public static string AltTempSymbol; public static float AltTempMult; public static float AltTempShift; public static bool TowBraceAllowsKeep; public static bool OrgInventoryMode; public static float[] OrgInventoryTweaks; public static bool BetterInvTransfer; public static bool QuickBarPinning; public static float[] QuickBarTweaks; public static bool NoSkillTraitCost; public static bool AllowSuperChars; public static float SuperCharMultiplier; public static string[] SuperCharacters; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }