Decompiled source of Faceless Joe v0.2.0
plugins/JoeModForReal.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.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 AncientScepter; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.GolemMonster; using HG; using HG.BlendableTypes; using IL.EntityStates.GolemMonster; using JetBrains.Annotations; using JoeModForReal; using JoeModForReal.Components; using JoeModForReal.Content; using JoeModForReal.Content.Survivors; using KinematicCharacterController; using ModdedEntityStates; using ModdedEntityStates.BaseStates; using ModdedEntityStates.Genji; using ModdedEntityStates.Joe; using ModdedEntityStates.Koal; using Modules; using Modules.Characters; using Modules.Survivors; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using On.RoR2.UI; using R2API; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Achievements; using RoR2.Audio; using RoR2.ContentManagement; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.Rendering; using Zio.FileSystems; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("JoeModForReal")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+1bbf8a7cc5ab9a6b3cb21e28886374e70d34fb19")] [assembly: AssemblyProduct("JoeModForReal")] [assembly: AssemblyTitle("JoeModForReal")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] internal class TestValueManager : MonoBehaviour { private float _tim; private float _holdTime = 0.4f; public static float fireballDamage = 5.5f; public static float swingDamage = 1.8f; public static float tenticleArmor = 50f; public static float tenticleMove = 0.5f; public static float swrodBeam = 1.4f; public static float dashArmor = 150f; public static float beems = 10f; private bool _testingEnabled => Config.Debug; private void Update() { if (_testingEnabled && Input.GetKey((KeyCode)308)) { manageTestValue(ref fireballDamage, "1 fireball dam", (KeyCode)116, (KeyCode)103, 0.1f); manageTestValue(ref swingDamage, "2 primary dam", (KeyCode)121, (KeyCode)104, 0.1f); manageTestValue(ref tenticleArmor, "3 tenticle armor", (KeyCode)117, (KeyCode)106, 1f); manageTestValue(ref tenticleMove, "4 tenticle move", (KeyCode)105, (KeyCode)107, 0.1f); manageTestValue(ref swrodBeam, "5 swrodbeam", (KeyCode)111, (KeyCode)108, 0.1f); manageTestValue(ref dashArmor, "6 dash armor", (KeyCode)112, (KeyCode)59, 10f); manageTestValue(ref beems, "7 beems", (KeyCode)91, (KeyCode)93, 1f); } } private void manageTestValue(ref float value, string valueName, KeyCode upKey, KeyCode downKey, float incrementAmount) { //IL_0001: 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_0036: 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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown(upKey)) { value = setTestValue(value + incrementAmount, valueName); } if (Input.GetKeyDown(downKey)) { value = setTestValue(value - incrementAmount, valueName); } if (Input.GetKey(upKey) || Input.GetKey(downKey)) { float num = incrementAmount * (float)(Input.GetKey(upKey) ? 1 : (-1)); _tim += Time.deltaTime; if (_tim > _holdTime) { _tim = _holdTime - 0.02f; value = setTestValue(value + num, valueName); } } if (Input.GetKeyUp(upKey) || Input.GetKeyUp(downKey)) { _tim = 0f; } } private float setTestValue(float value, string print) { Helpers.LogWarning(print + ": " + value.ToString("0.000")); return value; } } internal static class Helpers { public const string agilePrefix = "<style=cIsUtility>Agile.</style>"; public static bool verbose; 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>"; } internal 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 T[] Append<T>(ref T[] array, List<T> list) { int num = array.Length; int count = list.Count; Array.Resize(ref array, num + count); list.CopyTo(array, num); return array; } public static Func<T[], T[]> AppendDel<T>(List<T> list) { return (T[] r) => Append(ref r, list); } public static void LogVerbose(object message, bool chat = false) { if (Config.Debug && verbose) { FacelessJoePlugin.Log.LogMessage(message); if (chat) { Chat.AddMessage(message.ToString()); } } } public static void LogWarning(object message, bool chat = false) { if (Config.Debug) { FacelessJoePlugin.Log.LogWarning(message); if (chat) { Chat.AddMessage(message.ToString()); } } } public static List<TeamComponent> GatherEnemies(TeamIndex allyIndex, params TeamIndex[] ignore) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 //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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) List<TeamComponent> list = new List<TeamComponent>(); bool flag = (int)FriendlyFireManager.friendlyFireMode > 0; IEnumerable<TeamIndex> enumerable = ((TeamIndex[])Enum.GetValues(typeof(TeamIndex))).Except(ignore); foreach (TeamIndex item in enumerable) { if (flag || allyIndex != item) { list.AddRange(TeamComponent.GetTeamMembers(item)); } } return list; } internal static string KeywordText(string v, object p) { throw new NotImplementedException(); } } public static class ArrayHelper { public static T[] Append<T>(ref T[] array, List<T> list) { int num = array.Length; int count = list.Count; Array.Resize(ref array, num + count); list.CopyTo(array, num); return array; } public static Func<T[], T[]> AppendDel<T>(List<T> list) { return (T[] r) => Append(ref r, list); } } internal class SkillDefInfo { public string skillName; public string skillNameToken; public string skillDescriptionToken; public string[] keywordTokens = new string[0]; public Sprite skillIcon; public SerializableEntityStateType activationState; public InterruptPriority interruptPriority; public string activationStateMachineName; public float baseRechargeInterval; public int baseMaxStock = 1; public int rechargeStock = 1; public int requiredStock = 1; public int stockToConsume = 1; public bool isCombatSkill = true; public bool canceledFromSprinting; public bool forceSprintDuringState; public bool cancelSprintingOnActivation = true; public bool beginSkillCooldownOnSkillEnd; public bool fullRestockOnAssign = true; public bool resetCooldownTimerOnUse; public bool mustKeyPress; public SkillDefInfo() { } public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName, InterruptPriority interruptPriority, bool isCombatSkill, float baseRechargeInterval) { //IL_0063: 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_0073: 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) this.skillName = skillName; this.skillNameToken = skillNameToken; this.skillDescriptionToken = skillDescriptionToken; this.skillIcon = skillIcon; this.activationState = activationState; this.activationStateMachineName = activationStateMachineName; this.interruptPriority = interruptPriority; this.isCombatSkill = isCombatSkill; this.baseRechargeInterval = baseRechargeInterval; } public SkillDefInfo(string skillName, string skillNameToken, string skillDescriptionToken, Sprite skillIcon, SerializableEntityStateType activationState, string activationStateMachineName = "Weapon", bool agile = false) { //IL_0063: 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_0074: 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; interruptPriority = (InterruptPriority)0; isCombatSkill = true; baseRechargeInterval = 0f; requiredStock = 0; stockToConsume = 0; cancelSprintingOnActivation = !agile; if (agile) { keywordTokens = new string[1] { "KEYWORD_AGILE" }; } } } namespace Modules { public abstract class BaseMasteryUnlockable : GenericModdedUnlockable { public abstract string RequiredCharacterBody { get; } public abstract float RequiredDifficultyCoefficient { get; } public override void OnBodyRequirementMet() { ((ModdedUnlockable)this).OnBodyRequirementMet(); Run.onClientGameOverGlobal += OnClientGameOverGlobal; } public override void OnBodyRequirementBroken() { Run.onClientGameOverGlobal -= OnClientGameOverGlobal; ((ModdedUnlockable)this).OnBodyRequirementBroken(); } private void OnClientGameOverGlobal(Run run, RunReport runReport) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Invalid comparison between Unknown and I4 //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 if (Object.op_Implicit((Object)(object)runReport.gameEnding) && runReport.gameEnding.isWin) { DifficultyIndex val = runReport.ruleBook.FindDifficulty(); DifficultyDef difficultyDef = DifficultyCatalog.GetDifficultyDef(runReport.ruleBook.FindDifficulty()); if ((difficultyDef.countsAsHardMode && difficultyDef.scalingValue >= RequiredDifficultyCoefficient) || ((int)val >= 3 && (int)val <= 10) || difficultyDef.nameToken == "INFERNO_NAME") { ((BaseAchievement)this).Grant(); } } } public override BodyIndex LookUpRequiredBodyIndex() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) return BodyCatalog.FindBodyIndex(RequiredCharacterBody); } } public abstract class GenericModdedUnlockable : ModdedUnlockable { public abstract string AchievementTokenPrefix { get; } public abstract string AchievementSpriteName { get; } public override string AchievementIdentifier => AchievementTokenPrefix + "UNLOCKABLE_ACHIEVEMENT_ID"; public override string UnlockableIdentifier => AchievementTokenPrefix + "UNLOCKABLE_REWARD_ID"; public override string AchievementNameToken => AchievementTokenPrefix + "UNLOCKABLE_ACHIEVEMENT_NAME"; public override string AchievementDescToken => AchievementTokenPrefix + "UNLOCKABLE_ACHIEVEMENT_DESC"; public override string UnlockableNameToken => AchievementTokenPrefix + "UNLOCKABLE_UNLOCKABLE_NAME"; public override Sprite Sprite => Asset.LoadAsset<Sprite>(AchievementSpriteName); public override Func<string> GetHowToUnlock => () => Language.GetStringFormatted("UNLOCK_VIA_ACHIEVEMENT_FORMAT", new object[2] { Language.GetString(((ModdedUnlockable)this).AchievementNameToken), Language.GetString(((ModdedUnlockable)this).AchievementDescToken) }); public override Func<string> GetUnlocked => () => Language.GetStringFormatted("UNLOCKED_FORMAT", new object[2] { Language.GetString(((ModdedUnlockable)this).AchievementNameToken), Language.GetString(((ModdedUnlockable)this).AchievementDescToken) }); } internal static class Asset { public static AssetBundle mainAssetBundle; public static Shader hotpoo = LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/HGStandard"); public static GameObject JoeImpactEffect; public static GameObject JoeJumpSwingEffect; public static GameObject TenticlesSpelledWrong; public static GameObject MercSwordSlash; public static GameObject MercImpactEffect; public static NetworkSoundEventDef FleshSliceSound; public static NetworkSoundEventDef FireballImpactSound; private const string obsolete = "use `Materials.CreateMaterial` instead, or use the extension `Material.SetHotpooMaterial` directly on a material"; public static void Initialize() { LoadAssetBundle(); PopulateAss(); } public static void LoadAssetBundle() { if ((Object)(object)mainAssetBundle == (Object)null) { mainAssetBundle = AssetBundle.LoadFromFile(Files.GetPluginFilePath("AssetBundles", "joe")); } } private static void PopulateAss() { //IL_0032: 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) JoeJumpSwingEffect = LoadEffect("JoeJumpSwingParticlesesEffect", "", parentToTransform: false, (VFXPriority)2); JoeImpactEffect = LoadEffect("JoeImpactEffectBasic", "play_joe_fireExplosion", parentToTransform: false, (VFXPriority)2); MercSwordSlash = CloneAndColorEffect("RoR2/Base/Merc/MercSwordSlash.prefab", Color.green, "GreenMercSwordSlash"); CreateEffectFromObject(MercSwordSlash, "", parentToTransform: true, (VFXPriority)2); MercImpactEffect = CloneAndColorEffectLegacy("Prefabs/Effects/OmniEffect/OmniImpactVFXSlashMerc", Color.green, "GreenOmniImpactVFXSlashMerc"); MercImpactEffect.GetComponent<EffectComponent>().soundName = ""; CreateEffectFromObject(MercImpactEffect, "", parentToTransform: false, (VFXPriority)1); FleshSliceSound = CreateNetworkSoundEventDef("play_joe_fleshSlice"); FireballImpactSound = CreateNetworkSoundEventDef("play_joe_fireExplosion"); } public static void LateInitialize() { TenticlesSpelledWrong = CreateTenticles(); } private static GameObject CloneAndColorEffect(string addressablesPath, Color color, string name) { //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_0016: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabAPI.InstantiateClone(Addressables.LoadAssetAsync<GameObject>((object)addressablesPath).WaitForCompletion(), name); recolorEffects(color, val); return val; } private static GameObject CloneAndColorEffectLegacy(string legacyPath, Color color, string name) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>(legacyPath), name); recolorEffects(color, val); return val; } public static void recolorEffects(Color color, GameObject MercSwordSlash) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) ParticleSystemRenderer[] componentsInChildren = MercSwordSlash.GetComponentsInChildren<ParticleSystemRenderer>(); ParticleSystemRenderer[] array = componentsInChildren; foreach (ParticleSystemRenderer val in array) { ((Renderer)val).material.SetColor("_MainColor", color); ((Renderer)val).material.SetColor("_Color", color); ((Renderer)val).material.SetColor("_TintColor", color); } } private static GameObject CreateTenticles() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00a9: Expected O, but got Unknown //IL_00ae: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) GameObject val = Asset.LoadAsset<GameObject>("Tenticles"); ConvertAllRenderersToHopooShader(val); BuffWard component = val.GetComponent<BuffWard>(); component.buffDef = Buffs.TenticleBuff; component.Networkradius = Special1Tenticles.Range; ((Component)val.transform.Find("Tenticles")).transform.localScale = Vector3.one * Special1Tenticles.Range * 2f; GameObject val2 = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/WarbannerWard"); Material material = ((Renderer)((Component)val2.transform.Find("Indicator/IndicatorSphere")).GetComponent<MeshRenderer>()).material; MeshRenderer component2 = ((Component)val.transform.Find("Indicator/Sphere")).GetComponent<MeshRenderer>(); Material val3 = new Material(material); Material val4 = val3; ((Renderer)component2).material = val3; Material val5 = val4; val5.SetColor("_TintColor", Color.green); PrefabAPI.RegisterNetworkPrefab(val); return val; } public static T LoadAsset<T>(string assString) where T : Object { T val = mainAssetBundle.LoadAsset<T>(assString); if ((Object)(object)val == (Object)null) { Debug.LogError((object)("Null asset: " + assString + ".\nAttempt to load asset '" + assString + "' from assetbundles returned null")); } return val; } public static GameObject LoadSurvivorModel(string modelName) { GameObject val = Asset.LoadAsset<GameObject>(modelName); if ((Object)(object)val == (Object)null) { Debug.LogError((object)"Trying to load a null model- check to see if the name in your code matches the name of the object in Unity"); return null; } return PrefabAPI.InstantiateClone(val, ((Object)val).name, false); } public 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)(object)((val != null) ? ((Renderer)val).sharedMaterial : null) != (Object)null) { ((Renderer)val).sharedMaterial.SetHotpooMaterial(); } } SkinnedMeshRenderer[] componentsInChildren2 = objectToConvert.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { if ((Object)(object)((val2 != null) ? ((Renderer)val2).sharedMaterial : null) != (Object)null) { ((Renderer)val2).sharedMaterial.SetHotpooMaterial(); } } } public static Texture LoadCharacterIconGeneric(string characterName) { return Asset.LoadAsset<Texture>("tex" + characterName + "Icon"); } public static Texture LoadCharacterIcon(string name) { return Asset.LoadAsset<Texture>(name); } public static NetworkSoundEventDef CreateNetworkSoundEventDef(string eventName) { NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>(); val.akId = AkSoundEngine.GetIDFromString(eventName); val.eventName = eventName; Content.AddNetworkSoundEventDef(val); return val; } private static GameObject CloneLightningOrbEffect(string path, string name, Color beamColor, Color? lineColor = null, float width = 1f) { //IL_0041: 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_0070: Unknown result type (might be due to invalid IL or missing references) GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>(path), name, false); LineRenderer[] componentsInChildren = val.GetComponentsInChildren<LineRenderer>(); foreach (LineRenderer val2 in componentsInChildren) { if (Object.op_Implicit((Object)(object)val2)) { Material val3 = Object.Instantiate<Material>(((Renderer)val2).material); val3.SetColor("_TintColor", beamColor); ((Renderer)val2).material = val3; if (lineColor.HasValue) { val2.startColor = lineColor.Value; val2.endColor = lineColor.Value; } val2.widthMultiplier = width; } } AddNewEffectDef(val); return val; } private static GameObject CloneTracer(string originalTracerName, string newTracerName, Color? color = null, float widthMultiplierMultiplier = 1f, float? speed = null, float? length = null) { //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) //IL_0318: 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_0131: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_018f: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: 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_01e5: Expected O, but got Unknown //IL_01f5: 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_0219: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) 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 = (speed.HasValue ? speed.Value : val.GetComponent<Tracer>().speed); val.GetComponent<Tracer>().length = (length.HasValue ? length.Value : val.GetComponent<Tracer>().length); if (color.HasValue || widthMultiplierMultiplier != 1f) { LineRenderer[] componentsInChildren = val.GetComponentsInChildren<LineRenderer>(); foreach (LineRenderer val2 in componentsInChildren) { if (color.HasValue) { val2.startColor = color.Value; val2.endColor = color.Value; } if (widthMultiplierMultiplier != 1f) { val2.widthMultiplier *= widthMultiplierMultiplier; } } ParticleSystem[] componentsInChildren2 = val.GetComponentsInChildren<ParticleSystem>(); foreach (ParticleSystem val3 in componentsInChildren2) { MainModule main = val3.main; MinMaxCurve startSize = ((MainModule)(ref main)).startSize; ((MainModule)(ref main)).startSize = new MinMaxCurve(((MinMaxCurve)(ref startSize)).constant * widthMultiplierMultiplier); ((MainModule)(ref main)).startColor = new MinMaxGradient(color.Value); TrailModule trails = val3.trails; if (((TrailModule)(ref trails)).enabled) { Gradient val4 = new Gradient(); GradientColorKey[] array = (GradientColorKey[])(object)new GradientColorKey[2]; array[0].color = Color.green; array[0].time = 0f; array[1].color = Color.green; array[1].time = 1f; GradientAlphaKey[] array2 = (GradientAlphaKey[])(object)new GradientAlphaKey[2]; array2[0].alpha = 1f; array2[0].time = 0f; array2[1].alpha = 0f; array2[1].time = 1f; val4.SetKeys(array, array2); ((TrailModule)(ref trails)).colorOverLifetime = new MinMaxGradient(val4); } } } if (color.HasValue) { ParticleSystemRenderer[] componentsInChildren3 = val.GetComponentsInChildren<ParticleSystemRenderer>(); foreach (ParticleSystemRenderer val5 in componentsInChildren3) { ((Renderer)val5).material.SetColor("_MainColor", color.Value); ((Renderer)val5).material.SetColor("_Color", color.Value); ((Renderer)val5).material.SetColor("_TintColor", color.Value); } } AddNewEffectDef(val); return val; } public static GameObject LoadCrosshair(string crosshairName) { if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair") == (Object)null) { return Asset.LoadAsset<GameObject>("Prefabs/Crosshair/StandardCrosshair"); } return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair"); } private static GameObject LoadEffect(string resourceName, string soundName = "", bool parentToTransform = false, VFXPriority priority = 2) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) GameObject val = Asset.LoadAsset<GameObject>(resourceName); if (!Object.op_Implicit((Object)(object)val)) { Debug.LogError((object)("Failed to load effect: " + resourceName + " because it does not exist in the AssetBundle")); return null; } CreateEffectFromObject(val, soundName, parentToTransform, priority); return val; } private static void CreateEffectFromObject(GameObject newEffect) { CreateEffectFromObject(newEffect, "", parentToTransform: false, (VFXPriority)2); } private static void CreateEffectFromObject(GameObject newEffect, string soundName, bool parentToTransform, VFXPriority priority = 2) { //IL_0031: 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_005d: Unknown result type (might be due to invalid IL or missing references) newEffect.AddComponent<DestroyOnTimer>().duration = 6f; newEffect.AddComponent<NetworkIdentity>(); if (!Object.op_Implicit((Object)(object)newEffect.GetComponent<VFXAttributes>())) { newEffect.AddComponent<VFXAttributes>().vfxPriority = priority; } EffectComponent component = newEffect.GetComponent<EffectComponent>(); if (!Object.op_Implicit((Object)(object)component)) { component = newEffect.AddComponent<EffectComponent>(); component.applyScale = true; component.effectIndex = (EffectIndex)(-1); component.parentToReferencedTransform = parentToTransform; component.positionAtReferencedTransform = true; component.soundName = soundName; } AddNewEffectDef(newEffect, soundName); } private static void AddNewEffectDef(GameObject effectPrefab, string soundName = "") { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown EffectDef effectDef = new EffectDef(effectPrefab); Content.AddEffectDef(effectDef); } [Obsolete("use `Materials.CreateMaterial` instead, or use the extension `Material.SetHotpooMaterial` directly on a material")] public static Material CreateMaterial(string materialName) { return CreateMaterial(materialName, 0f); } [Obsolete("use `Materials.CreateMaterial` instead, or use the extension `Material.SetHotpooMaterial` directly on a material")] public static Material CreateMaterial(string materialName, float emission) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return CreateMaterial(materialName, emission, Color.white); } [Obsolete("use `Materials.CreateMaterial` instead, or use the extension `Material.SetHotpooMaterial` directly on a material")] public static Material CreateMaterial(string materialName, float emission, Color emissionColor) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return CreateMaterial(materialName, emission, emissionColor, 0f); } [Obsolete("use `Materials.CreateMaterial` instead, or use the extension `Material.SetHotpooMaterial` directly on a material")] public static Material CreateMaterial(string materialName, float emission, Color emissionColor, float normalStrength) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return Materials.CreateHotpooMaterial(materialName).MakeUnique().SetEmission(emission, emissionColor) .SetNormal(normalStrength); } } internal static class Buffs { internal static BuffDef TenticleBuff; internal static BuffDef DashArmorBuff; public static void RegisterBuffs() { //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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) TenticleBuff = AddNewBuff("JoeTenticle", Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/WarCryOnMultiKill/bdWarCryBuff.asset").WaitForCompletion().iconSprite, Color.green, canStack: true, isDebuff: false); DashArmorBuff = AddNewBuff("JoeDashArmor", LegacyResourcesAPI.Load<BuffDef>("BuffDefs/HiddenInvincibility").iconSprite, Color.magenta, canStack: false, isDebuff: false); } public static BuffDef AddNewBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) BuffDef val = ScriptableObject.CreateInstance<BuffDef>(); ((Object)val).name = buffName; val.iconSprite = buffIcon; val.buffColor = buffColor; val.canStack = canStack; val.isDebuff = isDebuff; val.eliteDef = null; Content.AddBuffDef(val); return val; } } internal class Compat { public static bool TinkersSatchelInstalled => Chainloader.PluginInfos.ContainsKey("com.ThinkInvisible.TinkersSatchel"); public static bool AetheriumInstalled => Chainloader.PluginInfos.ContainsKey("com.KomradeSpectre.Aetherium"); public static bool ScepterInstalled => Chainloader.PluginInfos.ContainsKey("com.DestroyedClone.AncientScepter"); public static bool RiskOfOptionsInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); public static void Initialize() { if (Chainloader.PluginInfos.ContainsKey("com.weliveinasociety.CustomEmotesAPI")) { MemeCompat.init(); } } internal static int TryGetScepterCount(Inventory inventory) { if (!ScepterInstalled) { return 0; } return GetScepterCount(inventory); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static int GetScepterCount(Inventory inventory) { return inventory.GetItemCount(((ItemBase)ItemBase<AncientScepterItem>.instance).ItemDef); } } public class MemeCompat { public static void init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown SurvivorCatalog.Init += new hook_Init(SurvivorCatalog_Init); } private static void SurvivorCatalog_Init(orig_Init orig) { orig.Invoke(); } } internal static class Config { public static bool Debug; public static ConfigEntry<bool> Cursed; public static ConfigEntry<bool> jerry; public static void ReadConfig() { Debug = ((BaseUnityPlugin)FacelessJoePlugin.instance).Config.Bind<bool>("Debug", "Debug Logs", false, "in case I forget to delete them when I upload").Value; string text = "General"; Cursed = ((BaseUnityPlugin)FacelessJoePlugin.instance).Config.Bind<bool>(text, "Cursed", false, "Enable wip/unused content"); jerry = BindAndOptions(text, "Everyone is Jerry", defaultValue: false, "When anyone dies, the Jerry scream is heard."); } public static ConfigEntry<T> BindAndOptions<T>(string section, string name, T defaultValue, string description = "", bool restartRequired = false) { if (string.IsNullOrEmpty(description)) { description = name; } if (restartRequired) { description += " (restart required)"; } ConfigEntry<T> val = ((BaseUnityPlugin)FacelessJoePlugin.instance).Config.Bind<T>(section, name, defaultValue, description); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { TryRegisterOption<T>(val, restartRequired); } return val; } public static ConfigEntry<float> BindAndOptionsSlider(string section, string name, float defaultValue, string description = "", float min = 0f, float max = 20f, bool restartRequired = false) { if (string.IsNullOrEmpty(description)) { description = name; } if (restartRequired) { description += " (restart required)"; } ConfigEntry<float> val = ((BaseUnityPlugin)FacelessJoePlugin.instance).Config.Bind<float>(section, name, defaultValue, description); if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { TryRegisterOptionSlider(val, min, max, restartRequired); } return val; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void TryRegisterOption<T>(ConfigEntry<T> entry, bool restartRequired) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown if (entry is ConfigEntry<float>) { ModSettingsManager.AddOption((BaseOption)new SliderOption(entry as ConfigEntry<float>, new SliderConfig { min = 0f, max = 20f, formatString = "{0:0.00}", restartRequired = restartRequired })); } if (entry is ConfigEntry<int>) { ModSettingsManager.AddOption((BaseOption)new IntSliderOption(entry as ConfigEntry<int>, restartRequired)); } if (entry is ConfigEntry<bool>) { ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(entry as ConfigEntry<bool>, restartRequired)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void TryRegisterOptionSlider(ConfigEntry<float> entry, float min, float max, bool restartRequired) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new SliderOption(entry, new SliderConfig { min = min, max = max, formatString = "{0:0.00}", restartRequired = restartRequired })); } public static bool GetKeyPressed(ConfigEntry<KeyboardShortcut> entry) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = entry.Value; foreach (KeyCode modifier in ((KeyboardShortcut)(ref value)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } value = entry.Value; return Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey); } } internal class Content { public static void AddCharacterBodyPrefab(GameObject bprefab) { ContentPacks.bodyPrefabs.Add(bprefab); } public static void AddMasterPrefab(GameObject prefab) { ContentPacks.masterPrefabs.Add(prefab); } public static GameObject AddProjectilePrefab(GameObject prefab) { ContentPacks.projectilePrefabs.Add(prefab); return prefab; } public static void AddSurvivorDef(SurvivorDef survivorDef) { ContentPacks.survivorDefs.Add(survivorDef); } public static void AddUnlockableDef(UnlockableDef unlockableDef) { ContentPacks.unlockableDefs.Add(unlockableDef); } public static void AddSkillDef(SkillDef skillDef) { ContentPacks.skillDefs.Add(skillDef); } public static void AddSkillFamily(SkillFamily skillFamily) { ContentPacks.skillFamilies.Add(skillFamily); } public static void AddEntityState(Type entityState) { ContentPacks.entityStates.Add(entityState); } public static void AddBuffDef(BuffDef buffDef) { ContentPacks.buffDefs.Add(buffDef); } public static void AddEffectDef(EffectDef effectDef) { ContentPacks.effectDefs.Add(effectDef); } public static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef) { ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef); } } internal class ContentPacks : IContentPackProvider { public 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.TheTimeSweeper.FacelessJoe"; public void Initialize() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders); } private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } 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 DamageTypes { public static ModdedDamageType TenticleLifeStealing; public static void RegisterDamageTypes() { //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) TenticleLifeStealing = DamageAPI.ReserveDamageType(); } } internal static class Dots { public static void RegisterDots() { } } internal static class EntityStates { public static void Init() { Content.AddEntityState(typeof(WindDownState)); Content.AddEntityState(typeof(JoeMain)); Content.AddEntityState(typeof(Primary1Swing)); Content.AddEntityState(typeof(Primary1JumpSwingFall)); Content.AddEntityState(typeof(Primary1JumpSwingLand)); Content.AddEntityState(typeof(PrimaryScepter1Swing)); Content.AddEntityState(typeof(PrimaryScepter1JumpSwingFall)); Content.AddEntityState(typeof(PrimaryScepter1JumpSwingLand)); Content.AddEntityState(typeof(PrimaryStupidSwing)); Content.AddEntityState(typeof(ThrowBoom)); Content.AddEntityState(typeof(ThroBoomButCoolerQuestionMaark)); Content.AddEntityState(typeof(Secondary1Fireball)); Content.AddEntityState(typeof(Utility1Dash)); Content.AddEntityState(typeof(Utility1ChargeMeleeDash)); Content.AddEntityState(typeof(Utility1MeleeDashAttack)); Content.AddEntityState(typeof(Special1Tenticles)); } } internal static class Files { public static SubFileSystem fileSystem; public static PluginInfo PluginInfo; internal static string assemblyDir => Path.GetDirectoryName(PluginInfo.Location); internal static void Init(PluginInfo info) { PluginInfo = info; } internal static string GetPluginFilePath(string folderName, string fileName) { return Path.Combine(assemblyDir, folderName, fileName); } } internal static class ItemDisplays { private static Dictionary<string, GameObject> itemDisplayPrefabs = new Dictionary<string, GameObject>(); private static bool recording = false; public static Dictionary<string, int> itemDisplayCheckCount = new Dictionary<string, int>(); public static Dictionary<string, Object> itemDisplayCheckAsset = new Dictionary<string, Object>(); public static Dictionary<string, Object> KeyAssets = new Dictionary<string, Object>(); public static void PopulateDisplays() { PopulateDisplaysFromBody("LoaderBody"); AddMasterSwordDisplay(); } private static void AddMasterSwordDisplay() { GameObject val = Asset.LoadAsset<GameObject>("displayMasterSword"); val.GetComponent<Renderer>().material.SetHotpooMaterial(); itemDisplayPrefabs["displaymastersword"] = val; } private static void PopulateDisplaysFromBody(string bodyName) { GameObject obj = LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyName); object obj2; if (obj == null) { obj2 = null; } else { ModelLocator component = obj.GetComponent<ModelLocator>(); obj2 = ((component == null) ? null : ((Component)component.modelTransform).GetComponent<CharacterModel>()?.itemDisplayRuleSet); } ItemDisplayRuleSet val = (ItemDisplayRuleSet)obj2; if ((Object)(object)val == (Object)null) { Debug.LogError((object)("couldn't load ItemDisplayRuleSet from " + bodyName + ". Check if name was entered correctly")); return; } KeyAssetRuleGroup[] keyAssetRuleGroups = val.keyAssetRuleGroups; for (int i = 0; i < keyAssetRuleGroups.Length; i++) { ItemDisplayRule[] rules = keyAssetRuleGroups[i].displayRuleGroup.rules; KeyAssets[keyAssetRuleGroups[i].keyAsset.name] = keyAssetRuleGroups[i].keyAsset; for (int j = 0; j < rules.Length; j++) { GameObject followerPrefab = rules[j].followerPrefab; if (Object.op_Implicit((Object)(object)followerPrefab)) { string key = ((Object)followerPrefab).name?.ToLowerInvariant(); if (!itemDisplayPrefabs.ContainsKey(key)) { itemDisplayPrefabs[key] = followerPrefab; itemDisplayCheckCount[key] = 0; itemDisplayCheckAsset[key] = keyAssetRuleGroups[i].keyAsset; } } } } } private static void AddCustomLightningArm() { GameObject val = PrefabAPI.InstantiateClone(itemDisplayPrefabs["DisplayLightningArmRight".ToLowerInvariant()], "DisplayLightningArmCustom", false); LimbMatcher component = val.GetComponent<LimbMatcher>(); component.limbPairs[0].targetChildLimb = "LightningArm1"; component.limbPairs[1].targetChildLimb = "LightningArm2"; component.limbPairs[2].targetChildLimb = "LightningArmEnd"; string key = "DisplayLightningArmCustom".ToLowerInvariant(); itemDisplayPrefabs[key] = val; } public static GameObject LoadDisplay(string name) { if (itemDisplayPrefabs.ContainsKey(name.ToLowerInvariant()) && Object.op_Implicit((Object)(object)itemDisplayPrefabs[name.ToLowerInvariant()])) { if (recording && itemDisplayCheckCount.ContainsKey(name.ToLowerInvariant())) { itemDisplayCheckCount[name.ToLowerInvariant()]++; } return itemDisplayPrefabs[name.ToLowerInvariant()]; } Debug.LogError((object)("item display " + name + " returned null")); return null; } public static void recordUnused() { recording = true; } public static void printUnused() { string text = "used:"; string text2 = "not used:"; foreach (KeyValuePair<string, int> item in itemDisplayCheckCount) { string text3 = $"\n{itemDisplayCheckAsset[item.Key]} | {((Object)itemDisplayPrefabs[item.Key]).name}"; text3 = SpitOutNewRule(itemDisplayCheckAsset[item.Key], ((Object)itemDisplayPrefabs[item.Key]).name); if (item.Value > 0) { text += text3; } else { text2 += text3; } } Helpers.LogWarning(text2); } private static string SpitOutNewRule(Object asset, string prefabName, string content = "DLC1Content") { string text = ((asset is ItemDef) ? "Items" : "Equipment"); return "\n itemDisplayRules.Add(ItemDisplays.CreateGenericDisplayRule(" + content + "." + text + "." + asset.name + ", \"" + prefabName + "\",\n \"Chest\",\n new Vector3(2, 2, 2),\n new Vector3(0, 0, 0),\n new Vector3(1, 1, 1)));"; } private static void resetUnused() { foreach (KeyValuePair<string, int> item in itemDisplayCheckCount) { itemDisplayCheckCount[item.Key] = 0; } recording = false; } 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) { Debug.LogError((object)("Could not load keyasset for " + itemName)); } return val; } public static KeyAssetRuleGroup CreateGenericDisplayRuleGroup(Object keyAsset_, GameObject itemPrefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) ItemDisplayRule val = CreateDisplayRule(itemPrefab, childName, position, rotation, scale); return CreateDisplayRuleGroupWithRules(keyAsset_, val); } public static ItemDisplayRule CreateDisplayRule(string prefabName, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) return CreateDisplayRule(LoadDisplay(prefabName), childName, position, rotation, scale); } public static ItemDisplayRule CreateDisplayRule(GameObject itemPrefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) ItemDisplayRule result = default(ItemDisplayRule); result.ruleType = (ItemDisplayRuleType)0; result.childName = childName; result.followerPrefab = itemPrefab; result.limbMask = (LimbFlags)0; result.localPos = position; result.localAngles = rotation; result.localScale = scale; return result; } public static ItemDisplayRule CreateLimbMaskDisplayRule(LimbFlags limb) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) ItemDisplayRule result = default(ItemDisplayRule); result.ruleType = (ItemDisplayRuleType)1; result.limbMask = limb; result.childName = ""; result.followerPrefab = null; return result; } public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(string itemName, params ItemDisplayRule[] rules) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) return CreateDisplayRuleGroupWithRules(GetKeyAssetFromString(itemName), rules); } public static KeyAssetRuleGroup CreateDisplayRuleGroupWithRules(Object keyAsset_, params ItemDisplayRule[] rules) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) KeyAssetRuleGroup result = default(KeyAssetRuleGroup); result.keyAsset = keyAsset_; result.displayRuleGroup = new DisplayRuleGroup { rules = rules }; return result; } public static KeyAssetRuleGroup CreateGenericDisplayRule(string itemName, string prefabName, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return CreateGenericDisplayRule(GetKeyAssetFromString(itemName), prefabName, childName, position, rotation, scale); } public static KeyAssetRuleGroup CreateGenericDisplayRule(Object itemDef, string prefabName, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return CreateGenericDisplayRule(itemDef, LoadDisplay(prefabName), childName, position, rotation, scale); } public static KeyAssetRuleGroup CreateGenericDisplayRule(string itemName, GameObject displayPrefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) return CreateGenericDisplayRule(GetKeyAssetFromString(itemName), displayPrefab, childName, position, rotation, scale); } public static KeyAssetRuleGroup CreateGenericDisplayRule(Object itemDef, GameObject displayPrefab, string childName, Vector3 position, Vector3 rotation, Vector3 scale) { //IL_002e: 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) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_007b: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_009e: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)displayPrefab == (Object)null) { Helpers.LogWarning("could not find display prefab for " + (object)itemDef); } KeyAssetRuleGroup result = default(KeyAssetRuleGroup); result.keyAsset = itemDef; result.displayRuleGroup = new DisplayRuleGroup { rules = (ItemDisplayRule[])(object)new ItemDisplayRule[1] { new ItemDisplayRule { ruleType = (ItemDisplayRuleType)0, childName = childName, followerPrefab = displayPrefab, limbMask = (LimbFlags)0, localPos = position, localAngles = rotation, localScale = scale } } }; return result; } } internal static class Language { public static SubFileSystem fileSystem; internal static string TokensOutput = ""; public static bool printingEnabled; internal static string languageRoot => Path.Combine(Files.assemblyDir, "Language"); public static void PrintOutput(string preface = "") { if (printingEnabled) { Helpers.LogWarning(preface + "\n{\n strings:\n {" + TokensOutput + "\n }\n}"); TokensOutput = ""; } } public static void Add(string token, string text) { LanguageAPI.Add(token, text, "en"); if (printingEnabled) { TokensOutput = TokensOutput + "\n \"" + token + "\" : \"" + text.Replace(Environment.NewLine, "\\n").Replace("\n", "\\n") + "\","; } } public static void HookRegisterLanguageTokens() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Language.SetFolders += new hook_SetFolders(fixme); } private static void fixme(orig_SetFolders orig, Language self, IEnumerable<string> newFolders) { if (Directory.Exists(languageRoot)) { IEnumerable<string> second = Directory.EnumerateDirectories(Path.Combine(languageRoot), self.name); orig.Invoke(self, newFolders.Union(second)); } else { orig.Invoke(self, newFolders); } } } internal static class Materials { private static List<Material> cachedMaterials = new List<Material>(); public static Material CreateHotpooMaterial(string materialName) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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)) { Helpers.LogVerbose("returning cached material for " + materialName); return val; } val = Asset.LoadAsset<Material>(materialName); if (!Object.op_Implicit((Object)(object)val)) { Debug.LogError((object)("Failed to load material: " + materialName + " - Check to see that the name in your Unity project matches the one in this code")); return new Material(Asset.hotpoo); } return val.SetHotpooMaterial(); } private static Material CreateHotpooMaterial(Material tempMat) { if (cachedMaterials.Contains(tempMat)) { Helpers.LogVerbose("returning cached material for " + (object)tempMat); return tempMat; } return tempMat.SetHotpooMaterial(); } public static Material SetHotpooMaterial(this Material tempMat) { //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) if (cachedMaterials.Contains(tempMat)) { Helpers.LogVerbose("returning cached material for " + (object)tempMat); return tempMat; } Helpers.LogVerbose("creating hotpoo material with " + (object)tempMat); if (((Object)tempMat.shader).name == "StubbedShader/deferred/hgstandard") { tempMat.shader = Asset.hotpoo; 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 = Asset.hotpoo; tempMat.SetColor("_Color", tempMat.GetColor("_Color")); tempMat.SetTexture("_MainTex", tempMat.GetTexture("_MainTex")); tempMat.SetTexture("_EmTex", tempMat.GetTexture("_EmissionMap")); if (num.HasValue) { tempMat.SetFloat("_NormalStrength", num.Value); } if (val.HasValue) { tempMat.SetColor("_EmColor", val.Value); tempMat.SetFloat("_EmPower", 1f); } if (tempMat.IsKeywordEnabled("_CULL")) { tempMat.SetInt("_Cull", 0); } tempMat.EnableKeyword("DITHER"); if (tempMat.IsKeywordEnabled("LIMBREMOVAL")) { tempMat.SetInt("_LimbRemovalOn", 1); } cachedMaterials.Add(tempMat); return tempMat; } public static Material MakeUnique(this Material material) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (cachedMaterials.Contains(material)) { return new Material(material); } return material; } public static Material SetColor(this Material material, Color color) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) material.SetColor("_Color", color); return material; } public static Material SetNormal(this Material material, float normalStrength = 1f) { material.SetFloat("_NormalStrength", normalStrength); return material; } public static Material SetEmission(this Material material) { return material.SetEmission(1f); } public static Material SetEmission(this Material material, float emission) { material.SetFloat("_EmPower", emission); return material; } public static Material SetEmission(this Material material, float emission, Color emissionColor) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) material.SetFloat("_EmPower", emission); material.SetColor("_EmColor", emissionColor); return material; } public static Material SetCull(this Material material, bool cull = false) { material.SetInt("_Cull", cull ? 1 : 0); return material; } } internal static class Prefabs { private static PhysicMaterial ragdollMaterial; public static GameObject CreateDisplayPrefab(string displayModelName, GameObject prefab, BodyInfo bodyInfo) { GameObject val = Asset.LoadSurvivorModel(displayModelName); CharacterModel val2 = val.GetComponent<CharacterModel>(); if (!Object.op_Implicit((Object)(object)val2)) { val2 = val.AddComponent<CharacterModel>(); } val2.baseRendererInfos = prefab.GetComponentInChildren<CharacterModel>().baseRendererInfos; Asset.ConvertAllRenderersToHopooShader(val); return val.gameObject; } public static GameObject CreateBodyPrefab(string bodyName, string modelName, BodyInfo bodyInfo) { //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyInfo.bodyNameToClone + "Body"))) { Debug.LogError((object)(bodyInfo.bodyNameToClone + "Body is not a valid body, character creation failed")); return null; } GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/" + bodyInfo.bodyNameToClone + "Body"), bodyName); Transform val2 = null; GameObject val3 = null; if (modelName != "mdl") { val3 = Asset.LoadSurvivorModel(modelName); if ((Object)(object)val3 == (Object)null) { val3 = ((Component)val.GetComponentInChildren<CharacterModel>()).gameObject; } val2 = AddCharacterModelToSurvivorBody(val, val3.transform, bodyInfo); } CharacterBody component = val.GetComponent<CharacterBody>(); ((Object)component).name = bodyInfo.bodyName; component.baseNameToken = bodyInfo.bodyNameToken; component.subtitleNameToken = bodyInfo.subtitleNameToken; component.portraitIcon = bodyInfo.characterPortrait; component.bodyColor = bodyInfo.bodyColor; component._defaultCrosshairPrefab = bodyInfo.crosshair; component.hideCrosshair = false; component.preferredPodPrefab = bodyInfo.podPrefab; component.baseMaxHealth = bodyInfo.maxHealth; component.baseRegen = bodyInfo.healthRegen; component.baseArmor = bodyInfo.armor; component.baseMaxShield = bodyInfo.shield; component.baseDamage = bodyInfo.damage; component.baseAttackSpeed = bodyInfo.attackSpeed; component.baseCrit = bodyInfo.crit; component.baseMoveSpeed = bodyInfo.moveSpeed; component.baseJumpPower = bodyInfo.jumpPower; component.autoCalculateLevelStats = bodyInfo.autoCalculateLevelStats; if (bodyInfo.autoCalculateLevelStats) { component.levelMaxHealth = Mathf.Round(component.baseMaxHealth * 0.3f); component.levelMaxShield = Mathf.Round(component.baseMaxShield * 0.3f); component.levelRegen = component.baseRegen * 0.2f; component.levelMoveSpeed = 0f; component.levelJumpPower = 0f; component.levelDamage = component.baseDamage * 0.2f; component.levelAttackSpeed = 0f; component.levelCrit = 0f; component.levelArmor = 0f; } else { component.levelMaxHealth = bodyInfo.healthGrowth; component.levelMaxShield = bodyInfo.shieldGrowth; component.levelRegen = bodyInfo.regenGrowth; component.levelMoveSpeed = bodyInfo.moveSpeedGrowth; component.levelJumpPower = bodyInfo.jumpPowerGrowth; component.levelDamage = bodyInfo.damageGrowth; component.levelAttackSpeed = bodyInfo.attackSpeedGrowth; component.levelCrit = bodyInfo.critGrowth; component.levelArmor = bodyInfo.armorGrowth; } component.baseAcceleration = bodyInfo.acceleration; component.baseJumpCount = bodyInfo.jumpCount; component.sprintingSpeedMultiplier = 1.45f; component.bodyFlags = bodyInfo.bodyFlags; component.rootMotionInMainState = false; component.hullClassification = (HullClassification)0; component.isChampion = false; SetupCameraTargetParams(val, bodyInfo); SetupModelLocator(val, val2, val3.transform); SetupCapsuleCollider(val); SetupHurtBoxGroup(val, val3); SetupAimAnimator(val, val3); if (bodyInfo.bodyNameToClone != "EngiTurret") { if ((Object)(object)val2 != (Object)null) { SetupCharacterDirection(val, val2, val3.transform); } SetupFootstepController(val3); SetupRagdoll(val3); } Content.AddCharacterBodyPrefab(val); return val; } public static void CreateGenericDoppelganger(GameObject bodyPrefab, string masterName, string masterToCopy) { GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/" + masterToCopy + "MonsterMaster"), masterName, true); val.GetComponent<CharacterMaster>().bodyPrefab = bodyPrefab; Content.AddMasterPrefab(val); } private static Transform AddCharacterModelToSurvivorBody(GameObject bodyPrefab, Transform modelTransform, BodyInfo bodyInfo) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) for (int num = bodyPrefab.transform.childCount - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)((Component)bodyPrefab.transform.GetChild(num)).gameObject); } Transform transform = new GameObject("ModelBase").transform; transform.parent = bodyPrefab.transform; transform.localPosition = bodyInfo.modelBasePosition; transform.localRotation = Quaternion.identity; modelTransform.parent = ((Component)transform).transform; modelTransform.localPosition = Vector3.zero; modelTransform.localRotation = Quaternion.identity; GameObject val = new GameObject("CameraPivot"); val.transform.parent = bodyPrefab.transform; val.transform.localPosition = bodyInfo.cameraPivotPosition; val.transform.localRotation = Quaternion.identity; GameObject val2 = new GameObject("AimOrigin"); val2.transform.parent = bodyPrefab.transform; val2.transform.localPosition = bodyInfo.aimOriginPosition; val2.transform.localRotation = Quaternion.identity; bodyPrefab.GetComponent<CharacterBody>().aimOriginTransform = val2.transform; return ((Component)transform).transform; } public static CharacterModel SetupCharacterModel(GameObject prefab) { return SetupCharacterModel(prefab, null); } public static CharacterModel SetupCharacterModel(GameObject prefab, CustomRendererInfo[] customInfos) { CharacterModel val = ((Component)prefab.GetComponent<ModelLocator>().modelTransform).gameObject.GetComponent<CharacterModel>(); bool flag = (Object)(object)val != (Object)null; if (!flag) { val = ((Component)prefab.GetComponent<ModelLocator>().modelTransform).gameObject.AddComponent<CharacterModel>(); } val.body = prefab.GetComponent<CharacterBody>(); val.autoPopulateLightInfos = true; val.invisibilityCount = 0; val.temporaryOverlays = new List<TemporaryOverlayInstance>(); if (!flag) { SetupCustomRendererInfos(val, customInfos); } else { SetupPreAttachedRendererInfos(val); } return val; } public static void SetupPreAttachedRendererInfos(CharacterModel characterModel) { for (int i = 0; i < characterModel.baseRendererInfos.Length; i++) { if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null) { characterModel.baseRendererInfos[i].defaultMaterial = characterModel.baseRendererInfos[i].renderer.sharedMaterial; } characterModel.baseRendererInfos[i].defaultMaterial.SetHotpooMaterial(); } } public static void SetupCustomRendererInfos(CharacterModel characterModel, CustomRendererInfo[] customInfos) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: 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)) { Debug.LogError((object)"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))) { Debug.LogError((object)("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 = component2.material.SetHotpooMaterial(); } list.Add(new RendererInfo { renderer = component2, defaultMaterial = val, ignoreOverlays = customInfos[i].ignoreOverlays, defaultShadowCastingMode = (ShadowCastingMode)1 }); } } characterModel.baseRendererInfos = list.ToArray(); } private static void SetupCharacterDirection(GameObject prefab, Transform modelBaseTransform, Transform modelTransform) { if (Object.op_Implicit((Object)(object)prefab.GetComponent<CharacterDirection>())) { CharacterDirection component = prefab.GetComponent<CharacterDirection>(); component.targetTransform = modelBaseTransform; component.overrideAnimatorForwardTransform = null; component.rootMotionAccumulator = null; component.modelAnimator = ((Component)modelTransform).GetComponent<Animator>(); component.driveFromRootRotation = false; component.turnSpeed = 720f; } } private static void SetupCameraTargetParams(GameObject prefab, BodyInfo bodyInfo) { CameraTargetParams component = prefab.GetComponent<CameraTargetParams>(); component.cameraParams = bodyInfo.cameraParams; component.cameraPivotTransform = prefab.transform.Find("CameraPivot"); } private static void SetupModelLocator(GameObject prefab, Transform modelBaseTransform, Transform modelTransform) { ModelLocator component = prefab.GetComponent<ModelLocator>(); component.modelTransform = modelTransform; component.modelBaseTransform = modelBaseTransform; } private static void SetupCapsuleCollider(GameObject prefab) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) CapsuleCollider component = prefab.GetComponent<CapsuleCollider>(); component.center = new Vector3(0f, 0f, 0f); component.radius = 0.5f; component.height = 1.82f; component.direction = 1; } public static void SetupHurtBoxGroup(GameObject bodyPrefab, GameObject bodyModel) { HealthComponent component = bodyPrefab.GetComponent<HealthComponent>(); HurtBoxGroup component2 = bodyModel.GetComponent<HurtBoxGroup>(); if ((Object)(object)component2 != (Object)null) { component2.mainHurtBox.healthComponent = component; for (int i = 0; i < component2.hurtBoxes.Length; i++) { component2.hurtBoxes[i].healthComponent = component; } } else { SetupMainHurtboxesFromChildLocator(bodyPrefab, bodyModel); } } private static void SetupMainHurtboxesFromChildLocator(GameObject prefab, GameObject model) { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) ChildLocator component = model.GetComponent<ChildLocator>(); if (!Object.op_Implicit((Object)(object)component.FindChild("MainHurtbox"))) { Helpers.LogWarning("Could not set up main hurtbox: make sure you have a transform pair in your prefab's ChildLocator component called 'MainHurtbox'"); return; } HurtBoxGroup val = model.AddComponent<HurtBoxGroup>(); HurtBox val2 = null; GameObject val3 = component.FindChildGameObject("HeadHurtbox"); if (Object.op_Implicit((Object)(object)val3)) { val2 = val3.AddComponent<HurtBox>(); ((Component)val2).gameObject.layer = LayerIndex.entityPrecise.intVal; val2.healthComponent = prefab.GetComponent<HealthComponent>(); val2.isBullseye = false; val2.isSniperTarget = true; val2.damageModifier = (DamageModifier)0; val2.hurtBoxGroup = val; val2.indexInGroup = 1; } HurtBox val4 = ((Component)component.FindChild("MainHurtbox")).gameObject.AddComponent<HurtBox>(); ((Component)val4).gameObject.layer = LayerIndex.entityPrecise.intVal; val4.healthComponent = prefab.GetComponent<HealthComponent>(); val4.isBullseye = true; val4.isSniperTarget = (Object)(object)val2 == (Object)null; val4.damageModifier = (DamageModifier)0; val4.hurtBoxGroup = val; val4.indexInGroup = 0; if (Object.op_Implicit((Object)(object)val2)) { val.hurtBoxes = (HurtBox[])(object)new HurtBox[2] { val4, val2 }; } else { val.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val4 }; } val.mainHurtBox = val4; val.bullseyeCount = 1; } private static void SetupFootstepController(GameObject model) { FootstepHandler val = model.AddComponent<FootstepHandler>(); val.baseFootstepString = "Play_player_footstep"; val.sprintFootstepOverrideString = ""; val.enableFootstepDust = true; val.footstepDustPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/GenericFootstepDust"); } private static void SetupRagdoll(GameObject model) { RagdollController component = model.GetComponent<RagdollController>(); if (!Object.op_Implicit((Object)(object)component)) { return; } if ((Object)(object)ragdollMaterial == (Object)null) { ragdollMaterial = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<RagdollController>().bones[1]).GetComponent<Collider>().material; } Transform[] bones = component.bones; foreach (Transform val in bones) { if (Object.op_Implicit((Object)(object)val)) { ((Component)val).gameObject.layer = LayerIndex.ragdoll.intVal; Collider component2 = ((Component)val).GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component2)) { component2.material = ragdollMaterial; component2.sharedMaterial = ragdollMaterial; } } } } private static void SetupAimAnimator(GameObject prefab, GameObject model) { AimAnimator val = model.AddComponent<AimAnimator>(); val.directionComponent = prefab.GetComponent<CharacterDirection>(); val.pitchRangeMax = 60f; val.pitchRangeMin = -60f; val.yawRangeMin = -80f; val.yawRangeMax = 80f; val.pitchGiveupRange = 30f; val.yawGiveupRange = 10f; val.giveupDuration = 3f; val.inputBank = prefab.GetComponent<InputBankTest>(); } public static void SetupHitbox(GameObject modelPrefab, string groupName, 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) { FacelessJoePlugin.Log.LogError((object)("missing hitbox for " + hitboxChildNames[i])); } } SetupHitbox(modelPrefab, groupName, array); } public static void SetupHitbox(GameObject modelPrefab, Transform hitboxTransform, string hitboxName) { SetupHitbox(modelPrefab, hitboxName, hitboxTransform); } public static void SetupHitbox(GameObject modelPrefab, string hitboxName, params Transform[] hitboxTransforms) { HitBoxGroup val = modelPrefab.AddComponent<HitBoxGroup>(); List<HitBox> list = new List<HitBox>(); foreach (Transform val2 in hitboxTransforms) { HitBox item = ((Component)val2).gameObject.AddComponent<HitBox>(); ((Component)val2).gameObject.layer = LayerIndex.projectile.intVal; list.Add(item); } val.hitBoxes = list.ToArray(); val.groupName = hitboxName; } } internal static class Projectiles { public static GameObject JoeFireball; public static GameObject JoeSwordBeam; public static GameObject totallyNewBombPrefab; public static void Init() { JoeFireball = LoadAndRegisterProjectileAsIs("JoeFireballBasic"); totallyNewBombPrefab = CloneProjectilePrefab("EngiGrenadeProjectile", "TotallyNotPlagueKnightBomb"); JoeSwordBeam = CreateJoeSwordBeam(); } private static GameObject CreateJoeSwordBeam() { //IL_0014: 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) GameObject val = Asset.LoadAsset<GameObject>("SwordBeam"); ModdedDamageTypeHolderComponent val2 = val.AddComponent<ModdedDamageTypeHolderComponent>(); val2.Add(DamageTypes.TenticleLifeStealing); GameObject ghostPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/EvisProjectile").GetComponent<ProjectileController>().ghostPrefab; ghostPrefab = PrefabAPI.InstantiateClone(ghostPrefab, "JoeGreenEvisProjectile", false); Asset.recolorEffects(Color.green, ghostPrefab); val.GetComponent<ProjectileController>().ghostPrefab = ghostPrefab; PrefabAPI.RegisterNetworkPrefab(val); Content.AddProjectilePrefab(val); return val; } public static GameObject LoadAndRegisterProjectileAsIs(string assName) { GameObject val = Asset.LoadAsset<GameObject>(assName); PrefabAPI.RegisterNetworkPrefab(val); Content.AddProjectilePrefab(val); return val; } public static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName) { return PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/" + prefabName), newPrefabName); } } internal static class Skills { public static void CreateSkillFamilies(GameObject targetPrefab, int families = 15, bool destroyExisting = true) { if (destroyExisting) { GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren<GenericSkill>(); foreach (GenericSkill val in componentsInChildren) { Object.DestroyImmediate((Object)(object)val); } } SkillLocator component = targetPrefab.GetComponent<SkillLocator>(); if (((uint)families & (true ? 1u : 0u)) != 0) { component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary"); } if (((uint)families & 2u) != 0) { component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary"); } if (((uint)families & 4u) != 0) { component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility"); } if (((uint)families & 8u) != 0) { component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special"); } } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string familyName, bool hidden = false) { GenericSkill val = targetPrefab.AddComponent<GenericSkill>(); val.skillName = familyName; val.hideInCharacterSelect = hidden; SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>(); ((Object)val2).name = ((Object)targetPrefab).name + familyName + "Family"; val2.variants = (Variant[])(object)new Variant[0]; val._skillFamily = val2; Content.AddSkillFamily(val2); return val; } public static void AddSkillToFamily(SkillFamily skillFamily, SkillDef skillDef, UnlockableDef unlockableDef = null) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); Variant[] variants = skillFamily.variants; int num = skillFamily.variants.Length - 1; Variant val = new Variant { skillDef = skillDef, unlockableDef = unlockableDef }; ((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null); variants[num] = val; } public static void AddSkillsToFamily(SkillFamily skillFamily, params SkillDef[] skillDefs) { foreach (SkillDef skillDef in skillDefs) { AddSkillToFamily(skillFamily, skillDef); } } public static void AddPrimarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().primary.skillFamily, skillDefs); } public static void AddSecondarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().secondary.skillFamily, skillDefs); } public static void AddUtilitySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().utility.skillFamily, skillDefs); } public static void AddSpecialSkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().special.skillFamily, skillDefs); } public static void AddUnlockablesToFamily(SkillFamily skillFamily, params UnlockableDef[] unlockableDefs) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < unlockableDefs.Length; i++) { Variant val = skillFamily.variants[i]; val.unlockableDef = unlockableDefs[i]; skillFamily.variants[i] = val; } } public static SkillDef CreateSkillDef(SkillDefInfo skillDefInfo) { return Skills.CreateSkillDef<SkillDef>(skillDefInfo); } public static T CreateSkillDef<T>(SkillDefInfo skillDefInfo) where T : SkillDef { T val = ScriptableObject.CreateInstance<T>(); popuplateSKillDef(skillDefInfo, (SkillDef)(object)val); Content.AddSkillDef((SkillDef)(object)val); return val; } private static void popuplateSKillDef(SkillDefInfo skillDefInfo, SkillDef skillDef) { //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) //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) skillDef.skillName = skillDefInfo.skillName; ((Object)skillDef).name = skillDefInfo.skillName; skillDef.skillNameToken = skillDefInfo.skillNameToken; skillDef.skillDescriptionToken = skillDefInfo.skillDescriptionToken; skillDef.icon = skillDefInfo.skillIcon; skillDef.activationState = skillDefInfo.activationState; skillDef.activationStateMachineName = skillDefInfo.activationStateMachineName; skillDef.baseMaxStock = skillDefInfo.baseMaxStock; skillDef.baseRechargeInterval = skillDefInfo.baseRechargeInterval; skillDef.beginSkillCooldownOnSkillEnd = skillDefInfo.beginSkillCooldownOnSkillEnd; skillDef.canceledFromSprinting = skillDefInfo.canceledFromSprinting; skillDef.forceSprintDuringState = skillDefInfo.forceSprintDuringState; skillDef.fullRestockOnAssign = skillDefInfo.fullRestockOnAssign; skillDef.interruptPriority = skillDefInfo.interruptPriority; skillDef.resetCooldownTimerOnUse = skillDefInfo.resetCooldownTimerOnUse; skillDef.isCombatSkill = skillDefInfo.isCombatSkill; skillDef.mustKeyPress = skillDefInfo.mustKeyPress; skillDef.cancelSprintingOnActivation = skillDefInfo.cancelSprintingOnActivation; skillDef.rechargeStock = skillDefInfo.rechargeStock; skillDef.requiredStock = skillDefInfo.requiredStock; skillDef.stockToConsume = skillDefInfo.stockToConsume; skillDef.keywordTokens = skillDefInfo.keywordTokens; } } internal static class Skins { public struct SkinDefInfo { public SkinDef[] BaseSkins; public Sprite Icon; public string NameToken; public UnlockableDef UnlockableDef; public GameObject RootObject; public RendererInfo[] RendererInfos; public MeshReplacement[] MeshReplacements; public GameObjectActivation[] GameObjectActivations; public ProjectileGhostReplacement[] ProjectileGhostReplacements; public MinionSkinReplacement[] MinionSkinReplacements; public string Name; } public static SkinDef CreateSkinDef(string skinName, Sprite skinIcon, RendererInfo[] defaultRendererInfos, GameObject root, UnlockableDef unlockableDef = null) { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown SkinDefInfo skinDefInfo = default(SkinDefInfo); skinDefInfo.BaseSkins = Array.Empty<SkinDef>(); skinDefInfo.GameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[0]; skinDefInfo.Icon = skinIcon; skinDefInfo.MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0]; skinDefInfo.MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0]; skinDefInfo.Name = skinName; skinDefInfo.NameToken = skinName; skinDefInfo.ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0]; skinDefInfo.RendererInfos = (RendererInfo[])(object)new RendererInfo[defaultRendererInfos.Length]; skinDefInfo.RootObject = root; skinDefInfo.UnlockableDef = unlockableDef; SkinDefInfo skinDefInfo2 = skinDefInfo; SkinDef.Awake += new hook_Awake(DoNothing); SkinDef val = ScriptableObject.CreateInstance<SkinDef>(); PopulateSkinDef(defaultRendererInfos, skinDefInfo2, val); SkinDef.Awake -= new hook_Awake(DoNothing); return val; } public static SkinDef CreateRecolorSkinDef(string skinName, Sprite skinIcon, SkinDef baseSkin, UnlockableDef unlockableDef) { SkinDef val = CreateSkinDef(skinName, skinIcon, baseSkin.rendererInfos, baseSkin.rootObject, unlockableDef); val.baseSkins = (SkinDef[])(object)new SkinDef[1] { baseSkin }; return val; } internal static SkinDef GetCurrentSkinDef(CharacterBody characterBody) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return SkinCatalog.GetBodySkinDef(characterBody.bodyIndex, (int)characterBody.skinIndex); } public static T CreateSkinDef<T>(string skinName, Sprite skinIcon, RendererInfo[] defaultRendererInfos, GameObject root, UnlockableDef unlockableDef = null) where T : SkinDef { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown SkinDefInfo skinDefInfo = default(SkinDefInfo); skinDefInfo.BaseSkins = Array.Empty<SkinDef>(); skinDefInfo.GameObjectActivations = (GameObjectActivation[])(object)new GameObjectActivation[0]; skinDefInfo.Icon = skinIcon; skinDefInfo.MeshReplacements = (MeshReplacement[])(object)new MeshReplacement[0]; skinDefInfo.MinionSkinReplacements = (MinionSkinReplacement[])(object)new MinionSkinReplacement[0]; skinDefInfo.Name = skinName; skinDefInfo.NameToken = skinName; skinDefInfo.ProjectileGhostReplacements = (ProjectileGhostReplacement[])(object)new ProjectileGhostReplacement[0]; skinDefInfo.RendererInfos = (RendererInfo[])(object)new RendererInfo[defaultRendererInfos.Length]; skinDefInfo.RootObject = root; skinDefInfo.UnlockableDef = unlockableDef; SkinDefInfo skinDefInfo2 = skinDefInfo; SkinDef.Awake += new hook_Awake(DoNothing); T val = ScriptableObject.CreateInstance<T>(); PopulateSkinDef(defaultRendererInfos, skinDefInfo2, (SkinDef)(object)val); SkinDef.Awake -= new hook_Awake(DoNothing); return val; } private static void PopulateSkinDef(RendererInfo[] rendererInfos, SkinDefInfo skinDefInfo, SkinDef skinDef) { skinDef.baseSkins = skinDefInfo.BaseSkins; skinDef.icon = skinDefInfo.Icon; skinDef.unlockableDef = skinDefInfo.UnlockableDef; skinDef.rootObject = skinDefInfo.RootObject; rendererInfos.CopyTo(skinDefInfo.RendererInfos, 0); skinDef.rendererInfos = skinDefInfo.RendererInfos; skinDef.gameObjectActivations = skinDefInfo.GameObjectActivations; skinDef.meshReplacements = skinDefInfo.MeshReplacements; skinDef.projectileGhostReplacements = skinDefInfo.ProjectileGhostReplacements; skinDef.minionSkinReplacements = skinDefInfo.MinionSkinReplacements; skinDef.nameToken = skinDefInfo.NameToken; ((Object)skinDef).name = skinDefInfo.Name; } public static T DuplicateScepterSkinDef<T>(T originalSkinDef, string newName = "_SCEPTER") where T : SkinDef { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown SkinDef.Awake += new hook_Awake(DoNothing); T val = ScriptableObject.CreateInstance<T>(); ((SkinDef)val).baseSkins = (SkinDef[])(object)new SkinDef[1] { originalSkinDef }; ((SkinDef)val).icon = ((SkinDef)originalSkinDef).icon; ((SkinDef)val).unlockableDef = ((SkinDef)originalSkinDef).unlockableDef; ((SkinDef)val).rootObject = ((SkinDef)originalSkinDef).rootObject; ((SkinDef)val).rendererInfos = ((SkinDef)originalSkinDef).rendererInfos; ((SkinDef)val).gameObjectActivations = ((SkinDef)originalSkinDef).gameObjectActivations; ((SkinDef)val).meshReplacements = ((SkinDef)originalSkinDef).meshReplacements; ((SkinDef)val).projectileGhostReplacements = ((SkinDef)originalSkinDef).projectileGhostReplacements; ((SkinDef)val).minionSkinReplacements = ((SkinDef)originalSkinDef).minionSkinReplacements; ((SkinDef)val).nameToken = ((SkinDef)originalSkinDef).nameToken + newName; ((Object)(object)val).name = ((Object)(object)originalSkinDef).name + newName; SkinDef.Awake -= new hook_Awake(DoNothing); return val; } private static void DoNothing(orig_Awake orig, SkinDef self) { } public static List<GameObject> createAllActivatedGameObjectsList(ChildLocator childLocator, params string[] allChildren) { List<GameObject> list = new List<GameObject>(); for (int i = 0; i < allChildren.Length; i++) { list.Add(childLocator.FindChildGameObject(allChildren[i])); } return list; } public static GameObjectActivation[] getGameObjectActivationsFromList(List<GameObject> allObjects, params int[] activatedChildren) { //IL_0016: 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_0039: Unknown result type (might be due to invalid IL or missing references) GameObjectActivation[] array = (GameObjectActivation[])(object)new GameObjectActivation[allObjects.Count]; for (int i = 0; i < allObjects.Count; i++) { array[i] = new GameObjectActivation { gameObject = allObjects[i], shouldActivate = activatedChildren.Contains(i) }; } return array; } internal static MeshReplacement[] getMeshReplacements(RendererInfo[] rendererinfos, params string[] meshes) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) List<MeshReplacement> list = new List<MeshReplacement>(); for (int i = 0; i < rendererinfos.Length; i++) { if (!string.IsNullOrEmpty(meshes[i])) { list.Add(new MeshReplacement { renderer = rendererinfos[i].renderer, mesh = Asset.LoadAsset<Mesh>(meshes[i]) }); } } return list.ToArray(); } } internal static class StaticValues { public const float swordDamageCoefficient = 2.8f; public const float gunDamageCoefficient = 4.2f; public const float bombDamageCoefficient = 16f; } internal static class Tokens { public static void GenerateTokens() { AddJoeTokens(); Language.PrintOutput("Joe.txt"); } private static void AddJoeTokens() { string text = "HABIBI_JOE_BODY_"; string text2 = "Faceless Joe is a fast-paced in-your-face melee character. Never seen any of those before.<color=#CCD3E0>" + Environment.NewLine + Environment.NewLine; text2 = text2 + "< ! > the Falling jump Attack is primarily useful for its wide range against multiple enemies." + Environment.NewLine + Environment.NewLine; text2 = text2 + "< ! > the Fireball does hefty damage, but knocks enemies back, making it more useful to finish enemies or get them away from you" + Environment.NewLine + Environment.NewLine; text2 = text2 + "< ! > Dash can be used freely to mitigate some damage from hits. use the charged melee version to get to enemies up in the air, then double jump to stay at their level." + Environment.NewLine + Environment.NewLine; text2 = text2 + "< ! > the ward of Tenticles will help you in a pinch, and enable you to stay in combat amidst a group of enemies" + Environment.NewLine + Environment.NewLine; string text3 = "..and so he left, jerrys' screams lingering in his hears."; string text4 = "..and so he vanished, his normals never recalculated outside."; string text5 = "Faceless Joe"; Language.Add(text + "NAME", te