Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of NarutoSurvivor v1.0.0
plugins/NarutoSurvivor.dll
Decompiled 16 hours 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.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.AI.Walker; using EntityStates.Commando; using EntityStates.Commando.CommandoWeapon; using HG; using HG.BlendableTypes; using JetBrains.Annotations; using KinematicCharacterController; using Microsoft.CodeAnalysis; using NarutoMod.Modules; using NarutoMod.Modules.Achievements; using NarutoMod.Modules.BaseStates; using NarutoMod.Modules.Characters; using NarutoMod.Survivors.Naruto; using NarutoMod.Survivors.Naruto.Clones; using NarutoMod.Survivors.Naruto.Components; using NarutoMod.Survivors.Naruto.SkillStates; using On.RoR2; using On.RoR2.UI; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Achievements; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using SurvivorFramework; using SurvivorFramework.Defense; using SurvivorFramework.Effects; using SurvivorFramework.Forms; using SurvivorFramework.Mastery; using SurvivorFramework.Movement; using SurvivorFramework.Net; using SurvivorFramework.Resources; using SurvivorFramework.Skills; using SurvivorFramework.UI; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NarutoSurvivor")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+58a86b8ad83f0e9f3dda462bae30810ec5d2d51d")] [assembly: AssemblyProduct("NarutoSurvivor")] [assembly: AssemblyTitle("NarutoSurvivor")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] 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; } } [CompilerGenerated] [Embedded] [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; } } } namespace NarutoMod { internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void ErrorAssetBundle(string assetName, string bundleName) { Error("failed to load asset, " + assetName + ", because it does not exist in asset bundle, " + bundleName); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.Eddie.NarutoSurvivor", "NarutoSurvivor", "1.0.0")] public class NarutoPlugin : BaseUnityPlugin { public const string MODUID = "com.Eddie.NarutoSurvivor"; public const string MODNAME = "NarutoSurvivor"; public const string MODVERSION = "1.0.0"; public const string DEVELOPER_PREFIX = "EDDIE"; public static NarutoPlugin instance; private void Awake() { instance = this; Log.Init(((BaseUnityPlugin)this).Logger); Language.Init(); Framework.Init(); new NarutoSurvivor().Initialize(); new ContentPacks().Initialize(); } } } namespace NarutoMod.Modules { internal static class Asset { internal static Dictionary<string, AssetBundle> loadedBundles = new Dictionary<string, AssetBundle>(); internal static AssetBundle LoadAssetBundle(string bundleName) { if (bundleName == "myassetbundle") { Log.Error("AssetBundle name hasn't been changed. not loading any assets to avoid conflicts.\nMake sure to rename your assetbundle filename and rename the AssetBundleName field in your character setup code "); return null; } if (loadedBundles.ContainsKey(bundleName)) { return loadedBundles[bundleName]; } AssetBundle val = null; try { val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)NarutoPlugin.instance).Info.Location), "AssetBundles", bundleName)); } catch (Exception arg) { Log.Error($"Error loading asset bundle, {bundleName}. Your asset bundle must be in a folder next to your mod dll called 'AssetBundles'. Follow the guide to build and install your mod correctly!\n{arg}"); } loadedBundles[bundleName] = val; return val; } internal static GameObject CloneTracer(string originalTracerName, string newTracerName) { if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null) { return null; } GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true); if (!Object.op_Implicit((Object)(object)val.GetComponent<EffectComponent>())) { val.AddComponent<EffectComponent>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<VFXAttributes>())) { val.AddComponent<VFXAttributes>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>())) { val.AddComponent<NetworkIdentity>(); } val.GetComponent<Tracer>().speed = 250f; val.GetComponent<Tracer>().length = 50f; Content.CreateAndAddEffectDef(val); return val; } internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert) { if (!Object.op_Implicit((Object)(object)objectToConvert)) { return; } MeshRenderer[] componentsInChildren = objectToConvert.GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial)) { ((Renderer)val).sharedMaterial.ConvertDefaultShaderToHopoo(); } } SkinnedMeshRenderer[] componentsInChildren2 = objectToConvert.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Renderer)val2).sharedMaterial)) { ((Renderer)val2).sharedMaterial.ConvertDefaultShaderToHopoo(); } } } internal static GameObject LoadCrosshair(string crosshairName) { GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair"); if ((Object)(object)val == (Object)null) { Log.Error("could not load crosshair with the name " + crosshairName + ". defaulting to Standard"); return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/StandardCrosshair"); } return val; } internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, bool parentToTransform) { return assetBundle.LoadEffect(resourceName, "", parentToTransform); } internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, string soundName = "", bool parentToTransform = false) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) GameObject val = assetBundle.LoadAsset<GameObject>(resourceName); if (!Object.op_Implicit((Object)(object)val)) { Log.ErrorAssetBundle(resourceName, ((Object)assetBundle).name); return null; } val.AddComponent<DestroyOnTimer>().duration = 12f; val.AddComponent<NetworkIdentity>(); val.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2; EffectComponent obj = val.AddComponent<EffectComponent>(); obj.applyScale = false; obj.effectIndex = (EffectIndex)(-1); obj.parentToReferencedTransform = parentToTransform; obj.positionAtReferencedTransform = true; obj.soundName = soundName; Content.CreateAndAddEffectDef(val); return val; } internal static GameObject CreateProjectileGhostPrefab(this AssetBundle assetBundle, string ghostName) { GameObject val = assetBundle.LoadAsset<GameObject>(ghostName); if ((Object)(object)val == (Object)null) { Log.Error("Failed to load ghost prefab " + ghostName); } if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>())) { val.AddComponent<NetworkIdentity>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<ProjectileGhostController>())) { val.AddComponent<ProjectileGhostController>(); } ConvertAllRenderersToHopooShader(val); return val; } internal static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName) { return PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/" + prefabName), newPrefabName); } internal static GameObject LoadAndAddProjectilePrefab(this AssetBundle assetBundle, string newPrefabName) { GameObject val = assetBundle.LoadAsset<GameObject>(newPrefabName); if ((Object)(object)val == (Object)null) { Log.ErrorAssetBundle(newPrefabName, ((Object)assetBundle).name); return null; } Content.AddProjectilePrefab(val); return val; } } public static class Config { public static ConfigFile MyConfig = ((BaseUnityPlugin)NarutoPlugin.instance).Config; public static ConfigEntry<bool> CharacterEnableConfig(string section, string characterName, string description = "", bool enabledByDefault = true) { if (string.IsNullOrEmpty(description)) { description = "Set to false to disable this character and as much of its code and content as possible"; } return BindAndOptions(section, "Enable " + characterName, enabledByDefault, description, restartRequired: true); } public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, string description = "", bool restartRequired = false, bool menu = true) { return BindAndOptions(section, name, defaultValue, 0f, 20f, description, restartRequired, menu); } public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, float min, float max, string description = "", bool restartRequired = false, bool menu = true) { if (string.IsNullOrEmpty(description)) { description = name; } if (restartRequired) { description += " (restart required)"; } ConfigEntry<T> val = MyConfig.Bind<T>(section, name, defaultValue, description); if (menu && Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { TryRegisterOption<T>(val, min, max, restartRequired); } return val; } public static ConfigEntry<float> BindAndOptionsSlider(string section, string name, float defaultValue, string description, float min = 0f, float max = 20f, bool restartRequired = false) { return BindAndOptions(section, name, defaultValue, min, max, description, restartRequired); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void TryRegisterOption<T>(ConfigEntry<T> entry, float min, float max, bool restartRequired) { //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_004c: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown if (entry is ConfigEntry<float>) { ModSettingsManager.AddOption((BaseOption)new SliderOption(entry as ConfigEntry<float>, new SliderConfig { min = min, max = max, FormatString = "{0:0.00}", restartRequired = restartRequired })); } else if (entry is ConfigEntry<int>) { ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry as ConfigEntry<int>, new IntSliderConfig { min = (int)min, max = (int)max, restartRequired = restartRequired })); } else if (entry is ConfigEntry<bool>) { ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry as ConfigEntry<bool>, restartRequired)); } else if (entry is ConfigEntry<KeyboardShortcut>) { ModSettingsManager.AddOption((BaseOption)new KeyBindOption(entry as ConfigEntry<KeyboardShortcut>, restartRequired)); } } public static bool GetKeyPressed(KeyboardShortcut entry) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) foreach (KeyCode modifier in ((KeyboardShortcut)(ref entry)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } return Input.GetKeyDown(((KeyboardShortcut)(ref entry)).MainKey); } } internal class Content { internal static void AddCharacterBodyPrefab(GameObject bprefab) { ContentPacks.bodyPrefabs.Add(bprefab); } internal static void AddMasterPrefab(GameObject prefab) { ContentPacks.masterPrefabs.Add(prefab); } internal static void AddProjectilePrefab(GameObject prefab) { ContentPacks.projectilePrefabs.Add(prefab); } internal static void AddSurvivorDef(SurvivorDef survivorDef) { ContentPacks.survivorDefs.Add(survivorDef); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, 100f); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, float sortPosition) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, sortPosition); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, unlockableDef, 100f); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef, float sortPosition) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) SurvivorDef obj = ScriptableObject.CreateInstance<SurvivorDef>(); obj.bodyPrefab = bodyPrefab; obj.displayPrefab = displayPrefab; obj.primaryColor = charColor; obj.cachedName = ((Object)bodyPrefab).name.Replace("Body", ""); obj.displayNameToken = tokenPrefix + "NAME"; obj.descriptionToken = tokenPrefix + "DESCRIPTION"; obj.outroFlavorToken = tokenPrefix + "OUTRO_FLAVOR"; obj.mainEndingEscapeFailureFlavorToken = tokenPrefix + "OUTRO_FAILURE"; obj.desiredSortPosition = sortPosition; obj.unlockableDef = unlockableDef; AddSurvivorDef(obj); } internal static void AddUnlockableDef(UnlockableDef unlockableDef) { ContentPacks.unlockableDefs.Add(unlockableDef); } internal static UnlockableDef CreateAndAddUnlockbleDef(string identifier, string nameToken, Sprite achievementIcon) { UnlockableDef obj = ScriptableObject.CreateInstance<UnlockableDef>(); obj.cachedName = identifier; obj.nameToken = nameToken; obj.achievementIcon = achievementIcon; AddUnlockableDef(obj); return obj; } internal static void AddSkillDef(SkillDef skillDef) { ContentPacks.skillDefs.Add(skillDef); } internal static void AddSkillFamily(SkillFamily skillFamily) { ContentPacks.skillFamilies.Add(skillFamily); } internal static void AddEntityState(Type entityState) { ContentPacks.entityStates.Add(entityState); } internal static void AddBuffDef(BuffDef buffDef) { ContentPacks.buffDefs.Add(buffDef); } internal static BuffDef CreateAndAddBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) BuffDef obj = ScriptableObject.CreateInstance<BuffDef>(); ((Object)obj).name = buffName; obj.buffColor = buffColor; obj.canStack = canStack; obj.isDebuff = isDebuff; obj.eliteDef = null; obj.iconSprite = buffIcon; AddBuffDef(obj); return obj; } internal static void AddEffectDef(EffectDef effectDef) { ContentPacks.effectDefs.Add(effectDef); } internal static EffectDef CreateAndAddEffectDef(GameObject effectPrefab) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000d: Expected O, but got Unknown EffectDef val = new EffectDef(effectPrefab); AddEffectDef(val); return val; } internal static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef) { ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef); } internal static NetworkSoundEventDef CreateAndAddNetworkSoundEventDef(string eventName) { NetworkSoundEventDef obj = ScriptableObject.CreateInstance<NetworkSoundEventDef>(); obj.akId = AkSoundEngine.GetIDFromString(eventName); obj.eventName = eventName; AddNetworkSoundEventDef(obj); return obj; } } internal class ContentPacks : IContentPackProvider { internal ContentPack contentPack = new ContentPack(); public static List<GameObject> bodyPrefabs = new List<GameObject>(); public static List<GameObject> masterPrefabs = new List<GameObject>(); public static List<GameObject> projectilePrefabs = new List<GameObject>(); public static List<SurvivorDef> survivorDefs = new List<SurvivorDef>(); public static List<UnlockableDef> unlockableDefs = new List<UnlockableDef>(); public static List<SkillFamily> skillFamilies = new List<SkillFamily>(); public static List<SkillDef> skillDefs = new List<SkillDef>(); public static List<Type> entityStates = new List<Type>(); public static List<BuffDef> buffDefs = new List<BuffDef>(); public static List<EffectDef> effectDefs = new List<EffectDef>(); public static List<NetworkSoundEventDef> networkSoundEventDefs = new List<NetworkSoundEventDef>(); public string identifier => "com.Eddie.NarutoSurvivor"; public void Initialize() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders); } private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { contentPack.identifier = identifier; contentPack.bodyPrefabs.Add(bodyPrefabs.ToArray()); contentPack.masterPrefabs.Add(masterPrefabs.ToArray()); contentPack.projectilePrefabs.Add(projectilePrefabs.ToArray()); contentPack.survivorDefs.Add(survivorDefs.ToArray()); contentPack.unlockableDefs.Add(unlockableDefs.ToArray()); contentPack.skillDefs.Add(skillDefs.ToArray()); contentPack.skillFamilies.Add(skillFamilies.ToArray()); contentPack.entityStateTypes.Add(entityStates.ToArray()); contentPack.buffDefs.Add(buffDefs.ToArray()); contentPack.effectDefs.Add(effectDefs.ToArray()); contentPack.networkSoundEventDefs.Add(networkSoundEventDefs.ToArray()); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } internal static class ItemDisplayCheck { public static List<Object> allDisplayedItems; public static void PrintUnused(ItemDisplayRuleSet itemDisplayRuleSet, string bodyName = "") { PrintUnused((IEnumerable<KeyAssetRuleGroup>)itemDisplayRuleSet.keyAssetRuleGroups.ToList(), bodyName); } public static void PrintUnused(IEnumerable<KeyAssetRuleGroup> ruleSet = null, string bodyName = "") { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) string text = "generating item displays for " + bodyName; if (allDisplayedItems == null) { LazyGatherAllItems(); } List<Object> list = new List<Object>(allDisplayedItems); string text2 = ""; if (ruleSet != null) { foreach (KeyAssetRuleGroup item in ruleSet) { if (item.displayRuleGroup.rules.Length != 0) { list.Remove(item.keyAsset); if (string.IsNullOrEmpty(text2)) { text2 = item.displayRuleGroup.rules[0].childName; } } } } if (string.IsNullOrEmpty(text2)) { text2 = "Chest"; } foreach (Object item2 in list) { string text3 = ""; if (ItemDisplays.KeyAssetDisplayPrefabs.ContainsKey(item2)) { text3 += SpitOutNewRule(item2, text2, ItemDisplays.KeyAssetDisplayPrefabs[item2]); } else { Log.Error($"COULD NOT FIND DISPLAY PREFABS FOR KEYASSET {item2}"); } text += text3; } Log.Message(text); } private static void LazyGatherAllItems() { allDisplayedItems = new List<Object>(ItemDisplays.KeyAssetDisplayPrefabs.Keys); allDisplayedItems.Sort(delegate(Object item1, Object item2) { if (item1 is ItemDef && item2 is ItemDef) { return item1.name.CompareTo(item2.name); } if (item1 is EquipmentDef && item2 is EquipmentDef) { return item1.name.CompareTo(item2.name); } if (item1 is ItemDef && item2 is EquipmentDef) { return -1; } return (item1 is EquipmentDef && item2 is ItemDef) ? 1 : 0; }); } private static string SpitOutNewRule(Object asset, string firstCompatibleChild, ItemDisplayRule[] displayRules) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (displayRules.Length == 0) { return $"\n[NO DISPLAY RULES FOUND FOR THE KEYASSET {asset}"; } string text = "\n itemDisplayRules.Add(ItemDisplays.CreateDisplayRuleGroupWithRules(ItemDisplays.KeyAssets[\"" + asset.name + "\"]"; for (int i = 0; i < displayRules.Length; i++) { text = (((int)displayRules[i].limbMask != 0) ? (text + ",\n" + $" ItemDisplays.CreateLimbMaskDisplayRule(LimbFlags.{displayRules[i].limbMask})") : (text + ",\n ItemDisplays.CreateDisplayRule(ItemDisplays.LoadDisplay(\"" + ((Object)displayRules[i].followerPrefab).name + "\"),\n \"" + firstCompatibleChild + "\",\n new Vector3(2, 2, 2),\n new Vector3(0, 0, 0),\n new Vector3(1, 1, 1)\n )")); } return text + "\n ));"; } } internal static class ItemDisplays { private static Dictionary<string, GameObject> itemDisplayPrefabs = new Dictionary<string, GameObject>(); public static Dictionary<Object, ItemDisplayRule[]> KeyAssetDisplayPrefabs = new Dictionary<Object, ItemDisplayRule[]>(); public static Dictionary<string, Object> KeyAssets = new Dictionary<string, Object>(); public static int queuedDisplays; public static bool initialized = false; public static void LazyInit() { if (!initialized) { initialized = true; PopulateDisplays(); } } internal static void DisposeWhenDone() { queuedDisplays--; if (queuedDisplays <= 0 && initialized) { initialized = false; itemDisplayPrefabs = null; KeyAssetDisplayPrefabs = null; KeyAssets = null; } } internal static void PopulateDisplays() { PopulateFromBody("LoaderBody"); } private static void PopulateFromBody(string bodyName) { //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) KeyAssetRuleGroup[] keyAssetRuleGroups = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyName).GetComponent<ModelLocator>().modelTransform).GetComponent<CharacterModel>().itemDisplayRuleSet.keyAssetRuleGroups; for (int i = 0; i < keyAssetRuleGroups.Length; i++) { ItemDisplayRule[] rules = keyAssetRuleGroups[i].displayRuleGroup.rules; KeyAssetDisplayPrefabs[keyAssetRuleGroups[i].keyAsset] = rules; KeyAssets[keyAssetRuleGroups[i].keyAsset.name] = keyAssetRuleGroups[i].keyAsset; for (int j = 0; j < rules.Length; j++) { GameObject val = rules[j].followerPrefab; if (!Object.op_Implicit((Object)(object)val) && rules[j].followerPrefabAddress != null && ((AssetReference)rules[j].followerPrefabAddress).RuntimeKeyIsValid()) { val = Addressables.LoadAssetAsync<GameObject>(((AssetReference)rules[j].followerPrefabAddress).RuntimeKey).WaitForCompletion(); } if (Object.op_Implicit((Object)(object)val)) { string key = ((Object)val).name?.ToLowerInvariant(); if (!itemDisplayPrefabs.ContainsKey(key)) { itemDisplayPrefabs[key] = val; } } } } } private static void PopulateCustomLightningArm() { GameObject val = PrefabAPI.InstantiateClone(itemDisplayPrefabs["displaylightningarmright"], "DisplayLightningCustom", false); LimbMatcher component = val.GetComponent<LimbMatcher>(); component.limbPairs[0].targetChildLimb = "LightningArm1"; component.limbPairs[1].targetChildLimb = "LightningArm2"; component.limbPairs[2].targetChildLimb = "LightningArmEnd"; itemDisplayPrefabs["displaylightningarmcustom"] = val; } public static GameObject LoadDisplay(string name) { if (itemDisplayPrefabs.ContainsKey(name.ToLowerInvariant()) && Object.op_Implicit((Object)(object)itemDisplayPrefabs[name.ToLowerInvariant()])) { return itemDisplayPrefabs[name.ToLowerInvariant()]; } Log.Error("item display " + name + " returned null"); return null; } public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(string itemName, params ItemDisplayRule[] rules) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) return CreateDisplayRuleGroupWithRules(GetKeyAssetFromString(itemName), rules); } public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(Object keyAsset_, params ItemDisplayRule[] rules) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (keyAsset_ == (Object)null) { Log.Error("could not find keyasset"); } return new KeyAssetRuleGroup { keyAsset = keyAsset_, displayRuleGroup = new DisplayRuleGroup { rules = rules } }; } public static ItemDisplayRule CreateDisplayRule(string prefabName, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) return CreateDisplayRule(LoadDisplay(prefabName), childName, position, rotation, scale); } public static ItemDisplayRule CreateDisplayRule(GameObject itemPrefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) return new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, childName = childName, followerPrefab = itemPrefab, limbMask = (LimbFlags)0, localPos = position, localAngles = rotation, localScale = scale }; } public static ItemDisplayRule CreateLimbMaskDisplayRule(LimbFlags limb) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) return new ItemDisplayRule { ruleType = (ItemDisplayRuleType)1, limbMask = limb, childName = "", followerPrefab = 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; } } internal static class Language { public static string TokensOutput = ""; public static bool usingLanguageFolder = false; public static bool printingEnabled = false; public static void Init() { if (usingLanguageFolder) { Language.collectLanguageRootFolders += Language_collectLanguageRootFolders; } } private static void Language_collectLanguageRootFolders(List<string> obj) { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)NarutoPlugin.instance).Info.Location), "Language"); if (Directory.Exists(text)) { obj.Add(text); } } public static void Add(string token, string text) { if (!usingLanguageFolder) { LanguageAPI.Add(token, text); } if (printingEnabled) { TokensOutput = TokensOutput + "\n \"" + token + "\" : \"" + text.Replace(Environment.NewLine, "\\n").Replace("\n", "\\n") + "\","; } } public static void PrintOutput(string fileName = "") { if (printingEnabled) { string text = "{\n strings:\n {" + TokensOutput + "\n }\n}"; Log.Message(fileName + ": \n" + text); if (!string.IsNullOrEmpty(fileName)) { File.WriteAllText(Path.Combine(Directory.GetParent(((BaseUnityPlugin)NarutoPlugin.instance).Info.Location).FullName, "Language", "en", fileName), text); } TokensOutput = ""; } } } internal static class Materials { private static List<Material> cachedMaterials = new List<Material>(); internal static Shader hotpoo = LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/HGStandard"); public static Material LoadMaterial(this AssetBundle assetBundle, string materialName) { return assetBundle.CreateHopooMaterialFromBundle(materialName); } public static Material CreateHopooMaterialFromBundle(this AssetBundle assetBundle, string materialName) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown Material val = cachedMaterials.Find(delegate(Material mat) { materialName.Replace(" (Instance)", ""); return ((Object)mat).name.Contains(materialName); }); if (Object.op_Implicit((Object)(object)val)) { Log.Debug(((Object)val).name + " has already been loaded. returning cached"); return val; } val = assetBundle.LoadAsset<Material>(materialName); if (!Object.op_Implicit((Object)(object)val)) { Log.ErrorAssetBundle(materialName, ((Object)assetBundle).name); return new Material(hotpoo); } return val.ConvertDefaultShaderToHopoo(); } public static Material SetHopooMaterial(this Material tempMat) { return tempMat.ConvertDefaultShaderToHopoo(); } public static Material ConvertDefaultShaderToHopoo(this Material tempMat) { //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) if (cachedMaterials.Contains(tempMat)) { Log.Debug(((Object)tempMat).name + " has already been converted. returning cached"); return tempMat; } string text = ((Object)tempMat.shader).name.ToLowerInvariant(); if (!text.StartsWith("standard") && !text.StartsWith("autodesk")) { Log.Debug(((Object)tempMat).name + " is not unity standard shader. aborting material conversion"); return tempMat; } float? num = null; Color? val = null; if (tempMat.IsKeywordEnabled("_NORMALMAP")) { num = tempMat.GetFloat("_BumpScale"); } if (tempMat.IsKeywordEnabled("_EMISSION")) { val = tempMat.GetColor("_EmissionColor"); } tempMat.shader = hotpoo; tempMat.SetTexture("_EmTex", tempMat.GetTexture("_EmissionMap")); tempMat.EnableKeyword("DITHER"); if (num.HasValue) { tempMat.SetFloat("_NormalStrength", num.Value); tempMat.SetTexture("_NormalTex", tempMat.GetTexture("_BumpMap")); } if (val.HasValue) { tempMat.SetColor("_EmColor", val.Value); tempMat.SetFloat("_EmPower", 1f); } if (tempMat.IsKeywordEnabled("NOCULL")) { tempMat.SetInt("_Cull", 0); } if (tempMat.IsKeywordEnabled("LIMBREMOVAL")) { tempMat.SetInt("_LimbRemovalOn", 1); } cachedMaterials.Add(tempMat); return tempMat; } public static Material MakeUnique(this Material material) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown if (cachedMaterials.Contains(material)) { return new Material(material); } return material; } public static Material SetColor(this Material material, Color color) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) material.SetColor("_Color", color); return material; } public static Material SetNormal(this Material material, float normalStrength = 1f) { material.SetFloat("_NormalStrength", normalStrength); return material; } public static Material SetEmission(this Material material) { return material.SetEmission(1f); } public static Material SetEmission(this Material material, float emission) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return material.SetEmission(emission, Color.white); } public static Material SetEmission(this Material material, float emission, Color emissionColor) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) material.SetFloat("_EmPower", emission); material.SetColor("_EmColor", emissionColor); return material; } public static Material SetCull(this Material material, bool cull = false) { material.SetInt("_Cull", cull ? 1 : 0); return material; } public static Material SetSpecular(this Material material, float strength) { material.SetFloat("_SpecularStrength", strength); return material; } public static Material SetSpecular(this Material material, float strength, float exponent) { material.SetFloat("_SpecularStrength", strength); material.SetFloat("SpecularExponent", exponent); return material; } } internal static class Prefabs { private static PhysicMaterial ragdollMaterial; public static GameObject CreateDisplayPrefab(AssetBundle assetBundle, string displayPrefabName, GameObject prefab) { GameObject val = assetBundle.LoadAsset<GameObject>(displayPrefabName); if ((Object)(object)val == (Object)null) { Log.Error("could not load display prefab " + displayPrefabName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name); return null; } CharacterModel val2 = val.GetComponent<CharacterModel>(); if (!Object.op_Implicit((Object)(object)val2)) { val2 = val.AddComponent<CharacterModel>(); } val2.baseRendererInfos = prefab.GetComponentInChildren<CharacterModel>().baseRendererInfos; Asset.ConvertAllRenderersToHopooShader(val); return val; } public static GameObject LoadCharacterModel(AssetBundle assetBundle, string modelName) { GameObject val = assetBundle.LoadAsset<GameObject>(modelName); if ((Object)(object)val == (Object)null) { Log.Error("could not load model prefab " + modelName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name); return null; } return val; } public static GameObject LoadCharacterBody(AssetBundle assetBundle, string bodyName) { GameObject val = assetBundle.LoadAsset<GameObject>(bodyName); if ((Object)(object)val == (Object)null) { Log.Error("could not load body prefab " + bodyName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name); return null; } return val; } public static GameObject CloneCharacterBody(BodyInfo bodyInfo) { GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyInfo.bodyNameToClone + "Body"); if (!Object.op_Implicit((Object)(object)val)) { Log.Error(bodyInfo.bodyNameToClone + " Body to clone is not a valid body, character creation failed"); return null; } GameObject val2 = PrefabAPI.InstantiateClone(val, bodyInfo.bodyName); for (int num = val2.transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)val2.transform.GetChild(num)).gameObject); } return val2; } public static GameObject CreateBodyPrefab(AssetBundle assetBundle, string modelPrefabName, BodyInfo bodyInfo) { return CreateBodyPrefab(LoadCharacterModel(assetBundle, modelPrefabName), bodyInfo); } public static GameObject CreateBodyPrefab(GameObject model, BodyInfo bodyInfo) { return CreateBodyPrefab(CloneCharacterBody(bodyInfo), model, bodyInfo); } public static GameObject CreateBodyPrefab(GameObject newBodyPrefab, AssetBundle assetBundle, string modelName, BodyInfo bodyInfo) { return CreateBodyPrefab(newBodyPrefab, LoadCharacterModel(assetBundle, modelName), bodyInfo); } public static GameObject CreateBodyPrefab(AssetBundle assetBundle, string bodyPrefabName, string modelPrefabName, BodyInfo bodyInfo) { return CreateBodyPrefab(LoadCharacterBody(assetBundle, bodyPrefabName), LoadCharacterModel(assetBundle, modelPrefabName), bodyInfo); } public static GameObject CreateBodyPrefab(GameObject newBodyPrefab, GameObject model, BodyInfo bodyInfo) { if ((Object)(object)model == (Object)null || (Object)(object)newBodyPrefab == (Object)null) { Log.Error($"Character creation failed. Model: {model}, Body: {newBodyPrefab}"); return null; } SetupCharacterBody(newBodyPrefab, bodyInfo); Transform modelBaseTransform = AddCharacterModelToSurvivorBody(newBodyPrefab, model.transform, bodyInfo); SetupModelLocator(newBodyPrefab, modelBaseTransform, model.transform); SetupCharacterDirection(newBodyPrefab, modelBaseTransform, model.transform); SetupCameraTargetParams(newBodyPrefab, bodyInfo); SetupCapsuleCollider(newBodyPrefab); Content.AddCharacterBodyPrefab(newBodyPrefab); return newBodyPrefab; } private static void SetupCharacterBody(GameObject newBodyPrefab, BodyInfo bodyInfo) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) CharacterBody component = newBodyPrefab.GetComponent<CharacterBody>(); component.baseNameToken = bodyInfo.bodyNameToken; component.subtitleNameToken = bodyInfo.subtitleNameToken; component.portraitIcon = bodyInfo.characterPortrait; component.bodyColor = bodyInfo.bodyColor; component._defaultCrosshairPrefab = bodyInfo.crosshair; component.hideCrosshair = false; component.preferredPodPrefab = bodyInfo.podPrefab; component.baseMaxHealth = bodyInfo.maxHealth; component.baseRegen = bodyInfo.healthRegen; component.baseArmor = bodyInfo.armor; component.baseMaxShield = bodyInfo.shield; component.baseDamage = bodyInfo.damage; component.baseAttackSpeed = bodyInfo.attackSpeed; component.baseCrit = bodyInfo.crit; component.baseMoveSpeed = bodyInfo.moveSpeed; component.baseJumpPower = bodyInfo.jumpPower; component.autoCalculateLevelStats = bodyInfo.autoCalculateLevelStats; if (bodyInfo.autoCalculateLevelStats) { component.levelMaxHealth = Mathf.Round(component.baseMaxHealth * 0.3f); component.levelMaxShield = Mathf.Round(component.baseMaxShield * 0.3f); component.levelRegen = component.baseRegen * 0.2f; component.levelMoveSpeed = 0f; component.levelJumpPower = 0f; component.levelDamage = component.baseDamage * 0.2f; component.levelAttackSpeed = 0f; component.levelCrit = 0f; component.levelArmor = 0f; } else { component.levelMaxHealth = bodyInfo.healthGrowth; component.levelMaxShield = bodyInfo.shieldGrowth; component.levelRegen = bodyInfo.regenGrowth; component.levelMoveSpeed = bodyInfo.moveSpeedGrowth; component.levelJumpPower = bodyInfo.jumpPowerGrowth; component.levelDamage = bodyInfo.damageGrowth; component.levelAttackSpeed = bodyInfo.attackSpeedGrowth; component.levelCrit = bodyInfo.critGrowth; component.levelArmor = bodyInfo.armorGrowth; } component.baseAcceleration = bodyInfo.acceleration; component.baseJumpCount = bodyInfo.jumpCount; component.sprintingSpeedMultiplier = 1.45f; component.bodyFlags = (BodyFlags)16; component.rootMotionInMainState = false; component.hullClassification = (HullClassification)0; component.isChampion = false; } private static Transform AddCharacterModelToSurvivorBody(GameObject bodyPrefab, Transform modelTransform, BodyInfo bodyInfo) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) Transform val = bodyPrefab.transform.Find("ModelBase"); if ((Object)(object)val == (Object)null) { val = new GameObject("ModelBase").transform; val.parent = bodyPrefab.transform; val.localPosition = bodyInfo.modelBasePosition; val.localRotation = Quaternion.identity; } modelTransform.parent = ((Component)val).transform; modelTransform.localPosition = Vector3.zero; modelTransform.localRotation = Quaternion.identity; if ((Object)(object)bodyPrefab.transform.Find("CameraPivot") == (Object)null) { Transform transform = new GameObject("CameraPivot").transform; transform.parent = bodyPrefab.transform; transform.localPosition = bodyInfo.cameraPivotPosition; transform.localRotation = Quaternion.identity; } Transform val2 = bodyPrefab.transform.Find("AimOrigin"); if ((Object)(object)val2 == (Object)null) { val2 = new GameObject("AimOrigin").transform; val2.parent = bodyPrefab.transform; val2.localPosition = bodyInfo.aimOriginPosition; val2.localRotation = Quaternion.identity; } bodyPrefab.GetComponent<CharacterBody>().aimOriginTransform = val2; return ((Component)val).transform; } private static void SetupCharacterDirection(GameObject prefab, Transform modelBaseTransform, Transform modelTransform) { if (Object.op_Implicit((Object)(object)prefab.GetComponent<CharacterDirection>())) { CharacterDirection component = prefab.GetComponent<CharacterDirection>(); component.targetTransform = modelBaseTransform; component.overrideAnimatorForwardTransform = null; component.rootMotionAccumulator = null; component.modelAnimator = ((Component)modelTransform).GetComponent<Animator>(); component.driveFromRootRotation = false; component.turnSpeed = 720f; } } private static void SetupCameraTargetParams(GameObject prefab, BodyInfo bodyInfo) { CameraTargetParams component = prefab.GetComponent<CameraTargetParams>(); component.cameraParams = bodyInfo.cameraParams; component.cameraPivotTransform = prefab.transform.Find("CameraPivot"); } private static void SetupModelLocator(GameObject prefab, Transform modelBaseTransform, Transform modelTransform) { ModelLocator component = prefab.GetComponent<ModelLocator>(); component.modelTransform = modelTransform; component.modelBaseTransform = modelBaseTransform; } private static void SetupCapsuleCollider(GameObject prefab) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) CapsuleCollider component = prefab.GetComponent<CapsuleCollider>(); component.center = new Vector3(0f, 0f, 0f); component.radius = 0.5f; component.height = 1.82f; component.direction = 1; } public static CharacterModel SetupCharacterModel(GameObject bodyPrefab, CustomRendererInfo[] customInfos = null) { CharacterModel val = ((Component)bodyPrefab.GetComponent<ModelLocator>().modelTransform).gameObject.GetComponent<CharacterModel>(); bool num = (Object)(object)val != (Object)null; if (!num) { val = ((Component)bodyPrefab.GetComponent<ModelLocator>().modelTransform).gameObject.AddComponent<CharacterModel>(); } val.body = bodyPrefab.GetComponent<CharacterBody>(); val.autoPopulateLightInfos = true; val.invisibilityCount = 0; val.temporaryOverlays = new List<TemporaryOverlayInstance>(); if (!num) { SetupCustomRendererInfos(val, customInfos); } else { SetupPreAttachedRendererInfos(val); } SetupHurtboxGroup(bodyPrefab, ((Component)val).gameObject); SetupAimAnimator(bodyPrefab, ((Component)val).gameObject); SetupFootstepController(((Component)val).gameObject); SetupRagdoll(((Component)val).gameObject); return val; } public static void SetupPreAttachedRendererInfos(CharacterModel characterModel) { for (int i = 0; i < characterModel.baseRendererInfos.Length; i++) { if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null) { characterModel.baseRendererInfos[i].defaultMaterial = characterModel.baseRendererInfos[i].renderer.sharedMaterial; } if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null) { Log.Error($"no material for rendererinfo of this renderer: {characterModel.baseRendererInfos[i].renderer}"); } characterModel.baseRendererInfos[i].defaultMaterial.ConvertDefaultShaderToHopoo(); } } public static void SetupCustomRendererInfos(CharacterModel characterModel, CustomRendererInfo[] customInfos) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) ChildLocator component = ((Component)characterModel).GetComponent<ChildLocator>(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("Failed CharacterModel setup: ChildLocator component does not exist on the model"); return; } List<RendererInfo> list = new List<RendererInfo>(); for (int i = 0; i < customInfos.Length; i++) { if (!Object.op_Implicit((Object)(object)component.FindChild(customInfos[i].childName))) { Log.Error("Trying to add a RendererInfo for a renderer that does not exist: " + customInfos[i].childName); continue; } Renderer component2 = ((Component)component.FindChild(customInfos[i].childName)).GetComponent<Renderer>(); if (Object.op_Implicit((Object)(object)component2)) { Material val = customInfos[i].material; if ((Object)(object)val == (Object)null) { val = ((!customInfos[i].dontHotpoo) ? component2.sharedMaterial.ConvertDefaultShaderToHopoo() : component2.sharedMaterial); } list.Add(new RendererInfo { renderer = component2, defaultMaterial = val, ignoreOverlays = customInfos[i].ignoreOverlays, defaultShadowCastingMode = (ShadowCastingMode)1 }); } } characterModel.baseRendererInfos = list.ToArray(); } private static void SetupHurtboxGroup(GameObject bodyPrefab, GameObject model) { SetupMainHurtboxesFromChildLocator(bodyPrefab, model); SetHurtboxesHealthComponents(bodyPrefab); } private static void SetupMainHurtboxesFromChildLocator(GameObject bodyPrefab, GameObject model) { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)bodyPrefab.GetComponent<HurtBoxGroup>() != (Object)null) { Log.Debug("Hitboxgroup already exists on model prefab. aborting code setup"); return; } ChildLocator component = model.GetComponent<ChildLocator>(); if (string.IsNullOrEmpty(component.FindChildNameInsensitive("MainHurtbox"))) { Log.Error("Could not set up main hurtbox: make sure you have a transform pair in your prefab's ChildLocator called 'MainHurtbox'"); return; } HurtBoxGroup val = model.AddComponent<HurtBoxGroup>(); HurtBox val2 = null; GameObject val3 = component.FindChildGameObjectInsensitive("HeadHurtbox"); if (Object.op_Implicit((Object)(object)val3)) { Log.Debug("HeadHurtboxFound. Setting up"); val2 = val3.AddComponent<HurtBox>(); ((Component)val2).gameObject.layer = LayerIndex.entityPrecise.intVal; val2.healthComponent = bodyPrefab.GetComponent<HealthComponent>(); val2.isBullseye = false; val2.isSniperTarget = true; val2.damageModifier = (DamageModifier)0; val2.hurtBoxGroup = val; val2.indexInGroup = 1; } HurtBox val4 = component.FindChildGameObjectInsensitive("MainHurtbox").AddComponent<HurtBox>(); ((Component)val4).gameObject.layer = LayerIndex.entityPrecise.intVal; val4.healthComponent = bodyPrefab.GetComponent<HealthComponent>(); val4.isBullseye = true; val4.isSniperTarget = (Object)(object)val2 == (Object)null; val4.damageModifier = (DamageModifier)0; val4.hurtBoxGroup = val; val4.indexInGroup = 0; if (Object.op_Implicit((Object)(object)val2)) { val.hurtBoxes = (HurtBox[])(object)new HurtBox[2] { val4, val2 }; } else { val.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val4 }; } val.mainHurtBox = val4; val.bullseyeCount = 1; } private static string FindChildNameInsensitive(this ChildLocator childLocator, string child) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) return childLocator.transformPairs.Where((NameTransformPair pair) => pair.name.ToLowerInvariant() == child.ToLowerInvariant()).FirstOrDefault().name; } private static Transform FindChildInsensitive(this ChildLocator childLocator, string child) { return childLocator.FindChild(childLocator.FindChildNameInsensitive(child)); } private static GameObject FindChildGameObjectInsensitive(this ChildLocator childLocator, string child) { return childLocator.FindChildGameObject(childLocator.FindChildNameInsensitive(child)); } public static void SetHurtboxesHealthComponents(GameObject bodyPrefab) { HealthComponent component = bodyPrefab.GetComponent<HealthComponent>(); HurtBoxGroup[] componentsInChildren = bodyPrefab.GetComponentsInChildren<HurtBoxGroup>(); foreach (HurtBoxGroup val in componentsInChildren) { val.mainHurtBox.healthComponent = component; for (int j = 0; j < val.hurtBoxes.Length; j++) { val.hurtBoxes[j].healthComponent = component; } } } private static void SetupFootstepController(GameObject model) { FootstepHandler obj = model.AddComponent<FootstepHandler>(); obj.baseFootstepString = "Play_player_footstep"; obj.sprintFootstepOverrideString = ""; obj.enableFootstepDust = true; obj.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.sharedMaterial = ragdollMaterial; } else { Log.Error($"Ragdoll bone {((Component)val).gameObject} doesn't have a collider. Ragdoll will break."); } } } } private static void SetupAimAnimator(GameObject prefab, GameObject model) { AimAnimator obj = model.AddComponent<AimAnimator>(); obj.directionComponent = prefab.GetComponent<CharacterDirection>(); obj.pitchRangeMax = 60f; obj.pitchRangeMin = -60f; obj.yawRangeMin = -80f; obj.yawRangeMax = 80f; obj.pitchGiveupRange = 30f; obj.yawGiveupRange = 10f; obj.giveupDuration = 3f; obj.inputBank = prefab.GetComponent<InputBankTest>(); } public static void CreateGenericDoppelganger(GameObject bodyPrefab, string masterName, string masterToCopy) { CloneDopplegangerMaster(bodyPrefab, masterName, masterToCopy); } public static GameObject CloneDopplegangerMaster(GameObject bodyPrefab, string masterName, string masterToCopy) { GameObject obj = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/" + masterToCopy + "MonsterMaster"), masterName, true); obj.GetComponent<CharacterMaster>().bodyPrefab = bodyPrefab; Content.AddMasterPrefab(obj); return obj; } public static GameObject CreateBlankMasterPrefab(GameObject bodyPrefab, string masterName) { GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/CommandoMonsterMaster"), masterName, true); ContentPacks.masterPrefabs.Add(val); val.GetComponent<CharacterMaster>().bodyPrefab = bodyPrefab; AISkillDriver[] components = val.GetComponents<AISkillDriver>(); for (int i = 0; i < components.Length; i++) { Object.Destroy((Object)(object)components[i]); } return val; } public static GameObject LoadMaster(this AssetBundle assetBundle, GameObject bodyPrefab, string assetName) { //IL_0040: 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) GameObject val = assetBundle.LoadAsset<GameObject>(assetName); BaseAI val2 = val.GetComponent<BaseAI>(); if ((Object)(object)val2 == (Object)null) { val2 = val.AddComponent<BaseAI>(); val2.aimVectorDampTime = 0.1f; val2.aimVectorMaxSpeed = 360f; } val2.scanState = new SerializableEntityStateType(typeof(Wander)); EntityStateMachine component = val.GetComponent<EntityStateMachine>(); if ((Object)(object)component == (Object)null) { AddEntityStateMachine(val, "AI", typeof(Wander), typeof(Wander)); } val2.stateMachine = component; CharacterMaster val3 = val.GetComponent<CharacterMaster>(); if ((Object)(object)val3 == (Object)null) { val3 = val.AddComponent<CharacterMaster>(); } val3.bodyPrefab = bodyPrefab; val3.teamIndex = (TeamIndex)2; Content.AddMasterPrefab(val); return val; } public static void ClearEntityStateMachines(GameObject bodyPrefab) { EntityStateMachine[] components = bodyPrefab.GetComponents<EntityStateMachine>(); for (int num = components.Length - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)components[num]); } bodyPrefab.GetComponent<NetworkStateMachine>().stateMachines = Array.Empty<EntityStateMachine>(); CharacterDeathBehavior component = bodyPrefab.GetComponent<CharacterDeathBehavior>(); if (Object.op_Implicit((Object)(object)component)) { component.idleStateMachine = Array.Empty<EntityStateMachine>(); } SetStateOnHurt component2 = bodyPrefab.GetComponent<SetStateOnHurt>(); if (Object.op_Implicit((Object)(object)component2)) { component2.idleStateMachine = Array.Empty<EntityStateMachine>(); } CharacterBody component3 = bodyPrefab.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component3)) { component3.vehicleIdleStateMachine = Array.Empty<EntityStateMachine>(); } } public static EntityStateMachine AddEntityStateMachine(GameObject prefab, string machineName, Type mainStateType = null, Type initalStateType = null, bool addToHurt = true, bool addToDeath = true) { //IL_004d: 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) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) EntityStateMachine val = EntityStateMachine.FindByCustomName(prefab, machineName); if ((Object)(object)val == (Object)null) { val = prefab.AddComponent<EntityStateMachine>(); } else { Log.Message("An Entity State Machine already exists with the name " + machineName + ". replacing."); } val.customName = machineName; if (mainStateType == null) { mainStateType = typeof(Idle); } val.mainStateType = new SerializableEntityStateType(mainStateType); if (initalStateType == null) { initalStateType = typeof(Idle); } val.initialStateType = new SerializableEntityStateType(initalStateType); NetworkStateMachine component = prefab.GetComponent<NetworkStateMachine>(); if (Object.op_Implicit((Object)(object)component)) { component.stateMachines = component.stateMachines.Append(val).ToArray(); } CharacterDeathBehavior component2 = prefab.GetComponent<CharacterDeathBehavior>(); if (Object.op_Implicit((Object)(object)component2) && addToDeath) { component2.idleStateMachine = component2.idleStateMachine.Append(val).ToArray(); } SetStateOnHurt component3 = prefab.GetComponent<SetStateOnHurt>(); if (Object.op_Implicit((Object)(object)component3) && addToHurt) { component3.idleStateMachine = component3.idleStateMachine.Append(val).ToArray(); } CharacterBody component4 = prefab.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component4)) { component4.vehicleIdleStateMachine = component4.vehicleIdleStateMachine.Append(val).ToArray(); } return val; } public static EntityStateMachine AddMainEntityStateMachine(GameObject bodyPrefab, string machineName = "Body", Type mainStateType = null, Type initalStateType = null) { //IL_004d: 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) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) EntityStateMachine val = EntityStateMachine.FindByCustomName(bodyPrefab, machineName); if ((Object)(object)val == (Object)null) { val = bodyPrefab.AddComponent<EntityStateMachine>(); } else { Log.Message("An Entity State Machine already exists with the name " + machineName + ". replacing."); } val.customName = machineName; if (mainStateType == null) { mainStateType = typeof(GenericCharacterMain); } val.mainStateType = new SerializableEntityStateType(mainStateType); if (initalStateType == null) { initalStateType = typeof(SpawnTeleporterState); } val.initialStateType = new SerializableEntityStateType(initalStateType); NetworkStateMachine component = bodyPrefab.GetComponent<NetworkStateMachine>(); if (Object.op_Implicit((Object)(object)component)) { component.stateMachines = component.stateMachines.Append(val).ToArray(); } CharacterDeathBehavior component2 = bodyPrefab.GetComponent<CharacterDeathBehavior>(); if (Object.op_Implicit((Object)(object)component2)) { component2.deathStateMachine = val; } SetStateOnHurt component3 = bodyPrefab.GetComponent<SetStateOnHurt>(); if (Object.op_Implicit((Object)(object)component3)) { component3.targetStateMachine = val; } return val; } public static void SetupHitBoxGroup(GameObject modelPrefab, string hitBoxGroupName, params string[] hitboxChildNames) { ChildLocator component = modelPrefab.GetComponent<ChildLocator>(); Transform[] array = (Transform[])(object)new Transform[hitboxChildNames.Length]; for (int i = 0; i < hitboxChildNames.Length; i++) { array[i] = component.FindChild(hitboxChildNames[i]); if ((Object)(object)array[i] == (Object)null) { Log.Error("missing hitbox for " + hitboxChildNames[i]); } } SetupHitBoxGroup(modelPrefab, hitBoxGroupName, array); } public static void SetupHitBoxGroup(GameObject prefab, string hitBoxGroupName, params Transform[] hitBoxTransforms) { List<HitBox> list = new List<HitBox>(); foreach (Transform val in hitBoxTransforms) { if ((Object)(object)val == (Object)null) { Log.Error("Error setting up hitboxGroup for " + hitBoxGroupName + ": hitbox transform was null"); continue; } HitBox item = ((Component)val).gameObject.AddComponent<HitBox>(); ((Component)val).gameObject.layer = LayerIndex.projectile.intVal; list.Add(item); } if (list.Count == 0) { Log.Error("No hitboxes were set up. aborting setting up hitboxGroup for " + hitBoxGroupName); return; } HitBoxGroup obj = prefab.AddComponent<HitBoxGroup>(); obj.hitBoxes = list.ToArray(); obj.groupName = hitBoxGroupName; } } public class CustomRendererInfo { public string childName; public Material material; public bool dontHotpoo; public bool ignoreOverlays; } internal static class Skills { public static void CreateSkillFamilies(GameObject targetPrefab) { SkillSlot[] array = new SkillSlot[4]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); CreateSkillFamilies(targetPrefab, (SkillSlot[])(object)array); } public static void CreateSkillFamilies(GameObject targetPrefab, params SkillSlot[] slots) { //IL_000e: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected I4, but got Unknown SkillLocator component = targetPrefab.GetComponent<SkillLocator>(); foreach (SkillSlot val in slots) { switch (val - -1) { case 1: component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary"); break; case 2: component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary"); break; case 3: component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility"); break; case 4: component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special"); break; } } } public static void ClearGenericSkills(GameObject targetPrefab) { GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren<GenericSkill>(); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, SkillSlot skillSlot, bool hidden = false) { //IL_0007: 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_0023: Expected I4, but got Unknown SkillLocator component = targetPrefab.GetComponent<SkillLocator>(); switch (skillSlot - -1) { case 1: return component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary", hidden); case 2: return component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary", hidden); case 3: return component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility", hidden); case 4: return component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special", hidden); case 0: Log.Error("Failed to create GenericSkill with skillslot None. If making a GenericSkill outside of the main 4, specify a familyName, and optionally a genericSkillName"); return null; default: return null; } } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string familyName, bool hidden = false) { return CreateGenericSkillWithSkillFamily(targetPrefab, familyName, familyName, hidden); } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string genericSkillName, string familyName, bool hidden = false) { GenericSkill obj = targetPrefab.AddComponent<GenericSkill>(); obj.skillName = genericSkillName; obj.hideInCharacterSelect = hidden; SkillFamily val = ScriptableObject.CreateInstance<SkillFamily>(); ((Object)val).name = ((Object)targetPrefab).name + familyName + "Family"; val.variants = (Variant[])(object)new Variant[0]; obj._skillFamily = val; Content.AddSkillFamily(val); return obj; } public static void AddSkillToFamily(SkillFamily skillFamily, SkillDef skillDef, UnlockableDef unlockableDef = null) { //IL_0027: 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_0051: Expected O, but got Unknown //IL_0051: 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) 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_000b: 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) //IL_0022: 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) 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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) 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).interruptPriority = skillDefInfo.interruptPriority; ((SkillDef)val).baseMaxStock = skillDefInfo.baseMaxStock; ((SkillDef)val).baseRechargeInterval = skillDefInfo.baseRechargeInterval; ((SkillDef)val).rechargeStock = skillDefInfo.rechargeStock; ((SkillDef)val).requiredStock = skillDefInfo.requiredStock; ((SkillDef)val).stockToConsume = skillDefInfo.stockToConsume; ((SkillDef)val).dontAllowPastMaxStocks = skillDefInfo.dontAllowPastMaxStocks; ((SkillDef)val).beginSkillCooldownOnSkillEnd = skillDefInfo.beginSkillCooldownOnSkillEnd; ((SkillDef)val).canceledFromSprinting = skillDefInfo.canceledFromSprinting; ((SkillDef)val).forceSprintDuringState = skillDefInfo.forceSprintDuringState; ((SkillDef)val).fullRestockOnAssign = skillDefInfo.fullRestockOnAssign; ((SkillDef)val).resetCooldownTimerOnUse = skillDefInfo.resetCooldownTimerOnUse; ((SkillDef)val).isCombatSkill = skillDefInfo.isCombatSkill; ((SkillDef)val).mustKeyPress = skillDefInfo.mustKeyPress; ((SkillDef)val).cancelSprintingOnActivation = skillDefInfo.cancelSprintingOnActivation; ((SkillDef)val).keywordTokens = skillDefInfo.keywordTokens; Content.AddSkillDef((SkillDef)(object)val); return val; } } internal class SkillDefInfo { public string skillName; public string skillNameToken; public string skillDescriptionToken; public string[] keywordTokens = Array.Empty<string>(); public Sprite skillIcon; public SerializableEntityStateType activationState; public string activationStateMachineName; public InterruptPriority interruptPriority; public float baseRechargeInterval; public int baseMaxStock = 1; public int rechargeStock = 1; public int requiredStock = 1; public int stockToConsume = 1; public bool resetCooldownTimerOnUse; public bool fullRestockOnAssign = true; public bool dontAllowPastMaxStocks; public bool beginSkillCooldownOnSkillEnd; public bool mustKeyPress; public bool isCombatSkill = true; public bool canceledFromSprinting; public bool cancelSprintingOnActivation = true; public bool forceSprintDuringState; public SkillDefInfo() { } public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName = "Weapon", bool agile = false) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) this.skillName = skillName; this.skillNameToken = skillNameToken; this.skillDescriptionToken = skillDescriptionToken; this.skillIcon = skillIcon; this.activationState = activationState; this.activationStateMachineName = activationStateMachineName; cancelSprintingOnActivation = !agile; if (agile) { keywordTokens = new string[1] { "KEYWORD_AGILE" }; } interruptPriority = (InterruptPriority)0; isCombatSkill = true; baseRechargeInterval = 0f; requiredStock = 0; stockToConsume = 0; } } internal static class Skins { internal static SkinDef CreateSkinDef(string skinName, Sprite skinIcon, RendererInfo[] defaultRendererInfos, GameObject root, UnlockableDef unlockableDef = null) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown SkinDefParams val = ScriptableObject.CreateInstance<SkinDefParams>(); ((Object)val).name = "skinParams" + skinName; val.rendererInfos = (RendererInfo[])(object)new RendererInfo[defaultRendererInfos.Length]; defaultRendererInfos.CopyTo(val.rendererInfos, 0); SkinDef.Awake += new hook_Awake(DoNothing); SkinDef obj = ScriptableObject.CreateInstance<SkinDef>(); SkinDef.Awake -= new hook_Awake(DoNothing); obj.baseSkins = Array.Empty<SkinDef>(); obj.icon = skinIcon; obj.unlockableDef = unlockableDef; obj.rootObject = root; obj.nameToken = skinName; ((Object)obj).name = "skinEDDIE_" + skinName; obj.skinDefParams = val; return obj; } 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(AssetBundle assetBundle, RendererInfo[] defaultRendererInfos, params string[] meshes) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) 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 = assetBundle.LoadAsset<Mesh>(meshes[i]) }); } } return list.ToArray(); } } internal static class Tokens { public const string agilePrefix = "<style=cIsUtility>Agile.</style>"; public static string DamageText(string text) { return "<style=cIsDamage>" + text + "</style>"; } public static string DamageValueText(float value) { return $"<style=cIsDamage>{value * 100f}% damage</style>"; } public static string UtilityText(string text) { return "<style=cIsUtility>" + text + "</style>"; } public static string RedText(string text) { return HealthText(text); } public static string HealthText(string text) { return "<style=cIsHealth>" + text + "</style>"; } public static string KeywordText(string keyword, string sub) { return "<style=cKeywordName>" + keyword + "</style><style=cSub>" + sub + "</style>"; } public static string ScepterDescription(string desc) { return "\n<color=#d299ff>SCEPTER: " + desc + "</color>"; } public static string GetAchievementNameToken(string identifier) { return "ACHIEVEMENT_" + identifier.ToUpperInvariant() + "_NAME"; } public static string GetAchievementDescriptionToken(string identifier) { return "ACHIEVEMENT_" + identifier.ToUpperInvariant() + "_DESCRIPTION"; } } } namespace NarutoMod.Modules.Characters { public abstract class CharacterBase<T> where T : CharacterBase<T>, new() { public abstract string assetBundleName { get; } public abstract string bodyName { get; } public abstract string modelPrefabName { get; } public abstract BodyInfo bodyInfo { get; } public virtual CustomRendererInfo[] customRendererInfos { get; } public virtual ItemDisplaysBase itemDisplays { get; } public static T instance { get; private set; } public abstract AssetBundle assetBundle { get; protected set; } public abstract GameObject bodyPrefab { get; protected set; } public abstract CharacterBody prefabCharacterBody { get; protected set; } public abstract GameObject characterModelObject { get; protected set; } public abstract CharacterModel prefabCharacterModel { get; protected set; } public virtual void Initialize() { instance = this as T; assetBundle = Asset.LoadAssetBundle(assetBundleName); InitializeCharacter(); } public virtual void InitializeCharacter() { InitializeCharacterBodyPrefab(); InitializeItemDisplays(); } protected virtual void InitializeCharacterBodyPrefab() { characterModelObject = Prefabs.LoadCharacterModel(assetBundle, modelPrefabName); bodyPrefab = Prefabs.CreateBodyPrefab(characterModelObject, bodyInfo); prefabCharacterBody = bodyPrefab.GetComponent<CharacterBody>(); prefabCharacterModel = Prefabs.SetupCharacterModel(bodyPrefab, customRendererInfos); } public virtual void InitializeItemDisplays() { ItemDisplayRuleSet val = ScriptableObject.CreateInstance<ItemDisplayRuleSet>(); ((Object)val).name = "idrs" + bodyName; prefabCharacterModel.itemDisplayRuleSet = val; bool value = Config.BindAndOptions("General", "Show Item Displays", defaultValue: false, "Show items on the character's body. Off by default.", restartRequired: true).Value; if (itemDisplays != null && value) { ItemDisplays.queuedDisplays++; ContentManager.onContentPacksAssigned += SetItemDisplays; } } public void SetItemDisplays(ReadOnlyArray<ReadOnlyContentPack> obj) { itemDisplays.SetItemDisplays(prefabCharacterModel.itemDisplayRuleSet); } public abstract void InitializeEntityStateMachines(); public abstract void InitializeSkills(); public abstract void InitializeSkins(); public abstract void InitializeCharacterMaster(); } public class BodyInfo { public string bodyName = ""; public string bodyNameToken = ""; public string subtitleNameToken = ""; public string bodyNameToClone = "Commando"; public Color bodyColor = Color.white; public Texture characterPortrait; public float sortPosition = 100f; public GameObject crosshair; public GameObject podPrefab; public float maxHealth = 100f; public float healthRegen = 1f; public float armor; public float shield; public int jumpCount = 1; public float damage = 12f; public float attackSpeed = 1f; public float crit = 1f; public float moveSpeed = 7f; public float acceleration = 80f; public float jumpPower = 15f; public bool autoCalculateLevelStats = true; public float healthGrowth = 30.000002f; public float regenGrowth = 0.2f; public float armorGrowth; public float shieldGrowth; public float damageGrowth = 2.4f; public float attackSpeedGrowth; public float critGrowth; public float moveSpeedGrowth; public float jumpPowerGrowth; public Vector3 aimOriginPosition = new Vector3(0f, 1.6f, 0f); public Vector3 modelBasePosition = new Vector3(0f, -0.92f, 0f); public Vector3 cameraPivotPosition = new Vector3(0f, 0.8f, 0f); public float cameraParamsVerticalOffset = 1.37f; public float cameraParamsDepth = -10f; private CharacterCameraParams _cameraParams; public CharacterCameraParams cameraParams { get { //IL_002c: 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_0046: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_cameraParams == (Object)null) { _cameraParams = ScriptableObject.CreateInstance<CharacterCameraParams>(); _cameraParams.data.minPitch = BlendableFloat.op_Implicit(-89f); _cameraParams.data.maxPitch = BlendableFloat.op_Implicit(89f); _cameraParams.data.wallCushion = BlendableFloat.op_Implicit(0.1f); _cameraParams.data.pivotVerticalOffset = BlendableFloat.op_Implicit(cameraParamsVerticalOffset); _cameraParams.data.idealLocalCameraPos = BlendableVector3.op_Implicit(new Vector3(0f, 0f, cameraParamsDepth)); } return _cameraParams; } set { _cameraParams = value; } } } public abstract class ItemDisplaysBase { public void SetItemDisplays(ItemDisplayRuleSet itemDisplayRuleSet) { List<KeyAssetRuleGroup> list = new List<KeyAssetRuleGroup>(); ItemDisplays.LazyInit(); SetItemDisplayRules(list); itemDisplayRuleSet.keyAssetRuleGroups = list.ToArray(); ItemDisplays.DisposeWhenDone(); } protected abstract void SetItemDisplayRules(List<KeyAssetRuleGroup> itemDisplayRules); } public abstract class SurvivorBase<T> : CharacterBase<T> where T : SurvivorBase<T>, new() { public abstract string masterName { get; } public abstract string displayPrefabName { get; } public abstract string survivorTokenPrefix { get; } public abstract UnlockableDef characterUnlockableDef { get; } public abstract GameObject displayPrefab { get; protected set; } public override void InitializeCharacter() { base.InitializeCharacter(); InitializeDisplayPrefab(); InitializeSurvivor(); } protected virtual void InitializeDisplayPrefab() { displayPrefab = Prefabs.CreateDisplayPrefab(assetBundle, displayPrefabName, bodyPrefab); } protected virtual void InitializeSurvivor() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Content.CreateSurvivor(bodyPrefab, displayPrefab, bodyInfo.bodyColor, survivorTokenPrefix, characterUnlockableDef, bodyInfo.sortPosition); } protected virtual void AddCssPreviewSkill(int indexFromEditor, SkillFamily skillFamily, SkillDef skillDef) { CharacterSelectSurvivorPreviewDisplayController component = displayPrefab.GetComponent<CharacterSelectSurvivorPreviewDisplayController>(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("trying to add skillChangeResponse to null CharacterSelectSurvivorPreviewDisplayController.\nMake sure you created one on your Display prefab in editor"); return; } component.skillChangeResponses[indexFromEditor].triggerSkillFamily = skillFamily; component.skillChangeResponses[indexFromEditor].triggerSkill = skillDef; } protected virtual void AddCssPreviewSkin(int indexFromEditor, SkinDef skinDef) { CharacterSelectSurvivorPreviewDisplayController component = displayPrefab.GetComponent<CharacterSelectSurvivorPreviewDisplayController>(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("trying to add skinChangeResponse to null CharacterSelectSurvivorPreviewDisplayController.\nMake sure you created one on your Display prefab in editor"); } else { component.skinChangeResponses[indexFromEditor].triggerSkin = skinDef; } } protected virtual void FinalizeCSSPreviewDisplayController() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)displayPrefab)) { return; } CharacterSelectSurvivorPreviewDisplayController component = displayPrefab.GetComponent<CharacterSelectSurvivorPreviewDisplayController>(); if (!Object.op_Implicit((Object)(object)component)) { return; } component.bodyPrefab = bodyPrefab; List<SkillChangeResponse> list = new List<SkillChangeResponse>(); for (int i = 0; i < component.skillChangeResponses.Length; i++) { if ((Object)(object)component.skillChangeResponses[i].triggerSkillFamily != (Object)null) { list.Add(component.skillChangeResponses[i]); } } component.skillChangeResponses = list.ToArray(); } } } namespace NarutoMod.Modules.BaseStates { public abstract class BaseMeleeAttack : BaseSkillState, IStepSetter { public int swingIndex; protected string hitboxGroupName = "SwordGroup"; protected DamageTypeCombo damageType = DamageTypeCombo.op_Implicit((DamageType)0); protected float damageCoefficient = 3.5f; protected float procCoefficient = 1f; protected float pushForce = 300f; protected Vector3 bonusForce = Vector3.zero; protected float baseDuration = 1f; protected float attackStartPercentTime = 0.2f; protected float attackEndPercentTime = 0.4f; protected float earlyExitPercentTime = 0.4f; protected float hitStopDuration = 0.012f; protected float attackRecoil = 0.75f; protected float hitHopVelocity = 4f; protected string swingSoundString = ""; protected string hitSoundString = ""; protected string muzzleString = "SwingCenter"; protected string playbackRateParam = "Slash.playbackRate"; protected GameObject swingEffectPrefab; protected GameObject hitEffectPrefab; protected NetworkSoundEventIndex impactSound = (NetworkSoundEventIndex)(-1); protected OverlapAttack attack; public float duration; private bool hasFired; private float hitPauseTimer; protected bool inHitPause; private bool hasHopped; protected float stopwatch; protected Animator animator; private HitStopCachedState hitStopCachedState; private Vector3 storedVelocity; private readonly List<HurtBox> hitBuffer = new List<HurtBox>(); public override void OnEnter() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); duration = baseDuration / ((BaseState)this).attackSpeedStat; animator = ((EntityState)this).GetModelAnimator(); ((BaseState)this).StartAimMode(0.5f + duration, false); PlayAttackAnimation(); attack = new OverlapAttack(); attack.damageType = damageType; attack.attacker = ((EntityState)this).gameObject; attack.inflictor = ((EntityState)this).gameObject; attack.teamIndex = ((BaseState)this).GetTeam(); attack.damage = damageCoefficient * ((BaseState)this).damageStat; attack.procCoefficient = procCoefficient; attack.hitEffectPrefab = hitEffectPrefab; attack.forceVector = bonusForce; attack.pushAwayForce = pushForce; attack.hitBoxGroup = ((BaseState)this).FindHitBoxGroup(hitboxGroupName); attack.isCrit = ((BaseState)this).RollCrit(); attack.impactSound = impactSound; ModifyOverlapAttack(attack); } protected virtual void ModifyOverlapAttack(OverlapAttack attack) { } protected virtual void PlayAttackAnimation() { ((EntityState)this).PlayCrossfade("Gesture, Override", "Slash" + (1 + swingIndex), playbackRateParam, duration, 0.05f); } public override void OnExit() { if (inHitPause) { RemoveHitstop(); } ((EntityState)this).OnExit(); } protected virtual void PlaySwingEffect() { EffectManager.SimpleMuzzleFlash(swingEffectPrefab, ((EntityState)this).gameObject, muzzleString, false); } protected virtual void OnEnemiesHitAuthority(int count) { } protected virtual void OnHitEnemyAuthority() { Util.PlaySound(hitSoundString, ((EntityState)this).gameObject); if (!hasHopped) { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor) && !((EntityState)this).characterMotor.isGrounded && hitHopVelocity > 0f) { ((BaseState)this).SmallHop(((EntityState)this).characterMotor, hitHopVelocity); } hasHopped = true; } ApplyHitstop(); } protected void ApplyHitstop() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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) if (!inHitPause && hitStopDuration > 0f) { storedVelocity = ((EntityState)this).characterMotor.velocity; hitStopCachedState = ((BaseState)this).CreateHitStopCachedState(((EntityState)this).characterMotor, animator, playbackRateParam); hitPauseTimer = hitStopDuration / ((BaseState)this).attackSpeedStat; inHitPause = true; } } private void FireAttack() { if (((EntityState)this).isAuthority) { hitBuffer.Clear(); if (attack.Fire(hitBuffer)) { OnHitEnemyAuthority(); OnEnemiesHitAuthority(hitBuffer.Count); } } } private void EnterAttack() { hasFired = true; Util.PlayAttackSpeedSound(swingSoundString, ((EntityState)this).gameObject, ((BaseState)this).attackSpeedStat); PlaySwingEffect(); if (((EntityState)this).isAuthority) { ((BaseState)this).AddRecoil(-1f * attackRecoil, -2f * attackRecoil, -0.5f * attackRecoil, 0.5f * attackRecoil); } } public override void FixedUpdate() { //IL_0062: 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) ((EntityState)this).FixedUpdate(); hitPauseTimer -= Time.deltaTime; if (hitPauseTimer <= 0f && inHitPause) { RemoveHitstop(); } if (!inHitPause) { stopwatch += Time.deltaTime; } else { if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.velocity = Vector3.zero; } if (Object.op_Implicit((Object)(object)animator)) { animator.SetFloat(playbackRateParam, 0f); } } bool flag = stopwatch >= duration * attackStartPercentTime; bool flag2 = stopwatch >= duration * attackEndPercentTime; if ((flag && !flag2) || (flag && flag2 && !hasFired)) { if (!hasFired) { EnterAttack(); } FireAttack(); } if (stopwatch >= duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } private void RemoveHitstop() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).ConsumeHitStopCachedState(hitStopCachedState, ((EntityState)this).characterMotor, animator); inHitPause = false; ((EntityState)this).characterMotor.velocity = storedVelocity; } public override InterruptPriority GetMinimumInterruptPriority() { if (!(stopwatch >= duration * earlyExitPercentTime)) { return (InterruptPriority)1; } return (InterruptPriority)0; } public override void OnSerialize(NetworkWriter writer) { ((BaseSkillState)this).OnSerialize(writer); writer.Write(swingIndex); } public override void OnDeserialize(NetworkReader reader) { ((BaseSkillState)this).OnDeserialize(reader); swingIndex = reader.ReadInt32(); } public void SetStep(int i) { swingIndex = i; } } public abstract class BaseTimedSkillState : BaseSkillState { protected float duration; protected float castStartTime; protected float castEndTime; protected bool hasFired; protected bool isFiring; protected bool hasExited; public abstract float TimedBaseDuration { get; } public abstract float TimedBaseCastStartPercentTime { get; } public virtual float TimedBaseCastEndPercentTime => 1f; public override void OnEnter() { InitDurationValues(); ((BaseState)this).OnEnter(); } protected virtual void InitDurationValues() { duration = TimedBaseDuration / ((BaseState)this).attackSpeedStat; castStartTime = TimedBaseCastStartPercentTime * duration; castEndTime = TimedBaseCastEndPercentTime * duration; } protected virtual void OnCastEnter() { } protected virtual void OnCastFixedUpdate() { } protected virtual void OnCastUpdate() { } protected virtual void OnCastExit() { } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); bool flag = ((EntityState)this).fixedAge >= castStartTime; bool flag2 = ((EntityState)this).fixedAge >= castEndTime; isFiring = false; if ((flag && !flag2) || (flag && flag2 && !hasFired)) { isFiring = true; OnCastFixedUpdate(); if (!hasFired) { OnCastEnter(); hasFired = true; } } if (flag2 && !hasExited) { hasExited = true; OnCastExit(); } if (((EntityState)this).fixedAge > duration) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void Update() { ((EntityState)this).Update(); if (isFiring) { OnCastUpdate(); } } } public class ExampleTimedSkillState : BaseTimedSkillState { public override float TimedBaseDuration => 1.5f; public override float TimedBaseCastStartPercentTime => 0.2f; public override float TimedBaseCastEndPercentTime => 0.9f; protected override void OnCastEnter() { } protected override void OnCastFixedUpdate() { } protected override void OnCastExit() { } } public class ExampleDelayedSkillState : BaseTimedSkillState { public override float TimedBaseDuration => 1.5f; public override float TimedBaseCastStartPercentTime => 0.2f; protected override void OnCastEnter() { } } } namespace NarutoMod.Modules.Achievements { public abstract class BaseMasteryAchievement : BaseAchievement { public abstract string RequiredCharacterBody { get; } public abstract float RequiredDifficultyCoefficient { get; } public override BodyIndex LookUpRequiredBodyIndex() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return BodyCatalog.FindBodyIndex(RequiredCharacterBody); } public override void OnBodyRequirementMet() { ((BaseAchievement)this).OnBodyRequirementMet(); Run.onClientGameOverGlobal += OnClientGameOverGlobal; } public override void OnBodyRequirementBroken() { Run.onClientGameOverGlobal -= OnClientGameOverGlobal; ((BaseAchievement)this).OnBodyRequirementBroken(); } private void OnClientGameOverGlobal(Run run, RunReport runReport) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references)
plugins/SurvivorFramework.dll
Decompiled 16 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using JetBrains.Annotations; using KinematicCharacterController; using Microsoft.CodeAnalysis; using On.RoR2; using On.RoR2.UI; using R2API; using R2API.Networking; using R2API.Networking.Interfaces; using RoR2; using RoR2.CameraModes; using RoR2.Navigation; using RoR2.Skills; using RoR2.UI; using SurvivorFramework.Defense; using SurvivorFramework.Effects; using SurvivorFramework.Forms; using SurvivorFramework.Mastery; using SurvivorFramework.Movement; using SurvivorFramework.Net; using SurvivorFramework.Resources; using SurvivorFramework.UI; using UnityEngine; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("SurvivorFramework")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+58a86b8ad83f0e9f3dda462bae30810ec5d2d51d")] [assembly: AssemblyProduct("SurvivorFramework")] [assembly: AssemblyTitle("SurvivorFramework")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] 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; } } [CompilerGenerated] [Embedded] [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; } } } namespace SurvivorFramework { public static class Framework { public const string Version = "0.1.0"; private static bool initialized; public static void Init() { if (!initialized) { initialized = true; NetworkingAPI.RegisterMessageType<SurfaceStateMessage>(); NetworkingAPI.RegisterMessageType<KillCreditMessage>(); NetworkingAPI.RegisterMessageType<SubstitutionMessage>(); NetworkingAPI.RegisterMessageType<AnimSyncMessage>(); NetworkingAPI.RegisterMessageType<FormRequestMessage>(); SubstitutionController.InstallHooks(); SurfaceWalker.InstallHooks(); MasteryTracker.InstallHooks(); ResourceHud.InstallHooks(); FormController.InstallHooks(); } } } } namespace SurvivorFramework.UI { public class RadialMenu { public struct Item { public string label; public string sub; public string initials; public string detail; public Color color; public bool disabled; } public Item[] items = new Item[0]; public float[] angles; public int centerItem = -1; public string idleTitle = ""; public string idleDetail = ""; public Color idleColor = Color.white; private MPEventSystem cursorSystem; private float hoverAnim; private int lastHover = -2; private static Texture2D texDisc; private static Texture2D texRing; private static Texture2D texGlow; private static Texture2D texPixel; private static GUIStyle sName; private static GUIStyle sSmall; private static GUIStyle sCenterName; private static GUIStyle sCenterSmall; private int RingCount => items.Length - ((centerItem >= 0 && centerItem < items.Length) ? 1 : 0); public bool isOpen { get; private set; } public int hover { get; private set; } = -1; private int RingIndex(int i) { if (centerItem < 0 || i <= centerItem) { return i; } return i - 1; } private float AngleOf(int i) { if (angles == null || angles.Length != items.Length) { return (float)RingIndex(i) * 360f / (float)Mathf.Max(1, RingCount); } return angles[i]; } public void Open() { if (!isOpen) { isOpen = true; hover = -1; LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); cursorSystem = ((firstLocalUser != null) ? firstLocalUser.eventSystem : null); if (Object.op_Implicit((Object)(object)cursorSystem)) { MPEventSystem obj = cursorSystem; int cursorOpenerCount = obj.cursorOpenerCount; obj.cursorOpenerCount = cursorOpenerCount + 1; } } } public void Close() { if (isOpen) { isOpen = false; if (Object.op_Implicit((Object)(object)cursorSystem)) { cursorSystem.cursorOpenerCount = Mathf.Max(0, cursorSystem.cursorOpenerCount - 1); cursorSystem = null; } } } public int UpdatePick() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0044: 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_00b6: 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) hover = -1; if (!isOpen || items.Length == 0) { return -1; } Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)Screen.width * 0.5f, (float)Screen.height * 0.5f); Vector2 val2 = Vector2.op_Implicit(Input.mousePosition) - val; bool flag = centerItem >= 0 && centerItem < items.Length; float num = (float)Screen.height * (flag ? 0.1f : 0.06f); if (((Vector2)(ref val2)).magnitude < num) { if (flag && !items[centerItem].disabled) { hover = centerItem; } return hover; } float num2 = Mathf.Atan2(val2.x, val2.y) * 57.29578f; if (num2 < 0f) { num2 += 360f; } int num3 = -1; float num4 = 999f; for (int i = 0; i < items.Length; i++) { if (i != centerItem) { float num5 = Mathf.Abs(Mathf.DeltaAngle(num2, AngleOf(i))); if (num5 < num4) { num4 = num5; num3 = i; } } } if (num3 < 0) { return -1; } hover = (items[num3].disabled ? (-1) : num3); return hover; } private static Texture2D MakeCircle(int n, float inner, float softness, bool radialFade) { //IL_0004: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(n, n, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; Color32[] array = (Color32[])(object)new Color32[n * n]; float num = (float)(n - 1) * 0.5f; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { float num2 = Mathf.Sqrt(((float)j - num) * ((float)j - num) + ((float)i - num) * ((float)i - num)) / num; float num3 = Mathf.Clamp01((1f - num2) / softness); if (inner > 0f) { num3 *= Mathf.Clamp01((num2 - inner) / softness); } if (radialFade) { num3 = Mathf.Pow(Mathf.Clamp01(1f - num2), 2f); } array[i * n + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num3 * 255f)); } } val.SetPixels32(array); val.Apply(); return val; } private static void EnsureGui() { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)texDisc)) { texDisc = MakeCircle(128, 0f, 0.04f, radialFade: false); } if (!Object.op_Implicit((Object)(object)texRing)) { texRing = MakeCircle(128, 0.86f, 0.04f, radialFade: false); } if (!Object.op_Implicit((Object)(object)texGlow)) { texGlow = MakeCircle(128, 0f, 1f, radialFade: true); } if (!Object.op_Implicit((Object)(object)texPixel)) { texPixel = new Texture2D(1, 1); texPixel.SetPixel(0, 0, Color.white); texPixel.Apply(); } int num = Mathf.RoundToInt((float)Screen.height / 52f); if (sName == null) { sName = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)1, fontStyle = (FontStyle)1, richText = true, wordWrap = true }; sSmall = new GUIStyle(sName) { fontStyle = (FontStyle)0 }; sCenterName = new GUIStyle(sName) { alignment = (TextAnchor)4 }; sCenterSmall = new GUIStyle(sSmall) { alignment = (TextAnchor)4 }; } sName.fontSize = num; sSmall.fontSize = Mathf.RoundToInt((float)num * 0.8f); sCenterName.fontSize = Mathf.RoundToInt((float)num * 1.15f); sCenterSmall.fontSize = Mathf.RoundToInt((float)num * 0.85f); } private static void Disc(Texture2D t, Vector2 c, float r, Color col) { //IL_0000: 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_000e: 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) GUI.color = col; GUI.DrawTexture(new Rect(c.x - r, c.y - r, r * 2f, r * 2f), (Texture)(object)t); } public static void Shadowed(Rect r, string text, GUIStyle st) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0074: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, 0.8f * color.a); GUI.Label(new Rect(((Rect)(ref r)).x + 1.5f, ((Rect)(ref r)).y + 1.5f, ((Rect)(ref r)).width, ((Rect)(ref r)).height), Regex.Replace(text, "<color=[^>]*>|</color>", ""), st); GUI.color = color; GUI.Label(r, text, st); } public static void Label(Rect r, string text, float sizeOfHeight, TextAnchor anchor) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown //IL_0031: 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) EnsureGui(); GUIStyle st = new GUIStyle(sSmall) { alignment = anchor, fontSize = Mathf.RoundToInt((float)Screen.height * sizeOfHeight), wordWrap = false }; GUI.color = Color.white; Shadowed(r, text, st); } public void Draw() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0512: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_0503: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_0561: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: 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_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_05e4: Unknown result type (might be due to invalid IL or missing references) //IL_05ed: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0621: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03da: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_06b3: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_0674: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Unknown result type (might be due to invalid IL or missing references) //IL_06a2: Unknown result type (might be due to invalid IL or missing references) //IL_0449: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) if (!isOpen || items.Length == 0) { return; } EnsureGui(); float num = Screen.height; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)Screen.width * 0.5f, num * 0.5f); float num2 = num * 0.235f; float num3 = num * 0.055f; float num4 = num * 0.11f; if (hover != lastHover) { lastHover = hover; hoverAnim = 0f; } hoverAnim = Mathf.MoveTowards(hoverAnim, 1f, Time.unscaledDeltaTime * 8f); GUI.color = new Color(0f, 0f, 0f, 0.35f); GUI.DrawTexture(new Rect(0f, 0f, (float)Screen.width, num), (Texture)(object)texPixel); Disc(texGlow, val, num2 + num3 * 2.4f, new Color(0f, 0f, 0f, 0.75f)); Disc(texRing, val, num2 + 1.5f, new Color(1f, 1f, 1f, 0.12f)); _ = 360f / (float)items.Length; bool flag = centerItem >= 0 && centerItem < items.Length; if (hover >= 0 && hover != centerItem) { Color color = items[hover].color; Matrix4x4 matrix = GUI.matrix; GUIUtility.RotateAroundPivot(AngleOf(hover), val); GUI.color = new Color(color.r, color.g, color.b, 0.55f * hoverAnim); GUI.DrawTexture(new Rect(val.x - 2f, val.y - num2 + num3, 4f, num2 - num3 - num4), (Texture)(object)texPixel); GUI.matrix = matrix; } for (int i = 0; i < items.Length; i++) { if (i != centerItem) { Item item = items[i]; float num5 = AngleOf(i) * (MathF.PI / 180f); Vector2 val2 = val + new Vector2(Mathf.Sin(num5), 0f - Mathf.Cos(num5)) * num2; Color val3 = (Color)(item.disabled ? new Color(0.45f, 0.45f, 0.45f) : item.color); bool flag2 = i == hover; float num6 = num3 * (flag2 ? Mathf.Lerp(1f, 1.18f, hoverAnim) : 1f); if (flag2) { Disc(texGlow, val2, num6 * 2.1f, new Color(val3.r, val3.g, val3.b, 0.55f * hoverAnim)); } Disc(texDisc, val2, num6, new Color(0.06f, 0.06f, 0.09f, 0.95f)); Disc(texDisc, val2, num6 * 0.78f, new Color(val3.r * 0.35f, val3.g * 0.35f, val3.b * 0.35f, 0.9f)); Disc(texRing, val2, num6, new Color(val3.r, val3.g, val3.b, flag2 ? 1f : 0.7f)); GUI.color = Color.white; Shadowed(new Rect(val2.x - num6, val2.y - num6 * 0.45f, num6 * 2f, num6), "<color=#" + ColorUtility.ToHtmlStringRGB(Color.Lerp(val3, Color.white, 0.4f)) + ">" + item.initials + "</color>", sCenterName); GUI.color = (Color)(flag2 ? Color.white : new Color(1f, 1f, 1f, item.disabled ? 0.45f : 0.75f)); Shadowed(new Rect(val2.x - num3 * 2.2f, val2.y + num6 + 2f, num3 * 4.4f, num * 0.03f), item.label, sName); if (!string.IsNullOrEmpty(item.sub)) { Shadowed(new Rect(val2.x - num3 * 2.2f, val2.y + num6 + num * 0.026f, num3 * 4.4f, num * 0.03f), item.sub, sSmall); } } } if (flag) { DrawCenterButton(val, num4, num); return; } Disc(texDisc, val, num4, new Color(0.04f, 0.04f, 0.07f, 0.92f)); Color val4 = ((hover >= 0) ? items[hover].color : idleColor); Disc(texRing, val, num4, new Color(val4.r, val4.g, val4.b, 0.8f)); GUI.color = Color.white; string text = ((hover >= 0) ? items[hover].label : idleTitle); string text2 = ((hover >= 0) ? items[hover].detail : idleDetail); Shadowed(new Rect(val.x - num4, val.y - num4 * 0.55f, num4 * 2f, num4 * 0.5f), "<color=#" + ColorUtility.ToHtmlStringRGB(val4) + ">" + text + "</color>", sCenterName); if (!string.IsNullOrEmpty(text2)) { GUI.color = new Color(1f, 1f, 1f, 0.8f); Shadowed(new Rect(val.x - num4 * 0.85f, val.y - num4 * 0.05f, num4 * 1.7f, num4 * 0.8f), text2, sCenterSmall); } GUI.color = Color.white; } private void DrawCenterButton(Vector2 c, float centreR, float H) { //IL_0040: 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_0045: 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_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Expected O, but got Unknown //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_044f: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04cd: Unknown result type (might be due to invalid IL or missing references) Item item = items[centerItem]; bool flag = hover == centerItem; Color val = (Color)(item.disabled ? new Color(0.45f, 0.45f, 0.45f) : item.color); float num = centreR * 0.82f * (flag ? Mathf.Lerp(1f, 1.1f, hoverAnim) : 1f); if (flag) { Disc(texGlow, c, num * 2f, new Color(val.r, val.g, val.b, 0.5f * hoverAnim)); } Disc(texDisc, c, num, new Color(0.05f, 0.05f, 0.08f, 0.95f)); Disc(texDisc, c, num * 0.84f, new Color(val.r * 0.3f, val.g * 0.3f, val.b * 0.3f, flag ? 0.95f : 0.8f)); Disc(texRing, c, num, new Color(val.r, val.g, val.b, flag ? 1f : 0.65f)); Disc(texRing, c, num * 0.86f, new Color(val.r, val.g, val.b, 0.18f)); GUI.color = Color.white; Shadowed(new Rect(c.x - num, c.y - num * 0.5f, num * 2f, num * 0.55f), "<color=#" + ColorUtility.ToHtmlStringRGB(Color.Lerp(val, Color.white, 0.35f)) + ">" + item.label + "</color>", sCenterName); if (!string.IsNullOrEmpty(item.sub)) { GUI.color = new Color(1f, 1f, 1f, 0.75f); Shadowed(new Rect(c.x - num * 0.9f, c.y + num * 0.05f, num * 1.8f, num * 0.45f), item.sub, sCenterSmall); } float num2 = H * 0.235f; float num3 = H * 0.055f; float num4 = H * 0.46f; float num5 = c.y + num2 + num3 + H * 0.075f; Color val2 = ((hover >= 0) ? items[hover].color : idleColor); string text = ((hover >= 0) ? items[hover].detail : idleDetail); float num6 = (string.IsNullOrEmpty(text) ? 0f : sSmall.CalcHeight(new GUIContent(text), num4 * 0.94f)); float num7 = H * 0.044f + num6; num5 = Mathf.Min(num5, H - num7 - H * 0.01f); GUI.color = new Color(0f, 0f, 0f, 0.6f); GUI.DrawTexture(new Rect(c.x - num4 * 0.5f, num5, num4, num7), (Texture)(object)texPixel); GUI.color = new Color(val2.r, val2.g, val2.b, 0.85f); GUI.DrawTexture(new Rect(c.x - num4 * 0.5f, num5, num4, 2f), (Texture)(object)texPixel); GUI.color = Color.white; string text2 = ((hover >= 0) ? items[hover].label : idleTitle); string text3 = ((hover >= 0) ? items[hover].detail : idleDetail); Shadowed(new Rect(c.x - num4 * 0.5f, num5 + H * 0.006f, num4, H * 0.03f), "<color=#" + ColorUtility.ToHtmlStringRGB(val2) + ">" + text2 + "</color>", sName); if (!string.IsNullOrEmpty(text3)) { GUI.color = new Color(1f, 1f, 1f, 0.82f); Shadowed(new Rect(c.x - num4 * 0.47f, num5 + H * 0.034f, num4 * 0.94f, num7 - H * 0.036f), text3, sSmall); } GUI.color = Color.white; } } public class ResourceHud : MonoBehaviour { private class Mote { public RectTransform r; public Image img; public float age; public float life; public float x; public float rise; public float size; public float drift; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Predicate<Mote> <>9__47_0; public static hook_Awake <>9__48_0; internal bool <UpdateMotes>b__47_0(Mote q) { return q.age >= q.life; } internal void <InstallHooks>b__48_0(orig_Awake orig, HUD self) { orig.Invoke(self); ((Component)self).gameObject.AddComponent<ResourceHud>().hud = self; } } private const float BarHeight = 22f; private const float PanelHeight = 30f; private const float Gap = 4f; private const float GlowPad = 9f; private HUD hud; private GameObject root; private RectTransform fill; private RectTransform reservedFill; private RectTransform xpFill; private Image fillImage; private Image xpImage; private Image formStripe; private Text label; private Text formName; private Text formInfo; private Text abilityText; private GameObject formPanel; private RectTransform ticks; private int tickCount = -1; private float shownFraction; private float shownXp; private float glowLevel; private Image glowImage; private Image shimmerImage; private Image tipImage; private Image rimImage; private RawImage flowImage; private RectTransform tip; private RectTransform motesRoot; private readonly List<Mote> motes = new List<Mote>(); private float moteTimer; private static Texture2D flowTex; private RectTransform shimmer; private static Sprite softRect; private static Sprite softBand; private static Sprite roundRect; private static Sprite roundFill; private static Sprite diamond; private Image formAccent; private Image formEmblem; private Image formGlow; private Image formRim; private RectTransform formRow; public static Func<RectTransform> extraSkillIcon; private readonly Vector3[] corners = (Vector3[])(object)new Vector3[4]; private static void EnsureSprites() { //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_0022: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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_0175: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)softRect)) { Texture2D val = new Texture2D(48, 48, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1 }; for (int i = 0; i < 48; i++) { for (int j = 0; j < 48; j++) { float num = Mathf.Max(0, Mathf.Max(18 - j, j - 29)); float num2 = Mathf.Max(0, Mathf.Max(18 - i, i - 29)); float num3 = Mathf.Sqrt(num * num + num2 * num2) / 18f; float num4 = Mathf.Pow(Mathf.Clamp01(1f - num3), 2f); val.SetPixel(j, i, new Color(1f, 1f, 1f, num4)); } } val.Apply(); softRect = Sprite.Create(val, new Rect(0f, 0f, 48f, 48f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, new Vector4(18f, 18f, 18f, 18f)); } if (Object.op_Implicit((Object)(object)softBand)) { return; } Texture2D val2 = new Texture2D(32, 4, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1 }; for (int k = 0; k < 32; k++) { float num5 = ((float)k - 15.5f) / 15.5f; float num6 = Mathf.Exp((0f - num5) * num5 * 4f); for (int l = 0; l < 4; l++) { val2.SetPixel(k, l, new Color(1f, 1f, 1f, num6)); } } val2.Apply(); softBand = Sprite.Create(val2, new Rect(0f, 0f, 32f, 4f), new Vector2(0.5f, 0.5f)); } private static void EnsurePanelSprites() { //IL_0042: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)roundRect)) { return; } Vector4 val = default(Vector4); ((Vector4)(ref val))..ctor(9f, 9f, 9f, 9f); roundRect = Sprite.Create(Make(rim: true), new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, val); roundFill = Sprite.Create(Make(rim: false), new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0, val); Texture2D val2 = new Texture2D(32, 32, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1 }; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num = Mathf.Abs((float)j + 0.5f - 16f) + Mathf.Abs((float)i + 0.5f - 16f); float num2 = Mathf.Clamp01(15.5f - num + 0.5f); float num3 = Mathf.Clamp01(10f - num); val2.SetPixel(j, i, new Color(1f, 1f, 1f, Mathf.Max(num2 * ((num > 11.5f) ? 1f : 0.25f), num3))); } } val2.Apply(); diamond = Sprite.Create(val2, new Rect(0f, 0f, 32f, 32f), new Vector2(0.5f, 0.5f)); static Texture2D Make(bool rim) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_00b9: 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) Texture2D val3 = new Texture2D(32, 32, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; for (int k = 0; k < 32; k++) { for (int l = 0; l < 32; l++) { float num4 = Mathf.Clamp((float)l + 0.5f, 8f, 24f); float num5 = Mathf.Clamp((float)k + 0.5f, 8f, 24f); float num6 = Mathf.Sqrt(((float)l + 0.5f - num4) * ((float)l + 0.5f - num4) + ((float)k + 0.5f - num5) * ((float)k + 0.5f - num5)); float num7 = Mathf.Clamp01(8f - num6 + 0.5f); if (!rim) { val3.SetPixel(l, k, new Color(1f, 1f, 1f, num7)); } else { float num8 = Mathf.Max(Mathf.Clamp01(1.6f - Mathf.Abs(6.8f - num6)) * ((num6 > 5f) ? 1f : 0f), (l < 1 || k < 1 || l > 30 || k > 30) ? 1f : 0f) * num7; val3.SetPixel(l, k, new Color(1f, 1f, 1f, num8)); } } } val3.Apply(); return val3; } } private static Texture2D FlowTexture() { //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_0033: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)flowTex)) { return flowTex; } flowTex = new Texture2D(128, 32, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)0, filterMode = (FilterMode)1 }; for (int i = 0; i < 32; i++) { for (int j = 0; j < 128; j++) { float num = (float)j / 128f * MathF.PI * 2f; float num2 = (float)i / 32f; float num3 = 0f; for (int k = 0; k < 3; k++) { float num4 = 0.5f + 0.32f * Mathf.Sin(num * (float)(k + 1) + (float)k * 2.1f); float num5 = Mathf.Abs(num2 - num4) / (0.06f + 0.03f * (float)k); num3 = Mathf.Max(num3, Mathf.Exp((0f - num5) * num5) * (0.9f - 0.2f * (float)k)); } flowTex.SetPixel(j, i, new Color(1f, 1f, 1f, num3)); } } flowTex.Apply(); return flowTex; } private void UpdateMotes(float level, float frac, float barW, Color c, float dt) { //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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) if (level > 0.05f) { moteTimer -= dt * (6f + 18f * level); Vector2 val3 = default(Vector2); while (moteTimer <= 0f) { moteTimer += 1f; Mote mote = motes.Find((Mote q) => q.age >= q.life); if (mote == null && motes.Count < 28) { RectTransform val = Rect("Mote", (Transform)(object)motesRoot); Image val2 = ((Component)val).gameObject.AddComponent<Image>(); val2.sprite = softRect; ((Graphic)val2).raycastTarget = false; ((Vector2)(ref val3))..ctor(0f, 0f); val.anchorMax = val3; val.anchorMin = val3; val.pivot = new Vector2(0.5f, 0.5f); mote = new Mote { r = val, img = val2 }; motes.Add(mote); } if (mote == null) { break; } mote.age = 0f; mote.life = Random.Range(0.45f, 0.9f); mote.x = Random.Range(0.02f, Mathf.Max(0.03f, frac)) * barW; mote.rise = Random.Range(10f, 26f); mote.size = Random.Range(3f, 7f); mote.drift = Random.Range(-6f, 6f); } } foreach (Mote mote2 in motes) { if (mote2.age >= mote2.life) { ((Behaviour)mote2.img).enabled = false; continue; } mote2.age += dt; float num = Mathf.Clamp01(mote2.age / mote2.life); ((Behaviour)mote2.img).enabled = true; mote2.r.anchoredPosition = new Vector2(mote2.x + mote2.drift * num, -7.7f + mote2.rise * num); mote2.r.sizeDelta = Vector2.one * mote2.size * (1f - 0.5f * num); ((Graphic)mote2.img).color = new Color(Mathf.Lerp(c.r, 1f, 0.5f), Mathf.Lerp(c.g, 1f, 0.5f), Mathf.Lerp(c.b, 1f, 0.5f), Mathf.Sin(num * MathF.PI) * 0.9f); } } internal static void InstallHooks() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown object obj = <>c.<>9__48_0; if (obj == null) { hook_Awake val = delegate(orig_Awake orig, HUD self) { orig.Invoke(self); ((Component)self).gameObject.AddComponent<ResourceHud>().hud = self; }; <>c.<>9__48_0 = val; obj = (object)val; } HUD.Awake += (hook_Awake)obj; } private static Font GetFont() { Font val = null; try { val = Resources.GetBuiltinResource<Font>("Arial.ttf"); } catch { } if (!Object.op_Implicit((Object)(object)val)) { try { val = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf"); } catch { } } return val; } private static RectTransform Rect(string name, Transform parent) { //IL_0014: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown RectTransform val = (RectTransform)new GameObject(name, new Type[1] { typeof(RectTransform) }).transform; ((Transform)val).SetParent(parent, false); return val; } private static RectTransform Stretch(RectTransform r, float l, float b, float rr, float t) { //IL_0001: 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_0019: 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) r.anchorMin = Vector2.zero; r.anchorMax = Vector2.one; r.offsetMin = new Vector2(l, b); r.offsetMax = new Vector2(0f - rr, 0f - t); return r; } private void Build() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_008e: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: 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_02db: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0432: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_051c: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Unknown result type (might be due to invalid IL or missing references) //IL_059a: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_06c2: Unknown result type (might be due to invalid IL or missing references) //IL_06dc: Unknown result type (might be due to invalid IL or missing references) //IL_074e: Unknown result type (might be due to invalid IL or missing references) //IL_077a: Unknown result type (might be due to invalid IL or missing references) //IL_0794: Unknown result type (might be due to invalid IL or missing references) //IL_07ae: Unknown result type (might be due to invalid IL or missing references) //IL_07be: Unknown result type (might be due to invalid IL or missing references) //IL_07eb: Unknown result type (might be due to invalid IL or missing references) //IL_0809: Expected O, but got Unknown //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0868: Unknown result type (might be due to invalid IL or missing references) //IL_087e: Unknown result type (might be due to invalid IL or missing references) //IL_0894: Unknown result type (might be due to invalid IL or missing references) //IL_08aa: Unknown result type (might be due to invalid IL or missing references) //IL_08c0: Unknown result type (might be due to invalid IL or missing references) //IL_099c: Unknown result type (might be due to invalid IL or missing references) //IL_0a37: Unknown result type (might be due to invalid IL or missing references) //IL_0a4d: Unknown result type (might be due to invalid IL or missing references) //IL_0a63: Unknown result type (might be due to invalid IL or missing references) //IL_0a79: Unknown result type (might be due to invalid IL or missing references) //IL_0a8f: Unknown result type (might be due to invalid IL or missing references) //IL_0aea: Unknown result type (might be due to invalid IL or missing references) //IL_0af1: Unknown result type (might be due to invalid IL or missing references) //IL_0b04: Unknown result type (might be due to invalid IL or missing references) //IL_0b1a: Unknown result type (might be due to invalid IL or missing references) //IL_0b30: Unknown result type (might be due to invalid IL or missing references) //IL_0ba3: Unknown result type (might be due to invalid IL or missing references) //IL_0ba8: Unknown result type (might be due to invalid IL or missing references) //IL_0bb3: Unknown result type (might be due to invalid IL or missing references) //IL_0bbd: Unknown result type (might be due to invalid IL or missing references) //IL_0bc8: Unknown result type (might be due to invalid IL or missing references) //IL_0bd2: Unknown result type (might be due to invalid IL or missing references) //IL_0bdd: Unknown result type (might be due to invalid IL or missing references) //IL_0be7: Unknown result type (might be due to invalid IL or missing references) //IL_0c14: Unknown result type (might be due to invalid IL or missing references) //IL_0c19: Unknown result type (might be due to invalid IL or missing references) //IL_0c24: Unknown result type (might be due to invalid IL or missing references) //IL_0c2e: Unknown result type (might be due to invalid IL or missing references) //IL_0c39: Unknown result type (might be due to invalid IL or missing references) //IL_0c43: Unknown result type (might be due to invalid IL or missing references) //IL_0c44: Unknown result type (might be due to invalid IL or missing references) //IL_0c58: Unknown result type (might be due to invalid IL or missing references) //IL_0c85: Unknown result type (might be due to invalid IL or missing references) //IL_0c8a: Unknown result type (might be due to invalid IL or missing references) //IL_0c95: Unknown result type (might be due to invalid IL or missing references) //IL_0c9f: Unknown result type (might be due to invalid IL or missing references) //IL_0caa: Unknown result type (might be due to invalid IL or missing references) //IL_0cb4: Unknown result type (might be due to invalid IL or missing references) //IL_0cbf: Unknown result type (might be due to invalid IL or missing references) //IL_0cc9: Unknown result type (might be due to invalid IL or missing references) //IL_0cd4: Unknown result type (might be due to invalid IL or missing references) //IL_0ce8: Unknown result type (might be due to invalid IL or missing references) //IL_0d0c: Unknown result type (might be due to invalid IL or missing references) //IL_0d22: Unknown result type (might be due to invalid IL or missing references) //IL_0d38: Unknown result type (might be due to invalid IL or missing references) //IL_0d4e: Unknown result type (might be due to invalid IL or missing references) //IL_0d64: Unknown result type (might be due to invalid IL or missing references) //IL_0dab: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (RectTransform)(Object.op_Implicit((Object)(object)hud.healthBar) ? /*isinst with value type is only supported in some contexts*/: null); root = new GameObject("SurvivorFrameworkResourceHud", new Type[1] { typeof(RectTransform) }); RectTransform val2 = (RectTransform)root.transform; Vector2 val3 = default(Vector2); if (Object.op_Implicit((Object)(object)val)) { ((Transform)val2).SetParent((Transform)(object)val, false); root.AddComponent<LayoutElement>().ignoreLayout = true; val2.anchorMin = new Vector2(0f, 0f); val2.anchorMax = new Vector2(1f, 0f); val2.pivot = new Vector2(0.5f, 1f); val2.sizeDelta = new Vector2(0f, 22f); val2.anchoredPosition = new Vector2(0f, -4f); } else { ((Transform)val2).SetParent(Object.op_Implicit((Object)(object)hud.mainContainer) ? hud.mainContainer.transform : ((Component)hud).transform, false); ((Vector2)(ref val3))..ctor(0f, 0f); val2.anchorMax = val3; val2.anchorMin = val3; val2.pivot = new Vector2(0f, 0f); val2.sizeDelta = new Vector2(360f, 22f); val2.anchoredPosition = new Vector2(40f, 40f); } Font font = GetFont(); EnsureSprites(); RectTransform val4 = Rect("Glow", (Transform)(object)val2); val4.anchorMin = new Vector2(0f, 1f); val4.anchorMax = new Vector2(1f, 1f); val4.pivot = new Vector2(0.5f, 0.5f); val4.sizeDelta = new Vector2(18f, 40f); val4.anchoredPosition = new Vector2(0f, -11f); glowImage = ((Component)val4).gameObject.AddComponent<Image>(); glowImage.sprite = softRect; glowImage.type = (Type)1; glowImage.pixelsPerUnitMultiplier = 2f; ((Graphic)glowImage).color = new Color(0f, 0f, 0f, 0f); ((Graphic)glowImage).raycastTarget = false; RectTransform val5 = Rect("Bar", (Transform)(object)val2); val5.anchorMin = new Vector2(0f, 1f); val5.anchorMax = new Vector2(1f, 1f); val5.pivot = new Vector2(0.5f, 1f); val5.sizeDelta = new Vector2(0f, 22f); val5.anchoredPosition = Vector2.zero; ((Graphic)((Component)val5).gameObject.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.55f); RectTransform val6 = Stretch(Rect("Inset", (Transform)(object)val5), 1.5f, 1.5f, 1.5f, 1.5f); ((Graphic)((Component)val6).gameObject.AddComponent<Image>()).color = new Color(0.05f, 0.06f, 0.1f, 0.9f); reservedFill = Stretch(Rect("Reserved", (Transform)(object)val6), 0f, 0f, 0f, 0f); ((Graphic)((Component)reservedFill).gameObject.AddComponent<Image>()).color = new Color(0.32f, 0.32f, 0.38f, 0.95f); fill = Stretch(Rect("Fill", (Transform)(object)val6), 0f, 0f, 0f, 0f); fillImage = ((Component)fill).gameObject.AddComponent<Image>(); RectTransform obj = Rect("Gloss", (Transform)(object)fill); obj.anchorMin = new Vector2(0f, 0.55f); obj.anchorMax = Vector2.one; val3 = (obj.offsetMin = (obj.offsetMax = Vector2.zero)); ((Graphic)((Component)obj).gameObject.AddComponent<Image>()).color = new Color(1f, 1f, 1f, 0.2f); ((Component)fill).gameObject.AddComponent<RectMask2D>(); RectTransform val8 = Stretch(Rect("Flow", (Transform)(object)fill), 0f, 0f, 0f, 0f); flowImage = ((Component)val8).gameObject.AddComponent<RawImage>(); flowImage.texture = (Texture)(object)FlowTexture(); ((Graphic)flowImage).raycastTarget = false; ((Graphic)flowImage).color = new Color(1f, 1f, 1f, 0f); shimmer = Rect("Shimmer", (Transform)(object)fill); shimmer.anchorMin = new Vector2(0f, 0f); shimmer.anchorMax = new Vector2(0f, 1f); shimmer.sizeDelta = new Vector2(46f, 0f); shimmerImage = ((Component)shimmer).gameObject.AddComponent<Image>(); shimmerImage.sprite = softBand; ((Graphic)shimmerImage).color = new Color(1f, 1f, 1f, 0f); ((Graphic)shimmerImage).raycastTarget = false; ticks = Stretch(Rect("Ticks", (Transform)(object)val6), 0f, 0f, 0f, 0f); RectTransform val9 = Stretch(Rect("Rim", (Transform)(object)val5), -1.5f, -1.5f, -1.5f, -1.5f); rimImage = ((Component)val9).gameObject.AddComponent<Image>(); EnsurePanelSprites(); rimImage.sprite = roundRect; rimImage.type = (Type)1; rimImage.pixelsPerUnitMultiplier = 4f; ((Graphic)rimImage).raycastTarget = false; ((Graphic)rimImage).color = new Color(1f, 1f, 1f, 0f); tip = Rect("Tip", (Transform)(object)val5); RectTransform obj2 = tip; RectTransform obj3 = tip; ((Vector2)(ref val3))..ctor(0f, 0.5f); obj3.anchorMax = val3; obj2.anchorMin = val3; tip.pivot = new Vector2(0.5f, 0.5f); tip.sizeDelta = new Vector2(26f, 34f); tipImage = ((Component)tip).gameObject.AddComponent<Image>(); tipImage.sprite = softRect; tipImage.type = (Type)1; tipImage.pixelsPerUnitMultiplier = 1.6f; ((Graphic)tipImage).raycastTarget = false; ((Graphic)tipImage).color = new Color(1f, 1f, 1f, 0f); motesRoot = Rect("Motes", (Transform)(object)val5); motesRoot.anchorMin = new Vector2(0f, 1f); motesRoot.anchorMax = new Vector2(1f, 1f); motesRoot.pivot = new Vector2(0.5f, 0f); motesRoot.sizeDelta = Vector2.zero; label = MakeText("Label", (Transform)(object)val5, font, 14, (TextAnchor)4, (FontStyle)1); Stretch((RectTransform)((Component)label).transform, 0f, 0f, 0f, 0f); EnsurePanelSprites(); RectTransform obj4; if (Object.op_Implicit((Object)(object)val)) { Transform parent = ((Transform)val).parent; RectTransform val10 = (RectTransform)(object)((parent is RectTransform) ? parent : null); if (val10 != null) { obj4 = val10; goto IL_082d; } } obj4 = val2; goto IL_082d; IL_082d: RectTransform parent2 = obj4; RectTransform val11 = Rect("SurvivorFrameworkFormPanel", (Transform)(object)parent2); formPanel = ((Component)val11).gameObject; ((Component)val11).gameObject.AddComponent<LayoutElement>().ignoreLayout = true; val11.anchorMin = new Vector2(0f, 1f); val11.anchorMax = new Vector2(1f, 1f); val11.pivot = new Vector2(0.5f, 0f); val11.sizeDelta = new Vector2(0f, 30f); val11.anchoredPosition = new Vector2(0f, 4f); RectTransform val12 = Stretch(Rect("Glow", (Transform)(object)val11), -6f, -6f, -6f, -6f); formGlow = ((Component)val12).gameObject.AddComponent<Image>(); formGlow.sprite = softRect; formGlow.type = (Type)1; formGlow.pixelsPerUnitMultiplier = 3f; ((Graphic)formGlow).raycastTarget = false; Image obj5 = ((Component)Stretch(Rect("Back", (Transform)(object)val11), 0f, 0f, 0f, 0f)).gameObject.AddComponent<Image>(); obj5.sprite = roundFill; obj5.type = (Type)1; obj5.pixelsPerUnitMultiplier = 2.5f; ((Graphic)obj5).color = new Color(0.06f, 0.07f, 0.11f, 0.8f); ((Graphic)obj5).raycastTarget = false; RectTransform val13 = Stretch(Rect("Rim", (Transform)(object)val11), 0f, 0f, 0f, 0f); formRim = ((Component)val13).gameObject.AddComponent<Image>(); formRim.sprite = roundRect; formRim.type = (Type)1; formRim.pixelsPerUnitMultiplier = 2.5f; ((Graphic)formRim).raycastTarget = false; RectTransform val14 = Rect("Accent", (Transform)(object)val11); val14.anchorMin = new Vector2(0.03f, 1f); val14.anchorMax = new Vector2(0.97f, 1f); val14.pivot = new Vector2(0.5f, 0.5f); val14.sizeDelta = new Vector2(0f, 2f); val14.anchoredPosition = new Vector2(0f, -1f); formAccent = ((Component)val14).gameObject.AddComponent<Image>(); formAccent.sprite = softBand; ((Graphic)formAccent).raycastTarget = false; RectTransform val15 = Rect("Emblem", (Transform)(object)val11); ((Vector2)(ref val3))..ctor(0f, 0.55f); val15.anchorMax = val3; val15.anchorMin = val3; val15.pivot = new Vector2(0.5f, 0.5f); val15.sizeDelta = new Vector2(18.6f, 18.6f); val15.anchoredPosition = new Vector2(15f, 0f); formEmblem = ((Component)val15).gameObject.AddComponent<Image>(); formEmblem.sprite = diamond; ((Graphic)formEmblem).raycastTarget = false; formEmblem.preserveAspect = true; formStripe = formEmblem; formName = MakeText("Name", (Transform)(object)val11, font, 16, (TextAnchor)3, (FontStyle)1); RectTransform val16 = (RectTransform)((Component)formName).transform; val16.anchorMin = new Vector2(0f, 0.25f); val16.anchorMax = new Vector2(0.62f, 1f); val16.offsetMin = new Vector2(28.5f, 0f); val16.offsetMax = Vector2.zero; formInfo = MakeText("Info", (Transform)(object)val11, font, 13, (TextAnchor)5, (FontStyle)0); RectTransform val17 = (RectTransform)((Component)formInfo).transform; val17.anchorMin = new Vector2(0.45f, 0.25f); val17.anchorMax = new Vector2(1f, 1f); val17.offsetMin = Vector2.zero; val17.offsetMax = new Vector2(-8f, 0f); abilityText = MakeText("Ability", (Transform)(object)val11, font, 12, (TextAnchor)6, (FontStyle)1); RectTransform val18 = (RectTransform)((Component)abilityText).transform; val18.anchorMin = new Vector2(0f, 1f); val18.anchorMax = new Vector2(1f, 1f); val18.pivot = new Vector2(0f, 0f); val18.sizeDelta = new Vector2(-10f, 18f); val18.anchoredPosition = new Vector2(8f, 2f); RectTransform val19 = Rect("XpBack", (Transform)(object)val11); val19.anchorMin = new Vector2(0f, 0f); val19.anchorMax = new Vector2(1f, 0f); val19.pivot = new Vector2(0.5f, 0f); val19.offsetMin = new Vector2(28.5f, 4.7999997f); val19.offsetMax = new Vector2(-8f, 8.799999f); Image obj6 = ((Component)val19).gameObject.AddComponent<Image>(); obj6.sprite = roundFill; obj6.type = (Type)1; obj6.pixelsPerUnitMultiplier = 8f; ((Graphic)obj6).color = new Color(1f, 1f, 1f, 0.13f); xpFill = Stretch(Rect("XpFill", (Transform)(object)val19), 0f, 0f, 0f, 0f); xpImage = ((Component)xpFill).gameObject.AddComponent<Image>(); xpImage.sprite = roundFill; xpImage.type = (Type)1; xpImage.pixelsPerUnitMultiplier = 8f; } private void PlaceFormPanel() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) SkillIcon[] skillIcons = hud.skillIcons; if (skillIcons == null || skillIcons.Length < 4 || !Object.op_Implicit((Object)(object)skillIcons[0]) || !Object.op_Implicit((Object)(object)skillIcons[3])) { return; } RectTransform val = (RectTransform)formPanel.transform; Transform parent = ((Component)skillIcons[0]).transform.parent; RectTransform row = (RectTransform)(object)((parent is RectTransform) ? parent : null); if (!Object.op_Implicit((Object)(object)row)) { return; } if ((Object)(object)((Transform)val).parent != (Object)(object)row) { ((Transform)val).SetParent((Transform)(object)row, false); ((Transform)val).SetAsLastSibling(); formRow = row; } float left = float.MaxValue; float right = float.MinValue; float top = float.MinValue; float iconH = 0f; SkillIcon[] array = skillIcons; foreach (SkillIcon val2 in array) { if (Object.op_Implicit((Object)(object)val2)) { Take((RectTransform)((Component)val2).transform); } } Take(extraSkillIcon?.Invoke()); if (!(left > right) && !(iconH <= 0f)) { float num = iconH * 0.6f; float num2 = iconH * 0.14f; float num3 = num / 30f; Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(0.5f, 0.5f); val.anchorMax = val3; val.anchorMin = val3; val.pivot = new Vector2(0.5f, 0f); ((Transform)val).localScale = new Vector3(num3, num3, 1f); ((Transform)val).localRotation = Quaternion.identity; val.sizeDelta = new Vector2((right - left) / num3, 30f); ((Transform)val).localPosition = new Vector3((left + right) * 0.5f, top + num2, 0f); } void Take(RectTransform r) { //IL_003a: 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_0044: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)r) && ((Component)r).gameObject.activeInHierarchy) { r.GetWorldCorners(corners); for (int j = 0; j < 4; j++) { corners[j] = ((Transform)row).InverseTransformPoint(corners[j]); } left = Mathf.Min(left, corners[0].x); right = Mathf.Max(right, corners[2].x); top = Mathf.Max(top, corners[1].y); iconH = Mathf.Max(iconH, corners[1].y - corners[0].y); } } } private Text MakeText(string name, Transform parent, Font font, int size, TextAnchor anchor, FontStyle style) { //IL_0023: 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_0036: 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_0086: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Rect(name, parent); Text obj = ((Component)val).gameObject.AddComponent<Text>(); obj.font = font; obj.fontSize = size; obj.alignment = anchor; ((Graphic)obj).color = Color.white; obj.fontStyle = style; obj.supportRichText = true; obj.horizontalOverflow = (HorizontalWrapMode)1; obj.verticalOverflow = (VerticalWrapMode)1; Outline obj2 = ((Component)val).gameObject.AddComponent<Outline>(); ((Shadow)obj2).effectColor = new Color(0f, 0f, 0f, 0.85f); ((Shadow)obj2).effectDistance = new Vector2(1f, -1f); return obj; } private void UpdateTicks(float max) { //IL_0080: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) int num = Mathf.Clamp(Mathf.FloorToInt((max - 0.01f) / 50f), 0, 40); if (num != tickCount) { tickCount = num; for (int num2 = ((Transform)ticks).childCount - 1; num2 >= 0; num2--) { Object.Destroy((Object)(object)((Component)((Transform)ticks).GetChild(num2)).gameObject); } for (int i = 1; i <= num; i++) { RectTransform obj = Rect("Tick", (Transform)(object)ticks); float num3 = (float)i * 50f / max; obj.anchorMin = new Vector2(num3, 0.2f); obj.anchorMax = new Vector2(num3, 0.8f); obj.sizeDelta = new Vector2(1.5f, 0f); ((Graphic)((Component)obj).gameObject.AddComponent<Image>()).color = new Color(0f, 0f, 0f, 0.45f); } } } private void Update() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_057b: Unknown result type (might be due to invalid IL or missing references) //IL_0589: Unknown result type (might be due to invalid IL or missing references) //IL_05aa: Unknown result type (might be due to invalid IL or missing references) //IL_0641: Unknown result type (might be due to invalid IL or missing references) //IL_064e: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Unknown result type (might be due to invalid IL or missing references) //IL_065c: Unknown result type (might be due to invalid IL or missing references) //IL_0668: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Unknown result type (might be due to invalid IL or missing references) //IL_0693: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06d6: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Unknown result type (might be due to invalid IL or missing references) //IL_06fa: Unknown result type (might be due to invalid IL or missing references) //IL_078f: Unknown result type (might be due to invalid IL or missing references) //IL_079f: Unknown result type (might be due to invalid IL or missing references) GameObject val = (Object.op_Implicit((Object)(object)hud) ? hud.targetBodyObject : null); ResourcePool resourcePool = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<ResourcePool>() : null); if (!Object.op_Implicit((Object)(object)resourcePool)) { if (Object.op_Implicit((Object)(object)root)) { root.SetActive(false); } if (Object.op_Implicit((Object)(object)formPanel)) { formPanel.SetActive(false); } return; } if (!Object.op_Implicit((Object)(object)root)) { Build(); } root.SetActive(true); float num = 1f - Mathf.Exp(-14f * Time.unscaledDeltaTime); float num2 = Mathf.Max(resourcePool.max, 0.0001f); shownFraction = Mathf.Lerp(shownFraction, Mathf.Clamp01(resourcePool.current / num2), num); fill.anchorMax = new Vector2(shownFraction, 1f); UpdateTicks(num2); reservedFill.anchorMin = new Vector2(Mathf.Clamp01(resourcePool.usableMax / num2), 0f); reservedFill.anchorMax = Vector2.one; bool flag = resourcePool.glowProvider != null && resourcePool.glowProvider(); glowLevel = Mathf.MoveTowards(glowLevel, flag ? 1f : 0f, Time.unscaledDeltaTime * (flag ? 4f : 2.5f)); float unscaledTime = Time.unscaledTime; float num3 = 0.5f + 0.5f * Mathf.Sin(unscaledTime * 5.5f); Color barColor = resourcePool.barColor; ((Graphic)fillImage).color = Color.Lerp(barColor, Color.white, glowLevel * (0.06f + 0.12f * num3)); ((Graphic)glowImage).color = new Color(Mathf.Lerp(barColor.r, 1f, 0.25f), Mathf.Lerp(barColor.g, 1f, 0.25f), Mathf.Lerp(barColor.b, 1f, 0.25f), glowLevel * (0.22f + 0.28f * num3)); float num4 = Mathf.Repeat(unscaledTime * 0.9f, 1.4f) - 0.2f; shimmer.anchorMin = new Vector2(num4, 0f); shimmer.anchorMax = new Vector2(num4, 1f); ((Graphic)shimmerImage).color = new Color(1f, 1f, 1f, glowLevel * 0.35f); Rect rect = ((RectTransform)((Transform)fill).parent).rect; float width = ((Rect)(ref rect)).width; float num5 = Mathf.Max(1f, width * shownFraction); flowImage.uvRect = new Rect((0f - unscaledTime) * 0.9f, 0f, num5 / 70f, 1f); ((Graphic)flowImage).color = new Color(Mathf.Lerp(barColor.r, 1f, 0.55f), Mathf.Lerp(barColor.g, 1f, 0.55f), Mathf.Lerp(barColor.b, 1f, 0.55f), glowLevel * (0.45f + 0.2f * num3)); ((Graphic)rimImage).color = new Color(Mathf.Lerp(barColor.r, 1f, 0.4f), Mathf.Lerp(barColor.g, 1f, 0.4f), Mathf.Lerp(barColor.b, 1f, 0.4f), glowLevel * (0.45f + 0.35f * num3)); tip.anchoredPosition = new Vector2(1.5f + num5, 0f); ((Graphic)tipImage).color = new Color(Mathf.Lerp(barColor.r, 1f, 0.6f), Mathf.Lerp(barColor.g, 1f, 0.6f), Mathf.Lerp(barColor.b, 1f, 0.6f), glowLevel * (0.55f + 0.35f * Mathf.Sin(unscaledTime * 13f) * 0.5f + 0.2f)); UpdateMotes(glowLevel, shownFraction, width, barColor, Time.unscaledDeltaTime); label.text = $"{resourcePool.displayName.ToUpperInvariant()} {resourcePool.current:0} / {resourcePool.max:0}" + ((resourcePool.reserved > 0f) ? $" ({resourcePool.reserved:0} reserved)" : ""); MasteryTracker component = val.GetComponent<MasteryTracker>(); FormController component2 = val.GetComponent<FormController>(); if (!Object.op_Implicit((Object)(object)component)) { formPanel.SetActive(false); return; } formPanel.SetActive(true); int num6 = (Object.op_Implicit((Object)(object)component2) ? component2.ActiveForm : component.activeForm); FormDef formDef = ((Object.op_Implicit((Object)(object)component2) && num6 > 0 && num6 < component2.forms.Count) ? component2.forms[num6] : null); Color val2 = (Color)(((??)formDef?.color) ?? new Color(0.75f, 0.85f, 1f)); string text = ((formDef != null) ? formDef.displayName : "Base"); formName.text = $"<color=#{ColorUtility.ToHtmlStringRGB(val2)}>{text.ToUpperInvariant()}</color> <color=#d8d8d8><size=12>LV</size> {component.GetLevel(num6)}</color>"; float num7 = formDef?.drainPerSecond() ?? 0f; formInfo.text = ((formDef == null) ? "" : ((num7 > 0.01f) ? $"<color=#ff9a7a>-{num7:0.0}/s</color> " : "")) + $"<color=#9aa3b5><size=11>MASTERY</size></color> <color=#e6e6e6>{component.totalMastery}</color>"; ((Graphic)formStripe).color = val2; ((Graphic)formAccent).color = new Color(val2.r, val2.g, val2.b, 0.9f); ((Graphic)formRim).color = new Color(Mathf.Lerp(1f, val2.r, 0.45f), Mathf.Lerp(1f, val2.g, 0.45f), Mathf.Lerp(1f, val2.b, 0.45f), 0.28f); ((Graphic)formGlow).color = new Color(val2.r, val2.g, val2.b, 0.1f + ((formDef != null) ? 0.08f : 0f)); PlaceFormPanel(); string text2 = (((Object)(object)component2 != (Object)null && component2.abilityStatus != null) ? component2.abilityStatus() : null); ((Component)abilityText).gameObject.SetActive(!string.IsNullOrEmpty(text2)); if (!string.IsNullOrEmpty(text2)) { abilityText.text = text2; } shownXp = Mathf.Lerp(shownXp, Mathf.Clamp01(component.GetXpFraction(num6)), num); xpFill.anchorMax = new Vector2(shownXp, 1f); ((Graphic)xpImage).color = val2; } } } namespace SurvivorFramework.Skills { public class ResourceSkillDef : SkillDef { protected class InstanceData : BaseSkillInstanceData { public ResourcePool pool; } public float resourceCost; public static Func<GenericSkill, float> costMultiplier; public override BaseSkillInstanceData OnAssigned([NotNull] GenericSkill skillSlot) { return (BaseSkillInstanceData)(object)new InstanceData { pool = ((Component)skillSlot).GetComponent<ResourcePool>() }; } private static ResourcePool GetPool(GenericSkill slot) { return (slot.skillInstanceData as InstanceData)?.pool; } public override bool IsReady([NotNull] GenericSkill skillSlot) { ResourcePool pool = GetPool(skillSlot); if (((SkillDef)this).IsReady(skillSlot)) { if (Object.op_Implicit((Object)(object)pool)) { return pool.CanAfford(resourceCost); } return true; } return false; } public override void OnExecute([NotNull] GenericSkill skillSlot) { ResourcePool pool = GetPool(skillSlot); if (Object.op_Implicit((Object)(object)pool)) { float num = resourceCost * ((costMultiplier != null) ? Mathf.Max(1f, costMultiplier(skillSlot)) : 1f); if (!pool.TrySpend(num)) { pool.TrySpend(Mathf.Min(num, pool.current)); } } ((SkillDef)this).OnExecute(skillSlot); } } } namespace SurvivorFramework.Resources { [DisallowMultipleComponent] public class ResourcePool : MonoBehaviour { public string displayName = "Resource"; public Color barColor = new Color(0.25f, 0.55f, 1f); public Func<bool> glowProvider; public Func<float> maxProvider = () => 100f; public Func<float> regenProvider = () => 1f; public Func<float> reserveProvider; [NonSerialized] public float pendingRateThisTick; [NonSerialized] public bool regenPaused; private CharacterBody body; private bool initialized; public float current { get; private set; } public float reserved { get; private set; } public float max => Mathf.Max(0f, maxProvider()); public float usableMax => Mathf.Max(0f, max - reserved); public float fraction { get { if (!(max > 0f)) { return 0f; } return current / max; } } private bool HasAuthority { get { if (Object.op_Implicit((Object)(object)body)) { return body.hasEffectiveAuthority; } return false; } } public event Action onEmpty; private void Awake() { body = ((Component)this).GetComponent<CharacterBody>(); } private void FixedUpdate() { if (HasAuthority) { if (reserveProvider != null) { reserved = Mathf.Clamp(reserveProvider(), 0f, max); } if (!initialized) { current = usableMax; initialized = true; } float num = (regenPaused ? 0f : regenProvider()) + pendingRateThisTick; pendingRateThisTick = 0f; float num2 = current; current = Mathf.Clamp(current + num * Time.fixedDeltaTime, 0f, usableMax); if (num2 > 0f && current <= 0f) { this.onEmpty?.Invoke(); } } } public bool CanAfford(float amount) { return current >= amount; } public bool TrySpend(float amount) { if (!HasAuthority || amount < 0f || current < amount) { return false; } current -= amount; if (current <= 0f) { this.onEmpty?.Invoke(); } return true; } public void Add(float amount) { if (HasAuthority) { current = Mathf.Clamp(current + amount, 0f, usableMax); } } public bool TryReserve(float amount) { if (amount < 0f || reserved + amount > max) { return false; } reserved += amount; current = Mathf.Min(current, usableMax); return true; } public void Release(float amount) { reserved = Mathf.Max(0f, reserved - amount); } } } namespace SurvivorFramework.Net { public class AnimSyncMessage : INetMessage, ISerializableObject { private NetworkInstanceId bodyId; private string layer; private string state; private float fade; public AnimSyncMessage() { } public AnimSyncMessage(NetworkInstanceId bodyId, string layer, string state, float fade) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) this.bodyId = bodyId; this.layer = layer; this.state = state; this.fade = fade; } public void Serialize(NetworkWriter w) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) w.Write(bodyId); w.Write(layer); w.Write(state); w.Write(fade); } public void Deserialize(NetworkReader r) { //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) bodyId = r.ReadNetworkId(); layer = r.ReadString(); state = r.ReadString(); fade = r.ReadSingle(); } public void OnReceived() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) GameObject val = Util.FindNetworkObject(bodyId); if (Object.op_Implicit((Object)(object)val)) { CharacterBody component = val.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && !component.hasEffectiveAuthority) { AnimSync.PlayLocal(component, layer, state, fade); } } } } public static class AnimSync { public static void Play(CharacterBody body, string layer, string state, float fade) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body)) { PlayLocal(body, layer, state, fade); if (NetworkServer.active || NetworkClient.active) { NetMessageExtensions.Send((INetMessage)(object)new AnimSyncMessage(((NetworkBehaviour)body).netId, layer, state, fade), (NetworkDestination)1); } } } public static void PlayLocal(CharacterBody body, string layer, string state, float fade) { Animator val = ((Object.op_Implicit((Object)(object)body.modelLocator) && Object.op_Implicit((Object)(object)body.modelLocator.modelTransform)) ? ((Component)body.modelLocator.modelTransform).GetComponent<Animator>() : null); if (Object.op_Implicit((Object)(object)val)) { int layerIndex = val.GetLayerIndex(layer); if (layerIndex >= 0) { val.CrossFadeInFixedTime(state, fade, layerIndex); } } } } public class KillCreditMessage : INetMessage, ISerializableObject { private NetworkInstanceId bodyId; private bool elite; private bool boss; public KillCreditMessage() { } public KillCreditMessage(NetworkInstanceId bodyId, bool elite, bool boss) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) this.bodyId = bodyId; this.elite = elite; this.boss = boss; } public void Serialize(NetworkWriter w) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) w.Write(bodyId); w.Write(elite); w.Write(boss); } public void Deserialize(NetworkReader r) { //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) bodyId = r.ReadNetworkId(); elite = r.ReadBoolean(); boss = r.ReadBoolean(); } public void OnReceived() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) GameObject val = Util.FindNetworkObject(bodyId); if (Object.op_Implicit((Object)(object)val)) { CharacterBody component = val.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && component.hasEffectiveAuthority) { val.GetComponent<MasteryTracker>()?.ReceiveKillCredit(elite, boss); } } } } public class SurfaceStateMessage : INetMessage, ISerializableObject { private NetworkInstanceId bodyId; private byte mode; private Vector3 normal; public SurfaceStateMessage() { } public SurfaceStateMessage(NetworkInstanceId bodyId, SurfaceWalker.Mode mode, Vector3 normal) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) this.bodyId = bodyId; this.mode = (byte)mode; this.normal = normal; } public void Serialize(NetworkWriter writer) { //IL_0002: 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) writer.Write(bodyId); writer.Write(mode); writer.Write(normal); } public void Deserialize(NetworkReader reader) { //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) bodyId = reader.ReadNetworkId(); mode = reader.ReadByte(); normal = reader.ReadVector3(); } public void OnReceived() { //IL_0001: 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) GameObject val = Util.FindNetworkObject(bodyId); if (Object.op_Implicit((Object)(object)val)) { SurfaceWalker component = val.GetComponent<SurfaceWalker>(); if (Object.op_Implicit((Object)(object)component)) { component.ApplyRemoteState((SurfaceWalker.Mode)mode, normal); } } } } internal static class Util { public static GameObject FindNetworkObject(NetworkInstanceId id) { //IL_000e: 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) if (!NetworkServer.active) { return ClientScene.FindLocalObject(id); } return NetworkServer.FindLocalObject(id); } } } namespace SurvivorFramework.Movement { [DisallowMultipleComponent] public class SurfaceWalker : MonoBehaviour { public enum Mode : byte { None, Wall, Water } public bool wallEnabled = true; public float runSpeedMult = 1f; public float climbBoostMult = 1.5f; public float maxSlideSeconds = 0.4f; public float attachProbeExtra = 0.6f; public float maxWallNormalY = 0.35f; public float stickSpeed = 2f; public float reattachCooldown = 0.25f; public float modelTiltSpeed = 18f; public float lostWallGrace = 0.2f; private CharacterBody body; private CharacterMotor motor; private InputBankTest inputBank; private ModelLocator modelLocator; private Vector3 wallVelocity; private float slideTimer; private float cooldownTimer; private float verticalBoost; private float lostWallTimer; private Quaternion visualRotation = Quaternion.identity; private bool visualInitialized; private Vector3 lastWallFeet; private float visualBlend; private Vector3 lastWallForward; private static int worldMask; public bool hold; private const float FloorNormalY = 0.7f; private Quaternion surfaceRot = Quaternion.identity; private Vector3 latchDir; private Vector3 latchInput; private float latchUntil; private float runOnGrace; private static readonly float[] probeOffsets = new float[3] { 0f, 0.6f, -0.6f }; private bool worldInput; private Vector3 slideFacing; private Vector3 dashVelocity; private float dashUntil = -1f; public Mode mode { get; private set; } public Vector3 surfaceNormal { get; private set; } = Vector3.up; public bool onWall => mode == Mode.Wall; private bool HasAuthority { get { if (Object.op_Implicit((Object)(object)body)) { return body.hasEffectiveAuthority; } return false; } } private float CapsuleRadius { get { if (!Object.op_Implicit((Object)(object)motor)) { return 0.5f; } return motor.capsuleRadius; } } private Vector3 Center { get { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)motor)) { return ((Component)this).transform.position; } return ((BaseCharacterController)motor).Motor.TransientPosition + ((BaseCharacterController)motor).Motor.CharacterTransformToCapsuleCenter; } } public bool Dashing => Time.fixedTime < dashUntil; internal static void InstallHooks() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown CharacterMotor.UpdateVelocity += new hook_UpdateVelocity(CharacterMotor_UpdateVelocity); ModelLocator.UpdateModelTransform += new hook_UpdateModelTransform(ModelLocator_UpdateModelTransform); } private static void ModelLocator_UpdateModelTransform(orig_UpdateModelTransform orig, ModelLocator self, float deltaTime) { orig.Invoke(self, deltaTime); SurfaceWalker component = ((Component)self).GetComponent<SurfaceWalker>(); if (Object.op_Implicit((Object)(object)component)) { component.ApplyVisualTilt(self.modelTransform, deltaTime); } } private static void CharacterMotor_UpdateVelocity(orig_UpdateVelocity orig, CharacterMotor self, ref Vector3 currentVelocity, float deltaTime) { //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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, ref currentVelocity, deltaTime); SurfaceWalker component = ((Component)self).GetComponent<SurfaceWalker>(); if (Object.op_Implicit((Object)(object)component) && component.mode == Mode.Wall && self.hasEffectiveAuthority) { currentVelocity = component.wallVelocity; self.velocity = component.wallVelocity; } } private void Awake() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) body = ((Component)this).GetComponent<CharacterBody>(); motor = ((Component)this).GetComponent<CharacterMotor>(); inputBank = ((Component)this).GetComponent<InputBankTest>(); modelLocator = ((Component)this).GetComponent<ModelLocator>(); if (worldMask == 0) { worldMask = LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask); } } public void Tick(float dt) { //IL_008e: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00be: 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_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //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_0107: Unknown result type (might be due to invalid IL or missing references) if (!HasAuthority || !Object.op_Implicit((Object)(object)motor)) { return; } if (cooldownTimer > 0f) { cooldownTimer -= dt; } Vector3 normal3; Vector3 normal4; if (mode == Mode.Wall) { if (runOnGrace > 0f) { runOnGrace -= dt; } if (!wallEnabled || (motor.isGrounded && surfaceNormal.y > -0.2f && runOnGrace <= 0f)) { Detach(wallVelocity); return; } if (SurfaceAhead(out var normal)) { if (normal.y >= 0.7f) { Detach(wallVelocity); return; } SetSurface(normal); StartLatch(); } if (!WallStillThere(out var normal2)) { bool flag = Vector3.Dot(wallVelocity, SurfaceUp()) > 0.5f && surfaceNormal.y > -0.3f; Detach(flag ? (Vector3.up * body.jumpPower * 0.6f - surfaceNormal * 3f) : wallVelocity); } else { SetSurface(normal2); ComputeWallVelocity(dt); } } else if (wallEnabled && !motor.isGrounded && cooldownTimer <= 0f && FindWall(out normal3)) { Attach(normal3, normal3.y < -0.7f); } else if (wallEnabled && motor.isGrounded && cooldownTimer <= 0f && RunOnto(out normal4)) { Attach(normal4); slideTimer = 0f; runOnGrace = 0.35f; ((BaseCharacterController)motor).Motor.ForceUnground(0.1f); wallVelocity = Vector3.up * Mathf.Max(2f, body.moveSpeed * runSpeedMult * 0.6f) - normal4 * stickSpeed; } } public bool JumpOff() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_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) if (!HasAuthority || mode != Mode.Wall) { return false; } Vector3 val = surfaceNormal; Detach(val * body.jumpPower * 0.9f + Vector3.up * body.jumpPower * ((val.y < -0.5f) ? 0f : 0.7f)); return true; } public Vector3 InputFor(Vector3 worldDir) { //IL_0017: 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_0023: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0083: 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) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_009a: Unknown result type (might be due to invalid IL or missing references) if (mode != Mode.Wall) { worldDir.y = 0f; return worldDir; } Vector3 val = Vector3.ProjectOnPlane(worldDir, surfaceNormal); if (((Vector3)(ref val)).sqrMagnitude < 1E-06f) { return Vector3.zero; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.zero; float num = -2f; for (int i = 0; i < 24; i++) { Vector3 val3 = Quaternion.Euler(0f, (float)i * 15f, 0f) * Vector3.forward; Vector3 val4 = MapInput(val3, surfaceNormal); float num2 = Vector3.Dot(((Vector3)(ref val4)).normalized, val); if (num2 > num) { num = num2; val2 = val3; } } return val2 * ((Vector3)(ref worldDir)).magnitude; } public void Release(Vector3 velocity) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (mode == Mode.Wall) { Detach(velocity); } } public bool TryHandleJump() { return JumpOff(); } private void SetSurface(Vector3 n) { //IL_0007: 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_001b: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_0048: 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 t