From a9813a5b80dbf79ef8a54dd0fe1149470d546d90 Mon Sep 17 00:00:00 2001 From: Gurge44 Date: Mon, 7 Jul 2025 16:14:56 +0200 Subject: [PATCH] Banana Man --- CustomRoles.cs | 1 + Main.cs | 1 + Modules/Camouflague.cs | 4 ++++ Modules/CustomRolesHelper.cs | 1 + Modules/GuessManager.cs | 1 + Modules/Utils.cs | 9 +++++++++ Patches/OnGameStartedPatch.cs | 5 ++++- Patches/PlayerControlPatch.cs | 3 +++ Resources/Lang/en_US.json | 4 ++++ Roles/AddOns/Common/BananaMan.cs | 16 ++++++++++++++++ 10 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 Roles/AddOns/Common/BananaMan.cs diff --git a/CustomRoles.cs b/CustomRoles.cs index 90d7e1477..ecaed4d31 100644 --- a/CustomRoles.cs +++ b/CustomRoles.cs @@ -459,6 +459,7 @@ public enum CustomRoles Autopsy, Avanger, Bait, + BananaMan, Trapper, // Beartrap Bewilder, Blind, diff --git a/Main.cs b/Main.cs index 91a9f7334..ff173c473 100644 --- a/Main.cs +++ b/Main.cs @@ -619,6 +619,7 @@ public class Main : BasePlugin { CustomRoles.Messenger, "#28b573" }, { CustomRoles.Dynamo, "#ebe534" }, { CustomRoles.AntiTP, "#fcba03" }, + { CustomRoles.BananaMan, "#ffe135" }, { CustomRoles.Blind, "#666666" }, { CustomRoles.Shy, "#9582f5" }, { CustomRoles.Blocked, "#B7A627" }, diff --git a/Modules/Camouflague.cs b/Modules/Camouflague.cs index 428368a2e..20323de84 100644 --- a/Modules/Camouflague.cs +++ b/Modules/Camouflague.cs @@ -1,6 +1,7 @@ using System.Collections; using System.Collections.Generic; using AmongUs.Data; +using EHR.AddOns.Common; using EHR.Impostor; using EHR.Modules; using EHR.Neutral; @@ -183,6 +184,9 @@ public static class Camouflage } } + if (target.Is(CustomRoles.BananaMan)) + newOutfit = BananaMan.GetOutfit(Main.AllPlayerNames.GetValueOrDefault(target.PlayerId, "Banana")); + SetPetForOutfitIfNecessary(newOutfit); if (Options.RemovePetsAtDeadPlayers.GetBool() && !target.IsAlive()) diff --git a/Modules/CustomRolesHelper.cs b/Modules/CustomRolesHelper.cs index 5c2b11dd9..f2f41219f 100644 --- a/Modules/CustomRolesHelper.cs +++ b/Modules/CustomRolesHelper.cs @@ -1033,6 +1033,7 @@ internal static class CustomRolesHelper CustomRoles.Oblivious when pc.Is(CustomRoles.Altruist) => false, CustomRoles.AntiTP when pc.GetCustomRole() is CustomRoles.Transmitter or CustomRoles.Miner or CustomRoles.Escapee or CustomRoles.Tunneler => false, CustomRoles.Swift when pc.Is(CustomRoles.Stealth) => false, + CustomRoles.BananaMan when pc.Is(CustomRoles.Disco) => false, CustomRoles.Disco when pc.GetCustomRole() is CustomRoles.Chameleon or CustomRoles.Swooper or CustomRoles.Wraith or CustomRoles.Alchemist => false, CustomRoles.Egoist when pc.Is(CustomRoles.Gangster) => false, CustomRoles.Nimble when pc.Is(CustomRoles.Oxyman) => false, diff --git a/Modules/GuessManager.cs b/Modules/GuessManager.cs index a6899d14f..854985cbf 100644 --- a/Modules/GuessManager.cs +++ b/Modules/GuessManager.cs @@ -318,6 +318,7 @@ public static class GuessManager case CustomRoles.Disco: case CustomRoles.Glow: case CustomRoles.LastImpostor: + case CustomRoles.BananaMan: ShowMessage("GuessObviousAddon"); return true; case CustomRoles.GM: diff --git a/Modules/Utils.cs b/Modules/Utils.cs index 085eedbd8..5eee2aead 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -2559,6 +2559,9 @@ public static class Utils string seerRealName = seer.GetRealName(forMeeting); + if (seer.Is(CustomRoles.BananaMan)) + seerRealName = seerRealName.Insert(0, $"{GetString("Prefix.BananaMan")} "); + if (!GameStates.IsLobby) { if ((Options.CurrentGameMode == CustomGameMode.FFA && FreeForAll.FFATeamMode.GetBool()) || Options.CurrentGameMode == CustomGameMode.HotPotato) @@ -2803,6 +2806,9 @@ public static class Utils string targetPlayerName = target.GetRealName(forMeeting); + if (target.Is(CustomRoles.BananaMan)) + targetPlayerName = targetPlayerName.Insert(0, $"{GetString("Prefix.BananaMan")} "); + if (GameStates.IsLobby) goto End; if (Options.CurrentGameMode != CustomGameMode.Standard) goto BeforeEnd; @@ -2989,6 +2995,9 @@ public static class Utils public static bool RpcChangeSkin(PlayerControl pc, NetworkedPlayerInfo.PlayerOutfit newOutfit, CustomRpcSender writer = null, SendOption sendOption = SendOption.Reliable) { + if (pc.Is(CustomRoles.BananaMan)) + newOutfit = BananaMan.GetOutfit(Main.AllPlayerNames.GetValueOrDefault(pc.PlayerId, "Banana")); + if (newOutfit.Compare(pc.Data.DefaultOutfit)) return false; Camouflage.SetPetForOutfitIfNecessary(newOutfit); diff --git a/Patches/OnGameStartedPatch.cs b/Patches/OnGameStartedPatch.cs index d88c7487f..e530c1152 100644 --- a/Patches/OnGameStartedPatch.cs +++ b/Patches/OnGameStartedPatch.cs @@ -864,6 +864,9 @@ internal static class StartGameHostPatch if (!state.MainRole.IsImpostor() && !(state.MainRole == CustomRoles.Traitor && Traitor.CanGetImpostorOnlyAddons.GetBool())) state.SubRoles.RemoveAll(x => x.IsImpOnlyAddon()); + + if (state.SubRoles.Contains(CustomRoles.BananaMan)) + Utils.RpcChangeSkin(state.Player, new()); } foreach (KeyValuePair pair in Main.PlayerStates) @@ -1046,7 +1049,7 @@ internal static class StartGameHostPatch } LoadingBarManager loadingBarManager = FastDestroyableSingleton.Instance; - yield return loadingBarManager.WaitAndSmoothlyUpdate(90f, 100f, 2f, GetString("LoadingBarText.1")); + yield return loadingBarManager.WaitAndSmoothlyUpdate(90f, 100f, 1f, GetString("LoadingBarText.1")); loadingBarManager.ToggleLoadingBar(false); Main.AllPlayerControls.Do(SetRoleSelf); diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index 7bd2600b5..8a1cf4050 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -1672,6 +1672,9 @@ internal static class FixedUpdatePatch string realName = target.GetRealName(); + if (target.Is(CustomRoles.BananaMan)) + realName = realName.Insert(0, $"{GetString("Prefix.BananaMan")} "); + if (target.AmOwner && inTask) { if (target.Is(CustomRoles.Arsonist) && target.IsDouseDone()) diff --git a/Resources/Lang/en_US.json b/Resources/Lang/en_US.json index e39445a4a..16a80d407 100644 --- a/Resources/Lang/en_US.json +++ b/Resources/Lang/en_US.json @@ -4682,6 +4682,10 @@ "JournalistError.IndexOutOfRange": "You didn't provide enough arguments.", "JournalistError.ArgumentOutOfRange": "The index you provided is out of range. Use /note view to see the indexes of your notes.", "JournalistError.Unknown": "An unknown error occurred.", + "BananaMan": "Banana Man", + "BananaManInfo": "You're the Banana Man", + "BananaManInfoLong": "(Add-ons):\\nAs the Banana Man, you are a banana.", + "Prefix.BananaMan": "Banana", "Grappler": "Grappler", "GrapplerInfo": "Prevent kills and pull players towards you", "GrapplerInfoLong": "(Crewmates):\\nAs the Grappler, you can prevent 1 kill in each round if you have an ability use left at the end of the last round. The first kill attempt will be blocked and the target will be teleported to you and not die. Your ability doesn't work during sabotages.", diff --git a/Roles/AddOns/Common/BananaMan.cs b/Roles/AddOns/Common/BananaMan.cs new file mode 100644 index 000000000..0c1af38ee --- /dev/null +++ b/Roles/AddOns/Common/BananaMan.cs @@ -0,0 +1,16 @@ +namespace EHR.AddOns.Common; + +public class BananaMan : IAddon +{ + public AddonTypes Type => AddonTypes.Mixed; + + public void SetupCustomOption() + { + Options.SetupAdtRoleOptions(652700, CustomRoles.BananaMan, canSetNum: true, teamSpawnOptions: true); + } + + public static NetworkedPlayerInfo.PlayerOutfit GetOutfit(string name) + { + return new NetworkedPlayerInfo.PlayerOutfit().Set(name, 14, "hat_pk04_Banana", "", "", "", "nameplate_shh"); + } +} \ No newline at end of file