using System;
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.Configuration;
using BepInEx.Logging;
using EntityStates;
using EntityStates.Bandit2.Weapon;
using Microsoft.CodeAnalysis;
using On.EntityStates.Bandit2.Weapon;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MoreSkullStacks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MoreSkullStacks")]
[assembly: AssemblyTitle("MoreSkullStacks")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace MoreSkullStacks
{
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Kytsop.MoreSkullStacks", "MoreSkullStacks", "1.0.0")]
public class MoreSkullStacks : BaseUnityPlugin
{
[CompilerGenerated]
private static class <>O
{
public static hook_Begin <0>__OnExitingStage;
public static hook_OnDeathStart <1>__OnPlayerDeath;
public static hook_Start <2>__OnBodyStart;
public static hook_ModifyBullet <3>__OnSkullRevolverFire;
public static hook_Start <4>__OnRunStart;
}
public const string PluginGUID = "Kytsop.MoreSkullStacks";
public const string PluginAuthor = "Kytsop";
public const string PluginName = "MoreSkullStacks";
public const string PluginVersion = "1.0.0";
private static ConfigEntry<float> configBaseDmg;
private static ConfigEntry<float> configDmgScaling;
private static ConfigEntry<float> configStackLoss;
private static Dictionary<PlayerCharacterMasterController, int> skullStackHolder = new Dictionary<PlayerCharacterMasterController, int>();
private static List<int> ignoredScenesIndex = new List<int> { 9, 43 };
public void Awake()
{
Log.Init(((BaseUnityPlugin)this).Logger);
configBaseDmg = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Base damage", 0.6f, "Damage dealt by the skill with no stacks. Original value is 1.");
configDmgScaling = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Damage scaling", 0.06f, "Damage gain with each stack. Original value is 0.1.");
configStackLoss = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Stack loss", 0.5f, "The proportion of stack lost each time you die or change stage. 0 means you lose all stacks, 1 means you keep all of your stacks.");
}
private void OnEnable()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected O, but got Unknown
object obj = <>O.<0>__OnExitingStage;
if (obj == null)
{
hook_Begin val = OnExitingStage;
<>O.<0>__OnExitingStage = val;
obj = (object)val;
}
SceneExitController.Begin += (hook_Begin)obj;
object obj2 = <>O.<1>__OnPlayerDeath;
if (obj2 == null)
{
hook_OnDeathStart val2 = OnPlayerDeath;
<>O.<1>__OnPlayerDeath = val2;
obj2 = (object)val2;
}
CharacterBody.OnDeathStart += (hook_OnDeathStart)obj2;
object obj3 = <>O.<2>__OnBodyStart;
if (obj3 == null)
{
hook_Start val3 = OnBodyStart;
<>O.<2>__OnBodyStart = val3;
obj3 = (object)val3;
}
CharacterBody.Start += (hook_Start)obj3;
object obj4 = <>O.<3>__OnSkullRevolverFire;
if (obj4 == null)
{
hook_ModifyBullet val4 = OnSkullRevolverFire;
<>O.<3>__OnSkullRevolverFire = val4;
obj4 = (object)val4;
}
FireSidearmSkullRevolver.ModifyBullet += (hook_ModifyBullet)obj4;
object obj5 = <>O.<4>__OnRunStart;
if (obj5 == null)
{
hook_Start val5 = OnRunStart;
<>O.<4>__OnRunStart = val5;
obj5 = (object)val5;
}
Run.Start += (hook_Start)obj5;
}
private void OnDisable()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Expected O, but got Unknown
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Expected O, but got Unknown
object obj = <>O.<0>__OnExitingStage;
if (obj == null)
{
hook_Begin val = OnExitingStage;
<>O.<0>__OnExitingStage = val;
obj = (object)val;
}
SceneExitController.Begin -= (hook_Begin)obj;
object obj2 = <>O.<1>__OnPlayerDeath;
if (obj2 == null)
{
hook_OnDeathStart val2 = OnPlayerDeath;
<>O.<1>__OnPlayerDeath = val2;
obj2 = (object)val2;
}
CharacterBody.OnDeathStart -= (hook_OnDeathStart)obj2;
object obj3 = <>O.<2>__OnBodyStart;
if (obj3 == null)
{
hook_Start val3 = OnBodyStart;
<>O.<2>__OnBodyStart = val3;
obj3 = (object)val3;
}
CharacterBody.Start -= (hook_Start)obj3;
object obj4 = <>O.<3>__OnSkullRevolverFire;
if (obj4 == null)
{
hook_ModifyBullet val4 = OnSkullRevolverFire;
<>O.<3>__OnSkullRevolverFire = val4;
obj4 = (object)val4;
}
FireSidearmSkullRevolver.ModifyBullet -= (hook_ModifyBullet)obj4;
object obj5 = <>O.<4>__OnRunStart;
if (obj5 == null)
{
hook_Start val5 = OnRunStart;
<>O.<4>__OnRunStart = val5;
obj5 = (object)val5;
}
Run.Start -= (hook_Start)obj5;
}
private static void OnRunStart(orig_Start orig, Run self)
{
skullStackHolder.Clear();
orig.Invoke(self);
}
private static void OnExitingStage(orig_Begin orig, SceneExitController self)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected I4, but got Unknown
List<int> list = ignoredScenesIndex;
Scene activeScene = SceneManager.GetActiveScene();
if (list.Contains((int)SceneCatalog.FindSceneIndex(((Scene)(ref activeScene)).name)))
{
orig.Invoke(self);
return;
}
_ = PlayerCharacterMasterController.instances;
foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
{
if (!instance.master.IsDeadAndOutOfLivesServer() && instance.master.GetBody().HasBuff(Buffs.BanditSkull))
{
skullStackHolder.TryAdd(instance, instance.master.GetBody().GetBuffCount(Buffs.BanditSkull));
}
}
orig.Invoke(self);
}
private static void OnPlayerDeath(orig_OnDeathStart orig, CharacterBody self)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected I4, but got Unknown
List<int> list = ignoredScenesIndex;
Scene activeScene = SceneManager.GetActiveScene();
if (list.Contains((int)SceneCatalog.FindSceneIndex(((Scene)(ref activeScene)).name)))
{
orig.Invoke(self);
return;
}
if (self.isPlayerControlled && self.HasBuff(Buffs.BanditSkull))
{
skullStackHolder.TryAdd(self.master.playerCharacterMasterController, self.GetBuffCount(Buffs.BanditSkull));
}
orig.Invoke(self);
}
private static void OnBodyStart(orig_Start orig, CharacterBody self)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Expected I4, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
List<int> list = ignoredScenesIndex;
Scene activeScene = SceneManager.GetActiveScene();
if (!list.Contains((int)SceneCatalog.FindSceneIndex(((Scene)(ref activeScene)).name)) && self.isPlayerControlled)
{
int value = 0;
float num = Math.Clamp(configStackLoss.Value, 0f, 1f);
if (skullStackHolder.TryGetValue(self.master.playerCharacterMasterController, out value))
{
self.AddBuff(Buffs.BanditSkull);
self.SetBuffCount(Buffs.BanditSkull.buffIndex, (int)((float)value * num));
skullStackHolder.Remove(self.master.playerCharacterMasterController);
}
}
}
private static void OnSkullRevolverFire(orig_ModifyBullet orig, FireSidearmSkullRevolver self, BulletAttack bulletAttack)
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
int num = 0;
if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody))
{
num = ((EntityState)self).characterBody.GetBuffCount(Buffs.BanditSkull);
}
bulletAttack.damage *= configBaseDmg.Value + configDmgScaling.Value * (float)num;
bulletAttack.damageType |= DamageTypeCombo.op_Implicit((DamageType)268435456);
}
}
}