using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
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 BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EmotesAPI;
using EntityStates;
using EntityStates.AI.Walker;
using EntityStates.Commando;
using EntityStates.Commando.CommandoWeapon;
using EntityStates.Huntress;
using HG;
using HG.BlendableTypes;
using JetBrains.Annotations;
using KinematicCharacterController;
using Newtonsoft.Json.Utilities;
using On.RoR2;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using R2API.Utils;
using RifterMod.Characters.Survivors.NemRifter.Components;
using RifterMod.Characters.Survivors.NemRifter.Components.Old;
using RifterMod.Characters.Survivors.NemRifter.SkillStates;
using RifterMod.Characters.Survivors.NemRifter.SkillStates.Old;
using RifterMod.Characters.Survivors.NemRifter.SkillStates.RiftZone;
using RifterMod.Characters.Survivors.Rifter.Components;
using RifterMod.Characters.Survivors.Rifter.SkillStates;
using RifterMod.Modules;
using RifterMod.Modules.Achievements;
using RifterMod.Modules.BaseStates;
using RifterMod.Modules.Characters;
using RifterMod.Modules.Networking;
using RifterMod.Survivors.NemRifter;
using RifterMod.Survivors.NemRifter.Components;
using RifterMod.Survivors.NemRifter.SkillStates;
using RifterMod.Survivors.Rifter;
using RifterMod.Survivors.Rifter.SkillStates;
using RiskOfOptions;
using RiskOfOptions.Options;
using RoR2;
using RoR2.Achievements;
using RoR2.Audio;
using RoR2.CharacterAI;
using RoR2.ContentManagement;
using RoR2.Projectile;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering;
using UnityEngine.UI;
using UnityEngine.UIElements.Experimental;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("RifterMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+273c2d2435a37172c5881c10393632bb11c938a4")]
[assembly: AssemblyProduct("RifterMod")]
[assembly: AssemblyTitle("RifterMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
public static class NemRifterDamage
{
internal static ModdedDamageType instabilityTriggerDamage;
internal static ModdedDamageType instabilityProcDamage;
internal static void SetupModdedDamage()
{
//IL_0000: 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)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
instabilityTriggerDamage = DamageAPI.ReserveDamageType();
instabilityProcDamage = DamageAPI.ReserveDamageType();
}
}
public static class RifterDamage
{
internal static ModdedDamageType riftDamage;
internal static ModdedDamageType riftSuperDamage;
internal static void SetupModdedDamage()
{
//IL_0000: 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)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
riftDamage = DamageAPI.ReserveDamageType();
riftSuperDamage = DamageAPI.ReserveDamageType();
}
}
internal class AirBourneOut : BaseState
{
private HurtBoxGroup hurtboxGroup;
private float duration = 0.5f;
private float stopwatch;
public override void OnEnter()
{
((BaseState)this).OnEnter();
if (Object.op_Implicit((Object)(object)hurtboxGroup))
{
HurtBoxGroup obj = hurtboxGroup;
int hurtBoxesDeactivatorCounter = obj.hurtBoxesDeactivatorCounter + 1;
obj.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter;
}
}
public override void FixedUpdate()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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)
((EntityState)this).FixedUpdate();
stopwatch += Time.fixedDeltaTime;
if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
{
((EntityState)this).characterMotor.velocity = Vector3.zero;
}
if (Object.op_Implicit((Object)(object)((EntityState)this).rigidbodyMotor))
{
((EntityState)this).rigidbodyMotor.moveVector = Vector3.zero;
}
if (stopwatch >= duration && ((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void OnExit()
{
if (Object.op_Implicit((Object)(object)hurtboxGroup))
{
HurtBoxGroup obj = hurtboxGroup;
int hurtBoxesDeactivatorCounter = obj.hurtBoxesDeactivatorCounter - 1;
obj.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter;
}
((EntityState)this).OnExit();
}
public override InterruptPriority GetMinimumInterruptPriority()
{
return (InterruptPriority)1;
}
}
public class FaultLine : RiftBase
{
public float stopwatch;
public override void OnEnter()
{
//IL_001d: 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_003d: 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)
fractureHitCallback = false;
isPrimary = false;
usesOvercharge = true;
shouldBuckshot = false;
Ray aimRay = ((BaseState)this).GetAimRay();
baseDuration = 0.2f;
base.OnEnter();
if (((EntityState)this).isAuthority)
{
Fracture(aimRay, RiftDistance(), LayerIndex.defaultLayer, (DamageSource)2);
}
TeleportEnemies();
}
public override void FixedUpdate()
{
base.FixedUpdate();
stopwatch += Time.fixedDeltaTime;
if (stopwatch >= duration && ((EntityState)this).isAuthority)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void OnExit()
{
base.OnExit();
}
public override InterruptPriority GetMinimumInterruptPriority()
{
return (InterruptPriority)1;
}
public override float RiftDistance()
{
return 500f;
}
public override bool IsOvercharged()
{
return true;
}
public override Vector3 GetTeleportLocation(CharacterBody body)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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_00f2: 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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//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_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
if (rifterStep.deployedList.Count > 0)
{
return rifterStep.deployedList.FirstOrDefault().transform.position + Vector3.up * 0.5f;
}
Ray aimRay = ((BaseState)this).GetAimRay();
Vector3 result = ((Ray)(ref aimRay)).GetPoint(45f);
aimRay = ((BaseState)this).GetAimRay();
Vector3 origin = ((Ray)(ref aimRay)).origin;
aimRay = ((BaseState)this).GetAimRay();
RaycastHit val = default(RaycastHit);
if (Physics.SphereCast(origin, 0.05f, ((Ray)(ref aimRay)).direction, ref val, 45f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)2))
{
bool num = Vector3.Angle(Vector3.up, ((RaycastHit)(ref val)).normal) < maxSlopeAngle;
if (num)
{
result = ((RaycastHit)(ref val)).point + Vector3.up * 0.5f;
}
if (!num)
{
Vector3 point = ((RaycastHit)(ref val)).point;
aimRay = ((BaseState)this).GetAimRay();
Vector3 direction = ((Ray)(ref aimRay)).direction;
result = point - ((Vector3)(ref direction)).normalized;
}
}
return result;
}
}
public class FractureShot : RiftBase
{
public float stopwatch;
public int shotNum;
public int shotMax = 3;
public override void OnEnter()
{
//IL_001d: 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_003d: 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)
fractureHitCallback = false;
isPrimary = false;
usesOvercharge = true;
shouldBuckshot = false;
Ray aimRay = ((BaseState)this).GetAimRay();
baseDuration = 0.8f;
base.OnEnter();
if (((EntityState)this).isAuthority)
{
Fracture(aimRay, RiftDistance(), LayerIndex.noCollision, (DamageSource)2);
}
TeleportEnemies();
shotNum++;
}
public override void FixedUpdate()
{
base.FixedUpdate();
stopwatch += Time.fixedDeltaTime;
if (stopwatch >= duration / 4f && ((EntityState)this).isAuthority)
{
if (shotNum < shotMax)
{
((EntityState)this).outer.SetNextState((EntityState)(object)new FractureShot
{
shotNum = shotNum,
shotMax = shotMax
});
}
else
{
((EntityState)this).outer.SetNextStateToMain();
}
}
}
public override void OnExit()
{
base.OnExit();
}
public override InterruptPriority GetMinimumInterruptPriority()
{
return (InterruptPriority)1;
}
public override float RiftDistance()
{
return 500f;
}
public override bool IsOvercharged()
{
return true;
}
public override Vector3 GetTeleportLocation(CharacterBody body)
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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_00f2: 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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//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_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
if (rifterStep.deployedList.Count > 0)
{
return rifterStep.deployedList.FirstOrDefault().transform.position + Vector3.up * 0.5f;
}
Ray aimRay = ((BaseState)this).GetAimRay();
Vector3 result = ((Ray)(ref aimRay)).GetPoint(45f);
aimRay = ((BaseState)this).GetAimRay();
Vector3 origin = ((Ray)(ref aimRay)).origin;
aimRay = ((BaseState)this).GetAimRay();
RaycastHit val = default(RaycastHit);
if (Physics.SphereCast(origin, 0.05f, ((Ray)(ref aimRay)).direction, ref val, 45f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)2))
{
bool num = Vector3.Angle(Vector3.up, ((RaycastHit)(ref val)).normal) < maxSlopeAngle;
if (num)
{
result = ((RaycastHit)(ref val)).point + Vector3.up * 0.5f;
}
if (!num)
{
Vector3 point = ((RaycastHit)(ref val)).point;
aimRay = ((BaseState)this).GetAimRay();
Vector3 direction = ((Ray)(ref aimRay)).direction;
result = point - ((Vector3)(ref direction)).normalized;
}
}
return result;
}
}
public class ModifiedTeleport : BaseState
{
public Vector3 initialPosition;
public Vector3 currentPosition;
public Vector3 targetFootPosition;
public GameObject attackerAndInflictor;
private Transform modelTransform;
private CharacterModel characterModel;
private HurtBoxGroup hurtboxGroup;
private float duration;
private bool hasSnapped;
public bool isPortalTeleport;
private GameObject inEffect = RifterAssets.slipstreamInEffect;
private GameObject outEffect = RifterAssets.slipstreamOutEffect;
public static GameObject tracerEffectPrefabOvercharged = RifterAssets.fractureLineTracerOvercharged;
public bool showEffect;
public float stopwatch;
public float teleportTimer;
public float teleportWaitDuration;
public bool teleportOut;
public float damageOutput;
public override void OnEnter()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Expected O, but got Unknown
//IL_0106: 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)
//IL_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: 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_012f: 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_013b: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
((BaseState)this).OnEnter();
initialPosition = ((EntityState)this).characterBody.corePosition;
modelTransform = ((EntityState)this).GetModelTransform();
if (Object.op_Implicit((Object)(object)modelTransform))
{
characterModel = ((Component)modelTransform).GetComponent<CharacterModel>();
hurtboxGroup = ((Component)modelTransform).GetComponent<HurtBoxGroup>();
}
if (Object.op_Implicit((Object)(object)characterModel))
{
CharacterModel obj = characterModel;
int invisibilityCount = obj.invisibilityCount;
obj.invisibilityCount = invisibilityCount + 1;
}
if (Object.op_Implicit((Object)(object)hurtboxGroup))
{
HurtBoxGroup obj2 = hurtboxGroup;
int hurtBoxesDeactivatorCounter = obj2.hurtBoxesDeactivatorCounter + 1;
obj2.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter;
}
CalculateSnapDestination();
if (isPortalTeleport && NetworkServer.active)
{
((EntityState)this).characterBody.AddTimedBuff(RifterBuffs.postTeleport, 2f);
}
if (!showEffect)
{
EffectData val = new EffectData
{
origin = ((EntityState)this).characterBody.corePosition,
scale = ((EntityState)this).characterBody.radius * 2.5f
};
EffectManager.SpawnEffect(inEffect, val, true);
new BulletAttack
{
damage = 0f,
origin = initialPosition,
aimVector = targetFootPosition - initialPosition,
maxDistance = Vector3.Distance(initialPosition, targetFootPosition),
tracerEffectPrefab = tracerEffectPrefabOvercharged
}.Fire();
}
}
public override 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)
//IL_002d: 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)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).FixedUpdate();
if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
{
((EntityState)this).characterMotor.velocity = Vector3.zero;
}
if (!hasSnapped)
{
SetPosition(Vector3.Lerp(currentPosition, targetFootPosition, ((EntityState)this).fixedAge / duration));
}
if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority)
{
hasSnapped = true;
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void OnExit()
{
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Expected O, but got Unknown
if (!((EntityState)this).outer.destroying)
{
modelTransform = ((EntityState)this).GetModelTransform();
if (Object.op_Implicit((Object)(object)modelTransform) && showEffect)
{
TemporaryOverlayInstance obj = TemporaryOverlayManager.AddOverlay(((Component)modelTransform).gameObject);
obj.duration = 0.6f;
obj.animateShaderAlpha = true;
obj.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
obj.destroyComponentOnEnd = true;
obj.originalMaterial = RifterAssets.matTeleport;
obj.AddToCharacterModel(((Component)modelTransform).GetComponent<CharacterModel>());
}
}
if (Object.op_Implicit((Object)(object)characterModel))
{
CharacterModel obj2 = characterModel;
int invisibilityCount = obj2.invisibilityCount;
obj2.invisibilityCount = invisibilityCount - 1;
}
if (Object.op_Implicit((Object)(object)hurtboxGroup))
{
HurtBoxGroup obj3 = hurtboxGroup;
int hurtBoxesDeactivatorCounter = obj3.hurtBoxesDeactivatorCounter - 1;
obj3.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter;
}
if (!showEffect)
{
EffectData val = new EffectData
{
origin = targetFootPosition,
scale = ((EntityState)this).characterBody.radius * 5f
};
EffectManager.SpawnEffect(outEffect, val, true);
}
((EntityState)this).OnExit();
}
public override InterruptPriority GetMinimumInterruptPriority()
{
return (InterruptPriority)7;
}
private void SetPosition(Vector3 newPosition)
{
//IL_0018: 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_003c: 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)
if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
{
((BaseCharacterController)((EntityState)this).characterMotor).Motor.SetPositionAndRotation(newPosition, Quaternion.identity, true);
}
if (Object.op_Implicit((Object)(object)((EntityState)this).rigidbodyMotor))
{
((Component)((EntityState)this).rigidbodyMotor).transform.SetPositionAndRotation(newPosition, Quaternion.identity);
}
}
private void CalculateSnapDestination()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: 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)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0066: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((EntityState)this).characterDirection != (Object)null)
{
((EntityState)this).characterDirection.forward = targetFootPosition;
}
else
{
((EntityState)this).transform.rotation = Util.QuaternionSafeLookRotation(targetFootPosition);
}
_ = ((EntityState)this).characterBody.footPosition;
currentPosition = ((EntityState)this).characterBody.footPosition;
Vector3 val = currentPosition - targetFootPosition;
duration = ((Vector3)(ref val)).magnitude;
duration = Util.Remap(duration, 0f, 100f, 0.1f, 0.25f);
}
public override void OnSerialize(NetworkWriter writer)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).OnSerialize(writer);
writer.Write(targetFootPosition);
writer.Write(currentPosition);
}
public override void OnDeserialize(NetworkReader reader)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
((EntityState)this).OnDeserialize(reader);
targetFootPosition = reader.ReadVector3();
currentPosition = reader.ReadVector3();
}
}
public class RifterMain : GenericCharacterMain
{
private RifterTracker rifterTracker;
public override void OnEnter()
{
((GenericCharacterMain)this).OnEnter();
rifterTracker = ((EntityState)this).GetComponent<RifterTracker>();
}
public override void OnExit()
{
((GenericCharacterMain)this).OnExit();
}
public override InterruptPriority GetMinimumInterruptPriority()
{
return (InterruptPriority)0;
}
}
public class ModifiedTeleportOld : BaseState
{
public Vector3 initialPosition;
public Vector3 targetFootPosition;
public GameObject attackerAndInflictor;
private Transform modelTransform;
private CharacterModel characterModel;
private HurtBoxGroup hurtboxGroup;
private GameObject inEffect = RifterAssets.slipstreamInEffect;
private GameObject outEffect = RifterAssets.slipstreamOutEffect;
public static GameObject tracerEffectPrefabOvercharged = RifterAssets.fractureLineTracerOvercharged;
public bool showEffect;
public float stopwatch;
public float teleportTimer;
public float teleportWaitDuration;
public bool teleportOut;
public float damageOutput;
public override void OnEnter()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: 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_00c4: 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_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Expected O, but got Unknown
//IL_00fa: 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_010a: 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_0116: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: 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_0123: 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_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
((BaseState)this).OnEnter();
initialPosition = ((EntityState)this).characterBody.corePosition;
modelTransform = ((EntityState)this).GetModelTransform();
if (Object.op_Implicit((Object)(object)modelTransform))
{
characterModel = ((Component)modelTransform).GetComponent<CharacterModel>();
hurtboxGroup = ((Component)modelTransform).GetComponent<HurtBoxGroup>();
}
if (Object.op_Implicit((Object)(object)characterModel))
{
CharacterModel obj = characterModel;
int invisibilityCount = obj.invisibilityCount;
obj.invisibilityCount = invisibilityCount + 1;
}
if (Object.op_Implicit((Object)(object)hurtboxGroup))
{
HurtBoxGroup obj2 = hurtboxGroup;
int hurtBoxesDeactivatorCounter = obj2.hurtBoxesDeactivatorCounter + 1;
obj2.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter;
}
if (((EntityState)this).characterBody.hasEffectiveAuthority)
{
TeleportHelper.TeleportBody(((EntityState)this).characterBody, targetFootPosition);
}
if (!showEffect)
{
EffectData val = new EffectData
{
origin = ((EntityState)this).characterBody.corePosition,
scale = ((EntityState)this).characterBody.radius * 2.5f
};
EffectManager.SpawnEffect(inEffect, val, true);
new BulletAttack
{
damage = 0f,
origin = initialPosition,
aimVector = targetFootPosition - initialPosition,
maxDistance = Vector3.Distance(initialPosition, targetFootPosition),
tracerEffectPrefab = tracerEffectPrefabOvercharged
}.Fire();
}
}
public override void FixedUpdate()
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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)
((EntityState)this).FixedUpdate();
stopwatch += Time.fixedDeltaTime;
if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor))
{
((EntityState)this).characterMotor.velocity = Vector3.zero;
}
if (Object.op_Implicit((Object)(object)((EntityState)this).rigidbodyMotor))
{
((EntityState)this).rigidbodyMotor.moveVector = Vector3.zero;
}
if (((EntityState)this).isAuthority && stopwatch >= teleportWaitDuration)
{
((EntityState)this).outer.SetNextStateToMain();
}
}
public override void OnExit()
{
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: 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_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: 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_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: 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_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: 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_0161: 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_016c: Expected O, but got Unknown
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Expected O, but got Unknown
if (!((EntityState)this).outer.destroying)
{
modelTransform = ((EntityState)this).GetModelTransform();
if (Object.op_Implicit((Object)(object)modelTransform) && showEffect)
{
TemporaryOverlayInstance obj = TemporaryOverlayManager.AddOverlay(((Component)modelTransform).gameObject);
obj.duration = 0.6f;
obj.animateShaderAlpha = true;
obj.alphaCurve = AnimationCurve.EaseInOut(0f, 1f, 1f, 0f);
obj.destroyComponentOnEnd = true;
obj.originalMaterial = RifterAssets.matTeleport;
obj.AddToCharacterModel(((Component)modelTransform).GetComponent<CharacterModel>());
}
}
if (Object.op_Implicit((Object)(object)characterModel))
{
CharacterModel obj2 = characterModel;
int invisibilityCount = obj2.invisibilityCount;
obj2.invisibilityCount = invisibilityCount - 1;
}
if (Object.op_Implicit((Object)(object)hurtboxGroup))
{
HurtBoxGroup obj3 = hurtboxGroup;
int hurtBoxesDeactivatorCounter = obj3.hurtBoxesDeactivatorCounter - 1;
obj3.hurtBoxesDeactivatorCounter = hurtBoxesDeactivatorCounter;
}
if (((EntityState)this).isAuthority)
{
BlastAttack val = new BlastAttack
{
attacker = attackerAndInflictor,
inflictor = attackerAndInflictor,
teamIndex = (TeamIndex)1,
radius = ((EntityState)this).characterBody.radius,
falloffModel = (FalloffModel)0,
baseDamage = damageOutput,
crit = ((BaseState)this).RollCrit(),
procCoefficient = 0.8f,
canRejectForce = false,
position = ((EntityState)this).transform.position,
attackerFiltering = (AttackerFiltering)3
};
DamageAPI.AddModdedDamageType(val, RifterDamage.riftDamage);
val.Fire();
}
if (!showEffect)
{
EffectData val2 = new EffectData
{
origin = targetFootPosition,
scale = ((EntityState)this).characterBody.radius * 5f
};
EffectManager.SpawnEffect(outEffect, val2, true);
}
((EntityState)this).OnExit();
}
public override InterruptPriority GetMinimumInterruptPriority()
{
return (InterruptPriority)7;
}
}
public class RiftRiderOut : ModifiedTeleport
{
private new float stopwatch;
public bool isResults;
public override void FixedUpdate()
{
base.FixedUpdate();
stopwatch += Time.fixedDeltaTime;
if (stopwatch > teleportWaitDuration && ((EntityState)this).isAuthority)
{
if (!((EntityState)this).characterMotor.isGrounded && isResults)
{
((EntityState)this).outer.SetNextState((EntityState)(object)new AirBourneOut());
}
else
{
((EntityState)this).outer.SetNextStateToMain();
}
}
}
}
namespace RifterMod
{
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 ErrorAssetBundle(string assetName, string bundleName)
{
Error("failed to load asset, " + assetName + ", because it does not exist in asset bundle, " + bundleName);
}
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);
}
}
[NetworkCompatibility(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.blake.RifterMod", "RifterMod", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class RifterPlugin : BaseUnityPlugin
{
public const string MODUID = "com.blake.RifterMod";
public const string MODNAME = "RifterMod";
public const string MODVERSION = "1.0.0";
public const string DEVELOPER_PREFIX = "BLAKE";
public static RifterPlugin instance;
public static BodyIndex rifterIndex;
public static BodyIndex nemRifterIndex;
public static GameObject hudInstance;
public static List<BodyIndex> blacklist = new List<BodyIndex>();
public static List<string> blacklistBodyNames = new List<string> { "MinorConstructBody(Clone)", "VoidBarnacleBody(Clone)" };
public static bool ScepterInstalled;
public static bool riskOfOptionsLoaded;
private void Awake()
{
instance = this;
Log.Init(((BaseUnityPlugin)this).Logger);
Language.Init();
if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
{
riskOfOptionsLoaded = true;
}
NetworkingAPI.RegisterMessageType<TeleportOnBodyRequest>();
NetworkingAPI.RegisterMessageType<AddGameObjectOnRequest>();
new RifterSurvivor().Initialize();
new ContentPacks().Initialize();
Hook();
}
public void Start()
{
if (riskOfOptionsLoaded)
{
SetupRifterPlugin();
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private void SetupRifterPlugin()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Expected O, but got Unknown
if (riskOfOptionsLoaded)
{
ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(RifterConfig.cursed));
}
}
private static void Hook()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Expected O, but got Unknown
BodyCatalog.Init += new hook_Init(BodyCatalog_Init);
GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(GlobalEventManager_OnHitEnemy);
CharacterBody.RecalculateStats += new hook_RecalculateStats(CharacterBody_RecalculateStats);
CharacterBody.OnBuffFinalStackLost += new hook_OnBuffFinalStackLost(CharacterBody_OnBuffFinalStackLost);
CharacterBody.UpdateAllTemporaryVisualEffects += new hook_UpdateAllTemporaryVisualEffects(CharacterBody_UpdateAllTemporaryVisualEffects);
GlobalEventManager.OnCharacterDeath += new hook_OnCharacterDeath(GlobalEventManager_OnCharacterDeath);
if (Chainloader.PluginInfos.ContainsKey("com.weliveinasociety.CustomEmotesAPI"))
{
SurvivorCatalog.Init += new hook_Init(SurvivorCatalog_Init);
}
}
private static void GlobalEventManager_OnCharacterDeath(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport)
{
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
CharacterBody body = damageReport.victim.body;
if ((Object)(object)body != (Object)null)
{
int buffCount = body.GetBuffCount(NemRifterBuffs.instabilityDebuff);
if (buffCount > 0)
{
NemRifterOwnerHolder component = ((Component)body).gameObject.GetComponent<NemRifterOwnerHolder>();
if ((Object)(object)component.owner != (Object)null)
{
float radius = buffCount;
float num = (((float)buffCount + 5f > 30f) ? 30f : ((float)buffCount + 5f));
GameObject obj = Object.Instantiate<GameObject>(NemRifterAssets.riftZonePillar, body.corePosition, Util.QuaternionSafeLookRotation(Vector3.forward));
obj.GetComponent<DestroyOnTimer>().duration = num;
obj.GetComponent<GenericOwnership>().ownerObject = component.owner;
obj.GetComponent<TeamFilter>().teamIndex = (TeamIndex)1;
((Component)obj.transform.GetChild(0)).GetComponent<TeamFilter>().teamIndex = (TeamIndex)1;
BuffWard component2 = ((Component)obj.transform.GetChild(0)).GetComponent<BuffWard>();
if ((Object)(object)component2 != (Object)null)
{
component2.radius = radius;
component2.buffDef = NemRifterBuffs.negateDebuff;
component2.expireDuration = num;
}
NetworkServer.Spawn(obj);
}
}
}
orig.Invoke(self, damageReport);
}
private static void CharacterMaster_OnBodyStart(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: 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_003f: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, body);
if (body.bodyIndex == nemRifterIndex && NetworkServer.active)
{
float radius = 40f;
float num = 30f;
GameObject obj = Object.Instantiate<GameObject>(NemRifterAssets.riftZonePillar, body.corePosition, body.transform.rotation);
obj.GetComponent<DestroyOnTimer>().duration = num;
obj.GetComponent<GenericOwnership>().ownerObject = ((Component)self).gameObject;
obj.GetComponent<TeamFilter>().teamIndex = (TeamIndex)1;
((Component)obj.transform.GetChild(0)).GetComponent<TeamFilter>().teamIndex = (TeamIndex)1;
BuffWard component = ((Component)obj.transform.GetChild(0)).GetComponent<BuffWard>();
if ((Object)(object)component != (Object)null)
{
component.radius = radius;
component.buffDef = NemRifterBuffs.negateDebuff;
component.expireDuration = num;
}
NetworkServer.Spawn(obj);
}
}
private static void CharacterBody_UpdateAllTemporaryVisualEffects(orig_UpdateAllTemporaryVisualEffects orig, CharacterBody self)
{
orig.Invoke(self);
TemporaryVisualEffect val = null;
self.UpdateSingleTemporaryVisualEffect(ref val, RifterAssets.shatterStackVisual, self.radius, self.HasBuff(RifterBuffs.superShatterDebuff), "");
}
private static void SurvivorCatalog_Init(orig_Init orig)
{
orig.Invoke();
foreach (SurvivorDef allSurvivorDef in SurvivorCatalog.allSurvivorDefs)
{
if (((Object)allSurvivorDef.bodyPrefab).name == "RifterBody")
{
GameObject emoteSkele = RifterAssets.emoteSkele;
CustomEmotesAPI.ImportArmature(allSurvivorDef.bodyPrefab, emoteSkele, 0, true);
}
}
}
private static void CharacterBody_OnBuffFinalStackLost(orig_OnBuffFinalStackLost orig, CharacterBody self, BuffDef buffDef)
{
//IL_00c1: 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)
orig.Invoke(self, buffDef);
if ((Object)(object)buffDef == (Object)(object)RifterBuffs.superShatterDebuff && !self.isFlying)
{
self.characterMotor.useGravity = true;
}
if (!((Object)(object)buffDef == (Object)(object)NemRifterBuffs.instabilityTriggerDebuff) || !NetworkServer.active)
{
return;
}
NemRifterOwnerHolder component = ((Component)self).gameObject.GetComponent<NemRifterOwnerHolder>();
if (!Object.op_Implicit((Object)(object)component) || !((Object)(object)component.owner != (Object)null))
{
return;
}
int buffCount = self.GetBuffCount(NemRifterBuffs.instabilityDebuff);
if (buffCount > 0)
{
for (int i = 0; i < buffCount; i++)
{
self.RemoveBuff(NemRifterBuffs.instabilityDebuff);
}
float radius = buffCount;
float num = (((float)buffCount + 5f > 30f) ? 30f : ((float)buffCount + 5f));
GameObject obj = Object.Instantiate<GameObject>(NemRifterAssets.riftZonePillar, self.corePosition, Util.QuaternionSafeLookRotation(Vector3.forward));
obj.GetComponent<DestroyOnTimer>().duration = num;
obj.GetComponent<GenericOwnership>().ownerObject = component.owner;
obj.GetComponent<TeamFilter>().teamIndex = (TeamIndex)1;
((Component)obj.transform.GetChild(0)).GetComponent<TeamFilter>().teamIndex = (TeamIndex)1;
BuffWard component2 = ((Component)obj.transform.GetChild(0)).GetComponent<BuffWard>();
if ((Object)(object)component2 != (Object)null)
{
component2.radius = radius;
component2.buffDef = NemRifterBuffs.negateDebuff;
component2.expireDuration = num;
}
NetworkServer.Spawn(obj);
}
}
private static void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self)
{
orig.Invoke(self);
if (!Object.op_Implicit((Object)(object)self))
{
return;
}
if (self.HasBuff(RifterBuffs.superShatterDebuff))
{
for (int i = 0; i < 10; i++)
{
self.AddTimedBuff(RifterBuffs.shatterDebuff, (float)i + 1f, 10);
}
CharacterMotor characterMotor = self.characterMotor;
if (Object.op_Implicit((Object)(object)characterMotor))
{
characterMotor.useGravity = false;
}
}
if (self.HasBuff(RifterBuffs.shatterDebuff))
{
int buffCount = self.GetBuffCount(RifterBuffs.shatterDebuff);
self.moveSpeed *= (float)(1 - buffCount / 10);
self.armor -= (float)(buffCount * 5);
}
if (self.HasBuff(NemRifterBuffs.collapseRifts))
{
self.moveSpeed *= 1.5f;
}
if (self.HasBuff(NemRifterBuffs.negateDebuff))
{
self.baseRegen = 2.5f;
}
}
private static IEnumerator BodyCatalog_Init(orig_Init orig)
{
yield return orig.Invoke();
rifterIndex = BodyCatalog.FindBodyIndex("RifterBody(Clone)");
}
private static void GlobalEventManager_OnHitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim)
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: 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_00d3: 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_00e7: 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)
//IL_0156: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self, damageInfo, victim);
if (!Object.op_Implicit((Object)(object)self))
{
return;
}
CharacterBody val = (Object.op_Implicit((Object)(object)damageInfo.attacker) ? damageInfo.attacker.GetComponent<CharacterBody>() : null);
CharacterBody component = victim.GetComponent<CharacterBody>();
if (Object.op_Implicit((Object)(object)val) && val.bodyIndex == rifterIndex)
{
if ((Object)(object)component != (Object)null && DamageAPI.HasModdedDamageType(damageInfo, RifterDamage.riftDamage) && component.GetBuffCount(RifterBuffs.shatterDebuff) <= 5)
{
component.ClearTimedBuffs(RifterBuffs.shatterDebuff);
for (int i = 0; i < 5; i++)
{
component.AddTimedBuff(RifterBuffs.shatterDebuff, (float)i + 1f, 5);
}
}
if ((Object)(object)component != (Object)null && DamageAPI.HasModdedDamageType(damageInfo, RifterDamage.riftSuperDamage))
{
component.AddTimedBuff(RifterBuffs.superShatterDebuff, 1f);
}
}
if (!Object.op_Implicit((Object)(object)val) || val.bodyIndex != nemRifterIndex)
{
return;
}
if ((Object)(object)component != (Object)null && DamageAPI.HasModdedDamageType(damageInfo, NemRifterDamage.instabilityProcDamage) && NetworkServer.active)
{
if (!component.HasBuff(NemRifterBuffs.instabilityDebuff))
{
component.AddTimedBuff(NemRifterBuffs.instabilityTriggerDebuff, 5f);
if (!Object.op_Implicit((Object)(object)victim.GetComponent<NemRifterOwnerHolder>()))
{
victim.gameObject.AddComponent<NemRifterOwnerHolder>();
}
victim.GetComponent<NemRifterOwnerHolder>().owner = ((Component)val).gameObject;
}
component.AddBuff(NemRifterBuffs.instabilityDebuff);
}
if ((Object)(object)component != (Object)null && DamageAPI.HasModdedDamageType(damageInfo, NemRifterDamage.instabilityTriggerDamage) && NetworkServer.active && component.HasBuff(NemRifterBuffs.instabilityTriggerDebuff))
{
component.RemoveBuff(NemRifterBuffs.instabilityTriggerDebuff);
}
}
public static void AddBodyToBlacklist(string bodyName)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: 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)
//IL_0009: Invalid comparison between Unknown and I4
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
BodyIndex val = BodyCatalog.FindBodyIndex(bodyName);
if ((int)val != -1 && blacklistBodyNames.Contains(bodyName))
{
blacklist.Add(val);
}
}
}
}
namespace RifterMod.Modules
{
public static class Config
{
public static ConfigFile MyConfig = ((BaseUnityPlugin)RifterPlugin.instance).Config;
public static ConfigEntry<bool> CharacterEnableConfig(string section, string characterName, string description = "", bool enabledByDefault = true)
{
if (string.IsNullOrEmpty(description))
{
description = "Set to false to disable this character and as much of its code and content as possible";
}
return BindAndOptions(section, "Enable " + characterName, enabledByDefault, description);
}
public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, string description = "", bool restartRequired = false)
{
if (string.IsNullOrEmpty(description))
{
description = name;
}
if (restartRequired)
{
description += " (restart required)";
}
ConfigEntry<T> val = MyConfig.Bind<T>(section, name, defaultValue, description);
if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
{
TryRegisterOption<T>(val, restartRequired);
}
return val;
}
public static ConfigEntry<float> BindAndOptionsSlider(string section, string name, float defaultValue, string description = "", float min = 0f, float max = 20f, bool restartRequired = false)
{
if (string.IsNullOrEmpty(description))
{
description = name;
}
if (restartRequired)
{
description += " (restart required)";
}
ConfigEntry<float> val = MyConfig.Bind<float>(section, name, defaultValue, description);
if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"))
{
TryRegisterOptionSlider(val, min, max, restartRequired);
}
return val;
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private static void TryRegisterOption<T>(ConfigEntry<T> entry, bool restartRequired)
{
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
private static void TryRegisterOptionSlider(ConfigEntry<float> entry, float min, float max, bool restartRequired)
{
}
public static bool GetKeyPressed(ConfigEntry<KeyboardShortcut> entry)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_0041: 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)
KeyboardShortcut value = entry.Value;
foreach (KeyCode modifier in ((KeyboardShortcut)(ref value)).Modifiers)
{
if (!Input.GetKey(modifier))
{
return false;
}
}
value = entry.Value;
return Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey);
}
}
internal class Content
{
internal static void AddCharacterBodyPrefab(GameObject bprefab)
{
ContentPacks.bodyPrefabs.Add(bprefab);
}
internal static void AddMasterPrefab(GameObject prefab)
{
ContentPacks.masterPrefabs.Add(prefab);
}
internal static void AddProjectilePrefab(GameObject prefab)
{
ContentPacks.projectilePrefabs.Add(prefab);
}
internal static void AddSurvivorDef(SurvivorDef survivorDef)
{
ContentPacks.survivorDefs.Add(survivorDef);
}
internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, 100f);
}
internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, float sortPosition)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, sortPosition);
}
internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, unlockableDef, 100f);
}
internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef, float sortPosition)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
SurvivorDef obj = ScriptableObject.CreateInstance<SurvivorDef>();
obj.bodyPrefab = bodyPrefab;
obj.displayPrefab = displayPrefab;
obj.primaryColor = charColor;
obj.cachedName = ((Object)bodyPrefab).name.Replace("Body", "");
obj.displayNameToken = tokenPrefix + "NAME";
obj.descriptionToken = tokenPrefix + "DESCRIPTION";
obj.outroFlavorToken = tokenPrefix + "OUTRO_FLAVOR";
obj.mainEndingEscapeFailureFlavorToken = tokenPrefix + "OUTRO_FAILURE";
obj.desiredSortPosition = sortPosition;
obj.unlockableDef = unlockableDef;
AddSurvivorDef(obj);
}
internal static void AddUnlockableDef(UnlockableDef unlockableDef)
{
ContentPacks.unlockableDefs.Add(unlockableDef);
}
internal static UnlockableDef CreateAndAddUnlockbleDef(string identifier, string nameToken, Sprite achievementIcon)
{
UnlockableDef obj = ScriptableObject.CreateInstance<UnlockableDef>();
obj.cachedName = identifier;
obj.nameToken = nameToken;
obj.achievementIcon = achievementIcon;
AddUnlockableDef(obj);
return obj;
}
internal static void AddSkillDef(SkillDef skillDef)
{
ContentPacks.skillDefs.Add(skillDef);
}
internal static void AddSkillFamily(SkillFamily skillFamily)
{
ContentPacks.skillFamilies.Add(skillFamily);
}
internal static void AddEntityState(Type entityState)
{
ContentPacks.entityStates.Add(entityState);
}
internal static void AddBuffDef(BuffDef buffDef)
{
ContentPacks.buffDefs.Add(buffDef);
}
internal static BuffDef CreateAndAddBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
BuffDef obj = ScriptableObject.CreateInstance<BuffDef>();
((Object)obj).name = buffName;
obj.buffColor = buffColor;
obj.canStack = canStack;
obj.isDebuff = isDebuff;
obj.eliteDef = null;
obj.iconSprite = buffIcon;
AddBuffDef(obj);
return obj;
}
internal static void AddEffectDef(EffectDef effectDef)
{
ContentPacks.effectDefs.Add(effectDef);
}
internal static EffectDef CreateAndAddEffectDef(GameObject effectPrefab)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_000d: Expected O, but got Unknown
EffectDef val = new EffectDef(effectPrefab);
AddEffectDef(val);
return val;
}
internal static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef)
{
ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef);
}
internal static NetworkSoundEventDef CreateAndAddNetworkSoundEventDef(string eventName)
{
NetworkSoundEventDef obj = ScriptableObject.CreateInstance<NetworkSoundEventDef>();
obj.akId = AkSoundEngine.GetIDFromString(eventName);
obj.eventName = eventName;
AddNetworkSoundEventDef(obj);
return obj;
}
}
internal class ContentPacks : IContentPackProvider
{
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.blake.RifterMod";
public void Initialize()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders);
}
private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider)
{
addContentPackProvider.Invoke((IContentPackProvider)(object)this);
}
public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args)
{
contentPack.identifier = identifier;
contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray());
contentPack.masterPrefabs.Add(masterPrefabs.ToArray());
contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray());
contentPack.survivorDefs.Add(survivorDefs.ToArray());
contentPack.unlockableDefs.Add(unlockableDefs.ToArray());
contentPack.skillDefs.Add(skillDefs.ToArray());
contentPack.skillFamilies.Add(skillFamilies.ToArray());
contentPack.entityStateTypes.Add(entityStates.ToArray());
contentPack.buffDefs.Add(buffDefs.ToArray());
contentPack.effectDefs.Add(effectDefs.ToArray());
contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray());
args.ReportProgress(1f);
yield break;
}
public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args)
{
ContentPack.Copy(contentPack, args.output);
args.ReportProgress(1f);
yield break;
}
public IEnumerator FinalizeAsync(FinalizeAsyncArgs args)
{
args.ReportProgress(1f);
yield break;
}
}
internal class FractureBeamComponent : MonoBehaviour
{
public Transform trans1;
public Transform trans2;
public bool trans1isOffset;
public bool trans2isOffset;
public Vector3 offsetVector;
private Vector3 positionMain;
private float duration = 0.1f;
private void Start()
{
//IL_002e: 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)
offsetVector = new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), Random.Range(-1f, 1f));
}
public void FixedUpdate()
{
//IL_003b: 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)
if (Time.fixedDeltaTime > duration)
{
offsetVector = new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), Random.Range(-1f, 1f));
}
}
private void Update()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: 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_0026: 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_0038: 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)
positionMain = (trans1.position + trans2.position) / 2f;
((Component)this).transform.position = positionMain + offsetVector;
}
}
internal static class ItemDisplayCheck
{
public static List<Object> allDisplayedItems;
public static void PrintUnused(ItemDisplayRuleSet itemDisplayRuleSet, string bodyName = "")
{
PrintUnused((IEnumerable<KeyAssetRuleGroup>)itemDisplayRuleSet.keyAssetRuleGroups.ToList(), bodyName);
}
public static void PrintUnused(IEnumerable<KeyAssetRuleGroup> ruleSet = null, string bodyName = "")
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: 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)
//IL_003f: 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)
//IL_0062: 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)
string text = "generating item displays for " + bodyName;
if (allDisplayedItems == null)
{
LazyGatherAllItems();
}
List<Object> list = new List<Object>(allDisplayedItems);
string text2 = "";
if (ruleSet != null)
{
foreach (KeyAssetRuleGroup item in ruleSet)
{
if (item.displayRuleGroup.rules.Length != 0)
{
list.Remove(item.keyAsset);
if (string.IsNullOrEmpty(text2))
{
text2 = item.displayRuleGroup.rules[0].childName;
}
}
}
}
if (string.IsNullOrEmpty(text2))
{
text2 = "Chest";
}
foreach (Object item2 in list)
{
string text3 = "";
if (ItemDisplays.KeyAssetDisplayPrefabs.ContainsKey(item2))
{
text3 += SpitOutNewRule(item2, text2, ItemDisplays.KeyAssetDisplayPrefabs[item2]);
}
else
{
Log.Error($"COULD NOT FIND DISPLAY PREFABS FOR KEYASSET {item2}");
}
text += text3;
}
Log.Message(text);
}
private static void LazyGatherAllItems()
{
allDisplayedItems = new List<Object>(ItemDisplays.KeyAssetDisplayPrefabs.Keys);
allDisplayedItems.Sort(delegate(Object item1, Object item2)
{
if (item1 is ItemDef && item2 is ItemDef)
{
return item1.name.CompareTo(item2.name);
}
if (item1 is EquipmentDef && item2 is EquipmentDef)
{
return item1.name.CompareTo(item2.name);
}
if (item1 is ItemDef && item2 is EquipmentDef)
{
return -1;
}
return (item1 is EquipmentDef && item2 is ItemDef) ? 1 : 0;
});
}
private static string SpitOutNewRule(Object asset, string firstCompatibleChild, ItemDisplayRule[] displayRules)
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
if (displayRules.Length == 0)
{
return $"\n[NO DISPLAY RULES FOUND FOR THE KEYASSET {asset}";
}
string text = "\n itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets[\"" + asset.name + "\"]";
for (int i = 0; i < displayRules.Length; i++)
{
text = (((int)displayRules[i].limbMask != 0) ? (text + ",\n" + $" ItemDisplays.CreateLimbMaskDisplayRule(LimbFlags.{displayRules[i].limbMask})") : (text + ",\n ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay(\"" + ((Object)displayRules[i].followerPrefab).name + "\"),\n \"" + firstCompatibleChild + "\",\n new Vector3(2, 2, 2),\n new Vector3(0, 0, 0),\n new Vector3(1, 1, 1)\n )"));
}
return text + "\n ));";
}
}
internal static class ItemDisplays
{
private static Dictionary<string, GameObject> itemDisplayPrefabs = new Dictionary<string, GameObject>();
public static Dictionary<Object, ItemDisplayRule[]> KeyAssetDisplayPrefabs = new Dictionary<Object, ItemDisplayRule[]>();
public static Dictionary<string, Object> KeyAssets = new Dictionary<string, Object>();
public static int queuedDisplays;
public static bool initialized = false;
public static void LazyInit()
{
if (!initialized)
{
initialized = true;
PopulateDisplays();
}
}
internal static void DisposeWhenDone()
{
queuedDisplays--;
if (queuedDisplays <= 0 && initialized)
{
initialized = false;
itemDisplayPrefabs = null;
KeyAssetDisplayPrefabs = null;
KeyAssets = null;
}
}
internal static void PopulateDisplays()
{
PopulateFromBody("MercBody");
PopulateCustomLightningArm();
}
private static void PopulateFromBody(string bodyName)
{
KeyAssetRuleGroup[] keyAssetRuleGroups = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyName).GetComponent<ModelLocator>().modelTransform).GetComponent<CharacterModel>().itemDisplayRuleSet.keyAssetRuleGroups;
for (int i = 0; i < keyAssetRuleGroups.Length; i++)
{
ItemDisplayRule[] rules = keyAssetRuleGroups[i].displayRuleGroup.rules;
KeyAssetDisplayPrefabs[keyAssetRuleGroups[i].keyAsset] = rules;
KeyAssets[keyAssetRuleGroups[i].keyAsset.name] = keyAssetRuleGroups[i].keyAsset;
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;
}
public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(string itemName, params ItemDisplayRule[] rules)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return CreateDisplayRuleGroupWithRules(GetKeyAssetFromString(itemName), rules);
}
public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(Object keyAsset_, params ItemDisplayRule[] rules)
{
//IL_0015: 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_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
if (keyAsset_ == (Object)null)
{
Log.Error("could not find keyasset");
}
KeyAssetRuleGroup result = default(KeyAssetRuleGroup);
result.keyAsset = keyAsset_;
result.displayRuleGroup = new DisplayRuleGroup
{
rules = rules
};
return result;
}
public static ItemDisplayRule CreateDisplayRule(string prefabName, string childName, Vector3 position, Vector3 rotation, Vector3 scale)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: 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)
return CreateDisplayRule(LoadDisplay(prefabName), childName, position, rotation, scale);
}
public static ItemDisplayRule CreateDisplayRule(GameObject itemPrefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale)
{
//IL_0002: 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_0023: 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_002b: 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)
//IL_003a: 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_0041: Unknown result type (might be due to invalid IL or missing references)
ItemDisplayRule result = default(ItemDisplayRule);
result.ruleType = (ItemDisplayRuleType)0;
result.childName = childName;
result.followerPrefab = itemPrefab;
result.limbMask = (LimbFlags)0;
result.localPos = position;
result.localAngles = rotation;
result.localScale = scale;
return result;
}
public static ItemDisplayRule CreateLimbMaskDisplayRule(LimbFlags limb)
{
//IL_0002: 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_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: 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)
ItemDisplayRule result = default(ItemDisplayRule);
result.ruleType = (ItemDisplayRuleType)1;
result.limbMask = limb;
result.childName = "";
result.followerPrefab = null;
return result;
}
private static Object GetKeyAssetFromString(string itemName)
{
Object val = (Object)(object)LegacyResourcesAPI.Load<ItemDef>("ItemDefs/" + itemName);
if (val == (Object)null)
{
val = (Object)(object)LegacyResourcesAPI.Load<EquipmentDef>("EquipmentDefs/" + itemName);
}
if (val == (Object)null)
{
Log.Error("Could not load keyasset for " + itemName);
}
return val;
}
}
internal static class Language
{
public static string TokensOutput = "";
public static bool usingLanguageFolder = false;
public static bool printingEnabled = false;
public static void Init()
{
if (usingLanguageFolder)
{
Language.collectLanguageRootFolders += Language_collectLanguageRootFolders;
}
}
private static void Language_collectLanguageRootFolders(List<string> obj)
{
string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)RifterPlugin.instance).Info.Location), "Language");
if (Directory.Exists(text))
{
obj.Add(text);
}
}
public static void Add(string token, string text)
{
if (!usingLanguageFolder)
{
LanguageAPI.Add(token, text);
}
if (printingEnabled)
{
TokensOutput = TokensOutput + "\n \"" + token + "\" : \"" + text.Replace(Environment.NewLine, "\\n").Replace("\n", "\\n") + "\",";
}
}
public static void PrintOutput(string fileName = "")
{
if (printingEnabled)
{
string text = "{\n strings:\n {" + TokensOutput + "\n }\n}";
Log.Message(fileName + ": \n" + text);
if (!string.IsNullOrEmpty(fileName))
{
File.WriteAllText(Path.Combine(Directory.GetParent(((BaseUnityPlugin)RifterPlugin.instance).Info.Location).FullName, "Language", "en", fileName), text);
}
TokensOutput = "";
}
}
}
internal static class Materials
{
private static List<Material> cachedMaterials = new List<Material>();
internal static Shader hotpoo = LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/HGStandard");
public static Material LoadMaterial(this AssetBundle assetBundle, string materialName)
{
return assetBundle.CreateHopooMaterialFromBundle(materialName);
}
public static Material CreateHopooMaterialFromBundle(this AssetBundle assetBundle, string materialName)
{
//IL_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: 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))
{
Log.Debug(((Object)val).name + " has already been loaded. returning cached");
return val;
}
val = assetBundle.LoadAsset<Material>(materialName);
if (!Object.op_Implicit((Object)(object)val))
{
Log.ErrorAssetBundle(materialName, ((Object)assetBundle).name);
return new Material(hotpoo);
}
return val.ConvertDefaultShaderToHopoo();
}
public static Material SetHopooMaterial(this Material tempMat)
{
return tempMat.ConvertDefaultShaderToHopoo();
}
public static Material ConvertDefaultShaderToHopoo(this Material tempMat)
{
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
if (cachedMaterials.Contains(tempMat))
{
Log.Debug(((Object)tempMat).name + " has already been loaded. returning cached");
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 = hotpoo;
tempMat.SetTexture("_EmTex", tempMat.GetTexture("_EmissionMap"));
tempMat.EnableKeyword("DITHER");
if (num.HasValue)
{
tempMat.SetFloat("_NormalStrength", num.Value);
tempMat.SetTexture("_NormalTex", tempMat.GetTexture("_BumpMap"));
}
if (val.HasValue)
{
tempMat.SetColor("_EmColor", val.Value);
tempMat.SetFloat("_EmPower", 1f);
}
if (tempMat.IsKeywordEnabled("NOCULL"))
{
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_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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_0006: 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_0012: 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;
}
public static Material SetSpecular(this Material material, float strength)
{
material.SetFloat("_SpecularStrength", strength);
return material;
}
public static Material SetSpecular(this Material material, float strength, float exponent)
{
material.SetFloat("_SpecularStrength", strength);
material.SetFloat("SpecularExponent", exponent);
return material;
}
}
internal static class MyCharacterAssets
{
internal static Dictionary<string, AssetBundle> loadedBundles = new Dictionary<string, AssetBundle>();
internal static AssetBundle LoadAssetBundle(string bundleName)
{
if (bundleName == "myassetbundle")
{
Log.Error("AssetBundle name hasn't been changed. not loading any assets to avoid conflicts.\nMake sure to rename your assetbundle filename and rename the AssetBundleName field in your character setup code ");
return null;
}
if (loadedBundles.ContainsKey(bundleName))
{
return loadedBundles[bundleName];
}
AssetBundle val = null;
try
{
val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)RifterPlugin.instance).Info.Location), "AssetBundles", bundleName));
}
catch (Exception arg)
{
Log.Error($"Error loading asset bundle, {bundleName}. Your asset bundle must be in a folder next to your mod dll called 'AssetBundles'. Follow the guide to build and install your mod correctly!\n{arg}");
}
loadedBundles[bundleName] = val;
return val;
}
internal static GameObject CloneTracer(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;
Content.CreateAndAddEffectDef(val);
return val;
}
internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert)
{
if (!Object.op_Implicit((Object)(object)objectToConvert))
{
return;
}
Renderer[] componentsInChildren = objectToConvert.GetComponentsInChildren<Renderer>();
foreach (Renderer obj in componentsInChildren)
{
if (obj != null)
{
obj.sharedMaterial?.ConvertDefaultShaderToHopoo();
}
}
}
internal static GameObject LoadCrosshair(string crosshairName)
{
GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair");
if ((Object)(object)val == (Object)null)
{
Log.Error("could not load crosshair with the name " + crosshairName + ". defaulting to Standard");
return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/StandardCrosshair");
}
return val;
}
internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, bool parentToTransform)
{
return assetBundle.LoadEffect(resourceName, "", parentToTransform);
}
internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, string soundName = "", bool parentToTransform = false)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
GameObject val = assetBundle.LoadAsset<GameObject>(resourceName);
if (!Object.op_Implicit((Object)(object)val))
{
Log.ErrorAssetBundle(resourceName, ((Object)assetBundle).name);
return null;
}
val.AddComponent<DestroyOnTimer>().duration = 12f;
val.AddComponent<NetworkIdentity>();
val.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2;
EffectComponent obj = val.AddComponent<EffectComponent>();
obj.applyScale = false;
obj.effectIndex = (EffectIndex)(-1);
obj.parentToReferencedTransform = parentToTransform;
obj.positionAtReferencedTransform = true;
obj.soundName = soundName;
Content.CreateAndAddEffectDef(val);
return val;
}
internal static GameObject CreateProjectileGhostPrefab(this AssetBundle assetBundle, string ghostName)
{
GameObject val = assetBundle.LoadAsset<GameObject>(ghostName);
if ((Object)(object)val == (Object)null)
{
Log.Error("Failed to load ghost prefab " + ghostName);
}
if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>()))
{
val.AddComponent<NetworkIdentity>();
}
if (!Object.op_Implicit((Object)(object)val.GetComponent<ProjectileGhostController>()))
{
val.AddComponent<ProjectileGhostController>();
}
ConvertAllRenderersToHopooShader(val);
return val;
}
internal static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName)
{
return PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/" + prefabName), newPrefabName);
}
internal static GameObject LoadAndAddProjectilePrefab(this AssetBundle assetBundle, string newPrefabName)
{
GameObject val = assetBundle.LoadAsset<GameObject>(newPrefabName);
if ((Object)(object)val == (Object)null)
{
Log.ErrorAssetBundle(newPrefabName, ((Object)assetBundle).name);
return null;
}
Content.AddProjectilePrefab(val);
return val;
}
}
public class NemRifterSkillDef : SkillDef
{
protected class InstanceData : BaseSkillInstanceData
{
public NemRifterTracker nemRifterTracker;
}
public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot)
{
return (BaseSkillInstanceData)(object)new InstanceData
{
nemRifterTracker = ((Component)skillSlot).GetComponent<NemRifterTracker>()
};
}
private static bool HasTarget([NotNull] GenericSkill skillSlot)
{
if (!Object.op_Implicit((Object)(object)((InstanceData)(object)skillSlot.skillInstanceData).nemRifterTracker?.GetTrackingTarget()))
{
return false;
}
return true;
}
public override bool CanExecute([NotNull] GenericSkill skillSlot)
{
if (!HasTarget(skillSlot))
{
return false;
}
return ((SkillDef)this).CanExecute(skillSlot);
}
public override bool IsReady([NotNull] GenericSkill skillSlot)
{
if (((SkillDef)this).IsReady(skillSlot))
{
return HasTarget(skillSlot);
}
return false;
}
}
internal static class Prefabs
{
private static PhysicMaterial ragdollMaterial;
public static GameObject CreateDisplayPrefab(AssetBundle assetBundle, string displayPrefabName, GameObject prefab)
{
GameObject val = assetBundle.LoadAsset<GameObject>(displayPrefabName);
if ((Object)(object)val == (Object)null)
{
Log.Error("could not load display prefab " + displayPrefabName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name);
return null;
}
CharacterModel val2 = val.GetComponent<CharacterModel>();
if (!Object.op_Implicit((Object)(object)val2))
{
val2 = val.AddComponent<CharacterModel>();
}
val2.baseRendererInfos = prefab.GetComponentInChildren<CharacterModel>().baseRendererInfos;
MyCharacterAssets.ConvertAllRenderersToHopooShader(val);
return val;
}
public static GameObject LoadCharacterModel(AssetBundle assetBundle, string modelName)
{
GameObject val = assetBundle.LoadAsset<GameObject>(modelName);
if ((Object)(object)val == (Object)null)
{
Log.Error("could not load model prefab " + modelName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name);
return null;
}
return val;
}
public static GameObject LoadCharacterBody(AssetBundle assetBundle, string bodyName)
{
GameObject val = assetBundle.LoadAsset<GameObject>(bodyName);
if ((Object)(object)val == (Object)null)
{
Log.Error("could not load body prefab " + bodyName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name);
return null;
}
return val;
}
public static GameObject CloneCharacterBody(BodyInfo bodyInfo)
{
GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyInfo.bodyNameToClone + "Body");
if (!Object.op_Implicit((Object)(object)val))
{
Log.Error(bodyInfo.bodyNameToClone + " Body to clone is not a valid body, character creation failed");
return null;
}
GameObject val2 = PrefabAPI.InstantiateClone(val, bodyInfo.bodyName);
for (int num = val2.transform.childCount - 1; num >= 0; num--)
{
Object.DestroyImmediate((Object)(object)((Component)val2.transform.GetChild(num)).gameObject);
}
return val2;
}
public static GameObject CreateBodyPrefab(AssetBundle assetBundle, string modelPrefabName, BodyInfo bodyInfo)
{
return CreateBodyPrefab(LoadCharacterModel(assetBundle, modelPrefabName), bodyInfo);
}
public static GameObject CreateBodyPrefab(GameObject model, BodyInfo bodyInfo)
{
return CreateBodyPrefab(CloneCharacterBody(bodyInfo), model, bodyInfo);
}
public static GameObject CreateBodyPrefab(GameObject newBodyPrefab, AssetBundle assetBundle, string modelName, BodyInfo bodyInfo)
{
return CreateBodyPrefab(newBodyPrefab, LoadCharacterModel(assetBundle, modelName), bodyInfo);
}
public static GameObject CreateBodyPrefab(AssetBundle assetBundle, string bodyPrefabName, string modelPrefabName, BodyInfo bodyInfo)
{
return CreateBodyPrefab(LoadCharacterBody(assetBundle, bodyPrefabName), LoadCharacterModel(assetBundle, modelPrefabName), bodyInfo);
}
public static GameObject CreateBodyPrefab(GameObject newBodyPrefab, GameObject model, BodyInfo bodyInfo)
{
if ((Object)(object)model == (Object)null || (Object)(object)newBodyPrefab == (Object)null)
{
Log.Error($"Character creation failed. Model: {model}, Body: {newBodyPrefab}");
return null;
}
SetupCharacterBody(newBodyPrefab, bodyInfo);
Transform modelBaseTransform = AddCharacterModelToSurvivorBody(newBodyPrefab, model.transform, bodyInfo);
SetupModelLocator(newBodyPrefab, modelBaseTransform, model.transform);
SetupCharacterDirection(newBodyPrefab, modelBaseTransform, model.transform);
SetupCameraTargetParams(newBodyPrefab, bodyInfo);
SetupCapsuleCollider(newBodyPrefab);
Content.AddCharacterBodyPrefab(newBodyPrefab);
return newBodyPrefab;
}
private static void SetupCharacterBody(GameObject newBodyPrefab, BodyInfo bodyInfo)
{
//IL_002d: 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_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
CharacterBody component = newBodyPrefab.GetComponent<CharacterBody>();
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.baseArmor = bodyInfo.armor;
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;
if (bodyInfo.autoCalculateLevelStats)
{
component.levelMaxHealth = Mathf.Round(component.baseMaxHealth * 0.3f);
component.levelMaxShield = Mathf.Round(component.baseMaxShield * 0.3f);
component.levelRegen = component.baseRegen * 0.2f;
component.levelMoveSpeed = 0f;
component.levelJumpPower = 0f;
component.levelDamage = component.baseDamage * 0.2f;
component.levelAttackSpeed = 0f;
component.levelCrit = 0f;
component.levelArmor = 0f;
}
else
{
component.levelMaxHealth = bodyInfo.healthGrowth;
component.levelMaxShield = bodyInfo.shieldGrowth;
component.levelRegen = bodyInfo.regenGrowth;
component.levelMoveSpeed = bodyInfo.moveSpeedGrowth;
component.levelJumpPower = bodyInfo.jumpPowerGrowth;
component.levelDamage = bodyInfo.damageGrowth;
component.levelAttackSpeed = bodyInfo.attackSpeedGrowth;
component.levelCrit = bodyInfo.critGrowth;
component.levelArmor = bodyInfo.armorGrowth;
}
component.baseAcceleration = bodyInfo.acceleration;
component.baseJumpCount = bodyInfo.jumpCount;
component.sprintingSpeedMultiplier = 1.45f;
component.bodyFlags = (BodyFlags)16;
component.rootMotionInMainState = false;
component.hullClassification = (HullClassification)0;
component.isChampion = false;
}
private static Transform AddCharacterModelToSurvivorBody(GameObject bodyPrefab, Transform modelTransform, BodyInfo bodyInfo)
{
//IL_005a: 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_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: 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)
Transform val = bodyPrefab.transform.Find("ModelBase");
if ((Object)(object)val == (Object)null)
{
val = new GameObject("ModelBase").transform;
val.parent = bodyPrefab.transform;
val.localPosition = bodyInfo.modelBasePosition;
val.localRotation = Quaternion.identity;
}
modelTransform.parent = ((Component)val).transform;
modelTransform.localPosition = Vector3.zero;
modelTransform.localRotation = Quaternion.identity;
if ((Object)(object)bodyPrefab.transform.Find("CameraPivot") == (Object)null)
{
Transform transform = new GameObject("CameraPivot").transform;
transform.parent = bodyPrefab.transform;
transform.localPosition = bodyInfo.cameraPivotPosition;
transform.localRotation = Quaternion.identity;
}
Transform val2 = bodyPrefab.transform.Find("AimOrigin");
if ((Object)(object)val2 == (Object)null)
{
val2 = new GameObject("AimOrigin").transform;
val2.parent = bodyPrefab.transform;
val2.localPosition = bodyInfo.aimOriginPosition;
val2.localRotation = Quaternion.identity;
}
bodyPrefab.GetComponent<CharacterBody>().aimOriginTransform = val2;
return ((Component)val).transform;
}
private static void SetupCharacterDirection(GameObject prefab, Transform modelBaseTransform, Transform modelTransform)
{
if (Object.op_Implicit((Object)(object)prefab.GetComponent<CharacterDirection>()))
{
CharacterDirection component = prefab.GetComponent<CharacterDirection>();
component.targetTransform = modelBaseTransform;
component.overrideAnimatorForwardTransform = null;
component.rootMotionAccumulator = null;
component.modelAnimator = ((Component)modelTransform).GetComponent<Animator>();
component.driveFromRootRotation = false;
component.turnSpeed = 720f;
}
}
private static void SetupCameraTargetParams(GameObject prefab, BodyInfo bodyInfo)
{
CameraTargetParams component = prefab.GetComponent<CameraTargetParams>();
component.cameraParams = bodyInfo.cameraParams;
component.cameraPivotTransform = prefab.transform.Find("CameraPivot");
}
private static void SetupModelLocator(GameObject prefab, Transform modelBaseTransform, Transform modelTransform)
{
ModelLocator component = prefab.GetComponent<ModelLocator>();
component.modelTransform = modelTransform;
component.modelBaseTransform = modelBaseTransform;
}
private static void SetupCapsuleCollider(GameObject prefab)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
CapsuleCollider component = prefab.GetComponent<CapsuleCollider>();
component.center = new Vector3(0f, 0f, 0f);
component.radius = 0.5f;
component.height = 1.82f;
component.direction = 1;
}
public static CharacterModel SetupCharacterModel(GameObject bodyPrefab, CustomRendererInfo[] customInfos = null)
{
CharacterModel val = ((Component)bodyPrefab.GetComponent<ModelLocator>().modelTransform).gameObject.GetComponent<CharacterModel>();
bool num = (Object)(object)val != (Object)null;
if (!num)
{
val = ((Component)bodyPrefab.GetComponent<ModelLocator>().modelTransform).gameObject.AddComponent<CharacterModel>();
}
val.body = bodyPrefab.GetComponent<CharacterBody>();
val.autoPopulateLightInfos = true;
val.invisibilityCount = 0;
val.temporaryOverlays = new List<TemporaryOverlayInstance>();
if (!num)
{
SetupCustomRendererInfos(val, customInfos);
}
else
{
SetupPreAttachedRendererInfos(val);
}
SetupHurtboxGroup(bodyPrefab, ((Component)val).gameObject);
SetupAimAnimator(bodyPrefab, ((Component)val).gameObject);
SetupFootstepController(((Component)val).gameObject);
SetupRagdoll(((Component)val).gameObject);
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.baseRendererInfos[i].renderer.sharedMaterial;
}
if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null)
{
Log.Error($"no material for rendererinfo of this renderer: {characterModel.baseRendererInfos[i].renderer}");
}
characterModel.baseRendererInfos[i].defaultMaterial.ConvertDefaultShaderToHopoo();
}
}
public static void SetupCustomRendererInfos(CharacterModel characterModel, CustomRendererInfo[] customInfos)
{
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
ChildLocator component = ((Component)characterModel).GetComponent<ChildLocator>();
if (!Object.op_Implicit((Object)(object)component))
{
Log.Error("Failed CharacterModel setup: ChildLocator component does not exist on the model");
return;
}
List<RendererInfo> list = new List<RendererInfo>();
for (int i = 0; i < customInfos.Length; i++)
{
if (!Object.op_Implicit((Object)(object)component.FindChild(customInfos[i].childName)))
{
Log.Error("Trying to add a RendererInfo for a renderer that does not exist: " + customInfos[i].childName);
continue;
}
Renderer component2 = ((Component)component.FindChild(customInfos[i].childName)).GetComponent<Renderer>();
if (Object.op_Implicit((Object)(object)component2))
{
Material val = customInfos[i].material;
if ((Object)(object)val == (Object)null)
{
val = ((!customInfos[i].dontHotpoo) ? component2.sharedMaterial.ConvertDefaultShaderToHopoo() : component2.sharedMaterial);
}
list.Add(new RendererInfo
{
renderer = component2,
defaultMaterial = val,
ignoreOverlays = customInfos[i].ignoreOverlays,
defaultShadowCastingMode = (ShadowCastingMode)1
});
}
}
characterModel.baseRendererInfos = list.ToArray();
}
private static void SetupHurtboxGroup(GameObject bodyPrefab, GameObject model)
{
SetupMainHurtboxesFromChildLocator(bodyPrefab, model);
SetHurtboxesHealthComponents(bodyPrefab);
}
private static void SetupMainHurtboxesFromChildLocator(GameObject bodyPrefab, GameObject model)
{
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)bodyPrefab.GetComponent<HurtBoxGroup>() != (Object)null)
{
Log.Debug("Hitboxgroup already exists on model prefab. aborting code setup");
return;
}
ChildLocator component = model.GetComponent<ChildLocator>();
if (!Object.op_Implicit((Object)(object)component.FindChild("MainHurtbox")))
{
Log.Error("Could not set up main hurtbox: make sure you have a transform pair in your prefab's ChildLocator called 'MainHurtbox'");
return;
}
HurtBoxGroup val = model.AddComponent<HurtBoxGroup>();
HurtBox val2 = null;
GameObject val3 = component.FindChildGameObject("HeadHurtbox");
if (Object.op_Implicit((Object)(object)val3))
{
Log.Debug("HeadHurtboxFound. Setting up");
val2 = val3.AddComponent<HurtBox>();
((Component)val2).gameObject.layer = LayerIndex.entityPrecise.intVal;
val2.healthComponent = bodyPrefab.GetComponent<HealthComponent>();
val2.isBullseye = false;
val2.isSniperTarget = true;
val2.damageModifier = (DamageModifier)0;
val2.hurtBoxGroup = val;
val2.indexInGroup = 1;
}
HurtBox val4 = component.FindChildGameObject("MainHurtbox").AddComponent<HurtBox>();
((Component)val4).gameObject.layer = LayerIndex.entityPrecise.intVal;
val4.healthComponent = bodyPrefab.GetComponent<HealthComponent>();
val4.isBullseye = true;
val4.isSniperTarget = (Object)(object)val2 == (Object)null;
val4.damageModifier = (DamageModifier)0;
val4.hurtBoxGroup = val;
val4.indexInGroup = 0;
if (Object.op_Implicit((Object)(object)val2))
{
val.hurtBoxes = (HurtBox[])(object)new HurtBox[2] { val4, val2 };
}
else
{
val.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val4 };
}
val.mainHurtBox = val4;
val.bullseyeCount = 1;
}
public static void SetHurtboxesHealthComponents(GameObject bodyPrefab)
{
HealthComponent component = bodyPrefab.GetComponent<HealthComponent>();
HurtBoxGroup[] componentsInChildren = bodyPrefab.GetComponentsInChildren<HurtBoxGroup>();
foreach (HurtBoxGroup val in componentsInChildren)
{
val.mainHurtBox.healthComponent = component;
for (int j = 0; j < val.hurtBoxes.Length; j++)
{
val.hurtBoxes[j].healthComponent = component;
}
}
}
private static void SetupFootstepController(GameObject model)
{
FootstepHandler obj = model.AddCo