using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using CheaperShipDecor;
using HarmonyLib;
using LCTutorialMod.Patches;
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("CheaperShipDecor")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("CheaperShipDecor")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("68107877-bf89-4c98-b632-65afc2bdff28")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace LCTutorialMod.Patches
{
[HarmonyPatch(typeof(Terminal))]
internal class TerminalPatch
{
[HarmonyPatch("RotateShipDecorSelection")]
[HarmonyPostfix]
private static void changeShownDecorationPrices(ref List<TerminalNode> ___ShipDecorSelection)
{
___ShipDecorSelection.Clear();
for (int i = 0; i < StartOfRound.Instance.unlockablesList.unlockables.Count; i++)
{
UnlockableItem val = StartOfRound.Instance.unlockablesList.unlockables[i];
if ((Object)(object)val.shopSelectionNode != (Object)null && !val.alwaysInStock)
{
___ShipDecorSelection.Add(val.shopSelectionNode);
}
}
foreach (TerminalNode item in ___ShipDecorSelection)
{
ModeBase.Instance.mls.LogInfo((object)("Overriding the price of ship decoration (" + ((object)item).ToString() + ")"));
item.itemCost = 20;
}
}
[HarmonyPatch("LoadNewNodeIfAffordable")]
[HarmonyPrefix]
private static void changeDecorationPrices(TerminalNode node, ref List<TerminalNode> ___ShipDecorSelection)
{
UnlockableItem val = ((node.shipUnlockableID == -1) ? null : StartOfRound.Instance.unlockablesList.unlockables[node.shipUnlockableID]);
if (val != null && ___ShipDecorSelection.Contains(val.shopSelectionNode))
{
ModeBase.Instance.mls.LogInfo((object)("Overriding the price of ship decoration (" + ((object)node).ToString() + ")"));
node.itemCost = 20;
}
}
}
}
namespace CheaperShipDecor
{
[BepInPlugin("gira.dev.cheapershipdecor", "Cheaper Ship Decor", "1.2.1")]
public class ModeBase : BaseUnityPlugin
{
private const string modGUID = "gira.dev.cheapershipdecor";
private const string modName = "Cheaper Ship Decor";
private const string modVersion = "1.2.1";
private readonly Harmony harmony = new Harmony("gira.dev.cheapershipdecor");
public static ModeBase Instance;
internal ManualLogSource mls;
public ManualLogSource Mls => mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("gira.dev.cheapershipdecor");
mls.LogInfo((object)"Cheaper Ship Decor initialized");
mls.LogInfo((object)"Modification of 7hp's Free Ship Decor mod, please don't come at me I'm still new lol");
harmony.PatchAll(typeof(ModeBase));
harmony.PatchAll(typeof(TerminalPatch));
}
}
}