Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SaitamaMod v0.1.1
SaitamaMod.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using ExtraSkillSlots; using KinematicCharacterController; using Microsoft.CodeAnalysis; using On.RoR2; using R2API; using RoR2; using RoR2.ConVar; using RoR2.Projectile; using RoR2.Skills; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets.ResourceLocators; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [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("SaitamaMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SaitamaMod")] [assembly: AssemblyTitle("SaitamaMod")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SaitamaMod { public static class ExerciseSystem { public static ConfigEntry<float> Duration; public static ConfigEntry<float> Cooldown; public static ConfigEntry<int> LimiterPerExercise; public static ConfigEntry<float> BonusSeconds; public static ConfigEntry<int> BonusMaxStacks; public static ConfigEntry<float> PushupsDamage; public static ConfigEntry<float> SquatsJump; public static ConfigEntry<float> PressRegen; public static BuffDef PushupsBuff; public static BuffDef SquatsBuff; public static BuffDef PressBuff; private static Sprite fallbackIcon; public static void Init(GameObject bodyPrefab, ConfigFile config, string pluginDir) { //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) Duration = config.Bind<float>("Exercises", "Duration", 2f, "Сколько секунд длится упражнение (Сайтама стоит на месте и не может атаковать)"); Cooldown = config.Bind<float>("Exercises", "Cooldown", 20f, "Перезарядка каждого упражнения, секунд"); LimiterPerExercise = config.Bind<int>("Exercises", "LimiterPerExercise", 1, "Сколько стаков Limiter даёт одно упражнение"); BonusSeconds = config.Bind<float>("Exercises", "BonusSeconds", 30f, "Сколько секунд держится побочный бонус упражнения"); BonusMaxStacks = config.Bind<int>("Exercises", "BonusMaxStacks", 10, "Максимум одновременных стаков бонуса каждого упражнения"); PushupsDamage = config.Bind<float>("Exercises", "PushupsDamagePerStack", 0.05f, "Отжимания: прибавка к урону за стак (0.05 = +5%)"); SquatsJump = config.Bind<float>("Exercises", "SquatsJumpPerStack", 0.04f, "Приседания: прибавка к высоте прыжка за стак (0.04 = +4%)"); PressRegen = config.Bind<float>("Exercises", "PressRegenPerStack", 1f, "Пресс: прибавка к регенерации за стак, ед. здоровья в секунду"); PushupsBuff = MakeBuff("SaitamaPushupsBonus", new Color(1f, 0.55f, 0.2f), pluginDir, "pushups_buff.png"); SquatsBuff = MakeBuff("SaitamaSquatsBonus", new Color(0.4f, 0.8f, 1f), pluginDir, "squats_buff.png"); PressBuff = MakeBuff("SaitamaPressBonus", new Color(0.5f, 1f, 0.5f), pluginDir, "press_buff.png"); bool flag = default(bool); ContentAddition.AddEntityState<ExerciseState>(ref flag); ContentAddition.AddEntityState<PushUpsState>(ref flag); ContentAddition.AddEntityState<SquatsState>(ref flag); ContentAddition.AddEntityState<PressState>(ref flag); ContentAddition.AddEntityState<ExerciseLockState>(ref flag); ExtraSkillLocator val = bodyPrefab.AddComponent<ExtraSkillLocator>(); string text = BonusSeconds.Value.ToString("0"); string text2 = BonusMaxStacks.Value.ToString(); val.extraFirst = AddExercise(bodyPrefab, pluginDir, "PushUps", "Push-ups", "Push-ups", "Saitama does a hundred push-ups. For 2 seconds he is vulnerable and cannot move or attack. Grants +1 Limiter and, for " + text + " s, a damage bonus: +" + Mathf.RoundToInt(PushupsDamage.Value * 100f) + "% per stack (up to " + text2 + " stacks).", "Сайтама делает сотню отжиманий. 2 секунды он уязвим и не может двигаться и атаковать. Даёт +1 к Limiter и на " + text + " с бонус к урону: +" + Mathf.RoundToInt(PushupsDamage.Value * 100f) + "% за стак (до " + text2 + " стаков).", "pushups.png", typeof(PushUpsState)); val.extraSecond = AddExercise(bodyPrefab, pluginDir, "Squats", "Squats", "Squats", "Saitama does a hundred squats. For 2 seconds he is vulnerable and cannot move or attack. Grants +1 Limiter and, for " + text + " s, a jump height bonus: +" + Mathf.RoundToInt(SquatsJump.Value * 100f) + "% per stack (up to " + text2 + " stacks).", "Сайтама делает сотню приседаний. 2 секунды он уязвим и не может двигаться и атаковать. Даёт +1 к Limiter и на " + text + " с бонус к высоте прыжка: +" + Mathf.RoundToInt(SquatsJump.Value * 100f) + "% за стак (до " + text2 + " стаков).", "squats.png", typeof(SquatsState)); val.extraThird = AddExercise(bodyPrefab, pluginDir, "Press", "Press", "Press", "Saitama does a hundred sit-ups. For 2 seconds he is vulnerable and cannot move or attack. Grants +1 Limiter and, for " + text + " s, a regeneration bonus: +" + PressRegen.Value.ToString("0.##") + " health per second per stack (up to " + text2 + " stacks).", "Сайтама делает сотню упражнений на пресс. 2 секунды он уязвим и не может двигаться и атаковать. Даёт +1 к Limiter и на " + text + " с бонус к регенерации: +" + PressRegen.Value.ToString("0.##") + " здоровья в секунду за стак (до " + text2 + " стаков).", "press.png", typeof(PressState)); } private static BuffDef MakeBuff(string name, Color color, string pluginDir, string iconFile) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) BuffDef def = ScriptableObject.CreateInstance<BuffDef>(); ((Object)def).name = name; def.buffColor = color; def.canStack = true; def.isDebuff = false; def.iconSprite = LimiterSystem.LoadIcon(pluginDir, iconFile); ContentAddition.AddBuffDef(def); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { if (!Object.op_Implicit((Object)(object)def.iconSprite)) { def.iconSprite = Buffs.Warbanner.iconSprite; } }); return def; } public static void ApplyBonuses(CharacterBody body, StatHookEventArgs args) { if (!((Object)(object)PushupsBuff == (Object)null)) { int buffCount = body.GetBuffCount(PushupsBuff); int buffCount2 = body.GetBuffCount(SquatsBuff); int buffCount3 = body.GetBuffCount(PressBuff); if (buffCount > 0) { args.damageMultAdd += (float)buffCount * PushupsDamage.Value; } if (buffCount2 > 0) { args.jumpPowerMultAdd += (float)buffCount2 * SquatsJump.Value; } if (buffCount3 > 0) { args.baseRegenAdd += (float)buffCount3 * PressRegen.Value; } } } private static GenericSkill AddExercise(GameObject body, string pluginDir, string id, string displayName, string displayNameRu, string description, string descriptionRu, string iconFile, Type stateType) { //IL_0099: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) string text = "SAITAMA_" + id.ToUpper() + "_NAME"; string text2 = "SAITAMA_" + id.ToUpper() + "_DESC"; LanguageAPI.Add(text, displayName); LanguageAPI.Add(text2, description); LanguageAPI.Add(text, displayNameRu, "ru"); LanguageAPI.Add(text2, descriptionRu, "ru"); SkillDef val = ScriptableObject.CreateInstance<SkillDef>(); val.skillName = "Saitama" + id; val.skillNameToken = text; val.skillDescriptionToken = text2; val.icon = LimiterSystem.LoadIcon(pluginDir, iconFile) ?? FallbackIcon(); val.activationState = new SerializableEntityStateType(stateType); val.activationStateMachineName = "Body"; val.baseMaxStock = 1; val.baseRechargeInterval = Cooldown.Value; val.rechargeStock = 1; val.requiredStock = 1; val.stockToConsume = 1; val.beginSkillCooldownOnSkillEnd = true; val.fullRestockOnAssign = true; val.interruptPriority = (InterruptPriority)1; val.isCombatSkill = false; val.canceledFromSprinting = false; val.cancelSprintingOnActivation = true; val.mustKeyPress = true; ContentAddition.AddSkillDef(val); SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>(); ((Object)val2).name = "SaitamaBody" + id + "Family"; Variant[] array = new Variant[1]; Variant val3 = new Variant { skillDef = val }; ((Variant)(ref val3)).viewableNode = new Node(val.skillNameToken, false, (Node)null); array[0] = val3; val2.variants = (Variant[])(object)array; ContentAddition.AddSkillFamily(val2); GenericSkill val4 = body.AddComponent<GenericSkill>(); val4.skillName = "Saitama" + id; typeof(GenericSkill).GetField("_skillFamily", BindingFlags.Instance | BindingFlags.NonPublic).SetValue(val4, val2); return val4; } private static Sprite FallbackIcon() { //IL_0032: 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) if (!Object.op_Implicit((Object)(object)fallbackIcon)) { Texture2D whiteTexture = Texture2D.whiteTexture; fallbackIcon = Sprite.Create(whiteTexture, new Rect(0f, 0f, (float)((Texture)whiteTexture).width, (float)((Texture)whiteTexture).height), new Vector2(0.5f, 0.5f)); } return fallbackIcon; } } public class ExerciseState : BaseState { private EntityStateMachine weaponMachine; protected virtual string AnimationName => null; protected virtual BuffDef BonusBuff => null; public override void OnEnter() { ((BaseState)this).OnEnter(); if (AnimationName != null) { SaitamaAnim.PlayClip(((EntityState)this).characterBody, AnimationName, ExerciseSystem.Duration.Value, restart: true); } weaponMachine = EntityStateMachine.FindByCustomName(((EntityState)this).gameObject, "Weapon"); if (Object.op_Implicit((Object)(object)weaponMachine) && ((EntityState)this).isAuthority) { weaponMachine.SetInterruptState((EntityState)(object)new ExerciseLockState(), (InterruptPriority)7); } } public override void FixedUpdate() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((EntityState)this).characterMotor.moveDirection = Vector3.zero; } if (((EntityState)this).isAuthority && ((EntityState)this).fixedAge >= ExerciseSystem.Duration.Value) { ((EntityState)this).outer.SetNextStateToMain(); } } public override void OnExit() { if (Object.op_Implicit((Object)(object)weaponMachine) && ((EntityState)this).isAuthority) { weaponMachine.SetNextStateToMain(); } if (AnimationName != null) { SaitamaAnim.StopClip(((EntityState)this).characterBody); } if (NetworkServer.active && ((EntityState)this).fixedAge >= ExerciseSystem.Duration.Value - 0.1f) { SaitamaLimiterController saitamaLimiterController = (Object.op_Implicit((Object)(object)((EntityState)this).characterBody) ? ((Component)((EntityState)this).characterBody).GetComponent<SaitamaLimiterController>() : null); if (Object.op_Implicit((Object)(object)saitamaLimiterController)) { saitamaLimiterController.AddLimiter(ExerciseSystem.LimiterPerExercise.Value); } BuffDef bonusBuff = BonusBuff; if ((Object)(object)bonusBuff != (Object)null && Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { ((EntityState)this).characterBody.AddTimedBuff(bonusBuff, ExerciseSystem.BonusSeconds.Value, ExerciseSystem.BonusMaxStacks.Value); } } ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)7; } } public class PushUpsState : ExerciseState { protected override string AnimationName => "Pushups"; protected override BuffDef BonusBuff => ExerciseSystem.PushupsBuff; } public class SquatsState : ExerciseState { protected override string AnimationName => "Squats"; protected override BuffDef BonusBuff => ExerciseSystem.SquatsBuff; } public class PressState : ExerciseState { protected override string AnimationName => "Situps"; protected override BuffDef BonusBuff => ExerciseSystem.PressBuff; } public class ExerciseLockState : BaseState { public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)7; } } public static class LeapSystem { public static ConfigEntry<float> Cooldown; public static ConfigEntry<float> Crouch; public static ConfigEntry<float> Distance; public static ConfigEntry<float> DistancePerStack; public static ConfigEntry<float> MaxDistance; public static ConfigEntry<float> DashSeconds; public static ConfigEntry<float> DashMaxSpeed; public static ConfigEntry<float> DashSpeedPerStack; public static ConfigEntry<float> RamDamage; public static ConfigEntry<float> RamDamagePerStack; public static ConfigEntry<float> RamRadius; public static ConfigEntry<float> RamForce; public static ConfigEntry<int> WallKicks; public static ConfigEntry<float> WallKickReach; public static ConfigEntry<float> WallKickSpeed; public static ConfigEntry<float> WallKickCooldown; public static ConfigEntry<int> JoggingPerLeap; public static ConfigEntry<int> JoggingPerRebound; public static SkillDef ReboundSkill; public static void Init(SkillLocator locator, string pluginDir, ConfigFile config) { //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) Cooldown = config.Bind<float>("Leap", "CooldownSeconds", 8f, "Перезарядка, секунд (начинается после приземления)"); Crouch = config.Bind<float>("Leap", "CrouchSeconds", 0.25f, "Короткая подготовка перед прыжком, секунд"); Distance = config.Bind<float>("Leap", "DashDistance", 20f, "Базовая дальность мощного прыжка, метров"); DistancePerStack = config.Bind<float>("Leap", "DashDistancePerLimiterStack", 0.15f, "Прибавка дальности за стак Limiter, метров"); MaxDistance = config.Bind<float>("Leap", "DashDistanceLimit", 0f, "Потолок дальности прыжка, метров (0 = без ограничения, дальность растёт вместе с Limiter)"); DashMaxSpeed = config.Bind<float>("Leap", "DashMaxSpeedCap", 200f, "Потолок скорости рывка, м/с (бонус от Limiter выше него не поднимает). Если дальность больше, рывок просто длится дольше"); DashSpeedPerStack = config.Bind<float>("Leap", "DashSpeedBonusPerLimiterStack", 0.002f, "Прибавка скорости рывка за стак Limiter (0.002 = +0.2%: на 500 стаках рывок вдвое быстрее, на 1000 втрое). Выше потолка DashMaxSpeedCap скорость не растёт"); DashSeconds = config.Bind<float>("Leap", "DashSeconds", 0.4f, "Сколько секунд длится сам рывок (дальше Сайтама падает по дуге)"); RamDamage = config.Bind<float>("Leap", "RamDamageCoefficient", 2.5f, "Урон при касании врага (2.5 = 250% урона персонажа), каждому врагу один раз"); RamDamagePerStack = config.Bind<float>("Leap", "RamDamagePerLimiterStack", 0.015f, "Прибавка урона за стак Limiter"); RamRadius = config.Bind<float>("Leap", "ContactRadius", 2.5f, "Радиус столкновения вокруг Сайтамы, метров"); RamForce = config.Bind<float>("Leap", "RamForce", 2500f, "Сила, с которой враги отбрасываются в стороны"); WallKicks = config.Bind<int>("Leap", "WallKicks", 3, "Сколько раз за прыжок можно использовать Отскок (0 = выключено). Во время прыжка Shift превращается в способность Отскок: оттолкнуться от стены, земли или потолка"); WallKickReach = config.Bind<float>("Leap", "WallKickRange", 9f, "На каком расстоянии от поверхности можно оттолкнуться, метров"); JoggingPerLeap = config.Bind<int>("Leap", "JoggingPointsPerLeap", 20, "Очков бега за каждый мощный прыжок (100 очков = +1 Limiter)"); JoggingPerRebound = config.Bind<int>("Leap", "JoggingPointsPerRebound", 5, "Очков бега за каждый Отскок"); WallKickCooldown = config.Bind<float>("Leap", "WallKickCooldownSeconds", 1f, "Перезарядка Отскока между толчками, секунд"); WallKickSpeed = config.Bind<float>("Leap", "WallKickSpeedMultiplier", 0.85f, "Скорость толчка относительно первого рывка (1 = такая же)"); bool flag = default(bool); ContentAddition.AddEntityState<SaitamaLeapState>(ref flag); ContentAddition.AddEntityState<SaitamaReboundState>(ref flag); ReboundSkill = SaitamaSkillSystem.MakeSkill("Rebound", "Rebound", ReboundDesc(ru: false), "rebound.png", pluginDir, typeof(SaitamaReboundState), "Weapon", WallKickCooldown.Value, mustKeyPress: true, cancelSprint: false, (InterruptPriority)0, cooldownOnEnd: false, "Отскок", ReboundDesc(ru: true)); SkillDef def = SaitamaSkillSystem.MakeSkill("Leap", "Leap", Desc(0, ru: false), "leap.png", pluginDir, typeof(SaitamaLeapState), "Body", Cooldown.Value, mustKeyPress: true, cancelSprint: false, (InterruptPriority)1, cooldownOnEnd: true, "Leap", Desc(0, ru: true)); SaitamaSkillSystem.SetSlot(locator.utility, "SaitamaBodyUtilityFamily", def); CharacterBody component = ((Component)locator).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { component.bodyFlags = (BodyFlags)(component.bodyFlags | 1); } } private static string N(float v) { return v.ToString("0.##", CultureInfo.InvariantCulture); } private static string Pct(float v) { return Mathf.Round(v * 100f).ToString("0", CultureInfo.InvariantCulture) + "%"; } public static float DistanceAt(int stacks) { float num = Distance.Value + (float)stacks * DistancePerStack.Value; return (MaxDistance.Value > 0f) ? Mathf.Min(MaxDistance.Value, num) : num; } public static float RamAt(int stacks) { return RamDamage.Value + (float)stacks * RamDamagePerStack.Value; } public static string ReboundDesc(bool ru) { return ru ? ("Доступно во время <style=cIsUtility>Мощного прыжка</style>. Оттолкнитесь от ближайшей поверхности (стены, земли, потолка в пределах " + N(WallKickReach.Value) + " м) и полетите туда, куда смотрите. До " + WallKicks.Value + " раз за прыжок.") : ("Available during <style=cIsUtility>Power Leap</style>. Push off the nearest surface (wall, ground or ceiling within " + N(WallKickReach.Value) + " m) and fly where you are looking. Up to " + WallKicks.Value + " times per leap."); } public static string Desc(int stacks, bool ru) { return ru ? ("<style=cIsUtility>Мощный прыжок</style> на " + N(DistanceAt(stacks)) + " м туда, куда вы смотрите: вперёд, вверх или в землю. Сайтама не проходит сквозь врагов: те, в кого он врезается, получают <style=cIsDamage>" + Pct(RamAt(stacks)) + "</style> урона. Чем больше стаков Limiter, тем дальше прыжок. Во время прыжка Shift заменяется способностью <style=cIsUtility>Отскок</style>. Перезарядка: " + N(Cooldown.Value) + " с.") : ("<style=cIsUtility>Power Leap</style> of " + N(DistanceAt(stacks)) + " m in the direction you look: forward, up or into the ground. Saitama doesn't pass through enemies: those he crashes into take <style=cIsDamage>" + Pct(RamAt(stacks)) + "</style> damage. The more Limiter stacks, the farther the leap. While leaping, Shift is replaced by <style=cIsUtility>Rebound</style>. Cooldown: " + N(Cooldown.Value) + " s."); } public static void Strike(CharacterBody body, Vector3 center, float radius, float damage, bool crit, Vector3 flyDirection, float force, HashSet<HealthComponent> once) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Expected O, but got Unknown //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //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) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)body)) { return; } TeamIndex val = (TeamIndex)((!Object.op_Implicit((Object)(object)body.teamComponent)) ? 1 : ((int)body.teamComponent.teamIndex)); SphereSearch val2 = new SphereSearch { origin = center, radius = radius, mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask, queryTriggerInteraction = (QueryTriggerInteraction)0 }; val2.RefreshCandidates(); val2.FilterCandidatesByHurtBoxTeam(TeamMask.GetEnemyTeams(val)); val2.FilterCandidatesByDistinctHurtBoxEntities(); List<HurtBox> list = new List<HurtBox>(); val2.GetHurtBoxes(list); GameObject prefab = FxSystem.GetPrefab(FxSystem.HitEffectPath.Value); foreach (HurtBox item in list) { if (!Object.op_Implicit((Object)(object)item) || !Object.op_Implicit((Object)(object)item.healthComponent) || !item.healthComponent.alive) { continue; } HealthComponent healthComponent = item.healthComponent; if (once == null || once.Add(healthComponent)) { Vector3 val3 = ((Component)healthComponent).transform.position - center; Vector3 val4 = ((Vector3)(ref flyDirection)).normalized + Vector3.up * 0.3f; Vector3 force2 = ((Vector3)(ref val4)).normalized * force; DamageInfo val5 = new DamageInfo { attacker = ((Component)body).gameObject, inflictor = ((Component)body).gameObject, damage = damage, crit = crit, force = force2, position = ((Component)item).transform.position, procCoefficient = 1f, damageColorIndex = (DamageColorIndex)0 }; healthComponent.TakeDamage(val5); GlobalEventManager.instance.OnHitEnemy(val5, ((Component)healthComponent).gameObject); GlobalEventManager.instance.OnHitAll(val5, ((Component)healthComponent).gameObject); if (Object.op_Implicit((Object)(object)prefab)) { EffectManager.SimpleImpactEffect(prefab, val5.position, -((Vector3)(ref force2)).normalized, true); } } } } } public class SaitamaReboundState : BaseState { public override void OnEnter() { ((BaseState)this).OnEnter(); if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).skillLocator) && Object.op_Implicit((Object)(object)((EntityState)this).skillLocator.utility)) { ((EntityState)this).skillLocator.utility.AddOneStock(); } ((EntityState)this).outer.SetNextStateToMain(); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)0; } } public class SaitamaLeapState : BaseState { private enum Phase { Crouch, Dash, Fall } private Phase phase; private int stacks; private float phaseTime; private float airTime; private float speed; private float dashSeconds; private Vector3 direction; private Vector3 lastPos; private Vector3 startPos; private string endReason = ""; private bool crit; private int kicksLeft; private Vector3 trailLast; private float trailTimer; private bool trailInit; private bool lastPressed = true; private bool overrideSet; private float sinceKick = 999f; private readonly HashSet<HealthComponent> ramHit = new HashSet<HealthComponent>(); private bool lastM2; private bool lastR; public override void OnEnter() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); stacks = ((EntityState)this).characterBody.GetBuffCount(LimiterSystem.LimiterBuff); crit = ((BaseState)this).RollCrit(); float num = LeapSystem.DistanceAt(stacks); float num2 = 1f + (float)stacks * Mathf.Max(0f, LeapSystem.DashSpeedPerStack.Value); float num3 = Mathf.Max(10f, LeapSystem.DashMaxSpeed.Value); dashSeconds = Mathf.Max(new float[3] { 0.1f, LeapSystem.DashSeconds.Value / num2, num / (0.8f * num3) }); speed = num / dashSeconds / 0.8f; phase = Phase.Crouch; kicksLeft = Mathf.Max(0, LeapSystem.WallKicks.Value); Ray aimRay = ((BaseState)this).GetAimRay(); direction = ((Ray)(ref aimRay)).direction; ((BaseState)this).StartAimMode(0.5f, false); SaitamaAnim.PlayClip(((EntityState)this).characterBody, "LeapCrouch", LeapSystem.Crouch.Value, restart: true); } public override void FixedUpdate() { //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) ((EntityState)this).FixedUpdate(); phaseTime += Time.fixedDeltaTime; sinceKick += Time.fixedDeltaTime; if (phase != Phase.Crouch) { TrailUpdate(); } if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).inputBank)) { bool down = ((EntityState)this).inputBank.skill3.down; bool flag = down && !lastPressed; lastPressed = down; if (flag && phase != Phase.Crouch && RequestKick() && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.skillLocator) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.skillLocator.utility) && ((EntityState)this).characterBody.skillLocator.utility.stock > 0) { ((EntityState)this).characterBody.skillLocator.utility.DeductStock(1); } } if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).inputBank) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.skillLocator)) { UseAbilities(); } switch (phase) { case Phase.Crouch: direction = (Object.op_Implicit((Object)(object)((EntityState)this).inputBank) ? ((EntityState)this).inputBank.aimDirection : direction); if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { Vector3 velocity2 = ((EntityState)this).characterMotor.velocity; ((EntityState)this).characterMotor.velocity = new Vector3(0f, Mathf.Min(0f, velocity2.y), 0f); } if (phaseTime >= LeapSystem.Crouch.Value) { Launch(); } break; case Phase.Dash: airTime += Time.fixedDeltaTime; if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { float num2 = Mathf.Clamp01(phaseTime / dashSeconds); float num3 = ((num2 < 0.5f) ? 1f : Mathf.Lerp(1f, 0.3f, Mathf.SmoothStep(0f, 1f, (num2 - 0.5f) * 2f))); ((EntityState)this).characterMotor.velocity = direction * speed * num3; if (phaseTime >= dashSeconds) { phase = Phase.Fall; phaseTime = 0f; } else if (airTime > 0.1f && ((EntityState)this).characterMotor.isGrounded && direction.y < -0.25f) { Finish(); } else if (phaseTime > 0.15f) { Vector3 val = ((EntityState)this).transform.position - lastPos; if (((Vector3)(ref val)).magnitude < speed * num3 * Time.fixedDeltaTime * 0.3f) { phase = Phase.Fall; phaseTime = 0f; endReason = "рывок оборвался (препятствие)"; ((EntityState)this).characterMotor.velocity = Vector3.zero; } } lastPos = ((EntityState)this).transform.position; } Ram(); break; case Phase.Fall: airTime += Time.fixedDeltaTime; if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { Vector3 velocity = ((EntityState)this).characterMotor.velocity; float num = Mathf.Max(0f, 1f - 2.5f * Time.fixedDeltaTime); velocity.x *= num; velocity.z *= num; if (velocity.y > 0f) { velocity.y *= num; } ((EntityState)this).characterMotor.velocity = velocity; if (((EntityState)this).characterMotor.isGrounded || airTime > dashSeconds + 12f) { Finish(); } } Ram(); break; } } private void TrailUpdate() { //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_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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((EntityState)this).transform.position; if (!trailInit) { trailInit = true; trailLast = position; return; } trailTimer += Time.fixedDeltaTime; if (!(trailTimer < 0.04f)) { Vector3 val = position - trailLast; float num = ((Vector3)(ref val)).magnitude / trailTimer; trailLast = position; trailTimer = 0f; if (!(num < 15f)) { SaitamaParticles.Trail(((EntityState)this).characterBody.corePosition, val, num); } } } private void UseAbilities() { SkillLocator skillLocator = ((EntityState)this).characterBody.skillLocator; bool down = ((EntityState)this).inputBank.skill2.down; bool down2 = ((EntityState)this).inputBank.skill4.down; try { if (((EntityState)this).inputBank.skill1.down && Object.op_Implicit((Object)(object)skillLocator.primary)) { skillLocator.primary.ExecuteIfReady(); } if (down && !lastM2 && Object.op_Implicit((Object)(object)skillLocator.secondary)) { skillLocator.secondary.ExecuteIfReady(); } if (down2 && !lastR && Object.op_Implicit((Object)(object)skillLocator.special)) { skillLocator.special.ExecuteIfReady(); } } catch (Exception ex) { LimiterSystem.Log.LogWarning((object)("Leap: способности: " + ex.Message)); } lastM2 = down; lastR = down2; } private bool FindSurface(out Vector3 point, out Vector3 normal) { //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_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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_0095: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) point = Vector3.zero; normal = Vector3.up; float num = Mathf.Max(0.5f, LeapSystem.WallKickReach.Value); Vector3 corePosition = ((EntityState)this).characterBody.corePosition; float num2 = float.MaxValue; bool result = false; RaycastHit val2 = default(RaycastHit); for (int i = 0; i < 26; i++) { int num3 = i % 3 - 1; int num4 = i / 3 % 3 - 1; int num5 = i / 9 - 1; if (num3 != 0 || num4 != 0 || num5 != 0) { Vector3 val = new Vector3((float)num3, (float)num4, (float)num5); Vector3 normalized = ((Vector3)(ref val)).normalized; if (Physics.SphereCast(corePosition, 0.4f, normalized, ref val2, num, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) && ((RaycastHit)(ref val2)).distance < num2) { num2 = ((RaycastHit)(ref val2)).distance; point = ((RaycastHit)(ref val2)).point; normal = ((RaycastHit)(ref val2)).normal; result = true; } } } return result; } public bool RequestKick() { if (phase == Phase.Crouch || kicksLeft <= 0 || sinceKick < LeapSystem.WallKickCooldown.Value || airTime < 0.1f) { return false; } return TryWallKick(); } private bool TryWallKick() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) if (!FindSurface(out var point, out var normal)) { return false; } Vector3 val = ((EntityState)this).inputBank.aimDirection; float num = Vector3.Dot(val, normal); if (num < 0.2f) { Vector3 val2 = val + normal * (0.2f - num); val = ((Vector3)(ref val2)).normalized; } direction = val; kicksLeft--; sinceKick = 0f; GiveJogging(LeapSystem.JoggingPerRebound.Value); phase = Phase.Dash; phaseTime = 0f; speed *= Mathf.Max(0.1f, LeapSystem.WallKickSpeed.Value); lastPos = ((EntityState)this).transform.position; endReason = ""; if (Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f); ((EntityState)this).characterMotor.velocity = direction * speed; } SaitamaAnim.PlayClip(((EntityState)this).characterBody, "LeapDash", 10f, restart: true); FxSystem.PlaySoundAt("leap", point, 60f, ((EntityState)this).isAuthority); FxSystem.Shake(point, 0.3f, 0.2f); SaitamaParticles.DustRing(point + normal * 0.2f, 10, 4f, 0.9f, SaitamaParticles.DustColor(0.6f)); return true; } private void Launch() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_01aa: Unknown result type (might be due to invalid IL or missing references) phase = Phase.Dash; phaseTime = 0f; if (direction.y > -0.25f && direction.y < 0.12f) { Vector3 val = new Vector3(direction.x, 0.12f, direction.z); direction = ((Vector3)(ref val)).normalized; } lastPos = ((EntityState)this).transform.position; startPos = ((EntityState)this).transform.position; GiveJogging(LeapSystem.JoggingPerLeap.Value); if (kicksLeft > 0 && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.skillLocator) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.skillLocator.utility) && Object.op_Implicit((Object)(object)LeapSystem.ReboundSkill)) { ((EntityState)this).characterBody.skillLocator.utility.SetSkillOverride((object)this, LeapSystem.ReboundSkill, (SkillOverridePriority)4); overrideSet = true; } SaitamaAnim.PlayClip(((EntityState)this).characterBody, "LeapDash", 10f, restart: true); FxSystem.PlaySoundAt("leap", ((EntityState)this).characterBody.corePosition, 60f, ((EntityState)this).isAuthority); FxSystem.Shake(((EntityState)this).characterBody.corePosition, 0.4f, 0.25f); if (((EntityState)this).isAuthority && Object.op_Implicit((Object)(object)((EntityState)this).characterMotor)) { ((BaseCharacterController)((EntityState)this).characterMotor).Motor.ForceUnground(0.1f); ((EntityState)this).characterMotor.velocity = direction * speed; } } private void Finish() { ((EntityState)this).outer.SetNextStateToMain(); } private void GiveJogging(int points) { if (NetworkServer.active && points > 0 && Object.op_Implicit((Object)(object)((EntityState)this).characterBody)) { SaitamaLimiterController component = ((Component)((EntityState)this).characterBody).GetComponent<SaitamaLimiterController>(); if (Object.op_Implicit((Object)(object)component)) { component.AddJoggingPoints(points); } } } private void Ram() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { Vector3 flyDirection = ((((Vector3)(ref direction)).sqrMagnitude > 0.01f) ? ((Vector3)(ref direction)).normalized : Vector3.forward); float damage = base.damageStat * LeapSystem.RamAt(stacks); LeapSystem.Strike(((EntityState)this).characterBody, ((EntityState)this).characterBody.corePosition, LeapSystem.RamRadius.Value, damage, crit, flyDirection, LeapSystem.RamForce.Value, ramHit); } } public override void OnExit() { if (overrideSet && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.skillLocator) && Object.op_Implicit((Object)(object)((EntityState)this).characterBody.skillLocator.utility)) { GenericSkill utility = ((EntityState)this).characterBody.skillLocator.utility; utility.UnsetSkillOverride((object)this, LeapSystem.ReboundSkill, (SkillOverridePriority)4); if (((EntityState)this).isAuthority) { try { int num = 5; while (utility.stock > 0 && num-- > 0) { utility.DeductStock(1); } utility.rechargeStopwatch = 0f; } catch (Exception ex) { LimiterSystem.Log.LogWarning((object)("Leap: не удалось запустить перезарядку: " + ex.Message)); } } } SaitamaAnim.StopClip(((EntityState)this).characterBody); ((EntityState)this).OnExit(); } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)5; } } public static class SaitamaAudio { private static readonly Dictionary<string, AudioClip> clips = new Dictionary<string, AudioClip>(); private static readonly HashSet<string> warned = new HashSet<string>(); private static GameObject musicObject; private static AudioSource musicSource; private static AudioType TypeFor(string path) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) string text = Path.GetExtension(path).ToLowerInvariant(); if (text == ".mp3") { return (AudioType)13; } if (text == ".ogg") { return (AudioType)14; } return (AudioType)20; } private static AudioClip Load(string path) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Invalid comparison between Unknown and I4 if (clips.TryGetValue(path, out var value)) { return value; } AudioClip val = null; try { if (File.Exists(path)) { UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(new Uri(path).AbsoluteUri, TypeFor(path)); try { UnityWebRequestAsyncOperation val2 = audioClip.SendWebRequest(); while (!((AsyncOperation)val2).isDone) { } if ((int)audioClip.result == 1) { val = DownloadHandlerAudioClip.GetContent(audioClip); } else if (warned.Add(path)) { LimiterSystem.Log.LogWarning((object)("Звук не загрузился: " + path + " (" + audioClip.error + ")")); } } finally { ((IDisposable)audioClip)?.Dispose(); } } } catch (Exception ex) { if (warned.Add(path)) { LimiterSystem.Log.LogWarning((object)("Звук не загрузился: " + path + " (" + ex.Message + ")")); } } clips[path] = val; return val; } public static void PlayOneShot(string path, float gain) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown AudioClip val = Load(path); if (Object.op_Implicit((Object)(object)val) && !(gain <= 0f)) { GameObject val2 = new GameObject("SaitamaSound"); AudioSource val3 = val2.AddComponent<AudioSource>(); val3.spatialBlend = 0f; val3.volume = Mathf.Clamp01(gain); val3.clip = val; val3.Play(); Object.Destroy((Object)(object)val2, val.length + 0.5f); } } public static bool PlayMusic(string path, float gain) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown AudioClip val = Load(path); if (!Object.op_Implicit((Object)(object)val)) { return false; } StopMusic(); musicObject = new GameObject("SaitamaMusic"); musicSource = musicObject.AddComponent<AudioSource>(); musicSource.spatialBlend = 0f; musicSource.loop = false; musicSource.clip = val; musicSource.volume = Mathf.Clamp01(gain); musicSource.Play(); return true; } public static void SetMusicVolume(float gain) { if (Object.op_Implicit((Object)(object)musicSource)) { musicSource.volume = Mathf.Clamp01(gain); } } public static void StopMusic() { if (Object.op_Implicit((Object)(object)musicObject)) { Object.Destroy((Object)(object)musicObject); } musicObject = null; musicSource = null; } } public class DustLines : MonoBehaviour { private static readonly string[] ShaderNames = new string[4] { "Sprites/Default", "Legacy Shaders/Particles/Alpha Blended", "Particles/Standard Unlit", "UI/Default" }; private static Material material; private static string materialShader; private static bool materialTried; private static bool warned; private static bool logged; private const float PuffSpacing = 0.9f; private const float Speed = 100f; private ParticleSystem system; private ParticleSystem debris; private static Material debrisMaterial; private Vector3 start; private Vector3 heading; private Vector3 right; private float tan; private float range; private float startTime; private float emitted; private float scale; private float seconds; public static void Spawn(Vector3 origin, Vector3 direction, float range, float fullAngle) { //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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) if (FxSystem.ConeIndicatorEnabled == null || !FxSystem.ConeIndicatorEnabled.Value) { return; } try { Vector3 val = Vector3.ProjectOnPlane(direction, Vector3.up); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Cross(Vector3.up, val); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num = Mathf.Tan(Mathf.Clamp(fullAngle * 0.5f, 1f, 85f) * (MathF.PI / 180f)); float num2 = ((FxSystem.DustScale != null) ? FxSystem.DustScale.Value : 1.5f); float num3 = Mathf.Max(0.3f, FxSystem.ConeIndicatorSeconds.Value); Material val3 = GetMaterial(); if ((Object)(object)val3 == (Object)null) { SpawnFallback(origin, val, normalized, num, range); return; } GameObject val4 = new GameObject("SaitamaDust"); ParticleSystem val5 = val4.AddComponent<ParticleSystem>(); val5.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val5.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 5000; ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(num3); EmissionModule emission = val5.emission; ((EmissionModule)(ref emission)).enabled = false; ShapeModule shape = val5.shape; ((ShapeModule)(ref shape)).enabled = false; Gradient val6 = new Gradient(); val6.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[4] { new GradientAlphaKey(0f, 0f), new GradientAlphaKey(1f, 0.06f), new GradientAlphaKey(1f, 0.65f), new GradientAlphaKey(0f, 1f) }); ColorOverLifetimeModule colorOverLifetime = val5.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val6); SizeOverLifetimeModule sizeOverLifetime = val5.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.Linear(0f, 0.6f, 1f, 1.4f)); ParticleSystemRenderer component = val4.GetComponent<ParticleSystemRenderer>(); ((Renderer)component).sharedMaterial = val3; component.renderMode = (ParticleSystemRenderMode)0; val5.Play(); DustLines dustLines = val4.AddComponent<DustLines>(); dustLines.system = val5; dustLines.debris = CreateDebris(val4); dustLines.start = GroundPoint(origin); dustLines.heading = val; dustLines.right = normalized; dustLines.tan = num; dustLines.range = range; dustLines.scale = num2; dustLines.seconds = num3; dustLines.startTime = Time.time; dustLines.emitted = 1f; if (!logged) { logged = true; } Object.Destroy((Object)(object)val4, range / 100f + num3 + 1f); } catch (Exception ex) { if (!warned) { warned = true; LimiterSystem.Log.LogWarning((object)("Линии пыли не показаны: " + ex.Message)); } } } private static Material GetMaterial() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown if (materialTried) { return material; } materialTried = true; Shader shader = SaitamaParticles.GetShader(); if (Object.op_Implicit((Object)(object)shader)) { material = new Material(shader); material.mainTexture = (Texture)(object)MakePuffTexture(); materialShader = ((Object)shader).name; return material; } LimiterSystem.Log.LogWarning((object)"Пыль: не найден подходящий шейдер, используется запасной эффект игры"); return null; } private static Texture2D MakePuffTexture() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false); ((Texture)val).wrapMode = (TextureWrapMode)1; Color32[] array = (Color32[])(object)new Color32[16384]; for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { float num = ((float)j - 64f) / 64f; float num2 = ((float)i - 64f) / 64f; float num3 = Mathf.Atan2(num2, num); float num4 = Mathf.Sqrt(num * num + num2 * num2); float num5 = 0.72f + 0.1f * Mathf.Sin(num3 * 3f + 0.7f) + 0.07f * Mathf.Sin(num3 * 5f + 2.1f) + 0.05f * Mathf.Sin(num3 * 8f + 4.3f); float num6 = Mathf.Clamp01((num5 - num4) * 25f); array[i * 128 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)Mathf.RoundToInt(num6 * 255f)); } } val.SetPixels32(array); val.Apply(); return val; } private static Color DirtColor() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) float num = Random.Range(0.85f, 1.2f); return new Color(0.17f * num, 0.18f * num, 0.15f * num, 1f); } private static ParticleSystem CreateDebris(GameObject parent) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0086: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_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_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown try { if (!Object.op_Implicit((Object)(object)debrisMaterial)) { Shader shader = SaitamaParticles.GetShader(); if (!Object.op_Implicit((Object)(object)shader)) { return null; } debrisMaterial = new Material(shader) { mainTexture = (Texture)(object)MakeChunkTexture(), hideFlags = (HideFlags)61 }; } GameObject val = new GameObject("SaitamaDebris"); val.transform.SetParent(parent.transform, false); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); val2.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val2.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 4000; ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(2.2f); EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).enabled = false; ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).enabled = false; RotationOverLifetimeModule rotationOverLifetime = val2.rotationOverLifetime; ((RotationOverLifetimeModule)(ref rotationOverLifetime)).enabled = true; ((RotationOverLifetimeModule)(ref rotationOverLifetime)).z = new MinMaxCurve(-6f, 6f); ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); ((Renderer)component).sharedMaterial = debrisMaterial; component.renderMode = (ParticleSystemRenderMode)0; val2.Play(); return val2; } catch (Exception) { return null; } } private void EmitDebris(Vector3 p) { //IL_0022: 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_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)debris)) { for (int i = 0; i < 3; i++) { EmitParams val = default(EmitParams); ((EmitParams)(ref val)).position = p + new Vector3(Random.Range(-0.8f, 0.8f), 0.5f, Random.Range(-0.8f, 0.8f)); ((EmitParams)(ref val)).velocity = new Vector3(Random.Range(-4f, 4f), Random.Range(5f, 13f), Random.Range(-4f, 4f)); ((EmitParams)(ref val)).startSize = Random.Range(0.18f, 0.5f) * Mathf.Max(0.6f, scale); ((EmitParams)(ref val)).startLifetime = Random.Range(0.8f, 1.5f); ((EmitParams)(ref val)).startColor = Color32.op_Implicit(DirtColor()); ((EmitParams)(ref val)).rotation = Random.Range(0f, 360f); EmitParams val2 = val; debris.Emit(val2, 1); } } } private static Texture2D MakeChunkTexture() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(32, 32, (TextureFormat)4, false); ((Texture)val).wrapMode = (TextureWrapMode)1; Color32[] array = (Color32[])(object)new Color32[1024]; float[] array2 = new float[5] { 0.95f, 0.6f, 0.85f, 0.5f, 0.9f }; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num = ((float)j - 16f) / 16f; float num2 = ((float)i - 16f) / 16f; float num3 = Mathf.Atan2(num2, num) + MathF.PI; float num4 = num3 / (MathF.PI * 2f) * (float)array2.Length; int num5 = Mathf.FloorToInt(num4) % array2.Length; int num6 = (num5 + 1) % array2.Length; float num7 = Mathf.Lerp(array2[num5], array2[num6], num4 - Mathf.Floor(num4)); float num8 = Mathf.Sqrt(num * num + num2 * num2); float num9 = Mathf.Clamp01((num7 - num8) * 12f); array[i * 32 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)Mathf.RoundToInt(num9 * 255f)); } } val.SetPixels32(array); val.Apply(); return val; } private static Vector3 GroundPoint(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_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_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(position + Vector3.up * 2f, Vector3.down, ref val, 20f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask))) { return ((RaycastHit)(ref val)).point; } return position + Vector3.down * 1.2f; } private Vector3 EdgePoint(float forward, float side) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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_002a: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) float num = (forward + 2.5f) * tan * side; Vector3 val = start + heading * forward + right * num; return GroundPoint(val + Vector3.up * 3f); } private void Update() { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)system)) { return; } float num = Mathf.Min(range, (Time.time - startTime) * 100f); while (emitted < num) { emitted += 0.9f; for (int i = -1; i <= 1; i += 2) { Vector3 val = EdgePoint(emitted, i); for (int j = 0; j < 2; j++) { EmitParams val2 = default(EmitParams); ((EmitParams)(ref val2)).position = val + new Vector3(Random.Range(-0.6f, 0.6f), 0.6f + (float)j * 0.5f, Random.Range(-0.6f, 0.6f)); ((EmitParams)(ref val2)).velocity = new Vector3(Random.Range(-0.5f, 0.5f), Random.Range(0.4f, 1.2f), Random.Range(-0.5f, 0.5f)); ((EmitParams)(ref val2)).startSize = Random.Range(3.5f, 6f) * scale * (1f + emitted / Mathf.Max(1f, range) * 0.4f); ((EmitParams)(ref val2)).startLifetime = Random.Range(0.7f, 1f) * seconds; ((EmitParams)(ref val2)).startColor = Color32.op_Implicit(DirtColor()); ((EmitParams)(ref val2)).rotation = Random.Range(0f, 360f); EmitParams val3 = val2; system.Emit(val3, 1); } EmitDebris(val); } } } private static void SpawnFallback(Vector3 origin, Vector3 heading, Vector3 right, float tan, float range) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00b4: Expected O, but got Unknown if (!NetworkServer.active) { return; } GameObject prefab = FxSystem.GetPrefab(FxSystem.HitEffectPath.Value); if (!Object.op_Implicit((Object)(object)prefab)) { return; } Vector3 val = GroundPoint(origin); for (float num = 2f; num <= range; num += 3f) { for (int i = -1; i <= 1; i += 2) { float num2 = (num + 2.5f) * tan * (float)i; Vector3 origin2 = GroundPoint(val + heading * num + right * num2 + Vector3.up * 3f); EffectManager.SpawnEffect(prefab, new EffectData { origin = origin2, scale = 1.5f }, true); } } } } public static class SaitamaEh { [CompilerGenerated] private static class <>O { public static hook_AttemptGrant <0>__OnAttemptGrant; public static Action <1>__RegisterOptions; } public const int SoundCount = 7; public static ConfigEntry<bool> BanAll; public static ConfigEntry<bool> HurtSound; public static ConfigEntry<float> HurtMinInterval; public static BuffDef SignalBuff; private static int lastSound = -1; private static readonly Dictionary<int, float> lastReject = new Dictionary<int, float>(); public static void Init(ConfigFile config, GameObject bodyPrefab) { //IL_0096: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown BanAll = config.Bind<bool>("Eh", "BanAllItems", true, "Saitama refuses any items and equipment. Hidden internal game items are not affected"); HurtSound = config.Bind<bool>("Eh", "HurtSoundWhenBroken", true, "В сломанном Limiter при получении урона звучит случайный \"эх\""); HurtMinInterval = config.Bind<float>("Eh", "HurtSoundMinInterval", 0.25f, "Минимум секунд между звуками урона (чтобы не трещало при быстрых ударах)"); SignalBuff = ScriptableObject.CreateInstance<BuffDef>(); ((Object)SignalBuff).name = "SaitamaEhSignal"; SignalBuff.canStack = true; SignalBuff.isDebuff = false; SignalBuff.isHidden = true; SignalBuff.buffColor = Color.white; ContentAddition.AddBuffDef(SignalBuff); bodyPrefab.AddComponent<SaitamaEhHurt>(); bodyPrefab.AddComponent<SaitamaItemGuard>(); try { object obj = <>O.<0>__OnAttemptGrant; if (obj == null) { hook_AttemptGrant val = OnAttemptGrant; <>O.<0>__OnAttemptGrant = val; obj = (object)val; } GenericPickupController.AttemptGrant += (hook_AttemptGrant)obj; } catch (Exception ex) { LimiterSystem.Log.LogWarning((object)("Запрет предметов не включён: " + ex.Message)); } RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(RegisterOptions)); } public static void PlayForAll(CharacterBody body) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) SaitamaEhHurt saitamaEhHurt = (Object.op_Implicit((Object)(object)body) ? ((Component)body).GetComponent<SaitamaEhHurt>() : null); if (Object.op_Implicit((Object)(object)saitamaEhHurt)) { saitamaEhHurt.ServerSignal(NextIndex()); } else { PlayRandom(body.corePosition, body.hasEffectiveAuthority); } } public static void PlayOk(CharacterBody body) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) SaitamaEhHurt saitamaEhHurt = (Object.op_Implicit((Object)(object)body) ? ((Component)body).GetComponent<SaitamaEhHurt>() : null); if (Object.op_Implicit((Object)(object)saitamaEhHurt)) { saitamaEhHurt.ServerSignal(100); } else { PlayIndex(100, body.corePosition, body.hasEffectiveAuthority); } } public static void PlayCheckmate(CharacterBody body) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) SaitamaEhHurt saitamaEhHurt = (Object.op_Implicit((Object)(object)body) ? ((Component)body).GetComponent<SaitamaEhHurt>() : null); if (Object.op_Implicit((Object)(object)saitamaEhHurt)) { saitamaEhHurt.ServerSignal(101); } else if (Object.op_Implicit((Object)(object)body)) { PlayIndex(101, body.corePosition, body.hasEffectiveAuthority); } } private static int NextIndex() { int num; do { num = Random.Range(1, 8); } while (num == lastSound); lastSound = num; return num; } public static void PlayIndex(int n, Vector3 position, bool owner) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (n == 101) { FxSystem.PlaySoundAt("checkmate", position, 150f, owner, (SaitamaFlair.OkBoost != null) ? SaitamaFlair.OkBoost.Value : 3f); } else if (n == 100) { FxSystem.PlaySoundAt("ok", position, 150f, owner, (SaitamaFlair.OkBoost != null) ? SaitamaFlair.OkBoost.Value : 3f); } else if (n >= 1 && n <= 7) { FxSystem.PlaySoundAt("eh" + n, position, 45f, owner); } } public static void PlayRandom(Vector3 position, bool owner) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) int num; do { num = Random.Range(1, 8); } while (num == lastSound); lastSound = num; FxSystem.PlaySoundAt("eh" + num, position, 45f, owner); } public static bool IsBanned(PickupIndex index) { //IL_0001: 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_002a: Invalid comparison between Unknown and I4 //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 PickupDef pickupDef = PickupCatalog.GetPickupDef(index); if (pickupDef == null) { return false; } if (BanAll.Value) { if ((int)pickupDef.itemIndex != -1) { return (int)pickupDef.itemTier != 5; } return (int)pickupDef.equipmentIndex != -1; } return false; } private static void OnAttemptGrant(orig_AttemptGrant orig, GenericPickupController self, CharacterBody body) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) try { if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)self) && Object.op_Implicit((Object)(object)((Component)body).GetComponent<SaitamaLimiterController>()) && IsBanned(self.pickupIndex)) { Reject(self, body); return; } } catch (Exception ex) { LimiterSystem.Log.LogWarning((object)("Запрет предметов: " + ex.Message)); } orig.Invoke(self, body); } private static void Reject(GenericPickupController pickup, CharacterBody body) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) int instanceID = ((Object)pickup).GetInstanceID(); float time = Time.time; if (!lastReject.TryGetValue(instanceID, out var value) || !(time - value < 1f)) { lastReject[instanceID] = time; if (lastReject.Count > 200) { lastReject.Clear(); } Vector3 val = ((Component)pickup).transform.position - body.corePosition; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = ((Component)body).gameObject.transform.forward; } ((Vector3)(ref val)).Normalize(); Rigidbody component = ((Component)pickup).GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component) && !component.isKinematic) { component.velocity = val * 9f + Vector3.up * 8f; } else { Transform transform = ((Component)pickup).transform; transform.position += val * 3f + Vector3.up * 0.5f; } PlayForAll(body); } } private static object CreateOption(Assembly asm, Type checkType, ConfigEntry<bool> entry, string category, string name, string description) { try { Type type = asm.GetType("RiskOfOptions.OptionConfigs.CheckBoxConfig"); if (type != null) { object obj = Activator.CreateInstance(type); SetMember(obj, "category", category); SetMember(obj, "name", name); SetMember(obj, "description", description); object obj2 = Activator.CreateInstance(checkType, entry, obj); if (obj2 != null) { return obj2; } } } catch (Exception ex) { LimiterSystem.Log.LogWarning((object)("Risk of Options: не удалось задать название настройки: " + ex.Message)); } return Activator.CreateInstance(checkType, entry); } private static void SetMember(object target, string name, string value) { FieldInfo field = target.GetType().GetField(name, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.FieldType == typeof(string)) { field.SetValue(target, value); return; } PropertyInfo property = target.GetType().GetProperty(name, BindingFlags.IgnoreCase | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite && property.PropertyType == typeof(string)) { property.SetValue(target, value, null); } } private static void LocalizeOption(object option, string nameEn, string nameRu, string descEn, string descRu) { try { MethodInfo[] methods = option.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy); foreach (MethodInfo methodInfo in methods) { if (methodInfo.ReturnType != typeof(string)) { continue; } bool flag = methodInfo.Name.IndexOf("NameToken", StringComparison.OrdinalIgnoreCase) >= 0; bool flag2 = methodInfo.Name.IndexOf("DescriptionToken", StringComparison.OrdinalIgnoreCase) >= 0; if (flag || flag2) { ParameterInfo[] parameters = methodInfo.GetParameters(); object[] array = new object[parameters.Length]; for (int j = 0; j < parameters.Length; j++) { array[j] = (parameters[j].HasDefaultValue ? parameters[j].DefaultValue : ((parameters[j].ParameterType == typeof(string)) ? "" : null)); } string text = methodInfo.Invoke(option, array) as string; if (!string.IsNullOrEmpty(text)) { LanguageAPI.Add(text, flag ? nameEn : descEn); LanguageAPI.Add(text, flag ? nameRu : descRu, "ru"); } } } } catch (Exception ex) { LimiterSystem.Log.LogWarning((object)("Risk of Options: перевод настройки не добавлен: " + ex.Message)); } } private static void RegisterOptions() { try { Assembly assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "RiskOfOptions"); if (assembly == null) { return; } Type type = assembly.GetType("RiskOfOptions.ModSettingsManager"); Type type2 = assembly.GetType("RiskOfOptions.Options.CheckBoxOption"); Type type3 = assembly.GetType("RiskOfOptions.Options.BaseOption"); if (type == null || type2 == null || type3 == null) { return; } MethodInfo method = type.GetMethod("AddOption", new Type[3] { type3, typeof(string), typeof(string) }); MethodInfo method2 = type.GetMethod("AddOption", new Type[1] { type3 }); ConfigEntry<bool>[] array = new ConfigEntry<bool>[2] { BanAll, LimiterSystem.DebugKeyEnabled }; foreach (ConfigEntry<bool> val in array) { bool flag = val == BanAll; object obj = CreateOption(assembly, type2, val, flag ? "Items" : "Debug", flag ? "Ban all items" : "Debug keys", flag ? "Saitama refuses any items and equipment. Hidden internal game items are not affected." : "F7 gives Limiter stacks, F6 raises mini-boss difficulty, F4 spawns a mini-boss (singleplayer or host only)."); if (method != null) { method.Invoke(null, new object[3] { obj, "com.chestavo.saitamamod", "SaitamaMod" }); } else if (method2 != null) { method2.Invoke(null, new object[1] { obj }); } if (val == BanAll) { LocalizeOption(obj, "Ban all items", "Отказ от предметов", "Saitama refuses any items and equipment. Hidden internal game items are not affected.", "Сайтама отказывается от любых предметов и снаряжения. Служебные скрытые предметы игры не затрагиваются."); } else { LocalizeOption(obj, "Debug keys", "Тестовые клавиши", "F7 gives Limiter stacks, F6 raises mini-boss difficulty, F4 spawns a mini-boss (singleplayer or host only).", "F7 выдаёт стаки Limiter, F6 поднимает сложность мини-боссов, F4 вызывает мини-босса (одиночная игра или хост)."); } } MethodInfo method3 = type.GetMethod("SetModDescription", new Type[3] { typeof(string), typeof(string), typeof(string) }); if (method3 != null) { method3.Invoke(null, new object[3] { SaitamaLoc.T("Настройки Сайтамы: отказ от предметов и тестовые клавиши (F4, F6, F7).", "Saitama settings: item ban and debug keys (F4, F6, F7)."), "com.chestavo.saitamamod", "SaitamaMod" }); } } catch (Exception ex) { LimiterSystem.Log.LogWarning((object)("Risk of Options: не удалось добавить настройки: " + ex.Message)); } } } public class SaitamaItemGuard : MonoBehaviour { private static MethodInfo removeMethod; private static MethodInfo countMethod; private static bool resolved; private CharacterBody body; private float timer; private void Awake() { body = ((Component)this).GetComponent<CharacterBody>(); } private static void Resolve() { if (!resolved) { resolved = true; Type typeFromHandle = typeof(Inventory); Type[] types = new Type[2] { typeof(ItemIndex), typeof(int) }; removeMethod = typeFromHandle.GetMethod("RemoveItemPermanent", types) ?? typeFromHandle.GetMethod("RemoveItem", types); countMethod = typeFromHandle.GetMethod("GetItemCountPermanent", new Type[1] { typeof(ItemIndex) }) ?? typeFromHandle.GetMethod("GetItemCount", new Type[1] { typeof(ItemIndex) }); } } private void FixedUpdate() { //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Invalid comparison between Unknown and I4 //IL_018e: 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_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.inventory)) { return; } timer -= Time.fixedDeltaTime; if (timer > 0f) { return; } timer = 0.25f; try { Resolve(); Inventory inventory = body.inventory; if (removeMethod != null && countMethod != null) { ItemIndex[] array = inventory.itemAcquisitionOrder.ToArray(); foreach (ItemIndex val in array) { PickupIndex val2 = PickupCatalog.FindPickupIndex(val); if (!SaitamaEh.IsBanned(val2)) { continue; } int num = (int)countMethod.Invoke(inventory, new object[1] { val }); if (num > 0) { removeMethod.Invoke(inventory, new object[2] { val, num }); for (int j = 0; j < Mathf.Min(num, 10); j++) { Drop(val2); } SaitamaEh.PlayForAll(body); } } } EquipmentIndex equipmentIndex = inventory.GetEquipmentIndex(); if ((int)equipmentIndex != -1) { PickupIndex val3 = PickupCatalog.FindPickupIndex(equipmentIndex); if (SaitamaEh.IsBanned(val3)) { inventory.SetEquipmentIndex((EquipmentIndex)(-1)); Drop(val3); SaitamaEh.PlayForAll(body); } } } catch (Exception ex) { LimiterSystem.Log.LogWarning((object)("Охранник инвентаря: " + ex.Message)); timer = 5f; } } private void Drop(PickupIndex pickup) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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) //IL_003a: 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_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 val = ((Vector2)(ref insideUnitCircle)).normalized * Random.Range(6f, 10f); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(val.x, Random.Range(8f, 12f), val.y); PickupDropletController.CreatePickupDroplet(pickup, body.corePosition + Vector3.up * 0.5f, val2); } } public class SaitamaEhHurt : MonoBehaviour { private CharacterBody body; private float lastHealth = -1f; private float lastPlay; private int lastSignal; private float signalResetAt; private void Awake() { body = ((Component)this).GetComponent<CharacterBody>(); } public void ServerSignal(int n) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && Object.op_Implicit((Object)(object)body) && !((Object)(object)SaitamaEh.SignalBuff == (Object)null) && !(Time.time < signalResetAt)) { body.SetBuffCount(SaitamaEh.SignalBuff.buffIndex, n); signalResetAt = Time.time + 0.3f; } } private void Update() { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)body.healthComponent)) { return; } if ((Object)(object)SaitamaEh.SignalBuff != (Object)null) { int buffCount = body.GetBuffCount(SaitamaEh.SignalBuff); if (buffCount != lastSignal) { lastSignal = buffCount; if (buffCount > 0) { SaitamaEh.PlayIndex(buffCount, body.corePosition, body.hasEffectiveAuthority); } } if (NetworkServer.active && buffCount != 0 && Time.time >= signalResetAt) { body.SetBuffCount(SaitamaEh.SignalBuff.buffIndex, 0); } } float combinedHealth = body.healthComponent.combinedHealth; if (lastHealth < 0f) { lastHealth = combinedHealth; return; } bool flag = combinedHealth < lastHealth - 0.01f; lastHealth = combinedHealth; if (flag && SaitamaEh.HurtSound != null && SaitamaEh.HurtSo