using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using MultiDPS.Patches; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.UI; [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("MultiDPS")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Per-player DPS scoreboard for Risk of Rain 2")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+de6605ce5b3f40b7d11b915ab155e5719e15d92c")] [assembly: AssemblyProduct("MultiDPS")] [assembly: AssemblyTitle("MultiDPS")] [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 MultiDPS { internal static class Attribution { private const int MaxMinionDepth = 4; public static NetworkUser Resolve(GameObject attacker, out bool viaMinion) { viaMinion = false; if ((Object)(object)attacker == (Object)null) { return null; } CharacterBody component = attacker.GetComponent(); if ((Object)(object)component == (Object)null) { return null; } CharacterMaster val = component.master; if ((Object)(object)val == (Object)null) { return null; } NetworkUser val2 = UserOf(val); if ((Object)(object)val2 != (Object)null) { return val2; } for (int i = 0; i < 4; i++) { MinionOwnership minionOwnership = val.minionOwnership; if ((Object)(object)minionOwnership == (Object)null) { break; } val = minionOwnership.ownerMaster; if ((Object)(object)val == (Object)null) { break; } val2 = UserOf(val); if ((Object)(object)val2 != (Object)null) { viaMinion = true; return val2; } } return null; } private static NetworkUser UserOf(CharacterMaster master) { PlayerCharacterMasterController playerCharacterMasterController = master.playerCharacterMasterController; if ((Object)(object)playerCharacterMasterController == (Object)null) { return null; } NetworkUser networkUser = playerCharacterMasterController.networkUser; if (!((Object)(object)networkUser == (Object)null)) { return networkUser; } return null; } } internal static class DpsTracker { private const float MinElapsed = 1f; private static readonly Dictionary Entries = new Dictionary(); private static float _stageStartTime; private static bool _subscribed; public static float Elapsed => Mathf.Max(1f, Time.unscaledTime - _stageStartTime); public static void Subscribe() { if (!_subscribed) { _subscribed = true; SnapshotStageStart(); GlobalEventManager.onClientDamageNotified += OnClientDamageNotified; Stage.onStageStartGlobal += OnStageStart; Run.onRunStartGlobal += OnRunStart; } } public static void Unsubscribe() { if (_subscribed) { _subscribed = false; GlobalEventManager.onClientDamageNotified -= OnClientDamageNotified; Stage.onStageStartGlobal -= OnStageStart; Run.onRunStartGlobal -= OnRunStart; Entries.Clear(); } } public static bool TryGet(NetworkUser user, out PlayerDps entry) { return Entries.TryGetValue(user, out entry); } private static void OnRunStart(Run run) { Reset(); } private static void OnStageStart(Stage stage) { Reset(); } private static void Reset() { Entries.Clear(); SnapshotStageStart(); } private static void SnapshotStageStart() { _stageStartTime = Time.unscaledTime; } private static void OnClientDamageNotified(DamageDealtMessage message) { try { if (message == null || message.damage <= 0f) { return; } bool viaMinion; NetworkUser val = Attribution.Resolve(message.attacker, out viaMinion); if (!((Object)(object)val == (Object)null)) { if (!Entries.TryGetValue(val, out var value)) { value = new PlayerDps(); Entries[val] = value; } if (viaMinion) { value.MinionDamage += message.damage; } else { value.DirectDamage += message.damage; } } } catch { } } } public enum ScoreboardAnchor { AboveHealthBar, TopRight, TopLeft, BottomRight, BottomLeft, TopCenter } public enum ChatBoxHandling { PushChatUp, PlaceAboveChat, MoveToCenter, Ignore } internal static class ModConfig { public const float MinScale = 0.4f; public const float MaxScale = 3f; public static ConfigEntry ToggleKey; public static ConfigEntry IsVisible; public static ConfigEntry HideWhenChatOpen; public static ConfigEntry RefreshInterval; public static ConfigEntry Anchor; public static ConfigEntry OffsetX; public static ConfigEntry OffsetY; public static ConfigEntry ChatBox; public static ConfigEntry ChatBoxGap; public static ConfigEntry ChatCenterOffsetX; public static ConfigEntry ChatCenterOffsetY; public static ConfigEntry MatchHudSkew; public static ConfigEntry Scale; public static ConfigEntry ScaleStep; public static ConfigEntry ScaleUpKey; public static ConfigEntry ScaleDownKey; public static ConfigEntry AutoSize; public static ConfigEntry Width; public static ConfigEntry Height; public static ConfigEntry FontSize; public static ConfigEntry MonospaceWidth; public static ConfigEntry ShowBackground; public static ConfigEntry BackgroundColor; public static ConfigEntry TextColor; public static ConfigEntry HighlightSelf; public static ConfigEntry SelfColor; public static ConfigEntry ShowCharacterName; public static ConfigEntry ShowMinionBreakdown; public static ConfigEntry ShowDamageShare; public static ConfigEntry ShowTeamTotal; public static ConfigEntry NameMaxLength; public static ConfigEntry UseCommas; public static bool LayoutDirty { get; set; } public static void Init(ConfigFile config) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) EnsureColorConverter(); ToggleKey = config.Bind("General", "Toggle Key", new KeyboardShortcut((KeyCode)290, Array.Empty()), "スコアボードの表示・非表示を切り替えるキー。"); IsVisible = config.Bind("General", "Is Visible", true, "現在スコアボードを表示しているか。トグルキーの状態がここに保存される。"); HideWhenChatOpen = config.Bind("General", "Hide When Chat Open", true, "チャット入力中はスコアボードを隠す。"); RefreshInterval = config.Bind("General", "Refresh Interval", 0.25f, "表示を更新する間隔(秒)。集計自体は常に行われるので、ここを大きくしても数値はずれない。"); Anchor = config.Bind("Layout", "Anchor", ScoreboardAnchor.AboveHealthBar, "スコアボードの配置。AboveHealthBar は HP バーとバフ表示の真上に下辺を合わせて追従する。"); OffsetX = config.Bind("Layout", "Offset X", 0f, "基準位置からの水平方向のずれ(ピクセル)。右が正。"); OffsetY = config.Bind("Layout", "Offset Y", 8f, "基準位置からの垂直方向のずれ(ピクセル)。上が正。"); ChatBox = config.Bind("Layout", "Chat Box Handling", ChatBoxHandling.MoveToCenter, "チャット・取得ログと重なったときの捌き方。PushChatUp はログを上へ押し上げる。PlaceAboveChat はスコアボード側がログの上へ逃げる。MoveToCenter はログを画面中央(自キャラのあたり)へ移す。Ignore は何もしない。"); ChatBoxGap = config.Bind("Layout", "Chat Box Gap", 8f, "スコアボードとチャット・取得ログのあいだに空ける隙間(ピクセル)。PushChatUp のときだけ使われる。"); ChatCenterOffsetX = config.Bind("Layout", "Chat Center Offset X", 380f, "MoveToCenter のときの、画面中央からの水平方向のずれ(ピクセル)。右が正。"); ChatCenterOffsetY = config.Bind("Layout", "Chat Center Offset Y", -46f, "MoveToCenter のときの、画面中央からの垂直方向のずれ(ピクセル)。上が正。"); MatchHudSkew = config.Bind("Layout", "Match HUD Skew", true, "ゲームの HUD と同じ傾き(画面中央を向いた台形変形)を掛ける。off にすると画面と平行な、傾きのない板になる。"); Scale = config.Bind("Layout", "Scale", 1.1f, "スコアボード全体の拡大率。左下を基準に拡大・縮小する。"); ScaleStep = config.Bind("Layout", "Scale Step", 0.1f, "拡大・縮小のキーを 1 回押したときに変化する量。"); ScaleUpKey = config.Bind("Layout", "Scale Up Key", new KeyboardShortcut((KeyCode)273, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), "スコアボードを拡大するキー。"); ScaleDownKey = config.Bind("Layout", "Scale Down Key", new KeyboardShortcut((KeyCode)274, (KeyCode[])(object)new KeyCode[1] { (KeyCode)306 }), "スコアボードを縮小するキー。"); AutoSize = config.Bind("Layout", "Auto Size", true, "パネルの大きさを中身に合わせて自動調整する。off にすると Width / Height が使われる。"); Width = config.Bind("Layout", "Width", 420f, "スコアボードの幅(ピクセル)。Auto Size が off のときだけ使われる。"); Height = config.Bind("Layout", "Height", 170f, "スコアボードの高さ(ピクセル)。Auto Size が off のときだけ使われる。"); FontSize = config.Bind("Layout", "Font Size", 16f, "文字サイズ。"); MonospaceWidth = config.Bind("Layout", "Monospace Width", 0.58f, "桁を揃えるための等幅文字の幅(em)。列がずれる場合に微調整する。"); ShowBackground = config.Bind("Layout", "Show Background", true, "背景パネルを表示する。"); BackgroundColor = config.Bind("Layout", "Background Color", new Color(1f, 1f, 1f, 2f / 51f), "背景パネルの色。"); TextColor = config.Bind("Display", "Text Color", Color.white, "文字色。"); HighlightSelf = config.Bind("Display", "Highlight Self", true, "自分の行を別の色で強調する。"); SelfColor = config.Bind("Display", "Self Color", new Color(1f, 0.84f, 0f, 1f), "自分の行の色。"); ShowCharacterName = config.Bind("Display", "Show Character Name", false, "プレイヤー名の隣に使用中のキャラクター名を表示する。"); ShowMinionBreakdown = config.Bind("Display", "Show Minion Breakdown", true, "タレット・ドローン・召喚物のぶんを (+N) として併記する。"); ShowDamageShare = config.Bind("Display", "Show Damage Share", true, "チーム総ダメージに占める割合を % で表示する。"); ShowTeamTotal = config.Bind("Display", "Show Team Total", true, "最下段にチーム合計の行を表示する。"); NameMaxLength = config.Bind("Display", "Name Max Length", 12, "プレイヤー名の表示に使う桁数。長い名前はここで切り詰められる。"); UseCommas = config.Bind("Display", "Use Commas", true, "数値に桁区切りを入れる。"); Anchor.SettingChanged += MarkLayoutDirty; OffsetX.SettingChanged += MarkLayoutDirty; OffsetY.SettingChanged += MarkLayoutDirty; MatchHudSkew.SettingChanged += MarkLayoutDirty; Scale.SettingChanged += MarkLayoutDirty; AutoSize.SettingChanged += MarkLayoutDirty; Width.SettingChanged += MarkLayoutDirty; Height.SettingChanged += MarkLayoutDirty; FontSize.SettingChanged += MarkLayoutDirty; ShowBackground.SettingChanged += MarkLayoutDirty; BackgroundColor.SettingChanged += MarkLayoutDirty; TextColor.SettingChanged += MarkLayoutDirty; if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { try { RegisterRiskOfOptions(); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Risk of Options への設定登録に失敗しました: " + ex.Message)); } } } private static void MarkLayoutDirty(object sender, EventArgs e) { LayoutDirty = true; } private static void EnsureColorConverter() { //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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown if (TomlTypeConverter.CanConvert(typeof(Color))) { return; } TomlTypeConverter.AddConverter(typeof(Color), new TypeConverter { ConvertToString = (object obj, Type type) => "#" + ColorUtility.ToHtmlStringRGBA((Color)obj), ConvertToObject = delegate(string str, Type type) { //IL_0010: 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_000f: Unknown result type (might be due to invalid IL or missing references) Color white = default(Color); if (!ColorUtility.TryParseHtmlString(str, ref white)) { white = Color.white; } return white; } }); } [MethodImpl(MethodImplOptions.NoInlining)] private static void RegisterRiskOfOptions() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown //IL_002d: 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_003d: 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_0058: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_009c: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00d1: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_0115: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //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_012f: 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_014a: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Expected O, but got Unknown //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Expected O, but got Unknown //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: 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_01f8: Expected O, but got Unknown //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Expected O, but got Unknown //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Expected O, but got Unknown //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Expected O, but got Unknown //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Expected O, but got Unknown //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Expected O, but got Unknown //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: 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_02c4: Expected O, but got Unknown //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Expected O, but got Unknown //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: 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_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Expected O, but got Unknown //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Expected O, but got Unknown //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Expected O, but got Unknown //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Expected O, but got Unknown //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_032b: Expected O, but got Unknown //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_033a: Expected O, but got Unknown //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Expected O, but got Unknown //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Expected O, but got Unknown //IL_035d: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Expected O, but got Unknown //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Expected O, but got Unknown //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Expected O, but got Unknown //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: Expected O, but got Unknown //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Expected O, but got Unknown //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Expected O, but got Unknown ModSettingsManager.SetModDescription("プレイヤーごとの DPS を HUD に表示します。フロアに入ってからの累計ダメージ ÷ 経過時間で計算します。"); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(ToggleKey)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(HideWhenChatOpen)); ModSettingsManager.AddOption((BaseOption)new SliderOption(RefreshInterval, new SliderConfig { min = 0.05f, max = 1f, FormatString = "{0:F2} s" })); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)Anchor)); ModSettingsManager.AddOption((BaseOption)new SliderOption(OffsetX, new SliderConfig { min = -960f, max = 960f, FormatString = "{0:F0}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(OffsetY, new SliderConfig { min = -540f, max = 540f, FormatString = "{0:F0}" })); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)ChatBox)); ModSettingsManager.AddOption((BaseOption)new SliderOption(ChatBoxGap, new SliderConfig { min = 0f, max = 80f, FormatString = "{0:F0}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ChatCenterOffsetX, new SliderConfig { min = -960f, max = 960f, FormatString = "{0:F0}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ChatCenterOffsetY, new SliderConfig { min = -540f, max = 540f, FormatString = "{0:F0}" })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(MatchHudSkew)); ModSettingsManager.AddOption((BaseOption)new SliderOption(Scale, new SliderConfig { min = 0.4f, max = 3f, FormatString = "{0:F2}x" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ScaleStep, new SliderConfig { min = 0.01f, max = 0.5f, FormatString = "{0:F2}" })); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(ScaleUpKey)); ModSettingsManager.AddOption((BaseOption)new KeyBindOption(ScaleDownKey)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(AutoSize)); ModSettingsManager.AddOption((BaseOption)new SliderOption(Width, new SliderConfig { min = 200f, max = 900f, FormatString = "{0:F0}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(Height, new SliderConfig { min = 60f, max = 600f, FormatString = "{0:F0}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(FontSize, new SliderConfig { min = 8f, max = 40f, FormatString = "{0:F0}" })); ModSettingsManager.AddOption((BaseOption)new SliderOption(MonospaceWidth, new SliderConfig { min = 0.4f, max = 1f, FormatString = "{0:F2} em" })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ShowBackground)); ModSettingsManager.AddOption((BaseOption)new ColorOption(BackgroundColor)); ModSettingsManager.AddOption((BaseOption)new ColorOption(TextColor)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(HighlightSelf)); ModSettingsManager.AddOption((BaseOption)new ColorOption(SelfColor)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ShowCharacterName)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ShowMinionBreakdown)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ShowDamageShare)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ShowTeamTotal)); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(NameMaxLength, new IntSliderConfig { min = 4, max = 24 })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(UseCommas)); } } internal sealed class PlayerDps { public float DirectDamage; public float MinionDamage; public string PlayerName; public string BodyName; public float TotalDamage => DirectDamage + MinionDamage; } [BepInPlugin("OchaDashiMan.MultiDPS", "MultiDPS", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { public const string Guid = "OchaDashiMan.MultiDPS"; public const string ModName = "MultiDPS"; public const string Version = "1.0.0"; internal const string RiskOfOptionsGuid = "com.rune580.riskofoptions"; internal static ManualLogSource Log; private Harmony _harmony; private void Awake() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; ModConfig.Init(((BaseUnityPlugin)this).Config); DpsTracker.Subscribe(); _harmony = new Harmony("OchaDashiMan.MultiDPS"); _harmony.PatchAll(typeof(HudPatch)); _harmony.PatchAll(typeof(ChatBoxPatch)); Log.LogInfo((object)"MultiDPS 1.0.0 loaded."); } private void OnDestroy() { DpsTracker.Unsubscribe(); Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } } internal sealed class ScoreboardBootstrap : MonoBehaviour { private const float Timeout = 10f; private HUD _hud; private float _deadline; public void Bind(HUD hud) { _hud = hud; _deadline = Time.unscaledTime + 10f; } private void Update() { if ((Object)(object)_hud == (Object)null) { Object.Destroy((Object)(object)this); } else if (ScoreboardView.Attach(_hud)) { Object.Destroy((Object)(object)this); } else if (Time.unscaledTime >= _deadline) { Plugin.Log.LogWarning((object)"HUD の SpringCanvas を見つけられなかったため、スコアボードを表示できません。ゲーム側の UI 構造が変わった可能性があります。"); Object.Destroy((Object)(object)this); } } } internal sealed class ScoreboardView : MonoBehaviour { private struct Row { public string PlayerName; public string BodyName; public float Total; public float MinionTotal; public bool IsSelf; } private struct Cell { public string Name; public string Body; public string Dps; public string Share; public string Minion; public bool IsSelf; } private static ScoreboardView _instance; private const int ColumnGap = 2; private const string TeamLabel = "TEAM"; private const float PaddingX = 10f; private const float PaddingY = 8f; private static readonly Comparison ByTotalDesc = (Row a, Row b) => b.Total.CompareTo(a.Total); private static readonly Vector3[] CornerBuffer = (Vector3[])(object)new Vector3[4]; private HUD _hud; private RectTransform _root; private Image _background; private HGTextMeshProUGUI _text; private Transform _springCanvas; private Transform _hudCluster; private RectTransform _chatRect; private Vector2 _chatOriginalPosition; private bool _chatCaptured; private readonly StringBuilder _sb = new StringBuilder(512); private readonly List _rows = new List(8); private readonly List _cells = new List(8); private float _nextRefresh; public static bool Attach(HUD hud) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_instance != (Object)null) { return true; } if ((Object)(object)hud == (Object)null) { return true; } if ((Object)(object)hud.mainUIPanel == (Object)null) { return false; } Transform val = hud.mainUIPanel.transform.Find("SpringCanvas"); if ((Object)(object)val == (Object)null) { return false; } Transform val2 = ResolveCluster(hud, val); GameObject val3 = new GameObject("MultiDPS"); val3.SetActive(false); RectTransform val4 = val3.AddComponent(); ((Transform)val4).SetParent((ModConfig.MatchHudSkew.Value && (Object)(object)val2 != (Object)null) ? val2 : val, false); val3.AddComponent().ignoreLayout = true; Image val5 = val3.AddComponent(); Image val6 = (((Object)(object)hud.itemInventoryDisplay != (Object)null) ? ((Component)hud.itemInventoryDisplay).GetComponent() : null); if ((Object)(object)val6 != (Object)null) { val5.sprite = val6.sprite; val5.type = (Type)1; } GameObject val7 = new GameObject("Text"); RectTransform obj = val7.AddComponent(); ((Transform)obj).SetParent((Transform)(object)val4, false); obj.anchorMin = Vector2.zero; obj.anchorMax = Vector2.one; obj.offsetMin = new Vector2(10f, 8f); obj.offsetMax = new Vector2(-10f, -8f); HGTextMeshProUGUI val8 = val7.AddComponent(); ((TMP_Text)val8).enableAutoSizing = false; ((TMP_Text)val8).enableWordWrapping = false; ((TMP_Text)val8).richText = true; ((Graphic)val8).raycastTarget = false; ((TMP_Text)val8).alignment = (TextAlignmentOptions)257; ScoreboardView scoreboardView = val3.AddComponent(); scoreboardView._hud = hud; scoreboardView._springCanvas = val; scoreboardView._hudCluster = val2; scoreboardView._root = val4; scoreboardView._background = val5; scoreboardView._text = val8; val3.SetActive(true); _instance = scoreboardView; scoreboardView.ApplyLayout(); Plugin.Log.LogInfo((object)"スコアボードを HUD に取り付けました。"); return true; } private void OnDestroy() { RestoreChatBox(); if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } private void Update() { if ((Object)(object)_text == (Object)null || (Object)(object)_root == (Object)null) { return; } HandleInput(); bool flag = ModConfig.IsVisible.Value && (!ModConfig.HideWhenChatOpen.Value || !ChatBoxPatch.IsTyping); ((Behaviour)_text).enabled = flag; ((Behaviour)_background).enabled = flag && ModConfig.ShowBackground.Value; if (!flag) { RestoreChatBox(); return; } if (ModConfig.LayoutDirty) { ModConfig.LayoutDirty = false; ApplyLayout(); } if (Time.unscaledTime >= _nextRefresh) { _nextRefresh = Time.unscaledTime + Mathf.Max(0.05f, ModConfig.RefreshInterval.Value); Redraw(); } UpdateChatBoxPosition(); } private static void HandleInput() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) if (!PauseManager.isPaused && !ChatBoxPatch.IsTyping) { KeyboardShortcut value = ModConfig.ToggleKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { ModConfig.IsVisible.Value = !ModConfig.IsVisible.Value; } value = ModConfig.ScaleUpKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { AdjustScale(ModConfig.ScaleStep.Value); } value = ModConfig.ScaleDownKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { AdjustScale(0f - ModConfig.ScaleStep.Value); } } } private static void AdjustScale(float delta) { float num = Mathf.Clamp(ModConfig.Scale.Value + delta, 0.4f, 3f); if (!Mathf.Approximately(num, ModConfig.Scale.Value)) { ModConfig.Scale.Value = num; } } private void ApplyLayout() { //IL_00a7: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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) ApplyParent(); Vector2 val = default(Vector2); switch (ModConfig.Anchor.Value) { case ScoreboardAnchor.AboveHealthBar: ((Vector2)(ref val))..ctor(0f, 0f); break; case ScoreboardAnchor.TopLeft: ((Vector2)(ref val))..ctor(0f, 1f); break; case ScoreboardAnchor.BottomRight: ((Vector2)(ref val))..ctor(1f, 0f); break; case ScoreboardAnchor.BottomLeft: ((Vector2)(ref val))..ctor(0f, 0f); break; case ScoreboardAnchor.TopCenter: ((Vector2)(ref val))..ctor(0.5f, 1f); break; default: ((Vector2)(ref val))..ctor(1f, 1f); break; } _root.anchorMin = val; _root.anchorMax = val; _root.pivot = val; _root.anchoredPosition = new Vector2(ModConfig.OffsetX.Value, ModConfig.OffsetY.Value); if (!ModConfig.AutoSize.Value) { _root.sizeDelta = new Vector2(ModConfig.Width.Value, ModConfig.Height.Value); } ((Transform)_root).localScale = Vector3.one * Mathf.Clamp(ModConfig.Scale.Value, 0.4f, 3f); ((Transform)_root).localRotation = Quaternion.identity; ((Graphic)_background).color = ModConfig.BackgroundColor.Value; ((Behaviour)_background).enabled = ModConfig.ShowBackground.Value; ((TMP_Text)_text).fontSize = ModConfig.FontSize.Value; ((Graphic)_text).color = ModConfig.TextColor.Value; } private void Redraw() { //IL_02e5: Unknown result type (might be due to invalid IL or missing references) float elapsed = DpsTracker.Elapsed; _rows.Clear(); float num = CollectRows(); _rows.Sort(ByTotalDesc); string text = (ModConfig.UseCommas.Value ? "N0" : "F0"); int limit = Mathf.Clamp(ModConfig.NameMaxLength.Value, 4, 24); bool value = ModConfig.ShowCharacterName.Value; bool value2 = ModConfig.ShowDamageShare.Value; bool value3 = ModConfig.ShowMinionBreakdown.Value; bool flag = ModConfig.ShowTeamTotal.Value && _rows.Count > 0; _cells.Clear(); int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; for (int i = 0; i < _rows.Count; i++) { Row row = _rows[i]; Cell item = new Cell { Name = Truncate(row.PlayerName, limit), Body = (value ? Truncate(row.BodyName, limit) : string.Empty), Dps = (row.Total / elapsed).ToString(text), Share = (value2 ? FormatShare(row.Total, num) : string.Empty), Minion = ((value3 && row.MinionTotal > 0f) ? ("(+" + (row.MinionTotal / elapsed).ToString(text) + ")") : string.Empty), IsSelf = row.IsSelf }; num2 = Mathf.Max(num2, item.Name.Length); num3 = Mathf.Max(num3, item.Body.Length); num4 = Mathf.Max(num4, item.Dps.Length); num5 = Mathf.Max(num5, item.Minion.Length); num6 = Mathf.Max(num6, item.Share.Length); _cells.Add(item); } string text2 = null; if (flag) { text2 = (num / elapsed).ToString(text); num2 = Mathf.Max(num2, "TEAM".Length); num4 = Mathf.Max(num4, text2.Length); } _sb.Length = 0; _sb.Append(""); for (int j = 0; j < _cells.Count; j++) { Cell cell = _cells[j]; int num7; if (cell.IsSelf) { num7 = (ModConfig.HighlightSelf.Value ? 1 : 0); if (num7 != 0) { _sb.Append("'); } } else { num7 = 0; } AppendRow(cell.Name, cell.Body, cell.Dps, cell.Minion, cell.Share, num2, num3, num4, num5, num6); if (num7 != 0) { _sb.Append(""); } _sb.Append('\n'); } if (flag) { int num8 = num2 + num4 + 2; if (num3 > 0) { num8 += num3 + 2; } if (num5 > 0) { num8 += num5 + 2; } if (num6 > 0) { num8 += num6 + 2; } _sb.Append('-', num8).Append('\n'); AppendRow("TEAM", string.Empty, text2, string.Empty, string.Empty, num2, num3, num4, num5, num6); } _sb.Append(""); ((TMP_Text)_text).text = _sb.ToString(); ResizeToFitText(); UpdateFollowPosition(); } private void AppendRow(string name, string body, string dps, string minion, string share, int nameWidth, int bodyWidth, int dpsWidth, int minionWidth, int shareWidth) { _sb.Append(name.PadRight(nameWidth)); if (bodyWidth > 0) { _sb.Append(' ', 2).Append(body.PadRight(bodyWidth)); } _sb.Append(' ', 2).Append(dps.PadLeft(dpsWidth)); if (minionWidth > 0) { _sb.Append(' ', 2).Append(minion.PadRight(minionWidth)); } if (shareWidth > 0) { _sb.Append(' ', 2).Append(share.PadLeft(shareWidth)); } } private static string FormatShare(float total, float teamTotal) { return ((teamTotal > 0f) ? (total * 100f / teamTotal) : 0f).ToString("F0") + "%"; } private void ResizeToFitText() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (ModConfig.AutoSize.Value) { _root.sizeDelta = new Vector2(((TMP_Text)_text).preferredWidth + 20f, ((TMP_Text)_text).preferredHeight + 16f); } } private void ApplyParent() { Transform val = ((ModConfig.MatchHudSkew.Value && (Object)(object)_hudCluster != (Object)null) ? _hudCluster : _springCanvas); if ((Object)(object)val != (Object)null && (Object)(object)((Transform)_root).parent != (Object)(object)val) { ((Transform)_root).SetParent(val, false); } } private void UpdateFollowPosition() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0108: 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_0129: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_008c: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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) if (ModConfig.Anchor.Value != ScoreboardAnchor.AboveHealthBar || (Object)(object)_hud == (Object)null) { return; } Transform parent = ((Transform)_root).parent; if ((Object)(object)parent == (Object)null) { return; } RectTransform val = RectOf((Component)(object)_hud.healthBar); if ((Object)(object)val == (Object)null) { return; } Vector3 val2 = TopLeftIn(parent, val); RectTransform val3 = RectOf((Component)(object)_hud.buffDisplay); if ((Object)(object)val3 != (Object)null && ((Component)val3).gameObject.activeInHierarchy) { Vector3 val4 = TopLeftIn(parent, val3); val2.x = Mathf.Min(val2.x, val4.x); val2.y = Mathf.Max(val2.y, val4.y); } if (ModConfig.ChatBox.Value == ChatBoxHandling.PlaceAboveChat) { RectTransform val5 = ResolveChatRect(); if ((Object)(object)val5 != (Object)null) { Vector3 val6 = TopLeftIn(parent, val5); val2.y = Mathf.Max(val2.y, val6.y + ModConfig.ChatBoxGap.Value); } } _root.pivot = Vector2.zero; ((Transform)_root).localPosition = new Vector3(val2.x + ModConfig.OffsetX.Value, val2.y + ModConfig.OffsetY.Value, val2.z); } private void UpdateChatBoxPosition() { //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_0049: Unknown result type (might be due to invalid IL or missing references) RectTransform val = ResolveChatRect(); if ((Object)(object)val == (Object)null) { _chatCaptured = false; return; } if (!_chatCaptured || (Object)(object)val != (Object)(object)_chatRect) { _chatRect = val; _chatOriginalPosition = val.anchoredPosition; _chatCaptured = true; } val.anchoredPosition = _chatOriginalPosition; Transform parent = ((Transform)val).parent; if (!((Object)(object)parent == (Object)null)) { switch (ModConfig.ChatBox.Value) { case ChatBoxHandling.PushChatUp: PushChatAboveScoreboard(val, parent); break; case ChatBoxHandling.MoveToCenter: MoveChatToCenter(val, parent); break; } } } private void PushChatAboveScoreboard(RectTransform chatRect, Transform chatParent) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) float y = TopLeftIn(chatParent, _root).y; chatRect.GetWorldCorners(CornerBuffer); float y2 = chatParent.InverseTransformPoint(CornerBuffer[0]).y; float num = y + ModConfig.ChatBoxGap.Value - y2; if (num > 0f) { chatRect.anchoredPosition = _chatOriginalPosition + new Vector2(0f, num); } } private void MoveChatToCenter(RectTransform chatRect, Transform chatParent) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: 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_0077: 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_007e: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) RectTransform val = ResolveCanvasRect(); if (!((Object)(object)val == (Object)null)) { chatRect.GetWorldCorners(CornerBuffer); Vector3 val2 = chatParent.InverseTransformPoint(CornerBuffer[0]); Vector3 val3 = chatParent.InverseTransformPoint(CornerBuffer[2]); Vector2 val4 = Vector2.op_Implicit((val2 + val3) * 0.5f); Rect rect = val.rect; Vector3 val5 = ((Transform)val).TransformPoint(Vector2.op_Implicit(((Rect)(ref rect)).center)); Vector2 val6 = Vector2.op_Implicit(chatParent.InverseTransformPoint(val5)); val6 += new Vector2(ModConfig.ChatCenterOffsetX.Value, ModConfig.ChatCenterOffsetY.Value); chatRect.anchoredPosition = _chatOriginalPosition + (val6 - val4); } } private RectTransform ResolveCanvasRect() { Canvas val = (((Object)(object)_background != (Object)null) ? ((Graphic)_background).canvas : null); if (!((Object)(object)val != (Object)null)) { return null; } Transform transform = ((Component)val).transform; return (RectTransform)(object)((transform is RectTransform) ? transform : null); } private void RestoreChatBox() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) if (_chatCaptured && !((Object)(object)_chatRect == (Object)null)) { _chatRect.anchoredPosition = _chatOriginalPosition; } } private static RectTransform ResolveChatRect() { ChatBox current = ChatBoxPatch.Current; if ((Object)(object)current == (Object)null) { return null; } RectTransform standardChatboxRect = current.standardChatboxRect; if (!((Object)(object)standardChatboxRect == (Object)null)) { return standardChatboxRect; } return null; } private static Vector3 TopLeftIn(Transform space, RectTransform rect) { //IL_0012: 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) rect.GetWorldCorners(CornerBuffer); return space.InverseTransformPoint(CornerBuffer[1]); } private static RectTransform RectOf(Component component) { if (!((Object)(object)component == (Object)null)) { Transform transform = component.transform; return (RectTransform)(object)((transform is RectTransform) ? transform : null); } return null; } private static Transform ResolveCluster(HUD hud, Transform spring) { RectTransform val = RectOf((Component)(object)hud.healthBar); if ((Object)(object)val == (Object)null) { return null; } Transform val2 = (Transform)(object)val; while ((Object)(object)val2.parent != (Object)null && (Object)(object)val2.parent != (Object)(object)spring) { val2 = val2.parent; } if (!((Object)(object)val2.parent == (Object)(object)spring)) { return null; } return val2; } private float CollectRows() { LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); NetworkUser val = ((firstLocalUser != null) ? firstLocalUser.currentNetworkUser : null); float num = 0f; IList readOnlyInstancesList = NetworkUser.readOnlyInstancesList; for (int i = 0; i < readOnlyInstancesList.Count; i++) { NetworkUser val2 = readOnlyInstancesList[i]; if (!((Object)(object)val2 == (Object)null)) { DpsTracker.TryGet(val2, out var entry); float num2 = entry?.DirectDamage ?? 0f; float num3 = entry?.MinionDamage ?? 0f; Row item = new Row { PlayerName = ResolvePlayerName(val2, entry), BodyName = ResolveBodyName(val2, entry), Total = num2 + num3, MinionTotal = num3, IsSelf = ((Object)(object)val != (Object)null && (Object)(object)val2 == (Object)(object)val) }; _rows.Add(item); num += item.Total; } } return num; } private static string ResolvePlayerName(NetworkUser user, PlayerDps entry) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) string text = null; try { NetworkPlayerName networkPlayerName = user.GetNetworkPlayerName(); text = ((NetworkPlayerName)(ref networkPlayerName)).GetResolvedName(); } catch { } if (string.IsNullOrEmpty(text)) { text = user.userName; } if (string.IsNullOrEmpty(text)) { if (entry == null || string.IsNullOrEmpty(entry.PlayerName)) { return "???"; } return entry.PlayerName; } if (entry != null) { entry.PlayerName = text; } return text; } private static string ResolveBodyName(NetworkUser user, PlayerDps entry) { CharacterMaster master = user.master; CharacterBody val = (((Object)(object)master != (Object)null) ? master.GetBody() : null); if ((Object)(object)val != (Object)null) { string displayName = val.GetDisplayName(); if (!string.IsNullOrEmpty(displayName)) { if (entry != null) { entry.BodyName = displayName; } return displayName; } } if (entry == null || entry.BodyName == null) { return string.Empty; } return entry.BodyName; } private static string Truncate(string value, int limit) { if (string.IsNullOrEmpty(value)) { return string.Empty; } if (value.Length <= limit) { return value; } return value.Substring(0, limit); } } } namespace MultiDPS.Patches { [HarmonyPatch(typeof(ChatBox))] internal static class ChatBoxPatch { private static ChatBox _current; public static ChatBox Current { get { if (!((Object)(object)_current == (Object)null)) { return _current; } return null; } } public static bool IsTyping { get { if ((Object)(object)_current != (Object)null && (Object)(object)_current.inputField != (Object)null) { return _current.inputField.isFocused; } return false; } } [HarmonyPatch("Start")] [HarmonyPostfix] private static void Start(ChatBox __instance) { _current = __instance; } } [HarmonyPatch] internal static class HudPatch { private static MethodBase ResolveAwake() { return AccessTools.Method(typeof(HUD), "Awake", (Type[])null, (Type[])null); } [HarmonyPrepare] private static bool Prepare() { if (ResolveAwake() != null) { return true; } Plugin.Log.LogError((object)"RoR2.UI.HUD.Awake が見つかりませんでした。ゲーム側の更新で変わった可能性があります。MultiDPS のスコアボードは無効になります。"); return false; } [HarmonyTargetMethod] private static MethodBase TargetMethod() { return ResolveAwake(); } [HarmonyPostfix] private static void Postfix(HUD __instance) { try { if (!ScoreboardView.Attach(__instance)) { ((Component)__instance).gameObject.AddComponent().Bind(__instance); } } catch (Exception ex) { Plugin.Log.LogError((object)("スコアボードの生成に失敗しました: " + ex)); } } } }