using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppSystem.Collections.Generic;
using SSSGame;
using SandSailorStudio.Inventory;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("blacks7ar")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("NoCostBuildingRepair")]
[assembly: AssemblyTitle("NoCostBuildingRepair")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace NoCostBuildingRepair;
[BepInPlugin("blacks7ar.NoCostBuildingRepair", "NoCostBuildingRepair", "1.0.0")]
public class Plugin : BasePlugin
{
[HarmonyPatch]
private static class Patch
{
private static readonly List<ItemInfo> _keyBuffer = new List<ItemInfo>();
[HarmonyPostfix]
[HarmonyPatch(typeof(RepairPart), "_GenerateRepairsManifest")]
private static void GenerateRepairsManifest_Postfix(RepairPart __instance, ref ItemManifest __result)
{
ItemManifest obj = __result;
Dictionary<ItemInfo, int> val = ((obj != null) ? obj._items : null);
if (val == null || val.Count == 0)
{
return;
}
_keyBuffer.Clear();
Enumerator<ItemInfo, int> enumerator = val._keys.GetEnumerator();
while (enumerator.MoveNext())
{
ItemInfo current = enumerator.Current;
_keyBuffer.Add(current);
}
foreach (ItemInfo item in _keyBuffer)
{
val[item] = 0;
}
__instance.IsRepairStage = true;
}
}
private const string modGUID = "blacks7ar.NoCostBuildingRepair";
public const string modName = "NoCostBuildingRepair";
public const string modAuthor = "blacks7ar";
public const string modVersion = "1.0.0";
private static ManualLogSource NCLogger;
public override void Load()
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
NCLogger = ((BasePlugin)this).Log;
NCLogger.LogInfo((object)"Mod loaded.");
new Harmony("blacks7ar.NoCostBuildingRepair").PatchAll();
}
}