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 StickHead v1.2.2
plugins/StickHead.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("StickHead")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.2.2.0")] [assembly: AssemblyInformationalVersion("1.2.2")] [assembly: AssemblyProduct("StickHead")] [assembly: AssemblyTitle("StickHead")] [assembly: AssemblyVersion("1.2.2.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 StickHead { internal static class Lang { public const string SecLang = "0.Language"; public const string KeyLang = "Language"; public static ConfigFile Cfg; public static ConfigEntry<string> E; public static bool En; private static readonly string[][] T; public static readonly string[] Ids; static Lang() { T = new string[18][] { new string[7] { "hotkey", "1.热键", "1. Hotkeys", "准星挂载", "Attach key", "准星瞄着队友按一下,传到他头顶并挂上(挂着时按无效,要先按翻滚键落下)", "Aim at a teammate and press to hop onto their head. Ignored while attached - press the tumble key to get down first." }, new string[7] { "keyshake", "1.热键", "1. Hotkeys", "甩人按键", "Shake-off key", "被别人挂在头顶时按一下,演 0.7 秒倒下把他吓下来(对方也装了本插件 1.2.2+ 才有效)", "While someone rides your head, press to fake a 0.7s knockdown and make them drop off (the rider also needs this plugin 1.2.2+)." }, new string[7] { "height", "2.头顶", "2. Head", "高度偏移", "Height offset", "米。0 = 正好站在头顶最高点,负数陷进去,正数浮起来", "Meters. 0 = standing right on the top surface; negative sinks into the head, positive floats above it." }, new string[7] { "crouch", "2.头顶", "2. Head", "蹲下额外补偿", "Crouch offset", "米。模型蹲下已自动跟随;只有队友蹲下时还偏高才填这个(0.3~0.8)", "Meters. Height already follows the model; only raise this if you sit too high while they crouch (0.3-0.8)." }, new string[7] { "energy", "3.能量", "3. Stamina", "格数", "Pips", "挂着时自己掉血、或你挂着的那个队友掉血,都掉一格;掉光强制翻滚落下", "Losing health yourself - or the teammate you are riding losing health - costs one pip each; at zero you are forced off." }, new string[7] { "cde", "3.能量", "3. Stamina", "掉光冷却", "Cooldown after wipeout", "秒。能量掉光落下后,多久才能再挂", "Seconds before you can attach again after an empty bar knocks you off." }, new string[7] { "cds", "3.能量", "3. Stamina", "主动落下冷却", "Cooldown after dropping off", "秒。自己按翻滚键落下后,多久才能再挂", "Seconds before you can attach again after dropping off yourself." }, new string[7] { "tpd", "4.传送", "4. Teleport", "最大距离", "Max distance", "米。准星传送只在这么远以内生效", "Meters. Aim-teleport only works within this range." }, new string[7] { "tpa", "4.传送", "4. Teleport", "准星角度", "Aim cone", "度。准星偏离队友超过这个角度就不算瞄着", "Degrees. Beyond this the crosshair no longer counts as aimed at the teammate." }, new string[7] { "hud", "5.显示", "5. Display", "显示能量条", "Show stamina bar", "右下角的格子能量条", "The pip bar in the bottom-right corner." }, new string[7] { "scale", "5.显示", "5. Display", "界面缩放", "HUD scale", "0.6~2", "0.6 - 2" }, new string[7] { "msgsec", "5.显示", "5. Display", "提示停留秒数", "Message duration", "秒。屏幕右下那条提示停留多久", "Seconds the on-screen message stays visible." }, new string[7] { "heal", "7.增益队友", "7. Team support", "开启", "Enable", "队友被攻击掉血超过阈值时,拿自己的血换他的血(扣多少补多少)", "When a teammate loses more HP than the threshold, trade your own HP for his - what you lose is what he gains." }, new string[7] { "healhit", "7.增益队友", "7. Team support", "触发阈值", "Trigger threshold", "队友一次挨打掉这么多血以上才触发(低于这个数不管)", "Only triggers when a single hit costs the teammate at least this much HP." }, new string[7] { "healcost", "7.增益队友", "7. Team support", "扣多少=回多少", "HP moved", "从自己身上扣多少血,就给他补多少(一比一)", "HP taken from you, and the same amount handed to him - one for one." }, new string[7] { "healtimes", "7.增益队友", "7. Team support", "最多次数", "Max donations", "每次挂头顶最多能输几次,挂上去就重置", "Donations allowed per attach; resets every time you hop on." }, new string[7] { "healkeep", "7.增益队友", "7. Team support", "自己最低保留", "Your HP floor", "自己血量扣完不能低于这个数,否则不输血(防自己死)", "Never drop your own HP below this; under it no donation happens (keeps you alive)." }, new string[7] { "dbg", "6.调试", "6. Debug", "写日志", "Write log", "开 = 把识别/挂载/落下写进 BepInEx 日志", "On = log scanning / attaching / dropping to the BepInEx console." } }; Ids = new string[T.Length]; for (int i = 0; i < T.Length; i++) { Ids[i] = T[i][0]; } } private static int ix(bool en, int zh, int enIx) { if (!en) { return zh; } return enIx; } public static string Sec(string id, bool en) { return Row(id)[ix(en, 1, 2)]; } public static string Key(string id, bool en) { return Row(id)[ix(en, 3, 4)]; } public static string Desc(string id, bool en) { return Row(id)[ix(en, 5, 6)]; } private static string[] Row(string id) { for (int i = 0; i < T.Length; i++) { if (T[i][0] == id) { return T[i]; } } return T[0]; } public static string R(string zh, string en) { if (!En) { return zh; } return en; } } internal static class Patches { [HarmonyPatch(typeof(PlayerTumble), "TumbleRequest")] internal static class P_TumbleRequest { private static bool Prefix(PlayerTumble __instance, bool __0, bool __1) { if (!__0) { return true; } if (__1) { return true; } return !Stick.BlockExternalTumble(__instance); } } [HarmonyPatch(typeof(PlayerTumble), "TumbleSet")] internal static class P_TumbleSet { private static bool Prefix(PlayerTumble __instance, bool __0, bool __1) { return !Stick.BlockTumbleSet(__instance, __0, __1); } } [HarmonyPatch(typeof(PlayerTumble), "TumbleSetRPC")] internal static class P_TumbleSetRPC { private static bool Prefix(PlayerTumble __instance, bool __0, bool __1) { return !Stick.BlockTumbleSet(__instance, __0, __1); } } [HarmonyPatch(typeof(PlayerTumble), "TumbleForce")] internal static class P_TumbleForce { private static bool Prefix(PlayerTumble __instance) { return !Stick.BlockExternalTumble(__instance); } } [HarmonyPatch(typeof(PlayerTumble), "TumbleTorque")] internal static class P_TumbleTorque { private static bool Prefix(PlayerTumble __instance) { return !Stick.BlockExternalTumble(__instance); } } } [BepInPlugin("com.yanyan.stickhead", "StickHead 头顶黏人", "1.2.2")] public class StickHeadPlugin : BaseUnityPlugin { public const string GUID = "com.yanyan.stickhead"; public const string VERSION = "1.2.2"; internal static StickHeadPlugin I; internal static Harmony H; private void Awake() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown I = this; Stick.Init(((BaseUnityPlugin)this).Config); try { H = new Harmony("com.yanyan.stickhead"); H.PatchAll(typeof(Patches)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"StickHead harmony patched"); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("harmony: " + ex)); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"StickHead v1.2.2 loaded"); } private void OnDestroy() { try { if (H != null) { H.UnpatchSelf(); } } catch { } } internal static void LogInfo(string m) { try { if ((Object)(object)I != (Object)null) { ((BaseUnityPlugin)I).Logger.LogInfo((object)m); } } catch { } } internal static void LogWarn(string m) { try { if ((Object)(object)I != (Object)null) { ((BaseUnityPlugin)I).Logger.LogWarning((object)m); } } catch { } } private void Update() { try { Stick.Tick(); } catch (Exception ex) { LogWarn("tick: " + ex.Message); } try { SpiritOrb.Tick(); } catch (Exception ex2) { LogWarn("orb: " + ex2.Message); } } private void LateUpdate() { try { Stick.LateTick(); } catch { } } private void OnGUI() { try { Stick.DrawHud(); } catch { } } } internal static class R { private const BindingFlags BF = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private static readonly Dictionary<string, Type> _types = new Dictionary<string, Type>(); public static Type FindType(string simpleName) { if (string.IsNullOrEmpty(simpleName)) { return null; } if (_types.TryGetValue(simpleName, out var value)) { return value; } Type type = null; try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { Type[] types; try { types = assembly.GetTypes(); } catch { continue; } Type[] array = types; foreach (Type type2 in array) { if (type2.Name == simpleName) { type = type2; break; } } if (type != null) { break; } } } catch { } _types[simpleName] = type; return type; } public static object Get(object o, string name) { if (o == null) { return null; } try { Type type = o.GetType(); FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field.GetValue(field.IsStatic ? null : o); } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanRead) { MethodInfo getMethod = property.GetGetMethod(nonPublic: true); if (getMethod != null) { return property.GetValue(getMethod.IsStatic ? null : o); } } } catch { } return null; } public static void Set(object o, string name, object v) { if (o == null) { return; } try { Type type = o.GetType(); FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { field.SetValue(field.IsStatic ? null : o, v); return; } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite) { MethodInfo setMethod = property.GetSetMethod(nonPublic: true); if (setMethod != null) { property.SetValue(setMethod.IsStatic ? null : o, v); } } } catch { } } public static object Static(Type t, string name) { if (t == null) { return null; } try { FieldInfo[] fields = t.GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (fieldInfo.Name == name && fieldInfo.IsStatic) { return fieldInfo.GetValue(null); } } PropertyInfo[] properties = t.GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (PropertyInfo propertyInfo in properties) { MethodInfo getMethod = propertyInfo.GetGetMethod(nonPublic: true); if (propertyInfo.Name == name && getMethod != null && getMethod.IsStatic) { return propertyInfo.GetValue(null); } } } catch { } return null; } public static object Call(object o, string name, params object[] args) { if (o == null) { return null; } try { MethodInfo[] methods = o.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (!(methodInfo.Name != name) && methodInfo.GetParameters().Length == args.Length) { try { return methodInfo.Invoke(methodInfo.IsStatic ? null : o, args); } catch { } } } } catch { } return null; } public static bool Bool(object o) { bool flag = default(bool); int num; if (o is bool) { flag = (bool)o; num = 1; } else { num = 0; } return (byte)((uint)num & (flag ? 1u : 0u)) != 0; } } internal static class SpiritOrb { private const KeyCode KEY = (KeyCode)103; public const float CD = 10f; private const float FLY_SPEED = 9f; private const float MAX_RANGE = 5f; private const float HOVER_SEC = 3f; private const float SEEK_RADIUS = 5f; private const float CHASE_SPEED = 16f; private const float HIT_DIST = 0.85f; private const float STUN_SEC = 3f; private const float STUN_STEP = 0.055f; private const float STUN_AMP = 1.05f; private const float CORE_SIZE = 0.15f; private const float GLOW_SIZE = 0.46f; private const float GLOW2_SIZE = 0.9f; private static readonly Color C_CORE = new Color(0.92f, 1f, 0.96f, 1f); private static readonly Color C_GLOW = new Color(0.45f, 1f, 0.7f, 0.5f); private static readonly Color C_GLOW2 = new Color(0.28f, 0.95f, 0.58f, 0.14f); private static readonly Color C_RING = new Color(0.62f, 1f, 0.82f, 0.95f); private static readonly Color C_LIGHT = new Color(0.45f, 1f, 0.72f); private const int P_IDLE = 0; private const int P_FLY = 1; private const int P_HOVER = 2; private const int P_CHASE = 3; private static int _phase = 0; private static float _nextCast; private static Vector3 _start; private static Vector3 _dir; private static Vector3 _pos; private static float _traveled; private static float _hoverUntil; private static float _pulse; private static Component _target; private static GameObject _root; private static Transform _core; private static Transform _glow; private static Transform _glow2; private static LineRenderer[] _rings; private static Light _light; private static Transform _ringRoot; private static readonly Quaternion[] _ringBase = (Quaternion[])(object)new Quaternion[3] { Quaternion.Euler(0f, 0f, 0f), Quaternion.Euler(74f, 0f, 0f), Quaternion.Euler(38f, 62f, 0f) }; private static Component _stunEnemy; private static Vector3 _stunBase; private static Vector3 _stunPos; private static float _stunUntil; private static float _stunNext; private static readonly List<Component> _enemies = new List<Component>(); private static Type _enemyType; private static float _scanAt; private static Texture2D _softTex; public static bool Busy => _phase != 0; public static float CdLeft => Mathf.Max(0f, _nextCast - Time.time); public static void Tick() { //IL_0099: Unknown result type (might be due to invalid IL or missing references) try { StunTick(); if (Input.GetKeyDown((KeyCode)103)) { TryCast(); } if (_phase == 0) { return; } if ((Object)(object)Stick.Local == (Object)null) { Kill(); return; } if (Time.time >= _scanAt) { _scanAt = Time.time + 0.4f; ScanEnemies(); } if (_phase == 1) { FlyTick(); } else if (_phase == 2) { HoverTick(); } else if (_phase == 3) { ChaseTick(); } if ((Object)(object)_root != (Object)null) { _root.transform.position = _pos; VisualTick(); } } catch (Exception ex) { Stick.Log("orb tick: " + ex.Message); } } private static void TryCast() { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) if (!Stick.AliveInMatch()) { return; } if (Time.time < _nextCast) { Stick.Say(Lang.R("灵球冷却 ", "Spirit orb cooling ") + CdLeft.ToString("0.0") + Lang.R(" 秒", "s")); return; } if ((Object)(object)Stick.Local == (Object)null) { Stick.Say(Lang.R("灵球:还没认到自己的角色", "Orb: avatar not found yet")); return; } if (!Muzzle(out var pos, out var dir)) { Stick.Say(Lang.R("灵球:找不到视角", "Orb: no camera")); return; } if (_phase != 0) { Kill(); } _start = pos; _dir = ((Vector3)(ref dir)).normalized; _pos = pos; _traveled = 0f; _pulse = 0f; _target = null; _phase = 1; _nextCast = Time.time + 10f; _scanAt = 0f; BuildVisual(pos); Stick.Log("ORB cast dir=" + ((Vector3)(ref _dir)).ToString("0.00")); } private static void FlyTick() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_007d: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) float num = 9f * Time.deltaTime; _traveled += num; if (_traveled >= 5f) { _traveled = 5f; _pos = _start + _dir * 5f; _phase = 2; _hoverUntil = Time.time + 3f; } else { _pos = _start + _dir * _traveled; } Component val = NearestEnemy(_pos, 5f); if ((Object)(object)val != (Object)null) { StartChase(val); } } private static void HoverTick() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Component val = NearestEnemy(_pos, 5f); if ((Object)(object)val != (Object)null) { StartChase(val); } else if (Time.time >= _hoverUntil) { Kill(); } } private static void ChaseTick() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: 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_0065: 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) if (!Alive(_target)) { Kill(); return; } Vector3 val = EnemyPos(_target); Vector3 val2 = val - _pos; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude <= 0.85f) { _pos = val; if ((Object)(object)_root != (Object)null) { _root.transform.position = _pos; } Hit(_target, val); } else { _pos += val2 / Mathf.Max(magnitude, 0.0001f) * Mathf.Min(16f * Time.deltaTime, magnitude); } } private static void StartChase(Component e) { _target = e; _phase = 3; Stick.Log("ORB lock " + EnemyLabel(e)); } private static void Hit(Component e, Vector3 at) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) string text = EnemyLabel(e); Kill(); _stunEnemy = e; _stunBase = at; _stunPos = at; _stunUntil = Time.time + 3f; _stunNext = 0f; Stick.Log("ORB hit " + text); Stick.Say(Lang.R("灵球命中:", "Orb hit: ") + text); } private static void StunTick() { //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_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_0090: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_stunEnemy == (Object)null) { return; } if (Time.time >= _stunUntil) { _stunEnemy = null; return; } if (Time.time >= _stunNext) { _stunNext = Time.time + 0.055f; _stunPos = _stunBase + new Vector3(Random.Range(-1.05f, 1.05f), Random.Range(0f, 1.5749999f), Random.Range(-1.05f, 1.05f)); try { R.Call(_stunEnemy, "EnemyTeleported", _stunPos); } catch { } } try { _stunEnemy.transform.position = _stunPos; } catch { } } private static void ScanEnemies() { _enemies.Clear(); if (_enemyType == null) { _enemyType = R.FindType("Enemy"); } if (_enemyType == null) { return; } Object[] array = null; try { array = Object.FindObjectsOfType(_enemyType); } catch { } if (array == null) { return; } foreach (Object obj2 in array) { Component val = (Component)(object)((obj2 is Component) ? obj2 : null); if ((Object)(object)val == (Object)null) { continue; } try { if (!val.gameObject.activeInHierarchy) { continue; } } catch { continue; } _enemies.Add(val); } } private static Component NearestEnemy(Vector3 from, float radius) { //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_0025: 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) Component result = null; float num = radius * radius; for (int i = 0; i < _enemies.Count; i++) { Component val = _enemies[i]; if (Alive(val)) { Vector3 val2 = EnemyPos(val) - from; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = val; } } } return result; } private static Vector3 EnemyPos(Component e) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_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) if ((Object)(object)e == (Object)null) { return Vector3.zero; } try { object obj = R.Get(e, "CenterTransform"); Transform val = (Transform)((obj is Transform) ? obj : null); if ((Object)(object)val != (Object)null) { return val.position; } } catch { } try { return e.transform.position; } catch { return Vector3.zero; } } private static string EnemyLabel(Component e) { try { object obj = R.Get(e, "EnemyParent"); string text = ((obj != null) ? (R.Get(obj, "enemyName") as string) : null); if (!string.IsNullOrEmpty(text)) { return text; } } catch { } try { return ((Object)e).name; } catch { return "Enemy"; } } private static bool Alive(Component c) { if ((Object)(object)c == (Object)null) { return false; } try { return (Object)(object)c.gameObject != (Object)null && c.gameObject.activeInHierarchy; } catch { return false; } } private static void BuildVisual(Vector3 at) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_0019: 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_0066: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) _root = new GameObject("YanSpiritOrb"); _root.transform.position = at; Shader sh = PickShader(additive: true); Shader sh2 = PickShader(additive: false); _core = Ball(_root.transform, "core", 0.15f, sh2, C_CORE); _glow = Ball(_root.transform, "glow", 0.46f, sh, C_GLOW); _glow2 = Ball(_root.transform, "glow2", 0.9f, sh, C_GLOW2); _ringRoot = new GameObject("rings").transform; _ringRoot.SetParent(_root.transform, false); _rings = (LineRenderer[])(object)new LineRenderer[3]; for (int i = 0; i < 3; i++) { _rings[i] = Ring(_ringRoot, 0.29f + (float)i * 0.075f, 0.019f + (float)i * 0.008f, sh); try { ((Component)_rings[i]).transform.localRotation = _ringBase[i]; } catch { } } Spark(_root.transform, sh); try { GameObject val = new GameObject("light"); val.transform.SetParent(_root.transform, false); Light obj2 = val.AddComponent<Light>(); obj2.type = (LightType)2; obj2.color = C_LIGHT; obj2.range = 5.5f; obj2.intensity = 3.2f; obj2.shadows = (LightShadows)0; _light = obj2; } catch { } } private static void VisualTick() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00ea: 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) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_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) _pulse += Time.deltaTime; float num = Mathf.Sin(_pulse * 2.6f) * 0.05f; float num2 = 1f + Mathf.Sin(_pulse * 9f) * 0.1f; float num3 = 1f + Mathf.Sin(_pulse * 4.5f) * 0.16f; Vector3 localPosition = default(Vector3); ((Vector3)(ref localPosition))..ctor(0f, num, 0f); if ((Object)(object)_core != (Object)null) { _core.localPosition = localPosition; _core.localScale = Vector3.one * (0.15f * (1f + Mathf.Sin(_pulse * 13f) * 0.07f)); } if ((Object)(object)_glow != (Object)null) { _glow.localPosition = localPosition; _glow.localScale = Vector3.one * (0.46f * num2); } if ((Object)(object)_glow2 != (Object)null) { _glow2.localPosition = localPosition; _glow2.localScale = Vector3.one * (0.9f * num3); } if ((Object)(object)_ringRoot != (Object)null) { _ringRoot.localPosition = localPosition; } if (_rings != null) { for (int i = 0; i < _rings.Length; i++) { if (!((Object)(object)_rings[i] == (Object)null)) { float num4 = 210f + (float)i * 95f; float num5 = 130f + (float)i * 45f; ((Component)_rings[i]).transform.localRotation = Quaternion.Euler(_pulse * num4, _pulse * num5, 0f) * _ringBase[i]; } } } if ((Object)(object)_light != (Object)null) { _light.intensity = 3.2f + Mathf.Sin(_pulse * 7f) * 0.9f; } } private static Transform Ball(Transform parent, string name, float size, Shader sh, Color c) { //IL_003c: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)val).name = name; try { Collider component = val.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } } catch { } val.transform.SetParent(parent, false); val.transform.localPosition = Vector3.zero; val.transform.localScale = Vector3.one * size; MeshRenderer component2 = val.GetComponent<MeshRenderer>(); if ((Object)(object)component2 != (Object)null) { ((Renderer)component2).material = MakeMat(sh, c); ((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component2).receiveShadows = false; } return val.transform; } catch { return null; } } private static LineRenderer Ring(Transform parent, float radius, float width, Shader sh) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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) try { GameObject val = new GameObject("ring"); val.transform.SetParent(parent, false); LineRenderer val2 = val.AddComponent<LineRenderer>(); val2.useWorldSpace = false; val2.loop = true; val2.positionCount = 56; val2.startWidth = width; val2.endWidth = width; val2.numCornerVertices = 2; val2.alignment = (LineAlignment)0; val2.startColor = C_RING; val2.endColor = new Color(C_RING.r, C_RING.g, C_RING.b, 0.35f); ((Renderer)val2).material = MakeMat(sh, Color.white); ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; for (int i = 0; i < val2.positionCount; i++) { float num = (float)i / (float)val2.positionCount * MathF.PI * 2f; val2.SetPosition(i, new Vector3(Mathf.Cos(num) * radius, Mathf.Sin(num) * radius, 0f)); } return val2; } catch { return null; } } private static void Spark(Transform parent, Shader sh) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0072: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Expected O, but got Unknown //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_018c: 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_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: 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_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: 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_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = new GameObject("spark"); val.transform.SetParent(parent, false); ParticleSystem val2 = val.AddComponent<ParticleSystem>(); MainModule main = val2.main; ((MainModule)(ref main)).duration = 1f; ((MainModule)(ref main)).loop = true; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.4f, 0.95f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(0.35f, 1.5f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.05f, 0.17f); ((MainModule)(ref main)).startColor = new MinMaxGradient(new Color(0.8f, 1f, 0.88f, 1f), new Color(0.3f, 1f, 0.58f, 1f)); ((MainModule)(ref main)).maxParticles = 320; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).playOnAwake = true; EmissionModule emission = val2.emission; ((EmissionModule)(ref emission)).enabled = true; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(110f); ShapeModule shape = val2.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).radius = 0.26f; ((ShapeModule)(ref shape)).radiusThickness = 1f; ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val3 = new Gradient(); val3.SetKeys((GradientColorKey[])(object)new GradientColorKey[3] { new GradientColorKey(new Color(0.95f, 1f, 0.97f), 0f), new GradientColorKey(new Color(0.4f, 1f, 0.68f), 0.45f), new GradientColorKey(new Color(0.1f, 0.65f, 0.38f), 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[3] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0.75f, 0.55f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = new MinMaxGradient(val3); SizeOverLifetimeModule sizeOverLifetime = val2.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).sizeMultiplier = 1f; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, AnimationCurve.EaseInOut(0f, 1f, 1f, 0.15f)); ParticleSystemRenderer component = val.GetComponent<ParticleSystemRenderer>(); if ((Object)(object)component != (Object)null) { ((Renderer)component).material = MakeMat(sh, Color.white, withTex: true); component.renderMode = (ParticleSystemRenderMode)0; component.sortingFudge = 3f; component.minParticleSize = 0.005f; component.maxParticleSize = 0.6f; } } catch (Exception ex) { Stick.Log("orb spark: " + ex.Message); } } private static Shader PickShader(bool additive) { string[] array = ((!additive) ? new string[4] { "Sprites/Default", "Unlit/Color", "Unlit/Transparent", "Legacy Shaders/Particles/Alpha Blended" } : new string[6] { "Legacy Shaders/Particles/Additive", "Particles/Additive", "Mobile/Particles/Additive", "Legacy Shaders/Particles/Alpha Blended", "Sprites/Default", "Unlit/Transparent" }); for (int i = 0; i < array.Length; i++) { Shader val = null; try { val = Shader.Find(array[i]); } catch { } if ((Object)(object)val != (Object)null) { return val; } } return null; } private static Material MakeMat(Shader sh, Color c, bool withTex) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0066: 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_0054: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)sh == (Object)null) { try { sh = Shader.Find("Sprites/Default"); } catch { } } if ((Object)(object)sh == (Object)null) { try { sh = Shader.Find("Hidden/Internal-Colored"); } catch { } } Material val = null; try { val = new Material(sh); } catch { } if ((Object)(object)val == (Object)null) { return null; } try { val.SetColor("_Color", c); } catch { } try { val.SetColor("_TintColor", c); } catch { } try { val.SetColor("_EmissionColor", c); } catch { } if (withTex) { try { val.mainTexture = (Texture)(object)SoftTex(); } catch { } } return val; } private static Material MakeMat(Shader sh, Color c) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return MakeMat(sh, c, withTex: false); } private static Texture2D SoftTex() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_softTex != (Object)null) { return _softTex; } Texture2D val = new Texture2D(64, 64, (TextureFormat)4, false); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; Color32[] array = (Color32[])(object)new Color32[4096]; float num = 31.5f; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num2 = ((float)j - num) / num; float num3 = ((float)i - num) / num; float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3); float num5 = Mathf.Clamp01(1f - num4); num5 = num5 * num5 * num5; array[i * 64 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(num5 * 255f)); } } val.SetPixels32(array); val.Apply(); _softTex = val; return val; } private static bool Muzzle(out Vector3 pos, out Vector3 dir) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0073: 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_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_0090: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) pos = Vector3.zero; dir = Vector3.forward; Camera val = null; try { val = Camera.main; } catch { } if ((Object)(object)val == (Object)null) { try { Camera[] allCameras = Camera.allCameras; if (allCameras != null) { for (int i = 0; i < allCameras.Length; i++) { if ((Object)(object)allCameras[i] != (Object)null && ((Behaviour)allCameras[i]).isActiveAndEnabled) { val = allCameras[i]; break; } } } } catch { } } if ((Object)(object)val != (Object)null) { dir = ((Component)val).transform.forward; if (((Vector3)(ref dir)).sqrMagnitude < 0.01f) { dir = Vector3.forward; } dir = ((Vector3)(ref dir)).normalized; pos = ((Component)val).transform.position + dir * 0.55f + Vector3.down * 0.16f; return true; } if ((Object)(object)Stick.Local != (Object)null) { Transform transform = ((Component)Stick.Local).transform; dir = transform.forward; if (((Vector3)(ref dir)).sqrMagnitude < 0.01f) { dir = Vector3.forward; } dir = ((Vector3)(ref dir)).normalized; pos = transform.position + Vector3.up * 1.15f + dir * 0.45f; return true; } return false; } public static void Kill() { _phase = 0; _target = null; try { if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } } catch { } _root = null; _core = null; _glow = null; _glow2 = null; _ringRoot = null; _rings = null; _light = null; } } internal static class Stick { private static ConfigEntry<KeyCode> KMount; private static ConfigEntry<KeyCode> KShake; private static ConfigEntry<float> FHeight; private static ConfigEntry<float> FCrouchFix; private static ConfigEntry<float> FMsgSec; private static ConfigEntry<float> FScale; private static ConfigEntry<int> NEnergy; private static ConfigEntry<float> FCdSelf; private static ConfigEntry<float> FCdEnergy; private static ConfigEntry<float> FTpDist; private static ConfigEntry<float> FTpAngle; private static ConfigEntry<bool> BHud; private static ConfigEntry<bool> BDbg; private static ConfigEntry<bool> BHeal; private static ConfigEntry<float> FHealHit; private static ConfigEntry<int> NHealCost; private static ConfigEntry<int> NHealTimes; private static ConfigEntry<int> NHealKeep; public static readonly List<PlayerAvatar> Players = new List<PlayerAvatar>(); private static readonly Dictionary<int, string> _names = new Dictionary<int, string>(); public static PlayerAvatar Local; public static PlayerAvatar Target; public static PlayerController Ctrl; public static bool On; private static int _energy; private static int _energyMax = 5; private static int _lastHp = -1; private static float _scanAt; private static float _cdUntil; private static float _uiRefreshAt; private static string _scene = ""; private static string _msg = ""; private static float _msgUntil; private static bool _stiff; private static float _hitCd; private static float _logCd; private static float _mateCd; private static float _selfDmgUntil; private static float _shakeUntil; private static readonly List<PlayerAvatar> _riders = new List<PlayerAvatar>(); private static float _cancelAt; private static float _giveCd; private static int _giveLeft; private static int _lastTgHp = -1; private static FieldInfo _fEntries; private static int _lastSig = -1; private static Texture2D _dot; private static GUIStyle _stc; private static GUIStyle _st; internal static bool Dbg { get { try { return BDbg != null && BDbg.Value; } catch { return false; } } } public static int Energy => _energy; public static int EnergyMax => _energyMax; public static bool Cooling => Time.time < _cdUntil; public static float CdLeft => Mathf.Max(0f, _cdUntil - Time.time); internal static void Log(string m) { if (Dbg) { StickHeadPlugin.LogInfo("[Stick] " + m); } } public static void Init(ConfigFile c) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown Lang.Cfg = c; Lang.E = c.Bind<string>("0.Language", "Language", "中文", new ConfigDescription("界面语言 / Interface language(改完立即生效,不用重启 / applies immediately, no restart needed)", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "中文", "English" }), Array.Empty<object>())); Lang.En = Lang.E.Value == "English"; BindAll(); Lang.E.SettingChanged += OnLangChanged; _energyMax = Mathf.Clamp(NEnergy.Value, 1, 10); _energy = _energyMax; } private static void OnLangChanged(object sender, EventArgs e) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown try { bool flag = Lang.E != null && Lang.E.Value == "English"; if (flag == Lang.En) { return; } Lang.En = flag; ConfigFile cfg = Lang.Cfg; int num = 0; int num2 = 0; foreach (DictionaryEntry item in EntriesDict(cfg)) { object? value = item.Value; ConfigEntryBase val = (ConfigEntryBase)((value is ConfigEntryBase) ? value : null); if (val == null || (object)val == Lang.E) { continue; } string text = IdOf(val.Definition); if (text == null) { num2++; continue; } try { SetBacking(val, "Definition", typeof(ConfigDefinition), (object)new ConfigDefinition(Lang.Sec(text, flag), Lang.Key(text, flag))); SetBacking(val, "Description", typeof(ConfigDescription), BuildDesc(text, flag, val.Description)); num++; } catch (Exception ex) { Log("lang relabel " + text + " fail: " + ex.Message); } } bool flag2 = RebuildEntries(cfg); try { cfg.Save(); } catch (Exception ex2) { Log("lang save fail: " + ex2.Message); } PurgeOther(cfg); Log("lang switch -> " + (flag ? "English" : "Chinese") + " relabeled=" + num + " skipped=" + num2 + " dict=" + (flag2 ? "ok" : "FAIL")); _uiRefreshAt = Time.time + 0.15f; Say(Lang.R("已切换为中文", "Switched to English")); } catch (Exception ex3) { Log("lang switch fail: " + ex3); Say("语言切换失败,重启游戏后生效 / restart the game to apply"); } } private static void MenuRefreshTick() { if (!(_uiRefreshAt <= 0f) && !(Time.time < _uiRefreshAt)) { _uiRefreshAt = 0f; RefreshMenu(); } } private static void RefreshMenu() { try { Type type = FindType("MenuLib.MenuAPI"); Type type2 = FindType("REPOConfig.ConfigMenu"); if (type2 == null) { return; } FieldInfo field = type2.GetField("hasPopupMenuOpened", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); bool flag = false; try { flag = field != null && field.GetValue(null) is bool && (bool)field.GetValue(null); } catch { } if (!flag) { Log("lang: menu closed, skip refresh"); return; } if (type != null) { MethodInfo method = type.GetMethod("CloseAllPagesAddedOnTop", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(null, DefArgs(method)); } } MethodInfo method2 = type2.GetMethod("CreateModMenu", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (method2 != null && method2.GetParameters().Length == 0) { method2.Invoke(null, null); } Log("lang: menu rebuilt"); } catch (Exception ex) { Log("lang: menu refresh fail " + ex.Message); } } private static object[] DefArgs(MethodInfo m) { ParameterInfo[] parameters = m.GetParameters(); object[] array = new object[parameters.Length]; for (int i = 0; i < parameters.Length; i++) { Type parameterType = parameters[i].ParameterType; if (parameterType == typeof(bool)) { array[i] = true; } else if (parameterType.IsValueType) { array[i] = Activator.CreateInstance(parameterType); } else { array[i] = null; } } return array; } private static Type FindType(string fullName) { try { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { if (!(assembly == null)) { Type type = assembly.GetType(fullName, throwOnError: false); if (type != null) { return type; } } } } catch { } return null; } private static string IdOf(ConfigDefinition d) { if (d == (ConfigDefinition)null) { return null; } for (int i = 0; i < Lang.Ids.Length; i++) { string text = Lang.Ids[i]; if ((!(d.Key != Lang.Key(text, en: true)) || !(d.Key != Lang.Key(text, en: false))) && (d.Section == Lang.Sec(text, en: true) || d.Section == Lang.Sec(text, en: false))) { return text; } } return null; } private static ConfigDescription BuildDesc(string id, bool en, ConfigDescription old) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown string text = Lang.Desc(id, en); AcceptableValueBase val = ((old != null) ? old.AcceptableValues : null); object[] array = ((old != null) ? old.Tags : null); if (val == null && (array == null || array.Length == 0)) { return new ConfigDescription(text, (AcceptableValueBase)null, Array.Empty<object>()); } return new ConfigDescription(text, val, (array == null) ? new object[0] : array); } private static void SetBacking(object entry, string hint, Type fieldType, object value) { Type type = entry.GetType(); while (type != null) { FieldInfo[] fields = type.GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (!(fieldInfo.FieldType != fieldType) && fieldInfo.Name.IndexOf(hint, StringComparison.Ordinal) >= 0) { fieldInfo.SetValue(entry, value); return; } } type = type.BaseType; } throw new Exception(hint + " backing field not found"); } private static FieldInfo EntriesField(ConfigFile c) { if (_fEntries != null) { return _fEntries; } Type typeFromHandle = typeof(ConfigFile); FieldInfo fieldInfo = typeFromHandle.GetField("<Entries>k__BackingField", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (fieldInfo == null) { FieldInfo[] fields = typeFromHandle.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); for (int i = 0; i < fields.Length; i++) { if (typeof(IDictionary).IsAssignableFrom(fields[i].FieldType)) { fieldInfo = fields[i]; break; } } } _fEntries = fieldInfo; return fieldInfo; } private static IDictionary EntriesDict(ConfigFile c) { FieldInfo fieldInfo = EntriesField(c); if (fieldInfo == null) { return new Hashtable(); } if (!(fieldInfo.GetValue(c) is IDictionary result)) { return new Hashtable(); } return result; } private static bool RebuildEntries(ConfigFile c) { FieldInfo fieldInfo = EntriesField(c); if (fieldInfo == null) { return false; } try { if (!(fieldInfo.GetValue(c) is IDictionary dictionary)) { return false; } IDictionary dictionary2 = (IDictionary)Activator.CreateInstance(dictionary.GetType()); foreach (DictionaryEntry item in dictionary) { object? value = item.Value; ConfigEntryBase val = (ConfigEntryBase)((value is ConfigEntryBase) ? value : null); if (val != null) { dictionary2[val.Definition] = val; } } fieldInfo.SetValue(c, dictionary2); return dictionary2.Count == dictionary.Count; } catch (Exception ex) { Log("lang: rebuild entries fail " + ex.Message); return false; } } private static void BindAll() { ConfigFile cfg = Lang.Cfg; KMount = B<KeyCode>(cfg, "hotkey", (KeyCode)114); KShake = B<KeyCode>(cfg, "keyshake", (KeyCode)102); FHeight = B(cfg, "height", 0.1f); FCrouchFix = B(cfg, "crouch", 0f); NEnergy = B(cfg, "energy", 5); FCdEnergy = B(cfg, "cde", 5f); FCdSelf = B(cfg, "cds", 3f); FTpDist = B(cfg, "tpd", 10f); FTpAngle = B(cfg, "tpa", 30f); BHud = B(cfg, "hud", def: true); FScale = B(cfg, "scale", 1f); FMsgSec = B(cfg, "msgsec", 2f); BHeal = B(cfg, "heal", def: true); FHealHit = B(cfg, "healhit", 10f); NHealCost = B(cfg, "healcost", 5); NHealTimes = B(cfg, "healtimes", 5); NHealKeep = B(cfg, "healkeep", 5); BDbg = B(cfg, "dbg", def: true); PurgeOther(cfg); } private static ConfigEntry<T> B<T>(ConfigFile c, string id, T def) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown ConfigDefinition val = new ConfigDefinition(Lang.Sec(id, Lang.En), Lang.Key(id, Lang.En)); ConfigDefinition key = new ConfigDefinition(Lang.Sec(id, !Lang.En), Lang.Key(id, !Lang.En)); string text = null; IDictionary dictionary = Orphans(c); if (dictionary != null) { if (dictionary.Contains(val)) { text = dictionary[val] as string; } else if (dictionary.Contains(key)) { text = dictionary[key] as string; } } ConfigEntry<T> val2 = c.Bind<T>(val, def, new ConfigDescription(Lang.Desc(id, Lang.En), (AcceptableValueBase)null, Array.Empty<object>())); if (!string.IsNullOrEmpty(text)) { try { ((ConfigEntryBase)val2).SetSerializedValue(text); } catch (Exception ex) { Log("migrate " + id + " fail: " + ex.Message); } } return val2; } private static void PurgeOther(ConfigFile c) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown bool flag = false; string[] ids = Lang.Ids; foreach (string id in ids) { ConfigDefinition key = new ConfigDefinition(Lang.Sec(id, !Lang.En), Lang.Key(id, !Lang.En)); IDictionary dictionary = Orphans(c); if (dictionary != null && dictionary.Contains(key)) { dictionary.Remove(key); flag = true; } } string[] array = new string[2] { "1.热键", "1. Hotkeys" }; string[] array2 = new string[4] { "挂载", "Mount", "准星传送", "Aim teleport" }; ids = array; foreach (string text in ids) { string[] array3 = array2; foreach (string text2 in array3) { IDictionary dictionary2 = Orphans(c); ConfigDefinition key2 = new ConfigDefinition(text, text2); if (dictionary2 != null && dictionary2.Contains(key2)) { Log("drop legacy entry [" + text + "] " + text2 + " = " + (dictionary2[key2] as string)); dictionary2.Remove(key2); flag = true; } } } if (flag) { try { c.Save(); } catch (Exception ex) { Log("purge save fail: " + ex.Message); } } } private static IDictionary Orphans(ConfigFile c) { try { PropertyInfo property = typeof(ConfigFile).GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property == null) { return null; } return property.GetValue(c, null) as IDictionary; } catch { return null; } } public static void Tick() { MenuRefreshTick(); SceneWatch(); if (Time.time >= _scanAt) { _scanAt = Time.time + 0.5f; Scan(); } Keys(); if (On) { StickTick(); } HealthWatch(); ShakeTick(); } public static void LateTick() { if (On && (Object)(object)Target != (Object)null) { PinPos(); } } private static void Keys() { //IL_0048: 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_0054: 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) try { if (On && SemiFunc.InputDown((InputKey)14)) { Drop(rolled: true); } else if (KShake != null && (int)KShake.Value != 0 && Input.GetKeyDown(KShake.Value)) { ShakeOff(); } else if ((int)KMount.Value != 0 && Input.GetKeyDown(KMount.Value)) { if (On) { Say(Lang.R("已经挂着了,先按翻滚键落下", "Already attached - press the tumble key to get down first")); } else { TpToAim(); } } } catch { } } private static void Mount(PlayerAvatar tg) { if ((Object)(object)Local == (Object)null) { Say(Lang.R("黏人:还没认到自己的角色", "Stick: your avatar is not recognized yet")); return; } if ((Object)(object)tg == (Object)null) { Say(Lang.R("黏人:附近没有队友", "Stick: no teammate nearby")); return; } if (Time.time < _cdUntil) { Say(Lang.R("黏人:冷却中 ", "Stick: cooling down ") + (_cdUntil - Time.time).ToString("0.0") + Lang.R(" 秒", "s")); return; } On = true; Target = tg; _energyMax = Mathf.Clamp(NEnergy.Value, 1, 10); _energy = _energyMax; _lastHp = Hp(Local); _hitCd = 0f; _giveCd = 0f; _giveLeft = Mathf.Clamp(NHealTimes.Value, 0, 20); _lastTgHp = Hp(tg); SetStiff(on: true); SelfTumble(on: false); PinPos(); Say(Lang.R("黏人:", "Stick: ") + NameOf(tg) + Lang.R("(翻滚键落下)", " (tumble key to drop)")); Log("ON target=" + NameOf(tg) + " ctrl=" + (((Object)(object)Ctrl != (Object)null) ? "ok" : "null")); } private static void Drop(bool rolled) { if (On) { On = false; Target = null; SetStiff(on: false); ReleaseRb(); if (rolled) { SelfTumble(on: true); } _cdUntil = Time.time + Mathf.Max(0f, FCdSelf.Value); _energy = _energyMax; _lastHp = Hp(Local); _lastTgHp = -1; Say(rolled ? (Lang.R("黏人:落下(冷却 ", "Stick: dropped (cooldown ") + FCdSelf.Value.ToString("0") + Lang.R(" 秒)", "s)")) : Lang.R("黏人:已松开", "Stick: released")); Log("OFF rolled=" + rolled); } } private static void DropByEnergy() { On = false; Target = null; SetStiff(on: false); ReleaseRb(); SelfTumble(on: true); _cdUntil = Time.time + Mathf.Max(0f, FCdEnergy.Value); _energy = 0; _lastHp = Hp(Local); _lastTgHp = -1; Say(Lang.R("黏人:能量耗尽!强制落下(冷却 ", "Stick: out of stamina - forced off (cooldown ") + FCdEnergy.Value.ToString("0") + Lang.R(" 秒)", "s)")); Log("OFF energy-exhausted"); } private static void StickTick() { PlayerAvatar target = Target; if ((Object)(object)target == (Object)null) { On = false; SetStiff(on: false); } else if (R.Bool(R.Get(target, "deadSet")) || Hp(target) <= 0) { On = false; Target = null; SetStiff(on: false); ReleaseRb(); Say(Lang.R("黏人:队友倒了,松开", "Stick: teammate is down - released")); Log("OFF target-dead"); } else if (R.Bool(R.Get(Local, "deadSet"))) { On = false; Target = null; SetStiff(on: false); } else { KillTumble(); MateHealTick(); PinPos(); } } private static void MateHealTick() { PlayerAvatar target = Target; if ((Object)(object)target == (Object)null) { return; } int num = Hp(target); if (num < 0) { _lastTgHp = -1; return; } if (_lastTgHp < 0) { _lastTgHp = num; return; } int num2 = _lastTgHp - num; _lastTgHp = num; if (num2 <= 0) { return; } if (Time.time >= _mateCd) { _mateCd = Time.time + 0.35f; LosePip("HIT(mate) -" + num2); } if (BHeal == null || !BHeal.Value || (float)num2 < FHealHit.Value || _giveLeft <= 0 || Time.time < _giveCd) { return; } int num3 = Hp(Local); if (num3 >= 0) { int num4 = Mathf.Max(1, NHealCost.Value); int num5 = Mathf.Max(1, NHealKeep.Value); if (num3 - num4 < num5) { Log("HEAL skip self " + num3 + " - " + num4 + " < " + num5); return; } _giveCd = Time.time + 0.3f; _giveLeft--; TakeOwnHealth(num4); GiveHealth(target, num4); Log("HEAL drop=" + num2 + " self-" + num4 + " (" + num3 + ") mate+" + num4 + " left=" + _giveLeft); Say(Lang.R("输血:自己 -", "Donate: you -") + num4 + " / " + NameOf(target) + " +" + num4 + Lang.R("(剩 ", " (") + _giveLeft + Lang.R(" 次)", " left)")); } } private static void TakeOwnHealth(int amount) { PlayerAvatar local = Local; if ((Object)(object)local == (Object)null) { return; } object obj = R.Get(local, "playerHealth"); if (obj == null) { return; } _selfDmgUntil = Time.time + 0.3f; try { MethodInfo method = obj.GetType().GetMethod("Hurt", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[4] { typeof(int), typeof(bool), typeof(int), typeof(bool) }, null); if (method != null) { int num = Hp(Local); method.Invoke(obj, new object[4] { amount, true, -1, false }); int num2 = Hp(Local); if (num2 >= 0 && num2 < num) { return; } } } catch { } try { int num3 = Hp(Local); int num4 = 40; try { object obj3 = R.Get(obj, "maxHealth"); if (obj3 != null) { num4 = Convert.ToInt32(obj3); } } catch { } int num5 = Mathf.Max(1, num3 - amount); R.Set(obj, "health", num5); try { R.Call(obj, "UpdateHealthRPC", num5, num4, false, false); } catch { } Log("HEAL fallback direct " + num3 + " -> " + num5); } catch { } } private static void GiveHealth(PlayerAvatar tg, int amount) { if ((Object)(object)tg == (Object)null) { return; } object obj = R.Get(tg, "playerHealth"); if (obj == null) { return; } try { MethodInfo method = obj.GetType().GetMethod("HealOther", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[2] { typeof(int), typeof(bool) }, null); if (method != null) { method.Invoke(obj, new object[2] { amount, true }); return; } } catch { } try { R.Call(obj, "Heal", amount, true); } catch { } } private static void KillTumble() { if (Time.time < _cancelAt) { return; } PlayerAvatar local = Local; if ((Object)(object)local == (Object)null) { return; } object obj = R.Get(local, "tumble"); if (obj == null || !R.Bool(R.Get(obj, "isTumbling"))) { return; } _cancelAt = Time.time + 0.1f; try { MethodInfo method = obj.GetType().GetMethod("TumbleRequest", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[2] { typeof(bool), typeof(bool) }, null); if (method != null) { method.Invoke(obj, new object[2] { false, true }); Log("auto-cancel tumble"); } } catch { } } private static void PinPos() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar target = Target; if ((Object)(object)target == (Object)null) { return; } PlayerController val = (((Object)(object)Ctrl != (Object)null) ? Ctrl : CtrlInst()); if ((Object)(object)val == (Object)null) { return; } float num = TopY(target); float value = FHeight.Value; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(((Component)target).transform.position.x, num + value, ((Component)target).transform.position.z); object obj = R.Get(val, "rb"); Rigidbody val3 = (Rigidbody)((obj is Rigidbody) ? obj : null); if ((Object)(object)val3 == (Object)null) { val3 = ((Component)val).GetComponent<Rigidbody>(); } if ((Object)(object)val3 != (Object)null) { val3.velocity = Vector3.zero; val3.angularVelocity = Vector3.zero; val3.isKinematic = true; val3.useGravity = false; val3.position = val2; } PlayerAvatar local = Local; if ((Object)(object)local != (Object)null) { ((Component)local).transform.position = val2; object obj2 = R.Get(local, "playerTransform"); Transform val4 = (Transform)((obj2 is Transform) ? obj2 : null); if ((Object)(object)val4 != (Object)null) { val4.position = val2; } } R.Set(val, "positionPrevious", val2); } private static void ReleaseRb() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) PlayerController val = (((Object)(object)Ctrl != (Object)null) ? Ctrl : CtrlInst()); if (!((Object)(object)val == (Object)null)) { object obj = R.Get(val, "rb"); Rigidbody val2 = (Rigidbody)((obj is Rigidbody) ? obj : null); if ((Object)(object)val2 == (Object)null) { val2 = ((Component)val).GetComponent<Rigidbody>(); } if ((Object)(object)val2 != (Object)null) { val2.isKinematic = false; val2.useGravity = true; val2.velocity = Vector3.zero; } } } private static float TopY(PlayerAvatar p) { //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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) float num = 0f; Bounds bounds; try { Collider[] componentsInChildren = ((Component)p).GetComponentsInChildren<Collider>(true); if (componentsInChildren != null) { Collider[] array = componentsInChildren; foreach (Collider val in array) { if (!((Object)(object)val == (Object)null) && !val.isTrigger && val.enabled && ((Component)val).gameObject.activeInHierarchy) { bounds = val.bounds; float y = ((Bounds)(ref bounds)).max.y; if (y > num) { num = y; } } } } } catch { } float num2 = 0f; try { Renderer[] componentsInChildren2 = ((Component)p).GetComponentsInChildren<Renderer>(true); if (componentsInChildren2 != null) { Renderer[] array2 = componentsInChildren2; foreach (Renderer val2 in array2) { if ((Object)(object)val2 == (Object)null || !val2.enabled) { continue; } MeshRenderer val3 = (MeshRenderer)(object)((val2 is MeshRenderer) ? val2 : null); if (!((Object)(object)val3 != (Object)null) || ((Component)val3).gameObject.activeInHierarchy) { bounds = val2.bounds; float y2 = ((Bounds)(ref bounds)).max.y; if (y2 > num2) { num2 = y2; } } } } } catch { } if (num2 > 0.5f) { num = ((num > 0.01f) ? Mathf.Min(num, num2 + 0.12f) : (num2 + 0.12f)); } if (num <= 0.01f) { num = ((Component)p).transform.position.y + 2f; } if (R.Bool(R.Get(p, "isCrouching")) || R.Bool(R.Get(p, "isCrawling"))) { num -= Mathf.Max(0f, FCrouchFix.Value); } return num; } private static void HealthWatch() { int num = Hp(Local); if (num < 0) { _lastHp = -1; } else if (_lastHp < 0) { _lastHp = num; } else if (num < _lastHp) { int lastHp = _lastHp; _lastHp = num; if (On && !(Time.time < _selfDmgUntil) && !(Time.time < _hitCd)) { _hitCd = Time.time + 0.35f; LosePip("HIT hp " + lastHp + "->" + num); } } else { _lastHp = num; } } private static int Hp(PlayerAvatar p) { if ((Object)(object)p == (Object)null) { return -1; } try { object obj = R.Get(p, "playerHealth"); if (obj == null) { return -1; } object obj2 = R.Get(obj, "health"); if (obj2 == null) { return -1; } return Convert.ToInt32(obj2); } catch { return -1; } } private static void SetStiff(bool on) { _stiff = on; } internal static bool BlockExternalTumble(PlayerTumble t) { if (!On || !_stiff || (Object)(object)t == (Object)null) { return false; } PlayerAvatar local = Local; if ((Object)(object)local == (Object)null) { return false; } object obj = R.Get(local, "tumble"); if (obj == null || obj != t) { return false; } OnBlockedHit(); return true; } internal static bool BlockTumbleSet(PlayerTumble t, bool isTumbling, bool playerInput) { if (!isTumbling) { return false; } if (playerInput) { return false; } return BlockExternalTumble(t); } private static void OnBlockedHit() { if (On && _stiff && !(Time.time < _logCd)) { _logCd = Time.time + 0.35f; Log("BLOCK tumble energy=" + _energy); } } private static bool LosePip(string why) { if (!On) { return false; } if (_energy <= 0) { return false; } _energy--; Log(why + " energy=" + _energy); Say(Lang.R("挨了一下!能量 ", "Hit! Stamina ") + _energy + "/" + _energyMax); if (_energy <= 0) { DropByEnergy(); } return true; } private static int Riders(List<PlayerAvatar> outList, float near) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_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_0056: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) outList.Clear(); Vector3 val = LocalPos(); foreach (PlayerAvatar player in Players) { if (!((Object)(object)player == (Object)null) && !IsLocal(player) && !R.Bool(R.Get(player, "deadSet"))) { Vector3 val2 = ((Component)player).transform.position - val; if (!(val2.y < 0.9f) && !(val2.x * val2.x + val2.z * val2.z > near * near)) { outList.Add(player); } } } return outList.Count; } private static void ShakeOff() { if ((Object)(object)Local == (Object)null) { Say(Lang.R("甩人:还没认到自己的角色", "Shake-off: your avatar is not recognized yet")); } else if (On) { Say(Lang.R("甩人:先按翻滚键从别人头上下来", "Shake-off: get off their head first (tumble key)")); } else { if (Time.time < _shakeUntil || Hp(Local) <= 0) { return; } int num = Riders(_riders, 1.8f); if (num <= 0) { Say(Lang.R("头上没人", "Nobody on your head")); return; } foreach (PlayerAvatar rider in _riders) { try { object obj = R.Get(rider, "tumble"); if (obj != null) { R.Call(obj, "TumbleRequest", true, false); } } catch { } } _shakeUntil = Time.time + 0.7f; BroadcastMyHp(0, MaxHp()); Log("SHAKE riders=" + num + " broadcast hp=0 for 0.7s"); Say(Lang.R("甩人:演一下倒下,", "Shake-off: faking a knockdown for ") + num + Lang.R(" 个挂着的", " rider(s)")); } } private static void ShakeTick() { if (!(_shakeUntil <= 0f) && !(Time.time < _shakeUntil)) { _shakeUntil = 0f; int num = Hp(Local); if (num > 0) { BroadcastMyHp(num, MaxHp()); Log("SHAKE restore hp=" + num); } } } private static int MaxHp() { try { object obj = R.Get(Local, "playerHealth"); if (obj == null) { return 40; } object obj2 = R.Get(obj, "maxHealth"); if (obj2 == null) { return 40; } int num = Convert.ToInt32(obj2); return (num > 0) ? num : 40; } catch { return 40; } } private static void BroadcastMyHp(int hp, int max) { try { object obj = R.Get(Local, "photonView"); if (obj == null) { return; } MethodInfo methodInfo = null; MethodInfo[] methods = obj.GetType().GetMethods(); foreach (MethodInfo methodInfo2 in methods) { if (!(methodInfo2.Name != "RPC")) { ParameterInfo[] parameters = methodInfo2.GetParameters(); if (parameters.Length >= 3 && parameters[0].ParameterType == typeof(string) && parameters[1].ParameterType.IsEnum) { methodInfo = methodInfo2; break; } } } if (methodInfo == null) { Log("rpc: RPC method not found"); return; } Type parameterType = methodInfo.GetParameters()[1].ParameterType; object obj2 = null; if (parameterType.IsEnum) { string[] names = Enum.GetNames(parameterType); foreach (string text in names) { if (text == "Others") { obj2 = Enum.Parse(parameterType, text); break; } } } if (obj2 == null) { Log("rpc: RpcTarget.Others not found"); return; } methodInfo.Invoke(obj, new object[3] { "UpdateHealthRPC", obj2, new object[4] { hp, max, false, false } }); } catch (Exception ex) { Log("rpc hp fail " + ex.Message); } } private static void Scan() { try { Players.Clear(); PlayerAvatar[] array = Object.FindObjectsOfType<PlayerAvatar>(); if (array != null) { PlayerAvatar[] array2 = array; foreach (PlayerAvatar val in array2) { if ((Object)(object)val != (Object)null) { Players.Add(val); } } } } catch { } Local = null; foreach (PlayerAvatar player in Players) { if (R.Bool(R.Get(player, "isLocal"))) { Local = player; break; } } if ((Object)(object)Local == (Object)null && Players.Count == 1) { Local = Players[0]; } if ((Object)(object)Local == (Object)null) { object obj2 = R.Static(typeof(PlayerAvatar), "instance"); PlayerAvatar val2 = (PlayerAvatar)((obj2 is PlayerAvatar) ? obj2 : null); if (val2 != null) { Local = val2; } } Ctrl = CtrlInst(); if ((Object)(object)Local != (Object)null) { PlayerController component = ((Component)Local).GetComponent<PlayerController>(); if ((Object)(object)component != (Object)null) { Ctrl = component; } else { try { PlayerController[] array3 = Object.FindObjectsOfType<PlayerController>(); foreach (PlayerController val3 in array3) { if ((Object)(object)val3 != (Object)null && R.Get(val3, "playerAvatarScript") == Local) { Ctrl = val3; break; } } } catch { } } } LogSig(); } private static void LogSig() { int num = Players.Count * 31 + (((Object)(object)Local != (Object)null) ? 7 : 0) + (((Object)(object)Ctrl != (Object)null) ? 101 : 0); if (num != _lastSig) { _lastSig = num; Log("scan players=" + Players.Count + " local=" + (((Object)(object)Local != (Object)null) ? NameOf(Local) : "null") + " ctrl=" + (((Object)(object)Ctrl != (Object)null) ? "ok" : "null")); } } private static PlayerController CtrlInst() { object obj = R.Static(typeof(PlayerController), "instance"); return (PlayerController)((obj is PlayerController) ? obj : null); } public static bool IsLocal(PlayerAvatar p) { if ((Object)(object)p != (Object)null) { return p == Local; } return false; } public static Vector3 LocalPos() { //IL_0017: 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_0034: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Local != (Object)null) { return ((Component)Local).transform.position; } if ((Object)(object)Ctrl != (Object)null) { return ((Component)Ctrl).transform.position; } return Vector3.zero; } private static void TpToAim() { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0282: 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_0160: 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_016a: 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_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: 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_019d: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_032d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Local == (Object)null) { Say(Lang.R("传送:还没认到自己的角色", "Teleport: your avatar is not recognized yet")); return; } if (On) { Say(Lang.R("已经挂着了,先按翻滚键落下", "Already attached - press the tumble key to get down first")); return; } if (Time.time < _cdUntil) { Say(Lang.R("传送:冷却中 ", "Teleport: cooling down ") + CdLeft.ToString("0.0") + Lang.R(" 秒", "s")); return; } Camera val = Cam(); if ((Object)(object)val == (Object)null) { Say(Lang.R("传送:找不到相机", "Teleport: camera not found")); return; } Vector3 position = ((Component)val).transform.position; Vector3 forward = ((Component)val).transform.forward; float num = Mathf.Clamp(FTpDist.Value, 1f, 100f); float num2 = Mathf.Clamp(FTpAngle.Value, 3f, 80f); PlayerAvatar val2 = null; float num3 = 999f; RaycastHit val4 = default(RaycastHit); foreach (PlayerAvatar player in Players) { if ((Object)(object)player == (Object)null || IsLocal(player) || R.Bool(R.Get(player, "deadSet"))) { continue; } Vector3 val3 = ((Component)player).transform.position + Vector3.up * 0.9f - position; float magnitude = ((Vector3)(ref val3)).magnitude; if (magnitude > num || magnitude < 0.2f) { continue; } float num4 = Vector3.Angle(forward, val3); if (num4 > num2) { continue; } try { if (Physics.Raycast(position, ((Vector3)(ref val3)).normalized, ref val4, magnitude - 0.3f, -1, (QueryTriggerInteraction)1) && !((Component)((RaycastHit)(ref val4)).collider).transform.IsChildOf(((Component)player).transform)) { continue; } } catch { } if (num4 < num3) { num3 = num4; val2 = player; } } if ((Object)(object)val2 == (Object)null) { Say(Lang.R("传送:准星上没瞄到 " + num.ToString("0") + " 米内的队友", "Teleport: no teammate within " + num.ToString("0") + " m under the crosshair")); return; } Target = val2; float num5 = TopY(val2); Vector3 position2 = default(Vector3); ((Vector3)(ref position2))..ctor(((Component)val2).transform.position.x, num5 + FHeight.Value, ((Component)val2).transform.position.z); Ctrl = Ctrl ?? CtrlInst(); Rigidbody val5 = (Rigidbody)(((Object)(object)Ctrl != (Object)null) ? /*isinst with value type is only supported in some contexts*/: null); if ((Object)(object)val5 != (Object)null) { val5.isKinematic = true; val5.useGravity = false; val5.position = position2; } if ((Object)(object)Local != (Object)null) { ((Component)Local).transform.position = position2; object obj2 = R.Get(Local, "playerTransform"); Transform val6 = (Transform)((obj2 is Transform) ? obj2 : null); if ((Object)(object)val6 != (Object)null) { val6.position = position2; } } Mount(val2); Log("TP aim=" + NameOf(val2) + " ang=" + num3.ToString("0.0") + " dist=" + Vector3.Distance(position, ((Component)val2).transform.position).ToString("0.0")); } private static Camera Cam() { try { Camera main = Camera.main; if ((Object)(object)main != (Object)null) { return main; } } catch { } try { MethodInfo method = typeof(SemiFunc).GetMethod("MainCamera", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (method != null && method.GetParameters().Length == 0) { object? obj2 = method.Invoke(null, null); Camera val = (Camera)((obj2 is Camera) ? obj2 : null); if (val != null) { return val; } } } catch { } try { Camera[] array = Object.FindObjectsOfType<Camera>(); if (array != null) { Camera[] array2 = array; foreach (Camera val2 in array2) { if ((Object)(object)val2 != (Object)null && ((Behaviour)val2).isActiveAndEnabled) { return val2; } } } } catch { } return null; } private static void SceneWatch() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) string text = ""; try { Scene activeScene = SceneManager.GetActiveScene(); text = ((Scene)(ref activeScene)).name; } catch { } if (!(text == _scene)) { bool num = string.IsNullOrEmpty(_scene); _scene = text; if (!num) { On = false; Target = null; SetStiff(on: false); _names.Clear(); _energy = _energyMax; _lastHp = -1; _cdUntil = 0f; _scanAt = 0f; } } } public static void SelfTumble(bool on) { try { PlayerAvatar val = Local; if ((Object)(object)val == (Object)null) { PlayerController val2 = (((Object)(object)Ctrl != (Object)null) ? Ctrl : CtrlInst()); if ((Object)(object)val2 != (Object)null) { object obj = R.Get(val2, "playerAvatarScript"); val = (PlayerAvatar)((obj is PlayerAvatar) ? obj : null); } } if ((Object)(object)val == (Object)null) { return; } object obj2 = R.Get(val, "tumble"); if (obj2 != null) { MethodInfo method = obj2.GetType().GetMethod("TumbleRequest", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[2] { typeof(bool), typeof(bool) }, null); if (!(method == null)) { method.Invoke(obj2, new object[2] { on, true }); } } } catch { } } public static string NameOf(PlayerAvatar p) { if ((Object)(object)p == (Object)null) { return "?"; } if (_names.TryGetValue(((Object)p).GetInstanceID(), out var value) && !string.IsNullOrEmpty(value)) { return value; } value = R.Get(p, "playerName") as string; if (string.IsNullOrEmpty(value)) { value = R.Get(p, "steamID") as string; } if (string.IsNullOrEmpty(value)) { value = (((Object)p).name ?? Lang.R("队友", "Teammate")).Replace("(Clone)", "").Trim(); } _names[((Object)p).GetInstanceID()] = value; return value; } internal static void Say(string t) { _msg = t; _msgUntil = Time.time + Mathf.Max(0.5f, FMsgSec.Value); } public static void DrawHud() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) if (BHud == null || BHud.Value) { float num = Mathf.Clamp(FScale.Value, 0.6f, 2f); float reserveW = (AliveInMatch() ? DrawOrbHud(num) : 0f); if (On && (Object)(object)Target != (Object)null) { DrawEnergy(num, reserveW); } if (Time.time < _msgUntil && !string.IsNullOrEmpty(_msg)) { int fs = Mathf.RoundToInt(14f * num); Line((float)Screen.width - 24f * num, (float)Screen.height - 96f * num, _msg, fs, new Color(1f, 0.88f, 0.55f), rightAlign: true); } } } public static bool AliveInMatch() { PlayerAvatar local = Local; if ((Object)(object)local == (Object)null) { return false; } try { if (R.Bool(R.Get(local, "deadSet"))) { return false; } } catch { } return Hp(local) != 0; } private static float DrawOrbHud(float sc) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_0208: Unknown result type (might be due to invalid IL or missing references) float num = 32f * sc; float num2 = 46f * sc; float num3 = (float)Screen.width - num2 - 22f * sc; float num4 = (float)Screen.height - num - 26f * sc; float num5 = 10f; float cdLeft = SpiritOrb.CdLeft; bool flag = cdLeft <= 0f; Capsule(new Rect(num3 + 2f * sc, num4 + 3f * sc, num2, num), new Color(0f, 0f, 0f, 0.26f)); float num6 = (flag ? (0.55f + 0.45f * Mathf.Abs(Mathf.Sin(Time.time * 3f))) : 0.18f); Capsule(new Rect(num3, num4, num2, num), new Color(0.36f, 0.95f, 0.66f, (flag ? 0.42f : 0.14f) * num6 + 0.05f)); Capsule(new Rect(num3 + 1f * sc, num4 + 1f * sc, num2 - 2f * sc, num - 2f * sc), new Color(0.05f, 0.07f, 0.08f, 0.86f)); if (!flag) { float num7 = Mathf.Clamp01(1f - cdLeft / Mathf.Max(0.01f, num5)); float num8 = (num - 8f * sc) * num7; if (num8 > 1f) { Capsule(new Rect(num3 + 4f * sc, num4 + num - 4f * sc - num8, num2 - 8f * sc, num8), new Color(0.3f, 0.85f, 0.55f, 0.28f)); } } string text = (flag ? "G" : cdLeft.ToString("0.0")); int fs = Mathf.RoundToInt((flag ? 15f : 13f) * sc); CenterText(new Rect(num3, num4, num2, num), text, fs, flag ? new Color(0.8f, 1f, 0.88f, 1f) : new Color(1f, 0.84f, 0.45f, 0.95f)); return num2 + 10f * sc; } private static void CenterText(Rect r, string text, int fs, Color col) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown if (_stc == null) { _stc = new GUIStyle(GUI.skin.label); _stc.fontStyle = (FontStyle)1; _stc.alignment = (TextAnchor)4; _stc.richText = false; } _stc.fontSize = Mathf.Clamp(fs, 10, 32); Color textColor = _stc.normal.textColor; _stc.normal.textColor = col; GUI.Label(r, text, _stc); _stc.normal.textColor = textColor; } private static void DrawEnergy(float sc, float reserveW) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_0116: 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_0183: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0274: 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) int num = Mathf.Max(1, _energyMax); float num2 = 14f * sc; float num3 = 34f * sc; float num4 = 6f * sc; float num5 = 12f * sc; float num6 = 9f * sc; float num7 = (float)num * num3 + (float)(num - 1) * num4 + num5 * 2f; float num8 = num2 + num6 * 2f; float num9 = (float)Screen.width - num7 - 22f * sc - reserveW; float num10 = (float)Screen.height - num8 - 26f * sc; Capsule(new Rect(num9 + 2f * sc, num10 + 3f * sc, num7, num8), new Color(0f, 0f, 0f, 0.26f)); Capsule(new Rect(num9, num10, num7, num8), new Color(0.48f, 0.7f, 0.95f, 0.2f)); float num11 = num7 - 2f * sc; float num12 = num8 - 2f * sc; Capsule(new Rect(num9 + 1f * sc, num10 + 1f * sc, num11, num12), new Color(0.05f, 0.065f, 0.09f, 0.86f)); float num13 = num9 + num5; float num14 = num10 + (num8 - num2) * 0.5f; float num15 = ((num > 1) ? ((float)_energy / (float)num) : ((_energy > 0) ? 1f : 0f)); Color val = new Color(1f, 0.3f, 0.28f); Color val2 = default(Color); ((Color)(ref val2))..ctor(0.34f, 0.88f, 1f); Color val3 = Color.Lerp(val, val2, Mathf.Clamp01(num15)); float num16 = 1f; if (_energy <= 1) { num16 = 0.72f + 0.28f * Mathf.Abs(Mathf.Sin(Time.time * 4.2f)); } Rect r = default(Rect); for (int i = 0; i < num; i++) { ((Rect)(ref r))..ctor(num13 + (float)i * (num3 + num4), num14, num3, num2); if (i < _energy) { Color c = val3; c.a = 0.95f * num16; Capsule(r, c); Capsule(new Rect(((Rect)(ref r)).x + 2.5f * sc, ((Rect)(ref r)).y + 1.6f * sc, ((Rect)(ref r)).width - 5f * sc, num2 * 0.42f), new Color(1f, 1f, 1f, 0.2f * num16)); } else { Capsule(r, new Color(0.14f, 0.16f, 0.2f, 0.92f)); } } string text = NameOf(Target) + " " + _energy + "/" + num; if (BHeal != null && BHeal.Value) { text = text + Lang.R(" 输血 ", " Donate ") + Mathf.Max(0, _giveLeft) + "/" + Mathf.Max(1, NHealTimes.Value); } Line(num9 + num11 - 2f * sc, num10 - 22f * sc, text, Mathf.RoundToInt(13f * sc), new Color(0.82f, 0.92f, 1f, 0.92f), rightAlign: true); } private static void Capsule(Rect r, Color c) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be