Decompiled source of Cloudburst v0.4.1
plugins/Cloudburst.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; 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 Cloudburst.CEntityStates.Wyatt; using Cloudburst.Characters.Wyatt; using Cloudburst.GlobalComponents; using Cloudburst.Items.Gray; using Cloudburst.Items.Gray.BlastBoot; using Cloudburst.Items.Green; using Cloudburst.Modules; using Cloudburst.Modules.Characters; using Cloudburst.Modules.Survivors; using Cloudburst.Wyatt.Components; using EmotesAPI; using EntityStates; using EntityStates.Merc; using HG; using HG.BlendableTypes; using IL.RoR2; using JetBrains.Annotations; using KinematicCharacterController; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Achievements; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.ExpansionManagement; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: AssemblyCompany("Cloudburst")] [assembly: AssemblyProduct("Cloudburst")] [assembly: AssemblyTitle("Cloudburst")] [assembly: AssemblyInformationalVersion("1.0.0+fadbba2987570ddc7333c5c37f4c511b99e3ad7f")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] [Microsoft.CodeAnalysis.Embedded] [CompilerGenerated] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [Microsoft.CodeAnalysis.Embedded] [CompilerGenerated] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] [Microsoft.CodeAnalysis.Embedded] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class FunnyCSSMenuSoundComponent : MonoBehaviour { private void OnEnable() { Util.PlaySound("Play_Wyatt_Groove_CSS", ((Component)this).gameObject); } private void OnDisable() { Util.PlaySound("Stop_Wyatt_Groove_CSS", ((Component)this).gameObject); } } public class MaterialSwapper : MonoBehaviour { private static Dictionary<string, string> _nameToAddressable; public string materialName = ""; public static Dictionary<string, string> nameToAddressable { get { if (_nameToAddressable == null) { InitDictionary(); } return _nameToAddressable; } } public static void InitDictionary() { _nameToAddressable = new Dictionary<string, string>(); _nameToAddressable["matOpaqueDustTrail"] = "RoR2/Base/Common/VFX/matOpaqueDustTrail.mat"; _nameToAddressable["matDistortionFaded"] = "RoR2/Base/Common/VFX/matDistortionFaded.mat"; _nameToAddressable["matOmniRingRock"] = "RoR2/Base/skymeadow/matOmniRingRock.mat"; _nameToAddressable["matGolemExplosion"] = "RoR2/Base/Common/VFX/matGolemExplosion.mat"; _nameToAddressable["matOpaqueDustLarge"] = "RoR2/Base/Common/VFX/matOpaqueDustLarge.mat"; _nameToAddressable["matDebris1"] = "RoR2/Base/Common/VFX/matDebris1.mat"; _nameToAddressable["matSandDetailRock"] = "RoR2/Base/Common/Props/matSandDetailRock.mat"; _nameToAddressable["matBaubleEffect"] = "RoR2/Base/SlowOnHit/matBaubleEffect.mat"; _nameToAddressable["matCleanseCore"] = "RoR2/Base/Cleanse/matCleanseCore.mat"; _nameToAddressable["matCleanseWater"] = "RoR2/Base/Cleanse/matCleanseWater.mat"; _nameToAddressable["matTracerBright"] = "RoR2/Base/Common/VFX/matTracerBright.mat"; } public static void RunSwappers(GameObject gob) { MaterialSwapper[] componentsInChildren = gob.GetComponentsInChildren<MaterialSwapper>(); foreach (MaterialSwapper materialSwapper in componentsInChildren) { materialSwapper.SwapMaterial(); } } public void SwapMaterial() { //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) string text = materialName; if (nameToAddressable.ContainsKey(materialName)) { text = nameToAddressable[materialName]; } ((Component)this).GetComponent<Renderer>().material = Addressables.LoadAssetAsync<Material>((object)text).WaitForCompletion(); } } public static class CCUtilities { public static T CopyComponent<T>(T original, GameObject destination) where T : Component { Type type = ((object)original).GetType(); Component val = destination.AddComponent(type); FieldInfo[] fields = type.GetFields(); FieldInfo[] array = fields; foreach (FieldInfo fieldInfo in array) { fieldInfo.SetValue(val, fieldInfo.GetValue(original)); } return (T)(object)((val is T) ? val : null); } public static void CreateValidProjectile(GameObject projectile, float lifeTime, float velocity, bool updateAfterFiring) { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) NetworkIdentity val = projectile.AddComponent<NetworkIdentity>(); TeamFilter val2 = projectile.AddComponent<TeamFilter>(); ProjectileController val3 = projectile.AddComponent<ProjectileController>(); ProjectileNetworkTransform val4 = projectile.AddComponent<ProjectileNetworkTransform>(); ProjectileSimple val5 = projectile.AddComponent<ProjectileSimple>(); ProjectileDamage val6 = projectile.AddComponent<ProjectileDamage>(); val3.allowPrediction = false; val3.predictionId = 0; val3.procCoefficient = 1f; val3.owner = null; val4.allowClientsideCollision = false; val4.interpolationFactor = 1f; val4.positionTransmitInterval = 0.03333334f; val5.desiredForwardSpeed = velocity; val5.lifetime = lifeTime; val5.updateAfterFiring = updateAfterFiring; val5.enableVelocityOverLifetime = false; val5.oscillate = false; val5.oscillateMagnitude = 20f; val5.oscillateSpeed = 0f; val6.damage = 0f; val6.crit = false; val6.force = 0f; val6.damageColorIndex = (DamageColorIndex)0; val6.damageType = DamageTypeCombo.op_Implicit((DamageType)16777216); } public static void CopyAISkillSettings(AISkillDriver beingCopiedFrom, AISkillDriver copier) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_0134: Unknown result type (might be due to invalid IL or missing references) copier.activationRequiresAimConfirmation = beingCopiedFrom.activationRequiresAimConfirmation; copier.activationRequiresTargetLoS = beingCopiedFrom.activationRequiresTargetLoS; copier.aimType = beingCopiedFrom.aimType; copier.buttonPressType = beingCopiedFrom.buttonPressType; copier.customName = beingCopiedFrom.customName; copier.driverUpdateTimerOverride = beingCopiedFrom.driverUpdateTimerOverride; copier.ignoreNodeGraph = beingCopiedFrom.ignoreNodeGraph; copier.maxDistance = beingCopiedFrom.maxDistance; copier.maxTargetHealthFraction = beingCopiedFrom.maxTargetHealthFraction; copier.maxUserHealthFraction = beingCopiedFrom.maxUserHealthFraction; copier.minDistance = beingCopiedFrom.minDistance; copier.minTargetHealthFraction = beingCopiedFrom.minTargetHealthFraction; copier.minUserHealthFraction = beingCopiedFrom.minUserHealthFraction; copier.moveInputScale = beingCopiedFrom.moveInputScale; copier.movementType = beingCopiedFrom.movementType; copier.moveTargetType = beingCopiedFrom.moveTargetType; copier.nextHighPriorityOverride = beingCopiedFrom.nextHighPriorityOverride; copier.noRepeat = beingCopiedFrom.noRepeat; copier.requireEquipmentReady = beingCopiedFrom.requireEquipmentReady; copier.requireSkillReady = beingCopiedFrom.requireSkillReady; copier.resetCurrentEnemyOnNextDriverSelection = beingCopiedFrom.resetCurrentEnemyOnNextDriverSelection; copier.selectionRequiresOnGround = beingCopiedFrom.selectionRequiresOnGround; copier.selectionRequiresTargetLoS = beingCopiedFrom.selectionRequiresTargetLoS; copier.shouldFireEquipment = beingCopiedFrom.shouldFireEquipment; copier.shouldSprint = beingCopiedFrom.shouldSprint; copier.skillSlot = beingCopiedFrom.skillSlot; } public static bool FriendlyFire_ShouldKnockupProceed(CharacterBody victimBody, TeamIndex attackerTeamIndex) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 return victimBody.teamComponent.teamIndex != attackerTeamIndex || (int)FriendlyFireManager.friendlyFireMode != 0 || (int)attackerTeamIndex == -1; } public static bool ShouldKnockup(CharacterBody victimBody, TeamIndex attackerTeamIndex) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) bool result = true; if (!FriendlyFire_ShouldKnockupProceed(victimBody, attackerTeamIndex)) { result = false; } return result; } public static void CharacterOverlapSphereAll(ref List<CharacterBody> hitBodies, Vector3 position, float radius, LayerMask layerMask) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) Collider[] array = Physics.OverlapSphere(position, radius, LayerMask.op_Implicit(layerMask)); Collider[] array2 = array; foreach (Collider val in array2) { HurtBox component = ((Component)val).gameObject.GetComponent<HurtBox>(); if (Object.op_Implicit((Object)(object)component)) { CharacterBody body = component.healthComponent.body; if (Object.op_Implicit((Object)(object)body) && !hitBodies.Contains(body)) { hitBodies.Add(body); } } } } public static void AddUpwardImpulseToBody(GameObject victimBody, float upwardImpulseAmount) { //IL_0001: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.up * upwardImpulseAmount; CharacterMotor component = victimBody.GetComponent<CharacterMotor>(); if (Object.op_Implicit((Object)(object)component)) { component.velocity = Vector3.zero; component.ApplyForce(val * component.mass, true, true); return; } RigidbodyMotor component2 = victimBody.GetComponent<RigidbodyMotor>(); if (Object.op_Implicit((Object)(object)component2)) { component2.rigid.velocity = Vector3.zero; component2.rigid.AddForce(val * component2.mass, (ForceMode)1); } } public static void AddForwardImpulseToBody(GameObject victimBody, Vector3 directionAuthority, float forwardImpulseAmount) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) Vector3 val = directionAuthority; val.y = 0f; val = ((Vector3)(ref val)).normalized * forwardImpulseAmount; CharacterMotor component = victimBody.GetComponent<CharacterMotor>(); if (Object.op_Implicit((Object)(object)component)) { component.ApplyForce(val * component.mass, true, true); return; } RigidbodyMotor component2 = victimBody.GetComponent<RigidbodyMotor>(); if (Object.op_Implicit((Object)(object)component2)) { component2.rigid.AddForce(val * component2.mass, (ForceMode)1); } } public static void AddExplosionForce(CharacterMotor body, float explosionForce, Vector3 explosionPosition, float explosionRadius, float upliftModifier = 0f, bool useWearoff = false) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0070: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)body).transform.position - explosionPosition; Vector3 zero = Vector3.zero; if (useWearoff) { float num = 1f - ((Vector3)(ref val)).magnitude / explosionRadius; zero = ((Vector3)(ref val)).normalized * explosionForce * num; } else { zero = ((Vector3)(ref val)).normalized * explosionForce; } body.ApplyForce(zero, false, false); float num2 = 1f - upliftModifier / explosionRadius; Vector3 val2 = Vector2.op_Implicit(Vector2.up * explosionForce * num2); body.ApplyForce(val2, false, false); } public static float GenericFlatStackingFloat(float baseValue, int itemCount, float stackingValue) { return baseValue + ((float)itemCount * stackingValue - stackingValue); } public static HitBoxGroup FindHitBoxGroup(string groupName, Transform modelTransform) { if (!Object.op_Implicit((Object)(object)modelTransform)) { return null; } HitBoxGroup result = null; List<HitBoxGroup> gameObjectComponents = GetComponentsCache<HitBoxGroup>.GetGameObjectComponents(((Component)modelTransform).gameObject); int i = 0; for (int count = gameObjectComponents.Count; i < count; i++) { if (gameObjectComponents[i].groupName == groupName) { result = gameObjectComponents[i]; break; } } GetComponentsCache<HitBoxGroup>.ReturnBuffer(gameObjectComponents); return result; } public static void RefreshALLBuffStacks(CharacterBody body, BuffDef def, float duration) { //IL_0014: 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) int num = 0; for (int i = 0; i < body.timedBuffs.Count; i++) { if (body.timedBuffs[i].buffIndex == def.buffIndex) { num++; if (body.timedBuffs[i].timer < duration) { body.timedBuffs[i].timer = duration; } } } } public static Vector3 FindBestPosition(HurtBox target) { //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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) float num = 15f; Vector3 position = ((Component)target).transform.position; position.x += Random.Range(0f - num, num); position.z += Random.Range(0f - num, num); position.y += Random.Range(num, num); return position; } public static Vector3 RandomPointInBounds(Bounds bounds) { //IL_0003: 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) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) return new Vector3(Random.Range(((Bounds)(ref bounds)).min.x, ((Bounds)(ref bounds)).max.x), Random.Range(((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).max.y), Random.Range(((Bounds)(ref bounds)).min.z, ((Bounds)(ref bounds)).max.z)); } public static List<T> Join<T>(this List<T> first, List<T> second) { if (first == null) { return second; } if (second == null) { return first; } return first.Concat(second).ToList(); } public static Color HexToColor(string hex) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) hex = hex.Replace("0x", ""); hex = hex.Replace("#", ""); byte b = byte.MaxValue; byte b2 = byte.Parse(hex.Substring(0, 2), NumberStyles.HexNumber); byte b3 = byte.Parse(hex.Substring(2, 2), NumberStyles.HexNumber); byte b4 = byte.Parse(hex.Substring(4, 2), NumberStyles.HexNumber); if (hex.Length == 8) { b = byte.Parse(hex.Substring(6, 2), NumberStyles.HexNumber); } return Color32.op_Implicit(new Color32(b2, b3, b4, b)); } public static void SafeRemoveBuff(BuffDef buffToRemove, CharacterBody body) { if (Object.op_Implicit((Object)(object)body) && body.HasBuff(buffToRemove)) { body.RemoveBuff(buffToRemove); } } public static void SafeRemoveBuffs(BuffDef buffToRemove, CharacterBody body, int stacksToRemove) { if (Object.op_Implicit((Object)(object)body)) { for (int i = 0; i < stacksToRemove; i++) { SafeRemoveBuff(buffToRemove, body); } } } public static void SafeRemoveAllOfBuff(BuffDef buffToRemove, CharacterBody body) { if (Object.op_Implicit((Object)(object)body)) { int buffCount = body.GetBuffCount(buffToRemove); for (int i = 0; i < buffCount; i++) { body.RemoveBuff(buffToRemove); } } } } namespace Cloudburst { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("CloudBurstTeam.Cloudburst", "Cloudburst", "0.4.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Cloudburst : BaseUnityPlugin { public const string PluginGUID = "CloudBurstTeam.Cloudburst"; public const string PluginAuthor = "CloudBurstTeam"; public const string PluginName = "Cloudburst"; public const string PluginVersion = "0.4.1"; private static ExpansionDef dlc1 = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion(); public static AssetBundle CloudburstAssets; public static AssetBundle OldCloudburstAssets; public static AssetBundle WyattAssetBundle; public static List<AssetBundle> AssetBundles = new List<AssetBundle>(); public static ExpansionDef cloudburstExpansion; public static Cloudburst instance; public static Shader hgs = Addressables.LoadAssetAsync<Shader>((object)"RoR2/Base/Shaders/HGStandard.shader").WaitForCompletion(); public static Shader hgicr = Addressables.LoadAssetAsync<Shader>((object)"RoR2/Base/Shaders/HGIntersectionCloudRemap.shader").WaitForCompletion(); public static Shader hgcr = Addressables.LoadAssetAsync<Shader>((object)"RoR2/Base/Shaders/HGCloudRemap.shader").WaitForCompletion(); public static Shader hgsp = Addressables.LoadAssetAsync<Shader>((object)"RoR2/Base/Shaders/HGSolidParallax.shader").WaitForCompletion(); public static Shader hgdw = Addressables.LoadAssetAsync<Shader>((object)"RoR2/Base/Shaders/HGDistantWater.shader").WaitForCompletion(); public static Shader hgocr = Addressables.LoadAssetAsync<Shader>((object)"RoR2/Base/Shaders/HGOpaqueCloudRemap.shader").WaitForCompletion(); public void Awake() { instance = this; Log.Init(((BaseUnityPlugin)this).Logger); GetBundle(); Compat.Init(); Language.Init(((BaseUnityPlugin)this).Info); cloudburstExpansion = ScriptableObject.CreateInstance<ExpansionDef>(); cloudburstExpansion.nameToken = "EXPANSION_CLOUDBURST_NAME"; cloudburstExpansion.descriptionToken = "EXPANSION_CLOUDBURST_DESCRIPTION"; cloudburstExpansion.iconSprite = CloudburstAssets.LoadAsset<Sprite>("CloudburstExpansionIcon"); cloudburstExpansion.disabledIconSprite = dlc1.disabledIconSprite; ContentAddition.AddExpansionDef(cloudburstExpansion); Language.Add("EXPANSION_CLOUDBURST_NAME", "Cloudburst"); Language.Add("EXPANSION_CLOUDBURST_DESCRIPTION", "Adds content from the mod 'Cloudburst' to the game."); Language.PrintOutput("Cloudburst.txt"); SetupItems(); Language.PrintOutput("Items.txt"); ItemDisplays.PopulateDisplays(); new WyattSurvivor().Initialize(); Language.PrintOutput("Wyatt.txt"); Log.Info("Awake done."); Language.collectLanguageRootFolders += Language_collectLanguageRootFolders; } private void Language_collectLanguageRootFolders(List<string> obj) { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Language"); if (Directory.Exists(text)) { obj.Add(text); } } public void SetupItems() { if (Config.BindAndOptions("Content", "Enable Items", defaultValue: true, "set false to disable all cloudburst items.", restartRequired: true).Value) { if (Config.BindAndOptions("Items", "Enable Blast Boot (wip)", defaultValue: false, "Toggles the Blast Boot item.", restartRequired: true).Value) { BlastBoot.Setup(); } if (Config.BindAndOptions("Items", "Enable Bismuth Earrings", defaultValue: true, "Toggles the Bismuth Earrings item.", restartRequired: true).Value) { BismuthEarrings.Setup(); } if (Config.BindAndOptions("Items", "Enable Enigmatic Keycard", defaultValue: true, "Toggles the Enigmatic Keycard item.", restartRequired: true).Value) { EnigmaticKeycard.Setup(); } if (Config.BindAndOptions("Items", "Enable Fabinhoru Dagger", defaultValue: true, "Toggles the Fabinhoru Dagger item.", restartRequired: true).Value) { FabinhoruDagger.Setup(); } if (Config.BindAndOptions("Items", "Enable Glass Harvester", defaultValue: true, "Toggles the Glass Harvester item.", restartRequired: true).Value) { GlassHarvester.Setup(); } if (Config.BindAndOptions("Items", "Enable Japes Cloak", defaultValue: true, "Toggles the Jape's Cloak item.", restartRequired: true).Value) { JapesCloak.Setup(); } } } public void GetBundle() { if ((Object)(object)CloudburstAssets == (Object)null) { try { CloudburstAssets = LoadAssetBundle("cloudburst"); WyattAssetBundle = LoadAssetBundle("wyatt"); OldCloudburstAssets = LoadAssetBundle("oldcloudburst"); } catch { } } if ((Object)(object)CloudburstAssets != (Object)null) { Log.Info("Successfully loaded Asset Bundle"); ConvertMaterialsIfItWasIncrediblyUnoptimizedAndIDidntCareToImproveEnigmasCode(); } else { Log.Error("AAAAAA"); } } private AssetBundle LoadAssetBundle(string name) { AssetBundle val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "AssetBundles", name)); AssetBundles.Add(val); return val; } public void ConvertMaterialsIfItWasIncrediblyUnoptimizedAndIDidntCareToImproveEnigmasCode() { Material[] array = OldCloudburstAssets.LoadAllAssets<Material>(); for (int i = 0; i < array.Length; i++) { if (((Object)array[i].shader).name == "Standard") { array[i].shader = hgs; } if (((Object)array[i]).name.Contains("GLASS")) { array[i].shader = hgicr; } switch (((Object)array[i].shader).name) { case "Hopoo Games/FX/Cloud Remap Proxy": array[i].shader = hgcr; break; case "stubbed_Hopoo Games/FX/Cloud Remap Proxy": array[i].shader = hgcr; break; case "stubbed_Hopoo Games/Deferred/Standard Proxy": array[i].shader = hgs; break; case "Hopoo Games/Deferred/Standard Proxy": array[i].shader = hgs; break; case "stubbed_Hopoo Games/FX/Solid Parallax Proxy": array[i].shader = hgsp; break; case "stubbed_Hopoo Games/Environment/Distant Water Proxy": array[i].shader = hgdw; break; case "Hopoo Games/FX/Cloud Intersection Remap Proxy": array[i].shader = hgicr; break; case "Hopoo Games/FX/Cloud Opaque Cloud Remap Proxy": array[i].shader = hgocr; break; } } } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } } namespace Cloudburst.Modules { internal static class Asset { public static T LoadAsset<T>(string assetName) where T : Object { for (int i = 0; i < Cloudburst.AssetBundles.Count; i++) { if (Cloudburst.AssetBundles[i].Contains(assetName)) { return Cloudburst.AssetBundles[i].LoadAsset<T>(assetName); } } Log.Error("Could not load asset " + assetName + " from assetbundles"); return default(T); } public static GameObject CreateTracer(string originalTracerName, string newTracerName) { if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null) { return null; } GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true); if (!Object.op_Implicit((Object)(object)val.GetComponent<EffectComponent>())) { val.AddComponent<EffectComponent>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<VFXAttributes>())) { val.AddComponent<VFXAttributes>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>())) { val.AddComponent<NetworkIdentity>(); } val.GetComponent<Tracer>().speed = 250f; val.GetComponent<Tracer>().length = 50f; AddNewEffectDef(val); return val; } public static GameObject CloneAndColorEffect(string addressablesPath, Color color, string name, bool network = true) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)addressablesPath).WaitForCompletion(), name, network); recolorEffects(color, val); return val; } public static GameObject CloneAndColorEffectLegacy(string legacyPath, Color color, string name) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>(legacyPath), name); recolorEffects(color, val); return val; } public static void recolorEffects(Color color, GameObject MercSwordSlash) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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) ParticleSystemRenderer[] componentsInChildren = MercSwordSlash.GetComponentsInChildren<ParticleSystemRenderer>(); ParticleSystemRenderer[] array = componentsInChildren; foreach (ParticleSystemRenderer val in array) { ((Renderer)val).material.SetColor("_MainColor", color); ((Renderer)val).material.SetColor("_Color", color); ((Renderer)val).material.SetColor("_TintColor", color); } } internal static NetworkSoundEventDef CreateNetworkSoundEventDef(string eventName) { NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>(); val.akId = AkSoundEngine.GetIDFromString(eventName); val.eventName = eventName; ContentAddition.AddNetworkSoundEventDef(val); return val; } internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert) { if (!Object.op_Implicit((Object)(object)objectToConvert)) { return; } Renderer[] componentsInChildren = objectToConvert.GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { if (!(val is ParticleSystemRenderer) && val != null) { val.material?.SetHopooMaterial(); } } } internal static RendererInfo[] SetupRendererInfos(GameObject obj) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) MeshRenderer[] componentsInChildren = obj.GetComponentsInChildren<MeshRenderer>(); RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[componentsInChildren.Length]; for (int i = 0; i < componentsInChildren.Length; i++) { array[i] = new RendererInfo { defaultMaterial = ((Renderer)componentsInChildren[i]).material, renderer = (Renderer)(object)componentsInChildren[i], defaultShadowCastingMode = (ShadowCastingMode)1, ignoreOverlays = false }; } return array; } public static GameObject LoadSurvivorModel(string modelName) { GameObject val = Asset.LoadAsset<GameObject>(modelName); if ((Object)(object)val == (Object)null) { Log.Error("Trying to load a null model- check to see if the BodyName in your code matches the prefab name of the object in Unity\nFor Example, if your prefab in unity is 'mdlHenry', then your BodyName must be 'Henry'"); return null; } return PrefabAPI.InstantiateClone(val, ((Object)val).name, false); } internal static GameObject LoadCrosshair(string crosshairName) { if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair") == (Object)null) { return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/StandardCrosshair"); } return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair"); } public static GameObject LoadEffect(string resourceName) { return LoadEffect(resourceName, "", parentToTransform: false); } public static GameObject LoadEffect(string resourceName, string soundName) { return LoadEffect(resourceName, soundName, parentToTransform: false); } public static GameObject LoadEffect(string resourceName, bool parentToTransform) { return LoadEffect(resourceName, "", parentToTransform); } public static GameObject LoadEffect(string resourceName, string soundName, bool parentToTransform) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) GameObject val = Asset.LoadAsset<GameObject>(resourceName); if (!Object.op_Implicit((Object)(object)val)) { Log.Error("Failed to load effect: " + resourceName + " because it does not exist in the AssetBundle"); return null; } val.AddComponent<DestroyOnTimer>().duration = 12f; val.AddComponent<NetworkIdentity>(); val.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2; EffectComponent val2 = val.AddComponent<EffectComponent>(); val2.applyScale = false; val2.effectIndex = (EffectIndex)(-1); val2.parentToReferencedTransform = parentToTransform; val2.positionAtReferencedTransform = true; val2.soundName = soundName; AddNewEffectDef(val, soundName); return val; } public static void AddNewEffectDef(GameObject effectPrefab) { AddNewEffectDef(effectPrefab, ""); } public static void AddNewEffectDef(GameObject effectPrefab, string soundName) { ContentAddition.AddEffect(effectPrefab); } } public static class Buffs { internal static BuffDef AddNewBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) BuffDef val = ScriptableObject.CreateInstance<BuffDef>(); ((Object)val).name = buffName; val.buffColor = buffColor; val.canStack = canStack; val.isDebuff = isDebuff; val.eliteDef = null; val.iconSprite = buffIcon; ContentAddition.AddBuffDef(val); return val; } } public class Compat { public static bool RiskOfOptionsInstalled; public static bool MemeInstalled; public static void Init() { RiskOfOptionsInstalled = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); MemeInstalled = Chainloader.PluginInfos.ContainsKey("com.weliveinasociety.CustomEmotesAPI"); } } public static class Config { private static bool loadedIcon; 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 = ((BaseUnityPlugin)Cloudburst.instance).Config.Bind<T>(section, name, defaultValue, description); if (Compat.RiskOfOptionsInstalled) { TryRegisterOption<T>(val, restartRequired); } return val; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void TryRegisterOption<T>(ConfigEntry<T> entry, bool restartRequired) { //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) //IL_0025: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown if (entry is ConfigEntry<float>) { ModSettingsManager.AddOption((BaseOption)new SliderOption(entry as ConfigEntry<float>, new SliderConfig { min = 0f, max = 20f, formatString = "{0:0.00}", restartRequired = restartRequired })); } if (entry is ConfigEntry<int>) { ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry as ConfigEntry<int>, restartRequired)); } if (entry is ConfigEntry<bool>) { ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry as ConfigEntry<bool>, restartRequired)); } if (!loadedIcon) { loadedIcon = true; try { ModSettingsManager.SetModIcon(LoadSpriteFromModFolder("icon.png")); } catch (Exception ex) { Log.Error("error adding ROO mod icon\n" + ex); } } } 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 = ((BaseUnityPlugin)Cloudburst.instance).Config.Bind<float>(section, name, defaultValue, description); if (Compat.RiskOfOptionsInstalled) { TryRegisterOptionSlider(val, min, max, restartRequired); } return val; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void TryRegisterOptionSlider(ConfigEntry<float> entry, float min, float max, bool restartRequired) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new SliderOption(entry, new SliderConfig { min = min, max = max, formatString = "{0:0.00}", restartRequired = restartRequired })); } public static bool GetKeyPressed(ConfigEntry<KeyboardShortcut> entry) { //IL_0003: 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_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_0020: 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_0052: 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 static Sprite LoadSpriteFromModFolder(string fileName, bool pointFilter = false) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)Cloudburst.instance).Info.Location), fileName); Texture2D val = new Texture2D(2, 2); byte[] array = File.ReadAllBytes(path); ImageConversion.LoadImage(val, array); ((Texture)val).filterMode = (FilterMode)((!pointFilter) ? 1 : 0); val.Apply(); if (pointFilter) { ((Texture)val).filterMode = (FilterMode)0; val.Apply(); } ((Object)val).name = fileName; ((Texture)val).filterMode = (FilterMode)0; val.Apply(); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height); Sprite val3 = Sprite.Create(val, val2, new Vector2(0.5f, 0.5f), 16f); ((Object)val3).name = fileName; return val3; } } internal static class ItemDisplayCheck { public static List<Object> allDisplayedItems; private static Object[] vanillaItems; private static Object[] dlc1Items; private static Object[] junkItems; private unsafe static void GatherAllItems() { //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //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_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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: 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_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) allDisplayedItems = new List<Object>(ItemDisplays.KeyAssetDisplayPrefabs.Keys); for (int i = 0; i < ContentManager.allLoadedContentPacks.Length; i++) { ReadOnlyContentPack val = Unsafe.Read<ReadOnlyContentPack>((void*)ContentManager.allLoadedContentPacks[i]); switch (((ReadOnlyContentPack)(ref val)).identifier) { case "RoR2.BaseContent": { Object[] array = (Object[])(object)((IEnumerable<ItemDef>)(object)((ReadOnlyContentPack)(ref val)).itemDefs).ToArray(); vanillaItems = array; vanillaItems = vanillaItems.Concat((IEnumerable<Object>)(object)((IEnumerable<EquipmentDef>)(object)((ReadOnlyContentPack)(ref val)).equipmentDefs).ToArray()).ToArray(); break; } case "RoR2.DLC1": { Object[] array = (Object[])(object)((IEnumerable<ItemDef>)(object)((ReadOnlyContentPack)(ref val)).itemDefs).ToArray(); dlc1Items = array; dlc1Items = dlc1Items.Concat((IEnumerable<Object>)(object)((IEnumerable<EquipmentDef>)(object)((ReadOnlyContentPack)(ref val)).equipmentDefs).ToArray()).ToArray(); break; } case "RoR2.Junk": { Object[] array = (Object[])(object)((IEnumerable<ItemDef>)(object)((ReadOnlyContentPack)(ref val)).itemDefs).ToArray(); junkItems = array; junkItems = junkItems.Concat((IEnumerable<Object>)(object)((IEnumerable<EquipmentDef>)(object)((ReadOnlyContentPack)(ref val)).equipmentDefs).ToArray()).ToArray(); break; } } } allDisplayedItems.Sort(delegate(Object item1, Object item2) { if (item1 is ItemDef && item2 is ItemDef) { return ((item1 is ItemDef) ? item1 : null).name.CompareTo(((item2 is ItemDef) ? item2 : null).name); } if (item1 is EquipmentDef && item2 is EquipmentDef) { return ((item1 is EquipmentDef) ? item1 : null).name.CompareTo(((item2 is EquipmentDef) ? item2 : null).name); } if (item1 is ItemDef && item2 is EquipmentDef) { return -1; } return (item1 is EquipmentDef && item2 is ItemDef) ? 1 : 0; }); } public static void PrintUnused(ItemDisplayRuleSet itemDisplayRuleSet, string bodyName) { PrintUnused((IEnumerable<KeyAssetRuleGroup>)itemDisplayRuleSet.keyAssetRuleGroups.ToList(), bodyName); } public static void PrintUnused(IEnumerable<KeyAssetRuleGroup> ruleSet, string bodyName) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) string text = "generating item displays for " + bodyName; if (allDisplayedItems == null) { GatherAllItems(); } List<Object> list = new List<Object>(allDisplayedItems); string text2 = ""; 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; } } } foreach (Object item2 in list) { string content = "MISSING"; if (vanillaItems.Contains(item2)) { content = "RoR2Content"; } if (dlc1Items.Contains(item2)) { content = "DLC1Content"; } if (junkItems.Contains(item2)) { content = "JunkContent"; } string text3 = ""; if (ItemDisplays.KeyAssetDisplayPrefabs.ContainsKey(item2)) { text3 += SpitOutNewRule(item2, content, text2, ItemDisplays.KeyAssetDisplayPrefabs[item2]); } else { Log.Error($"COULD NOT FIND DISPLAY PREFABS FOR KEYASSET {item2}"); } text += text3; } Log.Message(text); } private static string SpitOutNewRule(Object asset, string content, string firstCompatibleChild, List<string> prefabNames) { string text = ((asset is ItemDef) ? "Items" : "Equipment"); if (prefabNames.Count == 0) { return $"\n[NO PREFABS FOUND FOR THE KEYASSET {asset}"; } string text2 = "\n itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(" + content + "." + text + "." + asset.name; for (int i = 0; i < prefabNames.Count; i++) { text2 = text2 + ",\n ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay(\"" + prefabNames[i] + "\"),\n \"" + firstCompatibleChild + "\",\n new Vector3(2, 2, 2),\n new Vector3(0, 0, 0),\n new Vector3(1, 1, 1)\n )"; } return text2 + "));"; } } internal static class ItemDisplays { public static Dictionary<string, GameObject> itemDisplayPrefabs = new Dictionary<string, GameObject>(); public static Dictionary<Object, List<string>> KeyAssetDisplayPrefabs = new Dictionary<Object, List<string>>(); public static void PopulateDisplays() { PopulateDisplaysFromBody("MercBody"); PopulateCustomLightningArm(); } private static void PopulateDisplaysFromBody(string bodyName) { GameObject obj = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyName); object obj2; if (obj == null) { obj2 = null; } else { ModelLocator component = obj.GetComponent<ModelLocator>(); obj2 = ((component == null) ? null : ((Component)component.modelTransform).GetComponent<CharacterModel>()?.itemDisplayRuleSet); } ItemDisplayRuleSet val = (ItemDisplayRuleSet)obj2; if ((Object)(object)val == (Object)null) { Log.Error("couldn't load ItemDisplayRuleSet from " + bodyName + ". Check if name was entered correctly"); return; } KeyAssetRuleGroup[] keyAssetRuleGroups = val.keyAssetRuleGroups; for (int i = 0; i < keyAssetRuleGroups.Length; i++) { ItemDisplayRule[] rules = keyAssetRuleGroups[i].displayRuleGroup.rules; bool flag = KeyAssetDisplayPrefabs.ContainsKey(keyAssetRuleGroups[i].keyAsset); for (int j = 0; j < rules.Length; j++) { GameObject followerPrefab = rules[j].followerPrefab; if (!Object.op_Implicit((Object)(object)followerPrefab)) { continue; } string key = ((Object)followerPrefab).name?.ToLowerInvariant(); if (!itemDisplayPrefabs.ContainsKey(key)) { itemDisplayPrefabs[key] = followerPrefab; } if (!flag) { if (!KeyAssetDisplayPrefabs.ContainsKey(keyAssetRuleGroups[i].keyAsset)) { KeyAssetDisplayPrefabs[keyAssetRuleGroups[i].keyAsset] = new List<string>(); } KeyAssetDisplayPrefabs[keyAssetRuleGroups[i].keyAsset].Add(((Object)followerPrefab).name); } } } } 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; } 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; } public static KeyAssetRuleGroup CreateGenericDisplayRuleGroup(Object keyAsset_, GameObject itemPrefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //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_0025: Unknown result type (might be due to invalid IL or missing references) ItemDisplayRule val = CreateDisplayRule(itemPrefab, childName, position, rotation, scale); return CreateDisplayRuleGroupWithRules(keyAsset_, val); } public static ItemDisplayRule CreateDisplayRule(string prefabName, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_002c: 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_0034: 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_0042: 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_0046: 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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0014: 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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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; } public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(string itemName, params ItemDisplayRule[] rules) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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_0003: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) KeyAssetRuleGroup result = default(KeyAssetRuleGroup); result.keyAsset = keyAsset_; result.displayRuleGroup = new DisplayRuleGroup { rules = rules }; return result; } public static KeyAssetRuleGroup CreateGenericDisplayRule(string itemName, string prefabName, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0009: 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_000c: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return CreateGenericDisplayRule(GetKeyAssetFromString(itemName), prefabName, childName, position, rotation, scale); } public static KeyAssetRuleGroup CreateGenericDisplayRule(Object itemDef, string prefabName, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0009: 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_000c: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return CreateGenericDisplayRule(itemDef, LoadDisplay(prefabName), childName, position, rotation, scale); } public static KeyAssetRuleGroup CreateGenericDisplayRule(string itemName, GameObject displayPrefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0009: 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_000c: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return CreateGenericDisplayRule(GetKeyAssetFromString(itemName), displayPrefab, childName, position, rotation, scale); } public static KeyAssetRuleGroup CreateGenericDisplayRule(Object itemDef, GameObject displayPrefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_002d: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)displayPrefab == (Object)null) { Log.Warning("could not find display prefab for " + (object)itemDef); } KeyAssetRuleGroup result = default(KeyAssetRuleGroup); result.keyAsset = itemDef; result.displayRuleGroup = new DisplayRuleGroup { rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, childName = childName, followerPrefab = displayPrefab, limbMask = (LimbFlags)0, localPos = position, localAngles = rotation, localScale = scale } } }; return result; } } internal static class Language { public static string TokensOutput = ""; public static PluginInfo Info; public static bool printingEnabled => false; internal static void Init(PluginInfo info) { Info = info; } public static void Add(string token, string text) { LanguageAPI.Add(token, text, "en"); 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.Warning(fileName + ": \n" + text); if (!string.IsNullOrEmpty(fileName)) { string path = Path.Combine(Directory.GetParent(Info.Location).FullName, "Language", "en", fileName); File.WriteAllText(path, 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 CreateHopooMaterial(string materialName) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown Material val = cachedMaterials.Find(delegate(Material mat) { materialName.Replace(" (Instance)", ""); return ((Object)mat).name.Contains(materialName); }); if (Object.op_Implicit((Object)(object)val)) { return val; } val = Asset.LoadAsset<Material>(materialName); if (!Object.op_Implicit((Object)(object)val)) { Log.Error("Failed to load material: " + materialName + " - Check to see that the material in your Unity project matches this name"); return new Material(hotpoo); } return val.SetHopooMaterial(); } public static Material SetHopooMaterial(this Material tempMat) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if (cachedMaterials.Contains(tempMat)) { return tempMat; } float? num = null; Color? val = null; if (tempMat.IsKeywordEnabled("_NORMALMAP")) { num = tempMat.GetFloat("_BumpScale"); } if (tempMat.IsKeywordEnabled("_EMISSION")) { val = tempMat.GetColor("_EmissionColor"); } tempMat.shader = hotpoo; tempMat.SetColor("_Color", tempMat.GetColor("_Color")); tempMat.SetTexture("_MainTex", tempMat.GetTexture("_MainTex")); tempMat.SetTexture("_EmTex", tempMat.GetTexture("_EmissionMap")); tempMat.EnableKeyword("DITHER"); if (num.HasValue) { tempMat.SetFloat("_NormalStrength", num.Value); } if (val.HasValue) { tempMat.SetColor("_EmColor", val.Value); tempMat.SetFloat("_EmPower", 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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (cachedMaterials.Contains(material)) { return new Material(material); } return material; } public static Material SetColor(this Material material, Color color) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) material.SetColor("_Color", color); return material; } public static Material SetNormal(this Material material, float normalStrength = 1f) { material.SetFloat("_NormalStrength", normalStrength); return material; } public static Material SetEmission(this Material material) { return material.SetEmission(1f); } public static Material SetEmission(this Material material, float emission) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return material.SetEmission(emission, Color.white); } public static Material SetEmission(this Material material, float emission, Color emissionColor) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) material.SetFloat("_EmPower", emission); material.SetColor("_EmColor", emissionColor); return material; } public static Material SetCull(this Material material, bool cull = false) { material.SetInt("_Cull", cull ? 1 : 0); return material; } } public static class Unlockables { public static UnlockableDef CreateUnlockableDef(string unlockName, string nameToken, Sprite achievementIcon) { UnlockableDef val = ScriptableObject.CreateInstance<UnlockableDef>(); val.cachedName = unlockName; val.nameToken = nameToken; val.achievementIcon = achievementIcon; ContentAddition.AddUnlockableDef(val); return val; } } internal static class Prefabs { private static PhysicMaterial ragdollMaterial; public static GameObject CreateDisplayPrefab(string displayModelName, GameObject prefab, BodyInfo bodyInfo) { GameObject val = Asset.LoadSurvivorModel(displayModelName); CharacterModel val2 = val.GetComponent<CharacterModel>(); if (!Object.op_Implicit((Object)(object)val2)) { val2 = val.AddComponent<CharacterModel>(); } val2.baseRendererInfos = prefab.GetComponentInChildren<CharacterModel>().baseRendererInfos; Asset.ConvertAllRenderersToHopooShader(val); return val.gameObject; } public static GameObject CreateBodyPrefab(string bodyName, string modelName, BodyInfo bodyInfo) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyInfo.bodyNameToClone + "Body"); if (!Object.op_Implicit((Object)(object)val)) { Log.Error(bodyInfo.bodyNameToClone + "Body is not a valid body, character creation failed"); return null; } GameObject val2 = PrefabAPI.InstantiateClone(val, bodyName); Transform val3 = null; GameObject val4 = null; if (modelName != "mdl") { val4 = Asset.LoadSurvivorModel(modelName); if ((Object)(object)val4 == (Object)null) { val4 = ((Component)val2.GetComponentInChildren<CharacterModel>()).gameObject; } val3 = AddCharacterModelToSurvivorBody(val2, val4.transform, bodyInfo); } CharacterBody component = val2.GetComponent<CharacterBody>(); ((Object)component).name = bodyInfo.bodyName; component.baseNameToken = bodyInfo.bodyNameToken; component.subtitleNameToken = bodyInfo.subtitleNameToken; component.portraitIcon = bodyInfo.characterPortrait; component.bodyColor = bodyInfo.bodyColor; component._defaultCrosshairPrefab = bodyInfo.crosshair; component.hideCrosshair = false; component.preferredPodPrefab = bodyInfo.podPrefab; component.baseMaxHealth = bodyInfo.maxHealth; component.baseRegen = bodyInfo.healthRegen; component.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; SetupCameraTargetParams(val2, bodyInfo); SetupModelLocator(val2, val3, val4.transform); SetupCapsuleCollider(val2); SetupHurtBoxGroup(val2, val4); SetupAimAnimator(val2, val4); if ((Object)(object)val3 != (Object)null) { SetupCharacterDirection(val2, val3, val4.transform); } SetupFootstepController(val4); SetupRagdoll(val4); ContentAddition.AddBody(val2); return val2; } public static void CreateGenericDoppelganger(GameObject bodyPrefab, string masterName, string masterToCopy) { GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/" + masterToCopy + "MonsterMaster"), masterName, true); val.GetComponent<CharacterMaster>().bodyPrefab = bodyPrefab; ContentAddition.AddMaster(val); } private static Transform AddCharacterModelToSurvivorBody(GameObject bodyPrefab, Transform modelTransform, BodyInfo bodyInfo) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) for (int num = bodyPrefab.transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)bodyPrefab.transform.GetChild(num)).gameObject); } Transform transform = new GameObject("ModelBase").transform; transform.parent = bodyPrefab.transform; transform.localPosition = bodyInfo.modelBasePosition; transform.localRotation = Quaternion.identity; modelTransform.parent = ((Component)transform).transform; modelTransform.localPosition = Vector3.zero; modelTransform.localRotation = Quaternion.identity; GameObject val = new GameObject("CameraPivot"); val.transform.parent = bodyPrefab.transform; val.transform.localPosition = bodyInfo.cameraPivotPosition; val.transform.localRotation = Quaternion.identity; GameObject val2 = new GameObject("AimOrigin"); val2.transform.parent = bodyPrefab.transform; val2.transform.localPosition = bodyInfo.aimOriginPosition; val2.transform.localRotation = Quaternion.identity; bodyPrefab.GetComponent<CharacterBody>().aimOriginTransform = val2.transform; return ((Component)transform).transform; } public static CharacterModel SetupCharacterModel(GameObject prefab) { return SetupCharacterModel(prefab, null); } public static CharacterModel SetupCharacterModel(GameObject prefab, CustomRendererInfo[] customInfos) { CharacterModel val = ((Component)prefab.GetComponent<ModelLocator>().modelTransform).gameObject.GetComponent<CharacterModel>(); bool flag = (Object)(object)val != (Object)null; if (!flag) { val = ((Component)prefab.GetComponent<ModelLocator>().modelTransform).gameObject.AddComponent<CharacterModel>(); } val.body = prefab.GetComponent<CharacterBody>(); val.autoPopulateLightInfos = true; val.invisibilityCount = 0; val.temporaryOverlays = new List<TemporaryOverlayInstance>(); if (!flag) { SetupCustomRendererInfos(val, customInfos); } else { SetupPreAttachedRendererInfos(val); } return val; } public static void SetupPreAttachedRendererInfos(CharacterModel characterModel) { for (int i = 0; i < characterModel.baseRendererInfos.Length; i++) { if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null) { characterModel.baseRendererInfos[i].defaultMaterial = characterModel.baseRendererInfos[i].renderer.sharedMaterial; } characterModel.baseRendererInfos[i].defaultMaterial.SetHopooMaterial(); } } public static void SetupCustomRendererInfos(CharacterModel characterModel, CustomRendererInfo[] customInfos) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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.material.SetHopooMaterial() : component2.material); } list.Add(new RendererInfo { renderer = component2, defaultMaterial = val, ignoreOverlays = customInfos[i].ignoreOverlays, defaultShadowCastingMode = (ShadowCastingMode)1 }); } } characterModel.baseRendererInfos = list.ToArray(); } 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_0018: 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 void SetupHurtBoxGroup(GameObject bodyPrefab, GameObject bodyModel) { HealthComponent component = bodyPrefab.GetComponent<HealthComponent>(); HurtBoxGroup component2 = bodyModel.GetComponent<HurtBoxGroup>(); if ((Object)(object)component2 != (Object)null) { component2.mainHurtBox.healthComponent = component; for (int i = 0; i < component2.hurtBoxes.Length; i++) { component2.hurtBoxes[i].healthComponent = component; } } else { SetupMainHurtboxesFromChildLocator(bodyPrefab, bodyModel); } } private static void SetupMainHurtboxesFromChildLocator(GameObject prefab, GameObject model) { //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) ChildLocator component = model.GetComponent<ChildLocator>(); if (!Object.op_Implicit((Object)(object)component.FindChild("MainHurtbox"))) { Log.Warning("Could not set up main hurtbox: make sure you have a transform pair in your prefab's ChildLocator component called 'MainHurtbox'"); return; } HurtBoxGroup val = model.AddComponent<HurtBoxGroup>(); HurtBox val2 = null; GameObject val3 = component.FindChildGameObject("HeadHurtbox"); if (Object.op_Implicit((Object)(object)val3)) { val2 = val3.AddComponent<HurtBox>(); ((Component)val2).gameObject.layer = LayerIndex.entityPrecise.intVal; val2.healthComponent = prefab.GetComponent<HealthComponent>(); val2.isBullseye = false; val2.isSniperTarget = true; val2.damageModifier = (DamageModifier)0; val2.hurtBoxGroup = val; val2.indexInGroup = 1; } HurtBox val4 = ((Component)component.FindChild("MainHurtbox")).gameObject.AddComponent<HurtBox>(); ((Component)val4).gameObject.layer = LayerIndex.entityPrecise.intVal; val4.healthComponent = prefab.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 SetupHurtBoxes(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 val = model.AddComponent<FootstepHandler>(); val.baseFootstepString = "Play_player_footstep"; val.sprintFootstepOverrideString = ""; val.enableFootstepDust = true; val.footstepDustPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/GenericFootstepDust"); } private static void SetupRagdoll(GameObject model) { RagdollController component = model.GetComponent<RagdollController>(); if (!Object.op_Implicit((Object)(object)component)) { return; } if ((Object)(object)ragdollMaterial == (Object)null) { ragdollMaterial = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<RagdollController>().bones[1]).GetComponent<Collider>().material; } Transform[] bones = component.bones; foreach (Transform val in bones) { if (Object.op_Implicit((Object)(object)val)) { ((Component)val).gameObject.layer = LayerIndex.ragdoll.intVal; Collider component2 = ((Component)val).GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component2)) { component2.material = ragdollMaterial; component2.sharedMaterial = ragdollMaterial; } } } } private static void SetupAimAnimator(GameObject prefab, GameObject model) { AimAnimator val = model.AddComponent<AimAnimator>(); val.directionComponent = prefab.GetComponent<CharacterDirection>(); val.pitchRangeMax = 60f; val.pitchRangeMin = -60f; val.yawRangeMin = -80f; val.yawRangeMax = 80f; val.pitchGiveupRange = 30f; val.yawGiveupRange = 10f; val.giveupDuration = 3f; val.inputBank = prefab.GetComponent<InputBankTest>(); } public static void SetupHitbox(GameObject prefab, Transform hitboxTransform, string hitboxName) { HitBoxGroup val = prefab.AddComponent<HitBoxGroup>(); HitBox val2 = ((Component)hitboxTransform).gameObject.AddComponent<HitBox>(); ((Component)hitboxTransform).gameObject.layer = LayerIndex.projectile.intVal; val.hitBoxes = (HitBox[])(object)new HitBox[1] { val2 }; val.groupName = hitboxName; } public static void SetupHitbox(GameObject prefab, string hitboxName, params Transform[] hitboxTransforms) { HitBoxGroup val = prefab.AddComponent<HitBoxGroup>(); List<HitBox> list = new List<HitBox>(); foreach (Transform val2 in hitboxTransforms) { HitBox item = ((Component)val2).gameObject.AddComponent<HitBox>(); ((Component)val2).gameObject.layer = LayerIndex.projectile.intVal; list.Add(item); } val.hitBoxes = list.ToArray(); val.groupName = hitboxName; } } public class CustomRendererInfo { public string childName; public Material material = null; public bool dontHotpoo = false; public bool ignoreOverlays = false; } internal static class Skills { public static void CreateSkillFamilies(GameObject targetPrefab, bool destroyExisting = true) { if (destroyExisting) { GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren<GenericSkill>(); foreach (GenericSkill val in componentsInChildren) { Object.DestroyImmediate((Object)(object)val); } } SkillLocator component = targetPrefab.GetComponent<SkillLocator>(); component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary"); component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary"); component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility"); component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special"); } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string familyName, bool hidden = false) { GenericSkill val = targetPrefab.AddComponent<GenericSkill>(); val.skillName = familyName; val.hideInCharacterSelect = hidden; SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>(); ((Object)val2).name = ((Object)targetPrefab).name + familyName + "Family"; val2.variants = (Variant[])(object)new Variant[0]; val._skillFamily = val2; ContentAddition.AddSkillFamily(val2); return val; } public static void AddSkillToFamily(SkillFamily skillFamily, SkillDef skillDef, UnlockableDef unlockableDef = null) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); Variant[] variants = skillFamily.variants; int num = skillFamily.variants.Length - 1; Variant val = new Variant { skillDef = skillDef, unlockableDef = unlockableDef }; ((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null); variants[num] = val; } public static void AddSkillsToFamily(SkillFamily skillFamily, params SkillDef[] skillDefs) { foreach (SkillDef skillDef in skillDefs) { AddSkillToFamily(skillFamily, skillDef); } } public static void AddPrimarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().primary.skillFamily, skillDefs); } public static void AddSecondarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().secondary.skillFamily, skillDefs); } public static void AddUtilitySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().utility.skillFamily, skillDefs); } public static void AddSpecialSkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().special.skillFamily, skillDefs); } public static void AddUnlockablesToFamily(SkillFamily skillFamily, params UnlockableDef[] unlockableDefs) { //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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < unlockableDefs.Length; i++) { Variant val = skillFamily.variants[i]; val.unlockableDef = unlockableDefs[i]; skillFamily.variants[i] = val; } } public static SkillDef CreateSkillDef(SkillDefInfo skillDefInfo) { return Skills.CreateSkillDef<SkillDef>(skillDefInfo); } public static T CreateSkillDef<T>(SkillDefInfo skillDefInfo) where T : SkillDef { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_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) T val = ScriptableObject.CreateInstance<T>(); ((SkillDef)val).skillName = skillDefInfo.skillName; ((Object)(object)val).name = skillDefInfo.skillName; ((SkillDef)val).skillNameToken = skillDefInfo.skillNameToken; ((SkillDef)val).skillDescriptionToken = skillDefInfo.skillDescriptionToken; ((SkillDef)val).icon = skillDefInfo.skillIcon; ((SkillDef)val).activationState = skillDefInfo.activationState; ((SkillDef)val).activationStateMachineName = skillDefInfo.activationStateMachineName; ((SkillDef)val).baseMaxStock = skillDefInfo.baseMaxStock; ((SkillDef)val).baseRechargeInterval = skillDefInfo.baseRechargeInterval; ((SkillDef)val).beginSkillCooldownOnSkillEnd = skillDefInfo.beginSkillCooldownOnSkillEnd; ((SkillDef)val).canceledFromSprinting = skillDefInfo.canceledFromSprinting; ((SkillDef)val).forceSprintDuringState = skillDefInfo.forceSprintDuringState; ((SkillDef)val).fullRestockOnAssign = skillDefInfo.fullRestockOnAssign; ((SkillDef)val).interruptPriority = skillDefInfo.interruptPriority; ((SkillDef)val).resetCooldownTimerOnUse = skillDefInfo.resetCooldownTimerOnUse; ((SkillDef)val).isCombatSkill = skillDefInfo.isCombatSkill; ((SkillDef)val).mustKeyPress = skillDefInfo.mustKeyPress; ((SkillDef)val).cancelSprintingOnActivation = skillDefInfo.cancelSprintingOnActivation; ((SkillDef)val).rechargeStock = skillDefInfo.rechargeStock; ((SkillDef)val).requiredStock = skillDefInfo.requiredStock; ((SkillDef)val).stockToConsume = skillDefInfo.stockToConsume; ((SkillDef)val).keywordTokens = skillDefInfo.keywordTokens; ContentAddition.AddSkillDef((SkillDef)(object)val); return val; } } internal class SkillDefInfo { public string skillName; public string skillNameToken; public string skillDescriptionToken; public string[] keywordTokens = new string[0]; public Sprite skillIcon; public SerializableEntityStateType activationState; public InterruptPriority interruptPriority; public string activationStateMachineName; public float baseRechargeInterval; public int baseMaxStock = 1; public int rechargeStock = 1; public int requiredStock = 1; public int stockToConsume = 1; public bool isCombatSkill = true; public bool canceledFromSprinting; public bool forceSprintDuringState; public bool cancelSprintingOnActivation = true; public bool beginSkillCooldownOnSkillEnd; public bool fullRestockOnAssign = true; public bool resetCooldownTimerOnUse; public bool mustKeyPress; public SkillDefInfo() { } public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName = "Weapon", bool agile = false) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) this.skillName = skillName; this.skillName = skillNameToken; this.skillNameToken = skillNameToken; this.skillDescriptionToken = skillDescriptionToken; this.skillIcon = skillIcon; this.activationState = activationState; this.activationStateMachineName = activationStateMachineName; interruptPriority = (InterruptPriority)0; isCombatSkill = true; baseRechargeInterval = 0f; requiredStock = 0; stockToConsume = 0; cancelSprintingOnActivation = !agile; if (agile) { keywordTokens = new string[1] { "KEYWORD_AGILE" }; } } } internal static class Skins { internal struct SkinDefInfo { internal SkinDef[] BaseSkins; internal Sprite Icon; internal string NameToken; internal UnlockableDef UnlockableDef; internal GameObject RootObject; internal RendererInfo[] RendererInfos; internal MeshReplacement[] MeshReplacements; internal GameObjectActivation[] GameObjectActivations; internal ProjectileGhostReplacement[] ProjectileGhostReplacements; internal MinionSkinReplacement[] MinionSkinReplacements; internal string Name; } [CompilerGenerated] private static class <>O { public static hook_Awake <0>__DoNothing; } internal static SkinDef CreateSkinDef(string skinName, Sprite skinIcon, RendererInfo[] defaultRendererInfos, GameObject root, UnlockableDef unlockableDef = null) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown SkinDefInfo skinDefInfo = default(SkinDefInfo); skinDefInfo.BaseSkins = Array.Empty<SkinDef>(); skinDefInfo.GameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[0]; skinDefInfo.Icon = skinIcon; skinDefInfo.MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0]; skinDefInfo.MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0]; skinDefInfo.Name = skinName; skinDefInfo.NameToken = skinName; skinDefInfo.ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0]; skinDefInfo.RendererInfos = (RendererInfo[])(object)new RendererInfo[defaultRendererInfos.Length]; skinDefInfo.RootObject = root; skinDefInfo.UnlockableDef = unlockableDef; SkinDefInfo skinDefInfo2 = skinDefInfo; object obj = <>O.<0>__DoNothing; if (obj == null) { hook_Awake val = DoNothing; <>O.<0>__DoNothing = val; obj = (object)val; } SkinDef.Awake += (hook_Awake)obj; SkinDef val2 = ScriptableObject.CreateInstance<SkinDef>(); val2.baseSkins = skinDefInfo2.BaseSkins; val2.icon = skinDefInfo2.Icon; val2.unlockableDef = skinDefInfo2.UnlockableDef; val2.rootObject = skinDefInfo2.RootObject; defaultRendererInfos.CopyTo(skinDefInfo2.RendererInfos, 0); val2.rendererInfos = skinDefInfo2.RendererInfos; val2.gameObjectActivations = skinDefInfo2.GameObjectActivations; val2.meshReplacements = skinDefInfo2.MeshReplacements; val2.projectileGhostReplacements = skinDefInfo2.ProjectileGhostReplacements; val2.minionSkinReplacements = skinDefInfo2.MinionSkinReplacements; val2.nameToken = skinDefInfo2.NameToken; ((Object)val2).name = skinDefInfo2.Name; object obj2 = <>O.<0>__DoNothing; if (obj2 == null) { hook_Awake val3 = DoNothing; <>O.<0>__DoNothing = val3; obj2 = (object)val3; } SkinDef.Awake -= (hook_Awake)obj2; return val2; } private static void DoNothing(orig_Awake orig, SkinDef self) { } private static RendererInfo[] getRendererMaterials(RendererInfo[] defaultRenderers, params Material[] materials) { RendererInfo[] array = (RendererInfo[])(object)new RendererInfo[defaultRenderers.Length]; defaultRenderers.CopyTo(array, 0); for (int i = 0; i < array.Length; i++) { try { array[i].defaultMaterial = materials[i]; } catch { Log.Error("error adding skin rendererinfo material. make sure you're not passing in too many"); } } return array; } internal static MeshReplacement[] getMeshReplacements(RendererInfo[] defaultRendererInfos, params string[] meshes) { //IL_001d: 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) List<MeshReplacement> list = new List<MeshReplacement>(); for (int i = 0; i < defaultRendererInfos.Length; i++) { if (!string.IsNullOrEmpty(meshes[i])) { list.Add(new MeshReplacement { renderer = defaultRendererInfos[i].renderer, mesh = Asset.LoadAsset<Mesh>(meshes[i]) }); } } return list.ToArray(); } } } namespace Cloudburst.Modules.Survivors { public abstract class SurvivorBase<T> : CharacterBase<T> where T : CharacterBase<T> { public abstract string survivorTokenPrefix { get; } public abstract UnlockableDef characterUnlockableDef { get; } public virtual ConfigEntry<bool> characterEnabledConfig { get; set; } public virtual GameObject displayPrefab { get; set; } public override void InitializeCharacter() { if (characterEnabledConfig == null || characterEnabledConfig.Value) { InitializeUnlockables(); base.InitializeCharacter(); InitializeSurvivor(); } } protected override void InitializeCharacterBodyAndModel() { base.InitializeCharacterBodyAndModel(); InitializeDisplayPrefab(); } protected virtual void InitializeSurvivor() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) RegisterNewSurvivor(bodyPrefab, displayPrefab, Color.grey, survivorTokenPrefix, characterUnlockableDef, bodyInfo.sortPosition); } protected virtual void InitializeDisplayPrefab() { displayPrefab = Prefabs.CreateDisplayPrefab(characterName + "Display", bodyPrefab, bodyInfo); } public virtual void InitializeUnlockables() { } public static void RegisterNewSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) RegisterNewSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, 100f); } public static void RegisterNewSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, float sortPosition) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) RegisterNewSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, sortPosition); } public static void RegisterNewSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) RegisterNewSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, unlockableDef, 100f); } public static void RegisterNewSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef, float sortPosition) { //IL_0016: 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) SurvivorDef val = ScriptableObject.CreateInstance<SurvivorDef>(); val.bodyPrefab = bodyPrefab; val.displayPrefab = displayPrefab; val.primaryColor = charColor; val.cachedName = ((Object)bodyPrefab).name.Replace("Body", ""); val.displayNameToken = tokenPrefix + "NAME"; val.desc