Decompiled source of BetterWeaponBalanceUpdated v1.2.22

BetterWeaponBalanceBeta.dll

Decompiled 2 weeks ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("GameRepoTestMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GameRepoTestMod")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("65c072bf-987c-4c0c-9832-78dbc8deeb85")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("ru.u2vr.betterweaponbalance", "BetterWeaponBalance Mod", "0.1.0")]
public class Program : BaseUnityPlugin
{
	public static ConfigEntry<int> TranqBullets;

	public static ConfigEntry<int> ShothgunBullets;

	public static ConfigEntry<int> PistolBullets;

	public static ConfigEntry<int> CrossbowBullets;

	public static ConfigEntry<int> ZapperBullets;

	public static ManualLogSource Log;

	public static bool newWeaponLooged;

	public void Awake()
	{
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Expected O, but got Unknown
		//IL_0060: Unknown result type (might be due to invalid IL or missing references)
		//IL_006a: Expected O, but got Unknown
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Expected O, but got Unknown
		//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: Expected O, but got Unknown
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0103: Expected O, but got Unknown
		Harmony val = new Harmony("ru.u2vr.betterweaponbalance");
		TranqBullets = ((BaseUnityPlugin)this).Config.Bind<int>("AMMO", "Tranq (game def 5, mod def 10)", 10, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
		ShothgunBullets = ((BaseUnityPlugin)this).Config.Bind<int>("AMMO", "Shothgun (game def 4, mod def 6)", 6, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
		PistolBullets = ((BaseUnityPlugin)this).Config.Bind<int>("AMMO", "Pistol (game def 8, mod def 9)", 9, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
		CrossbowBullets = ((BaseUnityPlugin)this).Config.Bind<int>("AMMO", "Crossbow (game def 12, mod def 20)", 20, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
		ZapperBullets = ((BaseUnityPlugin)this).Config.Bind<int>("AMMO", "Zapper (game def 6, mod def 10)", 10, new ConfigDescription("", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
		val.PatchAll();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Better Weapon Balance Mod loaded!");
		Log = ((BaseUnityPlugin)this).Logger;
	}
}
[HarmonyPatch(typeof(ItemGun), "Update")]
public class ItemGun_Update_Patch
{
	public static void Prefix(ItemGun __instance)
	{
		ItemBattery val = default(ItemBattery);
		if (!((Object)(object)__instance == (Object)null) && ((Component)__instance).TryGetComponent<ItemBattery>(ref val))
		{
			bool flag = false;
			if (((Object)__instance).name.Equals("Item Gun Tranq(Clone)"))
			{
				val.batteryBars = Program.TranqBullets.Value;
				flag = true;
			}
			else if (((Object)__instance).name.Equals("Item Gun Shotgun(Clone)"))
			{
				val.batteryBars = Program.ShothgunBullets.Value;
				flag = true;
			}
			else if (((Object)__instance).name.Equals("Item Gun Handgun(Clone)"))
			{
				val.batteryBars = Program.PistolBullets.Value;
				flag = true;
			}
			else if (((Object)__instance).name.Equals("Item Gun Stun(Clone)"))
			{
				val.batteryBars = Program.CrossbowBullets.Value;
				flag = true;
			}
			else if (((Object)__instance).name.Equals("Item Gun Shockwave(Clone)"))
			{
				val.batteryBars = Program.ZapperBullets.Value;
				flag = true;
			}
			else if (((Object)__instance).name.Contains("Item Gun") && !Program.newWeaponLooged)
			{
				Program.Log.LogInfo((object)"NEW WEAPON <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
				Program.Log.LogInfo((object)((Object)__instance).name);
				Program.newWeaponLooged = true;
			}
			BatteryVisualLogic val2 = default(BatteryVisualLogic);
			if (flag && ((Component)val).TryGetComponent<BatteryVisualLogic>(ref val2))
			{
				val2.BatteryBarsSet();
			}
		}
	}
}