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.Configuration;
using HarmonyLib;
using TMPro;
using UnboundLib;
using UnboundLib.Cards;
using UnboundLib.Utils.UI;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("UnpowerfullGod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("UnpowerfullGod")]
[assembly: AssemblyTitle("UnpowerfullGod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace UnpowerfullGod;
[BepInPlugin("quinten.rounds.cards.unpowerfullgod", "Unpowerfull God", "1.4.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class UnpowerfullGodPlugin : BaseUnityPlugin
{
[Serializable]
[CompilerGenerated]
private sealed class <>c
{
public static readonly <>c <>9 = new <>c();
public static UnityAction <>9__3_0;
internal void <Awake>b__3_0()
{
}
}
public const string ModId = "quinten.rounds.cards.unpowerfullgod";
public const string ModName = "Unpowerfull God";
public const string Version = "1.4.0";
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Expected O, but got Unknown
UnpowerfullGodSettings.Bind(((BaseUnityPlugin)this).Config);
new Harmony("quinten.rounds.cards.unpowerfullgod").PatchAll();
CustomCard.BuildCard<UnpowerfullGodCard>();
object obj = <>c.<>9__3_0;
if (obj == null)
{
UnityAction val = delegate
{
};
<>c.<>9__3_0 = val;
obj = (object)val;
}
Unbound.RegisterMenu("Unpowerfull God", (UnityAction)obj, (Action<GameObject>)BuildMenu, (GameObject)null, true);
}
private static void BuildMenu(GameObject menu)
{
TextMeshProUGUI val = default(TextMeshProUGUI);
MenuHandler.CreateText("Unpowerfull god settings", menu, ref val, 60, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateText(" ", menu, ref val, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateText("Changes apply on the next frame.", menu, ref val, 24, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
MenuHandler.CreateText(" ", menu, ref val, 30, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
IntSlider("HP cap", UnpowerfullGodSettings.HpCap, 1, 50, menu);
IntSlider("Ammo cap", UnpowerfullGodSettings.AmmoCap, 1, 20, menu);
FloatSlider("Reload seconds", UnpowerfullGodSettings.ReloadSeconds, 1f, 60f, menu);
FloatSlider("Bullet damage", UnpowerfullGodSettings.BulletDamage, 1f, 5000f, menu);
IntSlider("Bounces", UnpowerfullGodSettings.Bounces, 0, 99, menu);
IntSlider("Block charges", UnpowerfullGodSettings.Blocks, 0, 99, menu);
}
private static void IntSlider(string label, ConfigEntry<int> entry, int min, int max, GameObject menu)
{
Slider val = default(Slider);
MenuHandler.CreateSlider(label, menu, 30, (float)min, (float)max, (float)entry.Value, (UnityAction<float>)delegate(float v)
{
entry.Value = Mathf.RoundToInt(v);
}, ref val, true, (Color?)null, (Direction)0, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
}
private static void FloatSlider(string label, ConfigEntry<float> entry, float min, float max, GameObject menu)
{
Slider val = default(Slider);
MenuHandler.CreateSlider(label, menu, 30, min, max, entry.Value, (UnityAction<float>)delegate(float v)
{
entry.Value = v;
}, ref val, false, (Color?)null, (Direction)0, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null);
}
}
public class UnpowerfullGodCard : CustomCard
{
protected override string GetTitle()
{
return "Unpowerfull god";
}
protected override string GetDescription()
{
return "1 hp, 1 bullet, slow reload, big damage.\nedit values in the mod menu.";
}
protected override GameObject GetCardArt()
{
return null;
}
protected override Rarity GetRarity()
{
return (Rarity)2;
}
protected override CardInfoStat[] GetStats()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Expected O, but got Unknown
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Expected O, but got Unknown
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Expected O, but got Unknown
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Expected O, but got Unknown
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Expected O, but got Unknown
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Expected O, but got Unknown
return (CardInfoStat[])(object)new CardInfoStat[6]
{
new CardInfoStat
{
positive = false,
stat = "Max HP",
amount = $"= {UnpowerfullGodSettings.HpCap.Value}",
simepleAmount = (SimpleAmount)0
},
new CardInfoStat
{
positive = false,
stat = "Ammo",
amount = $"= {UnpowerfullGodSettings.AmmoCap.Value}",
simepleAmount = (SimpleAmount)0
},
new CardInfoStat
{
positive = false,
stat = "Reload Time",
amount = $"{UnpowerfullGodSettings.ReloadSeconds.Value:0}s",
simepleAmount = (SimpleAmount)0
},
new CardInfoStat
{
positive = true,
stat = "Damage",
amount = $"{UnpowerfullGodSettings.BulletDamage.Value:0}",
simepleAmount = (SimpleAmount)0
},
new CardInfoStat
{
positive = true,
stat = "Bounces",
amount = $"+{UnpowerfullGodSettings.Bounces.Value}",
simepleAmount = (SimpleAmount)0
},
new CardInfoStat
{
positive = true,
stat = "Blocks",
amount = $"+{UnpowerfullGodSettings.Blocks.Value}",
simepleAmount = (SimpleAmount)0
}
};
}
protected override CardThemeColorType GetTheme()
{
return (CardThemeColorType)8;
}
public override string GetModName()
{
return "UPG";
}
public override void SetupCard(CardInfo cardInfo, Gun gun, ApplyCardStats cardStats, CharacterStatModifiers statModifiers, Block block)
{
statModifiers.health = 0.001f;
}
public override void OnAddCard(Player player, Gun gun, GunAmmo gunAmmo, CharacterData data, HealthHandler health, Gravity gravity, Block block, CharacterStatModifiers characterStats)
{
float num = (data.maxHealth = UnpowerfullGodSettings.HpCap.Value);
data.health = Mathf.Min(data.health, num);
if ((Object)(object)((Component)player).gameObject.GetComponent<UnpowerfullGodEnforcer>() == (Object)null)
{
((Component)player).gameObject.AddComponent<UnpowerfullGodEnforcer>();
}
}
public override void OnRemoveCard()
{
}
}
public class UnpowerfullGodEnforcer : MonoBehaviour
{
private CharacterData _data;
private Block _block;
private void Awake()
{
_data = ((Component)this).GetComponent<CharacterData>();
_block = ((Component)this).GetComponentInChildren<Block>();
}
private void LateUpdate()
{
if ((Object)(object)_data == (Object)null)
{
return;
}
float num = UnpowerfullGodSettings.HpCap.Value;
if (_data.maxHealth > num)
{
_data.maxHealth = num;
}
if (_data.health > num)
{
_data.health = num;
}
if ((Object)(object)_block != (Object)null)
{
_block.additionalBlocks = UnpowerfullGodSettings.Blocks.Value;
}
Gun val = (((Object)(object)_data.weaponHandler != (Object)null) ? _data.weaponHandler.gun : null);
if ((Object)(object)val == (Object)null)
{
return;
}
val.reloadTime = UnpowerfullGodSettings.ReloadSeconds.Value;
val.damage = UnpowerfullGodSettings.BulletDamage.Value;
val.reflects = UnpowerfullGodSettings.Bounces.Value;
GunAmmo component = ((Component)val).GetComponent<GunAmmo>();
if (!((Object)(object)component == (Object)null))
{
int value = UnpowerfullGodSettings.AmmoCap.Value;
Traverse val2 = Traverse.Create((object)component).Field("maxAmmo");
Traverse val3 = Traverse.Create((object)component).Field("currentAmmo");
if (val2.GetValue<int>() != value)
{
val2.SetValue((object)value);
}
if (val3.GetValue<int>() > value)
{
val3.SetValue((object)value);
}
}
}
}
public static class UnpowerfullGodSettings
{
public static ConfigEntry<int> HpCap;
public static ConfigEntry<int> AmmoCap;
public static ConfigEntry<float> ReloadSeconds;
public static ConfigEntry<float> BulletDamage;
public static ConfigEntry<int> Bounces;
public static ConfigEntry<int> Blocks;
public static void Bind(ConfigFile cfg)
{
HpCap = cfg.Bind<int>("Unpowerfull god", "HP cap", 1, "Maximum HP the player is allowed to have.");
AmmoCap = cfg.Bind<int>("Unpowerfull god", "Ammo cap", 1, "Maximum ammo (bullets per magazine).");
ReloadSeconds = cfg.Bind<float>("Unpowerfull god", "Reload seconds", 30f, "How long a reload takes, in seconds.");
BulletDamage = cfg.Bind<float>("Unpowerfull god", "Bullet damage", 1000f, "Damage per bullet.");
Bounces = cfg.Bind<int>("Unpowerfull god", "Bounces", 99, "Bullet bounces (reflects).");
Blocks = cfg.Bind<int>("Unpowerfull god", "Block charges", 99, "Additional block charges.");
}
}