From 7643210f4a0469a45b812c0b993b2df4d591b3db Mon Sep 17 00:00:00 2001 From: Gurge44 Date: Mon, 16 Dec 2024 16:36:58 +0100 Subject: [PATCH] a --- Modules/DevManager.cs | 211 +++++++----------------------- Modules/SimpleButton.cs | 27 ++-- Modules/Statistics.cs | 12 +- Modules/Utils.cs | 2 +- Modules/Zoom.cs | 15 +-- Patches/ChatCommandPatch.cs | 8 +- Patches/OutroPatch.cs | 45 +++++-- Patches/PlayerJoinAndLeftPatch.cs | 22 +--- Resources/Lang/en_US.json | 2 + main.cs | 8 +- 10 files changed, 132 insertions(+), 220 deletions(-) diff --git a/Modules/DevManager.cs b/Modules/DevManager.cs index 646f14e5b..af51367e7 100644 --- a/Modules/DevManager.cs +++ b/Modules/DevManager.cs @@ -1,172 +1,61 @@ -using System.Collections.Generic; -using System.Linq; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; +using System.Text.Json; +using UnityEngine.Networking; namespace EHR; -public class DevUser(string code = "", string color = "null", string tag = "null", bool isUp = false, bool deBug = false) -{ - public string Code { get; } = code; - private string Color { get; } = color; - private string Tag { get; } = tag; - public bool IsUp { get; } = isUp; - public bool DeBug { get; } = deBug; - - public bool HasTag() - { - return Tag != "null"; - } - - public string GetTag() - { - return Color == "null" ? $"{Tag}\r\n" : $"{(Tag == "#Dev" ? Translator.GetString("Developer") : Tag)}\r\n"; - } -} - public static class DevManager { - private static readonly DevUser DefaultDevUser = new(); - private static List DevUserList = []; + private static readonly TagInfo DefaultDevUser = new(); - public static void Init() - { - DevUserList = - [ - // Dev - new("actorour#0029", "#ffc0cb", "TOHE/TONX Developer", true, true), // KARPED1EM - new("pinklaze#1776", isUp: true), // NCSIMON - new("keepchirpy#6354", "#1FF3C6", "TOHEN Developer", true), // TommyXL - new("motelchief#4112", "#eb57af", "Twilight Raven", true, true), // Drakos - new("eagergaol#1562", "#5534eb", "Drakos Alt", true, true), // Drakos Steam Alt - new("timedapper#9496"), //阿龍 - new("sofaagile#3120"), //天寸 - new("keyscreech#2151"), //Endrmen40409 + private static Dictionary Tags { get; set; } = []; - // Up - new("primether#5348", tag: "YouTuber/Streamer", isUp: true), // AnonWorks - new("truantwarm#9165", isUp: true), // 萧暮不姓萧 - new("drilldinky#1386", isUp: true), // 爱玩AU的河豚 - new("farardour#6818", isUp: true), // -提米SaMa- - new("vealused#8192", isUp: true), // lag丶xy - new("storyeager#0815", isUp: true), // 航娜丽莎 - new("versegame#3885", isUp: true), // 柴唔cw - new("closegrub#6217", isUp: true), // 警长不会玩 - new("frownnatty#7935", isUp: true), // 鬼灵official - new("veryscarf#5368", isUp: true), // 小武同学102 - new("sparklybee#0275", isUp: true), // --红包SaMa-- - new("endingyon#3175", isUp: true), // 游侠开摆 - new("firmine#0232", isUp: true), // YH永恒_ - new("storkfey#3570", isUp: true), // Calypso - new("fellowsand#1003", isUp: true), // C-Faust - new("jetsafe#8512", isUp: true), // Hoream是好人 - new("spoonkey#0792", isUp: true), // 没好康的 - new("beakedmire#6099", isUp: true), // 茄-au - new("doggedsize#7892", isUp: true), // TronAndRey - new("openlanded#9533", "#9e2424", "God Of Death Love Apples", true), // ryuk - new("unlikecity#4086", "#eD2F91", "Ward", true), // Ward - new("iconicdrop#2727", isUp: true), // jackler - - - new("goneria#8334", "#FFFF00", "The Dev on Phone", true, true), // [Developer] The 200IQ guy // Me on phone - new("neatnet#5851", "#FFFF00", "[Developer] The 200IQ guy", true, true), // [Developer] The 200IQ guy - new("contenthue#0404", "#FFFF00", "[Developer] The 200IQ guy", true, true), // [Developer] The 200IQ guy - new("theseform#5686", tag: "PTBR-Translator/Role Idea Creator", isUp: true), // Tomix - new("heavyclod#2286", "#FFFF00", "小叨.exe已停止运行", true), // 小叨院长 - new("storeroan#0331", "#FF0066", "Night_瓜", true), // Night_瓜 - new("teamelder#5856", "#1379bf", "屑Slok(没信誉的鸽子)", true), // Slok7565 - - new("radarright#2509"), - - // EHR players - new("ravenknurl#4562", "#008000", "Moderador do FH", true), // RicardoFumante - new("crustzonal#9589", "#00FFFF", "Translator PT-BR", true), // artyleague01 - new("tinedpun#6584", "#0000ff", "Translator PT-BR", true), // Dechis - new("swiftlord#8072", isUp: true), // But What About - new("ovalinstep#2984", isUp: true), // Seleneous - new("seleneous#6930", isUp: true), // Seleneous - new("innerruler#4140", isUp: true), // thewhiskas27 - new("urbanecalf#4975", "#420773", "Streamer", true), // Gugutsik - new("crustzonal#9589", isUp: true), // aviiiv0102 - new("tubedilute#9062", isUp: true), // Xcl4udioX - new("ponyholey#5532", "#0000FF", "desenvolvedor", true), // DrawingsZz - new("akinlaptop#2206", isUp: true), // MR Carr - new("fursilty#4676", "#0000ff", "arthurzin", true), // arthurzin - new("stonefuzzy#8673", "#ff0062", "Ru Translator", true, true), // HyperAtill - new("momenthale#7626", "#6f3bd9", "Amiran", true), // Amiran - new("valuecubic#5819", "#6f3bd9", "Kate", true), // Kate Cat - new("frizzytram#2508", "#1C87FF", "RafaelBIT50", true), // RafaelBIT50 - new("ruefulscar#0287", isUp: true), // Zendena - new("foggyzing#6238", isUp: true), // LdZinnn - new("onsideblur#3929", "#fc3a51", "YouTuber", isUp: true), // Manelzin - new("modestspan#7071", "null", "null", true), // Shark - new("divotbusy#0624", isUp: true), // PreCeptorBR - new("pinsrustic#5496", "#fc3a51", "YouTuber", isUp: true), // FHgameplay - new("opaquedot#5610", isUp: true), // Deh_66 - new("furpolitic#3380", "#a020f0", "EuOncologico o impostor", isUp: true), // EuOncologico - new("pithfierce#5073", isUp: true), // OrigeTv - new("cannylink#0564", isUp: true), // SpicyPoops - new("ghostapt#7243", "#a48d6b", "AUME", true), // MasterKy - new("planegame#5847", "#44fff7", "Kopp56", true), // Kopp56 PRO - new("clovesorry#6973", "#191970", "Master", true), // MAT - new("ivorywish#3580", "#ff0000", "YouTuber", true), // Erik Carr - new("cleardress#6310", "#ffffff", "<#00BFFF>一<#48D1CC>个<#7CFC00>热狗<#32CD32>uwu", true), // ABoringCat (CN Translator Team Leader) - new("alphacook#6624", "#ff0000", "Translator CN", true), // Dispenser (CN Translator Member) - new("rainypearl#9545", "#A020F0", "YouTuber", true), // bielModzs - new("kiltedbill#4145", isUp: true), // tsaki84 - new("onlyfax#3941", "#ff0000", "YouTuber", true), // The Nick AG - new("somewallet#5521", "#ffff00", "Artist", true), // YoshiBertil - new("pagersane#4064", isUp: true), // Bluejava3 - new("pocketdoor#9080", isUp: true), // Imnot - new("motorstack#2287", "#E34234", "Foxfire", true), // Esrazraft - new("motorlace#4741", "#DFB722", "\u2756 Assistant Tester \u2756", true), // PEPPERcula - new("kohlcuboid#5702", "#DFB722", "\u2756 Assistant Tester \u2756", true), // PEPPERcula - new("keyrunning#8720", "#00ffff", "Miku", true), // EverMortal_1455 - new("yellowjoy#3138", "#FFE87C", "Sunshine", true), // Becksy - new("stuckclaw#5717", "#FF474C", "The biggest SUS", true), // BIG SUS - new("funnytiger#8420", "#ffd4ec", "Registered Bozo", true), // Differntperson - new("raritykey#6021", "#08f638", "DESPAIR", true), // Junko - new("stiltedgap#2406", "#ffff00", "Youtuber", true), // Marcopolo1982 - new("spaglad#3866", "#ff0000", "YouTuber", true), // spider_191 - new("stapleecho#3635", isUp: true), // Thaylor1819 - new("coralcolt#2815", "#ed5356", "YouTuber", true), // TheDarkYT - new("deltasunny#0515", "#ff0000", "YouTuber", true), // LuffyFelx - new("strangeant#6543", isUp: true), // after.edits - new("ninjanice#3990", isUp: true), // void_daora - new("magicmill#4146", isUp: true), // Sr.Angel - new("grassyprey#9593", "#ff0000", "YouTuber", true), // LucasCarr - new("blessedtea#6684", "#ff0000", "YouTuber", true), // Rvimpostor - new("seriouslug#1532", "#FF2400", "ZEN", true), // Zypherus - new("potatotall#5573", isUp: true), // V.K - new("kamedexter#7241", "#ff0000", "YouTuber", true), // Lean - new("faintforge#1505", isUp: true), // hira._.gana - new("rarespite#3723", isUp: true), // Buddah2400 - - // Sponsor - new("recentduct#6068", "#FF00FF", "高冷男模法师", false, true), - new("canneddrum#2370", "#fffcbe", "我是喜唉awa"), - new("dovefitted#5329", "#1379bf", "不要首刀我"), - new("luckylogo#7352", "#f30000", "林@林"), - new("axefitful#8788", "#8e8171", "寄才是真理"), - new("raftzonal#8893", "#8e8171", "寄才是真理"), - new("twainrobin#8089", "#0000FF", "啊哈修maker"), - new("mallcasual#6075", "#f89ccb", "波奇酱"), - new("beamelfin#9478", "#6495ED", "Amaster-1111"), - new("lordcosy#8966", "#FFD6EC", "HostEHR"), // K - new("honestsofa#2870", "#D381D9", "Discord: SolarFlare#0700", true), // SolarFlare - new("caseeast#7194", "#1c2451", "disc.gg/maul"), // laikrai - - // Other - new("peakcrown#8292", isUp: true) // Hakaka - ]; - } - - private static bool IsDevUser(this string code) - { - return DevUserList.Any(x => x.Code == code); - } - - public static DevUser GetDevUser(this string code) + public static TagInfo GetDevUser(this string code) { code = code.Replace(':', '#'); - return code.IsDevUser() ? DevUserList.Find(x => x.Code == code) : DefaultDevUser; + return Tags.GetValueOrDefault(code, DefaultDevUser); + } + + private static IEnumerator FetchTags() + { + UnityWebRequest request = UnityWebRequest.Get("https://gurge44.pythonanywhere.com/get_all_tags"); + yield return request.SendWebRequest(); + + if (request.result is UnityWebRequest.Result.ConnectionError or UnityWebRequest.Result.ProtocolError) { Logger.Error($"Error fetching tags: {request.error}", "DevManager.FetchTags"); } + else + { + try + { + string json = request.downloadHandler.text.Trim(); + Tags = JsonSerializer.Deserialize>(json); + Logger.Info($"Tags successfully fetched: {Tags.Count} tags loaded.", "DevManager.FetchTags"); + } + catch (Exception ex) { Logger.Error($"Error parsing tags JSON: {ex.Message}", "DevManager.FetchTags"); } + } + } + + public static void StartFetchingTags() + { + Main.Instance.StartCoroutine(FetchTags()); + } + + // ReSharper disable once ClassNeverInstantiated.Global + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")] + [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Global")] + [SuppressMessage("ReSharper", "UnusedMember.Global")] + public class TagInfo + { + public string tag_name { get; set; } + public string tag_color { get; set; } + public bool up { get; set; } + public string ip { get; set; } + + public bool HasTag() => !string.IsNullOrEmpty(tag_name); + + public string GetTag() => !HasTag() ? "" : $"{tag_name}\r\n"; } } \ No newline at end of file diff --git a/Modules/SimpleButton.cs b/Modules/SimpleButton.cs index b00202403..689339401 100644 --- a/Modules/SimpleButton.cs +++ b/Modules/SimpleButton.cs @@ -11,15 +11,15 @@ public class SimpleButton private float _fontSize; private Vector2 _scale; - /// 新しいボタンを作成する - /// 親オブジェクト - /// オブジェクト名 - /// 通常時の背景色 - /// マウスホバー時の背景色 - /// クリック時に発火するアクション - /// ボタンのラベル - /// ボタンの大きさ - /// 初期状態でアクティブにするかどうか(デフォルトtrue) + /// Creates a new button + /// Parent object + /// Object name + /// Background color in normal state + /// Background color when mouse hovers + /// Action triggered on click + /// Button label + /// Button position + /// Whether to be active initially (default true) public SimpleButton( Transform parent, string name, @@ -38,7 +38,7 @@ public class SimpleButton HoverSprite = Button.activeSprites.GetComponent(); buttonCollider = Button.GetComponent(); - // ラベルをセンタリング + // Center the label Transform container = Label.transform.parent; Object.Destroy(Label.GetComponent()); container.SetLocalX(0f); @@ -75,20 +75,19 @@ public class SimpleButton { if (baseButton != null || passiveButton == null) return; - // 複製 baseButton = Object.Instantiate(passiveButton); var label = baseButton.transform.Find("FontPlacer/Text_TMP").GetComponent(); baseButton.gameObject.SetActive(false); - // シーン切替時に破棄されないようにする + Object.DontDestroyOnLoad(baseButton); baseButton.name = "EHR_SimpleButtonBase"; - // 不要なコンポーネントを無効化 + Object.Destroy(baseButton.GetComponent()); label.DestroyTranslator(); label.fontSize = label.fontSizeMax = label.fontSizeMin = 3.5f; label.enableWordWrapping = false; label.text = "EHR SIMPLE BUTTON BASE"; - // 当たり判定がズレてるのを直す + var buttonCollider = baseButton.GetComponent(); buttonCollider.offset = new(0f, 0f); baseButton.OnClick = new(); diff --git a/Modules/Statistics.cs b/Modules/Statistics.cs index 3e9430fc6..2242e0faa 100644 --- a/Modules/Statistics.cs +++ b/Modules/Statistics.cs @@ -26,7 +26,9 @@ public static class Statistics { bool won = CustomWinnerHolder.WinnerIds.Contains(lp.PlayerId) || CustomWinnerHolder.WinnerRoles.Contains(role) || (CustomWinnerHolder.WinnerTeam == CustomWinner.Bloodlust && addons.Contains(CustomRoles.Bloodlust)); - switch (Options.CurrentGameMode) + CustomGameMode gm = Options.CurrentGameMode; + + switch (gm) { case CustomGameMode.FFA when won: Achievements.Type.SerialKiller.CompleteAfterGameEnd(); @@ -150,9 +152,11 @@ public static class Statistics if (correctGuesses >= 6) Achievements.Type.BestGuesserAward.CompleteAfterGameEnd(); - Main.NumWinsPerGM.TryAdd(Options.CurrentGameMode, []); - Main.NumWinsPerGM[Options.CurrentGameMode].AddRange(CustomWinnerHolder.WinnerIds.ToValidPlayers().ToDictionary(x => x.FriendCode, _ => 0), overrideExistingKeys: false); - Main.NumWinsPerGM[Options.CurrentGameMode].AdjustAllValues(x => ++x); + if (gm == CustomGameMode.Standard) return; + + Main.NumWinsPerGM.TryAdd(gm, []); + Main.NumWinsPerGM[gm].AddRange(CustomWinnerHolder.WinnerIds.ToValidPlayers().ToDictionary(x => x.FriendCode, _ => 0), overrideExistingKeys: false); + Main.NumWinsPerGM[gm].AdjustAllValues(x => ++x); } catch (Exception e) { Utils.ThrowException(e); } diff --git a/Modules/Utils.cs b/Modules/Utils.cs index 36c5a461c..2b8b2c987 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -1797,7 +1797,7 @@ public static class Utils }; } - DevUser devUser = player.FriendCode.GetDevUser(); + var devUser = player.FriendCode.GetDevUser(); bool isMod = ChatCommands.IsPlayerModerator(player.FriendCode); bool isVIP = ChatCommands.IsPlayerVIP(player.FriendCode); bool hasTag = devUser.HasTag(); diff --git a/Modules/Zoom.cs b/Modules/Zoom.cs index 5677040df..d1e4ed1ae 100644 --- a/Modules/Zoom.cs +++ b/Modules/Zoom.cs @@ -32,8 +32,7 @@ public static class Zoom } case < 0: { - if (GameStates.IsDead || GameStates.IsFreePlay || DebugModeManager.AmDebugger || GameStates.IsLobby || - PlayerControl.LocalPlayer.FriendCode.GetDevUser().DeBug) + if (GameStates.IsDead || GameStates.IsFreePlay || DebugModeManager.AmDebugger || GameStates.IsLobby) if (Camera.main.orthographicSize < 18.0f) SetZoomSize(true); @@ -107,10 +106,10 @@ public static class Flag if (!OneTimeList.Contains(type)) OneTimeList.Add(type); } -/* - public static void DeleteFlag(string type) - { - if (OneTimeList.Contains(type)) OneTimeList.Remove(type); - } -*/ + /* + public static void DeleteFlag(string type) + { + if (OneTimeList.Contains(type)) OneTimeList.Remove(type); + } + */ } \ No newline at end of file diff --git a/Patches/ChatCommandPatch.cs b/Patches/ChatCommandPatch.cs index 541c43d15..9cf59e36b 100644 --- a/Patches/ChatCommandPatch.cs +++ b/Patches/ChatCommandPatch.cs @@ -926,7 +926,7 @@ internal static class ChatCommands private static void ChangeRoleCommand(ChatController __instance, PlayerControl player, string text, string[] args) { - if (GameStates.IsLobby || !player.FriendCode.GetDevUser().IsUp) return; + if (GameStates.IsLobby || !player.FriendCode.GetDevUser().up) return; string subArgs = text.Remove(0, 8); string setRole = FixRoleNameInput(subArgs.Trim()); @@ -983,7 +983,7 @@ internal static class ChatCommands return; } - if (!player.IsHost() && !Options.PlayerCanSetColor.GetBool() && !IsPlayerVIP(player.FriendCode) && !player.FriendCode.GetDevUser().IsUp) + if (!player.IsHost() && !Options.PlayerCanSetColor.GetBool() && !IsPlayerVIP(player.FriendCode) && !player.FriendCode.GetDevUser().up) { Utils.SendMessage(GetString("DisableUseCommand"), player.PlayerId); return; @@ -1565,7 +1565,7 @@ internal static class ChatCommands return; } - if (resultId != 0 && !player.FriendCode.GetDevUser().IsUp) + if (resultId != 0 && !player.FriendCode.GetDevUser().up) { Utils.SendMessage($"{GetString("Message.NoPermissionSetRoleOthers")}", player.PlayerId); return; @@ -1599,7 +1599,7 @@ internal static class ChatCommands private static void RCommand(ChatController __instance, PlayerControl player, string text, string[] args) { string subArgs = text.Remove(0, 2); - SendRolesInfo(subArgs, player.PlayerId, player.FriendCode.GetDevUser().DeBug); + SendRolesInfo(subArgs, player.PlayerId); } private static void DisconnectCommand(ChatController __instance, PlayerControl player, string text, string[] args) diff --git a/Patches/OutroPatch.cs b/Patches/OutroPatch.cs index 372685551..508957a34 100644 --- a/Patches/OutroPatch.cs +++ b/Patches/OutroPatch.cs @@ -56,7 +56,9 @@ internal static class EndGamePatch if (Options.DumpLogAfterGameEnd.GetBool()) Utils.DumpLog(false); - StringBuilder sb = new(GetString("KillLog") + ":"); + StringBuilder sb = new(GetString("KillLog")); + sb.Append(':'); + sb.Append(""); foreach ((byte key, PlayerState value) in Main.PlayerStates.OrderBy(x => x.Value.RealKiller.TimeStamp.Ticks)) { @@ -70,7 +72,7 @@ internal static class EndGamePatch if (killerId != byte.MaxValue && killerId != key) sb.Append($"\n\t⇐ {Main.AllPlayerNames[killerId]} ({(gmIsFMHH ? string.Empty : Utils.GetDisplayRoleName(killerId, true))}{(gmIsFM ? string.Empty : Utils.GetSubRolesText(killerId, summary: true))})"); } - KillLog = sb.ToString(); + KillLog = sb.Append("").ToString(); if (!KillLog.Contains('\n')) KillLog = string.Empty; Main.NormalOptions.KillCooldown = Options.DefaultKillCooldown; @@ -132,6 +134,7 @@ internal static class SetEverythingUpPatch { public static string LastWinsText = string.Empty; public static string LastWinsReason = string.Empty; + private static SimpleButton showHideButton; public static void Postfix(EndGameManager __instance) { @@ -494,16 +497,19 @@ internal static class SetEverythingUpPatch } } - sb.Append(""); - - var winCounts = Utils.GetWinCountsString(); - - if (winCounts != string.Empty) + if (Options.CurrentGameMode != CustomGameMode.Standard) { - sb.Append("\n\n"); - sb.Append(winCounts); + var winCounts = Utils.GetWinCountsString(); + + if (winCounts != string.Empty) + { + sb.Append("\n\n\n"); + sb.Append(winCounts); + } } + sb.Append(""); + var RoleSummary = RoleSummaryObject.GetComponent(); RoleSummary.alignment = TextAlignmentOptions.TopLeft; RoleSummary.color = Color.white; @@ -514,6 +520,27 @@ internal static class SetEverythingUpPatch RoleSummaryRectTransform.anchoredPosition = new(Pos.x + 3.5f, Pos.y - 0.1f); RoleSummary.text = sb.ToString(); + var showInitially = Main.ShowResult; + + showHideButton = new SimpleButton( + __instance.transform, + "ShowHideResultsButton", + new(-4.5f, 2.6f, -14f), + new(0, 165, 255, 255), + new(0, 255, 255, 255), + () => + { + var setToActive = !RoleSummary.gameObject.activeSelf; + RoleSummary.gameObject.SetActive(setToActive); + Main.ShowResult = setToActive; + showHideButton.Label.text = GetString(setToActive ? "HideResults" : "ShowResults"); + }, + GetString(showInitially ? "HideResults" : "ShowResults")) + { + Scale = new(1.5f, 0.5f), + FontSize = 2f, + }; + return; static string GetAdditionalWinnerRoleName(CustomRoles role) diff --git a/Patches/PlayerJoinAndLeftPatch.cs b/Patches/PlayerJoinAndLeftPatch.cs index ee82f648b..5f06f4d39 100644 --- a/Patches/PlayerJoinAndLeftPatch.cs +++ b/Patches/PlayerJoinAndLeftPatch.cs @@ -78,14 +78,8 @@ internal static class OnGameJoinedPatch if (GameStates.IsOnlineGame && GameStates.IsVanillaServer) { - try - { - LobbyNotifierForDiscord.NotifyLobbyStatusChanged(LobbyStatus.In_Lobby); - } - catch (Exception e) - { - Utils.ThrowException(e); - } + try { LobbyNotifierForDiscord.NotifyLobbyStatusChanged(LobbyStatus.In_Lobby); } + catch (Exception e) { Utils.ThrowException(e); } } }, 5f, "NotifyLobbyCreated"); } @@ -144,10 +138,7 @@ internal static class OnPlayerJoinedPatch AmongUsClient.Instance.FinishRpcImmediately(retry); } - if (client.Character != null && client.Character.Data != null && (client.Character.Data.DefaultOutfit.ColorId < 0 || Palette.PlayerColors.Length <= client.Character.Data.DefaultOutfit.ColorId) && Main.AllPlayerControls.Length >= 18) - { - Disco.ChangeColor(client.Character); - } + if (client.Character != null && client.Character.Data != null && (client.Character.Data.DefaultOutfit.ColorId < 0 || Palette.PlayerColors.Length <= client.Character.Data.DefaultOutfit.ColorId) && Main.AllPlayerControls.Length >= 18) { Disco.ChangeColor(client.Character); } } } catch { } @@ -328,10 +319,7 @@ internal static class OnPlayerLeftPatch Utils.CountAlivePlayers(true); } catch (NullReferenceException) { } - catch (Exception ex) - { - Logger.Error(ex.ToString(), "OnPlayerLeftPatch.Postfix"); - } + catch (Exception ex) { Logger.Error(ex.ToString(), "OnPlayerLeftPatch.Postfix"); } finally { Utils.NotifyRoles(NoCache: true); @@ -452,7 +440,7 @@ internal static class InnerNetClientSpawnPatch }, 1.3f, "DisplayLastResult"); } - // if (PlayerControl.LocalPlayer.FriendCode.GetDevUser().IsUp && Options.EnableUpMode.GetBool()) + // if (PlayerControl.LocalPlayer.FriendCode.GetDevUser().Up && Options.EnableUpMode.GetBool()) // { // LateTask.New(() => // { diff --git a/Resources/Lang/en_US.json b/Resources/Lang/en_US.json index 7cedd583a..a367a3c9b 100644 --- a/Resources/Lang/en_US.json +++ b/Resources/Lang/en_US.json @@ -4109,6 +4109,8 @@ "BackstabberTeam.NK": "a <#ffab1b>Neutral Killer", "Backstabber.RevealAfterKilling": "Revealed after killing", "GuessBackstabber": "You cannot guess a revealed Backstabber.", + "HideResults": "Hide Results", + "ShowResults": "Show Results", "Curser": "Curser", "CurserInfo": "Make Others' Life Worse", "CurserInfoLong": "(Neutrals):\\nAs the Curser, when you use your kill button on someone, you can single click on them to reveal their alignment, and double click to give them one of the following effects:\\n- -1 ability use\\n- +1 harmful add-on\\n- permanent low vision\\n- permanent low speed\\nYou win if crewmates lose.", diff --git a/main.cs b/main.cs index c6e84c3b4..655417ffc 100644 --- a/main.cs +++ b/main.cs @@ -108,7 +108,7 @@ public class Main : BasePlugin public static string FirstDied = string.Empty; public static string ShieldPlayer = string.Empty; - public static Dictionary> NumWinsPerGM = []; + public static readonly Dictionary> NumWinsPerGM = []; public static HashSet DiedThisRound = []; public static List LoversPlayers = []; public static bool IsLoversDead = true; @@ -120,6 +120,8 @@ public class Main : BasePlugin public static Dictionary SleuthMsgs = []; public static int MadmateNum; + public static bool ShowResult = true; + public static Main Instance; @@ -698,7 +700,6 @@ public class Main : BasePlugin BanManager.Init(); TemplateManager.Init(); SpamManager.Init(); - DevManager.Init(); Cloud.Init(); IRandom.SetInstance(new NetRandomWrapper()); @@ -724,6 +725,9 @@ public class Main : BasePlugin CustomLogger.ClearLog(); + try { DevManager.StartFetchingTags(); } + catch (Exception e) { Utils.ThrowException(e); } + Harmony.PatchAll(); if (!DebugModeManager.AmDebugger)