using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using EntityStates;
using EntityStates.Mage.Weapon;
using Modules;
using R2API;
using RoR2;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.Skills;
using SkillsPlusPlus;
using SkillsPlusPlus.Modifiers;
using UnityEngine;
using UnityEngine.Networking;
[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("FastArtiBolts")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+2723c92f96b90d9421155e099261d490a0c691b0")]
[assembly: AssemblyProduct("FastArtiBolts")]
[assembly: AssemblyTitle("FastArtiBolts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace FastArtiBolts
{
[BepInPlugin("com.TheTimeSweeper.FastArtiBolts", "Fast Artificer Bolts", "2.2.2")]
public class FastBoltsMod : BaseUnityPlugin
{
public delegate void BaseOnEnterEvent();
public static FastBoltsMod instance;
public const string MODUID = "com.TheTimeSweeper.FastArtiBolts";
public BaseOnEnterEvent baseOnEnterEvent;
private void Awake()
{
instance = this;
Utils.PopulateAssets();
Utils.InitConfig(((BaseUnityPlugin)this).Config);
if (Chainloader.PluginInfos.ContainsKey("com.cwmlolzlz.skills"))
{
SkillsPlusCompat.Init();
}
createFastBoltProjectile();
AddNewFireboltSkill();
new ContentPacks().Initialize();
}
private void createFastBoltProjectile()
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/MageFireboltBasic"), "FastFireBolt", true);
GameObject val2 = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/MageFireboltBasic").GetComponent<ProjectileController>().ghostPrefab, "FastFireBoltGhost", false);
val2.transform.localScale = new Vector3(0.72f, 0.72f, 1f);
val2.transform.Find("Spinner").localScale = Vector3.one * 0.87f;
TrailRenderer[] componentsInChildren = val2.GetComponentsInChildren<TrailRenderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
componentsInChildren[i].time = 0.14f;
}
val.GetComponent<ProjectileController>().ghostPrefab = val2;
ContentPacks.projectilePrefabs.Add(val);
FireFastBolt.fastProjectilePrefab = val;
}
public void AddNewFireboltSkill()
{
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
GameObject val = LegacyResourcesAPI.Load<GameObject>("prefabs/characterbodies/MageBody");
SkillLocator component = val.GetComponent<SkillLocator>();
SkillFamily skillFamily = component.primary.skillFamily;
SkillDef skillDef = skillFamily.variants[0].skillDef;
SteppedSkillDef val2 = spoofFireBoltSkillDef((SteppedSkillDef)(object)((skillDef is SteppedSkillDef) ? skillDef : null));
Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
Variant[] variants = skillFamily.variants;
int num = skillFamily.variants.Length - 1;
Variant val3 = new Variant
{
skillDef = (SkillDef)(object)val2,
unlockableDef = null
};
((Variant)(ref val3)).viewableNode = new Node(((SkillDef)val2).skillNameToken, false, (Node)null);
variants[num] = val3;
ContentPacks.skillDefs.Add((SkillDef)(object)val2);
ContentPacks.entityStates.Add(typeof(FireFastBolt));
}
private static SteppedSkillDef spoofFireBoltSkillDef(SteppedSkillDef firefireboltskill)
{
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
LanguageAPI.Add("ARTI_PRIMARY_FASTBOLTS_NAME", "Fast Flame Bolts");
string text = $"<style=cIsDamage>2x{2.2f * Utils.Cfg_DamageMulti * 100f}%</style>";
string text2 = "<style=cIsDamage>Flame Bolts</style>";
string text3 = "Fire smaller " + text2 + " for " + text + ". Fires <style=cIsUtility>more bolts</style> with <style=cIsUtility>attack speed</style>";
LanguageAPI.Add("ARTI_PRIMARY_FASTBOLTS_DESCRIPTION", text3);
SteppedSkillDef val = ScriptableObject.CreateInstance<SteppedSkillDef>();
((SkillDef)val).icon = Utils.FastBoltIcon;
((SkillDef)val).skillDescriptionToken = "ARTI_PRIMARY_FASTBOLTS_DESCRIPTION";
((Object)val).name = (((SkillDef)val).skillNameToken = (((SkillDef)val).skillName = "ARTI_PRIMARY_FASTBOLTS_NAME"));
((SkillDef)val).keywordTokens = new string[1] { "KEYWORD_IGNITE" };
((SkillDef)val).activationState = new SerializableEntityStateType(typeof(FireFastBolt));
((SkillDef)val).activationStateMachineName = "Weapon";
((SkillDef)val).beginSkillCooldownOnSkillEnd = false;
((SkillDef)val).resetCooldownTimerOnUse = false;
((SkillDef)val).dontAllowPastMaxStocks = false;
((SkillDef)val).fullRestockOnAssign = true;
((SkillDef)val).canceledFromSprinting = false;
((SkillDef)val).interruptPriority = (InterruptPriority)0;
((SkillDef)val).rechargeStock = 1;
((SkillDef)val).isCombatSkill = true;
((SkillDef)val).mustKeyPress = false;
((SkillDef)val).cancelSprintingOnActivation = true;
((SkillDef)val).baseMaxStock = 4;
((SkillDef)val).baseRechargeInterval = 1.3f;
((SkillDef)val).rechargeStock = 1;
((SkillDef)val).requiredStock = 1;
((SkillDef)val).stockToConsume = 1;
val.stepCount = 2;
return val;
}
}
public class FireFastBolt : FireFireBolt, IStepSetter
{
public static GameObject fastProjectilePrefab;
public static GameObject fastMuzzleFlash = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/MuzzleFlashes/MuzzleflashMageFire");
private float _fastBoltDuration;
private float _firingBoltsEndTime;
private float _firingBoltsTimer = 0f;
private float _pseudoFixedAge = 0f;
private int _boltsFired = 1;
private Transform _aimOrigin;
private Vector3 _origOrigin;
private float _originShift = 0.12f;
private float _originShiftMax = 0.4f;
private float _originShiftForward = 0.2f;
private Gauntlet _jauntlet;
private float _fastBoltDamageMulti => Utils.Cfg_DamageMulti;
private float _fastBoltProcMulti => Utils.Cfg_ProcMulti;
private float _fastBoltAttackSpeedMulti => Utils.Cfg_AttackSpeedMulti;
private float _firingBoltsDurationMulti => Utils.Cfg_DurationMulti;
private bool potato => Utils.Cfg_potato;
public void SetStep(int i)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
((FireFireBolt)this).SetStep(i);
_jauntlet = (Gauntlet)i;
}
public override void OnEnter()
{
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
base.projectilePrefab = fastProjectilePrefab;
base.muzzleflashEffectPrefab = fastMuzzleFlash;
base.damageCoefficient = 2.2f * _fastBoltDamageMulti;
base.procCoefficient = 1f * _fastBoltProcMulti;
base.force = 300f;
base.baseDuration = 0.25f;
base.attackSoundString = "Play_mage_m1_shoot";
base.attackSoundPitch = 1.3f;
_fastBoltDuration = base.baseDuration / (((EntityState)this).characterBody.attackSpeed * _fastBoltAttackSpeedMulti);
_firingBoltsEndTime = base.baseDuration * _firingBoltsDurationMulti;
_firingBoltsTimer = 0f;
_pseudoFixedAge = 0f;
_aimOrigin = ((EntityState)this).characterBody.aimOriginTransform;
_origOrigin = _aimOrigin.localPosition;
((FireFireBolt)this).OnEnter();
_boltsFired = 1;
base.duration = base.baseDuration;
}
public override void FixedUpdate()
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
((FireFireBolt)this).FixedUpdate();
_firingBoltsTimer += Time.fixedDeltaTime;
_pseudoFixedAge += Time.fixedDeltaTime;
if (!(_firingBoltsTimer > _fastBoltDuration) || !(_pseudoFixedAge < _firingBoltsEndTime))
{
return;
}
if (!potato)
{
Ray aimRay = ((BaseState)this).GetAimRay();
Vector3 val = -Vector3.Cross(((Ray)(ref aimRay)).direction, Vector3.up);
int num = 1;
while (_firingBoltsTimer > _fastBoltDuration)
{
_firingBoltsTimer -= _fastBoltDuration;
float num2 = doFuckinMathOffset(_boltsFired);
aimRay = ((BaseState)this).GetAimRay();
Vector3 direction = ((Ray)(ref aimRay)).direction;
Vector3 val2 = ((Vector3)(ref direction)).normalized * _originShiftForward * _fastBoltDuration * (float)num * 80f;
Transform aimOrigin = _aimOrigin;
aimOrigin.position += ((Vector3)(ref val)).normalized * num2 - val2;
PseudoFireGauntlet();
num++;
_aimOrigin.localPosition = _origOrigin;
}
}
else
{
int num3 = 0;
while (_firingBoltsTimer > _fastBoltDuration)
{
_firingBoltsTimer -= _fastBoltDuration;
num3++;
}
base.damageCoefficient *= (float)num3;
base.procCoefficient *= (float)num3;
PseudoFireGauntlet();
}
}
private float doFuckinMathOffset(int boltsFired)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Invalid comparison between Unknown and I4
int num = (((int)_jauntlet == 1) ? 1 : (-1));
float num2 = _originShift * (float)boltsFired * (float)num;
while (Mathf.Clamp(num2, 0f - _originShiftMax, _originShiftMax) != num2)
{
if (num2 >= _originShiftMax)
{
num2 = 2f * _originShiftMax - num2;
}
if (num2 <= 0f - _originShiftMax)
{
num2 = -2f * _originShiftMax - num2;
}
}
return num2 + 0.1f * (float)num;
}
private void PseudoFireGauntlet()
{
base.hasFiredGauntlet = false;
((FireFireBolt)this).FireGauntlet();
_boltsFired++;
}
public override void OnExit()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
((FireFireBolt)this).OnExit();
_aimOrigin.localPosition = _origOrigin;
}
public override void OnSerialize(NetworkWriter writer)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
((FireFireBolt)this).OnSerialize(writer);
writer.Write((byte)_jauntlet);
}
public override void OnDeserialize(NetworkReader reader)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
((FireFireBolt)this).OnDeserialize(reader);
_jauntlet = (Gauntlet)reader.ReadByte();
}
}
public class SkillsPlusCompat
{
[SkillLevelModifier("ARTI_PRIMARY_FASTBOLTS_NAME", new Type[] { typeof(FireFastBolt) })]
private class CommandoFirePistolSkillModifier : SimpleSkillModifier<FireFastBolt>
{
public override void OnSkillLeveledUp(int level, CharacterBody characterBody, SkillDef skillDef)
{
base.OnSkillLeveledUp(level, characterBody, skillDef);
skillDef.baseMaxStock = BaseSkillModifier.AdditiveScaling(4, 2, level);
skillDef.baseRechargeInterval = BaseSkillModifier.MultScaling(1.3f, -0.1f, level);
}
}
public static void Init()
{
SkillModifierManager.LoadSkillModifiers();
doLanguage();
}
private static void doLanguage()
{
LanguageAPI.Add("ARTI_PRIMARY_FASTBOLTS_NAME_UPGRADE_DESCRIPTION", "<style=cIsUtility>+2</style> stock and <style=cIsUtility>-10%</style> stock recharge time");
}
}
public static class Utils
{
public static AssetBundle MainAssetBundle = null;
public static Sprite FastBoltIcon = null;
public static float Cfg_DamageMulti = 0.4f;
public static float Cfg_ProcMulti = 0.6f;
public static float Cfg_AttackSpeedMulti = 3f;
public static float Cfg_DurationMulti = 0.51f;
public static bool Cfg_potato = false;
public static void PopulateAssets()
{
if ((Object)(object)MainAssetBundle == (Object)null)
{
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("FastArtiBolts.arti");
MainAssetBundle = AssetBundle.LoadFromStream(stream);
}
FastBoltIcon = MainAssetBundle.LoadAsset<Sprite>("texMageSkillIcon");
}
public static void InitConfig(ConfigFile Config)
{
string text = "Do your best, I believe in you";
Cfg_DamageMulti = Config.Bind<float>(text, "FastBoltsDamageMulti", 0.5f, "The damage of Fast Bolts is the damage of original Flame Bolts * this multiplier").Value;
Cfg_ProcMulti = Config.Bind<float>(text, "FastBoltsProcMulti", 0.5f, "The Proc Coefficient of Fast Bolts is the Proc Coefficient of original Flame Bolts * this multiplier").Value;
Cfg_AttackSpeedMulti = Config.Bind<float>(text, "FastBoltAttackSpeedMulti", 3f, "Multiplier of attack speed that decides how fast you shoot flame bolts (which decides how many bolts you shoot within the window of the move)").Value;
Cfg_DurationMulti = Config.Bind<float>(text, "FiringBoltsDurationMulti", 0.52f, "The duration of the skill during which extra bolts will fire").Value;
Cfg_potato = Config.Bind<bool>(text, "potato", false, "If true, when multiple bolts are spawned on the same frame, it will instead spawn one bolt with combined damage\nThis also combines proc coefficient, which will lead to proc coefficients higher than 1, and I don't know what hilarity will ensue").Value;
}
}
public class help : MonoBehaviour
{
private void OnDestroy()
{
Debug.LogWarning((object)("rip " + ((Object)((Component)this).gameObject).name));
}
private void OnDisable()
{
Debug.LogWarning((object)("uh disable " + ((Object)((Component)this).gameObject).name));
}
private void OnEnable()
{
Debug.LogWarning((object)("uh enable " + ((Object)((Component)this).gameObject).name));
}
}
}
namespace Modules
{
public class ContentPacks : IContentPackProvider
{
public ContentPack contentPack = new ContentPack();
public static List<GameObject> projectilePrefabs = new List<GameObject>();
public static List<SkillDef> skillDefs = new List<SkillDef>();
public static List<Type> entityStates = new List<Type>();
public string identifier => "com.TheTimeSweeper.FastArtiBolts";
public void Initialize()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
}
private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
{
addContentPackProvider.Invoke((IContentPackProvider)(object)this);
}
public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
{
contentPack.identifier = identifier;
contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray());
contentPack.skillDefs.Add(skillDefs.ToArray());
contentPack.entityStateTypes.Add(entityStates.ToArray());
args.ReportProgress(1f);
yield break;
}
public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
{
ContentPack.Copy(contentPack, args.output);
args.ReportProgress(1f);
yield break;
}
public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
{
args.ReportProgress(1f);
yield break;
}
}
}