From 31d953378706311cf1e0d99c3c2993af96399116 Mon Sep 17 00:00:00 2001 From: HyperAtill Date: Mon, 22 Sep 2025 18:15:36 +0300 Subject: [PATCH] fix and rename --- CustomRoles.cs | 2 +- Main.cs | 4 +- Modules/CustomRoleSelector.cs | 2 +- Modules/CustomRolesHelper.cs | 10 +- Modules/RPC.cs | 6 +- Modules/Utils.cs | 2 +- Patches/ChatCommandPatch.cs | 125 +--------- Patches/CheckGameEndPatch.cs | 4 +- Patches/HudPatch.cs | 2 +- Patches/IntroPatch.cs | 4 +- README.md | 2 +- Resources/Lang/en_US.json | 16 +- Roles/Neutral/{DarkHide.cs => Stalker.cs} | 286 +++++++++++----------- 13 files changed, 171 insertions(+), 294 deletions(-) rename Roles/Neutral/{DarkHide.cs => Stalker.cs} (88%) diff --git a/CustomRoles.cs b/CustomRoles.cs index 43f905769..ac3f3f5ca 100644 --- a/CustomRoles.cs +++ b/CustomRoles.cs @@ -372,7 +372,7 @@ public enum CustomRoles Spirit, Spiritcaller, Sprayer, - DarkHide, // Stalker + Stalker, // Stalker Starspawn, Cultist, Sunnyboy, diff --git a/Main.cs b/Main.cs index 6f0140b39..0e3743d8f 100644 --- a/Main.cs +++ b/Main.cs @@ -526,7 +526,7 @@ public class Main : BasePlugin { CustomRoles.Hater, "#414b66" }, { CustomRoles.Konan, "#4d4dff" }, { CustomRoles.Demon, "#68bc71" }, - { CustomRoles.DarkHide, "#483d8b" }, + { CustomRoles.Stalker, "#483d8b" }, { CustomRoles.Workaholic, "#008b8b" }, { CustomRoles.Collector, "#9d8892" }, { CustomRoles.NecroGuesser, "#F6FE03" }, @@ -1018,7 +1018,7 @@ public enum CustomWinner Youtuber = CustomRoles.Youtuber, Egoist = CustomRoles.Egoist, Demon = CustomRoles.Demon, - DarkHide = CustomRoles.DarkHide, + Stalker = CustomRoles.Stalker, Workaholic = CustomRoles.Workaholic, Collector = CustomRoles.Collector, NecroGuesser = CustomRoles.NecroGuesser, diff --git a/Modules/CustomRoleSelector.cs b/Modules/CustomRoleSelector.cs index 21a2980a5..1874f6398 100644 --- a/Modules/CustomRoleSelector.cs +++ b/Modules/CustomRoleSelector.cs @@ -107,7 +107,7 @@ internal static class CustomRoleSelector case CustomRoles.Camouflager when Camouflager.DoesntSpawnOnFungle.GetBool() && Main.CurrentMap == MapNames.Fungle: case CustomRoles.Battery when Main.CurrentMap == MapNames.Fungle: case CustomRoles.Beacon when Main.CurrentMap == MapNames.Fungle: - case CustomRoles.DarkHide when Main.CurrentMap == MapNames.Fungle: + case CustomRoles.Stalker when Main.CurrentMap == MapNames.Fungle: case CustomRoles.Pelican when roles[RoleAssignType.Impostor].Any(x => x.Role == CustomRoles.Duellist): case CustomRoles.Duellist when roles[RoleAssignType.NeutralKilling].Any(x => x.Role == CustomRoles.Pelican): case CustomRoles.VengefulRomantic: diff --git a/Modules/CustomRolesHelper.cs b/Modules/CustomRolesHelper.cs index 7006fddd9..cc0ecb0d2 100644 --- a/Modules/CustomRolesHelper.cs +++ b/Modules/CustomRolesHelper.cs @@ -488,7 +488,7 @@ internal static class CustomRolesHelper CustomRoles.Jailor => UsePets && Jailor.UsePet.GetBool() ? RoleTypes.GuardianAngel : RoleTypes.Impostor, CustomRoles.Juggernaut => RoleTypes.Impostor, CustomRoles.Jinx => RoleTypes.Impostor, - CustomRoles.DarkHide => RoleTypes.Impostor, + CustomRoles.Stalker => RoleTypes.Impostor, CustomRoles.Provocateur => RoleTypes.Impostor, CustomRoles.BloodKnight => RoleTypes.Impostor, CustomRoles.Poisoner => RoleTypes.Impostor, @@ -614,7 +614,7 @@ internal static class CustomRolesHelper CustomRoles.Medusa or CustomRoles.Pelican or CustomRoles.Convict or - CustomRoles.DarkHide or + CustomRoles.Stalker or CustomRoles.Juggernaut or CustomRoles.Jinx or CustomRoles.Poisoner or @@ -1414,9 +1414,9 @@ internal static class CustomRolesHelper CustomRoles.Crewpostor => CountTypes.Impostor, CustomRoles.Refugee => CountTypes.Impostor, CustomRoles.Gaslighter => Gaslighter.WinCondition.GetValue() == 2 ? CountTypes.Gaslighter : CountTypes.Crew, - CustomRoles.DarkHide when DarkHide.SnatchesWin.GetBool() => CountTypes.Crew, + CustomRoles.Stalker when Stalker.SnatchesWin.GetBool() => CountTypes.Crew, CustomRoles.SchrodingersCat => SchrodingersCat.WinsWithCrewIfNotAttacked.GetBool() ? CountTypes.Crew : CountTypes.OutOfGame, - CustomRoles.DarkHide => !DarkHide.SnatchesWin.GetBool() ? CountTypes.DarkHide : CountTypes.Crew, + CustomRoles.Stalker => !Stalker.SnatchesWin.GetBool() ? CountTypes.Stalker : CountTypes.Crew, CustomRoles.Arsonist => Options.ArsonistKeepsGameGoing.GetBool() ? CountTypes.Arsonist : CountTypes.Crew, CustomRoles.Shifter => CountTypes.OutOfGame, CustomRoles.NoteKiller when !NoteKiller.CountsAsNeutralKiller => CountTypes.Crew, @@ -1957,7 +1957,7 @@ public enum CountTypes Juggernaut, Agitater, Virus, - DarkHide, + Stalker, Jinx, Ritualist, Pickpocket, diff --git a/Modules/RPC.cs b/Modules/RPC.cs index 10f6a4d54..4fc9dfd5d 100644 --- a/Modules/RPC.cs +++ b/Modules/RPC.cs @@ -110,7 +110,7 @@ public enum CustomRPC SetPelicanEtenNum, SwordsManKill, SetGhostPlayer, - SetDarkHiderKillCount, + SetStalkerKillCount, SetEvilDiviner, SetGreedierOe, SetCollectorVotes, @@ -1027,9 +1027,9 @@ internal static class RPCHandlerPatch BallLightning.ReceiveRPC(reader); break; } - case CustomRPC.SetDarkHiderKillCount: + case CustomRPC.SetStalkerKillCount: { - DarkHide.ReceiveRPC(reader); + Stalker.ReceiveRPC(reader); break; } case CustomRPC.SetGreedierOe: diff --git a/Modules/Utils.cs b/Modules/Utils.cs index b9e4d6b74..998730788 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -921,7 +921,7 @@ public static class Utils case CustomRoles.Wraith: case CustomRoles.Juggernaut: case CustomRoles.Ritualist: - case CustomRoles.DarkHide: + case CustomRoles.Stalker: case CustomRoles.Collector: case CustomRoles.ImperiusCurse: case CustomRoles.Provocateur: diff --git a/Patches/ChatCommandPatch.cs b/Patches/ChatCommandPatch.cs index 7e5d30c40..053426e9a 100644 --- a/Patches/ChatCommandPatch.cs +++ b/Patches/ChatCommandPatch.cs @@ -3381,130 +3381,7 @@ internal static class ChatCommands { text = text.Replace("着", "者").Trim().ToLower(); - return text switch - { - // There is no need to use these now //I guess forever - - /*"管理員" or "管理" or "gm" => GetString("GM"), - "賞金獵人" or "赏金" or "bh" or "bounty" => GetString("BountyHunter"), - "自爆兵" or "自爆" => GetString("Bomber"), - "邪惡的追踪者" or "邪恶追踪者" or "追踪" or "et" => GetString("EvilTracker"), - "煙花商人" or "烟花" or "fw" => GetString("FireWorks"), - "夢魘" or "夜魇" => GetString("Mare"), - "詭雷" => GetString("BoobyTrap"), - "黑手黨" or "黑手" => GetString("Mafia"), - "嗜血殺手" or "嗜血" or "sk" => GetString("SerialKiller"), - "千面鬼" or "千面" => GetString("ShapeMaster"), - "狂妄殺手" or "狂妄" or "arr" => GetString("Sans"), - "殺戮機器" or "杀戮" or "机器" or "杀戮兵器" or "km" => GetString("KillingMachine"), - "蝕時者" or "蚀时" or "偷时" or "tt" => GetString("TimeThief"), - "狙擊手" or "狙击" => GetString("Sniper"), - "傀儡師" or "傀儡" => GetString("Puppeteer"), - "殭屍" or "丧尸" => GetString("Zombie"), - "吸血鬼" or "吸血" or "vamp" => GetString("Vampire"), - "術士" => GetString("Warlock"), - "駭客" or "黑客" => GetString("Hacker"), - "刺客" or "忍者" => GetString("Ninja"), - "礦工" => GetString("Miner"), - "逃逸者" or "逃逸" => GetString("Escapee"), - "女巫" => GetString("Witch"), - "監視者" or "监管" or "aa" => GetString("AntiAdminer"), - "清道夫" or "清道" or "scav" => GetString("Scavenger"), - "窺視者" or "窥视" => GetString("Watcher"), - "誘餌" or "大奖" or "头奖" => GetString("Bait"), - "擺爛人" or "摆烂" => GetString("Needy"), - "獨裁者" or "独裁" or "dict" => GetString("Dictator"), - "法醫" or "doc" => GetString("Doctor"), - "偵探" or "det" => GetString("Forensic"), - "幸運兒" or "幸运" => GetString("Luckey"), - "大明星" or "明星" or "ss" => GetString("SuperStar"), - "demo" => GetString("Demolitionist"), - "俠客" => GetString("SwordsMan"), - "正義賭怪" or "正义的赌怪" or "好赌" or "正义赌" or "ng" => GetString("NiceGuesser"), - "邪惡賭怪" or "邪恶的赌怪" or "坏赌" or "恶赌" or "邪恶赌" or "赌怪" or "eg" => GetString("EvilGuesser"), - "市長" or "逝长" => GetString("Mayor"), - "被害妄想症" or "被害妄想" or "被迫害妄想症" or "被害" or "妄想" or "妄想症" => GetString("Paranoia"), - "愚者" or "愚" => GetString("Psychic"), - "修理大师" or "修理" or "维修" or "sm" => GetString("SabotageMaster"), - "警長" => GetString("Sheriff"), - "告密者" or "告密" => GetString("Snitch"), - "增速者" or "增速" => GetString("SpeedBooster"), - "時間操控者" or "时间操控人" or "时间操控" or "tm" => GetString("TimeManager"), - "陷阱師" or "陷阱" or "小奖" => GetString("Trapper"), - "傳送師" or "传送" or "trans" => GetString("Transporter"), - "縱火犯" or "纵火" or "arso" => GetString("Arsonist"), - "處刑人" or "处刑" or "exe" => GetString("Executioner"), - "小丑" or "丑皇" or "jest" => GetString("Jester"), - "投機者" or "投机" or "oppo" => GetString("Opportunist"), - "馬里奧" or "马力欧" => GetString("Mario"), - "恐怖分子" or "恐怖" or "terro" => GetString("Terrorist"), - "豺狼" or "蓝狼" or "狼" => GetString("Jackal"), - "神" or "上帝" => GetString("God"), - "情人" or "愛人" or "链子" or "老婆" or "老公" or "lover" => GetString("Lovers"), - "絕境者" or "绝境" or "last" or "lastimp" or "last imp" or "Last" => GetString("LastImpostor"), - "閃電俠" or "闪电" => GetString("Flashman"), - "靈媒" => GetString("Seer"), - "破平者" or "破平" => GetString("Brakar"), - "執燈人" or "执灯" or "灯人" => GetString("Torch"), - "膽小" or "胆小" or "obli" => GetString("Oblivious"), - "迷惑者" or "迷幻" or "bew" => GetString("Bewilder"), - "sun" => GetString("Sunglasses"), - "蠢蛋" or "笨蛋" or "蠢狗" or "傻逼" => GetString("Fool"), - "冤罪師" or "冤罪" or "inno" => GetString("Innocent"), - "資本家" or "资本主义" or "资本" or "cap" or "capi" => GetString("Capitalism"), - "老兵" or "vet" => GetString("Veteran"), - "加班狂" or "加班" => GetString("Workhorse"), - "復仇者" or "复仇" => GetString("Avanger"), - "鵜鶘" or "pel" or "peli" => GetString("Pelican"), - "保鏢" or "bg" => GetString("Bodyguard"), - "up" or "up主" or "yt" => GetString("Youtuber"), - "利己主義者" or "利己主义" or "利己" or "ego" => GetString("Egoist"), - "贗品商" or "赝品" => GetString("Counterfeiter"), - "擲雷兵" or "掷雷" or "闪光弹" or "gren" or "grena" => GetString("Grenadier"), - "竊票者" or "偷票" or "偷票者" or "窃票师" or "窃票" => GetString("TicketsStealer"), - "教父" => GetString("Gangster"), - "革命家" or "革命" or "revo" => GetString("Revolutionist"), - "fff團" or "fff" or "fff团" => GetString("Hater"), - "清理工" or "清潔工" or "清洁工" or "清理" or "清洁" or "janitor" => GetString("Cleaner"), - "醫生" => GetString("Medicaler"), - "占卜師" or "占卜" or "ft" => GetString("Divinator"), - "雙重人格" or "双重" or "双人格" or "人格" or "schizo" or "scizo" or "shizo" => GetString("DualPersonality"), - "玩家" => GetString("Gamer"), - "情報販子" or "情报" or "贩子" => GetString("Messenger"), - "球狀閃電" or "球闪" or "球状" => GetString("BallLightning"), - "潛藏者" or "潜藏" => GetString("DarkHide"), - "貪婪者" or "贪婪" => GetString("Greedier"), - "工作狂" or "工作" or "worka" => GetString("Workaholic"), - "呪狼" or "咒狼" or "cw" => GetString("CursedWolf"), - "寶箱怪" or "宝箱" => GetString("Mimic"), - "集票者" or "集票" or "寄票" or "机票" => GetString("Collector"), - "活死人" or "活死" => GetString("Glitch"), - "奪魂者" or "多混" or "夺魂" or "sc" => GetString("ImperiusCurse"), - "自爆卡車" or "自爆" or "卡车" or "provo" => GetString("Provocateur"), - "快槍手" or "快枪" or "qs" => GetString("QuickShooter"), - "隱蔽者" or "隐蔽" or "小黑人" => GetString("Concealer"), - "抹除者" or "抹除" => GetString("Eraser"), - "肢解者" or "肢解" => GetString("OverKiller"), - "劊子手" or "侩子手" or "柜子手" => GetString("Hangman"), - "陽光開朗大男孩" or "阳光" or "开朗" or "大男孩" or "阳光开朗" or "开朗大男孩" or "阳光大男孩" or "sunny" => GetString("Sunnyboy"), - "法官" or "审判" => GetString("Judge"), - "入殮師" or "入检师" or "入殓" or "mor" => GetString("Mortician"), - "通靈師" or "通灵" => GetString("Mediumshiper"), - "吟游詩人" or "诗人" => GetString("Bard"), - "隱匿者" or "隐匿" or "隐身" or "隐身人" or "印尼" => GetString("Swooper"), - "船鬼" or "cp" => GetString("Crewpostor"), - "嗜血騎士" or "血骑" or "骑士" or "bk" => GetString("BloodKnight"), - "賭徒" => GetString("Follower"), - "分散机" => GetString("Disperser"), - "和平之鸽" or "和平之鴿" or "和平的鸽子" or "和平" or "dop" or "dove of peace" => GetString("DovesOfNeace"), - "持槍" or "持械" or "手长" => GetString("Reach"), - "monarch" => GetString("Monarch"), - "sch" => GetString("SchrodingersCat"), - "glitch" => GetString("Glitch"), - "безумный" or "mad" => GetString("Madmate"), - "анти админер" or "anti adminer" => GetString("AntiAdminer"),*/ - _ => text, - }; + return text switch { _ => text }; } public static bool GetRoleByName(string name, out CustomRoles role) diff --git a/Patches/CheckGameEndPatch.cs b/Patches/CheckGameEndPatch.cs index 326939bd1..c00e68177 100644 --- a/Patches/CheckGameEndPatch.cs +++ b/Patches/CheckGameEndPatch.cs @@ -192,8 +192,8 @@ internal static class GameEndChecker switch (role) { - case CustomRoles.DarkHide when pc.IsAlive() && ((WinnerTeam == CustomWinner.Impostor && !reason.Equals(GameOverReason.ImpostorsBySabotage)) || WinnerTeam == CustomWinner.DarkHide || (WinnerTeam == CustomWinner.Crewmate && !reason.Equals(GameOverReason.CrewmatesByTask) && roleBase is DarkHide { IsWinKill: true } && DarkHide.SnatchesWin.GetBool())): - ResetAndSetWinner(CustomWinner.DarkHide); + case CustomRoles.Stalker when pc.IsAlive() && ((WinnerTeam == CustomWinner.Impostor && !reason.Equals(GameOverReason.ImpostorsBySabotage)) || WinnerTeam == CustomWinner.Stalker || (WinnerTeam == CustomWinner.Crewmate && !reason.Equals(GameOverReason.CrewmatesByTask) && roleBase is Stalker { IsWinKill: true } && Stalker.SnatchesWin.GetBool())): + ResetAndSetWinner(CustomWinner.Stalker); WinnerIds.Add(pc.PlayerId); break; case CustomRoles.Phantasm when pc.GetTaskState().RemainingTasksCount <= 0 && !pc.IsAlive() && Options.PhantomSnatchesWin.GetBool(): diff --git a/Patches/HudPatch.cs b/Patches/HudPatch.cs index ba6005a9c..4609b2839 100644 --- a/Patches/HudPatch.cs +++ b/Patches/HudPatch.cs @@ -593,7 +593,7 @@ internal static class SetHudActivePatch case CustomRoles.Hater: case CustomRoles.Medic: case CustomRoles.Demon: - case CustomRoles.DarkHide: + case CustomRoles.Stalker: case CustomRoles.Farseer: case CustomRoles.Crusader: __instance.SabotageButton?.ToggleVisible(false); diff --git a/Patches/IntroPatch.cs b/Patches/IntroPatch.cs index 7abb11bc4..73c5102e2 100644 --- a/Patches/IntroPatch.cs +++ b/Patches/IntroPatch.cs @@ -741,13 +741,13 @@ internal static class BeginCrewmatePatch CustomRoles.Noisemaker or CustomRoles.NoisemakerEHR or CustomRoles.SuperStar - or CustomRoles.DarkHide + or CustomRoles.Stalker or CustomRoles.Specter => GetIntroSound(RoleTypes.Noisemaker), CustomRoles.Phantom or CustomRoles.PhantomEHR - or CustomRoles.DarkHide + or CustomRoles.Stalker or CustomRoles.ImperiusCurse or CustomRoles.SoulHunter => GetIntroSound(RoleTypes.Phantom), diff --git a/README.md b/README.md index 4d4224a03..11423141e 100644 --- a/README.md +++ b/README.md @@ -412,7 +412,7 @@ Source language: English > > - Many role ideas -> - Provided roles: AntiAdminer, CursedWolf, Workaholic, Greedier, DarkHide, Ignitor, Rabbit +> - Provided roles: AntiAdminer, CursedWolf, Workaholic, Greedier, Stalker, Ignitor, Rabbit > - Reference: Modify game announcement > - New settings UI for v2024.6.18 > - Reference: Role Basis Changing Mid-Game diff --git a/Resources/Lang/en_US.json b/Resources/Lang/en_US.json index 57bcbb52f..2e71215f0 100644 --- a/Resources/Lang/en_US.json +++ b/Resources/Lang/en_US.json @@ -300,7 +300,7 @@ "Revolutionist": "Revolutionist", "Hater": "Hater", "Demon": "Demon", - "DarkHide": "Stalker", + "Stalker": "Stalker", "Workaholic": "Workaholic", "Collector": "Collector", "Provocateur": "Provocateur", @@ -580,7 +580,7 @@ "RevolutionistInfo": "Recruit players to win with you", "HaterInfo": "Kill Lovers and Converted players", "DemonInfo": "Consume blood volumes", - "DarkHideInfo": "Your kills cause power outages", + "StalkerInfo": "Your kills cause power outages", "WorkaholicInfo": "Finish all tasks to solo win!", "CollectorInfo": "Collect votes from players", "ProvocateurInfo": "Win if your target loses", @@ -810,7 +810,7 @@ "RevolutionistInfoLong": "(Neutrals):\\nThe Revolutionist can recruit players by clicking the kill button on them and following them for a few seconds. If recruiting is successful, a shield animation is shown as a reminder. Players recruited are likely to be immediately killed, a probability set by the host. The Revolutionist and all recruited players win if the specified number of players vent within the set time, otherwise, the recruited player dies. The Revolutionist dies if killed during a countdown or at a meeting. Players who died after recruitment can still win with the Revolutionist.", "HaterInfoLong": "(Neutrals):\\nAs the Hater, you can kill as often as you want with no cooldown and have impostor vision. You can only kill Lovers, recruited players, and recruiting roles, or you will die. Winning is possible if you kill at least one player during the game.", "DemonInfoLong": "(Neutrals):\\nDemon has a unique health-based killing system, and killing takes effect when one's health is exhausted. If a Demon's health is consumed but they are not killed, the murderer will see a shield animation as a reminder.", - "DarkHideInfoLong": "(Neutrals):\\nThe Stalker can kill anyone and cause electricity sabotage. They cannot vent. If the Stalker is alive and the Impostor or Crewmate wins, the Stalker wins alone.", + "StalkerInfoLong": "(Neutrals):\\nThe Stalker can kill anyone and cause electricity sabotage. They cannot vent. If the Stalker is alive and the Impostor or Crewmate wins, the Stalker wins alone.", "WorkaholicInfoLong": "(Neutrals):\\nWorkaholics win by completing more tasks, maybe even after their death.", "CollectorInfoLong": "(Neutrals):\\nCollectors can gather all the votes cast by a target in a meeting. When they collect the specified number of votes, they win, even over exiled players.", "PoisonerInfoLong": "(Neutrals):\\nAs the Poisoner, your kills are delayed. Kill everyone to win.", @@ -9242,7 +9242,7 @@ "RememberedNeutralKiller": "You remembered you were a neutral killer!", "RememberedMaverick": "You remembered you were a Maverick!", "RememberedPursuer": "You remembered you were a Pursuer!", - "RememberedTotocalcio": "You remembered you were a Follower!", + "RememberedFollower": "You remembered you were a Follower!", "RememberedAmnesiac": "You failed to remember your role.", "RememberedImpostor": "You remembered you were an Impostor!", "RememberedCrewmate": "You remembered you were a Crewmate!", @@ -9824,14 +9824,14 @@ "WinnerRoleText.Youtuber": "YouTuber Wins!", "WinnerRoleText.Egoist": "Egoist Wins!", "WinnerRoleText.Demon": "Demon Wins!", - "WinnerRoleText.DarkHide": "Stalker Wins!", + "WinnerRoleText.Stalker": "Stalker Wins!", "WinnerRoleText.Workaholic": "Workaholic Wins!", "WinnerRoleText.Agitater": "Agitator Wins!", "WinnerRoleText.Collector": "Collector Wins!", "WinnerRoleText.BloodKnight": "Blood Knight Wins!", "WinnerRoleText.Poisoner": "Poisoner Wins!", "WinnerRoleText.HexMaster": "Hex Master Wins!", - "WinnerRoleText.Succubus": "Cultist Wins!", + "WinnerRoleText.Cultist": "Cultist Wins!", "WinnerRoleText.Necromancer": "Undead Faction Wins!", "WinnerRoleText.Wraith": "Wraith Wins!", "WinnerRoleText.SerialKiller": "Serial Killer Wins!", @@ -9881,10 +9881,10 @@ "AdditionalWinnerRoleText.Sidekick": "along with Sidekicks", "AdditionalWinnerRoleText.Opportunist": "The Opportunist survived", "AdditionalWinnerRoleText.Lawyer": "The Lawyer wins along", - "AdditionalWinnerRoleText.FFF": "The Hater killed a recruit", + "AdditionalWinnerRoleText.Hater": "The Hater killed a recruit", "AdditionalWinnerRoleText.Provocateur": "The Provocateur wins along", "AdditionalWinnerRoleText.Sunnyboy": "And there's endless sunshine!", - "AdditionalWinnerRoleText.Totocalcio": "The Follower wins along", + "AdditionalWinnerRoleText.Follower": "The Follower wins along", "AdditionalWinnerRoleText.Pursuer": "The Pursuer survived", "AdditionalWinnerRoleText.Jester": "The Jester wins along", "AdditionalWinnerRoleText.Lovers": "Lovers win along", diff --git a/Roles/Neutral/DarkHide.cs b/Roles/Neutral/Stalker.cs similarity index 88% rename from Roles/Neutral/DarkHide.cs rename to Roles/Neutral/Stalker.cs index 5436fa533..b6e83f983 100644 --- a/Roles/Neutral/DarkHide.cs +++ b/Roles/Neutral/Stalker.cs @@ -1,144 +1,144 @@ -using System.Collections.Generic; -using AmongUs.GameOptions; -using EHR.Modules; -using Hazel; - -namespace EHR.Neutral; - -// Credit: https://github.com/Yumenopai/TownOfHost_Y -public class DarkHide : RoleBase -{ - private const int Id = 12900; - private static List PlayerIdList = []; - - private static OptionItem KillCooldown; - private static OptionItem HasImpostorVision; - private static OptionItem CanCountNeutralKiller; - private static OptionItem CanVent; - public static OptionItem SnatchesWin; - - private float CurrentKillCooldown = Options.AdjustedDefaultKillCooldown; - public bool IsWinKill; - - public override bool IsEnable => PlayerIdList.Count > 0; - - public override void SetupCustomOption() - { - Options.SetupRoleOptions(Id, TabGroup.NeutralRoles, CustomRoles.DarkHide); - - KillCooldown = new FloatOptionItem(Id + 10, "KillCooldown", new(0f, 180f, 0.5f), 30f, TabGroup.NeutralRoles) - .SetParent(Options.CustomRoleSpawnChances[CustomRoles.DarkHide]) - .SetValueFormat(OptionFormat.Seconds); - - CanVent = new BooleanOptionItem(Id + 14, "CanVent", true, TabGroup.NeutralRoles) - .SetParent(Options.CustomRoleSpawnChances[CustomRoles.DarkHide]); - - HasImpostorVision = new BooleanOptionItem(Id + 11, "ImpostorVision", true, TabGroup.NeutralRoles) - .SetParent(Options.CustomRoleSpawnChances[CustomRoles.DarkHide]); - - CanCountNeutralKiller = new BooleanOptionItem(Id + 12, "CanCountNeutralKiller", true, TabGroup.NeutralRoles) - .SetParent(Options.CustomRoleSpawnChances[CustomRoles.DarkHide]); - - SnatchesWin = new BooleanOptionItem(Id + 13, "SnatchesWin", false, TabGroup.NeutralRoles) - .SetParent(Options.CustomRoleSpawnChances[CustomRoles.DarkHide]); - } - - public override void Init() - { - PlayerIdList = []; - CurrentKillCooldown = KillCooldown.GetFloat(); - IsWinKill = false; - } - - public override void Add(byte playerId) - { - PlayerIdList.Add(playerId); - CurrentKillCooldown = KillCooldown.GetFloat(); - IsWinKill = false; - - DRpcSetKillCount(Utils.GetPlayerById(playerId)); - } - - public override void Remove(byte playerId) - { - PlayerIdList.Remove(playerId); - } - - public static void ReceiveRPC(MessageReader msg) - { - byte DarkHiderId = msg.ReadByte(); - if (Main.PlayerStates[DarkHiderId].Role is not DarkHide { IsEnable: true } dh) return; - - bool IsKillerKill = msg.ReadBoolean(); - dh.IsWinKill = IsKillerKill; - } - - private void DRpcSetKillCount(PlayerControl player, CustomRpcSender sender = null) - { - if (!IsEnable || !Utils.DoRPC || !AmongUsClient.Instance.AmHost) return; - - if (sender == null) - { - MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetDarkHiderKillCount, SendOption.Reliable); - writer.Write(player.PlayerId); - writer.Write(IsWinKill); - AmongUsClient.Instance.FinishRpcImmediately(writer); - } - else - { - sender.AutoStartRpc(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetDarkHiderKillCount); - sender.Write(player.PlayerId); - sender.Write(IsWinKill); - sender.EndRpc(); - } - } - - public override void SetKillCooldown(byte id) - { - Main.AllPlayerKillCooldown[id] = CurrentKillCooldown; - } - - public override bool CanUseKillButton(PlayerControl player) - { - return player.IsAlive(); - } - - public override bool CanUseImpostorVentButton(PlayerControl pc) - { - return CanVent.GetBool(); - } - - public override void ApplyGameOptions(IGameOptions opt, byte id) - { - opt.SetVision(HasImpostorVision.GetBool()); - } - - public override bool OnCheckMurder(PlayerControl killer, PlayerControl Ktarget) - { - CustomRoles targetRole = Ktarget.GetCustomRole(); - bool succeeded = targetRole.IsImpostor(); - if (CanCountNeutralKiller.GetBool()) succeeded |= Ktarget.IsNeutralKiller(); - - if (succeeded && SnatchesWin.GetBool()) IsWinKill = true; - - var sender = CustomRpcSender.Create("DarkHide.OnCheckMurder", SendOption.Reliable); - DRpcSetKillCount(killer, sender); - sender.AutoStartRpc(ShipStatus.Instance.NetId, RpcCalls.UpdateSystem, killer.OwnerId); - sender.Write((byte)SystemTypes.Electrical); - sender.WriteNetObject(killer); - sender.EndRpc(); - - foreach (PlayerControl target in Main.AllPlayerControls) - { - if (target.PlayerId == killer.PlayerId || target.Data.Disconnected) continue; - - sender.AutoStartRpc(ShipStatus.Instance.NetId, RpcCalls.UpdateSystem, target.OwnerId); - sender.Write((byte)SystemTypes.Electrical); - sender.WriteNetObject(target); - sender.EndRpc(); - } - - sender.SendMessage(); - return true; - } +using System.Collections.Generic; +using AmongUs.GameOptions; +using EHR.Modules; +using Hazel; + +namespace EHR.Neutral; + +// Credit: https://github.com/Yumenopai/TownOfHost_Y +public class Stalker : RoleBase +{ + private const int Id = 12900; + private static List PlayerIdList = []; + + private static OptionItem KillCooldown; + private static OptionItem HasImpostorVision; + private static OptionItem CanCountNeutralKiller; + private static OptionItem CanVent; + public static OptionItem SnatchesWin; + + private float CurrentKillCooldown = Options.AdjustedDefaultKillCooldown; + public bool IsWinKill; + + public override bool IsEnable => PlayerIdList.Count > 0; + + public override void SetupCustomOption() + { + Options.SetupRoleOptions(Id, TabGroup.NeutralRoles, CustomRoles.Stalker); + + KillCooldown = new FloatOptionItem(Id + 10, "KillCooldown", new(0f, 180f, 0.5f), 30f, TabGroup.NeutralRoles) + .SetParent(Options.CustomRoleSpawnChances[CustomRoles.Stalker]) + .SetValueFormat(OptionFormat.Seconds); + + CanVent = new BooleanOptionItem(Id + 14, "CanVent", true, TabGroup.NeutralRoles) + .SetParent(Options.CustomRoleSpawnChances[CustomRoles.Stalker]); + + HasImpostorVision = new BooleanOptionItem(Id + 11, "ImpostorVision", true, TabGroup.NeutralRoles) + .SetParent(Options.CustomRoleSpawnChances[CustomRoles.Stalker]); + + CanCountNeutralKiller = new BooleanOptionItem(Id + 12, "CanCountNeutralKiller", true, TabGroup.NeutralRoles) + .SetParent(Options.CustomRoleSpawnChances[CustomRoles.Stalker]); + + SnatchesWin = new BooleanOptionItem(Id + 13, "SnatchesWin", false, TabGroup.NeutralRoles) + .SetParent(Options.CustomRoleSpawnChances[CustomRoles.Stalker]); + } + + public override void Init() + { + PlayerIdList = []; + CurrentKillCooldown = KillCooldown.GetFloat(); + IsWinKill = false; + } + + public override void Add(byte playerId) + { + PlayerIdList.Add(playerId); + CurrentKillCooldown = KillCooldown.GetFloat(); + IsWinKill = false; + + DRpcSetKillCount(Utils.GetPlayerById(playerId)); + } + + public override void Remove(byte playerId) + { + PlayerIdList.Remove(playerId); + } + + public static void ReceiveRPC(MessageReader msg) + { + byte StalkerId = msg.ReadByte(); + if (Main.PlayerStates[StalkerId].Role is not Stalker { IsEnable: true } dh) return; + + bool IsKillerKill = msg.ReadBoolean(); + dh.IsWinKill = IsKillerKill; + } + + private void DRpcSetKillCount(PlayerControl player, CustomRpcSender sender = null) + { + if (!IsEnable || !Utils.DoRPC || !AmongUsClient.Instance.AmHost) return; + + if (sender == null) + { + MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetStalkerKillCount, SendOption.Reliable); + writer.Write(player.PlayerId); + writer.Write(IsWinKill); + AmongUsClient.Instance.FinishRpcImmediately(writer); + } + else + { + sender.AutoStartRpc(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.SetStalkerKillCount); + sender.Write(player.PlayerId); + sender.Write(IsWinKill); + sender.EndRpc(); + } + } + + public override void SetKillCooldown(byte id) + { + Main.AllPlayerKillCooldown[id] = CurrentKillCooldown; + } + + public override bool CanUseKillButton(PlayerControl player) + { + return player.IsAlive(); + } + + public override bool CanUseImpostorVentButton(PlayerControl pc) + { + return CanVent.GetBool(); + } + + public override void ApplyGameOptions(IGameOptions opt, byte id) + { + opt.SetVision(HasImpostorVision.GetBool()); + } + + public override bool OnCheckMurder(PlayerControl killer, PlayerControl Ktarget) + { + CustomRoles targetRole = Ktarget.GetCustomRole(); + bool succeeded = targetRole.IsImpostor(); + if (CanCountNeutralKiller.GetBool()) succeeded |= Ktarget.IsNeutralKiller(); + + if (succeeded && SnatchesWin.GetBool()) IsWinKill = true; + + var sender = CustomRpcSender.Create("Stalker.OnCheckMurder", SendOption.Reliable); + DRpcSetKillCount(killer, sender); + sender.AutoStartRpc(ShipStatus.Instance.NetId, RpcCalls.UpdateSystem, killer.OwnerId); + sender.Write((byte)SystemTypes.Electrical); + sender.WriteNetObject(killer); + sender.EndRpc(); + + foreach (PlayerControl target in Main.AllPlayerControls) + { + if (target.PlayerId == killer.PlayerId || target.Data.Disconnected) continue; + + sender.AutoStartRpc(ShipStatus.Instance.NetId, RpcCalls.UpdateSystem, target.OwnerId); + sender.Write((byte)SystemTypes.Electrical); + sender.WriteNetObject(target); + sender.EndRpc(); + } + + sender.SendMessage(); + return true; + } } \ No newline at end of file