using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Obeliskial_Essentials;
using QuickSave;
using TMPro;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("com.binbin.quicksave")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyInformationalVersion("1.3.0+d4c5f6832398bd7bb9b4dbda93cebf2882e9f754")]
[assembly: AssemblyProduct("QuickSave")]
[assembly: AssemblyTitle("com.binbin.quicksave")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.3.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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 static class EssentialsCompatibility
{
private static bool? _enabled;
public static bool Enabled
{
get
{
bool valueOrDefault = _enabled == true;
if (!_enabled.HasValue)
{
valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.stiffmeds.obeliskialessentials");
_enabled = valueOrDefault;
}
return _enabled.Value;
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void EssentialsRegister()
{
Essentials.RegisterMod(Plugin.PluginName, "binbin", "Town Map", Plugin.PluginVersion, Plugin.ModDate, "https://github.com/binbinmods/TownMap", (string[])null, "", 100, (string[])null, "", true);
Plugin.LogInfo(Plugin.PluginGUID + " " + Plugin.PluginVersion + " has loaded with Essentials!");
}
}
namespace QuickSave
{
[BepInPlugin("com.binbin.quicksave", "QuickSave", "1.3.0")]
[BepInProcess("AcrossTheObelisk.exe")]
public class Plugin : BaseUnityPlugin
{
internal static int ModDate = int.Parse(DateTime.Today.ToString("yyyyMMdd"));
private readonly Harmony harmony = new Harmony("com.binbin.quicksave");
internal static ManualLogSource Log;
internal static bool EssentialsInstalled = false;
public static string PluginName;
public static string PluginVersion;
public static string PluginGUID;
public static string debugBase = "com.binbin.quicksave ";
public static ConfigEntry<bool> EnableMod { get; set; }
public static ConfigEntry<bool> EnableDebugging { get; set; }
public static ConfigEntry<bool> EnableCustomSaveNames { get; set; }
public static ConfigEntry<float> MidCombatHorizontalShift { get; set; }
public static ConfigEntry<string> SaveFolderName { get; set; }
public static ConfigEntry<bool> DisableControlClick { get; set; }
private void Awake()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Expected O, but got Unknown
//IL_0047: Expected O, but got Unknown
//IL_005d: 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_0078: Expected O, but got Unknown
//IL_0078: Expected O, but got Unknown
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Expected O, but got Unknown
//IL_00a9: Expected O, but got Unknown
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_00de: Expected O, but got Unknown
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Expected O, but got Unknown
//IL_0113: Expected O, but got Unknown
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Expected O, but got Unknown
//IL_0144: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"com.binbin.quicksave 1.3.0 has loaded!");
EnableMod = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Quick Save", "EnableMod"), true, new ConfigDescription("Enables the Mod", (AcceptableValueBase)null, Array.Empty<object>()));
EnableDebugging = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Quick Save", "Enable Debugging"), true, new ConfigDescription("Enables debugging logs.", (AcceptableValueBase)null, Array.Empty<object>()));
EnableCustomSaveNames = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Quick Save", "Enable Custom Save Names"), false, new ConfigDescription("Enables you to choose the name of your saves with the Save Game button.", (AcceptableValueBase)null, Array.Empty<object>()));
MidCombatHorizontalShift = ((BaseUnityPlugin)this).Config.Bind<float>(new ConfigDefinition("Quick Save", "Mid Combat UI Shift"), 100f, new ConfigDescription("Shifts the UI to the right in combat. More positive is more to the right, more negative is more to the left. A value of 100 will shift the UI one \"Icon\" to the right.", (AcceptableValueBase)null, Array.Empty<object>()));
SaveFolderName = ((BaseUnityPlugin)this).Config.Bind<string>(new ConfigDefinition("Quick Save", "Save Folder Name"), "", new ConfigDescription("Sets the name of your save folder. If left blank, the current seed will be used instead.", (AcceptableValueBase)null, Array.Empty<object>()));
DisableControlClick = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition("Quick Save", "Disable Control Key Click"), false, new ConfigDescription("If selected, disables the control keys from clicking.", (AcceptableValueBase)null, Array.Empty<object>()));
PluginName = "QuickSave";
PluginVersion = "1.3.0";
PluginGUID = "com.binbin.quicksave";
if (EnableMod.Value)
{
if (EssentialsCompatibility.Enabled)
{
EssentialsCompatibility.EssentialsRegister();
}
else
{
LogDebug("Essentials is not installed. Mod will load normally, but Essentials features are unavaiable.");
}
harmony.PatchAll();
}
}
internal static void LogDebug(string msg)
{
if (EnableDebugging.Value)
{
Log.LogDebug((object)(debugBase + msg));
}
}
internal static void LogInfo(string msg)
{
Log.LogInfo((object)(debugBase + msg));
}
internal static void LogError(string msg)
{
Log.LogError((object)(debugBase + msg));
}
}
[HarmonyPatch]
public class QuickSaveFunctions
{
public enum LoadType
{
Turn,
Game
}
public static string quickLoadFilename;
public static string quickLoadFilenameGameForTurn;
public static LoadType quickLoadType;
public static bool isHost = GameManager.Instance.IsMultiplayer() && NetworkManager.Instance.IsMaster();
public static bool isMP = GameManager.Instance.IsMultiplayer();
public static Transform CreateIcon(Transform original, string name = "", List<GameObject> buttonList = null)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
GameObject val = Object.Instantiate<GameObject>(((Component)original).gameObject, Vector3.zero, Quaternion.identity, (Transform)null);
if ((Object)(object)val == (Object)null)
{
Plugin.LogDebug("Failed to instantiate game object clone");
return null;
}
Transform transform = val.transform;
if ((Object)(object)transform == (Object)null)
{
Plugin.LogDebug("Cloned object has no transform component");
return null;
}
Object.DontDestroyOnLoad((Object)(object)transform);
((Component)transform).gameObject.SetActive(false);
((Object)((Component)transform).gameObject).name = name;
buttonList?.Add(((Component)transform).gameObject);
return transform;
}
public static List<string> GetAllSaves(string rootDirectory)
{
string[] files = Directory.GetFiles(rootDirectory, "*", SearchOption.AllDirectories);
List<string> list = new List<string>();
string[] array = files;
foreach (string text in array)
{
string item = text.Substring(rootDirectory.Length + 1);
list.Add(item);
}
return list;
}
public static IEnumerator SaveGameTurn(bool doCustomName = false)
{
int saveSlot = SaveManager.Instance.GetSaveSlot();
Plugin.LogDebug($"Saving turn to slot {saveSlot}");
string savePath = SaveManager.Instance.PathSaveGameTurn(saveSlot);
string directory = Path.GetDirectoryName(savePath);
AtOManager instance = AtOManager.Instance;
string seed = ((instance != null) ? instance.GetGameId() : null) ?? "nullseed";
string node = AtOManager.Instance?.currentMapNode ?? "sen_0";
string folderName = ((Plugin.SaveFolderName.Value == "") ? seed : Plugin.SaveFolderName.Value);
string outputDirectory = Path.Combine(directory, folderName, node);
string originalPath = savePath;
string originalGameData = Path.Combine(directory, $"gamedata_{saveSlot}.ato");
MatchManager instance2 = MatchManager.Instance;
object obj;
if (instance2 == null)
{
obj = null;
}
else
{
Character characterActive = instance2.GetCharacterActive();
obj = ((characterActive != null) ? characterActive.SourceName : null);
}
if (obj == null)
{
obj = "nullchar";
}
string charActive = (string)obj;
MatchManager instance3 = MatchManager.Instance;
int turnNum = ((instance3 != null) ? instance3.GetCurrentRound() : 0);
Plugin.LogDebug("Original Path: " + originalPath);
string newFileName = $"gamedata_{saveSlot}_{node}_turn{turnNum}_{charActive}.ato";
Plugin.LogDebug("Output Dir: " + outputDirectory);
if (!Directory.Exists(outputDirectory))
{
Directory.CreateDirectory(outputDirectory);
}
string newPath = Path.Combine(outputDirectory, newFileName);
string nextFilePath = ((!doCustomName) ? GetUniqueFilename(newPath) : Path.Combine(outputDirectory, QuickSavePatches.customName));
string nameWithoutExtension = Path.GetFileNameWithoutExtension(nextFilePath);
string extension = Path.GetExtension(nextFilePath);
string newGamePathName = nameWithoutExtension + "_gamedata" + extension;
Plugin.LogDebug($"nextFilePath with doCustomName = {doCustomName}: {nextFilePath}");
Plugin.LogDebug($"newGamePathName with doCustomName = {doCustomName}: {newGamePathName}");
File.Copy(originalPath, nextFilePath, overwrite: true);
File.Copy(originalGameData, newGamePathName, overwrite: true);
quickLoadFilename = nextFilePath;
quickLoadFilenameGameForTurn = newGamePathName;
quickLoadType = LoadType.Turn;
QuickSavePatches.changeSaveGameText = true;
yield return Globals.Instance.WaitForSeconds(1f);
QuickSavePatches.changeSaveGameText = false;
yield return Globals.Instance.WaitForSeconds(1f);
}
public static IEnumerator SaveGame(bool doCustomName = false)
{
int saveSlot = SaveManager.Instance.GetSaveSlot();
string savePath = SaveManager.Instance.PathSaveGameTurn(saveSlot);
string directory = Path.GetDirectoryName(savePath);
AtOManager instance = AtOManager.Instance;
string seed = ((instance != null) ? instance.GetGameId() : null) ?? "nullseed";
string node = AtOManager.Instance?.currentMapNode ?? "sen_0";
string folderName = ((Plugin.SaveFolderName.Value == "") ? seed : Plugin.SaveFolderName.Value);
string outputDirectory = Path.Combine(directory, folderName, node);
string originalPath = Path.Combine(directory, $"gamedata_{saveSlot}.ato");
Plugin.LogDebug("Original Path: " + originalPath);
string newFileName = $"gamedata_{saveSlot}_{node}.ato";
Plugin.LogDebug("Output Dir: " + outputDirectory);
if (!Directory.Exists(outputDirectory))
{
Directory.CreateDirectory(outputDirectory);
}
string newPath = Path.Combine(outputDirectory, newFileName);
string nextFilePath = ((!doCustomName) ? GetUniqueFilename(newPath) : Path.Combine(outputDirectory, QuickSavePatches.customName));
File.Copy(originalPath, nextFilePath, overwrite: true);
quickLoadFilename = nextFilePath;
quickLoadType = LoadType.Game;
QuickSavePatches.changeSaveGameText = true;
yield return Globals.Instance.WaitForSeconds(5f);
QuickSavePatches.changeSaveGameText = false;
yield return Globals.Instance.WaitForSeconds(1f);
}
public static void QuickLoad()
{
Plugin.LogDebug("attempting to load" + quickLoadFilename);
LoadGameFromFilename(quickLoadType, quickLoadFilename, quickLoadFilenameGameForTurn);
}
public static void LoadGameFromFilename(LoadType loadType, string filePath, string filePathToGameIfTurn = "")
{
int saveSlot = SaveManager.Instance.GetSaveSlot();
string directoryName = Path.GetDirectoryName(SaveManager.Instance.PathSaveGameTurn(saveSlot));
switch (loadType)
{
case LoadType.Turn:
{
string destFileName = Path.Combine(directoryName, $"gamedata_{saveSlot}.ato");
string path = Path.Combine(directoryName, $"gamedata_{saveSlot}_turn.ato");
if (File.Exists(filePathToGameIfTurn))
{
File.Copy(filePathToGameIfTurn, destFileName, overwrite: true);
}
File.Copy(filePath, path, overwrite: true);
BinbinLoadGame(saveSlot);
break;
}
case LoadType.Game:
{
string destFileName = Path.Combine(directoryName, $"gamedata_{saveSlot}.ato");
string path = Path.Combine(directoryName, $"gamedata_{saveSlot}_turn.ato");
if (File.Exists(path))
{
File.Delete(path);
}
File.Copy(filePath, destFileName, overwrite: true);
BinbinLoadGame(saveSlot);
break;
}
default:
BinbinLoadGame(saveSlot);
break;
}
}
public static void SetButtons(List<GameObject> gameObjects, bool active)
{
foreach (GameObject gameObject in gameObjects)
{
gameObject.SetActive(active);
}
}
public static string GetUniqueFilename(string originalFilename)
{
string directoryName = Path.GetDirectoryName(originalFilename);
string text = Path.GetFileName(originalFilename);
int num = 2;
while (File.Exists(Path.Combine(directoryName, text)))
{
Match match = Regex.Match(text, "^(gamedata_\\d+_[^_]+_)(\\d+)(\\.ato)$");
if (match.Success)
{
string value = match.Groups[1].Value;
int num2 = int.Parse(match.Groups[2].Value);
string value2 = match.Groups[3].Value;
text = $"{value}{num2}_save{num}{value2}";
}
else
{
Match match2 = Regex.Match(text, "(.+?)(\\d+)(\\.ato)$");
if (match2.Success)
{
string value3 = match2.Groups[1].Value;
int num3 = int.Parse(match2.Groups[2].Value);
string value4 = match2.Groups[3].Value;
num3++;
text = $"{value3}{num3}{value4}";
}
else
{
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text);
string extension = Path.GetExtension(text);
text = $"{fileNameWithoutExtension}_save{num}{extension}";
}
}
num++;
}
return Path.Combine(directoryName, text);
}
public static string StripGamedataPrefix(string filename)
{
if (filename == null)
{
return filename;
}
return Regex.Replace(filename, "^gamedata_\\d+_", "");
}
public static List<string> GetAllFilePaths(string directory)
{
string text = ".ato";
return (from f in Directory.GetFiles(directory, "*" + text, SearchOption.AllDirectories)
orderby File.GetLastWriteTime(f) descending
select Path.GetRelativePath(directory, f)).ToList();
}
public static void SetCustomName(bool isTurn = false)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Expected O, but got Unknown
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
if (isTurn)
{
AlertManager.buttonClickDelegate = new OnButtonClickDelegate(SetFilenameTurn);
AlertManager.Instance.AlertInput("Input Name of Save", Texts.Instance.GetText("accept", "").ToUpper());
}
else
{
AlertManager.buttonClickDelegate = new OnButtonClickDelegate(SetFilenameGame);
AlertManager.Instance.AlertInput("Input Name of Save", Texts.Instance.GetText("accept", "").ToUpper());
}
}
public static void SetFilenameGame()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
AlertManager.buttonClickDelegate = (OnButtonClickDelegate)Delegate.Remove((Delegate?)(object)AlertManager.buttonClickDelegate, (Delegate?)new OnButtonClickDelegate(SetFilenameGame));
if (AlertManager.Instance.GetInputValue() != null)
{
string text = AlertManager.Instance.GetInputValue().ToLower();
if (text.Trim() == "")
{
((MonoBehaviour)Globals.Instance).StartCoroutine(SaveGame());
return;
}
QuickSavePatches.customName = text + ".ato";
((MonoBehaviour)Globals.Instance).StartCoroutine(SaveGame(doCustomName: true));
}
}
public static void SetFilenameTurn()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
AlertManager.buttonClickDelegate = (OnButtonClickDelegate)Delegate.Remove((Delegate?)(object)AlertManager.buttonClickDelegate, (Delegate?)new OnButtonClickDelegate(SetFilenameGame));
if (AlertManager.Instance.GetInputValue() != null)
{
string text = AlertManager.Instance.GetInputValue().ToLower();
if (text.Trim() == "")
{
((MonoBehaviour)Globals.Instance).StartCoroutine(SaveGameTurn());
return;
}
QuickSavePatches.customName = text + ".ato";
((MonoBehaviour)Globals.Instance).StartCoroutine(SaveGameTurn(doCustomName: true));
}
}
public static void LoadMP()
{
}
public static void BinbinLoadGame(int saveSlot, bool isTurn = false)
{
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
isMP = GameManager.Instance.IsMultiplayer();
isHost = GameManager.Instance.IsMultiplayer() && NetworkManager.Instance.IsMaster();
Plugin.LogDebug($"BinbinLoadGame - saveSlot {saveSlot}, isTurn {isTurn}, multiplayer {isHost && isMP}");
if (!isMP)
{
SaveManager.Instance.LoadGame(saveSlot, false);
}
else if (isHost)
{
if (isTurn)
{
GameManager.Instance.GameStatus = (GameStatus)1;
AtOManager.Instance.DoLoadGameFromMP(false);
}
else
{
GameManager.Instance.GameStatus = (GameStatus)1;
SaveManager.Instance.LoadGame(saveSlot, false);
AtOManager.Instance.DoLoadGameFromMP(false);
}
}
}
public static void HandleResetSeed2()
{
AtOManager instance = AtOManager.Instance;
if (instance != null)
{
instance.SetGameId("");
}
HSMStartLocal(HeroSelectionManager.Instance);
HeroSelectionManager.Instance.BeginAdventure();
}
public static void HandleResetSeed3()
{
AtOManager instance = AtOManager.Instance;
if (instance != null)
{
instance.SetGameId("");
}
if (Plugin.EnableCustomSaveNames.Value)
{
SetCustomName();
}
else
{
((MonoBehaviour)Globals.Instance).StartCoroutine(SaveGame());
}
QuickLoad();
}
public static void HandleResetSeed4()
{
AtOManager instance = AtOManager.Instance;
if (instance != null)
{
instance.SetGameId("");
}
SaveManager instance2 = SaveManager.Instance;
if (instance2 != null)
{
instance2.SaveGame(-1, false);
}
SaveManager instance3 = SaveManager.Instance;
if (instance3 != null)
{
instance3.LoadGame(SaveManager.Instance.GetSaveSlot(), false);
}
}
public static void HSMStartLocal(HeroSelectionManager __instance)
{
MethodInfo method = ((object)__instance).GetType().GetMethod("Start", BindingFlags.Instance | BindingFlags.NonPublic);
object[] parameters = new object[0];
method.Invoke(__instance, parameters);
}
}
[HarmonyPatch]
public class QuickSavePatches
{
public static List<GameObject> myButtonsMap;
public static List<GameObject> myButtonsCombat;
public static List<GameObject> test;
public static Transform iconReloadTurn;
public static Transform iconSkipCorruptor;
public static Transform iconSaveGame;
public static Transform iconSaveTurn;
public static Transform iconLoadGame;
public static Transform iconLoadGame2;
public static Transform iconQuickLoad;
public static Transform iconQuickLoad2;
public static Transform iconShowMap;
public static TMP_Dropdown loadgameDropdown;
public static bool skipCinematic = false;
public static bool skipCorruption = false;
public static bool changeSaveGameText = false;
public static List<string> loadFiles;
public static string customName = "";
[HarmonyPostfix]
[HarmonyPatch(typeof(OptionsManager), "Awake")]
public static void AwakePostfix(OptionsManager __instance, List<GameObject> ___buttonOrder)
{
Plugin.LogDebug("AwakePostfix");
myButtonsMap = new List<GameObject>();
myButtonsCombat = new List<GameObject>();
iconQuickLoad = QuickSaveFunctions.CreateIcon(__instance.iconSettings, "quickload", myButtonsMap);
iconLoadGame = QuickSaveFunctions.CreateIcon(__instance.iconStats, "loadgame", myButtonsMap);
iconSaveGame = QuickSaveFunctions.CreateIcon(__instance.iconTome, "savegame", myButtonsMap);
iconReloadTurn = QuickSaveFunctions.CreateIcon(__instance.iconRetry, "reloadturn", myButtonsCombat);
iconSaveTurn = QuickSaveFunctions.CreateIcon(__instance.iconTome, "saveturn", myButtonsCombat);
iconLoadGame2 = QuickSaveFunctions.CreateIcon(__instance.iconStats, "loadgame", myButtonsCombat);
iconQuickLoad2 = QuickSaveFunctions.CreateIcon(__instance.iconSettings, "quickload", myButtonsCombat);
iconSkipCorruptor = QuickSaveFunctions.CreateIcon(__instance.iconResign, "skipcorruptor", myButtonsCombat);
myButtonsCombat.Reverse();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(SettingsManager), "Awake")]
public static void SettingsManagerAwakePostfix(SettingsManager __instance)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: 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_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
TMP_Dropdown languageDropdown = SettingsManager.Instance.languageDropdown;
GameObject val = Object.Instantiate<GameObject>(((Component)languageDropdown).gameObject, Vector3.zero, Quaternion.identity, __instance.canvas.transform);
loadgameDropdown = val.GetComponent<TMP_Dropdown>();
((Component)loadgameDropdown).gameObject.SetActive(false);
Object.DontDestroyOnLoad((Object)(object)((Component)loadgameDropdown).transform);
((Object)loadgameDropdown).name = "loadgamedropdown";
((UnityEventBase)loadgameDropdown.onValueChanged).SetPersistentListenerState(0, (UnityEventCallState)0);
RectTransform component = ((Component)loadgameDropdown).GetComponent<RectTransform>();
component.SetSizeWithCurrentAnchors((Axis)0, 650f);
loadgameDropdown.ClearOptions();
((UnityEvent<int>)(object)loadgameDropdown.onValueChanged).AddListener((UnityAction<int>)OnDropdownValueChanged);
((Component)loadgameDropdown).transform.position = ((Component)__instance).transform.position;
((Component)loadgameDropdown).transform.localPosition = new Vector3(((Component)__instance).transform.localPosition.x - 200f, ((Component)__instance).transform.localPosition.y - 200f, ((Component)__instance).transform.localPosition.z);
Plugin.LogDebug("Created DropDownTest");
Plugin.LogDebug(string.Format("Created DropDownTest: {0} with index options {1}", ((Component)loadgameDropdown).gameObject.activeSelf, string.Join(", ", loadgameDropdown.options)));
}
public static void OnDropdownValueChanged(int index)
{
Plugin.LogDebug($"OnSubmit Test option selected {index}: {loadgameDropdown.options[index].text}");
if ((Object)(object)AtOManager.Instance == (Object)null)
{
Plugin.LogDebug("OnDropdownValueChanged - Null AtOManger");
return;
}
string directoryName = Path.GetDirectoryName(SaveManager.Instance.PathSaveGameTurn(SaveManager.Instance.GetSaveSlot()));
string gameId = AtOManager.Instance.GetGameId();
string path = ((Plugin.SaveFolderName.Value == "") ? gameId : Plugin.SaveFolderName.Value);
string text = Path.Combine(directoryName, path, loadgameDropdown.options[index].text);
long length = new FileInfo(text).Length;
Plugin.LogDebug($"Current filesize in bytes: {length}");
Plugin.LogDebug("Current filename: " + text);
QuickSaveFunctions.LoadType loadType = ((length > 10000) ? QuickSaveFunctions.LoadType.Game : QuickSaveFunctions.LoadType.Turn);
string filePathToGameIfTurn = "";
if (loadType == QuickSaveFunctions.LoadType.Turn)
{
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(text);
string extension = Path.GetExtension(text);
filePathToGameIfTurn = fileNameWithoutExtension + "_gamedata" + extension;
}
QuickSaveFunctions.LoadGameFromFilename(loadType, text, filePathToGameIfTurn);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(OptionsManager), "Show")]
public static void ShowPostfix(OptionsManager __instance, List<GameObject> ___buttonOrder)
{
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_021a: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: Unknown result type (might be due to invalid IL or missing references)
//IL_02af: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
//IL_0315: 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_033a: Unknown result type (might be due to invalid IL or missing references)
QuickSaveFunctions.isMP = GameManager.Instance.IsMultiplayer();
QuickSaveFunctions.isHost = GameManager.Instance.IsMultiplayer() && NetworkManager.Instance.IsMaster();
Plugin.LogDebug($"ShowPostfix - IsHost {QuickSaveFunctions.isHost}, IsMP {QuickSaveFunctions.isMP}");
QuickSaveFunctions.SetButtons(myButtonsCombat, active: false);
QuickSaveFunctions.SetButtons(myButtonsMap, active: false);
if ((Object.op_Implicit((Object)(object)MatchManager.Instance) || Object.op_Implicit((Object)(object)RewardsManager.Instance)) && (QuickSaveFunctions.isHost || !QuickSaveFunctions.isMP))
{
QuickSaveFunctions.SetButtons(myButtonsCombat, active: true);
if (!AtOManager.Instance.corruptionAccepted)
{
((Component)iconSkipCorruptor).gameObject.SetActive(false);
}
}
else if ((Object.op_Implicit((Object)(object)TownManager.Instance) || AtOManager.Instance.CharInTown()) && (QuickSaveFunctions.isHost || !QuickSaveFunctions.isMP))
{
QuickSaveFunctions.SetButtons(myButtonsMap, active: true);
}
else if (Object.op_Implicit((Object)(object)MapManager.Instance) && (QuickSaveFunctions.isHost || !QuickSaveFunctions.isMP))
{
QuickSaveFunctions.SetButtons(myButtonsMap, active: true);
}
float num = 0.95f;
float num2 = 0.65f;
for (int i = 0; i < myButtonsMap.Count; i++)
{
if (myButtonsMap[i].activeSelf)
{
myButtonsMap[i].transform.position = new Vector3(((Component)__instance.iconTome).transform.position.x - num, ((Component)__instance.iconTome).transform.position.y, ((Component)__instance.iconTome).transform.position.z);
myButtonsMap[i].transform.localPosition = new Vector3(num + num2 * 2f, myButtonsMap[i].transform.localPosition.y, myButtonsMap[i].transform.localPosition.z);
num -= num2;
}
}
num = 0.95f;
for (int j = 0; j < myButtonsCombat.Count; j++)
{
if (myButtonsCombat[j].activeSelf)
{
myButtonsCombat[j].transform.position = new Vector3(((Component)__instance.iconTome).transform.position.x - num, ((Component)__instance.iconTome).transform.position.y, ((Component)__instance.iconTome).transform.position.z);
myButtonsCombat[j].transform.localPosition = new Vector3(num - num2 * 5.7f + Plugin.MidCombatHorizontalShift.Value * 0.01f, myButtonsCombat[j].transform.localPosition.y, myButtonsCombat[j].transform.localPosition.z);
num -= num2;
}
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(BotonRollover), "ShowText")]
public static void BotonRolloverShowText(BotonRollover __instance)
{
if (((Object)((Component)__instance).gameObject).name == "reloadturn")
{
((Component)__instance.rollOverText).GetComponent<TMP_Text>().text = "Reload Turn";
}
if (((Object)((Component)__instance).gameObject).name == "savegame")
{
((Component)__instance.rollOverText).GetComponent<TMP_Text>().text = (changeSaveGameText ? "Game Saved!" : "Save Game");
}
if (((Object)((Component)__instance).gameObject).name == "loadgame")
{
((Component)__instance.rollOverText).GetComponent<TMP_Text>().text = "Load Game";
}
if (((Object)((Component)__instance).gameObject).name == "resetseed")
{
((Component)__instance.rollOverText).GetComponent<TMP_Text>().text = "Reset Seed";
}
if (((Object)((Component)__instance).gameObject).name == "saveturn")
{
((Component)__instance.rollOverText).GetComponent<TMP_Text>().text = (changeSaveGameText ? "Game Saved!" : "Save Turn");
}
if (((Object)((Component)__instance).gameObject).name == "skipcorruptor")
{
((Component)__instance.rollOverText).GetComponent<TMP_Text>().text = "Restart Combat without Corruptor";
}
if (((Object)((Component)__instance).gameObject).name == "quickload")
{
string text = "Quick Load \n(" + QuickSaveFunctions.StripGamedataPrefix(Path.GetFileNameWithoutExtension(QuickSaveFunctions.quickLoadFilename)) + ")";
string value = "\n";
int num = text.IndexOf('_');
int num2 = -1;
if (num != -1)
{
num2 = text.IndexOf('_', num + 1);
}
if (num2 != -1)
{
StringBuilder stringBuilder = new StringBuilder(text);
stringBuilder.Remove(num2, 1);
stringBuilder.Insert(num2, value);
text = stringBuilder.ToString();
}
((Component)__instance.rollOverText).GetComponent<TMP_Text>().text = text;
}
if (((Object)((Component)__instance).gameObject).name == "showmap")
{
((Component)__instance.rollOverText).GetComponent<TMP_Text>().text = "Show Map (Coming Soon)";
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(BotonRollover), "OnMouseUp")]
public static void BotonRolloverOnMouseUp(BotonRollover __instance)
{
QuickSaveFunctions.isMP = GameManager.Instance.IsMultiplayer();
QuickSaveFunctions.isHost = GameManager.Instance.IsMultiplayer() && NetworkManager.Instance.IsMaster();
if (!Functions.ClickedThisTransform(((Component)__instance).transform) || (Object.op_Implicit((Object)(object)MatchManager.Instance) && MatchManager.Instance.CombatLoading) || AlertManager.Instance.IsActive() || GameManager.Instance.IsTutorialActive() || SettingsManager.Instance.IsActive() || DamageMeterManager.Instance.IsActive() || (Object.op_Implicit((Object)(object)MapManager.Instance) && MapManager.Instance.IsCharacterUnlock()) || (Object.op_Implicit((Object)(object)MatchManager.Instance) && MatchManager.Instance.console.IsActive()))
{
return;
}
string name = ((Object)((Component)__instance).gameObject).name;
CloseWindows(__instance, name);
int saveSlot = SaveManager.Instance.GetSaveSlot();
Plugin.LogDebug("BotonRolloverOnMouseUp " + (name ?? "null object"));
switch (name)
{
case "reloadturn":
QuickSaveFunctions.isHost = GameManager.Instance.IsMultiplayer() && NetworkManager.Instance.IsMaster();
if (QuickSaveFunctions.isHost)
{
AtOManager.Instance.DoLoadGameFromMP(false);
}
else
{
SaveManager.Instance.LoadGame(saveSlot, false);
}
break;
case "resetseed":
QuickSaveFunctions.HandleResetSeed4();
break;
case "savegame":
if (Plugin.EnableCustomSaveNames.Value)
{
QuickSaveFunctions.SetCustomName();
}
else
{
((MonoBehaviour)Globals.Instance).StartCoroutine(QuickSaveFunctions.SaveGame());
}
break;
case "saveturn":
if (Plugin.EnableCustomSaveNames.Value)
{
QuickSaveFunctions.SetCustomName(isTurn: true);
}
else
{
((MonoBehaviour)Globals.Instance).StartCoroutine(QuickSaveFunctions.SaveGameTurn());
}
break;
case "loadgame":
{
string directoryName = Path.GetDirectoryName(SaveManager.Instance.PathSaveGameTurn(saveSlot));
string gameId = AtOManager.Instance.GetGameId();
string path = ((Plugin.SaveFolderName.Value == "") ? gameId : Plugin.SaveFolderName.Value);
string directory = Path.Combine(directoryName, path);
List<string> allFilePaths = QuickSaveFunctions.GetAllFilePaths(directory);
Plugin.LogDebug("initialized dropdown");
loadgameDropdown.ClearOptions();
loadgameDropdown.AddOptions(allFilePaths);
((Component)loadgameDropdown).gameObject.SetActive(true);
SettingsManager.Instance.ShowSettings(true);
break;
}
case "quickload":
QuickSaveFunctions.QuickLoad();
break;
case "skipcorruptor":
skipCorruption = true;
AtOManager.Instance.corruptionAccepted = false;
MatchManager.Instance.ALL_BreakByDesync();
break;
}
fRollOut(__instance);
}
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(BotonRollover), "fRollOut")]
public static void fRollOut(BotonRollover __instance)
{
}
[HarmonyReversePatch(/*Could not decode attribute arguments.*/)]
[HarmonyPatch(typeof(BotonRollover), "CloseWindows")]
public static void CloseWindows(BotonRollover __instance, string botName)
{
}
[HarmonyPostfix]
[HarmonyPatch(typeof(CinematicManager), "Awake")]
public static void CinematicManagerAwakePostfix(CinematicManager __instance)
{
if (skipCinematic)
{
Plugin.LogDebug("CinematicManagerAwakePostfix attempting to skip");
skipCinematic = false;
if (__instance != null)
{
__instance.SkipCinematic();
}
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(AtOManager), "DoLoadGame")]
public static void DoLoadGamePrefix(AtOManager __instance, bool comingFromReloadCombat = false)
{
Plugin.LogDebug("DoLoadGame");
if (skipCorruption)
{
Plugin.LogDebug("DoLoadGame attempting to corruption");
AtOManager.Instance.corruptionAccepted = false;
skipCorruption = false;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(AtOManager), "DoLoadGameFromMP")]
public static void DoLoadGameFromMPPrefix(AtOManager __instance, bool comingFromReloadCombat = false)
{
Plugin.LogDebug("DoLoadGameFromMPPrefix");
if (skipCorruption)
{
Plugin.LogDebug("DoLoadGameFromMPPrefix attempting to corruption");
AtOManager.Instance.corruptionAccepted = false;
skipCorruption = false;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(SaveManager), "LoadGameTurn")]
public static void LoadGameTurnPrefix()
{
Plugin.LogDebug("LoadGameTurnPrefix");
}
[HarmonyPrefix]
[HarmonyPatch(typeof(SaveManager), "LoadGame")]
public static void LoadGamePrefix()
{
Plugin.LogDebug("LoadGamePrefix");
}
[HarmonyPrefix]
[HarmonyPatch(typeof(InputController), "DoKeyBinding")]
public static bool DoKeyBindingPrefix(CallbackContext _context)
{
if (Keyboard.current != null && Plugin.DisableControlClick.Value && ((object)((CallbackContext)(ref _context)).control == Keyboard.current[(Key)55] || (object)((CallbackContext)(ref _context)).control == Keyboard.current[(Key)56]))
{
Plugin.LogDebug("Disabling control click");
return false;
}
return true;
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "com.binbin.quicksave";
public const string PLUGIN_NAME = "QuickSave";
public const string PLUGIN_VERSION = "1.3.0";
}
}