using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using BanditsPrimaryRevolver.MyEntityStates;
using BepInEx;
using EntityStates;
using EntityStates.Bandit2.Weapon;
using R2API;
using RoR2;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: InternalsVisibleTo("R2API.Items")]
[assembly: InternalsVisibleTo("R2API.ContentManagement")]
[assembly: InternalsVisibleTo("R2API.ArtifactCode")]
[assembly: InternalsVisibleTo("R2API.Difficulty")]
[assembly: InternalsVisibleTo("R2API.Elites")]
[assembly: InternalsVisibleTo("R2API.RecalculateStats")]
[assembly: InternalsVisibleTo("R2API.Prefab")]
[assembly: InternalsVisibleTo("R2API.Language")]
[assembly: InternalsVisibleTo("R2API.Unlockable")]
[assembly: InternalsVisibleTo("R2API.TempVisualEffect")]
[assembly: InternalsVisibleTo("R2API.SceneAsset")]
[assembly: InternalsVisibleTo("R2API.Orb")]
[assembly: InternalsVisibleTo("R2API.Loadout")]
[assembly: InternalsVisibleTo("R2API.Dot")]
[assembly: InternalsVisibleTo("R2API.DamageType")]
[assembly: InternalsVisibleTo("R2API.Sound")]
[assembly: InternalsVisibleTo("R2API.Director")]
[assembly: InternalsVisibleTo("R2API.Deployable")]
[assembly: InternalsVisibleTo("R2API.LobbyConfig")]
[assembly: InternalsVisibleTo("R2API.Networking")]
[assembly: InternalsVisibleTo("R2API.CommandHelper")]
[assembly: InternalsVisibleTo("R2API.Colors")]
[assembly: InternalsVisibleTo("R2API.Rules")]
[assembly: InternalsVisibleTo("R2API.Skins")]
[assembly: InternalsVisibleTo("R2API.StringSerializerExtensions")]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("BanditsSmallRevolver")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("BanditsSmallRevolver")]
[assembly: AssemblyTitle("BanditsSmallRevolver")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace BanditsPrimaryRevolver
{
[BepInPlugin("Icarus", "Bandit's Small Revolver", "1.0.0")]
public class BanditsPrimaryRevolver : BaseUnityPlugin
{
public static class Assets
{
public static AssetBundle mainBundle;
public const string bundleName = "asseticon";
public static string AssetBundlePath
{
get
{
string directoryName = Path.GetDirectoryName(PInfo.Location);
return Path.Combine(directoryName, "asseticon");
}
}
public static void Init()
{
mainBundle = AssetBundle.LoadFromFile(AssetBundlePath);
}
}
public static PluginInfo PInfo { get; private set; }
public void Awake()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
PInfo = ((BaseUnityPlugin)this).Info;
Assets.Init();
Sprite icon = Assets.mainBundle.LoadAsset<Sprite>("SkillIcon");
GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2Body.prefab").WaitForCompletion();
LanguageAPI.Add("BANDIT2_PRIMARY_REVOLVER_NAME", "Small revolver");
LanguageAPI.Add("BANDIT2_PRIMARY_REVOLVER_DESCRIPTION", "Fire a precise shot for <style=cIsDamage>250% damage</style>. Each <style=cIsDamage>Bandit Skull</style> stack increases this skill's damage by <style=cIsDamage>2,5%</style>.");
SkillDef val2 = ScriptableObject.CreateInstance<SkillDef>();
val2.activationState = new SerializableEntityStateType(typeof(Revolver));
val2.activationStateMachineName = "Weapon";
val2.baseMaxStock = 1;
val2.baseRechargeInterval = 3f;
val2.beginSkillCooldownOnSkillEnd = false;
val2.canceledFromSprinting = false;
val2.cancelSprintingOnActivation = true;
val2.fullRestockOnAssign = true;
val2.interruptPriority = (InterruptPriority)2;
val2.isCombatSkill = true;
val2.mustKeyPress = true;
val2.rechargeStock = 1;
val2.requiredStock = 1;
val2.stockToConsume = 1;
val2.resetCooldownTimerOnUse = false;
val2.beginSkillCooldownOnSkillEnd = true;
val2.icon = icon;
val2.skillDescriptionToken = "BANDIT2_PRIMARY_REVOLVER_DESCRIPTION";
val2.skillName = "BANDIT2_PRIMARY_REVOLVER_NAME";
val2.skillNameToken = "BANDIT2_PRIMARY_REVOLVER_NAME";
ContentAddition.AddSkillDef(val2);
SkillLocator component = val.GetComponent<SkillLocator>();
SkillFamily skillFamily = component.secondary.skillFamily;
Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
Variant[] variants = skillFamily.variants;
int num = skillFamily.variants.Length - 1;
Variant val3 = default(Variant);
val3.skillDef = val2;
Variant val4 = val3;
variants[num] = val4;
}
}
}
namespace BanditsPrimaryRevolver.MyEntityStates
{
public class Revolver : BaseSkillState
{
public float baseDuration = 0.2f;
private float duration;
public float revolverDuration;
public GameObject crosshairOverridePrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/Bandit2CrosshairPrepRevolverFire.prefab").WaitForCompletion();
private Animator animator;
private OverrideRequest crosshairOverrideRequest;
private int bodySideWeaponLayerIndex;
public GameObject hitEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/HitsparkBandit2Pistol.prefab").WaitForCompletion();
public GameObject tracerEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/TracerBanditPistol.prefab").WaitForCompletion();
public GameObject effectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Bandit2/MuzzleflashBandit2.prefab").WaitForCompletion();
public virtual string exitAnimationStateName => "BufferEmpty";
public override void OnEnter()
{
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_023f: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_0269: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Expected O, but got Unknown
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_0291: Expected O, but got Unknown
((BaseState)this).OnEnter();
animator = ((EntityState)this).GetModelAnimator();
if ((Object)(object)animator != (Object)null)
{
bodySideWeaponLayerIndex = animator.GetLayerIndex("Body, SideWeapon");
animator.SetLayerWeight(bodySideWeaponLayerIndex, 0.3f);
}
if ((Object)(object)crosshairOverridePrefab != (Object)null)
{
crosshairOverrideRequest = CrosshairUtils.RequestOverrideForBody(((EntityState)this).characterBody, crosshairOverridePrefab, (OverridePriority)1);
}
((EntityState)this).characterBody.SetAimTimer(2f);
duration = baseDuration / ((BaseState)this).attackSpeedStat;
revolverDuration = duration;
Ray aimRay = ((BaseState)this).GetAimRay();
((BaseState)this).StartAimMode(aimRay, 2f, false);
((EntityState)this).PlayAnimation("Gesture, Additive", "FireSideWeapon", "FireSideWeapon.playbackRate", duration, 0f);
Util.PlaySound("Play_bandit2_R_fire", ((EntityState)this).gameObject);
((BaseState)this).AddRecoil(-0.3f, 0.3f, -0.3f, 0.3f);
if (Object.op_Implicit((Object)(object)effectPrefab))
{
EffectManager.SimpleMuzzleFlash(effectPrefab, ((EntityState)this).gameObject, "MuzzlePistol", false);
}
if (!((EntityState)this).isAuthority)
{
return;
}
float damage = ((EntityState)this).characterBody.damage;
int buffCount = ((EntityState)this).characterBody.GetBuffCount(Buffs.BanditSkull);
float num = 1f + (float)buffCount * 0.025f;
float damage2 = damage * 2.5f * num;
BulletAttack val = new BulletAttack
{
owner = ((EntityState)this).gameObject,
weapon = ((EntityState)this).gameObject,
origin = ((Ray)(ref aimRay)).origin,
aimVector = ((Ray)(ref aimRay)).direction,
minSpread = 0f,
maxSpread = ((EntityState)this).characterBody.spreadBloomAngle / 2f,
bulletCount = 1u,
procCoefficient = 1f,
damage = damage2,
force = 0f,
falloffModel = (FalloffModel)0,
tracerEffectPrefab = tracerEffectPrefab,
muzzleName = "MuzzlePistol",
hitEffectPrefab = hitEffectPrefab,
isCrit = ((BaseState)this).RollCrit(),
HitEffectNormal = false,
stopperMask = LayerMask.op_Implicit(LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask) | LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.enemyBody)).mask)),
smartCollision = true,
maxDistance = 300f
};
val.hitCallback = (HitCallback)delegate(BulletAttack _bullet, ref BulletHit hitInfo)
{
if ((Object)(object)hitInfo.hitHurtBox == (Object)null || (Object)(object)hitInfo.hitHurtBox.healthComponent == (Object)null)
{
return BulletAttack.defaultHitCallback.Invoke(_bullet, ref hitInfo);
}
HealthComponent healthComponent = hitInfo.hitHurtBox.healthComponent;
bool flag = BulletAttack.defaultHitCallback.Invoke(_bullet, ref hitInfo);
if (!healthComponent.alive && (Object)(object)((EntityState)this).characterBody != (Object)null)
{
((EntityState)this).characterBody.AddBuff(Buffs.BanditSkull);
}
return true;
};
val.Fire();
}
public override void OnExit()
{
((EntityState)this).OnExit();
if ((Object)(object)animator != (Object)null)
{
animator.SetLayerWeight(bodySideWeaponLayerIndex, 0f);
}
Transform val = ((BaseState)this).FindModelChild("SpinningPistolFX");
}
public override void FixedUpdate()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
((EntityState)this).FixedUpdate();
if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextState((EntityState)new ExitSidearmRevolver());
}
}
public override InterruptPriority GetMinimumInterruptPriority()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
return (InterruptPriority)1;
}
}
}