Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of FirstMod v0.8.0
FirstMod.dll
Decompiled 10 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.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using HG; using Microsoft.CodeAnalysis; using On.RoR2; using Rewired; using RoR2; using RoR2.CharacterAI; using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("FirstMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+93aa80ca2c3746d9bf6cecf9b56180bdbcf31892")] [assembly: AssemblyProduct("FirstMod")] [assembly: AssemblyTitle("FirstMod")] [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 FirstMod { [BepInPlugin("com.Kavoshnik.firstmod", "FirstMod", "0.8.0")] public class Plugin : BaseUnityPlugin { private struct ItemEntry { public ItemDef def; public string name; public string lower; public int order; public Color color; public string tip; } private struct EquipEntry { public EquipmentDef def; public string name; public string lower; public int order; public Color color; public string tip; } private struct SpawnEntry { public string masterName; public string name; public string lower; public Texture icon; public bool boss; } private class TpPoint { public string name; public Vector3 pos; public string scene; } private struct StageEntry { public SceneDef def; public string sceneName; public string name; public string lower; } private struct ArtifactEntry { public ArtifactDef def; public string name; } private enum Lang { RU, EN } private struct ObjEntry { public InteractableSpawnCard card; public string name; public string lower; } private struct SurvivorEntry { public string bodyName; public string name; } private static readonly string[][] CommandTable = new string[29][] { new string[2] { "fm_god", "CmdGod" }, new string[2] { "fm_oneshot", "CmdOneShot" }, new string[2] { "fm_heal", "CmdHeal" }, new string[2] { "fm_revive", "CmdRevive" }, new string[2] { "fm_money", "CmdMoney" }, new string[2] { "fm_lunar", "CmdLunar" }, new string[2] { "fm_giveitem", "CmdGiveItem" }, new string[2] { "fm_takeitem", "CmdTakeItem" }, new string[2] { "fm_clearinv", "CmdClearInv" }, new string[2] { "fm_equip", "CmdEquip" }, new string[2] { "fm_killall", "CmdKillAll" }, new string[2] { "fm_tele", "CmdTele" }, new string[2] { "fm_nextstage", "CmdNextStage" }, new string[2] { "fm_restartstage", "CmdRestartStage" }, new string[2] { "fm_addtime", "CmdAddTime" }, new string[2] { "fm_spawn", "CmdSpawn" }, new string[2] { "fm_tp", "CmdTp" }, new string[2] { "fm_tpto", "CmdTpTo" }, new string[2] { "fm_nofall", "CmdNoFall" }, new string[2] { "fm_stage", "CmdStage" }, new string[2] { "fm_difficulty", "CmdDifficulty" }, new string[2] { "fm_artifact", "CmdArtifact" }, new string[2] { "fm_freebuy", "CmdFreeBuy" }, new string[2] { "fm_level", "CmdLevel" }, new string[2] { "fm_stages", "CmdStages" }, new string[2] { "fm_bossstart", "CmdBossStart" }, new string[2] { "fm_killaim", "CmdKillAim" }, new string[2] { "fm_spawnobj", "CmdSpawnObj" }, new string[2] { "fm_body", "CmdBody" } }; private static MethodInfo setArtifactMethod; private static bool setArtifactLookedUp; private static MethodInfo teleportBodyMethod; private static bool teleportLookedUp; public const string ModVersion = "0.8.0"; private bool showMenu; private int tab; private readonly Dictionary<string, bool> godSent = new Dictionary<string, bool>(); private readonly Dictionary<string, bool> oneShotSent = new Dictionary<string, bool>(); private bool noFallSent; private readonly List<CharacterMaster> uiMasters = new List<CharacterMaster>(); private int targetKind; private uint targetNetId; private bool critOn; private bool infJumps; private bool instantCooldowns; private bool attackSpeedOn; private float attackSpeed = 3f; private bool moveSpeedOn; private float moveSpeed = 2f; private bool gameSpeedOn; private float gameSpeed = 1.5f; private bool gameSpeedWasOn; private bool damageOn; private float damageMult = 2f; private bool armorOn; private float armorAdd = 50f; private bool jumpOn; private float jumpMult = 2f; private bool regenOn; private float regenAdd = 10f; private bool maxHpOn; private float maxHpMult = 2f; private bool flyOn; private float flySpeed = 1.5f; private bool noclipOn; private CharacterBody noclipBody; private bool statsChanged; private List<ItemEntry> itemList; private List<EquipEntry> equipList; private int itemMode; private string itemSearch = ""; private int itemAmount = 1; private Vector2 itemScroll; private bool itemTiles = true; private int itemRarity; private string hoverNow; private string hoverShown; private float tileViewHeight; private const float TileSize = 64f; private const float TileGap = 6f; private const float ItemsColumnWidth = 1120f; private static readonly Color NormalTileColor = new Color(0.78f, 0.78f, 0.8f); private static readonly Color BossTileColor = new Color(1f, 0.9f, 0.25f); private static readonly int[] AmountChoices = new int[4] { 1, 5, 25, 100 }; private List<SpawnEntry> spawnList; private string spawnSearch = ""; private int spawnCount = 1; private bool spawnAlly; private Vector2 spawnScroll; private bool spawnTiles = true; private static readonly int[] SpawnCountChoices = new int[4] { 1, 5, 10, 25 }; private readonly List<TpPoint> tpPoints = new List<TpPoint>(); private string pointName = ""; private int pointSeq; private Vector2 playersScroll; private bool hasBack; private Vector3 backPos; private string backScene; private readonly List<Action> pendingUi = new List<Action>(); private List<StageEntry> stageList; private List<ArtifactEntry> artifactList; private string[] difficultyLabels; private string stageSearch = ""; private Vector2 stageScroll; private Vector2 worldScroll; private string itemAmountText = "1"; private string spawnCountText = "1"; private string moneyText = "1000"; private string lunarText = "10"; private string timerMinText = "5"; private string timerSecText = "0"; private const float MoveSpeedMax = 100f; private const float FlySpeedMax = 100f; private const float AttackSpeedMax = 1000f; private const float GameSpeedMax = 50f; private const float DamageMax = 1000f; private const float ArmorMax = 10000f; private const float JumpMax = 50f; private const float RegenMax = 10000f; private const float MaxHpMax = 1000f; private const int MaxTpPoints = 20; private const int ItemAmountMax = 100000; private const int SpawnCountMax = 100; private readonly Dictionary<string, string> numBuf = new Dictionary<string, string>(); private string numEditing; private Rect windowRect; private bool stylesReady; private GUIStyle windowStyle; private GUIStyle btnStyle; private GUIStyle btnOnStyle; private GUIStyle tabStyle; private GUIStyle labelStyle; private GUIStyle warnStyle; private GUIStyle textStyle; private GUIStyle footerStyle; private GUIStyle sliderStyle; private GUIStyle sliderThumbStyle; private GUIStyle sliderTrackStyle; private GUIStyle sliderFillStyle; private GUIStyle tileBadgeStyle; private static readonly HashSet<NetworkInstanceId> GodMasters = new HashSet<NetworkInstanceId>(); private static readonly HashSet<NetworkInstanceId> OneShotMasters = new HashSet<NetworkInstanceId>(); private static readonly HashSet<NetworkInstanceId> NoFallMasters = new HashSet<NetworkInstanceId>(); private static readonly List<Texture2D> generatedTextures = new List<Texture2D>(); private bool commandsRegistered; private static Plugin instance; private ConfigEntry<KeyCode> cfgMenuKey; private ConfigEntry<string> cfgLang; private ConfigEntry<bool> cfgTiles; private ConfigEntry<bool> cfgSpawnTiles; private ConfigEntry<float> cfgMoveSpeed; private ConfigEntry<float> cfgFlySpeed; private ConfigEntry<float> cfgAttackSpeed; private ConfigEntry<float> cfgGameSpeed; private ConfigEntry<float> cfgDamage; private ConfigEntry<float> cfgArmor; private ConfigEntry<float> cfgJump; private ConfigEntry<float> cfgRegen; private ConfigEntry<float> cfgMaxHp; private bool typingInField; private static Lang currentLang = Lang.RU; private static readonly Dictionary<string, string[]> Loc = new Dictionary<string, string[]> { { "tab_player", new string[2] { "Игрок", "Player" } }, { "tab_movement", new string[2] { "Передвижение", "Movement" } }, { "tab_combat", new string[2] { "Бой", "Combat" } }, { "tab_world", new string[2] { "Мир", "World" } }, { "tab_items", new string[2] { "Предметы", "Items" } }, { "tab_spawn", new string[2] { "Спавн", "Spawn" } }, { "tab_players", new string[2] { "Игроки", "Players" } }, { "tab_settings", new string[2] { "Настройки", "Settings" } }, { "warn_client", new string[2] { "Вы клиент: серверные функции сработают, только если мод установлен и у хоста", "You are a client: server-side features only work if the mod is installed on the host" } }, { "god", new string[2] { "Бессмертие", "God Mode" } }, { "target", new string[2] { "Цель:", "Target:" } }, { "target_me", new string[2] { "Я", "Me" } }, { "target_all", new string[2] { "Все", "All" } }, { "tp_all", new string[2] { "Всех ко мне", "Bring everyone to me" } }, { "heal", new string[2] { "Лечить", "Heal" } }, { "revive", new string[2] { "Воскресить", "Revive" } }, { "money_label", new string[2] { "Деньги:", "Money:" } }, { "lunar_label", new string[2] { "Лунные монеты:", "Lunar Coins:" } }, { "give", new string[2] { "Выдать", "Give" } }, { "move_speed", new string[2] { "Скорость игрока", "Move Speed" } }, { "inf_jumps", new string[2] { "Бесконечные прыжки", "Infinite Jumps" } }, { "fly", new string[2] { "Полёт (WASD, Space, Ctrl)", "Flight (WASD, Space, Ctrl)" } }, { "noclip", new string[2] { "Noclip (сквозь стены)", "Noclip (through walls)" } }, { "movement_note", new string[2] { "Эти функции работают локально, в том числе не у хоста.", "These features work locally, even when you are not the host." } }, { "oneshot", new string[2] { "Ваншот всего", "One-Shot Everything" } }, { "attack_speed", new string[2] { "Скорость атаки", "Attack Speed" } }, { "crit", new string[2] { "100% шанс крита", "100% Crit Chance" } }, { "inst_cd", new string[2] { "Мгновенный кулдаун скиллов", "Instant Skill Cooldowns" } }, { "killall", new string[2] { "Убить всех врагов", "Kill All Enemies" } }, { "game_speed", new string[2] { "Скорость игры", "Game Speed" } }, { "tele", new string[2] { "Мгновенно зарядить телепорт", "Instantly Charge Teleporter" } }, { "nextstage", new string[2] { "Следующий этап", "Next Stage" } }, { "restartstage", new string[2] { "Перезапустить этап", "Restart Stage" } }, { "timer_label", new string[2] { "Таймер забега:", "Run Timer:" } }, { "min", new string[2] { "мин", "min" } }, { "sec", new string[2] { "сек", "sec" } }, { "add", new string[2] { "Добавить", "Add" } }, { "itemmode_give", new string[2] { "Выдать", "Give" } }, { "itemmode_take", new string[2] { "Убрать", "Remove" } }, { "itemmode_equip", new string[2] { "Экипировка", "Equipment" } }, { "search", new string[2] { "Поиск:", "Search:" } }, { "remove_equip", new string[2] { "Убрать экипировку", "Remove Equipment" } }, { "amount", new string[2] { "Количество:", "Amount:" } }, { "clear_inv", new string[2] { "Очистить инвентарь", "Clear Inventory" } }, { "cat_items", new string[2] { "Каталог предметов ещё загружается...", "Item catalog still loading..." } }, { "cat_spawn", new string[2] { "Каталог существ ещё загружается...", "Creature catalog still loading..." } }, { "spawn_ally", new string[2] { "Спавнить союзниками", "Spawn as Allies" } }, { "view_tiles", new string[2] { "Плитки", "Tiles" } }, { "r_all", new string[2] { "Все", "All" } }, { "r_white", new string[2] { "Белые", "White" } }, { "r_green", new string[2] { "Зелёные", "Green" } }, { "r_red", new string[2] { "Красные", "Red" } }, { "r_lunar", new string[2] { "Лунные", "Lunar" } }, { "r_boss", new string[2] { "Боссы", "Boss" } }, { "r_void", new string[2] { "Войд", "Void" } }, { "no_players", new string[2] { "Других игроков нет", "No other players" } }, { "tp_bring", new string[2] { "К себе", "Bring to me" } }, { "tp_goto", new string[2] { "К нему", "Go to them" } }, { "tp_note", new string[2] { "«К нему» работает у любого игрока, «К себе» - только у хоста.", "\"Go to them\" works for any player, \"Bring to me\" only for the host." } }, { "settings_lang", new string[2] { "Язык интерфейса", "Interface Language" } }, { "version", new string[2] { "Версия", "Version" } }, { "sec_players", new string[2] { "Телепорт между игроками", "Player teleport" } }, { "points_title", new string[2] { "Точки телепорта", "Teleport points" } }, { "point_name", new string[2] { "Имя:", "Name:" } }, { "point_save", new string[2] { "Сохранить позицию", "Save position" } }, { "point_tp", new string[2] { "Телепорт", "Teleport" } }, { "point_del", new string[2] { "Удалить", "Delete" } }, { "point_default", new string[2] { "Точка", "Point" } }, { "point_none", new string[2] { "На этом этапе нет сохранённых точек", "No saved points on this stage" } }, { "point_limit", new string[2] { "Достигнут лимит точек (20)", "Point limit reached (20)" } }, { "point_back", new string[2] { "Вернуться назад", "Go back" } }, { "point_note", new string[2] { "Точки видны только на этапе, где они сохранены. «Всех» и других игроков перемещает только хост.", "Points are only shown on the stage they were saved on. Only the host can move \"All\" and other players." } }, { "stat_damage", new string[2] { "Множитель урона", "Damage Multiplier" } }, { "stat_armor", new string[2] { "Броня", "Armor" } }, { "stat_jump", new string[2] { "Высота прыжка", "Jump Height" } }, { "stat_regen", new string[2] { "Регенерация (хп/с)", "Regeneration (HP/s)" } }, { "stat_maxhp", new string[2] { "Макс. здоровье", "Max Health" } }, { "no_fall", new string[2] { "Без урона от падения", "No Fall Damage" } }, { "stats_note", new string[2] { "Здоровье, броня и регенерация считаются сервером: у клиента они могут не сработать.", "Health, armor and regen are calculated by the server: they may not apply for clients." } }, { "state_note", new string[2] { "Вы клиент: кнопки показывают последнюю отправленную команду, а не состояние на сервере.", "You are a client: buttons show the last command sent, not the server state." } }, { "run_title", new string[2] { "Управление забегом (только хост)", "Run control (host only)" } }, { "run_note", new string[2] { "Смена сложности и артефактов посреди забега может вести себя нестабильно.", "Changing difficulty or artifacts mid-run may be unstable." } }, { "difficulty", new string[2] { "Сложность:", "Difficulty:" } }, { "artifacts", new string[2] { "Артефакты:", "Artifacts:" } }, { "stage_goto", new string[2] { "Перейти на этап:", "Go to stage:" } }, { "cat_stage", new string[2] { "Каталог этапов ещё загружается...", "Stage catalog still loading..." } } }; private string[] tabLabels; private string[] itemModeLabels; private string[] rarityLabels; private static readonly HashSet<NetworkInstanceId> FreeBuyMasters = new HashSet<NetworkInstanceId>(); private readonly Dictionary<string, bool> freeBuyMap = new Dictionary<string, bool>(); private bool freeBuySent; private bool freezeAI; private bool freezeAIWasOn; private bool noSpawns; private bool noSpawnsWasOn; private bool magnetOn; private float magnetRadius = 30f; private readonly Collider[] magnetBuf = (Collider[])(object)new Collider[256]; private string levelText = "10"; private string stagesText = "5"; private readonly Vector2[] tabScroll = (Vector2[])(object)new Vector2[9]; private Vector2 charScroll; private int spawnMode; private string[] spawnModeLabels; private bool spawnAtAim; private string[] eliteLabels; private readonly List<int> eliteIndices = new List<int>(); private int eliteChoice; private List<ObjEntry> objList; private string objSearch = ""; private Vector2 objScroll; private float objNextTry; private List<SurvivorEntry> survList; private string[] survNames; private int survChoice = -1; private string[] skinLabels; private int skinChoice; private readonly List<string> presetFiles = new List<string>(); private bool presetsDirty = true; private bool presetClear = true; private string presetName = ""; private Vector2 presetScroll; private bool hudOn = true; private GUIStyle hudStyle; private readonly StringBuilder hudSb = new StringBuilder(); private int hudLines; private ConfigEntry<KeyCode> cfgKeyGod; private ConfigEntry<KeyCode> cfgKeyFly; private ConfigEntry<KeyCode> cfgKeyNoclip; private ConfigEntry<KeyCode> cfgKeyTpAim; private ConfigEntry<KeyCode> cfgKeyKillAim; private ConfigEntry<KeyCode> cfgKeyHud; private ConfigEntry<bool> cfgHud; private static FieldInfo velocityField; private static PropertyInfo velocityProp; private const BindingFlags Flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; private static readonly Dictionary<string, PropertyInfo> PropCache = new Dictionary<string, PropertyInfo>(); private static readonly Dictionary<string, FieldInfo> FieldCache = new Dictionary<string, FieldInfo>(); private const float SliderThumbSize = 22f; private static string PresetDir => Path.Combine(Paths.ConfigPath, "FirstMod_builds"); private static string PointsPath => Path.Combine(Paths.ConfigPath, "com.Kavoshnik.firstmod.points.txt"); private void EnsureItemList() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) if (itemList != null || ItemCatalog.itemCount <= 0) { return; } List<ItemEntry> list = new List<ItemEntry>(); Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator(); try { while (enumerator.MoveNext()) { ItemDef current = enumerator.Current; if (Object.op_Implicit((Object)(object)current) && !current.hidden) { string text = Language.GetString(current.nameToken); if (string.IsNullOrEmpty(text)) { text = ((Object)current).name; } TierInfo(((object)current.tier/*cast due to .constrained prefix*/).ToString(), out var order, out var color); string text2 = TipFromToken(current.pickupToken); list.Add(new ItemEntry { def = current, name = text, lower = (text + " " + text2).ToLowerInvariant(), order = order, color = color, tip = text2 }); } } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } list.Sort((ItemEntry a, ItemEntry b) => (a.order == b.order) ? string.Compare(a.name, b.name, StringComparison.CurrentCultureIgnoreCase) : a.order.CompareTo(b.order)); itemList = list; } private void EnsureEquipList() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) if (equipList != null || EquipmentCatalog.equipmentCount <= 0) { return; } List<EquipEntry> list = new List<EquipEntry>(); for (int i = 0; i < EquipmentCatalog.equipmentCount; i++) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef((EquipmentIndex)i); if (Object.op_Implicit((Object)(object)equipmentDef) && !string.IsNullOrEmpty(equipmentDef.nameToken)) { string text = Language.GetString(equipmentDef.nameToken); if (string.IsNullOrEmpty(text)) { text = ((Object)equipmentDef).name; } int order = (equipmentDef.isLunar ? 2 : (equipmentDef.isBoss ? 1 : 0)); Color color = (equipmentDef.isLunar ? new Color(0.35f, 0.6f, 1f) : (equipmentDef.isBoss ? new Color(1f, 0.9f, 0.25f) : new Color(1f, 0.6f, 0.2f))); string text2 = TipFromToken(equipmentDef.pickupToken); list.Add(new EquipEntry { def = equipmentDef, name = text, lower = (text + " " + text2).ToLowerInvariant(), order = order, color = color, tip = text2 }); } } list.Sort((EquipEntry a, EquipEntry b) => (a.order == b.order) ? string.Compare(a.name, b.name, StringComparison.CurrentCultureIgnoreCase) : a.order.CompareTo(b.order)); equipList = list; } private void EnsureRunLists() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 if (stageList == null) { ReadOnlyArray<SceneDef> allSceneDefs = SceneCatalog.allSceneDefs; if (SceneCatalog.sceneDefCount > 0) { List<StageEntry> list = new List<StageEntry>(); Enumerator<SceneDef> enumerator = allSceneDefs.GetEnumerator(); try { while (enumerator.MoveNext()) { SceneDef current = enumerator.Current; if (Object.op_Implicit((Object)(object)current) && (int)current.sceneType == 1 && !current.isOfflineScene && !string.IsNullOrEmpty(current.cachedName)) { string text = (string.IsNullOrEmpty(current.nameToken) ? current.cachedName : Language.GetString(current.nameToken)); if (string.IsNullOrEmpty(text)) { text = current.cachedName; } string text2 = text + " [" + current.cachedName + "]"; list.Add(new StageEntry { def = current, sceneName = current.cachedName, name = text2, lower = text2.ToLowerInvariant() }); } } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } if (list.Count > 0) { list.Sort((StageEntry x, StageEntry y) => string.Compare(x.name, y.name, StringComparison.CurrentCultureIgnoreCase)); stageList = list; } } } if (artifactList == null && ArtifactCatalog.artifactCount > 0) { List<ArtifactEntry> list2 = new List<ArtifactEntry>(); for (int num = 0; num < ArtifactCatalog.artifactCount; num++) { ArtifactDef artifactDef = ArtifactCatalog.GetArtifactDef((ArtifactIndex)num); if (Object.op_Implicit((Object)(object)artifactDef) && !string.IsNullOrEmpty(artifactDef.cachedName)) { string text3 = (string.IsNullOrEmpty(artifactDef.nameToken) ? artifactDef.cachedName : Language.GetString(artifactDef.nameToken)); if (string.IsNullOrEmpty(text3)) { text3 = artifactDef.cachedName; } list2.Add(new ArtifactEntry { def = artifactDef, name = text3 }); } } if (list2.Count > 0) { list2.Sort((ArtifactEntry x, ArtifactEntry y) => string.Compare(x.name, y.name, StringComparison.CurrentCultureIgnoreCase)); artifactList = list2; } } if (difficultyLabels != null) { return; } List<string> list3 = new List<string>(); for (int num2 = 0; num2 < 64; num2++) { DifficultyDef difficultyDefSafe = GetDifficultyDefSafe(num2); if (difficultyDefSafe == null) { break; } string text4 = Language.GetString(difficultyDefSafe.nameToken); list3.Add(string.IsNullOrEmpty(text4) ? ("#" + num2) : text4); } if (list3.Count > 0) { difficultyLabels = list3.ToArray(); } } private void EnsureSpawnList() { if (spawnList != null) { return; } IEnumerable<CharacterMaster> allAiMasters = MasterCatalog.allAiMasters; if (allAiMasters == null) { return; } List<SpawnEntry> list = new List<SpawnEntry>(); foreach (CharacterMaster item in allAiMasters) { if (!Object.op_Implicit((Object)(object)item)) { continue; } string text = ((Object)item).name; Texture icon = null; bool boss = false; if (Object.op_Implicit((Object)(object)item.bodyPrefab)) { CharacterBody component = item.bodyPrefab.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { icon = component.portraitIcon; boss = component.isChampion; if (!string.IsNullOrEmpty(component.baseNameToken)) { string text2 = Language.GetString(component.baseNameToken); if (!string.IsNullOrEmpty(text2)) { text = text2; } } } } string text3 = text + " [" + ((Object)item).name + "]"; list.Add(new SpawnEntry { masterName = ((Object)item).name, name = text3, lower = text3.ToLowerInvariant(), icon = icon, boss = boss }); } if (list.Count == 0) { return; } list.Sort(delegate(SpawnEntry x, SpawnEntry y) { if (x.boss == y.boss) { return string.Compare(x.name, y.name, StringComparison.CurrentCultureIgnoreCase); } return (!x.boss) ? 1 : (-1); }); spawnList = list; } private void RegisterCommands() { if (commandsRegistered) { return; } Console val = Console.instance; if ((Object)(object)val == (Object)null) { return; } try { Type? typeFromHandle = typeof(Console); FieldInfo field = typeFromHandle.GetField("concommandCatalog", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); Type nestedType = typeFromHandle.GetNestedType("ConCommand", BindingFlags.Public | BindingFlags.NonPublic); Type nestedType2 = typeFromHandle.GetNestedType("ConCommandDelegate", BindingFlags.Public | BindingFlags.NonPublic); if (field == null || nestedType == null || nestedType2 == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Не удалось найти внутренние типы консоли, сетевые команды недоступны."); return; } if (!(field.GetValue(val) is IDictionary dictionary)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"concommandCatalog не найден, сетевые команды недоступны."); return; } FieldInfo field2 = nestedType.GetField("flags", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field3 = nestedType.GetField("action", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); FieldInfo field4 = nestedType.GetField("helpText", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); string[][] commandTable = CommandTable; foreach (string[] array in commandTable) { MethodInfo method = typeof(Plugin).GetMethod(array[1], BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (!(method == null)) { object obj = Activator.CreateInstance(nestedType); if (field2 != null) { field2.SetValue(obj, (object)(ConVarFlags)1); } if (field3 != null) { field3.SetValue(obj, Delegate.CreateDelegate(nestedType2, method)); } if (field4 != null) { field4.SetValue(obj, "FirstMod: " + array[0]); } dictionary[array[0]] = obj; } } commandsRegistered = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"FirstMod: сетевые команды зарегистрированы."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Регистрация команд: " + ex)); } } private static string ArgStr(ConCommandArgs a, int i) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (a.userArgs == null || a.userArgs.Count <= i) { return ""; } return a.userArgs[i]; } private static int ArgInt(ConCommandArgs a, int i, int def) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (a.userArgs != null && a.userArgs.Count > i && int.TryParse(a.userArgs[i], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return result; } return def; } private static bool ArgBool(ConCommandArgs a, int i) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return ArgStr(a, i) == "1"; } private static bool IsHostSender(ConCommandArgs a) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); NetworkUser val = ((firstLocalUser != null) ? firstLocalUser.currentNetworkUser : null); if ((Object)(object)val != (Object)null) { return (Object)(object)a.sender == (Object)(object)val; } return false; } private static bool TargetAllowed(ConCommandArgs a, string target) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(target) || target == "0") { return true; } return IsHostSender(a); } private static List<CharacterMaster> ServerTargets(ConCommandArgs a, string target) { //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) List<CharacterMaster> list = new List<CharacterMaster>(); if (target == "1") { foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.master)) { list.Add(instance.master); } } } else if (!string.IsNullOrEmpty(target) && target[0] == 'u') { if (uint.TryParse(target.Substring(1), NumberStyles.None, CultureInfo.InvariantCulture, out var result)) { foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)readOnlyInstances)) { NetworkInstanceId netId = ((NetworkBehaviour)readOnlyInstances).netId; if (((NetworkInstanceId)(ref netId)).Value == result && Object.op_Implicit((Object)(object)readOnlyInstances.master)) { list.Add(readOnlyInstances.master); break; } } } } } else if (Object.op_Implicit((Object)(object)a.sender) && Object.op_Implicit((Object)(object)a.sender.master)) { list.Add(a.sender.master); } return list; } private static ItemDef FindItem(string name) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) Enumerator<ItemDef> enumerator = ItemCatalog.allItemDefs.GetEnumerator(); try { while (enumerator.MoveNext()) { ItemDef current = enumerator.Current; if (Object.op_Implicit((Object)(object)current) && string.Equals(((Object)current).name, name, StringComparison.OrdinalIgnoreCase)) { return current; } } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } return null; } private static EquipmentDef FindEquipment(string name) { for (int i = 0; i < EquipmentCatalog.equipmentCount; i++) { EquipmentDef equipmentDef = EquipmentCatalog.GetEquipmentDef((EquipmentIndex)i); if (Object.op_Implicit((Object)(object)equipmentDef) && string.Equals(((Object)equipmentDef).name, name, StringComparison.OrdinalIgnoreCase)) { return equipmentDef; } } return null; } private static CharacterMaster FindMaster(string name) { foreach (CharacterMaster allAiMaster in MasterCatalog.allAiMasters) { if (Object.op_Implicit((Object)(object)allAiMaster) && string.Equals(((Object)allAiMaster).name, name, StringComparison.OrdinalIgnoreCase)) { return allAiMaster; } } return null; } private static void SetFlag(HashSet<NetworkInstanceId> set, ConCommandArgs a, bool on, string target) { //IL_0000: 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_001c: Unknown result type (might be due to invalid IL or missing references) foreach (CharacterMaster item in ServerTargets(a, target)) { if (on) { set.Add(((NetworkBehaviour)item).netId); } else { set.Remove(((NetworkBehaviour)item).netId); } } } private static void CmdGod(ConCommandArgs a) { //IL_0008: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { string target = ArgStr(a, 1); if (TargetAllowed(a, target)) { SetFlag(GodMasters, a, ArgBool(a, 0), target); } } } private static void CmdOneShot(ConCommandArgs a) { //IL_0008: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { string target = ArgStr(a, 1); if (TargetAllowed(a, target)) { SetFlag(OneShotMasters, a, ArgBool(a, 0), target); } } } private static void CmdHeal(ConCommandArgs a) { //IL_0008: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } string target = ArgStr(a, 0); if (!TargetAllowed(a, target)) { return; } foreach (CharacterMaster item in ServerTargets(a, target)) { CharacterBody body = item.GetBody(); if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent)) { HealthComponent healthComponent = body.healthComponent; healthComponent.Heal(healthComponent.fullCombinedHealth, default(ProcChainMask), false); } } } private static void CmdRevive(ConCommandArgs a) { //IL_0008: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } string target = ArgStr(a, 0); if (!TargetAllowed(a, target)) { return; } foreach (CharacterMaster item in ServerTargets(a, target)) { if (!Object.op_Implicit((Object)(object)item.GetBody())) { item.Respawn(item.deathFootPosition, Quaternion.identity, false); } } } private static void CmdMoney(ConCommandArgs a) { //IL_0008: 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_001b: 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 (!NetworkServer.active) { return; } string target = ArgStr(a, 1); if (!TargetAllowed(a, target)) { return; } int num = Mathf.Max(0, ArgInt(a, 0, 0)); foreach (CharacterMaster item in ServerTargets(a, target)) { item.GiveMoney((uint)num); } } private static void CmdLunar(ConCommandArgs a) { //IL_0008: 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_001b: 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 (!NetworkServer.active) { return; } string target = ArgStr(a, 1); if (!TargetAllowed(a, target)) { return; } int num = Mathf.Max(0, ArgInt(a, 0, 0)); foreach (CharacterMaster item in ServerTargets(a, target)) { NetworkUser val = (Object.op_Implicit((Object)(object)item.playerCharacterMasterController) ? item.playerCharacterMasterController.networkUser : null); if (Object.op_Implicit((Object)(object)val)) { val.AwardLunarCoins((uint)num); } } } private static void CmdGiveItem(ConCommandArgs a) { //IL_0008: 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_001a: 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_0044: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } string target = ArgStr(a, 2); if (!TargetAllowed(a, target)) { return; } ItemDef val = FindItem(ArgStr(a, 0)); if (!Object.op_Implicit((Object)(object)val)) { return; } int num = Mathf.Clamp(ArgInt(a, 1, 1), 1, 100000); foreach (CharacterMaster item in ServerTargets(a, target)) { if (Object.op_Implicit((Object)(object)item.inventory)) { item.inventory.GiveItemPermanent(val, num); } } } private static void CmdTakeItem(ConCommandArgs a) { //IL_0008: 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_001a: 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_0044: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } string target = ArgStr(a, 2); if (!TargetAllowed(a, target)) { return; } ItemDef val = FindItem(ArgStr(a, 0)); if (!Object.op_Implicit((Object)(object)val)) { return; } int num = Mathf.Clamp(ArgInt(a, 1, 1), 1, 100000); foreach (CharacterMaster item in ServerTargets(a, target)) { Inventory inventory = item.inventory; if (Object.op_Implicit((Object)(object)inventory)) { int itemCount = inventory.GetItemCount(val); if (itemCount > 0) { inventory.RemoveItemPermanent(val, Mathf.Min(num, itemCount)); } } } } private static void CmdClearInv(ConCommandArgs a) { //IL_0008: 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_001a: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } string target = ArgStr(a, 0); if (!TargetAllowed(a, target)) { return; } foreach (CharacterMaster item in ServerTargets(a, target)) { Inventory inventory = item.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { continue; } for (int i = 0; i < ItemCatalog.itemCount; i++) { ItemDef itemDef = ItemCatalog.GetItemDef((ItemIndex)i); if (Object.op_Implicit((Object)(object)itemDef)) { int itemCount = inventory.GetItemCount(itemDef); if (itemCount > 0) { inventory.RemoveItemPermanent(itemDef, itemCount); } } } } } private static void CmdEquip(ConCommandArgs a) { //IL_0008: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } string target = ArgStr(a, 1); if (!TargetAllowed(a, target)) { return; } string text = ArgStr(a, 0); EquipmentIndex equipmentIndex = (EquipmentIndex)(-1); if (!string.Equals(text, "none", StringComparison.OrdinalIgnoreCase)) { EquipmentDef val = FindEquipment(text); if (!Object.op_Implicit((Object)(object)val)) { return; } equipmentIndex = val.equipmentIndex; } foreach (CharacterMaster item in ServerTargets(a, target)) { if (Object.op_Implicit((Object)(object)item.inventory)) { item.inventory.SetEquipmentIndex(equipmentIndex); } } } private static void CmdKillAll(ConCommandArgs a) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !IsHostSender(a)) { return; } List<HealthComponent> list = new List<HealthComponent>(); TeamIndex[] array = new TeamIndex[3]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); TeamIndex[] array2 = (TeamIndex[])(object)array; for (int i = 0; i < array2.Length; i++) { foreach (TeamComponent teamMember in TeamComponent.GetTeamMembers(array2[i])) { if (Object.op_Implicit((Object)(object)teamMember) && Object.op_Implicit((Object)(object)teamMember.body) && Object.op_Implicit((Object)(object)teamMember.body.healthComponent)) { list.Add(teamMember.body.healthComponent); } } } foreach (HealthComponent item in list) { item.Suicide((GameObject)null, (GameObject)null, default(DamageTypeCombo)); } } private static void CmdTele(ConCommandArgs a) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !IsHostSender(a)) { return; } TeleporterInteraction val = TeleporterInteraction.instance; HoldoutZoneController val2 = (Object.op_Implicit((Object)(object)val) ? val.holdoutZoneController : null); if (!Object.op_Implicit((Object)(object)val2)) { return; } Type typeFromHandle = typeof(HoldoutZoneController); MethodInfo method = typeFromHandle.GetMethod("FullyChargeHoldoutZone", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(val2, null); return; } PropertyInfo property = typeFromHandle.GetProperty("charge", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null) { property.GetSetMethod(nonPublic: true)?.Invoke(val2, new object[1] { 1f }); } else { typeFromHandle.GetField("charge", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(val2, 1f); } } private static void CmdNextStage(ConCommandArgs a) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && IsHostSender(a)) { Run val = Run.instance; if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.nextStageScene)) { val.AdvanceStage(val.nextStageScene); } } } private static void CmdRestartStage(ConCommandArgs a) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && IsHostSender(a)) { Run val = Run.instance; SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene(); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)sceneDefForCurrentScene)) { val.AdvanceStage(sceneDefForCurrentScene); } } } private static void CmdAddTime(ConCommandArgs a) { //IL_0007: 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) if (NetworkServer.active && IsHostSender(a)) { Run val = Run.instance; if (Object.op_Implicit((Object)(object)val)) { val.SetRunStopwatch(val.GetRunStopwatch() + (float)ArgInt(a, 0, 0)); } } } private static void CmdTp(ConCommandArgs a) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !Object.op_Implicit((Object)(object)a.sender)) { return; } int num = ArgInt(a, 0, -1); switch (num) { default: return; case 0: case 2: if (!IsHostSender(a)) { if (Object.op_Implicit((Object)(object)instance)) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"fm_tp: перемещать других игроков может только хост."); } return; } break; case 1: break; } CharacterBody val = (Object.op_Implicit((Object)(object)a.sender.master) ? a.sender.master.GetBody() : null); if (!Object.op_Implicit((Object)(object)val)) { if (Object.op_Implicit((Object)(object)instance)) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"fm_tp: у отправителя нет тела (мёртв?)."); } } else if (num == 2) { List<CharacterBody> list = new List<CharacterBody>(); foreach (NetworkUser readOnlyInstances in NetworkUser.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)readOnlyInstances) && !((Object)(object)readOnlyInstances == (Object)(object)a.sender)) { CharacterBody val2 = (Object.op_Implicit((Object)(object)readOnlyInstances.master) ? readOnlyInstances.master.GetBody() : null); if (Object.op_Implicit((Object)(object)val2)) { list.Add(val2); } } } for (int i = 0; i < list.Count; i++) { Vector3 val3 = Quaternion.Euler(0f, 360f / (float)list.Count * (float)i, 0f) * (Vector3.forward * 2f); TeleportBodyTo(list[i], val.footPosition + val3 + Vector3.up * 0.5f); } } else { if (!uint.TryParse(ArgStr(a, 1), NumberStyles.None, CultureInfo.InvariantCulture, out var result)) { return; } NetworkUser val4 = null; foreach (NetworkUser readOnlyInstances2 in NetworkUser.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)readOnlyInstances2)) { NetworkInstanceId netId = ((NetworkBehaviour)readOnlyInstances2).netId; if (((NetworkInstanceId)(ref netId)).Value == result) { val4 = readOnlyInstances2; break; } } } if (!Object.op_Implicit((Object)(object)val4) || (Object)(object)val4 == (Object)(object)a.sender) { return; } CharacterBody val5 = (Object.op_Implicit((Object)(object)val4.master) ? val4.master.GetBody() : null); if (!Object.op_Implicit((Object)(object)val5)) { if (Object.op_Implicit((Object)(object)instance)) { ((BaseUnityPlugin)instance).Logger.LogInfo((object)"fm_tp: у цели нет тела (мёртв?)."); } } else if (num == 0) { TeleportBodyTo(val5, val.footPosition + Vector3.up * 0.5f); } else { TeleportBodyTo(val, val5.footPosition + Vector3.up * 0.5f); } } } private static void CmdTpTo(ConCommandArgs a) { //IL_0008: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { return; } string target = ArgStr(a, 3); if (!TargetAllowed(a, target) || !TryArgFloat(a, 0, out var v) || !TryArgFloat(a, 1, out var v2) || !TryArgFloat(a, 2, out var v3)) { return; } List<CharacterBody> list = new List<CharacterBody>(); foreach (CharacterMaster item in ServerTargets(a, target)) { CharacterBody body = item.GetBody(); if (Object.op_Implicit((Object)(object)body)) { list.Add(body); } } Vector3 val = new Vector3(v, v2, v3) + Vector3.up * 0.5f; for (int i = 0; i < list.Count; i++) { Vector3 val2 = Vector3.zero; if (list.Count > 1) { val2 = Quaternion.Euler(0f, 360f / (float)list.Count * (float)i, 0f) * (Vector3.forward * 2f); } TeleportBodyTo(list[i], val + val2); } } private static bool TryArgFloat(ConCommandArgs a, int i, out float v) { //IL_0007: 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_001f: Unknown result type (might be due to invalid IL or missing references) v = 0f; if (a.userArgs == null || a.userArgs.Count <= i) { return false; } if (!float.TryParse(a.userArgs[i], NumberStyles.Float, CultureInfo.InvariantCulture, out v)) { return false; } if (!float.IsNaN(v) && !float.IsInfinity(v)) { return Mathf.Abs(v) < 100000f; } return false; } private static void CmdNoFall(ConCommandArgs a) { //IL_0008: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { string target = ArgStr(a, 1); if (TargetAllowed(a, target)) { SetFlag(NoFallMasters, a, ArgBool(a, 0), target); } } } private static DifficultyDef GetDifficultyDefSafe(int index) { if (index < 0) { return null; } try { return DifficultyCatalog.GetDifficultyDef((DifficultyIndex)index); } catch (Exception) { return null; } } private static SceneDef FindStage(string name) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 Enumerator<SceneDef> enumerator = SceneCatalog.allSceneDefs.GetEnumerator(); try { while (enumerator.MoveNext()) { SceneDef current = enumerator.Current; if (Object.op_Implicit((Object)(object)current) && (int)current.sceneType == 1 && !current.isOfflineScene && string.Equals(current.cachedName, name, StringComparison.OrdinalIgnoreCase)) { return current; } } } finally { ((IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } return null; } private static ArtifactDef FindArtifact(string name) { for (int i = 0; i < ArtifactCatalog.artifactCount; i++) { ArtifactDef artifactDef = ArtifactCatalog.GetArtifactDef((ArtifactIndex)i); if (Object.op_Implicit((Object)(object)artifactDef) && string.Equals(artifactDef.cachedName, name, StringComparison.OrdinalIgnoreCase)) { return artifactDef; } } return null; } private static void CmdStage(ConCommandArgs a) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !IsHostSender(a)) { return; } Run val = Run.instance; if (Object.op_Implicit((Object)(object)val)) { SceneDef val2 = FindStage(ArgStr(a, 0)); if (Object.op_Implicit((Object)(object)val2) && (!Object.op_Implicit((Object)(object)val2.requiredExpansion) || val.IsExpansionEnabled(val2.requiredExpansion))) { val.AdvanceStage(val2); } } } private static void CmdDifficulty(ConCommandArgs a) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !IsHostSender(a)) { return; } Run val = Run.instance; if (!Object.op_Implicit((Object)(object)val)) { return; } int num = ArgInt(a, 0, -1); DifficultyDef difficultyDefSafe = GetDifficultyDefSafe(num); if (difficultyDefSafe == null) { return; } DifficultyIndex val2 = (DifficultyIndex)num; if (val.selectedDifficulty == val2) { return; } foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.master) && Object.op_Implicit((Object)(object)instance.master.inventory)) { Inventory inventory = instance.master.inventory; inventory.ResetItemPermanent(Items.DrizzlePlayerHelper); inventory.ResetItemPermanent(Items.MonsoonPlayerHelper); if ((int)val2 == 0) { inventory.GiveItemPermanent(Items.DrizzlePlayerHelper, 1); } else if (difficultyDefSafe.countsAsHardMode) { inventory.GiveItemPermanent(Items.MonsoonPlayerHelper, 1); } } } val.selectedDifficulty = val2; } private static void CmdArtifact(ConCommandArgs a) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active || !IsHostSender(a)) { return; } Run val = Run.instance; RunArtifactManager val2 = RunArtifactManager.instance; if (Object.op_Implicit((Object)(object)val) && !((Object)(object)val2 == (Object)null)) { ArtifactDef val3 = FindArtifact(ArgStr(a, 0)); if (Object.op_Implicit((Object)(object)val3) && (!Object.op_Implicit((Object)(object)val3.requiredExpansion) || val.IsExpansionEnabled(val3.requiredExpansion))) { SetArtifactEnabledCompat(val2, val3, ArgBool(a, 1)); } } } private static void SetArtifactEnabledCompat(RunArtifactManager mgr, ArtifactDef def, bool enabled) { if (!setArtifactLookedUp) { setArtifactLookedUp = true; string[] array = new string[2] { "SetArtifactEnabledServer", "SetArtifactEnabled" }; foreach (string name in array) { setArtifactMethod = typeof(RunArtifactManager).GetMethod(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[2] { typeof(ArtifactDef), typeof(bool) }, null); if (setArtifactMethod != null) { break; } } } if (setArtifactMethod == null) { if (Object.op_Implicit((Object)(object)instance)) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)"fm_artifact: не найден метод включения артефактов."); } } else { setArtifactMethod.Invoke(mgr, new object[2] { def, enabled }); } } private static void TeleportBodyTo(CharacterBody body, Vector3 footPosition) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)body)) { RawTeleport(body, footPosition); CharacterMaster master = body.master; if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)master)) { ((MonoBehaviour)instance).StartCoroutine(instance.VerifyTeleport(master, footPosition)); } } } private IEnumerator VerifyTeleport(CharacterMaster master, Vector3 footPosition) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) yield return (object)new WaitForSeconds(0.5f); if (!Object.op_Implicit((Object)(object)master)) { yield break; } CharacterBody body = master.GetBody(); if (!Object.op_Implicit((Object)(object)body)) { yield break; } Vector3 val = body.footPosition - footPosition; if (((Vector3)(ref val)).sqrMagnitude < 16f) { yield break; } ((BaseUnityPlugin)this).Logger.LogInfo((object)"fm_tp: штатный телепорт не сработал, пересоздаю игрока в точке назначения."); HealthComponent healthComponent = body.healthComponent; float oldFull = (Object.op_Implicit((Object)(object)healthComponent) ? healthComponent.fullHealth : 0f); float hpFrac = ((oldFull > 0f) ? Mathf.Clamp01(healthComponent.health / oldFull) : 1f); float barrierFrac = ((oldFull > 0f) ? (healthComponent.barrier / oldFull) : 0f); float num = (Object.op_Implicit((Object)(object)healthComponent) ? healthComponent.fullShield : 0f); float shieldFrac = ((num > 0f) ? Mathf.Clamp01(healthComponent.shield / num) : 1f); Quaternion val2 = Quaternion.Euler(0f, ((Component)body).transform.eulerAngles.y, 0f); GameObject oldObject = ((Component)body).gameObject; master.DestroyBody(); master.Respawn(footPosition, val2, false); CharacterBody val3 = null; for (int i = 0; i < 20; i++) { yield return (object)new WaitForSeconds(0.05f); if (!Object.op_Implicit((Object)(object)master)) { yield break; } val3 = master.GetBody(); if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val3.healthComponent) && val3.healthComponent.fullHealth >= oldFull * 0.95f) { break; } } if (Object.op_Implicit((Object)(object)val3) && Object.op_Implicit((Object)(object)val3.healthComponent)) { if (Object.op_Implicit((Object)(object)oldObject) && (Object)(object)oldObject != (Object)(object)((Component)val3).gameObject) { NetworkServer.Destroy(oldObject); } HealthComponent healthComponent2 = val3.healthComponent; SetHealthValue(healthComponent2, "health", Mathf.Max(1f, hpFrac * healthComponent2.fullHealth)); if (healthComponent2.fullShield > 0f) { SetHealthValue(healthComponent2, "shield", shieldFrac * healthComponent2.fullShield); } if (barrierFrac > 0f) { SetHealthValue(healthComponent2, "barrier", barrierFrac * healthComponent2.fullHealth); } } } private static void SetHealthValue(HealthComponent hc, string name, float value) { Type typeFromHandle = typeof(HealthComponent); PropertyInfo propertyInfo = typeFromHandle.GetProperty("Network" + name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? typeFromHandle.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); MethodInfo methodInfo = ((propertyInfo != null) ? propertyInfo.GetSetMethod(nonPublic: true) : null); if (methodInfo != null) { methodInfo.Invoke(hc, new object[1] { value }); return; } FieldInfo fieldInfo = typeFromHandle.GetField("_" + name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) ?? typeFromHandle.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (fieldInfo != null && fieldInfo.FieldType == typeof(float)) { fieldInfo.SetValue(hc, value); } } private static void RawTeleport(CharacterBody body, Vector3 footPosition) { //IL_009a: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body)) { return; } if (!teleportLookedUp) { teleportLookedUp = true; Type type = typeof(CharacterBody).Assembly.GetType("RoR2.TeleportHelper"); if (type != null) { teleportBodyMethod = type.GetMethod("TeleportBody", BindingFlags.Static | BindingFlags.Public, null, new Type[2] { typeof(CharacterBody), typeof(Vector3) }, null); } } if (teleportBodyMethod != null) { teleportBodyMethod.Invoke(null, new object[2] { body, footPosition }); return; } Vector3 val = footPosition + (((Component)body).transform.position - body.footPosition); Component motorComponent = GetMotorComponent(body); object obj = (Object.op_Implicit((Object)(object)motorComponent) ? GetKinematicMotor(motorComponent) : null); if (obj != null) { MethodInfo method = obj.GetType().GetMethod("SetPosition", new Type[2] { typeof(Vector3), typeof(bool) }); if (method != null) { method.Invoke(obj, new object[2] { val, true }); return; } } ((Component)body).transform.position = val; } private static string T(string key) { if (!Loc.TryGetValue(key, out var value)) { return key; } return value[(currentLang != Lang.RU) ? 1u : 0u]; } private void RebuildLabels() { tabLabels = new string[9] { T("tab_player"), T("tab_movement"), T("tab_combat"), T("tab_world"), T("tab_items"), T("tab_spawn"), T("tab_players"), T("tab_character"), T("tab_settings") }; itemModeLabels = new string[3] { T("itemmode_give"), T("itemmode_take"), T("itemmode_equip") }; rarityLabels = new string[7] { T("r_all"), T("r_white"), T("r_green"), T("r_red"), T("r_lunar"), T("r_boss"), T("r_void") }; ExtraRebuildLabels(); } private void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown instance = this; ((BaseUnityPlugin)this).Logger.LogInfo((object)"FirstMod loaded!"); ExtraLoc(); LoadSettings(); HealthComponent.TakeDamage += new hook_TakeDamage(OnTakeDamage); CharacterBody.RecalculateStats += new hook_RecalculateStats(OnRecalculateStats); ExtraInit(); Run.onRunStartGlobal += OnRunChangedGlobal; Run.onRunDestroyGlobal += OnRunChangedGlobal; RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(RegisterCommands)); if ((Object)(object)Console.instance != (Object)null) { RegisterCommands(); } } private void OnDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown HealthComponent.TakeDamage -= new hook_TakeDamage(OnTakeDamage); CharacterBody.RecalculateStats -= new hook_RecalculateStats(OnRecalculateStats); ExtraDestroy(); RoR2Application.onLoad = (Action)Delegate.Remove(RoR2Application.onLoad, new Action(RegisterCommands)); if ((Object)(object)instance == (Object)(object)this) { instance = null; } Run.onRunStartGlobal -= OnRunChangedGlobal; Run.onRunDestroyGlobal -= OnRunChangedGlobal; if (Object.op_Implicit((Object)(object)noclipBody)) { SetNoclip(noclipBody, on: false); } if (showMenu) { SetMenu(open: false); } Time.timeScale = 1f; foreach (Texture2D generatedTexture in generatedTextures) { if (Object.op_Implicit((Object)(object)generatedTexture)) { Object.Destroy((Object)(object)generatedTexture); } } generatedTextures.Clear(); } private void OnApplicationQuit() { SaveSettings(); } private void LoadSettings() { ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; cfgMenuKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "MenuKey", (KeyCode)110, "Клавиша открытия меню / Menu toggle key"); cfgLang = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Language", "RU", "Язык интерфейса: RU или EN / UI language: RU or EN"); cfgTiles = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "TileView", true, "Показывать предметы плитками / Show items as icon tiles"); cfgMoveSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Values", "MoveSpeed", 2f, "Множитель скорости игрока / Move speed multiplier"); cfgFlySpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Values", "FlySpeed", 1.5f, "Множитель скорости полёта / Flight speed multiplier"); cfgAttackSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Values", "AttackSpeed", 3f, "Множитель скорости атаки / Attack speed multiplier"); cfgGameSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Values", "GameSpeed", 1.5f, "Скорость игры / Game speed"); cfgDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Values", "Damage", 2f, "Множитель урона / Damage multiplier"); cfgArmor = ((BaseUnityPlugin)this).Config.Bind<float>("Values", "Armor", 50f, "Добавка к броне / Armor bonus"); cfgJump = ((BaseUnityPlugin)this).Config.Bind<float>("Values", "JumpHeight", 2f, "Множитель высоты прыжка / Jump height multiplier"); cfgRegen = ((BaseUnityPlugin)this).Config.Bind<float>("Values", "Regen", 10f, "Добавка к регенерации, хп/с / Regeneration bonus, HP/s"); cfgMaxHp = ((BaseUnityPlugin)this).Config.Bind<float>("Values", "MaxHealth", 2f, "Множитель макс. здоровья / Max health multiplier"); cfgSpawnTiles = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawn", "TileView", true, "Показывать существ плитками / Show creatures as tiles"); currentLang = (string.Equals(cfgLang.Value, "EN", StringComparison.OrdinalIgnoreCase) ? Lang.EN : Lang.RU); itemTiles = cfgTiles.Value; moveSpeed = Mathf.Clamp(cfgMoveSpeed.Value, 1f, 100f); flySpeed = Mathf.Clamp(cfgFlySpeed.Value, 1f, 100f); attackSpeed = Mathf.Clamp(cfgAttackSpeed.Value, 1f, 1000f); gameSpeed = Mathf.Clamp(cfgGameSpeed.Value, 0.1f, 50f); damageMult = Mathf.Clamp(cfgDamage.Value, 1f, 1000f); armorAdd = Mathf.Clamp(cfgArmor.Value, 0f, 10000f); jumpMult = Mathf.Clamp(cfgJump.Value, 1f, 50f); regenAdd = Mathf.Clamp(cfgRegen.Value, 0f, 10000f); maxHpMult = Mathf.Clamp(cfgMaxHp.Value, 1f, 1000f); spawnTiles = cfgSpawnTiles.Value; ExtraLoadSettings(); } private void SaveSettings() { if (cfgLang != null) { cfgLang.Value = ((currentLang == Lang.EN) ? "EN" : "RU"); cfgTiles.Value = itemTiles; cfgMoveSpeed.Value = moveSpeed; cfgFlySpeed.Value = flySpeed; cfgAttackSpeed.Value = attackSpeed; cfgGameSpeed.Value = gameSpeed; cfgDamage.Value = damageMult; cfgArmor.Value = armorAdd; cfgJump.Value = jumpMult; cfgRegen.Value = regenAdd; cfgMaxHp.Value = maxHpMult; cfgSpawnTiles.Value = spawnTiles; ExtraSaveSettings(); ((BaseUnityPlugin)this).Config.Save(); } } private void OnRunChangedGlobal(Run run) { GodMasters.Clear(); OneShotMasters.Clear(); NoFallMasters.Clear(); godSent.Clear(); oneShotSent.Clear(); noFallSent = false; hasBack = false; ExtraRunChanged(); } private void OnTakeDamage(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { //IL_0034: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00ed: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active && Object.op_Implicit((Object)(object)self.body)) { CharacterMaster master = self.body.master; if ((Object.op_Implicit((Object)(object)master) && GodMasters.Contains(((NetworkBehaviour)master).netId)) || (Object.op_Implicit((Object)(object)master) && NoFallMasters.Count > 0 && NoFallMasters.Contains(((NetworkBehaviour)master).netId) && DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)2097152)) != 0L)) { return; } if (OneShotMasters.Count > 0 && Object.op_Implicit((Object)(object)damageInfo.attacker)) { CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component.master) && OneShotMasters.Contains(((NetworkBehaviour)component.master).netId) && component.teamComponent.teamIndex != self.body.teamComponent.teamIndex) { damageInfo.damage = 1E+09f; } } } orig.Invoke(self, damageInfo); } private void OnRecalculateStats(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (IsLocalPlayerBody(self)) { if (attackSpeedOn) { MulFloat(self, "attackSpeed", attackSpeed); } if (moveSpeedOn) { MulFloat(self, "moveSpeed", moveSpeed); } if (critOn) { SetMember(self, "crit", 100f); } if (infJumps) { SetMember(self, "maxJumpCount", 1000); } if (damageOn) { MulFloat(self, "damage", damageMult); } if (armorOn) { SetMember(self, "armor", GetFloat(self, "armor") + armorAdd); } if (jumpOn) { MulFloat(self, "jumpPower", jumpMult); } if (regenOn) { SetMember(self, "regen", GetFloat(self, "regen") + regenAdd); } if (maxHpOn) { MulFloat(self, "maxHealth", maxHpMult); } } } private void Update() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ExtraUpdate(); if (Input.GetKeyDown(cfgMenuKey.Value) && (!showMenu || !typingInField)) { SetMenu(!showMenu); } else if (showMenu && Input.GetKeyDown((KeyCode)27)) { SetMenu(open: false); } if (gameSpeedOn) { if (Time.timeScale > 0f) { Time.timeScale = gameSpeed; } } else if (gameSpeedWasOn) { Time.timeScale = 1f; } gameSpeedWasOn = gameSpeedOn; if (instantCooldowns) { CharacterBody body = GetBody(); if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.skillLocator)) { SkillLocator skillLocator = body.skillLocator; ResetSkill(skillLocator.primary); ResetSkill(skillLocator.secondary); ResetSkill(skillLocator.utility); ResetSkill(skillLocator.special); } } } private void FixedUpdate() { //IL_00b6: 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_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) ExtraFixedUpdate(); CharacterBody body = GetBody(); if (noclipOn) { if (Object.op_Implicit((Object)(object)body) && (Object)(object)body != (Object)(object)noclipBody) { if (Object.op_Implicit((Object)(object)noclipBody)) { SetNoclip(noclipBody, on: false); } noclipBody = body; SetNoclip(body, on: true); } } else if (Object.op_Implicit((Object)(object)noclipBody)) { SetNoclip(noclipBody, on: false); noclipBody = null; } Component motorComponent = GetMotorComponent(body); if ((!flyOn && !noclipOn) || !Object.op_Implicit((Object)(object)body) || !Object.op_Implicit((Object)(object)motorComponent) || !Object.op_Implicit((Object)(object)body.inputBank)) { return; } Vector3 val = Vector3.zero; if (!showMenu) { Vector3 aimDirection = body.inputBank.aimDirection; Vector3 val2 = Vector3.Cross(Vector3.up, aimDirection); Vector3 normalized = ((Vector3)(ref val2)).normalized; if (Input.GetKey((KeyCode)119)) { val += aimDirection; } if (Input.GetKey((KeyCode)115)) { val -= aimDirection; } if (Input.GetKey((KeyCode)100)) { val += normalized; } if (Input.GetKey((KeyCode)97)) { val -= normalized; } if (Input.GetKey((KeyCode)32)) { val += Vector3.up; } if (Input.GetKey((KeyCode)306)) { val -= Vector3.up; } } SetVelocity(motorComponent, ((Vector3)(ref val)).normalized * (15f * flySpeed)); } private void LateUpdate() { if (showMenu) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } } private void SetMenu(bool open) { showMenu = open; if (!open) { GUIUtility.keyboardControl = 0; typingInField = false; SaveSettings(); } LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); Player val = ((firstLocalUser != null) ? firstLocalUser.inputPlayer : null); if (val != null) { val.controllers.maps.SetAllMapsEnabled(!open); } } private static void ExtraLoc() { Loc["tab_character"] = new string[2] { "Персонаж", "Character" }; Loc["free_buy"] = new string[2] { "Бесплатные покупки", "Free Purchases" }; Loc["level_label"] = new string[2] { "Уровень команды:", "Team Level:" }; Loc["set"] = new string[2] { "Задать", "Set" }; Loc["tp_aim"] = new string[2] { "В точку прицела", "To Crosshair" }; Loc["tp_tele"] = new string[2] { "К телепортеру", "To Teleporter" }; Loc["tp_chest"] = new string[2] { "К ближайшему сундуку", "To Nearest Chest" }; Loc["magnet"] = new string[2] { "Магнит лута (радиус)", "Loot Magnet (radius)" }; Loc["spawn_creatures"] = new string[2] { "Существа", "Creatures" }; Loc["spawn_objects"] = new string[2] { "Объекты", "Objects" }; Loc["elite_label"] = new string[2] { "Элита:", "Elite:" }; Loc["elite_none"] = new string[2] { "Обычные", "None" }; Loc["spawn_aim"] = new string[2] { "В точку прицела", "At Crosshair" }; Loc["cat_objects"] = new string[2] { "Каталог объектов ещё загружается...", "Object catalog still loading..." }; Loc["objects_note"] = new string[2] { "Объекты спавнит только хост, в точке прицела (или перед вами).", "Only the host can spawn objects, at the crosshair (or in front of you)." }; Loc["cat_surv"] = new string[2] { "Каталог персонажей ещё загружается...", "Survivor catalog still loading..." }; Loc["survivor_label"] = new string[2] { "Персонаж:", "Survivor:" }; Loc["skin_label"] = new string[2] { "Скин:", "Skin:" }; Loc["apply"] = new string[2] { "Применить", "Apply" }; Loc["body_note"] = new string[2] { "Смена персонажа пересоздаёт тело, предметы сохраняются. Других игроков меняет только хост.", "Swapping respawns the body, items are kept. Only the host can change other players." }; Loc["presets_title"] = new string[2] { "Пресеты билдов", "Build presets" }; Loc["preset_name"] = new string[2] { "Имя:", "Name:" }; Loc["preset_save"] = new string[2] { "Сохранить мой билд", "Save my build" }; Loc["preset_load"] = new string[2] { "Загрузить", "Load" }; Loc["preset_clear"] = new string[2] { "Очищать инвентарь перед загрузкой", "Clear inventory before loading" }; Loc["preset_none"] = new string[2] { "Сохранённых билдов пока нет", "No saved builds yet" }; Loc["preset_note"] = new string[2] { "Сохраняются предметы и экипировка вашего персонажа; загружается выбранной цели.", "Saves your items and equipment; loading goes to the selected target." }; Loc["director_title"] = new string[2] { "Директор и ИИ (только хост)", "Director & AI (host only)" }; Loc["no_spawns"] = new string[2] { "Остановить спавн врагов", "Stop Enemy Spawns" }; Loc["add_credits"] = new string[2] { "+1000 кредитов директору", "+1000 Director Credits" }; Loc["start_boss"] = new string[2] { "Запустить телепортер (босс)", "Start Teleporter Event" }; Loc["stages_label"] = new string[2] { "Пройдено этапов:", "Stages Cleared:" }; Loc["freeze_ai"] = new string[2] { "Заморозить ИИ врагов", "Freeze Enemy AI" }; Loc["kill_aim"] = new string[2] { "Убить цель в прицеле", "Kill Target at Crosshair" }; Loc["director_note"] = new string[2] { "Магнит, директор и заморозка ИИ работают только у хоста.", "Magnet, director and AI freeze only work for the host." }; Loc["hud"] = new string[2] { "HUD со включёнными функциями", "Active Features HUD" }; Loc["hotkeys_title"] = new string[2] { "Горячие клавиши (меняются в конфиге):", "Hotkeys (change in the config):" }; } private void ExtraRebuildLabels() { spawnModeLabels = new string[2] { T("spawn_creatures"), T("spawn_objects") }; eliteLabels = null; } private void ExtraInit() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown PurchaseInteraction.CanBeAffordedByInteractor += new hook_CanBeAffordedByInteractor(OnCanAfford); PurchaseInteraction.OnInteractionBegin += new hook_OnInteractionBegin(OnPurchaseBegin); LoadPoints(); } private void ExtraDestroy() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown PurchaseInteraction.CanBeAffordedByInteractor -= new hook_CanBeAffordedByInteractor(OnCanAfford); PurchaseInteraction.OnInteractionBegin -= new hook_OnInteractionBegin(OnPurchaseBegin); try { SetDirectorsEnabled(on: true); SetEnemyAiEnabled(on: true); } catch (Exception) { } } private void ExtraRunChanged() { FreeBuyMasters.Clear(); freeBuyMap.Clear(); freeBuySent = false; noSpawns = (noSpawnsWasOn = false); freezeAI = (freezeAIWasOn = false); } private void ExtraLoadSettings() { cfgKeyGod = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "God", (KeyCode)286, "Бессмертие / God mode (None = выкл.)"); cfgKeyFly = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "Fly", (KeyCode)287, "Полёт / Flight"); cfgKeyNoclip = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "Noclip", (KeyCode)288, "Noclip"); cfgKeyTpAim = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "TeleportToCrosshair", (KeyCode)289, "Телепорт в точку прицела / Teleport to crosshair"); cfgKeyKillAim = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "KillTargetAtCrosshair", (KeyCode)290, "Убить цель в прицеле (хост) / Kill target at crosshair (host)"); cfgKeyHud = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Hotkeys", "ToggleHud", (KeyCode)291, "Показать / скрыть HUD / Toggle HUD"); cfgHud = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "Enabled", true, "HUD со списком включённых функций / Active features HUD"); hudOn = cfgHud.Value; } private void ExtraSaveSettings() { if (cfgHud != null) { cfgHud.Value = hudOn; } } private static bool KeyPressed(ConfigEntry<KeyCode> e) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (e != null && (int)e.Value != 0) { return Input.GetKeyDown(e.Value); } return false; } private bool MeFlag(HashSet<NetworkInstanceId> set, Dictionary<string, bool> sent) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { CharacterMaster master = GetMaster(); if ((Object)(object)master != (Object)null) { return set.Contains(((NetworkBehaviour)master).netId); } return false; } bool value; return sent.TryGetValue("0", out value) && value; } private void ExtraUpdate() { if (!typingInField && cfgKeyHud != null) { if (KeyPressed(cfgKeyHud)) { hudOn = !hudOn; } if (KeyPressed(cfgKeyFly)) { flyOn = !flyOn; } if (KeyPressed(cfgKeyNoclip)) { noclipOn = !noclipOn; } if (KeyPressed(cfgKeyTpAim)) { TeleportToAim(); } if (KeyPressed(cfgKeyKillAim) && NetworkServer.active) { KillAimTarget(); } if (KeyPressed(cfgKeyGod)) { bool flag = !MeFlag(GodMasters, godSent); godSent["0"] = flag; Send("fm_god " + (flag ? "1" : "0") + " 0"); } } } private void ExtraFixedUpdate() { if (NetworkServer.active && !((Object)(object)Run.instance == (Object)null)) { if (noSpawns) { SetDirectorsEnabled(on: false); } else if (noSpawnsWasOn) { SetDirectorsEnabled(on: true); } noSpawnsWasOn = noSpawns; if (freezeAI) { SetEnemyAiEnabled(on: false); } else if (freezeAIWasOn) { SetEnemyAiEnabled(on: true); } freezeAIWasOn = freezeAI; if (magnetOn) { PullPickups(); } } } private static void SetDirectorsEnabled(bool on) { foreach (CombatDirector instances in CombatDirector.instancesList) { if (Object.op_Implicit((Object)(object)instances)) { ((Behaviour)instances).enabled = on; } } } private static void SetEnemyAiEnabled(bool on) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 foreach (CharacterMaster readOnlyInstances in CharacterMaster.readOnlyInstancesList) { if (Object.op_Implicit((Object)(object)readOnlyInstances) && (int)readOnlyInstances.teamIndex != 1) { BaseAI component = ((Component)readOnlyInstances).GetComponent<BaseAI>(); if (Object.op_Implicit((Object)(object)component)) { ((Behaviour)component).enabled = on; } } } } private static void AddDirectorCredits(float credits) { foreach (CombatDirector instances in CombatDirector.instancesList) { if (Object.op_Implicit((Object)(object)instances)) { instances.monsterCredit += credits; } } } private void PullPickups() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) CharacterBody body = GetBody(); if (!Object.op_Implicit((Object)(object)body)) { return; } Vector3 corePosition = body.corePosition; int num = Physics.OverlapSphereNonAlloc(corePosition, magnetRadius, magnetBuf, -1, (QueryTriggerInteraction)2); float num2 = 40f * Time.fixedDeltaTime; for (int i = 0; i < num; i++) { Collider val = magnetBuf[i]; if (!Object.op_Implicit((Object)(object)val)) { continue; } Component componentInParent = (Component)(object)((Component)val).GetComponentInParent<GenericPickupController>(); if (!Object.op_Implicit((Object)(object)componentInParent)) { componentInParent = (Component)(object)((Component)val).GetComponentInParent<MoneyPickup>(); } if (Object.op_Implicit((Object)(object)componentInParent)) { Transform transform = componentInParent.transform; Vector3 position = Vector3.MoveTowards(transform.position, corePosition, num2); Rigidbody component = ((Component)transform).GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)component)) { component.velocity = Vector3.zero; component.position = position; } transform.position = position; } } } private static bool IsFreeBuyer(Interactor activator) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)activator)) { return false; } CharacterBody component = ((Component)activator).GetComponent<CharacterBody>(); if (!Object.op_Implicit((Object)(object)component)) { return false; } CharacterMaster master = component.master; if (NetworkServer.active && Object.op_Implicit((Object)(object)master) && FreeBuyMasters.Contains(((NetworkBehaviour)master).netId)) { return true; } if (!NetworkServer.active && (Object)(object)instance != (Object)null && instance.freeBuySent) { return IsLocalPlayerBody(component); } return false; } private bool OnCanAfford(orig_CanBeAffordedByInteractor orig, PurchaseInteraction self, Interactor activator) { if (IsFreeBuyer(activator)) { return true; } return orig.Invoke(self, activator); } private void OnPurchaseBegin(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor activator) { if (NetworkServer.active && FreeBuyMasters.Count > 0 && IsFreeBuyer(activator)) { int cost = self.cost; self.cost = 0; try { orig.Invoke(self, activator); return; } finally { self.cost = cost; } } orig.Invoke(self, activator); } private static void CmdFreeBuy(ConCommandArgs a) { //IL_0008: 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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { string target = ArgStr(a, 1); if (TargetAllowed(a, target)) { SetFlag(FreeBuyMasters, a, ArgBool(a, 0), target); } } } private bool GetAimPoint(out Vector3 point) { //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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missin