using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
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 BepInEx.Logging;
using DarthVaderMod.Content.Controllers;
using DarthVaderMod.Modules;
using DarthVaderMod.Modules.Characters;
using DarthVaderMod.Modules.Networking;
using DarthVaderMod.Modules.Survivors;
using DarthVaderMod.SkillStates;
using DarthVaderMod.SkillStates.BaseStates;
using EmotesAPI;
using EntityStates;
using HG;
using HG.BlendableTypes;
using On.RoR2;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.ContentManagement;
using RoR2.Skills;
using RoR2.Stats;
using RoR2.UI;
using TMPro;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;
[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("DarthVaderMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+52c7444c8c834c68b9f37a286819b5500909e664")]
[assembly: AssemblyProduct("DarthVaderMod")]
[assembly: AssemblyTitle("DarthVaderMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: UnverifiableCode]
namespace DarthVaderMod
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.PopcornFactory.DarthVaderMod", "DarthVaderMod", "2.2.3")]
public class DarthVaderPlugin : BaseUnityPlugin
{
public const string MODUID = "com.PopcornFactory.DarthVaderMod";
public const string MODNAME = "DarthVaderMod";
public const string MODVERSION = "2.2.3";
public const string DEVELOPER_PREFIX = "POPCORN";
public static DarthVaderPlugin instance;
public EnergySystem energySystem;
public DarthVaderPassive passiveSkillSlot;
private uint entranceID;
private uint entranceVoiceID;
public float currentattackspeed;
private void Awake()
{
instance = this;
Log.Init(((BaseUnityPlugin)this).Logger);
Assets.Initialize();
Config.ReadConfig();
if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
{
Config.SetupRiskOfOptions();
}
States.RegisterStates();
Buffs.RegisterBuffs();
Projectiles.RegisterProjectiles();
Tokens.AddTokens();
ItemDisplays.PopulateDisplays();
Unlockables.AddUnlockables();
new DarthVader().Initialize(isHidden: false);
new ContentPacks().Initialize();
Hook();
SetupNetworkMessages();
}
private void SetupNetworkMessages()
{
NetworkingAPI.RegisterMessageType<PerformForceNetworkRequest>();
NetworkingAPI.RegisterMessageType<EndRageBuffNetworkRequest>();
NetworkingAPI.RegisterMessageType<DeflectClientHandlerNetworkRequest>();
NetworkingAPI.RegisterMessageType<InflictDamageOnDarthNetworkRequest>();
NetworkingAPI.RegisterMessageType<InflictDamageOnEnemyFromDeflectNetworkRequest>();
}
private void Hook()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Expected O, but got Unknown
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Expected O, but got Unknown
CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(GlobalEventManager_OnHitEnemy);
CharacterBody.OnDeathStart += new hook_OnDeathStart(CharacterBody_OnDeathStart);
CharacterModel.Awake += new hook_Awake(CharacterModel_Awake);
if (Chainloader.PluginInfos.ContainsKey("com.weliveinasociety.CustomEmotesAPI"))
{
SurvivorCatalog.Init += new hook_Init(SurvivorCatalog_Init);
}
GlobalEventManager.onCharacterDeathGlobal += delegate(DamageReport damageReport)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Expected O, but got Unknown
if (damageReport != null && damageReport.victimBody.isPlayerControlled && Object.op_Implicit((Object)(object)damageReport.victimBody))
{
string bestMasterName = Util.GetBestMasterName(damageReport.victimMaster);
if (damageReport.victimBody.baseNameToken == "POPCORN_DARTHVADER_BODY_NAME")
{
Chat.SendBroadcastChat((ChatMessageBase)new SimpleChatMessage
{
baseToken = "There was too much Sand."
});
}
}
};
}
private void SurvivorCatalog_Init(orig_Init orig)
{
orig.Invoke();
foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs)
{
if (((Object)allSurvivorDef.bodyPrefab).name == "DarthVaderBody")
{
CustomEmotesAPI.ImportArmature(allSurvivorDef.bodyPrefab, Assets.mainAssetBundle.LoadAsset<GameObject>("EmoteDarthVader"), 0, true);
}
}
}
private void CharacterModel_Awake(orig_Awake orig, CharacterModel self)
{
orig.Invoke(self);
if (((Object)((Component)self).gameObject).name.Contains("DarthVaderDisplay"))
{
entranceVoiceID = AkSoundEngine.PostEvent("DarthVoice", ((Component)self).gameObject);
if (Config.enableMusic.Value)
{
entranceID = AkSoundEngine.PostEvent("DarthIntroTheme", ((Component)self).gameObject);
}
}
else
{
AkSoundEngine.StopPlayingID(entranceVoiceID);
AkSoundEngine.StopPlayingID(entranceID);
}
}
private void CharacterBody_OnDeathStart(orig_OnDeathStart orig, CharacterBody self)
{
orig.Invoke(self);
if (self.baseNameToken == "POPCORN_DARTHVADER_BODY_NAME")
{
AkSoundEngine.PostEvent("DarthDeath", ((Component)self).gameObject);
}
}
private void GlobalEventManager_OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
{
orig.Invoke(self, damageInfo, victim);
if ((Object)(object)damageInfo.attacker != (Object)null && damageInfo != null && ((Object)damageInfo.attacker).name.Contains("DarthVaderBody"))
{
DarthVaderController component = damageInfo.attacker.GetComponent<DarthVaderController>();
if (Object.op_Implicit((Object)(object)component))
{
component.SetMaxDamage(damageInfo.damage);
}
}
}
private void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
{
if (!Object.op_Implicit((Object)(object)self.healthComponent))
{
return;
}
orig.Invoke(self);
if (!Object.op_Implicit((Object)(object)self) || !(self.baseNameToken == "POPCORN_DARTHVADER_BODY_NAME"))
{
return;
}
EnergySystem component = ((Component)self).GetComponent<EnergySystem>();
if (self.HasBuff(Buffs.DeflectBuff))
{
self.moveSpeed *= 0.5f;
}
float moveSpeed = self.moveSpeed;
if (Config.armorBonusPassiveActive.Value && moveSpeed > 7f)
{
float num = moveSpeed - 7f;
self.armor += num;
}
if (!self.HasBuff(Buffs.RageBuff))
{
if (Config.speedCapBaseActive.Value && Config.maxSpeedNormal.Value != 0f)
{
self.moveSpeed = Mathf.Min(new float[2]
{
moveSpeed,
Config.maxSpeedNormal.Value
});
}
float attackSpeed = self.attackSpeed;
if (Object.op_Implicit((Object)(object)component))
{
component.meleeForceEnergyGain = attackSpeed;
}
if (attackSpeed > 1f)
{
self.attackSpeed = 1f;
float num2 = attackSpeed / 1f;
self.damage *= num2;
}
}
else if (self.HasBuff(Buffs.RageBuff))
{
self.moveSpeed *= 2f;
self.armor *= 2f;
self.attackSpeed *= 2f;
self.damage *= self.attackSpeed;
if (Config.speedCapRageActive.Value && Config.maxSpeedRage.Value != 0f)
{
self.moveSpeed = Mathf.Min(new float[2]
{
moveSpeed,
Config.maxSpeedRage.Value
});
}
}
}
}
internal static class Log
{
internal 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);
}
}
}
namespace DarthVaderMod.SkillStates
{
public class Deflect : BaseSkillState
{
public DarthVaderController DarthVadercon;
public DarthVaderPassive passiveSkillSlot;
public EnergySystem energySystem;
public bool isEnergy;
public override void OnEnter()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Expected O, but got Unknown
((BaseState)this).OnEnter();
DarthVadercon = ((Component)((EntityState)this).characterBody).gameObject.GetComponent<DarthVaderController>();
energySystem = ((Component)((EntityState)this).characterBody).gameObject.GetComponent<EnergySystem>();
passiveSkillSlot = ((EntityState)this).gameObject.GetComponent<DarthVaderPassive>();
NetworkingHelpers.ApplyBuff(((EntityState)this).characterBody, Buffs.DeflectBuff.buffIndex, 1, -1f);
if (passiveSkillSlot.isEnergyPassive())
{
isEnergy = true;
if (Object.op_Implicit((Object)(object)energySystem))
{
energySystem.ifEnergyRegenAllowed = false;
}
((EntityState)this).characterBody.skillLocator.utility.AddOneStock();
((EntityState)this).PlayAnimation("RightArm, Override", "Deflect", "Attack.playbackRate", 10000f, 0f);
}
else
{
isEnergy = false;
((EntityState)this).PlayAnimation("RightArm, Override", "Deflect", "Attack.playbackRate", 6f, 0f);
}
HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
}
public override void Update()
{
((EntityState)this).Update();
((EntityState)this).PlayCrossfade("RightArm, Override", "Deflect", "Attack.playbackRate", 1f, 0.01f);
if (!((EntityState)this).isAuthority)
{
return;
}
if (isEnergy)
{
if (!((BaseSkillState)this).IsKeyDownAuthority() && !((BaseSkillState)this).IsKeyDownAuthority())
{
((EntityState)this).outer.SetNextStateToMain();
}
}
else if (((EntityState)this).fixedAge > 6f && ((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
}
public override void OnExit()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Expected O, but got Unknown
((EntityState)this).OnExit();
if (Object.op_Implicit((Object)(object)energySystem))
{
energySystem.ifEnergyRegenAllowed = true;
}
((EntityState)this).characterBody.SetBuffCount(Buffs.DeflectBuff.buffIndex, 0);
HealthComponent.TakeDamage -= new hook_TakeDamage(HealthComponent_TakeDamage);
}
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)3;
}
private void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Invalid comparison between Unknown and I4
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Expected O, but got Unknown
//IL_00ba: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: 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)
//IL_017b: 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_0185: 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_018f: Invalid comparison between Unknown and I4
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Invalid comparison between Unknown and I4
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
//IL_02da: Unknown result type (might be due to invalid IL or missing references)
//IL_02e5: Expected O, but got Unknown
//IL_0303: Unknown result type (might be due to invalid IL or missing references)
//IL_0308: Unknown result type (might be due to invalid IL or missing references)
//IL_0309: Unknown result type (might be due to invalid IL or missing references)
//IL_0311: Unknown result type (might be due to invalid IL or missing references)
//IL_031c: Unknown result type (might be due to invalid IL or missing references)
//IL_031d: Unknown result type (might be due to invalid IL or missing references)
//IL_031f: Unknown result type (might be due to invalid IL or missing references)
//IL_0324: Unknown result type (might be due to invalid IL or missing references)
//IL_032f: Expected O, but got Unknown
if (Object.op_Implicit((Object)(object)self) && damageInfo != null && Object.op_Implicit((Object)(object)damageInfo.attacker) && (int)DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)2)) <= 0 && damageInfo.damage > 0f && self.body.HasBuff(Buffs.DeflectBuff.buffIndex))
{
DamageInfo val = new DamageInfo();
val.damage = damageInfo.damage * 2f * (1f + self.body.master.luck);
val.position = damageInfo.attacker.transform.position;
val.force = Vector3.zero;
val.damageColorIndex = (DamageColorIndex)0;
val.crit = Util.CheckRoll(self.body.crit, self.body.master);
val.attacker = ((Component)self).gameObject;
val.inflictor = null;
val.damageType = DamageTypeCombo.op_Implicit((DamageType)0);
val.procCoefficient = 1f;
val.procChainMask = default(ProcChainMask);
passiveSkillSlot = ((Component)self).gameObject.GetComponent<DarthVaderPassive>();
energySystem = ((Component)self.body).gameObject.GetComponent<EnergySystem>();
Vector3 position = damageInfo.attacker.transform.position;
Vector3 val2 = position - self.body.transform.position;
bool flag = (int)damageInfo.damageColorIndex != 11 && (int)DamageTypeCombo.op_Implicit(damageInfo.damageType) != 131088;
if (flag)
{
damageInfo.rejected = true;
}
if (passiveSkillSlot.isEnergyPassive() && flag)
{
NetMessageExtensions.Send((INetMessage)(object)new DeflectClientHandlerNetworkRequest(damageInfo.attacker.gameObject.GetComponent<CharacterBody>().masterObjectId, self.body.masterObjectId, damageInfo.damage), (NetworkDestination)1);
}
else if (!passiveSkillSlot.isEnergyPassive())
{
AkSoundEngine.PostEvent("DarthDeflect", ((Component)self.body).gameObject);
damageInfo.rejected = true;
if (damageInfo.attacker.gameObject.GetComponent<CharacterBody>().baseNameToken != "POPCORN_DARTHVADER_BODY_NAME" && (Object)(object)damageInfo.attacker != (Object)null)
{
damageInfo.attacker.GetComponent<CharacterBody>().healthComponent.TakeDamage(val);
}
if (((Vector3)(ref val2)).magnitude >= 3f)
{
EffectManager.SpawnEffect(Assets.blasterShotEffect, new EffectData
{
origin = self.body.transform.position,
scale = 1f,
rotation = Quaternion.LookRotation(val2)
}, true);
}
else if (((Vector3)(ref val2)).magnitude < 3f)
{
EffectManager.SpawnEffect(Assets.swordHitImpactEffect, new EffectData
{
origin = position,
scale = 1f,
rotation = Quaternion.LookRotation(val2)
}, true);
}
}
}
orig.Invoke(self, damageInfo);
}
}
public class Force : BaseSkillState
{
public DarthVaderController DarthVadercon;
public EnergySystem energySystem;
public DarthVaderPassive passiveSkillSlot;
public HurtBox Target;
public float maxTrackingDistance = 100f;
public float maxTrackingAngle = 30f;
public float pullRange;
public float pushRange;
private ChildLocator child;
public GameObject blastEffectPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/effects/SonicBoomEffect");
public float chargeTime = 0.25f;
public float castTime = 0.25f;
public float duration;
public bool hasFired;
public bool isPull;
public override void OnEnter()
{
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
((BaseState)this).OnEnter();
isPull = false;
if (!((BaseState)this).HasBuff(Buffs.RageBuff))
{
pushRange = 150f;
pullRange = 0f;
}
else if (((BaseState)this).HasBuff(Buffs.RageBuff))
{
pushRange = 50f;
pullRange = 0f;
}
hasFired = false;
duration = chargeTime + castTime;
((BaseState)this).StartAimMode(0.5f + duration, false);
DarthVadercon = ((Component)((EntityState)this).characterBody).gameObject.GetComponent<DarthVaderController>();
passiveSkillSlot = ((EntityState)this).gameObject.GetComponent<DarthVaderPassive>();
energySystem = ((Component)((EntityState)this).characterBody).gameObject.GetComponent<EnergySystem>();
if (passiveSkillSlot.isEnergyPassive())
{
if (!Object.op_Implicit((Object)(object)energySystem))
{
return;
}
if (energySystem.currentForceEnergy > StaticValues.forcePushPullCost)
{
((EntityState)this).characterBody.skillLocator.secondary.AddOneStock();
AkSoundEngine.PostEvent("DarthForcePush", ((EntityState)this).gameObject);
((EntityState)this).PlayCrossfade("LeftArm, Override", "ForceStart", "Attack.playbackRate", chargeTime, 0.05f);
energySystem.SpendEnergy(StaticValues.forcePushPullCost);
energySystem.TriggerGlow(0.1f, 0.3f, Color.black);
}
else
{
((EntityState)this).characterBody.skillLocator.secondary.AddOneStock();
energySystem.TriggerGlow(0.1f, 0.3f, Color.blue);
if (((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
}
else
{
AkSoundEngine.PostEvent("DarthForcePush", ((EntityState)this).gameObject);
((EntityState)this).PlayCrossfade("LeftArm, Override", "ForceStart", "Attack.playbackRate", chargeTime, 0.05f);
}
}
public override void OnExit()
{
((EntityState)this).OnExit();
}
public override void FixedUpdate()
{
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: 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_0159: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: 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_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).FixedUpdate();
if (!(((EntityState)this).fixedAge > chargeTime) || !((EntityState)this).isAuthority)
{
return;
}
if (((EntityState)this).inputBank.skill2.down && !hasFired)
{
isPull = true;
hasFired = true;
((EntityState)this).PlayCrossfade("LeftArm, Override", "ForcePull", "Attack.playbackRate", castTime, 0.05f);
}
else if (!hasFired)
{
isPull = false;
hasFired = true;
((EntityState)this).PlayCrossfade("LeftArm, Override", "ForcePush", "Attack.playbackRate", castTime, 0.05f);
}
if (((EntityState)this).fixedAge > duration && ((EntityState)this).isAuthority)
{
Ray aimRay;
if (isPull)
{
NetworkInstanceId masterObjectId = ((EntityState)this).characterBody.masterObjectId;
aimRay = ((BaseState)this).GetAimRay();
Vector3 origin = ((Ray)(ref aimRay)).origin;
aimRay = ((BaseState)this).GetAimRay();
Vector3 origin2 = origin - ((Ray)(ref aimRay)).direction;
aimRay = ((BaseState)this).GetAimRay();
NetMessageExtensions.Send((INetMessage)(object)new PerformForceNetworkRequest(masterObjectId, origin2, ((Ray)(ref aimRay)).direction, pullRange), (NetworkDestination)1);
}
else
{
NetworkInstanceId masterObjectId2 = ((EntityState)this).characterBody.masterObjectId;
aimRay = ((BaseState)this).GetAimRay();
Vector3 origin3 = ((Ray)(ref aimRay)).origin;
aimRay = ((BaseState)this).GetAimRay();
Vector3 origin4 = origin3 - ((Ray)(ref aimRay)).direction;
aimRay = ((BaseState)this).GetAimRay();
NetMessageExtensions.Send((INetMessage)(object)new PerformForceNetworkRequest(masterObjectId2, origin4, ((Ray)(ref aimRay)).direction, pushRange), (NetworkDestination)1);
}
((EntityState)this).outer.SetNextStateToMain();
}
}
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)2;
}
}
public class RageMode : BaseSkillState
{
public float timer;
public EnergySystem energySystem;
public DarthVaderController DarthVadercon;
public DarthVaderPassive passiveSkillSlot;
private GameObject blasteffectPrefab = Resources.Load<GameObject>("prefabs/effects/ImpBossBlink");
public GameObject effectPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/effects/SonicBoomEffect");
public bool isEnergy;
public override void OnEnter()
{
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_0287: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Unknown result type (might be due to invalid IL or missing references)
//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0304: Unknown result type (might be due to invalid IL or missing references)
//IL_030f: Unknown result type (might be due to invalid IL or missing references)
//IL_0320: Expected O, but got Unknown
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Expected O, but got Unknown
((BaseState)this).OnEnter();
DarthVadercon = ((Component)((EntityState)this).characterBody).gameObject.GetComponent<DarthVaderController>();
passiveSkillSlot = ((EntityState)this).gameObject.GetComponent<DarthVaderPassive>();
energySystem = ((Component)((EntityState)this).characterBody).gameObject.GetComponent<EnergySystem>();
if (passiveSkillSlot.isEnergyPassive())
{
if (!Object.op_Implicit((Object)(object)energySystem) || !Object.op_Implicit((Object)(object)DarthVadercon))
{
return;
}
isEnergy = true;
if (energySystem.currentForceEnergy > energySystem.maxForceEnergy * 0.98f)
{
((EntityState)this).characterBody.skillLocator.special.AddOneStock();
energySystem.TriggerGlow(0.1f, 0.3f, Color.black);
if (!((EntityState)this).characterBody.HasBuff(Buffs.RageBuff))
{
NetworkingHelpers.ApplyBuff(((EntityState)this).characterBody, Buffs.RageBuff.buffIndex, 1, -1f);
((EntityState)this).characterBody.healthComponent.Heal(((EntityState)this).characterBody.healthComponent.fullCombinedHealth, default(ProcChainMask), true);
RageEffectController component = ((Component)((EntityState)this).characterBody).gameObject.GetComponent<RageEffectController>();
if (!Object.op_Implicit((Object)(object)component))
{
component = ((Component)((EntityState)this).characterBody).gameObject.AddComponent<RageEffectController>();
component.charbody = ((EntityState)this).characterBody;
}
if (((EntityState)this).isAuthority)
{
DarthVadercon.PlayRageLoop();
}
EffectManager.SpawnEffect(blasteffectPrefab, new EffectData
{
origin = ((EntityState)this).characterBody.footPosition,
scale = 1f
}, true);
}
}
else
{
((EntityState)this).characterBody.skillLocator.special.AddOneStock();
energySystem.TriggerGlow(0.1f, 0.3f, Color.blue);
if (((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
return;
}
isEnergy = false;
if (!((EntityState)this).characterBody.HasBuff(Buffs.RageBuff))
{
((EntityState)this).characterBody.AddTimedBuffAuthority(Buffs.RageBuff.buffIndex, 15f);
((EntityState)this).characterBody.healthComponent.Heal(((EntityState)this).characterBody.healthComponent.fullCombinedHealth, default(ProcChainMask), true);
RageEffectController component2 = ((Component)((EntityState)this).characterBody).gameObject.GetComponent<RageEffectController>();
if (!Object.op_Implicit((Object)(object)component2))
{
component2 = ((Component)((EntityState)this).characterBody).gameObject.AddComponent<RageEffectController>();
component2.charbody = ((EntityState)this).characterBody;
}
if (((EntityState)this).isAuthority)
{
AkSoundEngine.PostEvent("DarthRage", ((EntityState)this).gameObject);
}
EffectManager.SpawnEffect(blasteffectPrefab, new EffectData
{
origin = ((EntityState)this).characterBody.footPosition,
scale = 1f
}, true);
}
else
{
((EntityState)this).characterBody.skillLocator.special.AddOneStock();
}
}
public override void FixedUpdate()
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: 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_00ff: 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_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Expected O, but got Unknown
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).FixedUpdate();
if (timer > 0.1f)
{
if (isEnergy && Object.op_Implicit((Object)(object)energySystem))
{
energySystem.TriggerGlow(0.05f, 0.05f, new Color(Random.Range(0f, 1f), Random.Range(0f, 1f), Random.Range(0f, 1f), 1f));
}
float num = 10f;
Quaternion rotation = Util.QuaternionSafeLookRotation(Vector3.up);
float num2 = 0.01f;
rotation.x += Random.Range(0f - num2, num2) * num;
rotation.y += Random.Range(0f - num2, num2) * num;
timer = 0f;
EffectManager.SpawnEffect(effectPrefab, new EffectData
{
origin = ((EntityState)this).characterBody.corePosition,
scale = 1f,
rotation = rotation
}, true);
}
else
{
timer += Time.fixedDeltaTime;
}
if (((EntityState)this).fixedAge > 0.5f && ((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void OnExit()
{
((EntityState)this).OnExit();
}
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)2;
}
}
public class RageEffectController : MonoBehaviour
{
public CharacterBody charbody;
private GameObject effectObj;
public float timer;
public void Start()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
charbody = ((Component)this).gameObject.GetComponent<CharacterBody>();
effectObj = Object.Instantiate<GameObject>(Assets.rageAuraEffect, charbody.footPosition, Quaternion.LookRotation(Vector3.up));
effectObj.transform.parent = ((Component)charbody).gameObject.transform;
}
public void FixedUpdate()
{
timer += Time.fixedDeltaTime;
if (timer > 2f)
{
Object.Destroy((Object)(object)effectObj);
Object.Destroy((Object)(object)this);
}
if (!Object.op_Implicit((Object)(object)charbody))
{
Object.Destroy((Object)(object)effectObj);
}
}
public void OnDestroy()
{
Object.Destroy((Object)(object)effectObj);
}
}
public class SlashCombo : BaseMeleeAttack
{
public DarthVaderController DarthVadercon;
public EnergySystem energySystem;
public DarthVaderPassive passiveSkillSlot;
public HurtBox Target;
public override void OnEnter()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
hitboxName = "Sword";
damageType = (DamageType)0;
damageCoefficient = Config.primaryCoefficient.Value;
procCoefficient = 1f;
pushForce = 300f;
bonusForce = new Vector3(0f, -300f, 0f);
baseDuration = 1f;
attackStartTime = 0.2f;
attackEndTime = 0.4f;
baseEarlyExitTime = 0.4f;
hitStopDuration = 0.2f;
attackRecoil = 0.5f;
hitHopVelocity = 10f;
swingSoundString = "DarthLightSaberSwing";
hitSoundString = "";
muzzleString = ChooseAnimationString();
swingEffectPrefab = Assets.swordSwingEffect;
hitEffectPrefab = Assets.swordHitImpactEffect;
impactSound = Assets.swordHitSoundEvent.index;
base.OnEnter();
DarthVadercon = ((EntityState)this).gameObject.GetComponent<DarthVaderController>();
passiveSkillSlot = ((EntityState)this).gameObject.GetComponent<DarthVaderPassive>();
energySystem = ((EntityState)this).gameObject.GetComponent<EnergySystem>();
}
private string ChooseAnimationString()
{
string result = "SwingLeft";
switch (swingIndex)
{
case 0:
result = "SwingLeft";
break;
case 1:
result = "SwingRight";
break;
case 2:
result = "SwingCenter";
break;
case 3:
result = "SwingRight";
break;
}
return result;
}
protected override void PlayAttackAnimation()
{
base.PlayAttackAnimation();
}
protected override void PlaySwingEffect()
{
base.PlaySwingEffect();
}
protected override void OnHitEnemyAuthority()
{
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
base.OnHitEnemyAuthority();
if (passiveSkillSlot.isEnergyPassive())
{
if (Object.op_Implicit((Object)(object)DarthVadercon))
{
if (Object.op_Implicit((Object)(object)energySystem))
{
energySystem.MeleeEnergyGain(StaticValues.meleeOnHitForceEnergyGain);
}
if (Object.op_Implicit((Object)(object)energySystem))
{
energySystem.TriggerGlow(0.1f, 0.3f, Color.white);
}
}
}
else if (!((BaseState)this).HasBuff(Buffs.RageBuff))
{
((EntityState)this).skillLocator.DeductCooldownFromAllSkillsServer(1f);
}
}
protected override void SetNextState()
{
int num = swingIndex;
num++;
if (num > 3)
{
num = 0;
}
((EntityState)this).outer.SetNextState((EntityState)(object)new SlashCombo
{
swingIndex = num
});
}
public override void OnExit()
{
base.OnExit();
}
}
}
namespace DarthVaderMod.SkillStates.BaseStates
{
public class BaseMeleeAttack : BaseSkillState
{
public int swingIndex;
protected string hitboxName = "Sword";
protected DamageType damageType = (DamageType)0;
protected float damageCoefficient = 3.5f;
protected float procCoefficient = 1f;
protected float pushForce = 300f;
protected Vector3 bonusForce = Vector3.zero;
protected float baseDuration = 1f;
protected float attackStartTime = 0.2f;
protected float attackEndTime = 0.4f;
protected float baseEarlyExitTime = 0.4f;
protected float hitStopDuration = 0.012f;
protected float attackRecoil = 0.75f;
protected float hitHopVelocity = 4f;
protected bool cancelled = false;
protected string swingSoundString = "";
protected string hitSoundString = "";
protected string muzzleString = "SwingCenter";
protected GameObject swingEffectPrefab;
protected GameObject hitEffectPrefab;
protected NetworkSoundEventIndex impactSound;
private float earlyExitTime;
public float duration;
private bool hasFired;
private float hitPauseTimer;
private OverlapAttack attack;
protected bool inHitPause;
private bool hasHopped;
protected float stopwatch;
protected Animator animator;
private HitStopCachedState hitStopCachedState;
private Vector3 storedVelocity;
public override void OnEnter()
{
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Expected O, but got Unknown
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
((BaseState)this).OnEnter();
duration = baseDuration / ((BaseState)this).attackSpeedStat;
earlyExitTime = baseEarlyExitTime / ((BaseState)this).attackSpeedStat;
hasFired = false;
animator = ((EntityState)this).GetModelAnimator();
((BaseState)this).StartAimMode(0.5f + duration, false);
((EntityState)this).characterBody.outOfCombatStopwatch = 0f;
animator.SetBool("attacking", true);
animator.SetFloat("Slash.playbackRate", ((BaseState)this).attackSpeedStat);
HitBoxGroup hitBoxGroup = null;
Transform modelTransform = ((EntityState)this).GetModelTransform();
if (Object.op_Implicit((Object)(object)modelTransform))
{
hitBoxGroup = Array.Find(((Component)modelTransform).GetComponents<HitBoxGroup>(), (HitBoxGroup element) => element.groupName == hitboxName);
}
PlayAttackAnimation();
attack = new OverlapAttack();
attack.damageType = DamageTypeCombo.op_Implicit(damageType);
attack.attacker = ((EntityState)this).gameObject;
attack.inflictor = ((EntityState)this).gameObject;
attack.teamIndex = ((BaseState)this).GetTeam();
attack.damage = damageCoefficient * ((BaseState)this).damageStat;
attack.procCoefficient = procCoefficient;
attack.hitEffectPrefab = hitEffectPrefab;
attack.forceVector = bonusForce;
attack.pushAwayForce = pushForce;
attack.hitBoxGroup = hitBoxGroup;
attack.isCrit = ((BaseState)this).RollCrit();
attack.impactSound = impactSound;
}
protected virtual void PlayAttackAnimation()
{
((EntityState)this).PlayCrossfade("RightArm, Override", "Slash" + (1 + swingIndex), "Slash.playbackRate", duration / 2f, 0.01f);
}
public override void OnExit()
{
if (!hasFired && !cancelled)
{
FireAttack();
}
((EntityState)this).OnExit();
animator.SetBool("attacking", false);
}
protected virtual void PlaySwingEffect()
{
EffectManager.SimpleMuzzleFlash(swingEffectPrefab, ((EntityState)this).gameObject, muzzleString, true);
}
protected virtual void OnHitEnemyAuthority()
{
//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_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)
Util.PlaySound(hitSoundString, ((EntityState)this).gameObject);
if (!hasHopped)
{
if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded && hitHopVelocity > 0f)
{
((BaseState)this).SmallHop(((EntityState)this).characterMotor, hitHopVelocity);
}
hasHopped = true;
}
if (!inHitPause && hitStopDuration > 0f)
{
storedVelocity = ((EntityState)this).characterMotor.velocity;
hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, "Slash.playbackRate");
hitPauseTimer = hitStopDuration / ((BaseState)this).attackSpeedStat;
inHitPause = true;
}
}
private void FireAttack()
{
if (!hasFired)
{
hasFired = true;
Util.PlayAttackSpeedSound(swingSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat);
if (((EntityState)this).isAuthority)
{
PlaySwingEffect();
((BaseState)this).AddRecoil(-1f * attackRecoil, -2f * attackRecoil, -0.5f * attackRecoil, 0.5f * attackRecoil);
}
}
if (((EntityState)this).isAuthority && attack.Fire((List<HurtBox>)null))
{
OnHitEnemyAuthority();
}
}
protected virtual void SetNextState()
{
int num = ((swingIndex == 0) ? 1 : 0);
((EntityState)this).outer.SetNextState((EntityState)(object)new BaseMeleeAttack
{
swingIndex = num
});
}
public override void FixedUpdate()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).FixedUpdate();
hitPauseTimer -= Time.fixedDeltaTime;
if (hitPauseTimer <= 0f && inHitPause)
{
((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator);
inHitPause = false;
((EntityState)this).characterMotor.velocity = storedVelocity;
}
if (!inHitPause)
{
stopwatch += Time.fixedDeltaTime;
}
else
{
if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
{
((EntityState)this).characterMotor.velocity = Vector3.zero;
}
if (Object.op_Implicit((Object)(object)animator))
{
animator.SetFloat("Swing.playbackRate", 0f);
}
if (Object.op_Implicit((Object)(object)animator))
{
animator.SetFloat("Slash.playbackRate", 0f);
}
}
if (stopwatch >= duration * attackStartTime && stopwatch <= duration * attackEndTime)
{
FireAttack();
}
if (stopwatch >= duration - earlyExitTime && ((EntityState)this).isAuthority && ((EntityState)this).inputBank.skill1.down)
{
if (!hasFired)
{
FireAttack();
}
SetNextState();
}
else if (stopwatch >= duration && ((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
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;
}
public override void OnSerialize(NetworkWriter writer)
{
((BaseSkillState)this).OnSerialize(writer);
writer.Write(swingIndex);
}
public override void OnDeserialize(NetworkReader reader)
{
((BaseSkillState)this).OnDeserialize(reader);
swingIndex = reader.ReadInt32();
}
}
public class BaseTimedSkillState : BaseSkillState
{
public static float TimedBaseDuration;
public static float TimedBaseCastStartTime;
public static float TimedBaseCastEndTime;
protected float duration;
protected float castStartTime;
protected float castEndTime;
protected bool hasFired;
protected bool isFiring;
protected bool hasExited;
protected virtual void InitDurationValues(float baseDuration, float baseCastStartTime, float baseCastEndTime = 1f)
{
TimedBaseDuration = baseDuration;
TimedBaseCastStartTime = baseCastStartTime;
TimedBaseCastEndTime = baseCastEndTime;
duration = TimedBaseDuration / ((BaseState)this).attackSpeedStat;
castStartTime = baseCastStartTime * duration;
castEndTime = baseCastEndTime * duration;
}
protected virtual void OnCastEnter()
{
}
protected virtual void OnCastFixedUpdate()
{
}
protected virtual void OnCastUpdate()
{
}
protected virtual void OnCastExit()
{
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
if (!hasFired && ((EntityState)this).fixedAge > castStartTime)
{
hasFired = true;
OnCastEnter();
}
bool flag = ((EntityState)this).fixedAge >= castStartTime;
bool flag2 = ((EntityState)this).fixedAge >= castEndTime;
isFiring = false;
if ((flag && !flag2) || (flag && flag2 && !hasFired))
{
isFiring = true;
OnCastFixedUpdate();
}
if (flag2 && !hasExited)
{
hasExited = true;
OnCastExit();
}
if (((EntityState)this).fixedAge > duration)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void Update()
{
((EntityState)this).Update();
if (isFiring)
{
OnCastUpdate();
}
}
}
public class ExampleTimedSkillState : BaseTimedSkillState
{
public static float SkillBaseDuration = 1.5f;
public static float SkillStartTime = 0.2f;
public static float SkillEndTime = 0.9f;
public override void OnEnter()
{
((BaseState)this).OnEnter();
InitDurationValues(SkillBaseDuration, SkillStartTime, SkillEndTime);
}
protected override void OnCastEnter()
{
}
protected override void OnCastFixedUpdate()
{
}
protected override void OnCastExit()
{
}
}
public class ExampleDelayedSkillState : BaseTimedSkillState
{
public static float SkillBaseDuration = 1.5f;
public static float SkillStartTime = 0.2f;
public override void OnEnter()
{
((BaseState)this).OnEnter();
InitDurationValues(SkillBaseDuration, SkillStartTime);
}
protected override void OnCastEnter()
{
}
}
public class SpawnState : BaseSkillState
{
public override void OnEnter()
{
((BaseState)this).OnEnter();
}
public override void OnExit()
{
((EntityState)this).OnExit();
}
public override void FixedUpdate()
{
((EntityState)this).FixedUpdate();
if (((EntityState)this).fixedAge > 0f && ((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
}
}
namespace DarthVaderMod.Content.Controllers
{
public class DarthVaderPassive : MonoBehaviour
{
public SkillDef normalCooldownPassive;
public SkillDef energyPassive;
public GenericSkill passiveSkillSlot;
public bool isEnergyPassive()
{
if (Object.op_Implicit((Object)(object)energyPassive) && Object.op_Implicit((Object)(object)passiveSkillSlot))
{
return (Object)(object)passiveSkillSlot.skillDef == (Object)(object)energyPassive;
}
return false;
}
}
public class EnergySystem : MonoBehaviour
{
private enum GlowState
{
STOP,
FLASH,
DECAY
}
public CharacterBody characterBody;
public GameObject CustomUIObject;
public RectTransform forceMeter;
public RectTransform forceMeterGlowRect;
public Image forceMeterGlowBackground;
public HGTextMeshProUGUI forceNumber;
public float maxForceEnergy;
public float currentForceEnergy;
public float regenForceEnergy;
public float drainForceEnergy;
public float costmultiplierForceEnergy;
public float costflatForceEnergy;
public float meleeForceEnergyGain;
public DarthVaderPassive passiveSkillSlot;
public bool ifEnergyRegenAllowed;
public float rageTimer;
public float increasingRageTimer;
public float rageMeleeMultiplier;
public float rageEnergyCost;
public float energyDecayTimer;
public bool ifEnergyUsed;
public bool SetActiveTrue;
private float decayConst;
private float flashConst;
private float glowStopwatch;
private Color targetColor;
private Color originalColor;
private Color currentColor;
private GlowState state;
public void Awake()
{
characterBody = ((Component)this).gameObject.GetComponent<CharacterBody>();
}
public void Start()
{
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
ifEnergyRegenAllowed = true;
maxForceEnergy = StaticValues.baseForceEnergy + (characterBody.level - 1f) * StaticValues.levelForceEnergy;
currentForceEnergy = maxForceEnergy;
regenForceEnergy = maxForceEnergy * StaticValues.regenForceEnergyFraction;
drainForceEnergy = maxForceEnergy * StaticValues.drainForceEnergyFraction;
costmultiplierForceEnergy = 1f;
costflatForceEnergy = 0f;
meleeForceEnergyGain = StaticValues.basemeleeForceEnergyGain;
rageMeleeMultiplier = 1f;
rageEnergyCost = 1f;
ifEnergyUsed = false;
CustomUIObject = Object.Instantiate<GameObject>(Assets.mainAssetBundle.LoadAsset<GameObject>("darthCustomUI"));
CustomUIObject.SetActive(false);
SetActiveTrue = false;
forceMeter = ((Component)CustomUIObject.transform.GetChild(0)).GetComponent<RectTransform>();
forceMeterGlowBackground = ((Component)CustomUIObject.transform.GetChild(1)).GetComponent<Image>();
forceMeterGlowRect = ((Component)CustomUIObject.transform.GetChild(1)).GetComponent<RectTransform>();
forceNumber = CreateLabel(CustomUIObject.transform, "forceNumber", $"{(int)currentForceEnergy} / {maxForceEnergy}", new Vector2(0f, -110f), 24f);
state = GlowState.STOP;
decayConst = 1f;
flashConst = 1f;
glowStopwatch = 1f;
originalColor = new Color(1f, 1f, 1f, 0f);
targetColor = new Color(1f, 1f, 1f, 1f);
currentColor = originalColor;
}
private HGTextMeshProUGUI CreateLabel(Transform parent, string name, string text, Vector2 position, float textScale)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_0081: 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_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name);
val.transform.parent = parent;
val.AddComponent<CanvasRenderer>();
RectTransform val2 = val.AddComponent<RectTransform>();
HGTextMeshProUGUI val3 = val.AddComponent<HGTextMeshProUGUI>();
((Behaviour)val3).enabled = true;
((TMP_Text)val3).text = text;
((TMP_Text)val3).fontSize = textScale;
((Graphic)val3).color = Color.red;
((TMP_Text)val3).alignment = (TextAlignmentOptions)514;
((TMP_Text)val3).enableWordWrapping = false;
((Transform)val2).localPosition = Vector2.op_Implicit(Vector2.zero);
val2.anchorMin = Vector2.zero;
val2.anchorMax = Vector2.one;
((Transform)val2).localScale = Vector3.one;
val2.sizeDelta = Vector2.zero;
val2.anchoredPosition = position;
return val3;
}
private void CalculateEnergyStats()
{
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)characterBody))
{
maxForceEnergy = StaticValues.baseForceEnergy + (characterBody.level - 1f) * StaticValues.levelForceEnergy + 10f * (float)characterBody.master.inventory.GetItemCount(Items.SecondarySkillMagazine) + 30f * (float)characterBody.master.inventory.GetItemCount(Items.UtilitySkillMagazine);
regenForceEnergy = maxForceEnergy * StaticValues.regenForceEnergyFraction;
costmultiplierForceEnergy = (float)Math.Pow(0.75, characterBody.master.inventory.GetItemCount(Items.AlienHead));
costflatForceEnergy = 5 * characterBody.master.inventory.GetItemCount(Items.LunarBadLuck);
if (costmultiplierForceEnergy > 1f)
{
costmultiplierForceEnergy = 1f;
}
if (meleeForceEnergyGain < 1f)
{
meleeForceEnergyGain = StaticValues.basemeleeForceEnergyGain;
}
}
if (ifEnergyUsed)
{
if (energyDecayTimer > 2f)
{
energyDecayTimer = 0f;
ifEnergyRegenAllowed = true;
ifEnergyUsed = false;
}
else
{
ifEnergyRegenAllowed = false;
energyDecayTimer += Time.fixedDeltaTime;
}
}
if (ifEnergyRegenAllowed)
{
currentForceEnergy += regenForceEnergy * Time.fixedDeltaTime;
}
if (currentForceEnergy > maxForceEnergy)
{
currentForceEnergy = maxForceEnergy;
}
if (currentForceEnergy <= 1f && characterBody.HasBuff(Buffs.RageBuff))
{
currentForceEnergy = 0f;
ExitRage();
NetMessageExtensions.Send((INetMessage)(object)new EndRageBuffNetworkRequest(characterBody.masterObjectId), (NetworkDestination)1);
}
if (Object.op_Implicit((Object)(object)forceNumber))
{
((TMP_Text)forceNumber).SetText($"{(int)currentForceEnergy} / {maxForceEnergy}", true);
}
if (Object.op_Implicit((Object)(object)forceMeter))
{
float num = Mathf.Log10(maxForceEnergy / StaticValues.baseForceEnergy * 10f + 1f) * (currentForceEnergy / maxForceEnergy);
((Transform)forceMeter).localScale = new Vector3(2f * num, 0.05f, 1f);
((Transform)forceMeterGlowRect).localScale = new Vector3(2.3f * num, 0.1f, 1f);
}
}
public void FixedUpdate()
{
if (characterBody.hasEffectiveAuthority)
{
CalculateEnergyStats();
}
if (characterBody.hasEffectiveAuthority && !SetActiveTrue)
{
CustomUIObject.SetActive(true);
SetActiveTrue = true;
}
}
public void Update()
{
//IL_00ee: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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)
if (state != 0)
{
glowStopwatch += Time.deltaTime;
switch (state)
{
case GlowState.FLASH:
{
float num = glowStopwatch / flashConst;
currentColor = Color.Lerp(originalColor, targetColor, num);
if (glowStopwatch > flashConst)
{
state = GlowState.DECAY;
glowStopwatch = 0f;
}
break;
}
case GlowState.DECAY:
{
float num = glowStopwatch / decayConst;
currentColor = Color.Lerp(targetColor, originalColor, num);
if (glowStopwatch > decayConst)
{
state = GlowState.STOP;
glowStopwatch = 0f;
}
break;
}
}
}
((Graphic)forceMeterGlowBackground).color = currentColor;
}
public void MeleeEnergyGain(float Energy)
{
currentForceEnergy += rageMeleeMultiplier * (Energy * meleeForceEnergyGain);
}
public void SpendEnergy(float Energy)
{
float num = Energy - costflatForceEnergy;
if (num < 0f)
{
num = 0f;
}
float num2 = rageEnergyCost * costmultiplierForceEnergy * num;
if (num2 < 0f)
{
num2 = 0f;
}
currentForceEnergy -= num2;
ifEnergyUsed = true;
}
public void TriggerGlow(float newDecayTimer, float newFlashTimer, Color newStartingColor)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
decayConst = newDecayTimer;
flashConst = newFlashTimer;
originalColor = new Color(newStartingColor.r, newStartingColor.g, newStartingColor.b, 0f);
targetColor = newStartingColor;
glowStopwatch = 0f;
state = GlowState.FLASH;
}
public void SetRageState(float increasingRageTimer)
{
rageEnergyCost = 0f;
rageMeleeMultiplier = 0.5f;
ifEnergyRegenAllowed = false;
currentForceEnergy -= (float)Math.Pow(increasingRageTimer, StaticValues.drainForceEnergyFraction) * Time.fixedDeltaTime;
}
public void ExitRage()
{
rageMeleeMultiplier = 1f;
ifEnergyRegenAllowed = true;
rageEnergyCost = 1f;
}
public void OnDestroy()
{
Object.Destroy((Object)(object)CustomUIObject);
}
}
}
namespace DarthVaderMod.Modules
{
internal static class Assets
{
internal static AssetBundle mainAssetBundle;
internal static GameObject swordSwingEffect;
internal static GameObject swordHitImpactEffect;
internal static GameObject blasterShotEffect;
internal static GameObject rageAuraEffect;
internal static List<GameObject> networkObjDefs = new List<GameObject>();
internal static NetworkSoundEventDef swordHitSoundEvent;
internal static Shader hotpoo = LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/HGStandard");
internal static Material commandoMat;
private static string[] assetNames = new string[0];
private const string assetbundleName = "DarthVaderAssetBundle";
private const string csProjName = "DarthVaderMod";
public static Material SpatialMovementBuffMaterial;
public static Sprite shieldBuffIcon = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Common/bdArmorBoost.asset").WaitForCompletion().iconSprite;
public static Sprite lightningBuffIcon = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/ShockNearby/bdTeslaField.asset").WaitForCompletion().iconSprite;
public static GameObject voidjailermuzzleEffect = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/VoidSurvivor/VoidSurvivorBeamTracer.prefab").WaitForCompletion();
internal static void Initialize()
{
bool flag = false;
LoadAssetBundle();
LoadSoundbank();
PopulateAssets();
}
internal static void LoadAssetBundle()
{
try
{
if ((Object)(object)mainAssetBundle == (Object)null)
{
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("DarthVaderMod.DarthVaderAssetBundle");
mainAssetBundle = AssetBundle.LoadFromStream(stream);
}
}
catch (Exception ex)
{
Log.Error("Failed to load assetbundle. Make sure your assetbundle name is setup correctly\n" + ex);
return;
}
assetNames = mainAssetBundle.GetAllAssetNames();
}
internal static void LoadSoundbank()
{
using Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("DarthVaderMod.DarthVaderBank.bnk");
byte[] array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
SoundBanks.Add(array);
}
internal static void PopulateAssets()
{
if (!Object.op_Implicit((Object)(object)mainAssetBundle))
{
Log.Error("There is no AssetBundle to load assets from.");
return;
}
swordHitSoundEvent = CreateNetworkSoundEventDef("DarthLightsaberHit");
swordSwingEffect = LoadEffect("DarthVaderSwordSwingEffect", parentToTransform: true);
swordHitImpactEffect = LoadEffect("ImpactDarthVaderSlash");
blasterShotEffect = LoadEffect("BlasterShot");
rageAuraEffect = LoadEffect("rageAura");
}
private static GameObject CreateTracer(string originalTracerName, string newTracerName)
{
if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null)
{
return null;
}
GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true);
if (!Object.op_Implicit((Object)(object)val.GetComponent<EffectComponent>()))
{
val.AddComponent<EffectComponent>();
}
if (!Object.op_Implicit((Object)(object)val.GetComponent<VFXAttributes>()))
{
val.AddComponent<VFXAttributes>();
}
if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>()))
{
val.AddComponent<NetworkIdentity>();
}
val.GetComponent<Tracer>().speed = 250f;
val.GetComponent<Tracer>().length = 50f;
AddNewEffectDef(val);
return val;
}
internal static NetworkSoundEventDef CreateNetworkSoundEventDef(string eventName)
{
NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>();
val.akId = AkSoundEngine.GetIDFromString(eventName);
val.eventName = eventName;
Content.AddNetworkSoundEventDef(val);
return val;
}
internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert)
{
if (!Object.op_Implicit((Object)(object)objectToConvert))
{
return;
}
Renderer[] componentsInChildren = objectToConvert.GetComponentsInChildren<Renderer>();
foreach (Renderer val in componentsInChildren)
{
if (val != null)
{
val.material?.SetHopooMaterial(isCulled: false);
}
}
}
internal static RendererInfo[] SetupRendererInfos(GameObject obj)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>();
RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length];
for (int i = 0; i < componentsInChildren.Length; i++)
{
array[i] = new RendererInfo
{
defaultMaterial = ((Renderer)componentsInChildren[i]).material,
renderer = (Renderer)(object)componentsInChildren[i],
defaultShadowCastingMode = (ShadowCastingMode)1,
ignoreOverlays = false
};
}
return array;
}
public static GameObject LoadSurvivorModel(string modelName)
{
GameObject val = mainAssetBundle.LoadAsset<GameObject>(modelName);
if ((Object)(object)val == (Object)null)
{
Log.Error("Trying to load a null model- check to see if the name in your code matches the name of the object in Unity");
return null;
}
return PrefabAPI.InstantiateClone(val, ((Object)val).name, false);
}
internal static Texture LoadCharacterIconGeneric(string characterName)
{
return mainAssetBundle.LoadAsset<Texture>("tex" + characterName + "Icon");
}
internal static GameObject LoadCrosshair(string crosshairName)
{
if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair") == (Object)null)
{
return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/StandardCrosshair");
}
return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair");
}
private static GameObject LoadEffect(string resourceName)
{
return LoadEffect(resourceName, "", parentToTransform: false);
}
private static GameObject LoadEffect(string resourceName, string soundName)
{
return LoadEffect(resourceName, soundName, parentToTransform: false);
}
private static GameObject LoadEffect(string resourceName, bool parentToTransform)
{
return LoadEffect(resourceName, "", parentToTransform);
}
private static GameObject LoadEffect(string resourceName, string soundName, bool parentToTransform)
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
for (int i = 0; i < assetNames.Length; i++)
{
if (assetNames[i].Contains(resourceName.ToLowerInvariant()))
{
flag = true;
i = assetNames.Length;
}
}
if (!flag)
{
Log.Error("Failed to load effect: " + resourceName + " because it does not exist in the AssetBundle");
return null;
}
GameObject val = mainAssetBundle.LoadAsset<GameObject>(resourceName);
val.AddComponent<DestroyOnTimer>().duration = 12f;
val.AddComponent<NetworkIdentity>();
val.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
EffectComponent val2 = val.AddComponent<EffectComponent>();
val2.applyScale = false;
val2.effectIndex = (EffectIndex)(-1);
val2.parentToReferencedTransform = parentToTransform;
val2.positionAtReferencedTransform = true;
val2.soundName = soundName;
AddNewEffectDef(val, soundName);
return val;
}
private static void AddNewEffectDef(GameObject effectPrefab)
{
AddNewEffectDef(effectPrefab, "");
}
private static void AddNewEffectDef(GameObject effectPrefab, string soundName)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
EffectDef val = new EffectDef();
val.prefab = effectPrefab;
val.prefabEffectComponent = effectPrefab.GetComponent<EffectComponent>();
val.prefabName = ((Object)effectPrefab).name;
val.prefabVfxAttributes = effectPrefab.GetComponent<VFXAttributes>();
val.spawnSoundEventName = soundName;
Content.AddEffectDef(val);
}
}
public static class Buffs
{
internal static BuffDef RageBuff;
internal static BuffDef DeflectBuff;
internal static void RegisterBuffs()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
RageBuff = AddNewBuff("RageBuff", Assets.lightningBuffIcon, Color.red, canStack: false, isDebuff: false);
DeflectBuff = AddNewBuff("DeflectBuff", Assets.shieldBuffIcon, Color.red, canStack: false, isDebuff: false);
}
internal static BuffDef AddNewBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff)
{
//IL_0010: 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)
BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
((Object)val).name = buffName;
val.buffColor = buffColor;
val.canStack = canStack;
val.isDebuff = isDebuff;
val.eliteDef = null;
val.iconSprite = buffIcon;
Content.AddBuffDef(val);
return val;
}
}
public static class Config
{
public static ConfigEntry<bool> enableMusic;
public static ConfigEntry<bool> enableBreathing;
public static ConfigEntry<float> primaryCoefficient;
public static ConfigEntry<float> secondaryCoefficientPull;
public static ConfigEntry<float> secondaryCoefficientPush;
public static ConfigEntry<float> secondaryForceOnWeightMultiplier;
public static ConfigEntry<float> secondaryForceReductionForBosses;
public static ConfigEntry<float> secondaryCooldown;
public static ConfigEntry<float> utilityMultiplier;
public static ConfigEntry<float> utilityCooldown;
public static ConfigEntry<float> specialDuration;
public static ConfigEntry<float> specialCooldown;
public static ConfigEntry<float> specialMultiplier;
public static ConfigEntry<float> passiveEnergyRecovery;
public static ConfigEntry<float> energyGainedOnHit;
public static ConfigEntry<float> cooldownReducedOnHit;
public static ConfigEntry<float> baseDamage;
public static ConfigEntry<float> damageGainedPerLevel;
public static ConfigEntry<bool> armorBonusPassiveActive;
public static ConfigEntry<bool> speedCapBaseActive;
public static ConfigEntry<bool> speedCapRageActive;
public static ConfigEntry<float> maxSpeedNormal;
public static ConfigEntry<float> maxSpeedRage;
public static void ReadConfig()
{
baseDamage = ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<float>("01 - General", "02 - Base Damage", 10f, "Sets the base damage at Level 1. Requires a restart to apply.");
damageGainedPerLevel = ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<float>("01 - General", "03 - Damage growth per level", 2.4f, "Sets the damage gained per level. Requires a restart to apply.");
enableMusic = ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<bool>("01 - General", "04 - Music is enabled", true, "Enables music. Setting to false mutes music.");
enableBreathing = ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<bool>("01 - General", "05 - Darth Breathing enabled", true, "Enables periodic breathing SFX. Set to False to disable.");
primaryCoefficient = ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<float>("02 - Primary", "01 - Lightsaber Coefficient", 2f, "Sets the coefficient for lightsabre, 1.0 = 100%. Can change in runtime, but requires a restart to show in the UI.");
secondaryCoefficientPull = ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<float>("03 - Secondary", "01 - Force Push Coefficient", 3.5f, "Sets the coefficient for Force Push, 1.0 = 100%. Can change in runtime, but requires a restart to show in the UI.");
secondaryCoefficientPush = ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<float>("03 - Secondary", "02 - Force Pull Coefficient", 4f, "Sets the coefficient for Force Pull, 1.0 = 100%. Can change in runtime, but requires a restart to show in the UI.");
secondaryForceOnWeightMultiplier = ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<float>("03 - Secondary", "03 - Mulitplier on Force", 1f, "Multiplies the force applied on an enemy affected by pull/push by the set value.");
secondaryForceReductionForBosses = ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<float>("03 - Secondary", "04 - Reduction on boss enemies", 5f, "Reduces the amount of force applied for boss enemies affected by Push/Pull");
secondaryCooldown = ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<float>("03 - Secondary", "05 - Force Push/Pull Cooldown", 5f, "Sets the cooldown for Force Pull/Push. Requires a restart to apply.");
armorBonusPassiveActive = ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<bool>("04 - Misc", "01 - Armor Bonus Passive", true, "Determines if Armor should scale based on movespeed.");
speedCapBaseActive = ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<bool>("04 - Misc", "02 - Move Speed Limiter", true, "Determines if the move speed should be limited in Normal Mode, outside of Rage. If unticked, speed will be uncapped.");
maxSpeedNormal = ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<float>("04 - Misc", "03 - Max Speed in Normal Mode", 0f, "Determines the maximum speed Darth Vader can move at. Setting it to 0 uncaps the speed.");
speedCapRageActive = ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<bool>("04 - Misc", "04 - Rage: Move Speed Limiter", true, "Determines if the move speed should be limited in Rage Mode. If unticked, speed will be uncapped.");
maxSpeedRage = ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<float>("04 - Misc", "05 - Max Speed in Rage Mode", 0f, "Determines the maximum speed Darth Vader can move at in Rage mode. Setting it to 0 uncaps the speed.");
}
public static ConfigEntry<bool> CharacterEnableConfig(string characterName, string description = "Set to false to disable this character", bool enabledDefault = true)
{
return ((BaseUnityPlugin)DarthVaderPlugin.instance).Config.Bind<bool>("General", "Enable " + characterName, enabledDefault, description);
}
public static void SetupRiskOfOptions()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: 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_00bd: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Expected O, but got Unknown
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Expected O, but got Unknown
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Expected O, but got Unknown
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Expected O, but got Unknown
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Expected O, but got Unknown
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Expected O, but got Unknown
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: 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_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0159: Expected O, but got Unknown
//IL_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Expected O, but got Unknown
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(baseDamage, new StepSliderConfig
{
min = 1f,
max = 100f,
increment = 0.5f
}));
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(damageGainedPerLevel, new StepSliderConfig
{
min = 1f,
max = 100f,
increment = 0.5f
}));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enableMusic));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enableBreathing));
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(primaryCoefficient, new StepSliderConfig
{
min = 1f,
max = 100f,
increment = 0.1f
}));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(armorBonusPassiveActive));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(speedCapBaseActive));
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(maxSpeedNormal, new StepSliderConfig
{
min = 0f,
max = 1000f,
increment = 0.5f
}));
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(speedCapRageActive));
ModSettingsManager.AddOption((BaseOption)new StepSliderOption(maxSpeedRage, new StepSliderConfig
{
min = 0f,
max = 1000f,
increment = 0.5f
}));
}
}
internal class ContentPacks : IContentPackProvider
{
[CompilerGenerated]
private sealed class <FinalizeAsync>d__18 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public FinalizeAsyncArgs args;
public ContentPacks <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <FinalizeAsync>d__18(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
if (<>1__state != 0)
{
return false;
}
<>1__state = -1;
args.ReportProgress(1f);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <GenerateContentPackAsync>d__17 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public GetContentPackAsyncArgs args;
public ContentPacks <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <GenerateContentPackAsync>d__17(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
if (<>1__state != 0)
{
return false;
}
<>1__state = -1;
ContentPack.Copy(<>4__this.contentPack, args.output);
args.ReportProgress(1f);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <LoadStaticContentAsync>d__16 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LoadStaticContentAsyncArgs args;
public ContentPacks <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadStaticContentAsync>d__16(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
if (<>1__state != 0)
{
return false;
}
<>1__state = -1;
<>4__this.contentPack.identifier = <>4__this.identifier;
<>4__this.contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray());
<>4__this.contentPack.masterPrefabs.Add(masterPrefabs.ToArray());
<>4__this.contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray());
<>4__this.contentPack.survivorDefs.Add(survivorDefs.ToArray());
<>4__this.contentPack.unlockableDefs.Add(unlockableDefs.ToArray());
<>4__this.contentPack.skillDefs.Add(skillDefs.ToArray());
<>4__this.contentPack.skillFamilies.Add(skillFamilies.ToArray());
<>4__this.contentPack.entityStateTypes.Add(entityStates.ToArray());
<>4__this.contentPack.buffDefs.Add(buffDefs.ToArray());
<>4__this.contentPack.effectDefs.Add(effectDefs.ToArray());
<>4__this.contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray());
args.ReportProgress(1f);
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
internal ContentPack contentPack = new ContentPack();
public static List<GameObject> bodyPrefabs = new List<GameObject>();
public static List<GameObject> masterPrefabs = new List<GameObject>();
public static List<GameObject> projectilePrefabs = new List<GameObject>();
public static List<SurvivorDef> survivorDefs = new List<SurvivorDef>();
public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>();
public static List<SkillFamily> skillFamilies = new List<SkillFamily>();
public static List<SkillDef> skillDefs = new List<SkillDef>();
public static List<Type> entityStates = new List<Type>();
public static List<BuffDef> buffDefs = new List<BuffDef>();
public static List<EffectDef> effectDefs = new List<EffectDef>();
public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>();
public string identifier => "com.PopcornFactory.DarthVaderMod";
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);
}
[IteratorStateMachine(typeof(<LoadStaticContentAsync>d__16))]
public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadStaticContentAsync>d__16(0)
{
<>4__this = this,
args = args
};
}
[IteratorStateMachine(typeof(<GenerateContentPackAsync>d__17))]
public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <GenerateContentPackAsync>d__17(0)
{
<>4__this = this,
args = args
};
}
[IteratorStateMachine(typeof(<FinalizeAsync>d__18))]
public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <FinalizeAsync>d__18(0)
{
<>4__this = this,
args = args
};
}
}
internal class Content
{
public static void AddCharacterBodyPrefab(GameObject bprefab)
{
ContentPacks.bodyPrefabs.Add(bprefab);
}
public static void AddMasterPrefab(GameObject prefab)
{
ContentPacks.masterPrefabs.Add(prefab);
}
public static void AddProjectilePrefab(GameObject prefab)
{
ContentPacks.projectilePrefabs.Add(prefab);
}
public static void AddSurvivorDef(SurvivorDef survivorDef)
{
ContentPacks.survivorDefs.Add(survivorDef);
}
public static void AddUnlockableDef(UnlockableDef unlockableDef)
{
ContentPacks.unlockableDefs.Add(unlockableDef);
}
public static void AddSkillDef(SkillDef skillDef)
{
ContentPacks.skillDefs.Add(skillDef);
}
public static void AddSkillFamily(SkillFamily skillFamily)
{
ContentPacks.skillFamilies.Add(skillFamily);
}
public static void AddEntityState(Type entityState)
{
ContentPacks.entityStates.Add(entityState);
}
public static void AddBuffDef(BuffDef buffDef)
{
ContentPacks.buffDefs.Add(buffDef);
}
public static void AddEffectDef(EffectDef effectDef)
{
ContentPacks.effectDefs.Add(effectDef);
}
public static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef)
{
ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef);
}
}
internal static class Helpers
{
internal const string agilePrefix = "<style=cIsUtility>Agile.</style> ";
internal static string ScepterDescription(string desc)
{
return "\n<color=#d299ff>SCEPTER: " + desc + "</color>";
}
public static T[] Append<T>(ref T[] array, List<T> list)
{
int num = array.Length;
int count = list.Count;
Array.Resize(ref array, num + count);
list.CopyTo(array, num);
return array;
}
public static Func<T[], T[]> AppendDel<T>(List<T> list)
{
return (T[] r) => Append(ref r, list);
}
}
internal static class ItemDisplays
{
private static Dictionary<string, GameObject> itemDisplayPrefabs = new Dictionary<string, GameObject>();
internal static void PopulateDisplays()
{
PopulateFromBody("MageBody");
PopulateFromBody("LunarExploderBody");
PopulateCustomLightningArm();
}
private static void PopulateFromBody(string bodyName)
{
ItemDisplayRuleSet itemDisplayRuleSet = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyName).GetComponent<ModelLocator>().modelTransform).GetComponent<CharacterModel>().itemDisplayRuleSet;
KeyAssetRuleGroup[] keyAssetRuleGroups = itemDisplayRuleSet.keyAssetRuleGroups;
for (int i = 0; i < keyAssetRuleGroups.Length; i++)
{
ItemDisplayRule[] rules = keyAssetRuleGroups[i].displayRuleGroup.rules;
for (int j = 0; j < rules.Length; j++)
{
GameObject followerPrefab = rules[j].followerPrefab;
if (Object.op_Implicit((Object)(object)followerPrefab))
{
string key = ((Object)followerPrefab).name?.ToLowerInvariant();
if (!itemDisplayPrefabs.ContainsKey(key))
{
itemDisplayPrefabs[key] = followerPrefab;
}
}
}
}
}
private static void PopulateCustomLightningArm()
{
GameObject val = PrefabAPI.InstantiateClone(itemDisplayPrefabs["displaylightningarmright"], "DisplayLightningCustom", false);
LimbMatcher component = val.GetComponent<LimbMatcher>();
component.limbPairs[0].targetChildLimb = "LightningArm1";
component.limbPairs[1].targetChildLimb = "LightningArm2";
component.limbPairs[2].targetChildLimb = "LightningArmEnd";
itemDisplayPrefabs["displaylightningarmcustom"] = val;
}
public static GameObject LoadDisplay(string name)
{
if (itemDisplayPrefabs.ContainsKey(name.ToLowerInvariant()) && Object.op_Implicit((Object)(object)itemDisplayPrefabs[name.ToLowerInvariant()]))
{
return itemDisplayPrefabs[name.ToLowerInvariant()];
}
Log.Error("item display " + name + " returned null");
return null;
}
}
internal static class Materials
{
private static List<Material> cachedMaterials = new List<Material>();
public static Material CreateHopooMaterial(string materialName, bool isCulled)
{
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
Material val = cachedMaterials.Find(delegate(Material mat)
{
materialName.Replace(" (Instance)", "");
return ((Object)mat).name.Contains(materialName);
});
if (Object.op_Implicit((Object)(object)val))
{
return val;
}
val = Assets.mainAssetBundle.LoadAsset<Material>(materialName);
if (!Object.op_Implicit((Object)(object)val))
{
Log.Error("Failed to load material: " + materialName + " - Check to see that the material in your Unity project matches this name");
return new Material(Assets.hotpoo);
}
return val.SetHopooMaterial(isCulled);
}
public static Material SetHopooMaterial(this Material tempMat, bool isCulled)
{
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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)
if (cachedMaterials.Contains(tempMat))
{
return tempMat;
}
float? num = null;
Color? val = null;
if (tempMat.IsKeywordEnabled("_NORMALMAP"))
{
num = tempMat.GetFloat("_BumpScale");
}
if (tempMat.IsKeywordEnabled("_EMISSION"))
{
val = tempMat.GetColor("_EmissionColor");
}
tempMat.shader = Assets.hotpoo;
tempMat.SetColor("_Color", tempMat.GetColor("_Color"));
tempMat.SetTexture("_MainTex", tempMat.GetTexture("_MainTex"));
tempMat.SetTexture("_EmTex", tempMat.GetTexture("_EmissionMap"));
tempMat.EnableKeyword("DITHER");
if (num.HasValue)
{
tempMat.SetFloat("_NormalStrength", num.Value);
}
if (val.HasValue)
{
tempMat.SetColor("_EmColor", val.Value);
tempMat.SetFloat("_EmPower", 5f);
}
if (!isCulled)
{
tempMat.SetInt("_Cull", 0);
}
if (tempMat.IsKeywordEnabled("LIMBREMOVAL"))
{
tempMat.SetInt("_LimbRemovalOn", 1);
}
cachedMaterials.Add(tempMat);
return tempMat;
}
public static Material MakeUnique(this Material material)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
if (cachedMaterials.Contains(material))
{
return new Material(material);
}
return material;
}
public static Material SetColor(this Material material, Color color)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
material.SetColor("_Color", color);
return material;
}
public static Material SetNormal(this Material material, float normalStrength = 1f)
{
material.SetFloat("_NormalStrength", normalStrength);
return material;
}
public static Material SetEmission(this Material material)
{
return material.SetEmission(1f);
}
public static Material SetEmission(this Material material, float emission)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return material.SetEmission(emission, Color.white);
}
public static Material SetEmission(this Material material, float emission, Color emissionColor)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
material.SetFloat("_EmPower", emission);
material.SetColor("_EmColor", emissionColor);
return material;
}
public static Material SetCull(this Material material, bool cull = false)
{
material.SetInt("_Cull", cull ? 1 : 0);
return material;
}
}
internal static class Prefabs
{
private static PhysicMaterial ragdollMaterial;
public static GameObject CreateDisplayPrefab(string displayModelName, GameObject prefab, BodyInfo bodyInfo)
{
GameObject val = Assets.LoadSurvivorModel(displayModelName);
CharacterModel val2 = val.GetComponent<CharacterModel>();
if (!Object.op_Implicit((Object)(object)val2))
{
val2 = val.AddComponent<CharacterModel>();
}
val2.baseRendererInfos = prefab.GetComponentInChildren<CharacterModel>().baseRendererInfos;
Assets.ConvertAllRenderersToHopooShader(val);
return val.gameObject;
}
public static GameObject CreateBodyPrefab(string bodyName, string modelName, BodyInfo bodyInfo)
{
//IL_00d7: 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_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyInfo.bodyNameToClone + "Body");
if (!Object.op_Implicit((Object)(object)val))
{
Log.Error(bodyInfo.bodyNameToClone + "Body is not a valid body, character creation failed");
return null;
}
GameObject val2 = PrefabAPI.InstantiateClone(val, bodyName);
Transform val3 = null;
GameObject val4 = null;
if (modelName != "mdl")
{
val4 = Assets.LoadSurvivorModel(modelName);
if ((Object)(object)val4 == (Object)null)
{
val4 = ((Component)val2.GetComponentInChildren<CharacterModel>()).gameObject;
}
val3 = AddCharacterModelToSurvivorBody(val2, val4.transform, bodyInfo);
}
CharacterBody component = val2.GetComponent<CharacterBody>();
((Object)component).name = bodyInfo.bodyName;
component.baseNameToken = bodyInfo.bodyNameToken;
component.subtitleNameToken = bodyInfo.subtitleNameToken;
component.portraitIcon = bodyInfo.characterPortrait;
component.bodyColor = bodyInfo.bodyColor;
component._defaultCrosshairPrefab = bodyInfo.crosshair;
component.hideCrosshair = false;
component.preferredPodPrefab = bodyInfo.podPrefab;
component.baseMaxHealth = bodyInfo.maxHealth;
component.baseRegen = bodyInfo.healthRegen;
component.levelArmor = bodyInfo.armorGrowth;
component.baseMaxShield = bodyInfo.shield;
component.baseDamage = bodyInfo.damage;
component.baseAttackSpeed = bodyInfo.attackSpeed;
component.baseCrit = bodyInfo.crit;
component.baseMoveSpeed = bodyInfo.moveSpeed;
component.baseJumpPower = bodyInfo.jumpPower;
component.autoCalculateLevelStats = bodyInfo.autoCalculateLevelStats;
component.levelDamage = bodyInfo.damageGrowth;
component.levelAttackSpeed = bodyInfo.attackSpeedGrowth;
component.levelCrit = bodyInfo.critGrowth;
component.levelMaxHealth = bodyInfo.healthGrowth;
component.levelRegen = bodyInfo.regenGrowth;
component.baseArmor = bodyInfo.armor;
component.levelMaxShield = bodyInfo.shieldGrowth;
component.levelMoveSpeed = bodyInfo.moveSpeedGrowth;
component.levelJumpPower = bodyInfo.jumpPowerGrowth;
component.baseAcceleration = bodyInfo.acceleration;
component.baseJumpCount = bodyInfo.jumpCount;
component.sprintingSpeedMultiplier = 1.4f;
component.bodyFlags = (BodyFlags)16;
component.rootMotionInMainState = false;
component.hullClassification = (HullClassification)0;
component.isChampion = false;
SetupCameraTargetParams(val2, bodyInfo);
SetupModelLocator(val2, val3, val4.transform);
SetupCapsuleCollider(val2);
SetupMainHurtbox(val2, val4);
SetupCharacterMotor(val2);
SetupAimAnimator(val2, val4);
if ((Object)(object)val3 != (Object)null)
{
SetupCharacterDirection(val2, val3, val4.transform);
}
SetupFootstepController(val4);
SetupRagdoll(val4);
Content.AddCharacterBodyPrefab(val2);
return val2;
}
public static void CreateGenericDoppelganger(GameObject bodyPrefab, string masterName, string masterToCopy)
{
GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/" + masterToCopy + "MonsterMaster"), masterName, true);
val.GetComponent<CharacterMaster>().bodyPrefab = bodyPrefab;
Content.AddMasterPrefab(val);
}
private static Transform AddCharacterModelToSurvivorBody(GameObject bodyPrefab, Transform modelTransform, BodyInfo bodyInfo)
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Expected O, but got Unknown
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Expected O, but got Unknown
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
for (int num = bodyPrefab.transform.childCount - 1; num >= 0; num--)
{
Object.DestroyImmediate((Object)(object)((Component)bodyPrefab.transform.GetChild(num)).gameObject);
}
Transform transform = new GameObject("ModelBase").transform;
transform.parent = bodyPrefab.transform;
transform.localPosition = bodyInfo.modelBasePosition;
transform.localRotation = Quaternion.identity;
modelTransform.parent = ((Component)transform).transform;
modelTransform.localPosition = Vector3.zero;
modelTransform.localRotation = Quaternion.identity;
GameObject val = new GameObject("CameraPivot");
val.transform.parent = bodyPrefab.transform;
val.transform.localPosition = bodyInfo.cameraPivotPosition;
val.transform.localRotation = Quaternion.identity;
GameObject val2 = new GameObject("AimOrigin");
val2.transform.parent = bodyPrefab.transform;
val2.transform.localPosition = bodyInfo.aimOriginPosition;
val2.transform.localRotation = Quaternion.identity;
bodyPrefab.GetComponent<CharacterBody>().aimOriginTransform = val2.transform;
return ((Component)transform).transform;
}
public static CharacterModel SetupCharacterModel(GameObject prefab)
{
return SetupCharacterModel(prefab, null);
}
public static CharacterModel SetupCharacterModel(GameObject prefab, CustomRendererInfo[] customInfos)
{
CharacterModel val = ((Component)prefab.GetComponent<ModelLocator>().modelTransform).gameObject.GetComponent<CharacterModel>();
bool flag = (Object)(object)val != (Object)null;
if (!flag)
{
val = ((Component)prefab.GetComponent<ModelLocator>().modelTransform).gameObject.AddComponent<CharacterModel>();
}
val.body = prefab.GetComponent<CharacterBody>();
val.autoPopulateLightInfos = true;
val.invisibilityCount = 0;
val.temporaryOverlays = new List<TemporaryOverlayInstance>();
if (!flag)
{
SetupCustomRendererInfos(val, customInfos);
}
else
{
SetupPreAttachedRendererInfos(val);
}
return val;
}
public static void SetupPreAttachedRendererInfos(CharacterModel characterModel)
{
for (int i = 0; i < characterModel.baseRendererInfos.Length; i++)
{
if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null)
{
characterModel.baseRendererInfos[i].defaultMaterial = characterModel.base