using 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 Atlas;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("NGA")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Persistent player progression! Raid, stash loot, and deploy with seemless scene/loadout saving.")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("NGA.HideoutProgression")]
[assembly: AssemblyTitle("BepInEx Plugin Title")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.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;
}
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace NGA
{
[BepInPlugin("NGA.HideoutProgression", "HideoutProgression", "0.0.1")]
[BepInDependency("nrgill28.Sodalite", "1.4.1")]
[BepInDependency("nrgill28.Atlas", "1.0.0")]
[BepInDependency("NGA.JsonFileIO", "0.0.0")]
[BepInProcess("h3vr.exe")]
public class HideoutProgression : BaseUnityPlugin
{
[HarmonyPatch(typeof(ItemSpawnerV2))]
[HarmonyPatch("RedrawDetailsCanvas")]
private class ItemSpawnerV2RedrawDetailsCanvasHook
{
private static void Postfix(ItemSpawnerV2 __instance)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.Find("SP2Tablet(Clone)");
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name != GetCurrHideoutSceneName() || (Object)(object)val == (Object)null)
{
return;
}
Logger.LogMessage((object)("RedrawDetailsCanvas: " + __instance.m_selectedID));
if (__instance.m_selectedID == null)
{
return;
}
string text = "";
if (!IM.HasSpawnedID(__instance.m_selectedID) && IM.OD.ContainsKey(__instance.m_selectedID))
{
FVRObject val2 = IM.OD[__instance.m_selectedID];
text = val2.SpawnedFromId;
}
if (!(text == ""))
{
Logger.LogMessage((object)("trying again: " + text));
ItemSpawnerID spawnerID = IM.GetSpawnerID(text);
PriceInfo priceInfo = new PriceInfo();
priceInfo.SetItemSpw(spawnerID);
int price = ItemPricing2.GetPrice(priceInfo);
__instance.TXT_Title.text = "$" + price + " " + __instance.TXT_Title.text;
if (price >= GM.MMFlags.GB)
{
Logger.LogWarning((object)"Not enough funds!");
__instance.m_selectedID = null;
}
int index = __instance.BTNS_DetailTutorial.Count - 1;
((Component)__instance.BTNS_DetailTutorial[index]).gameObject.SetActive(true);
__instance.BTNS_DetailTutorial[index].text = "Funds: " + GM.MMFlags.GB;
}
}
}
[HarmonyPatch(typeof(ItemSpawnerV2))]
[HarmonyPatch("BTN_Details_Spawn")]
private class ItemSpawnerV2BTN_Details_SpawnHook
{
private static bool Prefix(ItemSpawnerV2 __instance)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.Find("SP2Tablet(Clone)");
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name != GetCurrHideoutSceneName() || (Object)(object)val == (Object)null)
{
return true;
}
Logger.LogMessage((object)("BTN_Details_Spawn: " + __instance.m_selectedID));
string text = "";
if (!IM.HasSpawnedID(__instance.m_selectedID) && IM.OD.ContainsKey(__instance.m_selectedID))
{
FVRObject val2 = IM.OD[__instance.m_selectedID];
text = val2.SpawnedFromId;
}
if (text == "")
{
return true;
}
Logger.LogMessage((object)("trying again: " + text));
ItemSpawnerID spawnerID = IM.GetSpawnerID(text);
PriceInfo priceInfo = new PriceInfo();
priceInfo.SetItemSpw(spawnerID);
int price = ItemPricing2.GetPrice(priceInfo);
if (price >= GM.MMFlags.GB)
{
Logger.LogWarning((object)"Not enough funds!");
__instance.m_selectedID = null;
return false;
}
Logger.LogWarning((object)("Subtracting " + price));
GM.MMFlags.SGB(price);
Logger.LogWarning((object)("Saving value " + GM.MMFlags.GB));
GM.MMFlags.SaveToFile();
Logger.LogWarning((object)("Saved value " + GM.MMFlags.GB));
int index = __instance.BTNS_DetailTutorial.Count - 1;
((Component)__instance.BTNS_DetailTutorial[index]).gameObject.SetActive(true);
__instance.BTNS_DetailTutorial[index].text = "Funds: " + GM.MMFlags.GB;
return true;
}
}
[HarmonyPatch(typeof(FVRWristMenu2))]
[HarmonyPatch("Awake")]
private class WristMenuAwakeHook
{
private static void Postfix(FVRWristMenu2 __instance)
{
if ((Object)(object)__instance == (Object)null)
{
Logger.LogMessage((object)"FVRWristMenu2 is null!?");
}
Dictionary<GameObject, MyWristButton> existingButtons = new Dictionary<GameObject, MyWristButton>();
FVRWristMenuSection_Safehouse2 fVRWristMenuSection_Safehouse = AddWristMenuSectionAndButton(__instance, null, "Hideout", existingButtons, new MyWristButton(ogButtText_SpawnPanel, 5, SpawnThePanel));
AddWristMenuSectionAndButton(__instance, fVRWristMenuSection_Safehouse, "Hideout", existingButtons, new MyWristButton(ogButtText_ExtractToSafehouse, 4, ExtractToHideout));
AddWristMenuSectionAndButton(__instance, fVRWristMenuSection_Safehouse, "Hideout", existingButtons, new MyWristButton(ogButtText_SpawnLoadout, 3, SpawnSavedLoady));
AddWristMenuSectionAndButton(__instance, fVRWristMenuSection_Safehouse, "Hideout", existingButtons, new MyWristButton(ogButtText_SaveLoadout, 1, SaveLoadout));
List<string> list = new List<string> { ogButtText_SpawnLoadout, ogButtText_SaveSafehouse, ogButtText_ExtractToSafehouse, ogButtText_SaveLoadout, ogButtText_SpawnPanel };
List<string> list2 = new List<string> { ogButtText_SaveLoadout, ogButtText_SpawnLoadout, ogButtText_ExtractToSafehouse, ogButtText_SpawnPanel };
int num = 0;
foreach (GameObject item in existingButtons.Keys.OrderBy((GameObject x) => existingButtons[x].priority))
{
FVRWristMenuSection_Safehouse2.ButtonStuff buttonStuff = new FVRWristMenuSection_Safehouse2.ButtonStuff();
buttonStuff.TXT_Button = ((Component)item.transform).GetComponentInChildren<Text>();
buttonStuff.ogText = list2[num];
fVRWristMenuSection_Safehouse.buttons.Add(buttonStuff);
num++;
}
}
}
[HarmonyPatch(typeof(FVRSceneSettings))]
[HarmonyPatch("LoadDefaultSceneRoutine")]
private class FVRSceneSettingsLoadDefaultSceneRoutineHook
{
private static void Prefix(FVRSceneSettings __instance)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == GetCurrHideoutSceneName() && extracting_to_safehouse_need_map && Object.op_Implicit((Object)(object)GM.CurrentSceneSettings) && (Object)(object)GM.CurrentSceneSettings.DefaultVaultSceneConfig != (Object)null)
{
GM.CurrentSceneSettings.DefaultVaultSceneConfig = null;
}
}
private static void Postfix(FVRSceneSettings __instance)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)__instance == (Object)null)
{
Logger.LogMessage((object)"FVRSceneSettings is null!?");
}
ManualLogSource logger = Logger;
Scene activeScene = SceneManager.GetActiveScene();
logger.LogMessage((object)("Scene ID: " + ((Scene)(ref activeScene)).name));
activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == GetCurrHideoutSceneName() && extracting_to_safehouse_need_map)
{
extracting_to_safehouse_need_map = false;
VaultFile val = new VaultFile();
string text = GetCurrHideoutSceneName() + "_" + hideout_officialsave_filename;
if (!VaultSystem.LoadVaultFile(text, (VaultFileDisplayMode)2, ref val))
{
Logger.LogMessage((object)"WARNING: Didn't find Safehouse file.");
}
string text2 = default(string);
if (!VaultSystem.SpawnObjects((VaultFileDisplayMode)2, val, ref text2, (Transform)null, Vector3.up))
{
Logger.LogMessage((object)"ERROR: Loading safehouse scene file failed.");
Logger.LogMessage((object)text2);
}
}
}
}
public class FileStuff
{
public static string key_gamesettings = "gameSettings";
public static string key_priceModifiers = "priceModifiers";
public static void InitializeSaveFile()
{
string text = FileIO.ReadFile(mod_save_folder_name, save_file_name);
if (text == null)
{
text = CreateDefaultSaveFile();
FileIO.WriteToFile(mod_save_folder_name, save_file_name, text);
}
else
{
mySaveDic = ExtensibleDictionary.FromJson(text);
}
}
public static string CreateDefaultSaveFile()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
mySaveDic = new ExtensibleDictionary();
GameSettingsSave gameSettingsSave = new GameSettingsSave();
gameSettingsSave.InitDefaultValues();
string text = JsonConvert.SerializeObject((object)gameSettingsSave, (Formatting)1);
mySaveDic.AddEntry(key_gamesettings, text);
Logger.LogWarning((object)"...Creating Default Modifiers...");
GamePricingModifiersSave gamePricingModifiersSave = new GamePricingModifiersSave();
gamePricingModifiersSave.InitDefaultValues();
string text2 = JsonConvert.SerializeObject((object)gamePricingModifiersSave, (Formatting)1);
mySaveDic.AddEntry(key_priceModifiers, text2);
Logger.LogWarning((object)"...Created Default Modifiers added...");
return mySaveDic.ToJson();
}
public static void ReadVarsFromSaveFile()
{
mySaveDic = ExtensibleDictionary.FromJson(FileIO.ReadFile(mod_save_folder_name, save_file_name));
GameSettingsSave gameSettingsSave = JsonConvert.DeserializeObject<GameSettingsSave>(mySaveDic.GetValue(key_gamesettings));
gameSettingsSave.SetToHideoutProgression();
Logger.LogWarning((object)"...Reading Modifiers...");
string value = mySaveDic.GetValue(key_priceModifiers);
if (!string.IsNullOrEmpty(value))
{
gamePricingModsSave = JsonConvert.DeserializeObject<GamePricingModifiersSave>(value);
}
Logger.LogWarning((object)"...Set Read Modifiers...");
}
public static void WriteVarsToMyDic()
{
if (mySaveDic == null)
{
Logger.LogError((object)"myDic is not initialized.");
return;
}
GameSettingsSave gameSettingsSave = new GameSettingsSave();
gameSettingsSave.CopyFromHideoutProgression();
string text = JsonConvert.SerializeObject((object)gameSettingsSave, (Formatting)1);
mySaveDic.InsertOrUpdateEntry(key_gamesettings, text);
Logger.LogWarning((object)"...Writing Modifiers...");
GamePricingModifiersSave gamePricingModifiersSave = new GamePricingModifiersSave();
gamePricingModifiersSave.CopyFrom(gamePricingModsSave);
string text2 = JsonConvert.SerializeObject((object)gamePricingModifiersSave, (Formatting)1);
mySaveDic.InsertOrUpdateEntry(key_priceModifiers, text2);
Logger.LogWarning((object)"...Finished writing Modifiers...");
}
public static void RefreshSaveFile()
{
WriteVarsToMyDic();
FileIO.WriteToFile(mod_save_folder_name, save_file_name, mySaveDic.ToJson());
ReadVarsFromSaveFile();
}
}
private class GameSettingsSave
{
public string _currHideout;
public List<string> _recentHideoutScenes;
public DateTime _lastHideoutSave;
public DateTime _lastHideoutBUSave;
public bool _config_delete_loadout_on_spawn;
public bool _config_delete_loadout_on_save;
public void InitDefaultValues()
{
_currHideout = "GP_Hangar";
_recentHideoutScenes = new List<string>();
_lastHideoutSave = DateTime.MinValue;
_lastHideoutBUSave = DateTime.MinValue;
_config_delete_loadout_on_spawn = false;
_config_delete_loadout_on_save = true;
}
public void CopyFromHideoutProgression()
{
_currHideout = currHideout;
_recentHideoutScenes = recentHideoutScenes;
_lastHideoutSave = lastHideoutSave;
_lastHideoutBUSave = lastHideoutBUSave;
_config_delete_loadout_on_spawn = config_delete_loadout_on_spawn;
_config_delete_loadout_on_save = config_delete_loadout_on_save;
}
public void SetToHideoutProgression()
{
currHideout = _currHideout;
recentHideoutScenes = _recentHideoutScenes;
lastHideoutSave = _lastHideoutSave;
lastHideoutBUSave = _lastHideoutBUSave;
config_delete_loadout_on_spawn = false;
config_delete_loadout_on_save = _config_delete_loadout_on_save;
}
}
[Serializable]
public class GamePricingModifiersSave
{
public Dictionary<string, int> NamePrices = new Dictionary<string, int>();
public Dictionary<OTagFirearmCountryOfOrigin, float> CountryMultipliers { get; private set; }
public GamePricingModifiersSave()
{
CountryMultipliers = new Dictionary<OTagFirearmCountryOfOrigin, float>();
}
public void InitDefaultValues()
{
CountryMultipliers.Clear();
NamePrices.Clear();
}
public void CopyFrom(GamePricingModifiersSave other)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
CountryMultipliers.Clear();
NamePrices.Clear();
if (other == null)
{
return;
}
foreach (KeyValuePair<OTagFirearmCountryOfOrigin, float> countryMultiplier in other.CountryMultipliers)
{
CountryMultipliers[countryMultiplier.Key] = countryMultiplier.Value;
}
foreach (KeyValuePair<string, int> namePrice in other.NamePrices)
{
NamePrices[namePrice.Key] = namePrice.Value;
}
}
public void SetTo(GamePricingModifiersSave other)
{
other?.CopyFrom(this);
}
public void ApplyAllMultipliersToItemPrices()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
Logger.LogWarning((object)"Applying Multipliers");
int num = 0;
foreach (KeyValuePair<OTagFirearmCountryOfOrigin, float> countryMultiplier in CountryMultipliers)
{
if (ItemPricing2.countryOriginMultipliers.ContainsKey(countryMultiplier.Key))
{
ItemPricing2.countryOriginMultipliers[countryMultiplier.Key] = countryMultiplier.Value;
num++;
}
}
Logger.LogWarning((object)("Applied Multipliers: " + num));
Logger.LogWarning((object)"Applying Named prices");
int num2 = 0;
foreach (KeyValuePair<string, int> namePrice in NamePrices)
{
if (ItemPricing2.namePrices.ContainsKey(namePrice.Key))
{
ItemPricing2.namePrices[namePrice.Key] = namePrice.Value;
num2++;
}
}
Logger.LogWarning((object)("Applied names: " + num2));
}
}
public static class ItemPricing2
{
public static float PriceScaler = 1f;
public static Dictionary<string, int> namePrices = new Dictionary<string, int>();
public static Dictionary<EItemCategory, int> categoryPrices = new Dictionary<EItemCategory, int>();
public static Dictionary<ESubCategory, int> subCategoryPrices = new Dictionary<ESubCategory, int>();
public static Dictionary<OTagFirearmRoundPower, float> roundPowerMultipliers = new Dictionary<OTagFirearmRoundPower, float>();
public static Dictionary<OTagFirearmCountryOfOrigin, float> countryOriginMultipliers = new Dictionary<OTagFirearmCountryOfOrigin, float>();
public static Dictionary<OTagEra, float> eraMultipliers = new Dictionary<OTagEra, float>();
public static Dictionary<OTagFirearmAction, float> actionMultipliers = new Dictionary<OTagFirearmAction, float>();
public static void SetNamePrice(string name, int price)
{
namePrices[name] = price;
}
public static void SetItemCatPrice(EItemCategory category, int price)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
categoryPrices[category] = price;
}
public static void SetSubCatPrice(ESubCategory subCategory, int price)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
subCategoryPrices[subCategory] = price;
}
public static void SetMultiplier(OTagFirearmRoundPower roundPower, float multiplier)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
roundPowerMultipliers[roundPower] = multiplier;
}
public static int GetPrice(string spawnedFromId, bool getMaxPrice = true)
{
ItemSpawnerID spawnerID = IM.GetSpawnerID(spawnedFromId);
return GetPrice(new PriceInfo(spawnerID), getMaxPrice);
}
public static int GetPrice(PriceInfo priceInfo, bool getMaxPrice = true)
{
FVRObject fvrObjectIn = priceInfo.fvrObjectIn;
ItemSpawnerID itemSpanwerIDin = priceInfo.itemSpanwerIDin;
if ((Object)(object)fvrObjectIn == (Object)null)
{
Logger.LogError((object)"GetPrice ERROR: fvrObject null");
return 0;
}
if ((Object)(object)itemSpanwerIDin == (Object)null)
{
Logger.LogError((object)"GetPrice ERROR: itemSpawnerID null");
return 0;
}
int value = 0;
Logger.LogWarning((object)("TEST: Name-. " + fvrObjectIn.DisplayName));
if (namePrices.TryGetValue(fvrObjectIn.DisplayName, out value))
{
Logger.LogWarning((object)("Found name! " + value));
return ApplyScaler(value, priceInfo);
}
value = GetBestEnumPrice(fvrObjectIn, itemSpanwerIDin, getMaxPrice);
if (value > 0)
{
return ApplyScaler(value, priceInfo);
}
value = 0;
return ApplyScaler(value, priceInfo);
}
private static int ApplyScaler(int basePrice, PriceInfo priceInfo)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
float num = (float)basePrice * PriceScaler;
if (roundPowerMultipliers.TryGetValue(priceInfo.fvrObjectIn.TagFirearmRoundPower, out var value))
{
Logger.LogWarning((object)("Found RoundPower: " + value));
num *= value;
}
if (countryOriginMultipliers.TryGetValue(priceInfo.fvrObjectIn.TagFirearmCountryOfOrigin, out var value2))
{
Logger.LogWarning((object)("Found Country: " + value2));
num *= value2;
}
if (eraMultipliers.TryGetValue(priceInfo.fvrObjectIn.TagEra, out var value3))
{
Logger.LogWarning((object)("Found Era: " + value3));
num *= value3;
}
if (actionMultipliers.TryGetValue(priceInfo.fvrObjectIn.TagFirearmAction, out var value4))
{
Logger.LogWarning((object)("Found Action: " + value4));
num *= value4;
}
Logger.LogWarning((object)("Final: " + num + " base: " + basePrice));
return Mathf.RoundToInt(num);
}
private static int GetBestEnumPrice(FVRObject fvrObject, ItemSpawnerID itemSpawnerID, bool getMaxPrice)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
int? num = (getMaxPrice ? new int?(int.MinValue) : new int?(int.MaxValue));
Logger.LogWarning((object)("TEST: Category-. " + ((object)(EItemCategory)(ref itemSpawnerID.Category)).ToString()));
if (categoryPrices.TryGetValue(itemSpawnerID.Category, out var value))
{
Logger.LogWarning((object)("Found Cat! " + value));
if (value != 0)
{
num = ((!getMaxPrice) ? new int?(Mathf.Min(num.Value, value)) : new int?(Mathf.Max(num.Value, value)));
}
}
Logger.LogWarning((object)("TEST: SubCategory-. " + ((object)(ESubCategory)(ref itemSpawnerID.SubCategory)).ToString()));
if (subCategoryPrices.TryGetValue(itemSpawnerID.SubCategory, out var value2))
{
Logger.LogWarning((object)("Found Subcat! " + value2));
if (value2 != 0)
{
num = ((!getMaxPrice) ? new int?(Mathf.Min(num.Value, value2)) : new int?(Mathf.Max(num.Value, value2)));
}
}
Logger.LogWarning((object)("FINAL: " + (num.HasValue ? num.Value : 0)));
return num.HasValue ? num.Value : 0;
}
public static void InitializePrices()
{
Dictionary<string, int> dictionary = new Dictionary<string, int> { { "Degle", 9999 } };
Dictionary<EItemCategory, int> dictionary2 = new Dictionary<EItemCategory, int>
{
{
(EItemCategory)0,
10
},
{
(EItemCategory)1,
15
},
{
(EItemCategory)2,
25
},
{
(EItemCategory)3,
35
},
{
(EItemCategory)4,
2
},
{
(EItemCategory)5,
1
},
{
(EItemCategory)6,
0
},
{
(EItemCategory)7,
3
},
{
(EItemCategory)8,
3
},
{
(EItemCategory)9,
0
},
{
(EItemCategory)10,
1
},
{
(EItemCategory)11,
0
},
{
(EItemCategory)12,
0
},
{
(EItemCategory)40,
2
}
};
Dictionary<ESubCategory, int> dictionary3 = new Dictionary<ESubCategory, int>
{
{
(ESubCategory)0,
0
},
{
(ESubCategory)1,
10
},
{
(ESubCategory)2,
5
},
{
(ESubCategory)3,
15
},
{
(ESubCategory)4,
5
},
{
(ESubCategory)5,
10
},
{
(ESubCategory)6,
30
},
{
(ESubCategory)7,
15
},
{
(ESubCategory)8,
15
},
{
(ESubCategory)9,
5
},
{
(ESubCategory)10,
20
},
{
(ESubCategory)11,
20
},
{
(ESubCategory)12,
30
},
{
(ESubCategory)13,
10
},
{
(ESubCategory)14,
40
},
{
(ESubCategory)15,
2
},
{
(ESubCategory)16,
45
},
{
(ESubCategory)17,
2
},
{
(ESubCategory)18,
0
},
{
(ESubCategory)19,
4
},
{
(ESubCategory)20,
10
},
{
(ESubCategory)21,
4
},
{
(ESubCategory)22,
4
},
{
(ESubCategory)23,
0
},
{
(ESubCategory)24,
0
},
{
(ESubCategory)25,
3
},
{
(ESubCategory)26,
0
},
{
(ESubCategory)27,
0
},
{
(ESubCategory)28,
1
},
{
(ESubCategory)33,
0
},
{
(ESubCategory)34,
5
},
{
(ESubCategory)35,
5
},
{
(ESubCategory)36,
0
},
{
(ESubCategory)37,
0
},
{
(ESubCategory)38,
0
},
{
(ESubCategory)39,
0
},
{
(ESubCategory)40,
0
},
{
(ESubCategory)41,
5
},
{
(ESubCategory)42,
0
},
{
(ESubCategory)43,
0
},
{
(ESubCategory)44,
0
},
{
(ESubCategory)45,
20
},
{
(ESubCategory)46,
1
},
{
(ESubCategory)47,
4
},
{
(ESubCategory)49,
0
},
{
(ESubCategory)50,
0
},
{
(ESubCategory)51,
0
},
{
(ESubCategory)52,
0
},
{
(ESubCategory)53,
0
},
{
(ESubCategory)54,
1
},
{
(ESubCategory)55,
0
},
{
(ESubCategory)56,
0
},
{
(ESubCategory)57,
1
},
{
(ESubCategory)58,
40
},
{
(ESubCategory)59,
50
},
{
(ESubCategory)60,
0
},
{
(ESubCategory)61,
2
},
{
(ESubCategory)62,
50
}
};
Dictionary<OTagFirearmRoundPower, float> dictionary4 = new Dictionary<OTagFirearmRoundPower, float> {
{
(OTagFirearmRoundPower)1,
0.1f
} };
Dictionary<OTagFirearmCountryOfOrigin, float> dictionary5 = new Dictionary<OTagFirearmCountryOfOrigin, float>
{
{
(OTagFirearmCountryOfOrigin)0,
1f
},
{
(OTagFirearmCountryOfOrigin)1,
1f
},
{
(OTagFirearmCountryOfOrigin)10,
1.3f
},
{
(OTagFirearmCountryOfOrigin)21,
1.3f
},
{
(OTagFirearmCountryOfOrigin)22,
1.3f
},
{
(OTagFirearmCountryOfOrigin)35,
1f
},
{
(OTagFirearmCountryOfOrigin)36,
1.3f
},
{
(OTagFirearmCountryOfOrigin)42,
1.2f
},
{
(OTagFirearmCountryOfOrigin)43,
1.2f
},
{
(OTagFirearmCountryOfOrigin)44,
1.3f
},
{
(OTagFirearmCountryOfOrigin)45,
1.3f
},
{
(OTagFirearmCountryOfOrigin)52,
1f
},
{
(OTagFirearmCountryOfOrigin)53,
1.3f
},
{
(OTagFirearmCountryOfOrigin)60,
1.2f
},
{
(OTagFirearmCountryOfOrigin)71,
1.3f
},
{
(OTagFirearmCountryOfOrigin)92,
1.2f
},
{
(OTagFirearmCountryOfOrigin)100,
1.2f
},
{
(OTagFirearmCountryOfOrigin)111,
1.3f
},
{
(OTagFirearmCountryOfOrigin)120,
1f
},
{
(OTagFirearmCountryOfOrigin)121,
1f
},
{
(OTagFirearmCountryOfOrigin)130,
1f
},
{
(OTagFirearmCountryOfOrigin)140,
1.3f
},
{
(OTagFirearmCountryOfOrigin)153,
1.3f
},
{
(OTagFirearmCountryOfOrigin)160,
1f
},
{
(OTagFirearmCountryOfOrigin)161,
1f
},
{
(OTagFirearmCountryOfOrigin)162,
1.2f
},
{
(OTagFirearmCountryOfOrigin)170,
1f
},
{
(OTagFirearmCountryOfOrigin)171,
1f
},
{
(OTagFirearmCountryOfOrigin)172,
1f
},
{
(OTagFirearmCountryOfOrigin)173,
1f
},
{
(OTagFirearmCountryOfOrigin)190,
1f
},
{
(OTagFirearmCountryOfOrigin)200,
1.3f
},
{
(OTagFirearmCountryOfOrigin)210,
1f
},
{
(OTagFirearmCountryOfOrigin)220,
1.3f
},
{
(OTagFirearmCountryOfOrigin)230,
1f
},
{
(OTagFirearmCountryOfOrigin)250,
1.2f
},
{
(OTagFirearmCountryOfOrigin)263,
1f
},
{
(OTagFirearmCountryOfOrigin)270,
1f
},
{
(OTagFirearmCountryOfOrigin)281,
1f
}
};
Dictionary<OTagEra, float> dictionary6 = new Dictionary<OTagEra, float>
{
{
(OTagEra)0,
1f
},
{
(OTagEra)1,
0.2f
},
{
(OTagEra)2,
0.2f
},
{
(OTagEra)3,
0.5f
},
{
(OTagEra)4,
0.65f
},
{
(OTagEra)5,
0.85f
},
{
(OTagEra)6,
0.94f
},
{
(OTagEra)7,
1f
},
{
(OTagEra)8,
1.2f
},
{
(OTagEra)9,
0.1f
}
};
Dictionary<OTagFirearmAction, float> dictionary7 = new Dictionary<OTagFirearmAction, float>
{
{
(OTagFirearmAction)0,
1f
},
{
(OTagFirearmAction)1,
0.5f
},
{
(OTagFirearmAction)2,
1f
},
{
(OTagFirearmAction)3,
1f
},
{
(OTagFirearmAction)4,
1f
},
{
(OTagFirearmAction)5,
1f
},
{
(OTagFirearmAction)6,
1.05f
},
{
(OTagFirearmAction)7,
0.1f
},
{
(OTagFirearmAction)8,
0.1f
},
{
(OTagFirearmAction)9,
1f
},
{
(OTagFirearmAction)10,
0.7f
}
};
namePrices = dictionary;
categoryPrices = dictionary2;
subCategoryPrices = dictionary3;
roundPowerMultipliers = dictionary4;
countryOriginMultipliers = dictionary5;
eraMultipliers = dictionary6;
actionMultipliers = dictionary7;
}
}
public class PriceInfo
{
public FVRObject fvrObjectIn = null;
public ItemSpawnerID itemSpanwerIDin = null;
public PriceInfo(ItemSpawnerID _ItemSpawnerID)
{
fvrObjectIn = _ItemSpawnerID.MainObject;
itemSpanwerIDin = _ItemSpawnerID;
}
public PriceInfo()
{
}
public void SetItemSpw(ItemSpawnerID leitem)
{
fvrObjectIn = leitem.MainObject;
itemSpanwerIDin = leitem;
}
}
public static class ItemPricing
{
public static Dictionary<string, int> itemPrices = new Dictionary<string, int>
{
{ "Automatic Pistol", 5 },
{ "Revolver", 4 },
{ "Machine Pistol", 7 },
{ "Break-Action Shotgun", 8 },
{ "Tube Fed Shotgun", 9 },
{ "Magazine Fed Shotgun", 10 },
{ "Submachinegun", 20 },
{ "Personal Defense Weapon", 15 },
{ "Lever Action Rifle", 12 },
{ "Carbine", 25 },
{ "Assault Rifle", 30 },
{ "Battle Rifle", 28 },
{ "Bolt Action Rifle", 22 },
{ "Anti-Material Rifle", 35 },
{ "Machinegun", 32 }
};
public static int GetItemPrice(string itemName)
{
if (itemPrices.TryGetValue(itemName, out var value))
{
return value;
}
return 0;
}
public static void ScalePrices(int pistolPrice)
{
float num = (float)pistolPrice / (float)itemPrices["Automatic Pistol"];
List<string> list = new List<string>(itemPrices.Keys);
foreach (string item in list)
{
itemPrices[item] = Mathf.RoundToInt((float)itemPrices[item] * num);
}
}
}
public struct MyWristButton
{
public Action<object> onclick;
public string name;
public int priority;
public MyWristButton(string name_, int priority_, Action<object> clickAction = null)
{
onclick = clickAction;
name = name_;
priority = priority_;
}
}
public static string currHideout;
public static List<string> recentHideoutScenes;
public static DateTime lastHideoutSave;
public static DateTime lastHideoutBUSave;
public static string hideout_officialsave_filename = "hideoutProg_Save";
public static string hideout_backup_filename = "hideoutProg_Backup";
public static string loady_extracted_filename = "hideoutProg_ExtractDeployLoady";
public static bool extracting_to_safehouse_need_map = false;
private static GameObject spawnedTablet = null;
public static bool config_delete_loadout_on_spawn;
public static bool config_delete_loadout_on_save;
public static ExtensibleDictionary mySaveDic;
public static string mod_folder_name = "NGA-HideoutProgression";
public static string mod_save_folder_name = "NGA-ProfileSaveFolder";
public static string save_file_name = "nga_hideoutprogression.json";
private float updateTimer = 0f;
private const float saveInterval = 100f;
private static GamePricingModifiersSave gamePricingModsSave = new GamePricingModifiersSave();
public static string ogButtText_SpawnPanel = "Hideout-Manager";
public static string ogButtText_ExtractToSafehouse = "Extract-to-Hideout";
public static string ogButtText_SaveLoadout = "Save-Loadout";
public static string ogButtText_SpawnLoadout = "Spawn-Loadout";
public static string ogButtText_SaveSafehouse = "Save-Hideout";
public static List<string> cashMoneySpawnIdsOrd = new List<string> { "", "", "", "", "" };
internal static ManualLogSource Logger { get; private set; }
public void Awake()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Harmony val = new Harmony("NGA.HideoutProgression");
FileStuff.InitializeSaveFile();
FileStuff.ReadVarsFromSaveFile();
ItemPricing2.InitializePrices();
gamePricingModsSave.ApplyAllMultipliersToItemPrices();
val.PatchAll();
Logger.LogMessage((object)"Hello, world! Sent from NGA.HideoutProgression 0.0.1");
}
private void Update()
{
updateTimer += Time.deltaTime;
if (updateTimer >= 100f)
{
updateTimer = 0f;
SaveBUHideoutScene();
FileStuff.RefreshSaveFile();
}
}
public static string GetCurrHideoutSceneName()
{
return currHideout;
}
public static void SetCurrHideoutSceneName(string newScene)
{
currHideout = newScene;
}
public static void ExtractToHideout(object sender)
{
Logger.LogMessage((object)"ExtractToHideout");
Button val = (Button)((sender is Button) ? sender : null);
FVRWristMenuSection_Safehouse2 fVRWristMenuSection_Safehouse = Object.FindObjectOfType<FVRWristMenuSection_Safehouse2>();
if ((Object)(object)val != (Object)null && ((Object)(object)fVRWristMenuSection_Safehouse == (Object)null || !fVRWristMenuSection_Safehouse.IsConfirmed(ogButtText_ExtractToSafehouse)))
{
return;
}
SaveLoadout(null);
extracting_to_safehouse_need_map = true;
for (int i = 0; i < GM.CurrentSceneSettings.QuitReceivers.Count; i++)
{
GM.CurrentSceneSettings.QuitReceivers[i].BroadcastMessage("QUIT", (SendMessageOptions)1);
}
if (((AnvilCallbackBase)GM.LoadingCallback).IsCompleted)
{
CustomSceneInfo customScene = AtlasPlugin.GetCustomScene(GetCurrHideoutSceneName());
if (customScene != null)
{
AtlasPlugin.LoadCustomScene(GetCurrHideoutSceneName());
}
else
{
SteamVR_LoadLevel.Begin(GetCurrHideoutSceneName(), false, 0.5f, 0f, 0f, 0f, 1f);
}
}
}
public static void GoToHideout(object sender)
{
Button val = (Button)((sender is Button) ? sender : null);
FVRWristMenuSection_Safehouse2 fVRWristMenuSection_Safehouse = Object.FindObjectOfType<FVRWristMenuSection_Safehouse2>();
if ((Object)(object)val != (Object)null && ((Object)(object)fVRWristMenuSection_Safehouse == (Object)null || !fVRWristMenuSection_Safehouse.IsConfirmed(ogButtText_ExtractToSafehouse)))
{
return;
}
extracting_to_safehouse_need_map = true;
for (int i = 0; i < GM.CurrentSceneSettings.QuitReceivers.Count; i++)
{
GM.CurrentSceneSettings.QuitReceivers[i].BroadcastMessage("QUIT", (SendMessageOptions)1);
}
if (((AnvilCallbackBase)GM.LoadingCallback).IsCompleted)
{
CustomSceneInfo customScene = AtlasPlugin.GetCustomScene(GetCurrHideoutSceneName());
if (customScene != null)
{
AtlasPlugin.LoadCustomScene(GetCurrHideoutSceneName());
}
else
{
SteamVR_LoadLevel.Begin(GetCurrHideoutSceneName(), false, 0.5f, 0f, 0f, 0f, 1f);
}
}
}
public static void SaveLoadout(object sender)
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Expected O, but got Unknown
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
Logger.LogMessage((object)"SaveLoadout");
Button val = (Button)((sender is Button) ? sender : null);
FVRWristMenuSection_Safehouse2 fVRWristMenuSection_Safehouse = Object.FindObjectOfType<FVRWristMenuSection_Safehouse2>();
if ((Object)(object)val != (Object)null && ((Object)(object)fVRWristMenuSection_Safehouse == (Object)null || !fVRWristMenuSection_Safehouse.IsConfirmed(ogButtText_SaveLoadout)))
{
return;
}
VaultFile val2 = new VaultFile();
if (VaultSystem.FindAndScanObjectsInQuickbelt(val2))
{
if (val2.Objects.Count == 0)
{
Logger.LogMessage((object)"WARNING: Tried saving empty.");
}
else if (!VaultSystem.SaveVaultFile(loady_extracted_filename, (VaultFileDisplayMode)1, val2))
{
Logger.LogMessage((object)"ERROR: Saving loadout failed.");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).transform))
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
}
}
else if (config_delete_loadout_on_save)
{
VaultFile val3 = new VaultFile();
FVRPlayerBody val4 = Object.FindObjectOfType<FVRPlayerBody>();
Transform transform = new GameObject().transform;
transform.position = ((Component)val4).transform.position;
string text = default(string);
if (!VaultSystem.SpawnObjects((VaultFileDisplayMode)1, val3, ref text, transform, Vector3.zero))
{
Logger.LogMessage((object)("ERROR: Couldn't spawn empty loadout w status: " + text));
}
}
}
else
{
Logger.LogMessage((object)"ERROR: Quickbelt scan failed.");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).transform))
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
}
}
}
public static void SpawnThePanel(object sender)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
Button val = (Button)((sender is Button) ? sender : null);
if ((Object)(object)val != (Object)null)
{
if ((Object)(object)spawnedTablet != (Object)null)
{
Object.Destroy((Object)(object)spawnedTablet);
}
FVRObject val2 = IM.OD["NGA_SP2Tablet"];
spawnedTablet = Object.Instantiate<GameObject>(((AnvilAsset)val2).GetGameObject(), ((Component)val).transform.position, Quaternion.Euler(0f, 90f, 0f));
}
}
public static void SaveHideoutScene(object sender)
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Expected O, but got Unknown
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
Logger.LogMessage((object)"SaveHideoutScene");
Button val = (Button)((sender is Button) ? sender : null);
FVRWristMenuSection_Safehouse2 fVRWristMenuSection_Safehouse = Object.FindObjectOfType<FVRWristMenuSection_Safehouse2>();
if ((Object)(object)val != (Object)null && ((Object)(object)fVRWristMenuSection_Safehouse == (Object)null || !fVRWristMenuSection_Safehouse.IsConfirmed(ogButtText_SaveSafehouse)))
{
return;
}
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name != GetCurrHideoutSceneName())
{
Logger.LogMessage((object)("WARNING: Won't save since this isn't selected House: " + GetCurrHideoutSceneName()));
if ((Object)(object)val != (Object)null && Object.op_Implicit((Object)(object)((Component)val).transform))
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
}
return;
}
VaultFile val2 = new VaultFile();
if (VaultSystem.FindAndScanObjectsInScene(val2))
{
string text = GetCurrHideoutSceneName() + "_" + hideout_officialsave_filename;
if (!VaultSystem.SaveVaultFile(text, (VaultFileDisplayMode)2, val2))
{
Logger.LogMessage((object)"ERROR: Scene Vault save failed");
if ((Object)(object)val != (Object)null && Object.op_Implicit((Object)(object)((Component)val).transform))
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
}
}
else
{
lastHideoutSave = DateTime.UtcNow;
}
}
else
{
Logger.LogMessage((object)"ERROR: Scene scan failed");
if ((Object)(object)val != (Object)null && Object.op_Implicit((Object)(object)((Component)val).transform))
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
}
}
}
public static void SaveBUHideoutScene()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Expected O, but got Unknown
Logger.LogMessage((object)"SaveBUHideoutScene");
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name != GetCurrHideoutSceneName())
{
Logger.LogMessage((object)("WARNING: Won't save since this isn't selected House: " + GetCurrHideoutSceneName()));
return;
}
VaultFile val = new VaultFile();
if (VaultSystem.FindAndScanObjectsInScene(val))
{
string text = GetCurrHideoutSceneName() + "_" + hideout_backup_filename;
if (!VaultSystem.SaveVaultFile(text, (VaultFileDisplayMode)2, val))
{
Logger.LogMessage((object)"ERROR: Scene Vault save failed");
}
else
{
lastHideoutBUSave = DateTime.UtcNow;
}
}
else
{
Logger.LogMessage((object)"ERROR: Scene scan failed");
}
}
public static void LoadBUHideoutScene()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
Logger.LogMessage((object)"LoadBUHideoutScene");
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == GetCurrHideoutSceneName())
{
VaultFile val = new VaultFile();
string text = GetCurrHideoutSceneName() + "_" + hideout_backup_filename;
if (!VaultSystem.LoadVaultFile(text, (VaultFileDisplayMode)2, ref val))
{
Logger.LogMessage((object)"WARNING: Didn't find Safehouse file.");
}
string text2 = default(string);
if (!VaultSystem.SpawnObjects((VaultFileDisplayMode)2, val, ref text2, (Transform)null, Vector3.up))
{
Logger.LogMessage((object)"ERROR: Loading safehouse scene file failed.");
Logger.LogMessage((object)text2);
}
}
}
public static void SpawnSavedLoady(object sender)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Expected O, but got Unknown
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
Button val = (Button)((sender is Button) ? sender : null);
FVRWristMenuSection_Safehouse2 fVRWristMenuSection_Safehouse = Object.FindObjectOfType<FVRWristMenuSection_Safehouse2>();
if ((Object)(object)val != (Object)null && !fVRWristMenuSection_Safehouse.IsConfirmed(ogButtText_SpawnLoadout))
{
return;
}
FVRPlayerBody val2 = Object.FindObjectOfType<FVRPlayerBody>();
Transform transform = new GameObject().transform;
transform.position = ((Component)val2).transform.position;
VaultFile val3 = new VaultFile();
string text = default(string);
if (!VaultSystem.LoadVaultFile(loady_extracted_filename, (VaultFileDisplayMode)1, ref val3))
{
Logger.LogMessage((object)"ERROR: Loading saved loadout failed.");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).transform))
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
}
}
else if (!VaultSystem.SpawnObjects((VaultFileDisplayMode)1, val3, ref text, transform, Vector3.zero))
{
Logger.LogMessage((object)"ERROR: Spawning saved loadout failed.");
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Component)val).transform))
{
SM.PlayGlobalUISound((GlobalUISound)2, ((Component)val).transform.position);
}
}
else if (config_delete_loadout_on_spawn)
{
VaultFile val4 = new VaultFile();
VaultSystem.SaveVaultFile(loady_extracted_filename, (VaultFileDisplayMode)1, val4);
}
}
public static string StringifyLoadyVaultFile()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
VaultFile vaultFile = new VaultFile();
if (!VaultSystem.LoadVaultFile(loady_extracted_filename, (VaultFileDisplayMode)1, ref vaultFile))
{
Logger.LogMessage((object)"ERROR: Loading saved loadout failed stringify.");
return "";
}
return GetTopLevelObjectIDs(vaultFile);
}
public static string GetTopLevelObjectIDs(VaultFile vaultFile)
{
List<string> list = new List<string>();
foreach (VaultObject @object in vaultFile.Objects)
{
foreach (VaultElement element in @object.Elements)
{
list.Add(element.ObjectID);
}
}
return string.Join(", ", list.ToArray());
}
public static void AddWristMenuButton(FVRWristMenuSection shMenuSection, MyWristButton new_button, Transform buttonTransform)
{
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
((Component)buttonTransform).GetComponentInChildren<Text>().text = new_button.name;
Button component = ((Component)buttonTransform).GetComponent<Button>();
component.onClick = new ButtonClickedEvent();
((UnityEvent)component.onClick).AddListener((UnityAction)delegate
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
SM.PlayGlobalUISound((GlobalUISound)0, buttonTransform.position);
new_button.onclick(component);
});
}
public static void ResizeAndReorderSection(RectTransform background, int oldButtonCount, Dictionary<GameObject, MyWristButton> existingButtons)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
Vector2 sizeDelta = background.sizeDelta;
int childCount = ((Transform)background).childCount;
RectTransform val = (RectTransform)((Transform)background).GetChild(0);
float num = val.sizeDelta.y * ((Transform)val).localScale.y;
float num2 = (sizeDelta.y - num * (float)oldButtonCount) / (float)(oldButtonCount + 2);
float num3 = num + num2;
background.sizeDelta = new Vector2(sizeDelta.x, (float)childCount * num3 + num2 * 2f);
float num4 = num3 / 2f + num2;
foreach (GameObject item in existingButtons.Keys.OrderBy((GameObject x) => existingButtons[x].priority))
{
item.transform.localPosition = new Vector3(0f, num4, 0f);
num4 += num3;
}
}
public static FVRWristMenuSection_Safehouse2 AddWristMenuSectionAndButton(FVRWristMenu2 instance2, FVRWristMenuSection_Safehouse2 menuSection, string sectionText, Dictionary<GameObject, MyWristButton> existingButtons, MyWristButton new_button)
{
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Expected O, but got Unknown
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Expected O, but got Unknown
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Expected O, but got Unknown
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Expected O, but got Unknown
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Expected O, but got Unknown
if ((Object)(object)menuSection == (Object)null)
{
FVRWristMenuSection val = instance2.Sections.First((FVRWristMenuSection x) => (object)((object)x).GetType() == typeof(FVRWristMenuSection_Spawn));
Transform transform = ((Component)val).transform;
FVRWristMenuSection val2 = Object.Instantiate<FVRWristMenuSection>(val, transform.position, transform.rotation, transform.parent);
GameObject gameObject = ((Component)val2).gameObject;
Object.Destroy((Object)(object)val2);
Renderer component = gameObject.GetComponent<Renderer>();
if ((Object)(object)component != (Object)null)
{
Color color = default(Color);
((Color)(ref color))..ctor(0.3f, 0.67f, 0.3f, 1f);
component.material.color = color;
}
menuSection = gameObject.AddComponent<FVRWristMenuSection_Safehouse2>();
((FVRWristMenuSection)menuSection).ButtonText = sectionText;
((FVRWristMenuSection)menuSection).Menu = instance2;
instance2.Sections.Add((FVRWristMenuSection)(object)menuSection);
instance2.RegenerateButtons();
RectTransform val3 = (RectTransform)((Component)menuSection).transform;
RectTransform val4 = (RectTransform)((Transform)val3).GetChild(0);
int childCount = ((Transform)val3).childCount;
for (int num = childCount - 1; num >= 0; num--)
{
RectTransform val5 = (RectTransform)((Transform)val3).GetChild(num);
if (!((Object)(object)val5 == (Object)(object)val4))
{
Object.DestroyImmediate((Object)(object)((Component)val5).gameObject);
}
}
existingButtons.Add(((Component)val4).gameObject, new_button);
AddWristMenuButton((FVRWristMenuSection)(object)menuSection, new_button, (Transform)(object)val4);
ResizeAndReorderSection(val3, childCount, existingButtons);
return menuSection;
}
RectTransform val6 = (RectTransform)((Component)menuSection).transform;
Transform child = ((Transform)val6).GetChild(0);
RectTransform val7 = (RectTransform)Object.Instantiate<GameObject>(((Component)child).gameObject, child.position, child.rotation, child.parent).transform;
existingButtons.Add(((Component)val7).gameObject, new_button);
AddWristMenuButton((FVRWristMenuSection)(object)menuSection, new_button, (Transform)(object)val7);
ResizeAndReorderSection(val6, ((Transform)val6).childCount - 1, existingButtons);
return menuSection;
}
}
public class FVRWristMenuSection_Safehouse2 : FVRWristMenuSection
{
public class ButtonStuff
{
public Text TXT_Button;
public bool confirmedButton = false;
public string ogText = "";
}
public List<ButtonStuff> buttons = new List<ButtonStuff>();
public void ResetConfirm()
{
foreach (ButtonStuff button in buttons)
{
button.confirmedButton = false;
button.TXT_Button.text = button.ogText;
}
}
public bool IsConfirmed(string qOgButtonText)
{
foreach (ButtonStuff button in buttons)
{
if (button.ogText == qOgButtonText)
{
if (!button.confirmedButton)
{
ResetConfirm();
button.confirmedButton = true;
button.TXT_Button.text = button.ogText + " ???";
return false;
}
ResetConfirm();
return true;
}
}
return false;
}
public override void OnHide()
{
ResetConfirm();
}
}
[Serializable]
public class SF2_SaveFormat
{
}
}