Decompiled source of RepoCartAddingMod v1.0.1

RepoCartAddingMod.dll

Decompiled 4 hours ago
using System;
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 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RepoCartAddingMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("REPO 상점 카트 추가 모드")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RepoCartAddingMod")]
[assembly: AssemblyTitle("RepoCartAddingMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace RepoCartAddingMod;

[BepInPlugin("com.mydesigner.repocartaddingmod", "Repo Cart Adding Mod", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static Plugin Instance;

	public static ManualLogSource Log;

	private void Awake()
	{
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002d: Expected O, but got Unknown
		Instance = this;
		Log = ((BaseUnityPlugin)this).Logger;
		Log.LogInfo((object)"매 라운드 카트 100% 확정 스폰 모드가 켜졌습니다!");
		Harmony val = new Harmony("com.mydesigner.repocartaddingmod");
		val.PatchAll();
	}
}
[HarmonyPatch(typeof(ShopManager), "GetAllItemsFromStatsManager")]
[HarmonyPriority(0)]
public class ShopManagerItemFillPatch
{
	private static void Postfix(ShopManager __instance)
	{
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: Invalid comparison between Unknown and I4
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Invalid comparison between Unknown and I4
		//IL_0110: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Invalid comparison between Unknown and I4
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0121: Invalid comparison between Unknown and I4
		Plugin.Log.LogInfo((object)"상점 무작위 셔플 감지! 카트 100% 확정 진열 작업을 시작합니다.");
		try
		{
			if (__instance.potentialItemUpgrades == null || (Object)(object)StatsManager.instance == (Object)null || StatsManager.instance.itemDictionary == null)
			{
				return;
			}
			Item val = null;
			foreach (Item value in StatsManager.instance.itemDictionary.Values)
			{
				if (!((Object)(object)value == (Object)null))
				{
					if ((int)value.itemType == 2)
					{
						val = value;
						break;
					}
					if ((int)value.itemType == 12 && (Object)(object)val == (Object)null)
					{
						val = value;
					}
				}
			}
			if ((Object)(object)val == (Object)null)
			{
				Plugin.Log.LogWarning((object)"게임 창고에서 카트 아이템 데이터를 찾지 못했습니다.");
				return;
			}
			bool flag = false;
			foreach (Item potentialItemUpgrade in __instance.potentialItemUpgrades)
			{
				if ((Object)(object)potentialItemUpgrade != (Object)null && ((int)potentialItemUpgrade.itemType == 2 || (int)potentialItemUpgrade.itemType == 12))
				{
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				Plugin.Log.LogInfo((object)"카트가 확률에 밀려 탈락한 것을 확인했습니다. 강제 주입을 시작합니다.");
				if (__instance.potentialItemUpgrades.Count > 0)
				{
					__instance.potentialItemUpgrades[0] = val;
				}
				else
				{
					__instance.potentialItemUpgrades.Add(val);
				}
				Plugin.Log.LogInfo((object)("[성공] 상점 0번 자리에 " + ((Object)val).name + "를 확정 등록했습니다. 이번 라운드에 무조건 나옵니다!"));
			}
			else
			{
				Plugin.Log.LogInfo((object)"다행히 무작위 확률로 카트가 이미 목록에 포함되어 있습니다.");
			}
		}
		catch (Exception ex)
		{
			Plugin.Log.LogError((object)("카트 확정 스폰 중 에러 발생: " + ex.Message));
		}
	}
}