using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("DspFontPatcher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DspFontPatcher")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("81DF3045-8007-4F6A-AAF6-903139D85B6C")]
[assembly: AssemblyFileVersion("0.1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.1.0.0")]
[module: UnverifiableCode]
namespace DSPBigInventory;
[BepInPlugin("Appun.DSP.plugin.BigInventory", "DSPBigInventory", "1.0.8")]
[BepInProcess("DSPGAME.exe")]
[HarmonyPatch]
public class DSPBigInventory : BaseUnityPlugin
{
public static ConfigEntry<int> colCount;
public static ConfigEntry<int> rowCount;
public static ConfigEntry<int> DeliveryColCount;
public static ConfigEntry<bool> defaultSetting;
public void Start()
{
LogManager.Logger = ((BaseUnityPlugin)this).Logger;
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
colCount = ((BaseUnityPlugin)this).Config.Bind<int>("General", "colCount", 16, "Inventory Column Count max30");
rowCount = ((BaseUnityPlugin)this).Config.Bind<int>("General", "rowCount", 14, "Inventory Row Count");
DeliveryColCount = ((BaseUnityPlugin)this).Config.Bind<int>("General", "DeliveryColCount", 5, "Delivery slot Column Count max20");
defaultSetting = ((BaseUnityPlugin)this).Config.Bind<bool>("DefaultSetting", "DefaultSize?", false, "Reset Your Inventory Size?");
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Player), "Import")]
public static void Mecha_Import_Postfix(Player __instance)
{
if (!defaultSetting.Value)
{
__instance.packageColCount = colCount.Value;
__instance.package.SetSize(colCount.Value * rowCount.Value);
__instance.deliveryPackage.colCount = DeliveryColCount.Value;
__instance.deliveryPackage.rowCount = rowCount.Value;
__instance.deliveryPackage.NotifySizeChange();
return;
}
if (GameMain.history.TechUnlocked(2307))
{
__instance.package.SetSize(144);
__instance.deliveryPackage.rowCount = 12;
__instance.deliveryPackage.colCount = 3;
__instance.deliveryPackage.NotifySizeChange();
__instance.deliveryPackage.stackSizeMultiplier = 10;
__instance.packageColCount = 12;
}
else if (GameMain.history.TechUnlocked(2306))
{
__instance.package.SetSize(120);
__instance.deliveryPackage.rowCount = 12;
__instance.deliveryPackage.colCount = 2;
__instance.deliveryPackage.NotifySizeChange();
__instance.deliveryPackage.stackSizeMultiplier = 10;
__instance.packageColCount = 10;
}
else if (GameMain.history.TechUnlocked(2305))
{
__instance.deliveryPackage.colCount = 2;
__instance.deliveryPackage.rowCount = 10;
__instance.deliveryPackage.NotifySizeChange();
__instance.deliveryPackage.stackSizeMultiplier = 8;
__instance.package.SetSize(100);
__instance.packageColCount = 10;
}
else if (GameMain.history.TechUnlocked(2304))
{
__instance.package.SetSize(80);
__instance.deliveryPackage.colCount = 2;
__instance.deliveryPackage.rowCount = 8;
__instance.deliveryPackage.NotifySizeChange();
__instance.deliveryPackage.stackSizeMultiplier = 6;
__instance.packageColCount = 10;
}
else if (GameMain.history.TechUnlocked(2303))
{
__instance.package.SetSize(70);
__instance.deliveryPackage.colCount = 1;
__instance.deliveryPackage.rowCount = 7;
__instance.deliveryPackage.NotifySizeChange();
__instance.deliveryPackage.stackSizeMultiplier = 4;
__instance.packageColCount = 10;
}
else if (GameMain.history.TechUnlocked(2302))
{
__instance.package.SetSize(60);
__instance.deliveryPackage.colCount = 1;
__instance.deliveryPackage.rowCount = 6;
__instance.deliveryPackage.NotifySizeChange();
__instance.deliveryPackage.stackSizeMultiplier = 2;
__instance.packageColCount = 10;
}
else if (GameMain.history.TechUnlocked(2301))
{
__instance.package.SetSize(50);
__instance.deliveryPackage.colCount = 1;
__instance.deliveryPackage.rowCount = 5;
__instance.deliveryPackage.NotifySizeChange();
__instance.deliveryPackage.stackSizeMultiplier = 2;
__instance.packageColCount = 10;
}
else
{
__instance.package.SetSize(40);
__instance.deliveryPackage.colCount = 1;
__instance.deliveryPackage.rowCount = 4;
__instance.deliveryPackage.NotifySizeChange();
__instance.deliveryPackage.stackSizeMultiplier = 2;
__instance.packageColCount = 10;
}
if (!GameMain.history.TechUnlocked(2306))
{
__instance.deliveryPackage.colCount = 0;
__instance.packageColCount = 10;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Player), "SetForNewGame")]
public static void Mecha_SetForNewGame_Postfix(Player __instance)
{
if (!defaultSetting.Value)
{
__instance.package.SetSize(colCount.Value * rowCount.Value);
__instance.deliveryPackage.colCount = DeliveryColCount.Value;
__instance.deliveryPackage.rowCount = rowCount.Value;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(GameHistoryData), "UnlockTechFunction")]
public static bool GameHistoryData_UnlockTechFunction_Prefix(GameHistoryData __instance, int func)
{
if (!defaultSetting.Value)
{
return func switch
{
5 => false,
32 => false,
33 => false,
38 => false,
_ => true,
};
}
return true;
}
public static void UIInventoryWindow_OnPlayerDeliveryPackageSizeChange_Postfix(UIInventoryWindow __instance)
{
//IL_00bb: 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_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
if (!defaultSetting.Value)
{
UIRoot.instance.uiGame.inventoryWindow.inventory.colCount = colCount.Value;
bool flag = __instance.player.deliveryPackage.activeCount > 0;
float num = (flag ? (__instance.player.deliveryPackage.colCount * 50 + 6) : 0);
float num2 = (flag ? 26 : 0);
__instance.windowTrans.sizeDelta = new Vector2((float)(colCount.Value * 50 + 80) + 8f + num, (float)(110 + ((__instance.player.package.size - 1) / colCount.Value + 1) * 50) + num2);
((Component)__instance.deliveryPanel).transform.localPosition = Vector2.op_Implicit(new Vector2((float)(40 + 50 * __instance.player.deliveryPackage.colCount), ((Component)__instance.deliveryPanel).transform.localPosition.y));
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(Player), "OnPackageSizeChange")]
public static void UIInventoryWindow_OnPackageSizeChange_Postfix(Player __instance)
{
if (!defaultSetting.Value)
{
__instance.deliveryPackage.rowCount = (__instance.package.size - 1) / colCount.Value + 1;
}
}
public static bool UIAssemblerWindow_OpenPlayerPackage_Prefix(UIAssemblerWindow __instance)
{
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
if (!defaultSetting.Value)
{
if (!((ManualBehaviour)__instance.playerInventory).inited)
{
__instance.playerInventory.colCount = colCount.Value;
((ManualBehaviour)__instance.playerInventory)._Init((object)__instance.player.package);
((ManualBehaviour)__instance.playerInventory)._Open();
__instance.windowTrans.sizeDelta = new Vector2((float)(colCount.Value * 50 + 80), (float)(rowCount.Value * 50 + 220));
}
return false;
}
return true;
}
public static bool UIMinerWindow_OnOpen_Prefix(UIMinerWindow __instance)
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
if (!defaultSetting.Value)
{
if (GameMain.localPlanet != null && GameMain.localPlanet.factory != null)
{
__instance.playerInventory.colCount = colCount.Value;
__instance.windowTrans.sizeDelta = new Vector2((float)(colCount.Value * 50 + 80), (float)(rowCount.Value * 50 + 220));
}
return true;
}
return true;
}
}
public class LogManager
{
public static ManualLogSource Logger;
}