using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using EntityStates;
using IL.RoR2;
using KinematicCharacterController;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using R2API;
using R2API.Utils;
using Rewired.ComponentControls.Effects;
using RoR2;
using RoR2.Achievements;
using RoR2.Projectile;
using RoR2.Skills;
using RoR2.UI;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering.PostProcessing;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = "")]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: CompilationRelaxations(8)]
[assembly: AssemblyCompany("LegacyItems")]
[assembly: AssemblyProduct("LegacyItems")]
[assembly: AssemblyTitle("LegacyItems")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace LegacyItems;
public static class Achievements
{
[RegisterAchievement("LEGACYITEMS_ROOT", "ACHIEVEMENT_LEGACYITEMS_ROOT_UNLOCKABLE_ID", null, null)]
public class RootUnlockable : BaseAchievement
{
private float requiredHealth = 650f;
public override void OnInstall()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
((BaseAchievement)this).OnInstall();
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
}
private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
{
if ((Object)(object)((BaseAchievement)this).localUser.cachedBody == (Object)(object)sender)
{
float num = sender.baseMaxHealth + sender.levelMaxHealth * (sender.level - 1f);
float num2 = sender.healthComponent.fullHealth - num;
if (requiredHealth <= num2)
{
((BaseAchievement)this).Grant();
}
}
}
public override void OnUninstall()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
RecalculateStatsAPI.GetStatCoefficients -= new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
((BaseAchievement)this).OnUninstall();
}
}
[RegisterAchievement("LEGACYITEMS_UMBRELLA", "ACHIEVEMENT_LEGACYITEMS_UMBRELLA_UNLOCKABLE_ID", null, null)]
public class UmbrellaUnlockable : BaseAchievement
{
public override void OnInstall()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
((BaseAchievement)this).OnInstall();
MeteorStormController.OnDestroy += new hook_OnDestroy(MeteorStormController_OnDestroy);
}
private void MeteorStormController_OnDestroy(orig_OnDestroy orig, MeteorStormController self)
{
if (((BaseAchievement)this).isUserAlive)
{
((BaseAchievement)this).Grant();
}
orig.Invoke(self);
}
public override void OnUninstall()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Expected O, but got Unknown
MeteorStormController.OnDestroy -= new hook_OnDestroy(MeteorStormController_OnDestroy);
((BaseAchievement)this).OnUninstall();
}
}
internal static UnlockableDef rootUnlock;
internal static UnlockableDef umbrellaUnlock;
public static void RegisterUnlockables()
{
rootUnlock = NewUnlockable<RootUnlockable>("ROOT", "Root of Life", "Reach 650 bonus health.");
umbrellaUnlock = NewUnlockable<UmbrellaUnlockable>("UMBRELLA", "Make A Wish", "Survive a meteor rainfall.");
}
private static UnlockableDef NewUnlockable<T>(string AchievementIdentifier, string Title, string Description) where T : BaseAchievement
{
string text = "ACHIEVEMENT_LEGACYITEMS_";
UnlockableDef val = ScriptableObject.CreateInstance<UnlockableDef>();
string langName = text + AchievementIdentifier + "_NAME";
string langDesc = text + AchievementIdentifier + "_DESCRIPTION";
LanguageAPI.Add(langName, Title);
LanguageAPI.Add(langDesc, Description);
Func<string> func = () => Language.GetStringFormatted("UNLOCKED_FORMAT", new object[2]
{
Language.GetString(langName),
Language.GetString(langDesc)
});
Type typeFromHandle = typeof(T);
val.cachedName = text + AchievementIdentifier + "_UNLOCKABLE_ID";
val.getHowToUnlockString = func;
val.getUnlockedString = func;
val.achievementIcon = Assets.Load<Sprite>(AchievementIdentifier.ToLower() + "Icon");
val.sortScore = 20;
val.hidden = false;
ContentAddition.AddUnlockableDef(val);
return val;
}
}
internal class Assets
{
internal static AssetBundle MainAssetBundle;
public static T Load<T>(string name) where T : Object
{
return MainAssetBundle.LoadAsset<T>(name);
}
public static void PopulateAssets()
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
if ((Object)(object)MainAssetBundle == (Object)null)
{
using Stream stream = executingAssembly.GetManifestResourceStream("LegacyItems.AssetBundle.legacyitemassets");
MainAssetBundle = AssetBundle.LoadFromStream(stream);
}
using Stream stream2 = executingAssembly.GetManifestResourceStream("LegacyItems.LegacyItems.bnk");
byte[] array = new byte[stream2.Length];
stream2.Read(array, 0, array.Length);
SoundBanks.Add(array);
}
}
internal class HourglassInflicted : MonoBehaviour
{
}
internal class HourglassBehaviour : NetworkBehaviour
{
[SyncVar]
public float stopDuration;
public TeamIndex team;
private float stopwatch;
private TeamMask mask;
private List<CharacterBody> bodies = new List<CharacterBody>();
private List<Animator> animators = new List<Animator>();
private List<ParticleSystem> particles = new List<ParticleSystem>();
private List<ProjectileController> projectiles = new List<ProjectileController>();
private bool soundPlayed;
public float NetworkstopDuration
{
get
{
return stopDuration;
}
[param: In]
set
{
((NetworkBehaviour)this).SetSyncVar<float>(value, ref stopDuration, 1u);
}
}
private void OnEnable()
{
//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
MusicController.LateUpdate += new Manipulator(MusicController_LateUpdate);
Run.ShouldUpdateRunStopwatch += new hook_ShouldUpdateRunStopwatch(Run_ShouldUpdateRunStopwatch);
CombatDirector.FixedUpdate += new hook_FixedUpdate(CombatDirector_FixedUpdate);
}
private void CombatDirector_FixedUpdate(orig_FixedUpdate orig, CombatDirector self)
{
}
private bool Run_ShouldUpdateRunStopwatch(orig_ShouldUpdateRunStopwatch orig, Run self)
{
return false;
}
private void OnDisable()
{
//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
MusicController.LateUpdate -= new Manipulator(MusicController_LateUpdate);
Run.ShouldUpdateRunStopwatch -= new hook_ShouldUpdateRunStopwatch(Run_ShouldUpdateRunStopwatch);
CombatDirector.FixedUpdate -= new hook_FixedUpdate(CombatDirector_FixedUpdate);
}
private void MusicController_LateUpdate(ILContext il)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
ILCursor val = new ILCursor(il);
int num = default(int);
val.GotoNext(new Func<Instruction, bool>[1]
{
(Instruction i) => ILPatternMatchingExt.MatchStloc(i, ref num)
});
val.EmitDelegate<Func<bool, bool>>((Func<bool, bool>)((bool b) => true));
}
private void Start()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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_0241: 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_02e1: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: 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_0304: 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_0347: Unknown result type (might be due to invalid IL or missing references)
//IL_0354: Unknown result type (might be due to invalid IL or missing references)
//IL_0359: Unknown result type (might be due to invalid IL or missing references)
//IL_03ac: Unknown result type (might be due to invalid IL or missing references)
//IL_03b6: Expected O, but got Unknown
AkSoundEngine.PostEvent(Sounds.Play_LegacyItems_TimeStop, ((Component)this).gameObject);
mask = TeamMask.GetEnemyTeams(team);
((Behaviour)((Component)this).GetComponent<OutsideInteractableLocker>()).enabled = true;
List<ProjectileController> instancesList = InstanceTracker.GetInstancesList<ProjectileController>();
foreach (ProjectileController item in instancesList)
{
if (item.cannotBeDeleted || !((TeamMask)(ref mask)).HasTeam(item.teamFilter.teamIndex))
{
continue;
}
projectiles.Add(item);
ProjectileGhostController ghost = item.ghost;
if (Object.op_Implicit((Object)(object)ghost))
{
ParticleSystem[] componentsInChildren = ((Component)ghost).GetComponentsInChildren<ParticleSystem>();
foreach (ParticleSystem val in componentsInChildren)
{
particles.Add(val);
val.Pause();
}
}
Rigidbody component = ((Component)item).GetComponent<Rigidbody>();
if (Object.op_Implicit((Object)(object)component))
{
component.velocity = Vector3.zero;
}
ProjectileSimple component2 = ((Component)item).GetComponent<ProjectileSimple>();
if (Object.op_Implicit((Object)(object)component2))
{
((Behaviour)component2).enabled = false;
}
MissileController component3 = ((Component)item).GetComponent<MissileController>();
if (Object.op_Implicit((Object)(object)component3))
{
((Behaviour)component3).enabled = false;
}
ProjectileSteerTowardTarget component4 = ((Component)item).GetComponent<ProjectileSteerTowardTarget>();
if (Object.op_Implicit((Object)(object)component4))
{
((Behaviour)component4).enabled = false;
}
ProjectileCharacterController component5 = ((Component)item).GetComponent<ProjectileCharacterController>();
if (Object.op_Implicit((Object)(object)component5))
{
((Behaviour)component5).enabled = false;
}
ProjectileImpactExplosion component6 = ((Component)item).GetComponent<ProjectileImpactExplosion>();
if (Object.op_Implicit((Object)(object)component6))
{
((Behaviour)component6).enabled = false;
}
ProjectileDirectionalTargetFinder component7 = ((Component)item).GetComponent<ProjectileDirectionalTargetFinder>();
if (Object.op_Implicit((Object)(object)component7))
{
((Behaviour)component7).enabled = false;
}
ProjectileSphereTargetFinder component8 = ((Component)item).GetComponent<ProjectileSphereTargetFinder>();
if (Object.op_Implicit((Object)(object)component8))
{
((Behaviour)component7).enabled = false;
}
ProjectileTargetComponent component9 = ((Component)item).GetComponent<ProjectileTargetComponent>();
if (Object.op_Implicit((Object)(object)component9))
{
component9.target = null;
}
}
foreach (CharacterBody instances in CharacterBody.instancesList)
{
if (!((TeamMask)(ref mask)).HasTeam(instances.teamComponent.teamIndex) || !instances.healthComponent.alive || !Object.op_Implicit((Object)(object)instances.master) || Object.op_Implicit((Object)(object)((Component)instances).GetComponent<HourglassInflicted>()))
{
continue;
}
((Component)instances).gameObject.AddComponent<HourglassInflicted>();
bodies.Add(instances);
RigidbodyMotor component10 = ((Component)instances).GetComponent<RigidbodyMotor>();
if (Object.op_Implicit((Object)(object)instances.characterMotor) && !instances.characterMotor.isGrounded)
{
((BaseCharacterController)instances.characterMotor).Motor.Rigidbody.velocity = Vector3.zero;
instances.characterMotor.velocity = Vector3.zero;
instances.characterMotor.rootMotion = Vector3.zero;
instances.characterMotor.useGravity = false;
((Behaviour)((BaseCharacterController)instances.characterMotor).Motor).enabled = false;
}
else if (Object.op_Implicit((Object)(object)component10))
{
component10.rigid.velocity = Vector3.zero;
component10.rootMotion = Vector3.zero;
((Behaviour)component10).enabled = false;
}
if (Util.HasEffectiveAuthority(((Component)instances).gameObject))
{
EntityStateMachine[] components = ((Component)instances).GetComponents<EntityStateMachine>();
foreach (EntityStateMachine val2 in components)
{
if (val2.customName == "Body")
{
val2.SetNextState((EntityState)new BaseState());
}
else
{
val2.SetNextStateToMain();
}
}
}
if (Object.op_Implicit((Object)(object)instances.modelLocator) && Object.op_Implicit((Object)(object)instances.modelLocator.modelTransform))
{
ParticleSystem[] componentsInChildren2 = ((Component)instances.modelLocator.modelTransform).GetComponentsInChildren<ParticleSystem>();
foreach (ParticleSystem val3 in componentsInChildren2)
{
val3.Pause();
particles.Add(val3);
}
Animator component11 = ((Component)instances.modelLocator.modelTransform).GetComponent<Animator>();
if (Object.op_Implicit((Object)(object)component11))
{
component11.speed = 0f;
animators.Add(component11);
}
}
}
}
private void FixedUpdate()
{
stopwatch += Time.fixedDeltaTime;
if (stopwatch >= stopDuration - 2.3f && !soundPlayed)
{
soundPlayed = true;
AkSoundEngine.PostEvent(Sounds.Play_LegacyItems_TimeBack, ((Component)this).gameObject);
}
if (stopwatch >= stopDuration)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
private void OnDestroy()
{
((Behaviour)((Component)this).GetComponent<OutsideInteractableLocker>()).enabled = false;
foreach (ProjectileController projectile in projectiles)
{
if (Object.op_Implicit((Object)(object)projectile))
{
ProjectileSimple component = ((Component)projectile).GetComponent<ProjectileSimple>();
if (Object.op_Implicit((Object)(object)component))
{
((Behaviour)component).enabled = true;
component.SetForwardSpeed(component.desiredForwardSpeed);
}
MissileController component2 = ((Component)projectile).GetComponent<MissileController>();
if (Object.op_Implicit((Object)(object)component2))
{
((Behaviour)component2).enabled = true;
}
ProjectileSteerTowardTarget component3 = ((Component)projectile).GetComponent<ProjectileSteerTowardTarget>();
if (Object.op_Implicit((Object)(object)component3))
{
((Behaviour)component3).enabled = true;
}
ProjectileCharacterController component4 = ((Component)projectile).GetComponent<ProjectileCharacterController>();
if (Object.op_Implicit((Object)(object)component4))
{
((Behaviour)component4).enabled = true;
}
ProjectileImpactExplosion component5 = ((Component)projectile).GetComponent<ProjectileImpactExplosion>();
if (Object.op_Implicit((Object)(object)component5))
{
((Behaviour)component5).enabled = true;
}
ProjectileDirectionalTargetFinder component6 = ((Component)projectile).GetComponent<ProjectileDirectionalTargetFinder>();
if (Object.op_Implicit((Object)(object)component6))
{
((Behaviour)component6).enabled = true;
}
ProjectileSphereTargetFinder component7 = ((Component)projectile).GetComponent<ProjectileSphereTargetFinder>();
if (Object.op_Implicit((Object)(object)component7))
{
((Behaviour)component6).enabled = true;
}
}
}
foreach (ParticleSystem particle in particles)
{
if (Object.op_Implicit((Object)(object)particle))
{
particle.Play();
}
}
foreach (CharacterBody body in bodies)
{
if (Object.op_Implicit((Object)(object)body))
{
Object.Destroy((Object)(object)((Component)body).gameObject.GetComponent<HourglassInflicted>());
RigidbodyMotor component8 = ((Component)body).GetComponent<RigidbodyMotor>();
if (Object.op_Implicit((Object)(object)body.characterMotor) && !body.characterMotor.isGrounded)
{
((Behaviour)((BaseCharacterController)body.characterMotor).Motor).enabled = true;
body.characterMotor.useGravity = true;
}
else if (Object.op_Implicit((Object)(object)component8))
{
((Behaviour)component8).enabled = true;
}
if (Util.HasEffectiveAuthority(((Component)body).gameObject))
{
((Component)body).GetComponent<EntityStateMachine>().SetNextStateToMain();
}
Object.Destroy((Object)(object)((Component)body).GetComponent<HourglassInflicted>());
}
}
foreach (Animator animator in animators)
{
if (Object.op_Implicit((Object)(object)animator))
{
animator.speed = 1f;
}
}
}
private void UNetVersion()
{
}
public override bool OnSerialize(NetworkWriter writer, bool forceAll)
{
if (forceAll)
{
writer.Write(stopDuration);
return true;
}
bool flag = false;
if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
{
if (!flag)
{
writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
flag = true;
}
writer.Write(stopDuration);
}
if (!flag)
{
writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
}
return flag;
}
public override void OnDeserialize(NetworkReader reader, bool initialState)
{
if (initialState)
{
stopDuration = reader.ReadSingle();
return;
}
int num = (int)reader.ReadPackedUInt32();
if (((uint)num & (true ? 1u : 0u)) != 0)
{
stopDuration = reader.ReadSingle();
}
}
}
internal class HourglassCooldownTimer : MonoBehaviour
{
public float duration = 5f;
private float stopwatch;
private Inventory inventory;
private void Start()
{
inventory = ((Component)this).GetComponent<Inventory>();
}
private void FixedUpdate()
{
if (!Object.op_Implicit((Object)(object)inventory))
{
return;
}
stopwatch += Time.fixedDeltaTime;
if (!(stopwatch >= duration))
{
return;
}
int itemCount = inventory.GetItemCount(Items.hourglassConsumed);
if (itemCount > 0)
{
int num = 0;
while (num < itemCount)
{
num++;
inventory.RemoveItem(Items.hourglassConsumed, 1);
inventory.GiveItem(Items.hourglass, 1);
}
Object.Destroy((Object)(object)this);
}
}
}
internal class PostProcessScale : MonoBehaviour
{
public float duration;
private PostProcessVolume pp;
private float fixedAge;
private AnimationCurve curve;
private void Start()
{
pp = ((Component)this).GetComponent<PostProcessVolume>();
curve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
}
private void FixedUpdate()
{
fixedAge += Time.fixedDeltaTime;
pp.weight = curve.Evaluate(fixedAge / duration);
if (fixedAge >= duration)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
internal class RandomizedRainDot : NetworkBehaviour
{
[SyncVar]
public float rainDuration;
public float durationStopwatch;
public float damagePercentage = 0.035f;
public float stunDuration = 1f;
public float debuffDuration = 5f;
public float minDelay = 0.05f;
public float maxDelay = 0.2f;
public float minChance = 0.02f;
public float maxChance = 0.11f;
public float delay;
public float chance;
public float thunderMinChance = 0.05f;
public float thunderMaxChance = 0.2f;
public float thunderChance;
private float stopwatch;
private uint ID;
private decimal dmg = default(decimal);
public float NetworkrainDuration
{
get
{
return rainDuration;
}
[param: In]
set
{
((NetworkBehaviour)this).SetSyncVar<float>(value, ref rainDuration, 1u);
}
}
private void Start()
{
delay = RoR2Application.rng.RangeFloat(minDelay, maxDelay);
ID = AkSoundEngine.PostEvent(Sounds.Play_LegacyItems_Rain, ((Component)this).gameObject);
}
private void OnDestroy()
{
AkSoundEngine.StopPlayingID(ID);
}
private void FixedUpdate()
{
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Invalid comparison between Unknown and I4
//IL_0119: 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)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: 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_0143: 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_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Expected O, but got Unknown
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
stopwatch += Time.fixedDeltaTime;
if (stopwatch >= delay)
{
stopwatch = 0f;
Xoroshiro128Plus rng = RoR2Application.rng;
delay = rng.RangeFloat(minDelay, maxDelay);
chance = rng.RangeFloat(minChance, maxChance);
thunderChance = rng.RangeFloat(thunderMinChance, thunderMaxChance);
if (rng.RangeFloat(0f, 1f) <= thunderChance)
{
AkSoundEngine.PostEvent(Sounds.Play_LegacyItems_Thunder, ((Component)this).gameObject);
}
foreach (CharacterBody instances in CharacterBody.instancesList)
{
if (rng.RangeFloat(0f, 1f) <= chance && (int)instances.teamComponent.teamIndex != 1 && instances.healthComponent.alive && NetworkServer.active)
{
DamageInfo val = new DamageInfo
{
attacker = ((Component)this).gameObject,
inflictor = ((Component)this).gameObject,
position = instances.corePosition,
damage = instances.healthComponent.fullCombinedHealth * damagePercentage,
crit = false,
damageColorIndex = (DamageColorIndex)3,
procChainMask = default(ProcChainMask),
procCoefficient = 0f
};
instances.healthComponent.TakeDamage(val);
instances.AddTimedBuff(Buffs.Weak, debuffDuration);
SetStateOnHurt.SetStunOnObject(((Component)instances).gameObject, stunDuration);
EffectManager.SimpleEffect(Prefabs.rainImpactEffect, instances.corePosition, Quaternion.identity, true);
}
}
}
durationStopwatch += Time.fixedDeltaTime;
if (durationStopwatch >= rainDuration)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
private void UNetVersion()
{
}
public override bool OnSerialize(NetworkWriter writer, bool forceAll)
{
if (forceAll)
{
writer.Write(rainDuration);
return true;
}
bool flag = false;
if ((((NetworkBehaviour)this).syncVarDirtyBits & (true ? 1u : 0u)) != 0)
{
if (!flag)
{
writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
flag = true;
}
writer.Write(rainDuration);
}
if (!flag)
{
writer.WritePackedUInt32(((NetworkBehaviour)this).syncVarDirtyBits);
}
return flag;
}
public override void OnDeserialize(NetworkReader reader, bool initialState)
{
if (initialState)
{
rainDuration = reader.ReadSingle();
return;
}
int num = (int)reader.ReadPackedUInt32();
if (((uint)num & (true ? 1u : 0u)) != 0)
{
rainDuration = reader.ReadSingle();
}
}
}
internal class ScaleEmmissionRate : MonoBehaviour
{
public float duration;
private ParticleSystem particle;
private float fixedAge;
private AnimationCurve curve = AnimationCurve.EaseInOut(0f, 0f, 1f, 1f);
private void Start()
{
particle = ((Component)this).GetComponent<ParticleSystem>();
}
private void FixedUpdate()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
fixedAge += Time.fixedDeltaTime;
EmissionModule emission = particle.emission;
Debug.LogWarning((object)curve.Evaluate(fixedAge / duration));
((EmissionModule)(ref emission)).rateOverTimeMultiplier = curve.Evaluate(fixedAge / duration);
if (fixedAge >= duration)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
internal class Hook
{
internal static void Hooks()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: 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
RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients);
TeleporterInteraction.onTeleporterBeginChargingGlobal += TeleporterInteraction_onTeleporterBeginChargingGlobal;
HealthComponent.TakeDamage += new hook_TakeDamage(HealthComponent_TakeDamage);
Inventory.onInventoryChangedGlobal += Inventory_onInventoryChangedGlobal;
}
private static void Inventory_onInventoryChangedGlobal(Inventory inventory)
{
if (!NetworkServer.active)
{
return;
}
int itemCount = inventory.GetItemCount(Items.hourglass);
if (itemCount > 0 && Object.op_Implicit((Object)(object)((Component)inventory).GetComponent<HourglassCooldownTimer>()))
{
int num = 0;
while (num < itemCount)
{
num++;
inventory.RemoveItem(Items.hourglass, 1);
inventory.GiveItem(Items.hourglassConsumed, 1);
}
}
}
private static void HealthComponent_TakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo)
{
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, damageInfo);
if (!Object.op_Implicit((Object)(object)self.body) || !Object.op_Implicit((Object)(object)self.body.inventory) || !Object.op_Implicit((Object)(object)self.body.teamComponent) || !Object.op_Implicit((Object)(object)self.body.masterObject))
{
return;
}
Inventory inventory = self.body.inventory;
int itemCount = inventory.GetItemCount(Items.hourglass);
if (itemCount > 0 && self.isHealthLow)
{
int num = 0;
while (num < itemCount)
{
num++;
inventory.RemoveItem(Items.hourglass, 1);
inventory.GiveItem(Items.hourglassConsumed, 1);
}
self.body.masterObject.AddComponent<HourglassCooldownTimer>();
GameObject val = Object.Instantiate<GameObject>(Prefabs.stop);
HourglassBehaviour component = val.GetComponent<HourglassBehaviour>();
component.NetworkstopDuration = 5f + 2.5f * (float)(itemCount - 1);
component.team = self.body.teamComponent.teamIndex;
NetworkServer.Spawn(val);
}
}
private static void TeleporterInteraction_onTeleporterBeginChargingGlobal(TeleporterInteraction teleporter)
{
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
float num = 0f;
List<GameObject> list = new List<GameObject>();
foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances)
{
if (!Object.op_Implicit((Object)(object)instance.master) || !Object.op_Implicit((Object)(object)instance.master.inventory))
{
continue;
}
int itemCount = instance.master.inventory.GetItemCount(Items.umbrella);
if (itemCount > 0)
{
num += (float)(15 * itemCount);
}
if (num > 0f)
{
GameObject bodyObject = instance.master.GetBodyObject();
if (Object.op_Implicit((Object)(object)bodyObject))
{
list.Add(bodyObject);
}
}
}
if (list.Count <= 0)
{
return;
}
foreach (GameObject item in list)
{
if (Util.HasEffectiveAuthority(item))
{
GameObject val = Object.Instantiate<GameObject>(Prefabs.rainEffect);
val.transform.parent = item.transform;
val.transform.localPosition = Vector3.zero;
val.GetComponent<DestroyOnTimer>().duration = num;
}
}
if (NetworkServer.active)
{
GameObject val2 = Object.Instantiate<GameObject>(Prefabs.rainDot);
val2.GetComponent<RandomizedRainDot>().NetworkrainDuration = num;
NetworkServer.Spawn(val2);
}
}
private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args)
{
if (Object.op_Implicit((Object)(object)sender.inventory))
{
int itemCount = sender.inventory.GetItemCount(Items.root);
args.healthMultAdd += 0.08f * (float)itemCount;
}
}
}
internal class Items
{
internal const string Prefix = "LEGACYITEMS_";
internal static ItemDef root;
internal static ItemDef hourglass;
internal static ItemDef hourglassConsumed;
internal static ItemDef umbrella;
internal static ItemDef CreateNewItem(string name, GameObject model, ItemTier tier, UnlockableDef unlock, ItemTag[] tags, bool canRemove)
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
ItemDef val = ScriptableObject.CreateInstance<ItemDef>();
((Object)val).name = "LEGACYITEMS_" + name;
val.nameToken = "LEGACYITEMS_" + name + "_NAME";
val.descriptionToken = "LEGACYITEMS_" + name + "_DESC";
val.pickupToken = "LEGACYITEMS_" + name + "_PICKUP";
val.loreToken = "LEGACYITEMS_" + name + "_LORE";
val.deprecatedTier = tier;
val.pickupIconSprite = Assets.Load<Sprite>(name.ToLower() + "Icon");
val.pickupModelPrefab = model;
val.canRemove = canRemove;
val.hidden = false;
val.unlockableDef = unlock;
val.tags = tags;
ContentAddition.AddItemDef(val);
return val;
}
internal static void CreateItems()
{
string text = "ROOT";
LanguageAPI.Add("LEGACYITEMS_" + text + "_NAME", "Bitter Root");
LanguageAPI.Add("LEGACYITEMS_" + text + "_DESC", "Gain <style=cIsHealth>8% max hp</style> <style=cStack>(+8% per stack)</style>.");
LanguageAPI.Add("LEGACYITEMS_" + text + "_PICKUP", "Gain max hp.");
LanguageAPI.Add("LEGACYITEMS_" + text + "_LORE", "Order: Bitter Root\r\n\r\nTracking Number: 552*****\r\nEstimated Delivery: 06/04/2056\r\nShipping Method: Standard\r\nShipping Address: 103 110th, Northlake, Mars\r\nOrder Details: Biggest. Ginseng. Root. Ever.\r\nNot really, but it's pretty freackin' huge. You can boil it or sun dry it, whatever you want. I'll be curious to see if your cancer research actually pans out; sounds like voodoo magic to me, herbal medicine, but if the natives say it works, it works.\r\n");
root = CreateNewItem(text, Assets.Load<GameObject>("Assets/LegacyItemAssets/Items/BitterRoot.prefab"), (ItemTier)0, Achievements.rootUnlock, (ItemTag[])(object)new ItemTag[2]
{
(ItemTag)2,
(ItemTag)5
}, canRemove: true);
string text2 = "HOURGLASS";
LanguageAPI.Add("LEGACYITEMS_" + text2 + "_NAME", "Time Keeper's Secret");
LanguageAPI.Add("LEGACYITEMS_" + text2 + "_DESC", "Falling below <style=cIsHealth>25% health</style> <style=cIsUtility>stops time</style> for <style=cIsUtility>5s</style> <style=cStack>(+2.5s per stack)</style>. This item will be <style=cIsUtility>consumed</style> after activation and returns to it's normal state after <style=cIsUtility>5m</style> have passed.");
LanguageAPI.Add("LEGACYITEMS_" + text2 + "_PICKUP", "Stops time at low health. Consumed on use.");
LanguageAPI.Add("LEGACYITEMS_" + text2 + "_LORE", "Order: Time Keeper's Secret\r\n\r\nTracking Number: 751*****\r\nEstimated Delivery: 07/13/2056\r\nShipping Method: Priority\r\nShipping Address: 5th Ave, Limbo Road, Mars\r\nOrder Details: My old grandfather's hourglass. As the Time Keeper in the Hall of The Revered, he valued this hourglass a lot. He claimed that it would keep him safe in times of danger. For some reason, the sand never seems to run out! That's all an illusion, however. There must be some mechanism at the bottom of the hourglass that replenishes the top well. Very cute.\r\n\r\nMy old grandfather's hourglass. As the Time Keeper in the..\r\n");
GameObject model = Assets.Load<GameObject>("Assets/LegacyItemAssets/Items/TimeKeepersSecret.prefab");
ItemTag[] array = new ItemTag[6];
RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
hourglass = CreateNewItem(text2, model, (ItemTier)1, null, (ItemTag[])(object)array, canRemove: false);
string text3 = "HOURGLASSCONSUMED";
LanguageAPI.Add("LEGACYITEMS_" + text3 + "_NAME", "Time Keeper's Secret (Consumed)");
LanguageAPI.Add("LEGACYITEMS_" + text3 + "_DESC", "A spent item with no remaining power. Returns to it's original state after <style=cIsUtility>5m</style> have passed.");
LanguageAPI.Add("LEGACYITEMS_" + text3 + "_PICKUP", "A spent item with no remaining power. Returns to it's original state after <style=cIsUtility>5m</style> have passed.");
LanguageAPI.Add("LEGACYITEMS_" + text3 + "_LORE", "Order: Time Keeper's Secret\r\n\r\nTracking Number: 751*****\r\nEstimated Delivery: 07/13/2056\r\nShipping Method: Priority\r\nShipping Address: 5th Ave, Limbo Road, Mars\r\nOrder Details: My old grandfather's hourglass. As the Time Keeper in the Hall of The Revered, he valued this hourglass a lot. He claimed that it would keep him safe in times of danger. For some reason, the sand never seems to run out! That's all an illusion, however. There must be some mechanism at the bottom of the hourglass that replenishes the top well. Very cute.\r\n\r\nMy old grandfather's hourglass. As the Time Keeper in the..\r\n");
ItemTag[] array2 = new ItemTag[5];
RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
hourglassConsumed = CreateNewItem(text3, null, (ItemTier)5, null, (ItemTag[])(object)array2, canRemove: false);
string text4 = "UMBRELLA";
LanguageAPI.Add("LEGACYITEMS_" + text4 + "_NAME", "Umbrella");
LanguageAPI.Add("LEGACYITEMS_" + text4 + "_DESC", "Rain begins for <style=cIsUtility>15s</style> <style=cStack>(+15s per stack)</style> upon activating the Teleporter. Rain <style=cIsDamage>stuns</style>, deals <style=cIsDamage>3.5% max hp damage</style>, and <style=cIsDamage>weakens</style> enemies. You are <style=cIsDamage>invincible</style> while it is raining.");
LanguageAPI.Add("LEGACYITEMS_" + text4 + "_PICKUP", "Rains on starting the Teleporter event. Rain stuns, damages, and weakens enemies.");
LanguageAPI.Add("LEGACYITEMS_" + text4 + "_LORE", "Order: Umbrella\r\n\r\nTracking Number: 3489****\r\nEstimated Delivery: 08/03/2060\r\nShipping Method: Standard\r\nShipping Address: 2 Grumpy Old Men Rd, Orofino Idaho, EARTH\r\nOrder Details: Thank you for ordering the Crossplat Umbrella Infinitive! your order should arrive in 5 to 10 business years! Look forward to a drier tomorrow! Guaranteed to protect from all weather conditions from a light drizzle up to a heavy downpour*! Special Warranty period secures this product for up to 1 year, Umbrella quality only guaranteed for up to 8 seconds.\r\n");
GameObject model2 = Assets.Load<GameObject>("Assets/LegacyItemAssets/Items/Umbrella.prefab");
UnlockableDef umbrellaUnlock = Achievements.umbrellaUnlock;
ItemTag[] array3 = new ItemTag[4];
RuntimeHelpers.InitializeArray(array3, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
umbrella = CreateNewItem(text4, model2, (ItemTier)2, umbrellaUnlock, (ItemTag[])(object)array3, canRemove: true);
}
}
[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.*/)]
[BepInPlugin("com.Dragonyck.LegacyItems", "LegacyItems", "1.0.0")]
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MainPlugin : BaseUnityPlugin
{
public const string MODUID = "com.Dragonyck.LegacyItems";
public const string MODNAME = "LegacyItems";
public const string VERSION = "1.0.0";
private void Awake()
{
Assets.PopulateAssets();
Achievements.RegisterUnlockables();
Items.CreateItems();
Prefabs.CreatePrefabs();
Hook.Hooks();
}
}
internal class Prefabs
{
internal static GameObject rainDot;
internal static GameObject rainEffect;
internal static GameObject rainImpactEffect;
internal static GameObject stop;
internal static T Load<T>(string path)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return Addressables.LoadAssetAsync<T>((object)path).WaitForCompletion();
}
internal static void CreatePrefabs()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Expected O, but got Unknown
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Expected O, but got Unknown
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Expected O, but got Unknown
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Expected O, but got Unknown
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Expected O, but got Unknown
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Expected O, but got Unknown
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_0321: Unknown result type (might be due to invalid IL or missing references)
//IL_032b: Expected O, but got Unknown
Material val = Assets.Load<Material>("BitterRoot");
val.shader = Load<Shader>("RoR2/Base/Shaders/HGStandard.shader");
val.SetTexture("_NormalTex", (Texture)(object)Assets.Load<Texture2D>("BitterRoot_Normal"));
val.SetFloat("_NormalStrength", 5f);
val.EnableKeyword("CUTOUT");
GameObject val2 = new GameObject("DontDestroyOnLoad");
val2.SetActive(false);
Object.DontDestroyOnLoad((Object)(object)val2);
rainDot = new GameObject("RainDot");
rainDot.AddComponent<NetworkIdentity>();
rainDot.AddComponent<RandomizedRainDot>();
rainDot.transform.parent = val2.transform;
PrefabAPI.RegisterNetworkPrefab(rainDot);
rainEffect = PrefabAPI.InstantiateClone(Assets.Load<GameObject>("rainEffect"), "RainEffect", false);
((Renderer)rainEffect.GetComponent<ParticleSystemRenderer>()).material = Load<Material>("RoR2/Base/Common/VFX/matRain.mat");
rainEffect.AddComponent<DestroyOnTimer>();
GameObject val3 = new GameObject("PP");
val3.transform.parent = rainEffect.transform;
val3.layer = 20;
PostProcessVolume val4 = val3.AddComponent<PostProcessVolume>();
val4.profile = Object.Instantiate<PostProcessProfile>(Load<PostProcessProfile>("RoR2/Base/title/ppSceneMoon.asset"));
val4.sharedProfile = val4.profile;
val4.weight = 1f;
val4.priority = 99f;
val4.isGlobal = true;
RampFog val5 = (RampFog)val4.profile.settings[0];
((ParameterOverride<float>)(object)val5.fogIntensity).value = 1.9f;
SobelRain val6 = (SobelRain)val4.profile.settings[3];
((ParameterOverride<float>)(object)val6.outlineScale).value = 0.9f;
stop = new GameObject("StopBehaviour");
stop.AddComponent<NetworkIdentity>();
stop.AddComponent<HourglassBehaviour>();
stop.transform.parent = val2.transform;
GameObject val7 = new GameObject("PP");
val7.transform.parent = stop.transform;
val7.layer = 20;
PostProcessVolume val8 = val7.AddComponent<PostProcessVolume>();
val8.profile = Object.Instantiate<PostProcessProfile>(Load<PostProcessProfile>("RoR2/Base/title/ppLocalLightning.asset"));
val8.sharedProfile = val8.profile;
val8.weight = 1f;
val8.priority = 99f;
val8.isGlobal = true;
((ParameterOverride)((ColorGrading)val8.profile.settings[1]).colorFilter).overrideState = false;
OutsideInteractableLocker val9 = Utils.CopyComponent<OutsideInteractableLocker>(Load<GameObject>("RoR2/Base/Teleporters/Teleporter1.prefab").GetComponent<OutsideInteractableLocker>(), stop);
val9.radius = 9999999f;
((Behaviour)val9).enabled = false;
PrefabAPI.RegisterNetworkPrefab(stop);
rainImpactEffect = PrefabAPI.InstantiateClone(Load<GameObject>("RoR2/Base/Common/VFX/OmniImpactVFX.prefab"), "RainImpactEffect", false);
Object.Destroy((Object)(object)rainImpactEffect.GetComponent<OmniEffect>());
ParticleSystemRenderer[] componentsInChildren = rainImpactEffect.GetComponentsInChildren<ParticleSystemRenderer>(true);
foreach (ParticleSystemRenderer val10 in componentsInChildren)
{
((Component)val10).gameObject.SetActive(true);
((Renderer)val10).material = new Material(((Renderer)val10).material);
((Renderer)val10).material.DisableKeyword("VERTEXCOLOR");
((Renderer)val10).material.SetTexture("_RemapTex", (Texture)(object)Load<Texture2D>("RoR2/Base/Common/ColorRamps/texRampWispSoul.png"));
}
ContentAddition.AddEffect(rainImpactEffect);
}
}
internal class Sounds
{
public static readonly uint Play_LegacyItems_Thunder = 936056574u;
public static readonly uint Play_LegacyItems_TimeStop = 2619352211u;
public static readonly uint Play_LegacyItems_Rain = 2710238298u;
public static readonly uint Play_LegacyItems_TimeBack = 2889813234u;
}
internal static class Extensions
{
public static GameObject NewSyringe(this GameObject g, params Material[] m)
{
((Renderer)g.GetComponentsInChildren<MeshRenderer>(false)[0]).material = m[0];
((Renderer)g.GetComponent<TrailRenderer>()).material = m[1];
((Renderer)g.GetComponent<ParticleSystemRenderer>()).material = m[2];
return g;
}
public static Material SwapTexture(this Material m, Texture2D t)
{
m.mainTexture = (Texture)(object)t;
return m;
}
public static GameObject SwapMaterials(this GameObject g, Material[] m)
{
Renderer[] componentsInChildren = g.GetComponentsInChildren<Renderer>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
if (Object.op_Implicit((Object)(object)m[i]))
{
componentsInChildren[i].material = m[i];
}
}
return g;
}
public static float Mult(this float f, float mult = 100f)
{
return f * mult;
}
public static Color ToRGB255(this Color c, string title, string body)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
return new Color(c.r / 255f, c.g / 255f, c.b / 255f);
}
public static void SetStrings(this TooltipProvider t, string title, string body)
{
t.overrideTitleText = title;
t.overrideBodyText = body;
}
}
internal class Utils
{
public static EntityStateMachine NewStateMachine<T>(GameObject obj, string customName) where T : EntityState
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: 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)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
SerializableEntityStateType val = default(SerializableEntityStateType);
((SerializableEntityStateType)(ref val))..ctor(typeof(T));
EntityStateMachine val2 = obj.AddComponent<EntityStateMachine>();
val2.customName = customName;
val2.initialStateType = val;
val2.mainStateType = val;
return val2;
}
public static GenericSkill NewGenericSkill(GameObject obj, SkillDef skill)
{
//IL_0031: 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_0053: Expected O, but got Unknown
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
GenericSkill val = obj.AddComponent<GenericSkill>();
SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>();
val2.variants = (Variant[])(object)new Variant[1];
val._skillFamily = val2;
SkillFamily skillFamily = val.skillFamily;
Variant[] variants = skillFamily.variants;
Variant val3 = new Variant
{
skillDef = skill
};
((Variant)(ref val3)).viewableNode = new Node(skill.skillNameToken, false, (Node)null);
variants[0] = val3;
ContentAddition.AddSkillFamily(skillFamily);
return val;
}
public static void AddAlt(SkillFamily skillFamily, SkillDef SkillDef)
{
//IL_0029: 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
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1);
Variant[] variants = skillFamily.variants;
int num = skillFamily.variants.Length - 1;
Variant val = new Variant
{
skillDef = SkillDef
};
((Variant)(ref val)).viewableNode = new Node(SkillDef.skillNameToken, false, (Node)null);
variants[num] = val;
}
public static BuffDef NewBuffDef(string name, bool stack, bool hidden, Sprite sprite, Color color)
{
//IL_0025: 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)
BuffDef val = ScriptableObject.CreateInstance<BuffDef>();
((Object)val).name = name;
val.canStack = stack;
val.isHidden = hidden;
val.iconSprite = sprite;
val.buffColor = color;
ContentAddition.AddBuffDef(val);
return val;
}
public static ObjectScaleCurve AddScaleComponent(GameObject target, float timeMax)
{
ObjectScaleCurve val = target.AddComponent<ObjectScaleCurve>();
val.useOverallCurveOnly = true;
val.timeMax = timeMax;
val.overallCurve = AnimationCurve.Linear(0f, 0f, 1f, 1f);
return val;
}
public static RotateAroundAxis AddRotationComponent(GameObject target, float speed, RotationAxis axis)
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
RotateAroundAxis val = target.AddComponent<RotateAroundAxis>();
val.speed = (Speed)2;
val.fastRotationSpeed = speed;
val.rotateAroundAxis = axis;
return val;
}
public static GameObject NewDisplayModel(GameObject model, string name)
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Expected O, but got Unknown
GameObject val = PrefabAPI.InstantiateClone(model, name, false);
val.GetComponentInChildren<Animator>().runtimeAnimatorController = Assets.Load<RuntimeAnimatorController>("displayAnimator");
RendererInfo[] baseRendererInfos = val.GetComponentInChildren<CharacterModel>().baseRendererInfos;
for (int i = 0; i < baseRendererInfos.Length; i++)
{
baseRendererInfos[i].defaultMaterial = new Material(baseRendererInfos[i].defaultMaterial);
baseRendererInfos[i].defaultMaterial.DisableKeyword("_DITHER");
}
return val;
}
internal static Sprite CreateSprite(Texture2D tex)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
return Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0.5f, 0.5f), 128f);
}
internal static SkinDefInfo CreateNewSkinDefInfo(SkinnedMeshRenderer[] childList, GameObject rootObject, string skinName, string objectToEnable, RendererInfo[] rendererInfos)
{
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: 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_00da: 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)
SkinDefInfo result = default(SkinDefInfo);
result.BaseSkins = Array.Empty<SkinDef>();
result.MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0];
result.ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0];
List<GameObjectActivation> list = new List<GameObjectActivation>();
foreach (SkinnedMeshRenderer val in childList)
{
GameObjectActivation val2 = default(GameObjectActivation);
val2.gameObject = ((Component)val).gameObject;
val2.shouldActivate = ((Object)val).name == objectToEnable;
GameObjectActivation item = val2;
list.Add(item);
}
result.GameObjectActivations = list.ToArray();
result.Icon = Assets.MainAssetBundle.LoadAsset<Sprite>(objectToEnable);
result.MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0];
result.Name = skinName;
result.NameToken = skinName;
result.RendererInfos = rendererInfos;
result.RootObject = rootObject;
result.UnlockableDef = null;
return result;
}
internal static T CopyComponent<T>(T original, GameObject destination) where T : Component
{
Type type = ((object)original).GetType();
Component val = destination.AddComponent(type);
FieldInfo[] fields = type.GetFields();
FieldInfo[] array = fields;
foreach (FieldInfo fieldInfo in array)
{
fieldInfo.SetValue(val, fieldInfo.GetValue(original));
}
return (T)(object)((val is T) ? val : null);
}
public static Sprite CreateSpriteFromTexture(Texture2D texture)
{
//IL_0025: 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)
if (Object.op_Implicit((Object)(object)texture))
{
return Sprite.Create(texture, new Rect(0f, 0f, (float)((Texture)texture).width, (float)((Texture)texture).height), new Vector2(0.5f, 0.5f));
}
return null;
}
public static GameObject FindInActiveObjectByName(string name)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Invalid comparison between Unknown and I4
Transform[] array = Resources.FindObjectsOfTypeAll<Transform>();
for (int i = 0; i < array.Length; i++)
{
if ((int)((Object)array[i]).hideFlags == 0 && ((Object)array[i]).name == name)
{
return ((Component)array[i]).gameObject;
}
}
return null;
}
public static GameObject CreateHitbox(string name, Transform parent, Vector3 scale)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_001b: 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_003d: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name);
val.transform.SetParent(parent);
val.transform.localPosition = Vector3.zero;
val.transform.localRotation = Quaternion.identity;
val.transform.localScale = scale;
HitBoxGroup val2 = ((Component)parent).gameObject.AddComponent<HitBoxGroup>();
HitBox val3 = val.AddComponent<HitBox>();
val.layer = LayerIndex.projectile.intVal;
val2.hitBoxes = (HitBox[])(object)new HitBox[1] { val3 };
val2.groupName = name;
return val;
}
internal static EffectComponent RegisterEffect(GameObject effect, float duration, string soundName = "", bool parentToReferencedTransform = true, bool positionAtReferencedTransform = true)
{
//IL_00a6: 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)
EffectComponent val = effect.GetComponent<EffectComponent>();
if (!Object.op_Implicit((Object)(object)val))
{
val = effect.AddComponent<EffectComponent>();
}
if (duration != -1f)
{
DestroyOnTimer component = effect.GetComponent<DestroyOnTimer>();
if (!Object.op_Implicit((Object)(object)component))
{
effect.AddComponent<DestroyOnTimer>().duration = duration;
}
else
{
component.duration = duration;
}
}
if (!Object.op_Implicit((Object)(object)effect.GetComponent<NetworkIdentity>()))
{
effect.AddComponent<NetworkIdentity>();
}
if (!Object.op_Implicit((Object)(object)effect.GetComponent<VFXAttributes>()))
{
effect.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
}
val.applyScale = false;
val.effectIndex = (EffectIndex)(-1);
val.parentToReferencedTransform = parentToReferencedTransform;
val.positionAtReferencedTransform = positionAtReferencedTransform;
val.soundName = soundName;
ContentAddition.AddEffect(effect);
return val;
}
public static Material InstantiateMaterial(Texture tex)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
Material val = Object.Instantiate<Material>(Prefabs.Load<Material>("RoR2/Base/Commando/matCommandoDualies.mat"));
if (Object.op_Implicit((Object)(object)val))
{
val.SetColor("_Color", Color.white);
val.SetTexture("_MainTex", tex);
val.SetColor("_EmColor", Color.black);
val.SetFloat("_EmPower", 0f);
val.SetTexture("_EmTex", (Texture)null);
val.SetFloat("_NormalStrength", 1f);
val.SetTexture("_NormalTex", (Texture)null);
return val;
}
return val;
}
public static Material InstantiateMaterial(Color color, Texture tex, Color emColor, float emPower, Texture emTex, float normStr, Texture normTex)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
Material val = Object.Instantiate<Material>(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<CharacterModel>().baseRendererInfos[0].defaultMaterial);
if (Object.op_Implicit((Object)(object)val))
{
val.SetColor("_Color", color);
val.SetTexture("_MainTex", tex);
val.SetColor("_EmColor", emColor);
val.SetFloat("_EmPower", emPower);
val.SetTexture("_EmTex", emTex);
val.SetFloat("_NormalStrength", 1f);
val.SetTexture("_NormalTex", normTex);
return val;
}
return val;
}
public static Material FindMaterial(string name)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Invalid comparison between Unknown and I4
Material[] array = Resources.FindObjectsOfTypeAll<Material>();
for (int i = 0; i < array.Length; i++)
{
if ((int)((Object)array[i]).hideFlags == 0 && ((Object)array[i]).name == name)
{
return array[i];
}
}
return null;
}
}