Decompiled source of Skill tree rpg v0.6.12
BepInEx/plugins/GPTRPG.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.Globalization; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Codex.RoundsRpgMod; using ExitGames.Client.Photon; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using TMPro; using UnboundLib; using UnboundLib.Utils.UI; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("GPTRPG")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("GPTRPG")] [assembly: AssemblyTitle("GPTRPG")] [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 Codex.RoundsRpg.Api { public enum UpgradeCategory { Health, Attack, Defense, Mobility, Utility } public static class RpgContentApi { public static bool RegisterClass(int id, string title, string weapon, string passive, Action<Player> applyBase) { return PlayerClasses.Register(id, title, weapon, passive, applyBase); } public static bool RegisterClassLocalized(int id, string title, string weapon, string passive, string englishTitle, string englishWeapon, string englishPassive, Action<Player> applyBase) { return PlayerClasses.Register(id, title, weapon, passive, applyBase, englishTitle, englishWeapon, englishPassive); } public static bool RegisterGeneralNode(string id, string title, string description, int cost, int maxLevel, UpgradeCategory category, int graphX, int graphY, Action<Player, int> applyLevel, string prerequisiteId = null, int prerequisiteLevel = 0, bool replaceExisting = false, Func<int, float> runtimeMultiplier = null) { return RegisterNode(0, id, title, description, cost, maxLevel, category, graphX, graphY, applyLevel, prerequisiteId, prerequisiteLevel, replaceExisting, runtimeMultiplier); } public static bool RegisterClassNode(int classId, string id, string title, string description, int cost, int maxLevel, UpgradeCategory category, int graphX, int graphY, Action<Player, int> applyLevel, string prerequisiteId = null, int prerequisiteLevel = 0, bool replaceExisting = false, Func<int, float> runtimeMultiplier = null) { if (classId <= 0 || PlayerClasses.Find((PlayerClass)classId) == null) { return false; } return RegisterNode(classId, id, title, description, cost, maxLevel, category, graphX, graphY, applyLevel, prerequisiteId, prerequisiteLevel, replaceExisting, runtimeMultiplier); } public static bool RegisterGeneralNodeLocalized(string id, string title, string description, string englishTitle, string englishDescription, int cost, int maxLevel, UpgradeCategory category, int graphX, int graphY, Action<Player, int> applyLevel, string prerequisiteId = null, int prerequisiteLevel = 0, bool replaceExisting = false, Func<int, float> runtimeMultiplier = null) { return RegisterNode(0, id, title, description, cost, maxLevel, category, graphX, graphY, applyLevel, prerequisiteId, prerequisiteLevel, replaceExisting, runtimeMultiplier, englishTitle, englishDescription); } public static bool RegisterClassNodeLocalized(int classId, string id, string title, string description, string englishTitle, string englishDescription, int cost, int maxLevel, UpgradeCategory category, int graphX, int graphY, Action<Player, int> applyLevel, string prerequisiteId = null, int prerequisiteLevel = 0, bool replaceExisting = false, Func<int, float> runtimeMultiplier = null) { if (classId <= 0 || PlayerClasses.Find((PlayerClass)classId) == null) { return false; } return RegisterNode(classId, id, title, description, cost, maxLevel, category, graphX, graphY, applyLevel, prerequisiteId, prerequisiteLevel, replaceExisting, runtimeMultiplier, englishTitle, englishDescription); } private static bool RegisterNode(int classId, string id, string title, string description, int cost, int maxLevel, UpgradeCategory category, int graphX, int graphY, Action<Player, int> applyLevel, string prerequisiteId, int prerequisiteLevel, bool replaceExisting, Func<int, float> runtimeMultiplier, string englishTitle = null, string englishDescription = null) { if (string.IsNullOrWhiteSpace(id) || string.IsNullOrWhiteSpace(title) || cost < 1 || maxLevel < 1 || applyLevel == null || prerequisiteLevel < 0 || !TryConvertCategory(category, out var converted)) { return false; } UpgradeTree tree = ((classId != 0) ? UpgradeTree.Class : UpgradeTree.General); return UpgradeCatalog.RegisterNode(new UpgradeNode(id, title, description ?? string.Empty, cost, maxLevel, UpgradeEffect.Foundation, tree, prerequisiteId, prerequisiteLevel, converted, graphX, graphY, (PlayerClass)classId, applyLevel, runtimeMultiplier, null, 0, null, 0, null, englishTitle, englishDescription), replaceExisting); } private static bool TryConvertCategory(UpgradeCategory category, out Codex.RoundsRpgMod.UpgradeCategory converted) { switch (category) { case UpgradeCategory.Health: converted = Codex.RoundsRpgMod.UpgradeCategory.Health; return true; case UpgradeCategory.Attack: converted = Codex.RoundsRpgMod.UpgradeCategory.Attack; return true; case UpgradeCategory.Defense: converted = Codex.RoundsRpgMod.UpgradeCategory.Defense; return true; case UpgradeCategory.Mobility: converted = Codex.RoundsRpgMod.UpgradeCategory.Mobility; return true; case UpgradeCategory.Utility: converted = Codex.RoundsRpgMod.UpgradeCategory.Utility; return true; default: converted = Codex.RoundsRpgMod.UpgradeCategory.Utility; return false; } } } } namespace Codex.RoundsRpgMod { internal static class ClassSelectionWindow { [CompilerGenerated] private static class <>O { public static WindowFunction <0>__DrawContents; } private static Rect _window = new Rect(0f, 0f, 780f, 470f); private static bool _positionInitialized; private static int _selectionPlayerId = -1; private static PlayerClass _selectedClass; private static Vector2 _classScroll; private static GUIStyle _classButtonStyle; private static GUIStyle _descriptionTitleStyle; private static GUIStyle _descriptionStyle; private static GUIStyle _sectionStyle; internal static void Draw() { //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_0121: 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_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: Expected O, but got Unknown int? activeClassPickerPlayerId = SkillTreeRuntime.ActiveClassPickerPlayerId; if (activeClassPickerPlayerId.HasValue && PlayerClasses.All.Count != 0) { if (_selectionPlayerId != activeClassPickerPlayerId.Value || PlayerClasses.Find(_selectedClass) == null) { _selectionPlayerId = activeClassPickerPlayerId.Value; _selectedClass = PlayerClasses.All[0].Id; _classScroll = Vector2.zero; } EnsureStyles(); if (!_positionInitialized || ((Rect)(ref _window)).width > (float)Screen.width || ((Rect)(ref _window)).height > (float)Screen.height) { ((Rect)(ref _window)).width = Mathf.Min(780f, (float)Screen.width - 24f); ((Rect)(ref _window)).height = Mathf.Min(470f, (float)Screen.height - 24f); ((Rect)(ref _window)).x = ((float)Screen.width - ((Rect)(ref _window)).width) * 0.5f; ((Rect)(ref _window)).y = ((float)Screen.height - ((Rect)(ref _window)).height) * 0.5f; _positionInitialized = true; } Rect window = _window; object obj = <>O.<0>__DrawContents; if (obj == null) { WindowFunction val = DrawContents; <>O.<0>__DrawContents = val; obj = (object)val; } _window = GUI.Window(238400, window, (WindowFunction)obj, Localization.Text("Выбор класса", "Class Selection")); } } private static void DrawContents(int windowId) { //IL_003c: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: 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_013a: 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_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: 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_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: 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_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) int? activeClassPickerPlayerId = SkillTreeRuntime.ActiveClassPickerPlayerId; if (!activeClassPickerPlayerId.HasValue) { return; } float width = ((Rect)(ref _window)).width; float height = ((Rect)(ref _window)).height; GUI.Label(new Rect(20f, 24f, width - 160f, 28f), Localization.Text("Выбери класс", "Choose a class"), _descriptionTitleStyle); GUI.Label(new Rect(22f, 51f, width - 44f, 20f), Localization.Text("Игрок ", "Player ") + (activeClassPickerPlayerId.Value + 1), _sectionStyle); Rect val = default(Rect); ((Rect)(ref val))..ctor(22f, 76f, width - 290f, height - 154f); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(width - 250f, 76f, 228f, height - 154f); GUI.Box(val, GUIContent.none); GUI.Box(val2, GUIContent.none); float num = (float)PlayerClasses.All.Count * 64f; Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(0f, 0f, ((Rect)(ref val)).width - 18f, Mathf.Max(((Rect)(ref val)).height, num)); _classScroll = GUI.BeginScrollView(val, _classScroll, val3); for (int i = 0; i < PlayerClasses.All.Count; i++) { PlayerClassInfo playerClassInfo = PlayerClasses.All[i]; Rect val4 = new Rect(8f, 8f + (float)i * 64f, ((Rect)(ref val3)).width - 16f, 54f); Color color = GUI.color; if (_selectedClass == playerClassInfo.Id) { GUI.color = new Color(0.72f, 0.9f, 1f, 1f); } if (GUI.Button(val4, Localization.ClassTitle(playerClassInfo), _classButtonStyle)) { _selectedClass = playerClassInfo.Id; } GUI.color = color; } GUI.EndScrollView(); PlayerClassInfo playerClassInfo2 = PlayerClasses.Find(_selectedClass); GUI.Label(new Rect(((Rect)(ref val2)).x + 10f, ((Rect)(ref val2)).y + 10f, ((Rect)(ref val2)).width - 20f, 24f), Localization.Text("Описание класса", "Class description"), _descriptionTitleStyle); if (playerClassInfo2 != null) { float num2 = ((Rect)(ref val2)).y + 43f; GUI.Label(new Rect(((Rect)(ref val2)).x + 10f, num2, ((Rect)(ref val2)).width - 20f, 28f), Localization.ClassTitle(playerClassInfo2), _sectionStyle); num2 += 34f; GUI.Label(new Rect(((Rect)(ref val2)).x + 10f, num2, ((Rect)(ref val2)).width - 20f, 20f), Localization.Text("Оружие", "Weapon"), _sectionStyle); num2 += 20f; GUI.Label(new Rect(((Rect)(ref val2)).x + 10f, num2, ((Rect)(ref val2)).width - 20f, 78f), Localization.ClassWeapon(playerClassInfo2), _descriptionStyle); num2 += 84f; GUI.Label(new Rect(((Rect)(ref val2)).x + 10f, num2, ((Rect)(ref val2)).width - 20f, 20f), Localization.Text("Особенность", "Passive"), _sectionStyle); num2 += 20f; GUI.Label(new Rect(((Rect)(ref val2)).x + 10f, num2, ((Rect)(ref val2)).width - 20f, Mathf.Max(44f, ((Rect)(ref val2)).yMax - num2 - 10f)), Localization.ClassPassive(playerClassInfo2), _descriptionStyle); } Rect val5 = new Rect((width - 300f) * 0.5f, height - 62f, 300f, 42f); bool enabled = GUI.enabled; GUI.enabled = enabled && playerClassInfo2 != null; if (GUI.Button(val5, Localization.Text("Подтвердить выбор", "Confirm selection"))) { SkillTreeWindow.SelectClassTree(); NetworkBridge networkBridge = (Object.op_Implicit((Object)(object)CardChoice.instance) ? NetworkBridge.Ensure(CardChoice.instance) : null); if (Object.op_Implicit((Object)(object)networkBridge)) { networkBridge.RequestClass(activeClassPickerPlayerId.Value, _selectedClass); } else { SkillTreeRuntime.ReceiveClassChoice(activeClassPickerPlayerId.Value, _selectedClass); } } GUI.enabled = enabled; GUI.DragWindow(new Rect(0f, 0f, 10000f, 22f)); } private static void EnsureStyles() { //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_001d: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0049: 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_0055: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: 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_00a1: Expected O, but got Unknown //IL_00b2: 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_00be: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown if (_classButtonStyle == null) { _classButtonStyle = new GUIStyle(GUI.skin.button) { alignment = (TextAnchor)4, fontSize = 18, fontStyle = (FontStyle)1, wordWrap = true }; } if (_descriptionTitleStyle == null) { _descriptionTitleStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 18, fontStyle = (FontStyle)1, wordWrap = true }; } if (_descriptionStyle == null) { _descriptionStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)0, fontSize = 13, wordWrap = true }; } if (_sectionStyle == null) { _sectionStyle = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)3, fontSize = 14, fontStyle = (FontStyle)1, wordWrap = true }; } } } internal sealed class GunCombatHook : MonoBehaviour { private Gun _gun; private int _shooterSpreadIndex; private int _spreadProjectileCount; internal static void Attach(Gun gun) { if (Object.op_Implicit((Object)(object)gun)) { GunCombatHook gunCombatHook = ((Component)gun).GetComponent<GunCombatHook>(); if (!Object.op_Implicit((Object)(object)gunCombatHook)) { gunCombatHook = ((Component)gun).gameObject.AddComponent<GunCombatHook>(); } gunCombatHook.Bind(gun); } } private void Bind(Gun gun) { if (!((Object)(object)_gun == (Object)(object)gun)) { if (Object.op_Implicit((Object)(object)_gun)) { Gun gun2 = _gun; gun2.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(gun2.ShootPojectileAction, new Action<GameObject>(OnProjectileSpawned)); } _gun = gun; Gun gun3 = _gun; gun3.ShootPojectileAction = (Action<GameObject>)Delegate.Combine(gun3.ShootPojectileAction, new Action<GameObject>(OnProjectileSpawned)); } } private void OnProjectileSpawned(GameObject projectile) { if (!Object.op_Implicit((Object)(object)_gun) || !Object.op_Implicit((Object)(object)_gun.player) || !Object.op_Implicit((Object)(object)projectile)) { return; } PlayerProgress progress = SkillTreeRuntime.GetProgress(_gun.player.playerID); ProjectileAttackHook.Attach(_gun.player, projectile, progress.GetLevel(UpgradeTree.General, "attack_projectile_speed"), progress.GetLevel(UpgradeTree.General, "attack_projectile_size"), progress.GetLevel(UpgradeTree.General, "attack_damage_size") + progress.GetLevel(UpgradeTree.General, "attack_cooldown_size"), progress.GetLevel(UpgradeTree.General, "attack_homing") > 0); if (progress.SelectedClass == PlayerClass.Mage) { float damageMultiplier = Mathf.Pow(1.15f, (float)progress.GetLevel(UpgradeTree.Class, "mage_power")); MageRuntime.AttachProjectile(_gun, projectile, progress.SelectedElement, damageMultiplier); } if (progress.GetLevel(UpgradeTree.General, "health_parasite") > 0) { ProjectileHit component = projectile.GetComponent<ProjectileHit>(); if (Object.op_Implicit((Object)(object)component)) { MageRuntime.AttachParasite(_gun.player, projectile, component.damage); } } } private void OnDestroy() { if (Object.op_Implicit((Object)(object)_gun)) { Gun gun = _gun; gun.ShootPojectileAction = (Action<GameObject>)Delegate.Remove(gun.ShootPojectileAction, new Action<GameObject>(OnProjectileSpawned)); } } internal static void ApplyShooterSpread(Gun gun, GameObject projectile, int usedNumberOfProjectiles) { if (Object.op_Implicit((Object)(object)gun) && Object.op_Implicit((Object)(object)gun.player) && Object.op_Implicit((Object)(object)projectile) && SkillTreeRuntime.GetProgress(gun.player.playerID).SelectedClass == PlayerClass.Shooter) { GunCombatHook component = ((Component)gun).GetComponent<GunCombatHook>(); if (!Object.op_Implicit((Object)(object)component)) { Attach(gun); component = ((Component)gun).GetComponent<GunCombatHook>(); } if (Object.op_Implicit((Object)(object)component)) { component.ApplyShooterSpread(projectile, usedNumberOfProjectiles); } } } internal void ApplyShooterSpread(GameObject projectile, int usedNumberOfProjectiles) { if (!Object.op_Implicit((Object)(object)_gun) || !Object.op_Implicit((Object)(object)projectile)) { return; } int num = Mathf.Clamp((usedNumberOfProjectiles > 0) ? usedNumberOfProjectiles : _gun.numberOfProjectiles, 1, 32); if (_spreadProjectileCount != num) { _spreadProjectileCount = num; _shooterSpreadIndex = 0; } if (num <= 1) { _shooterSpreadIndex = 0; return; } int shooterSpreadIndex = _shooterSpreadIndex; _shooterSpreadIndex++; if (_shooterSpreadIndex >= num) { _shooterSpreadIndex = 0; } ProjectileSpreadRuntime.Apply(projectile, shooterSpreadIndex, num, 14f); } } internal sealed class SwordVisual : MonoBehaviour { private const float ThrustExtension = 0.65f; private const float ThrustOutTime = 0.075f; private const float ThrustHoldTime = 0.045f; private const float ThrustDuration = 0.24f; private readonly Dictionary<int, float> _nextTouchDamageTime = new Dictionary<int, float>(); private readonly HashSet<int> _thrustTargets = new HashSet<int>(); private Gun _gun; private WarriorSwordStyle? _configuredStyle; private SpriteRenderer[] _weaponSprites; private bool[] _spriteWasEnabled; private LineRenderer _blade; private LineRenderer _guard; private LineRenderer _grip; private float _reach; private float _thrustAge; private float _thrustDamage; private bool _thrusting; internal bool IsConfigured => _configuredStyle.HasValue; internal void Configure(WarriorSwordStyle? style, float reach) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_009c: 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_00dc: 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) EnsureRenderers(); _gun = ((Component)this).GetComponent<Gun>(); _configuredStyle = style; _reach = reach; EndThrust(); if (!style.HasValue) { RestoreWeaponSprites(); SetSwordRenderersEnabled(enabled: false); return; } HideWeaponSprites(); SetSwordRenderersEnabled(enabled: true); _blade.SetPosition(0, new Vector3(0f, -0.18f, 0f)); _blade.SetPosition(1, new Vector3(0f, reach, 0f)); _guard.SetPosition(0, new Vector3(-0.25f, -0.05f, 0f)); _guard.SetPosition(1, new Vector3(0.25f, -0.05f, 0f)); _grip.SetPosition(0, new Vector3(0f, -0.12f, 0f)); _grip.SetPosition(1, new Vector3(0f, -0.55f, 0f)); } internal void BeginThrust(float damage) { _thrusting = true; _thrustAge = 0f; _thrustDamage = damage; _thrustTargets.Clear(); } private void EndThrust() { _thrusting = false; SetSwordOffset(0f); } private void SetSwordOffset(float distance) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) Vector3 localPosition = Vector3.up * distance; ((Component)_blade).transform.localPosition = localPosition; ((Component)_guard).transform.localPosition = localPosition; ((Component)_grip).transform.localPosition = localPosition; } private void AnimateThrust() { if (_thrusting) { float thrustAge = _thrustAge; _thrustAge += Time.deltaTime; float num = ((thrustAge < 0.075f) ? Mathf.Min(0.075f, _thrustAge) : _thrustAge); if (num >= 0.24f) { EndThrust(); return; } float num2 = 0.120000005f; float num3 = ((num <= 0.075f) ? Mathf.SmoothStep(0f, 1f, num / 0.075f) : Mathf.SmoothStep(1f, 0f, (num - num2) / (0.24f - num2))); SetSwordOffset(_reach * 0.65f * num3); } } private void Update() { //IL_00fc: 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_0106: 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_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_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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: 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_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Unknown result type (might be due to invalid IL or missing references) //IL_03af: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Unknown result type (might be due to invalid IL or missing references) //IL_0428: Unknown result type (might be due to invalid IL or missing references) if (!_configuredStyle.HasValue || !Object.op_Implicit((Object)(object)_blade) || !((Renderer)_blade).enabled || !Object.op_Implicit((Object)(object)_gun) || !Object.op_Implicit((Object)(object)_gun.player)) { return; } Player player = _gun.player; if (!Object.op_Implicit((Object)(object)player.data) || !player.data.isPlaying || player.data.dead) { if (_thrusting) { EndThrust(); } return; } AnimateThrust(); if (!SkillTreeRuntime.IsLocallyOwned(player) || !Object.op_Implicit((Object)(object)PlayerManager.instance) || (_thrusting && _thrustDamage <= 0f)) { return; } List<Player> players = PlayerManager.instance.players; if (players == null) { return; } PlayerProgress progress = SkillTreeRuntime.GetProgress(player.playerID); float num = (WarriorAimTracker.HasOverheadBonus(player, progress) ? 1.2f : 1f); Vector3 val = ((Component)_blade).transform.TransformPoint(_blade.GetPosition(0)); Vector3 end = ((Component)_blade).transform.TransformPoint(_blade.GetPosition(1)); Vector3 val2 = (_thrusting ? ((Component)this).transform.TransformPoint(_blade.GetPosition(0)) : val); float num2 = Mathf.Max(_blade.startWidth, _blade.endWidth) * Mathf.Max(Mathf.Abs(((Component)_blade).transform.lossyScale.x), Mathf.Abs(((Component)_blade).transform.lossyScale.y)) * 0.5f; float num3 = Mathf.Clamp(0.25f * _gun.attackSpeed, 0.06f, 0.6f); float time = Time.time; for (int i = 0; i < players.Count; i++) { Player val3 = players[i]; if (!Object.op_Implicit((Object)(object)val3) || (Object)(object)val3 == (Object)(object)player || !Object.op_Implicit((Object)(object)val3.data) || val3.data.dead || val3.teamID == player.teamID || !Object.op_Implicit((Object)(object)val3.data.healthHandler)) { continue; } bool num4; if (!_thrusting) { if (!_nextTouchDamageTime.TryGetValue(val3.playerID, out var value)) { goto IL_0286; } num4 = time < value; } else { num4 = _thrustTargets.Contains(val3.playerID); } if (num4) { continue; } goto IL_0286; IL_0286: CircleCollider2D component = ((Component)val3).GetComponent<CircleCollider2D>(); Vector3 val4 = (Object.op_Implicit((Object)(object)component) ? ((Component)component).transform.TransformPoint(Vector2.op_Implicit(((Collider2D)component).offset)) : ((Component)val3).transform.position); float num5 = (Object.op_Implicit((Object)(object)component) ? (component.radius * Mathf.Max(Mathf.Abs(((Component)component).transform.lossyScale.x), Mathf.Abs(((Component)component).transform.lossyScale.y))) : 0.45f); Vector3 val5 = ClosestPointOnSegment(val, end, val4); float num6 = num5 + num2; Vector3 val6 = val4 - val5; if (!(((Vector3)(ref val6)).sqrMagnitude > num6 * num6) && CombatRuntime.HasClearMeleePath(player, val3, Vector2.op_Implicit(val2), Vector2.op_Implicit(val4))) { if (_thrusting) { _thrustTargets.Add(val3.playerID); } float num7 = (_thrusting ? _thrustDamage : (Mathf.Max(0f, _gun.damage * 15f) * 1.3f * num)); Vector2 val7 = Vector2.op_Implicit(val4 - ((Component)player).transform.position); if (((Vector2)(ref val7)).sqrMagnitude < 0.001f) { val7 = Vector2.op_Implicit(((Component)this).transform.up); } else { ((Vector2)(ref val7)).Normalize(); } ((Damagable)val3.data.healthHandler).CallTakeDamage(val7 * num7, Vector2.op_Implicit(val4), ((Component)_gun).gameObject, player, true); if (progress.GetLevel(UpgradeTree.General, "health_parasite") > 0) { MageRuntime.ApplyParasite(player, val3, num7, Vector2.op_Implicit(val4)); } _nextTouchDamageTime[val3.playerID] = time + num3; } } } private static Vector3 ClosestPointOnSegment(Vector3 start, Vector3 end, Vector3 point) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0018: Unknown result type (might be due to invalid IL or missing references) Vector3 val = end - start; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < 0.0001f) { return start; } float num = Mathf.Clamp01(Vector3.Dot(point - start, val) / sqrMagnitude); return start + val * num; } private void EnsureRenderers() { //IL_0090: 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_00ee: Unknown result type (might be due to invalid IL or missing references) if (_weaponSprites == null) { _weaponSprites = ((Component)this).GetComponentsInChildren<SpriteRenderer>(true); _spriteWasEnabled = new bool[_weaponSprites.Length]; for (int i = 0; i < _weaponSprites.Length; i++) { _spriteWasEnabled[i] = Object.op_Implicit((Object)(object)_weaponSprites[i]) && ((Renderer)_weaponSprites[i]).enabled; } } if (!Object.op_Implicit((Object)(object)_blade)) { _blade = CreateLine("GPT RPG Sword Blade", 0.15f, new Color(0.78f, 0.9f, 1f, 1f)); _guard = CreateLine("GPT RPG Sword Guard", 0.12f, new Color(0.8f, 0.57f, 0.2f, 1f)); _grip = CreateLine("GPT RPG Sword Grip", 0.1f, new Color(0.24f, 0.16f, 0.1f, 1f)); _blade.positionCount = 2; _guard.positionCount = 2; _grip.positionCount = 2; } } private LineRenderer CreateLine(string objectName, float width, Color color) { //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_0050: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown GameObject val = new GameObject(objectName); val.transform.SetParent(((Component)this).transform, false); LineRenderer val2 = val.AddComponent<LineRenderer>(); val2.useWorldSpace = false; val2.startWidth = width; val2.endWidth = width * 0.65f; val2.numCapVertices = 2; val2.numCornerVertices = 2; ((Renderer)val2).sortingOrder = 10; val2.startColor = color; val2.endColor = color; Shader val3 = Shader.Find("Sprites/Default"); if (Object.op_Implicit((Object)(object)val3)) { ((Renderer)val2).material = new Material(val3); } return val2; } private void HideWeaponSprites() { for (int i = 0; i < _weaponSprites.Length; i++) { if (Object.op_Implicit((Object)(object)_weaponSprites[i])) { ((Renderer)_weaponSprites[i]).enabled = false; } } } private void RestoreWeaponSprites() { for (int i = 0; i < _weaponSprites.Length; i++) { if (Object.op_Implicit((Object)(object)_weaponSprites[i])) { ((Renderer)_weaponSprites[i]).enabled = _spriteWasEnabled[i]; } } } private void SetSwordRenderersEnabled(bool enabled) { if (Object.op_Implicit((Object)(object)_blade)) { ((Renderer)_blade).enabled = enabled; } if (Object.op_Implicit((Object)(object)_guard)) { ((Renderer)_guard).enabled = enabled; } if (Object.op_Implicit((Object)(object)_grip)) { ((Renderer)_grip).enabled = enabled; } } } internal sealed class SwordSlashEffect : MonoBehaviour { private static Material _material; private LineRenderer _line; private Vector3 _origin; private float _startAngle; private float _arcDegrees; private float _reach; private float _duration; private float _elapsed; internal static void Spawn(Player player, float angle, WarriorSwordStyle style, float reach, float rotationSpeed) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)player)) { SwordStyleInfo info = WarriorStyles.Get(style); GameObject val = new GameObject("GPT RPG Sword Slash"); val.transform.position = ((Component)player).transform.position; val.AddComponent<SwordSlashEffect>().Initialize(player, angle, style, reach, rotationSpeed, info); } } private void Initialize(Player player, float angle, WarriorSwordStyle style, float reach, float rotationSpeed, SwordStyleInfo info) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00c0: 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_00d1: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown _line = ((Component)this).gameObject.AddComponent<LineRenderer>(); _line.useWorldSpace = true; _line.positionCount = 18; _line.startWidth = 0.16f; _line.endWidth = 0.06f; _line.numCapVertices = 3; _line.numCornerVertices = 3; ((Renderer)_line).sortingOrder = 15; Color val = ((style == WarriorSwordStyle.Long) ? new Color(1f, 0.75f, 0.32f, 0.95f) : new Color(0.7f, 0.92f, 1f, 0.95f)); _line.startColor = val; _line.endColor = new Color(val.r, val.g, val.b, 0.35f); if (!Object.op_Implicit((Object)(object)_material)) { Shader val2 = Shader.Find("Sprites/Default"); if (Object.op_Implicit((Object)(object)val2)) { _material = new Material(val2); } } if (Object.op_Implicit((Object)(object)_material)) { ((Renderer)_line).material = _material; } _origin = ((Component)player).transform.position; _origin.z -= 0.1f; _startAngle = angle - info.ArcDegrees * 0.5f; _arcDegrees = info.ArcDegrees; _reach = reach; _duration = 0.22f / Mathf.Max(0.25f, rotationSpeed); DrawArc(0.02f); } private void Update() { if (Object.op_Implicit((Object)(object)_line)) { _elapsed += Time.deltaTime; float num = Mathf.Clamp01(_elapsed / _duration); DrawArc(num); if (num >= 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } private void DrawArc(float progress) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_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) float num = _arcDegrees * Mathf.Max(0.02f, progress); for (int i = 0; i < _line.positionCount; i++) { float num2 = (float)i / (float)(_line.positionCount - 1); float num3 = (_startAngle + num * num2) * (MathF.PI / 180f); _line.SetPosition(i, _origin + new Vector3(Mathf.Cos(num3), Mathf.Sin(num3), 0f) * _reach); } } } internal static class CombatRuntime { private const float BaseArmRotationDegreesPerSecond = 540f; private const float SwordThrustDamageMultiplier = 1.25f; internal static void ConfigureSword(Player player, WarriorSwordStyle? style) { if (!Object.op_Implicit((Object)(object)player)) { return; } Gun val = FindGun(player); if (Object.op_Implicit((Object)(object)val)) { SwordVisual swordVisual = ((Component)val).GetComponent<SwordVisual>(); if (!Object.op_Implicit((Object)(object)swordVisual)) { swordVisual = ((Component)val).gameObject.AddComponent<SwordVisual>(); } float reach = (style.HasValue ? GetSwordReach(player) : 0f); swordVisual.Configure(style, reach); } } internal static void ShowSwordSlash(int playerId, float angle, WarriorSwordStyle style, bool overhead) { Player val = SkillTreeRuntime.FindPlayer(playerId); if (Object.op_Implicit((Object)(object)val)) { float rotationSpeed = (overhead ? 1.5f : 1f); SwordSlashEffect.Spawn(val, angle, style, GetSwordReach(val), rotationSpeed); } } internal static void ShowRemoteSwordThrust(int playerId) { Player val = SkillTreeRuntime.FindPlayer(playerId); if (Object.op_Implicit((Object)(object)val) && !SkillTreeRuntime.IsLocallyOwned(val) && SkillTreeRuntime.GetProgress(playerId).SelectedClass == PlayerClass.Warrior) { Gun val2 = FindGun(val); if (Object.op_Implicit((Object)(object)val2)) { BeginSwordThrust(val, val2, 0f); } } } private static void BeginSwordThrust(Player player, Gun gun, float damage) { SwordVisual swordVisual = ((Component)gun).GetComponent<SwordVisual>(); if (!Object.op_Implicit((Object)(object)swordVisual)) { swordVisual = ((Component)gun).gameObject.AddComponent<SwordVisual>(); } if (!swordVisual.IsConfigured) { swordVisual.Configure(SkillTreeRuntime.GetProgress(player.playerID).SwordStyle, GetSwordReach(player)); } swordVisual.BeginThrust(damage); } internal static float GetSwordReach(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return WarriorStyles.Neutral.Reach; } PlayerProgress progress = SkillTreeRuntime.GetProgress(player.playerID); float num = Mathf.Pow(1.05f, (float)(progress.GetLevel(UpgradeTree.Class, "warrior_core_sword_size") + progress.GetLevel(UpgradeTree.Class, "warrior_standard_size"))) * Mathf.Pow(1.1f, (float)progress.GetLevel(UpgradeTree.Class, "warrior_heavy_size")); return WarriorStyles.Get(progress.SwordStyle).Reach * num; } internal static float GetSwordAimRotationSpeed(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return 1f; } PlayerProgress progress = SkillTreeRuntime.GetProgress(player.playerID); return Mathf.Clamp((progress.WarriorSubclassChosen ? WarriorStyles.Get(progress.SwordStyle) : WarriorStyles.Neutral).AimRotationSpeed * Mathf.Pow(1.1f, (float)progress.GetLevel(UpgradeTree.Class, "warrior_core_rotation")), 0.35f, 3.5f); } internal static void UpdateWarriorArmAim(Player player) { //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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: 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_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_00ca: 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) if (!Object.op_Implicit((Object)(object)player) || !Object.op_Implicit((Object)(object)player.data)) { return; } PlayerProgress progress = SkillTreeRuntime.GetProgress(player.playerID); if (progress.SelectedClass != PlayerClass.Warrior || !SkillTreeRuntime.IsLocallyOwned(player)) { return; } GeneralInput input = player.data.input; if (!Object.op_Implicit((Object)(object)input)) { return; } Vector3 aim = input.aimDirection; if (((Vector3)(ref aim)).sqrMagnitude < 0.001f && Optionshandler.leftStickAim) { aim = input.direction; } if (!(((Vector3)(ref aim)).sqrMagnitude < 0.001f)) { WarriorAimTracker warriorAimTracker = ((Component)player).GetComponent<WarriorAimTracker>(); if (!Object.op_Implicit((Object)(object)warriorAimTracker)) { warriorAimTracker = ((Component)player).gameObject.AddComponent<WarriorAimTracker>(); } float maxStep = 540f * GetSwordAimRotationSpeed(player) * Time.deltaTime; Vector3 aimDirection = (input.aimDirection = warriorAimTracker.Follow(aim, maxStep, WarriorAimTracker.CanChop(player, progress))); player.data.aimDirection = aimDirection; } } internal static void ApplyWarriorSlow(Player attacker, Player target) { if (!Object.op_Implicit((Object)(object)attacker) || !Object.op_Implicit((Object)(object)target) || !SkillTreeRuntime.IsLocallyOwned(attacker)) { return; } PlayerProgress progress = SkillTreeRuntime.GetProgress(attacker.playerID); if (progress.SelectedClass == PlayerClass.Warrior && progress.GetLevel(UpgradeTree.Class, "warrior_slow") > 0) { NetworkBridge networkBridge = (Object.op_Implicit((Object)(object)CardChoice.instance) ? NetworkBridge.Ensure(CardChoice.instance) : null); if (Object.op_Implicit((Object)(object)networkBridge)) { networkBridge.BroadcastWarriorSlow(target.playerID); } else { WarriorSlowHook.Apply(target); } } } internal static bool HasClearMeleePath(Player attacker, Player target, Vector2 start, Vector2 end) { //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) if (!Object.op_Implicit((Object)(object)attacker) || !Object.op_Implicit((Object)(object)target)) { return false; } RaycastHit2D[] array = Physics2D.LinecastAll(start, end); for (int i = 0; i < array.Length; i++) { Collider2D collider = ((RaycastHit2D)(ref array[i])).collider; if (Object.op_Implicit((Object)(object)collider) && !collider.isTrigger) { Player componentInParent = ((Component)collider).GetComponentInParent<Player>(); if (!((Object)(object)componentInParent == (Object)(object)attacker) && !((Object)(object)componentInParent == (Object)(object)target)) { return false; } } } return true; } internal static void Swing(Gun gun, float projectileDamage) { //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_00f7: 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_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0257: 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_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028a: 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_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: 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_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_032c: 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_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)gun) || !Object.op_Implicit((Object)(object)gun.player)) { return; } Player player = gun.player; PlayerProgress progress = SkillTreeRuntime.GetProgress(player.playerID); if (progress.SelectedClass != PlayerClass.Warrior || !Object.op_Implicit((Object)(object)player.data) || !player.data.isPlaying || player.data.dead || !SkillTreeRuntime.IsLocallyOwned(player)) { return; } SwordStyleInfo swordStyleInfo = WarriorStyles.Get(progress.SwordStyle); Vector2 val = WarriorMovement.SwordDirection(player, gun); bool flag = WarriorAimTracker.HasOverheadBonus(player, progress); float num = (flag ? 1.2f : 1f); float num2 = Mathf.Max(0f, projectileDamage) * 1.3f * num; NetworkBridge networkBridge = (Object.op_Implicit((Object)(object)CardChoice.instance) ? NetworkBridge.Ensure(CardChoice.instance) : null); if (progress.GetLevel(UpgradeTree.Class, "warrior_lunge") > 0) { BeginSwordThrust(player, gun, num2 * 1.25f); if (Object.op_Implicit((Object)(object)networkBridge)) { networkBridge.BroadcastSwordThrust(player.playerID); } return; } float angle = Mathf.Atan2(val.y, val.x) * 57.29578f; if (Object.op_Implicit((Object)(object)networkBridge)) { networkBridge.BroadcastSwordSlash(player.playerID, angle, (int)progress.SwordStyle, flag); } else { ShowSwordSlash(player.playerID, angle, progress.SwordStyle, flag); } List<Player> list = (Object.op_Implicit((Object)(object)PlayerManager.instance) ? PlayerManager.instance.players : null); if (list == null) { return; } for (int i = 0; i < list.Count; i++) { Player val2 = list[i]; if (!Object.op_Implicit((Object)(object)val2) || (Object)(object)val2 == (Object)(object)player || !Object.op_Implicit((Object)(object)val2.data) || val2.data.dead || val2.teamID == player.teamID) { continue; } Vector2 val3 = Vector2.op_Implicit(((Component)val2).transform.position - ((Component)player).transform.position); float magnitude = ((Vector2)(ref val3)).magnitude; CircleCollider2D component = ((Component)val2).GetComponent<CircleCollider2D>(); float num3 = (Object.op_Implicit((Object)(object)component) ? (component.radius * Mathf.Abs(((Component)val2).transform.lossyScale.x)) : 0.45f); if (magnitude > GetSwordReach(player)) { continue; } float num4 = swordStyleInfo.ArcDegrees * 0.5f + Mathf.Atan2(num3, magnitude) * 57.29578f; if (Vector2.Angle(val, val3) > num4 || !Object.op_Implicit((Object)(object)val2.data.healthHandler) || !HasClearMeleePath(player, val2, Vector2.op_Implicit(((Component)player).transform.position), Vector2.op_Implicit(((Component)val2).transform.position))) { continue; } ((Damagable)val2.data.healthHandler).CallTakeDamage(val * num2, Vector2.op_Implicit(((Component)val2).transform.position), ((Component)gun).gameObject, player, true); if (flag) { HealthHandler healthHandler = val2.data.healthHandler; if (Object.op_Implicit((Object)(object)healthHandler)) { healthHandler.CallTakeForce(val * 1.5f, (ForceMode2D)1, false, true, 0.1f); } } if (progress.GetLevel(UpgradeTree.General, "health_parasite") > 0) { MageRuntime.ApplyParasite(player, val2, num2, Vector2.op_Implicit(((Component)val2).transform.position)); } } } private static Gun FindGun(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return null; } Holding component = ((Component)player).GetComponent<Holding>(); Gun val = ((Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.holdable)) ? ((Component)component.holdable).GetComponent<Gun>() : null); if (!Object.op_Implicit((Object)(object)val)) { return ((Component)player).GetComponentInChildren<Gun>(); } return val; } } internal static class DelayedDamageRuntime { private static readonly object Committed = new object(); private static readonly ConditionalWeakTable<IEnumerator, object> CommittedRoutines = new ConditionalWeakTable<IEnumerator, object>(); [ThreadStatic] private static HealthHandler _schedulingFor; internal static void Schedule(HealthHandler health, Vector2 damage, Vector2 position, float time, float interval, Color color, GameObject weapon, Player attacker, bool lethal) { //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_0054: Unknown result type (might be due to invalid IL or missing references) CharacterData component = ((Component)health).GetComponent<CharacterData>(); Player val = (Object.op_Implicit((Object)(object)component) ? component.player : null); bool num = Object.op_Implicit((Object)(object)val) && SkillTreeRuntime.GetProgress(val.playerID).GetLevel(UpgradeTree.General, "defense_damage_over_time") > 0; HealthHandler schedulingFor = _schedulingFor; _schedulingFor = (num ? health : null); try { health.TakeDamageOverTime(damage, position, time, interval, color, weapon, attacker, lethal); } finally { _schedulingFor = schedulingFor; } } internal static void Capture(HealthHandler health, IEnumerator routine) { if (Object.op_Implicit((Object)(object)_schedulingFor) && !((Object)(object)_schedulingFor != (Object)(object)health) && routine != null) { _schedulingFor = null; CommittedRoutines.Add(routine, Committed); } } internal static bool IgnoreBlock(bool original, IEnumerator routine) { object value; if (!original) { return CommittedRoutines.TryGetValue(routine, out value); } return true; } } [HarmonyPatch(typeof(HealthHandler), "TakeDamage", new Type[] { typeof(Vector2), typeof(Vector2), typeof(Color), typeof(GameObject), typeof(Player), typeof(bool), typeof(bool) })] internal static class ScheduleDelayedDamagePatch { private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { MethodInfo schedule = AccessTools.Method(typeof(HealthHandler), "TakeDamageOverTime", (Type[])null, (Type[])null); MethodInfo replacement = AccessTools.Method(typeof(DelayedDamageRuntime), "Schedule", (Type[])null, (Type[])null); foreach (CodeInstruction instruction in instructions) { if (CodeInstructionExtensions.Calls(instruction, schedule)) { instruction.opcode = OpCodes.Call; instruction.operand = replacement; } yield return instruction; } } } [HarmonyPatch(typeof(DamageOverTime), "DoDamageOverTime")] internal static class CaptureDelayedDamageRoutinePatch { private static void Postfix(HealthHandler ___health, IEnumerator __result) { DelayedDamageRuntime.Capture(___health, __result); } } [HarmonyPatch] internal static class ApplyDelayedDamageTickPatch { private static MethodBase TargetMethod() { return AccessTools.EnumeratorMoveNext((MethodBase)AccessTools.Method(typeof(DamageOverTime), "DoDamageOverTime", (Type[])null, (Type[])null)); } private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { MethodInfo applyDamage = AccessTools.Method(typeof(HealthHandler), "DoDamage", (Type[])null, (Type[])null); MethodInfo ignoreBlock = AccessTools.Method(typeof(DelayedDamageRuntime), "IgnoreBlock", (Type[])null, (Type[])null); foreach (CodeInstruction instruction in instructions) { if (!CodeInstructionExtensions.Calls(instruction, applyDamage)) { yield return instruction; continue; } OpCode opcode = instruction.opcode; instruction.opcode = OpCodes.Ldarg_0; instruction.operand = null; yield return instruction; yield return new CodeInstruction(OpCodes.Call, (object)ignoreBlock); yield return new CodeInstruction(opcode, (object)applyDamage); } } } internal static class ExtraJumpRuntime { private sealed class JumpBonus { internal int Applied; } private static readonly ConditionalWeakTable<CharacterData, JumpBonus> Bonuses = new ConditionalWeakTable<CharacterData, JumpBonus>(); internal static void SetBonus(Player player, int extraJumps) { if (!Object.op_Implicit((Object)(object)player) || !Object.op_Implicit((Object)(object)player.data)) { return; } CharacterData data = player.data; if (!Bonuses.TryGetValue(data, out var value)) { if (extraJumps == 0) { return; } value = Bonuses.GetValue(data, (CharacterData _) => new JumpBonus()); } int num = extraJumps - value.Applied; if (num != 0) { data.jumps += num; data.currentJumps = Mathf.Clamp(Mathf.Max(0, data.currentJumps) + num, 0, data.jumps); if (extraJumps == 0) { Bonuses.Remove(data); } else { value.Applied = extraJumps; } } } } internal sealed class ExtraShieldChargeHook : MonoBehaviour { private Player _player; private float _extraChargeReadyAt; internal static void Attach(Player player) { if (Object.op_Implicit((Object)(object)player)) { ExtraShieldChargeHook extraShieldChargeHook = ((Component)player).GetComponent<ExtraShieldChargeHook>(); if (!Object.op_Implicit((Object)(object)extraShieldChargeHook)) { extraShieldChargeHook = ((Component)player).gameObject.AddComponent<ExtraShieldChargeHook>(); } extraShieldChargeHook._player = player; } } internal static void ResetCharge(Player player) { if (Object.op_Implicit((Object)(object)player)) { ExtraShieldChargeHook component = ((Component)player).GetComponent<ExtraShieldChargeHook>(); if (Object.op_Implicit((Object)(object)component)) { component._extraChargeReadyAt = 0f; } } } internal static bool TryUseExtraCharge(Block block) { //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)block)) { return true; } Player val = FindPlayer(block); if (!Object.op_Implicit((Object)(object)val) || !SkillTreeRuntime.IsLocallyOwned(val) || SkillTreeRuntime.GetProgress(val.playerID).GetLevel(UpgradeTree.General, "defense_aegis") <= 0) { return true; } Attach(val); ExtraShieldChargeHook component = ((Component)val).GetComponent<ExtraShieldChargeHook>(); if (!Object.op_Implicit((Object)(object)component)) { return true; } if (!block.IsOnCD()) { return true; } if (Time.time < component._extraChargeReadyAt) { return false; } component._extraChargeReadyAt = Time.time + Mathf.Max(0.15f, block.Cooldown()); block.CallDoBlock(true, true, (BlockTriggerType)0, Vector3.zero, false); return false; } private static Player FindPlayer(Block block) { Player componentInParent = ((Component)block).GetComponentInParent<Player>(); if (Object.op_Implicit((Object)(object)componentInParent)) { return componentInParent; } List<Player> list = (Object.op_Implicit((Object)(object)PlayerManager.instance) ? PlayerManager.instance.players : null); if (list == null) { return null; } for (int i = 0; i < list.Count; i++) { Player val = list[i]; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.data) && (Object)(object)val.data.block == (Object)(object)block) { return val; } } return null; } } internal static class HealthRuntime { internal static void ConfigureRegeneration(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return; } PlayerProgress progress = SkillTreeRuntime.GetProgress(player.playerID); int level = progress.GetLevel(UpgradeTree.General, "health_regen"); int level2 = progress.GetLevel(UpgradeTree.General, "health_regen_reserve"); int level3 = progress.GetLevel(UpgradeTree.General, "health_standing_regen"); float num = (float)level * 0.005f + (float)level2 * 0.003f + ((level3 > 0) ? 0.05f : 0f); StandingRegenerationHook standingRegenerationHook = ((Component)player).GetComponent<StandingRegenerationHook>(); if (num <= 0f) { if (Object.op_Implicit((Object)(object)standingRegenerationHook)) { Object.Destroy((Object)(object)standingRegenerationHook); } return; } if (!Object.op_Implicit((Object)(object)standingRegenerationHook)) { standingRegenerationHook = ((Component)player).gameObject.AddComponent<StandingRegenerationHook>(); } standingRegenerationHook.Configure(player, num, level3 > 0); } } internal sealed class StandingRegenerationHook : MonoBehaviour { private Player _player; private float _rate; private bool _doublesWhileStanding; private float _pendingHeal; internal void Configure(Player player, float rate, bool doublesWhileStanding) { _player = player; _rate = Mathf.Max(0f, rate); _doublesWhileStanding = doublesWhileStanding; } private void Update() { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_player)) { _player = ((Component)this).GetComponent<Player>(); } if (!Object.op_Implicit((Object)(object)_player) || !Object.op_Implicit((Object)(object)_player.data) || _player.data.dead || _rate <= 0f || !SkillTreeRuntime.IsLocallyOwned(_player) || !Object.op_Implicit((Object)(object)_player.data.healthHandler)) { return; } Rigidbody2D val = ((Component)_player).GetComponent<Rigidbody2D>(); if (!Object.op_Implicit((Object)(object)val)) { val = ((Component)_player).GetComponentInChildren<Rigidbody2D>(); } int num; if (Object.op_Implicit((Object)(object)val)) { Vector2 velocity = val.velocity; num = ((((Vector2)(ref velocity)).sqrMagnitude <= 0.04f) ? 1 : 0); } else { num = 0; } bool flag = (byte)num != 0; float num2 = ((_doublesWhileStanding && flag) ? 2f : 1f); float maxHealth = _player.data.maxHealth; if (maxHealth <= 0f) { return; } if (_player.data.health >= maxHealth - 0.001f) { _pendingHeal = 0f; return; } _pendingHeal += _rate * num2 * maxHealth * Time.deltaTime; float num3 = Mathf.Floor(_pendingHeal); if (!(num3 < 1f)) { _pendingHeal -= num3; _player.data.healthHandler.Heal(num3); } } } internal static class Localization { internal sealed class LanguageOption { internal string Code { get; } internal string DisplayName { get; } internal LanguageOption(string code, string displayName) { Code = code; DisplayName = displayName; } } private static readonly List<LanguageOption> SupportedLanguageList = new List<LanguageOption> { new LanguageOption("en", "English"), new LanguageOption("ru", "Russian") }; private static readonly Dictionary<string, string> EnglishNodeTitles = new Dictionary<string, string> { ["health_growth"] = "Toughness", ["health_lifesteal"] = "Bloodletting", ["health_lifesteal_damage"] = "Hunting Thirst", ["health_lifesteal_reserve"] = "Blood Reserve", ["health_parasite"] = "Parasite", ["health_regen"] = "Recovery", ["health_regen_health"] = "Vitality", ["health_regen_reserve"] = "Healthy Reserve", ["health_standing_regen"] = "Stillness", ["health_extra_life"] = "Extra life", ["attack_power"] = "Damage +5%", ["attack_projectile_speed"] = "Bullet Speed +10%", ["attack_projectile_size"] = "Attack Size +10%", ["attack_speed"] = "Fire Rate +10%", ["attack_bounce"] = "Bounce +1", ["attack_damage_size"] = "Damage and Size", ["attack_cooldown_size"] = "Size and Cooldown", ["attack_rapid_fire"] = "Barrage", ["attack_homing"] = "Homing", ["attack_bounce_mastery"] = "Bounce Master", ["defense_armor"] = "Defense", ["defense_block_duration"] = "Extended Shield", ["defense_block"] = "Fast Shield", ["defense_evade"] = "Evasion", ["defense_resistance"] = "Damage Reduction", ["defense_block_health"] = "Hardened Shield", ["defense_evade_resistance"] = "Evasive Defense", ["defense_bulwark"] = "Restorative Shield", ["defense_damage_over_time"] = "Delayed Damage", ["defense_aegis"] = "Extra shield", ["mobility_speed"] = "Mobility", ["mobility_jump"] = "Jump", ["mobility_agility"] = "Agility", ["mobility_double_jump"] = "Double Jump", ["mobility_dash"] = "Swift Dash", ["warrior_core_damage"] = "Sword Damage +5%", ["warrior_core_sword_size"] = "Sword Size +5%", ["warrior_core_rotation"] = "Mouse Follow +10%", ["warrior_common_damage"] = "Sword Damage +10%", ["warrior_common_movement"] = "Movement Speed +5%", ["warrior_lunge"] = "Lunge", ["warrior_slow"] = "Slow Target", ["warrior_subclass_short"] = "Short Sword", ["warrior_short_attack"] = "Attack Rate +10%", ["warrior_short_movement"] = "Run Speed +10%", ["warrior_short_dash"] = "Shield Dash", ["warrior_subclass_standard"] = "Standard Sword", ["warrior_standard_size"] = "Sword Size +5%", ["warrior_standard_attack"] = "Attack Rate +5%", ["warrior_standard_damage"] = "Sword Damage +10%", ["warrior_subclass_heavy"] = "Large Sword", ["warrior_heavy_size"] = "Sword Size +10%", ["warrior_heavy_damage"] = "Sword Damage +20%", ["warrior_heavy_overhead"] = "Overhead Swing", ["shooter_rate"] = "Quick Trigger", ["shooter_magazine"] = "Extended Magazine", ["shooter_burst"] = "Burst Fire", ["shooter_reload"] = "Quick Reload", ["mage_power"] = "Elemental Power", ["mage_duration"] = "Echo Duration", ["mage_control"] = "Area of Effect" }; private static readonly Dictionary<string, string> EnglishNodeDescriptions = new Dictionary<string, string> { ["health_growth"] = "+10% max health per level.", ["health_lifesteal"] = "Steal 15% of damage dealt as health per level.", ["health_lifesteal_damage"] = "+7.5% life steal and +2.5% damage per level.", ["health_lifesteal_reserve"] = "+7.5% life steal and +5% max health per level.", ["health_parasite"] = "Hits infect the target and deal damage over 4 seconds. +20% health, +50% life steal and +10% damage.", ["health_regen"] = "Regenerate 0.5% max health per second per level.", ["health_regen_health"] = "+20% max health per level.", ["health_regen_reserve"] = "+0.3% regeneration per second and +5% max health per level.", ["health_standing_regen"] = "Regeneration doubles while standing still. +30% max health and +5% regeneration per second.", ["health_extra_life"] = "Permanent upgrade: +1 extra respawn each round. This purchase is not consumed when used.", ["attack_power"] = "+5% damage per level.", ["attack_projectile_speed"] = "Projectiles fly 10% faster per level.", ["attack_projectile_size"] = "Projectile size and hitbox increase by 10% per level.", ["attack_speed"] = "The weapon attacks 10% more often per level.", ["attack_bounce"] = "+1 projectile bounce per level.", ["attack_damage_size"] = "+5% damage and +5% attack size per level.", ["attack_cooldown_size"] = "Attack cooldown is 5% shorter and attack size 5% larger per level.", ["attack_rapid_fire"] = "Special: fire rate +1000%, +12 ammo and −50% damage.", ["attack_homing"] = "Special: projectiles seek the nearest enemy and deal +15% damage.", ["attack_bounce_mastery"] = "Unique: +5 bounces, +10% damage and +80% base damage per bounce.", ["defense_armor"] = "Damage received is reduced by 4% per level.", ["defense_block_duration"] = "Shield action lasts 0.1 seconds longer per level.", ["defense_block"] = "Shield cooldown is 5% shorter per level.", ["defense_evade"] = "Chance to completely dodge a hit increases by 2% per level.", ["defense_resistance"] = "Damage received is reduced by an additional 8% per level.", ["defense_block_health"] = "Shield cooldown is 2.5% shorter and max health is 5% higher per level.", ["defense_evade_resistance"] = "Dodge chance +1% and damage received −4% per level.", ["defense_bulwark"] = "Special: blocking restores 2.5% max health, lasts 0.5 seconds longer and recharges 10% faster.", ["defense_damage_over_time"] = "Damage received is spread over 4 seconds. Blocking does not cancel the remaining ticks.", ["defense_aegis"] = "Special: gain a separate second shield charge with its own recharge.", ["mobility_speed"] = "+5% movement speed per level.", ["mobility_jump"] = "+8% jump height per level.", ["mobility_agility"] = "+8% movement speed per level.", ["mobility_double_jump"] = "Special: gain one extra mid-air jump.", ["mobility_dash"] = "Special: +25% movement speed and one extra jump.", ["warrior_core_damage"] = "+5% sword damage per level.", ["warrior_core_sword_size"] = "+5% sword length and hitbox radius per level.", ["warrior_core_rotation"] = "+10% speed at which the sword follows the mouse per level.", ["warrior_common_damage"] = "+10% sword damage per level.", ["warrior_common_movement"] = "+5% movement speed per level.", ["warrior_lunge"] = "Attack thrusts the blade forward for +65% reach and +25% damage without pushing your character.", ["warrior_slow"] = "Sword hits slow the target by 35% for 1.25 seconds. Another hit refreshes the duration.", ["warrior_subclass_short"] = "+40% attack rate, −30% damage and −40% sword size.", ["warrior_short_attack"] = "+10% sword attack rate per level.", ["warrior_short_movement"] = "+10% movement speed per level.", ["warrior_short_dash"] = "Activating the shield launches you in the direction of the sword.", ["warrior_subclass_standard"] = "+10% sword damage.", ["warrior_standard_size"] = "+5% sword length and hitbox radius per level.", ["warrior_standard_attack"] = "+5% sword attack rate per level.", ["warrior_standard_damage"] = "+10% sword damage per level.", ["warrior_subclass_heavy"] = "+40% damage and sword size, −20% attack rate and −45% sword mouse-follow speed.", ["warrior_heavy_size"] = "+10% sword length and hitbox radius per level.", ["warrior_heavy_damage"] = "+20% sword damage per level.", ["warrior_heavy_overhead"] = "While the sword moves downward, it deals 20% more damage and follows your aim 50% faster.", ["shooter_rate"] = "Fire rate +12% per level.", ["shooter_magazine"] = "+2 rounds per magazine per level.", ["shooter_burst"] = "+1 projectile per shot; requires Extended Magazine.", ["shooter_reload"] = "Reload 15% faster per level.", ["mage_power"] = "+15% damage for magic bullets and effects per level.", ["mage_duration"] = "+20% effect duration per level.", ["mage_control"] = "+20% explosion and acid cloud radius per level." }; private static readonly Dictionary<MageElement, string> EnglishElementTitles = new Dictionary<MageElement, string> { [MageElement.Fire] = "Fire", [MageElement.Poison] = "Poison", [MageElement.Ice] = "Ice", [MageElement.Explosion] = "Explosion", [MageElement.Stun] = "Stun", [MageElement.AcidCloud] = "Acid Cloud", [MageElement.Parasite] = "Parasite" }; private static readonly Dictionary<MageElement, string> EnglishElementDescriptions = new Dictionary<MageElement, string> { [MageElement.Fire] = "Sets the target on fire and deals damage over time.", [MageElement.Poison] = "Poisons the target with a series of small hits.", [MageElement.Ice] = "Briefly immobilizes the target.", [MageElement.Explosion] = "Damages players around the point of impact.", [MageElement.Stun] = "Stuns the target briefly.", [MageElement.AcidCloud] = "Leaves a cloud that damages players standing in it.", [MageElement.Parasite] = "Infects the target and deals damage over time." }; internal static IReadOnlyList<LanguageOption> Languages => SupportedLanguageList; internal static string LanguageCode { get { if (MainPlugin.InterfaceLanguage == null) { return "en"; } return MainPlugin.InterfaceLanguage.Value; } } internal static LanguageOption SelectedLanguage => FindLanguage(LanguageCode) ?? SupportedLanguageList[0]; internal static bool IsEnglish => LanguageCode == "en"; internal static bool IsRussian => LanguageCode == "ru"; internal static string Text(string russian, string english) { if (!IsRussian) { return english; } return russian; } internal static LanguageOption FindLanguage(string code) { for (int i = 0; i < SupportedLanguageList.Count; i++) { if (string.Equals(SupportedLanguageList[i].Code, code, StringComparison.OrdinalIgnoreCase)) { return SupportedLanguageList[i]; } } return null; } internal static void SetLanguage(string code) { ConfigEntry<string> interfaceLanguage = MainPlugin.InterfaceLanguage; LanguageOption languageOption = FindLanguage(code); if (interfaceLanguage != null && languageOption != null) { interfaceLanguage.Value = languageOption.Code; if (Object.op_Implicit((Object)(object)MainPlugin.Instance)) { ((BaseUnityPlugin)MainPlugin.Instance).Config.Save(); } } } internal static string NodeTitle(UpgradeNode node) { if (node == null || IsRussian) { if (node == null) { return string.Empty; } return node.Title; } if (!string.IsNullOrWhiteSpace(node.EnglishTitle)) { return node.EnglishTitle; } if (node.ApplyLevel != null) { return node.Title; } if (!EnglishNodeTitles.TryGetValue(node.Id, out var value)) { return node.Title; } return value; } internal static string NodeDescription(UpgradeNode node) { if (node == null || IsRussian) { if (node == null) { return string.Empty; } return node.Description; } if (!string.IsNullOrWhiteSpace(node.EnglishDescription)) { return node.EnglishDescription; } if (node.ApplyLevel != null) { return node.Description; } if (!EnglishNodeDescriptions.TryGetValue(node.Id, out var value)) { return node.Description; } return value; } internal static string ClassTitle(PlayerClassInfo info) { if (info == null || IsRussian) { return info?.Title ?? string.Empty; } if (!string.IsNullOrWhiteSpace(info.EnglishTitle)) { return info.EnglishTitle; } return info.Id switch { PlayerClass.Warrior => "Warrior", PlayerClass.Shooter => "Shooter", PlayerClass.Mage => "Mage", _ => info.Title, }; } internal static string ClassWeapon(PlayerClassInfo info) { if (info == null || IsRussian) { return info?.Weapon ?? string.Empty; } if (!string.IsNullOrWhiteSpace(info.EnglishWeapon)) { return info.EnglishWeapon; } return info.Id switch { PlayerClass.Warrior => "Sword. Choose the short, standard, or large subclass in the skill tree.", PlayerClass.Shooter => "Standard ROUNDS weapon with no starting penalties.", PlayerClass.Mage => "Bullets gain the selected elemental effect.", _ => info.Weapon, }; } internal static string ClassPassive(PlayerClassInfo info) { if (info == null || IsRussian) { return info?.Passive ?? string.Empty; } if (!string.IsNullOrWhiteSpace(info.EnglishPassive)) { return info.EnglishPassive; } return info.Id switch { PlayerClass.Warrior => "Choosing one sword subclass locks the other two branches.", PlayerClass.Shooter => "The tree improves fire rate, magazine size, burst fire, and reload speed.", PlayerClass.Mage => "Choose fire, poison, ice, explosion, stun, or acid cloud.", _ => info.Passive, }; } internal static string ElementTitle(MageElementInfo element) { if (element == null || IsRussian) { return element?.Title ?? string.Empty; } if (!EnglishElementTitles.TryGetValue(element.Id, out var value)) { return element.Title; } return value; } internal static string ElementDescription(MageElementInfo element) { if (element == null || IsRussian) { return element?.Description ?? string.Empty; } if (!EnglishElementDescriptions.TryGetValue(element.Id, out var value)) { return element.Description; } return value; } } internal sealed class MageProjectileEffectHook : MonoBehaviour { private ProjectileHit _projectileHit; private Player _caster; private MageElement _element; private float _damage; private bool _hasHit; internal void Initialize(Player caster, MageElement element, float damage, ProjectileHit projectileHit) { _caster = caster; _element = element; _damage = damage; _projectileHit = projectileHit; if (Object.op_Implicit((Object)(object)_projectileHit)) { _projectileHit.AddHitActionWithData((Action<HitInfo>)OnHit); } } private void OnHit(HitInfo info) { //IL_0131: Unknown result type (might be due to invalid IL or missing references) if (!_hasHit && Object.op_Implicit((Object)(object)_caster) && SkillTreeRuntime.IsLocallyOwned(_caster)) { _hasHit = true; Player val = (Object.op_Implicit((Object)(object)info.transform) ? ((Component)info.transform).GetComponentInParent<Player>() : null); int targetId = ((Object.op_Implicit((Object)(object)val) && (Object)(object)val != (Object)(object)_caster) ? val.playerID : (-1)); SkillTreeRuntime.GetProgress(_caster.playerID); NetworkBridge networkBridge = (Object.op_Implicit((Object)(object)CardChoice.instance) ? NetworkBridge.Ensure(CardChoice.instance) : null); if (Object.op_Implicit((Object)(object)networkBridge)) { networkBridge.BroadcastMageImpact(_caster.playerID, targetId, _element, _damage, 1f, SkillTreeRuntime.GetMageDurationMultiplier(_caster.playerID), SkillTreeRuntime.GetMageAreaMultiplier(_caster.playerID), info.point.x, info.point.y); } else { MageRuntime.ReceiveImpact(_caster.playerID, targetId, _element, _damage, 1f, SkillTreeRuntime.GetMageDurationMultiplier(_caster.playerID), SkillTreeRuntime.GetMageAreaMultiplier(_caster.playerID), info.point); } } } } internal sealed class ParasiteProjectileEffectHook : MonoBehaviour { private ProjectileHit _projectileHit; private Player _caster; private float _damage; private bool _hasHit; internal void Initialize(Player caster, float damage, ProjectileHit projectileHit) { _caster = caster; _damage = damage; _projectileHit = projectileHit; if (Object.op_Implicit((Object)(object)_projectileHit)) { _projectileHit.AddHitActionWithData((Action<HitInfo>)OnHit); } } private void OnHit(HitInfo info) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) if (!_hasHit && Object.op_Implicit((Object)(object)_caster) && SkillTreeRuntime.IsLocallyOwned(_caster)) { Player val = (Object.op_Implicit((Object)(object)info.transform) ? ((Component)info.transform).GetComponentInParent<Player>() : null); if (Object.op_Implicit((Object)(object)val) && !((Object)(object)val == (Object)(object)_caster) && val.teamID != _caster.teamID) { _hasHit = true; MageRuntime.ApplyParasite(_caster, val, _damage, info.point); } } } } internal sealed class MageStatusController : MonoBehaviour { private sealed class DotEffect { internal MageElement Element; internal int CasterId; internal float DamagePerTick; internal float Interval; internal float NextTick; internal float Expires; } private readonly List<DotEffect> _effects = new List<DotEffect>(); private Player _target; internal static MageStatusController For(Player player) { if (!Object.op_Implicit((Object)(object)player)) { return null; } MageStatusController mageStatusController = ((Component)player).GetComponent<MageStatusController>(); if (!Object.op_Implicit((Object)(object)mageStatusController)) { mageStatusController = ((Component)player).gameObject.AddComponent<MageStatusController>(); } mageStatusController._target = player; return mageStatusController; } internal void ApplyDot(int casterId, MageElement element, float damagePerTick, float interval, float duration) { float time = Time.time; foreach (DotEffect effect in _effects) { if (effect.CasterId == casterId && effect.Element == element) { effect.DamagePerTick = Mathf.Max(effect.DamagePerTick, damagePerTick); effect.Interval = Mathf.Min(effect.Interval, interval); effect.Expires = Mathf.Max(effect.Expires, time + duration); return; } } _effects.Add(new DotEffect { CasterId = casterId, Element = element, DamagePerTick = damagePerTick, Interval = interval, NextTick = time + interval, Expires = time + duration }); } private void Update() { //IL_00ce: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)_target)) { _target = ((Component)this).GetComponent<Player>(); } if (!Object.op_Implicit((Object)(object)_target) || !Object.op_Implicit((Object)(object)_target.data) || !SkillTreeRuntime.IsLocallyOwned(_target)) { return; } for (int num = _effects.Count - 1; num >= 0; num--) { DotEffect dotEffect = _effects[num]; if (Time.time >= dotEffect.Expires) { _effects.RemoveAt(num); } else if (!_target.data.dead && Object.op_Implicit((Object)(object)_target.data.healthHandler)) { while (Time.time >= dotEffect.NextTick && dotEffect.NextTick < dotEffect.Expires) { Player val = SkillTreeRuntime.FindPlayer(dotEffect.CasterId); ((Damagable)_target.data.healthHandler).CallTakeDamage(Vector2.up * dotEffect.DamagePerTick, Vector2.op_Implicit(((Component)_target).transform.position), (GameObject)null, val, true); dotEffect.NextTick += dotEffect.Interval; } } } } } internal sealed class MageAcidCloud : MonoBehaviour { private int _casterId; private float _damage; private float _radius; private float _nextTick; private float _expires; internal static void Spawn(int casterId, Vector2 position, float damage, float radius, float duration) { //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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0069: 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) GameObject val = new GameObject("GPT RPG Acid Cloud"); val.transform.position = new Vector3(position.x, position.y, 0f); MageAcidCloud mageAcidCloud = val.AddComponent<MageAcidCloud>(); mageAcidCloud._casterId = casterId; mageAcidCloud._damage = damage; mageAcidCloud._radius = radius; mageAcidCloud._nextTick = Time.time + 0.35f; mageAcidCloud._expires = Time.time + duration; MageRuntime.DrawAreaMarker(val.transform.position, radius, new Color(0.45f, 1f, 0.24f, 0.4f), duration); } private void Update() { //IL_00de: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0121: 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_0131: Unknown result type (might be due to invalid IL or missing references) if (Time.time >= _expires) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { if (Time.time < _nextTick) { return; } _nextTick = Time.time + 0.6f; Player val = SkillTreeRuntime.FindPlayer(_casterId); if (!Object.op_Implicit((Object)(object)val) || !Object.op_Implicit((Object)(object)PlayerManager.instance) || PlayerManager.instance.players == null) { return; } foreach (Player player in PlayerManager.instance.players) { if (Object.op_Implicit((Object)(object)player) && Object.op_Implicit((Object)(object)player.data) && !player.data.dead && player.teamID != val.teamID && Object.op_Implicit((Object)(object)player.data.healthHandler) && SkillTreeRuntime.IsLocallyOwned(player) && Vector2.Distance(Vector2.op_Implicit(((Component)this).transform.position), Vector2.op_Implicit(((Component)player).transform.position)) <= _radius) { ((Damagable)player.data.healthHandler).CallTakeDamage(Vector2.up * (_damage * 0.16f), Vector2.op_Implicit(((Component)this).transform.position), (GameObject)null, val, true); } } } } } internal static class MageRuntime { internal static void AttachParasite(Player caster, GameObject projectile, float damage) { if (!Object.op_Implicit((Object)(object)caster) || !Object.op_Implicit((Object)(object)projectile)) { return; } ProjectileHit component = projectile.GetComponent<ProjectileHit>(); if (Object.op_Implicit((Object)(object)component)) { ParasiteProjectileEffectHook parasiteProjectileEffectHook = projectile.GetComponent<ParasiteProjectileEffectHook>(); if (!Object.op_Implicit((Object)(object)parasiteProjectileEffectHook)) { parasiteProjectileEffectHook = projectile.AddComponent<ParasiteProjectileEffectHook>(); } parasiteProjectileEffectHook.Initialize(caster, damage, component); } } internal static void ApplyParasite(Player caster, Player target, float damage, Vector2 point) { //IL_0097: 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_006e: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)caster) && Object.op_Implicit((Object)(object)target) && !((Object)(object)target == (Object)(object)caster) && target.teamID != caster.teamID) { NetworkBridge networkBridge = (Object.op_Implicit((Object)(object)CardChoice.instance) ? NetworkBridge.Ensure(CardChoice.instance) : null); if (Object.op_Implicit((Object)(object)networkBridge)) { networkBridge.BroadcastMageImpact(caster.playerID, target.playerID, MageElement.Parasite, damage, 1f, 1f, 1f, point.x, point.y); } else { ReceiveImpact(caster.playerID, target.playerID, MageElement.Parasite, damage, 1f, 1f, 1f, point); } } } internal static void AttachProjectile(Gun gun, GameObject projectile, MageElement element, float damageMultiplier) { ProjectileHit component = projectile.GetComponent<ProjectileHit>(); if (Object.op_Implicit((Object)(object)component)) { component.damage *= Mathf.Max(1f, damageMultiplier); MageProjectileEffectHook mageProjectileEffectHook = projectile.GetComponent<MageProjectileEffectHook>(); if (!Object.op_Implicit((Object)(object)mageProjectileEffectHook)) { mageProjectileEffectHook = projectile.AddComponent<MageProjectileEffectHook>(); } mageProjectileEffectHook.Initialize(gun.player, element, component.damage, component); } } internal static void SetProjectileColor(Player player, MageElement element) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!Object.op_Implicit((Object)(object)player)) { return; } Color projectileColor = ColorFor(element); Gun[] componentsInChildren = ((Component)player).GetComponentsInChildren<Gun>(); foreach (Gun val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val)) { val.projectileColor = projectileColor; } } } internal static Color ColorFor(MageElement element) { //IL_0037: 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_006b: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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) return (Color)(element switch { MageElement.Fire => new Color(1f, 0.3f, 0.08f, 1f), MageElement.Poison => new Color(0.35f, 0.95f, 0.18f, 1f), MageElement.Ice => new Color(0.3f, 0.8f, 1f, 1f), MageElement.Explosion => new Color(1f, 0.65f, 0.12f, 1f), MageElement.Stun => new Color(0.8f, 0.35f, 1f, 1f), MageElement.AcidCloud => new Color(0.6f, 1f, 0.22f, 1f), _ => Color.white, }); } internal static void ReceiveImpact(int casterId, int targetId, MageElement element, float damage, float power, float duration, float area, Vector2 point) { //IL_011b: 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_00dd: 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_010a: 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) Player val = SkillTreeRuntime.FindPlayer(casterId); Player target = SkillTreeRuntime.FindPlayer(targetId); float num = Mathf.Max(0f, damage * power); switch (element) { case MageElement.Fire: ApplyDot(target, casterId, element, num * 0.12f, 0.5f, 2f * duration); break; case MageElement.Poison: ApplyDot(target, casterId, element, num * 0.07f, 0.4f, 2.8f * duration); break; case MageElement.Parasite: ApplyDot(target, casterId, element, num * 0.04f, 0.5f, 4f * duration); break; case MageElement.Ice: ApplyStun(target, 0.42f * duration); break; case MageElement.Stun: ApplyStun(target, 0.82f * duration); break; case MageElement.Explosion: if (Object.op_Implicit((Object)(object)val) && SkillTreeRuntime.IsLocallyOwned(val)) { Explode(val, point, num, 1.65f * area); } DrawAreaMarker(new Vector3(point.x, point.y, 0f), 1.65f * area, new Color(1f, 0.54f, 0.13f, 0.8f), 0.25f); break; case MageElement.AcidCloud: MageAcidCloud.Spawn(casterId, point, num, 1.85f * area, 3.2f * duration); break; } } internal static void DrawAreaMarker(Vector3 center, float radius, Color color, float duration) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Expected O, but got Unknown //IL_00a1: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("GPT RPG Area Effect"); LineRenderer val2 = val.AddComponent<LineRenderer>(); val2.useWorldSpace = true; val2.positionCount = 25; val2.startWidth = 0.08f; val2.endWidth = 0.025f; val2.loop = true; ((Renderer)val2).sortingOrder = 11; val2.startColor = color; val2.endColor = color; Shader val3 = Shader.Find("Sprites/Default"); if (Object.op_Implicit((Object)(object)val3)) { ((Renderer)val2).material = new Material(val3); } center.z -= 0.08f; for (int i = 0; i < val2.positionCount; i++) { float num = (float)i / (float)val2.positionCount * MathF.PI * 2f; val2.SetPosition(i, center + new Vector3(Mathf.Cos(num), Mathf.Sin(num), 0f) * radius); } Object.Destroy((Object)(object)val, duration); } private static void ApplyDot(Player target, int casterId, MageElement element, float damagePerTick, float interval, float duration) { if (Object.op_Implicit((Object)(object)target)) { MageStatusController.For(target).ApplyDot(casterId, element, damagePerTick, interval, duration); } } private static void ApplyStun(Player target, float duration) { if (Object.op_Implicit((Object)(object)target) && Object.op_Implicit((Object)(object)target.data) && SkillTreeRuntime.IsLocallyOwned(target)) { StunHandler component = ((Component)target).GetComponent<StunHandler>(); if (Object.op_Implicit((Object)(object)component)) { component.AddStun(duration); } } } private static void Explode(Player caster, Vector2 point, float damage, float radius) { //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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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) if (!Object.op_Implicit((Object)(object)PlayerManager.instance) || PlayerManager.instance.players == null) { return; } foreach (Player player in PlayerManager.instance.players) { if (Object.op_Implicit((Object)(object)player) && Object.op_Implicit((Object)(object)player.data) && !player.data.dead && !((Object)(object)player == (Object)(object)caster) && player.teamID != caster.teamID && Object.op_Implicit((Object)(object)player.data.healthHandler)) { Vector2 val = Vector2.op_Implicit(((Component)player).transform.position) - point; float magnitude = ((Vector2)(ref val)).magnitude; if (!(magnitude > radius)) { float num = 1f - 0.35f * Mathf.Clamp01(magnitude / radius); float num2 = damage * 0.55f * num; Vector2 val2 = ((magnitude > 0.001f) ? (val / magnitude) : Vector2.up); ((Damagable)player.data.healthHandler).CallTakeDamage(val2 * num2, point, (GameObject)null, caster, true); } } } } } [BepInPlugin("com.codex.roundsrpg", "Skill tree rpg", "0.6.12")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("Rounds.exe")] public sealed class MainPlugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__19_0; internal void <Awake>b__19_0() { } } public const string PluginGuid = "com.codex.roundsrpg"; public const string ModName = "Skill tree rpg"; public const string Version = "0.6.12"; internal static MainPlugin Instance { get; private set; } internal static ManualLogSource PluginLogger { get; private set; } internal static ConfigEntry<int> PointsPerCardChoice { get; private set; } internal static ConfigEntry<string> InterfaceLanguage { get; private set; } private void Awake() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown Instance = this; PluginLogger = ((BaseUnityPlugin)this).Logger; PointsPerCardChoice = ((BaseUnityPlugin)this).Config.Bind<int>("Progression", "PointsPerCardChoice", 3, "Очки прокачки за магазин. В сетевой игре используется значение хоста."); InterfaceLanguage = ((BaseUnityPlugin)this).Config.Bind<string>("Interface", "Language", "en", "Choose the mod interface language from the available list."); object obj = <>c.<>9__19_0; if (obj == null) { UnityAction val = delegate { }; <>c.<>9__19_0 = val; obj = (object)val; } Unbound.RegisterMenu("Skill tree rpg", (UnityAction)obj, (Action<GameObject>)ModSettingsUI.Build, (GameObject)null, false); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Настройки Skill tree rpg зарегистрированы в меню Mods."); InstallGamePatches(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Skill tree rpg загружен. Выбор карт заменён классами и двумя деревьями прокачки."); } private void InstallGamePatches() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown Harmony val = new Harmony("com.codex.roundsrpg"); Type[] array = new Type[3] { typeof(CardChoiceStartPickPatch), typeof(CardChoiceDoPlayerSelectPatch), typeof(CardChoiceAwakePatch) }; Type[] array2 = array; foreach (Type type in array2) { val.CreateClassProcessor(type).Patch(); } Harmony val2 = new Harmony("com.codex.roundsrpg.parallel-shop"); try { val2.CreateClassProcessor(typeof(ParallelShopGameModePatch)).Patch(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Обработчики параллельного магазина установлены."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Параллельный магазин недоступен. Используется прокачка по очереди. " + ex)); try {