From ea6d112519ae53e3788da2858b2a6cae95878f8a Mon Sep 17 00:00:00 2001 From: Gurge44 Date: Fri, 12 Jun 2026 13:00:55 +0200 Subject: [PATCH] comment out => dynamic disable --- Gamemodes/BedWars.cs | 2 +- Gamemodes/CaptureTheFlag.cs | 6 ++- Gamemodes/KingOfTheZones.cs | 17 ++++---- Gamemodes/TheMindGame.cs | 5 +-- Modules/AntiBlackout.cs | 2 +- Modules/Camouflage.cs | 1 + Modules/CustomRoleSelector.cs | 2 +- Modules/ExtendedPlayerControl.cs | 6 +-- .../PlayerGameOptionsSender.cs | 2 +- Modules/GhostRolesManager.cs | 1 + Modules/Utils.cs | 31 +++----------- Patches/ChatCommandPatch.cs | 4 +- Patches/CheckGameEndPatch.cs | 7 ++-- Patches/HudPatch.cs | 38 +++++++++++------ Patches/NotificationPopperPatch.cs | 2 +- Patches/PetActionsPatch.cs | 4 +- Patches/PlayerControlPatch.cs | 42 +++++++++---------- Roles/Standard/Crewmate/Miscellaneous/Tar.cs | 6 +-- Roles/Standard/Crewmate/Power/Astral.cs | 2 +- Roles/Standard/Ghost/Bloodmoon.cs | 1 + Roles/Standard/Ghost/GA.cs | 7 +++- Roles/Standard/Ghost/Minion.cs | 4 +- .../Impostor/Concealing/Exclusionary.cs | 13 +++--- Roles/Standard/Impostor/Killing/Trapster.cs | 1 + 24 files changed, 106 insertions(+), 100 deletions(-) diff --git a/Gamemodes/BedWars.cs b/Gamemodes/BedWars.cs index ca39427fc..17900b0f0 100644 --- a/Gamemodes/BedWars.cs +++ b/Gamemodes/BedWars.cs @@ -851,7 +851,7 @@ public static class BedWars NameNotifyManager.Notifies.Remove(pc.PlayerId); RPC.PlaySoundRPC(pc.PlayerId, Sounds.TaskComplete); pc.ReviveFromTemporaryExile(); - // pc.RpcSetColor(Team.GetColorId()); + if (GameStates.CurrentServerType != GameStates.ServerType.Vanilla) pc.RpcSetColor(Team.GetColorId()); pc.TP(Base.SpawnPosition); pc.SetChatVisible(true); Utils.NotifyRoles(SpecifyTarget: pc, SendOption: SendOption.None); diff --git a/Gamemodes/CaptureTheFlag.cs b/Gamemodes/CaptureTheFlag.cs index 4e696cf58..175fd273d 100644 --- a/Gamemodes/CaptureTheFlag.cs +++ b/Gamemodes/CaptureTheFlag.cs @@ -363,6 +363,8 @@ public static class CaptureTheFlag int blueCount = players.Count / 2; HashSet bluePlayers = []; HashSet yellowPlayers = []; + + bool vanillaServer = GameStates.CurrentServerType == GameStates.ServerType.Vanilla; for (var i = 0; i < blueCount; i++) { @@ -370,7 +372,7 @@ public static class CaptureTheFlag players.Remove(player); PlayerTeams[player.PlayerId] = CTFTeam.Blue; bluePlayers.Add(player.PlayerId); - // player.RpcSetColor(1); + if (!vanillaServer) player.RpcSetColor(1); yield return WaitFrameIfNecessary(); } @@ -378,7 +380,7 @@ public static class CaptureTheFlag { PlayerTeams[player.PlayerId] = CTFTeam.Yellow; yellowPlayers.Add(player.PlayerId); - // player.RpcSetColor(5); + if (!vanillaServer) player.RpcSetColor(5); yield return WaitFrameIfNecessary(); } diff --git a/Gamemodes/KingOfTheZones.cs b/Gamemodes/KingOfTheZones.cs index 1c8a60a4e..bcd9203bc 100644 --- a/Gamemodes/KingOfTheZones.cs +++ b/Gamemodes/KingOfTheZones.cs @@ -972,17 +972,20 @@ public static class KingOfTheZones yield return null; - /*foreach (PlayerControl player in Main.EnumerateAlivePlayerControls()) + if (GameStates.CurrentServerType != GameStates.ServerType.Vanilla) { - try + foreach (PlayerControl player in Main.EnumerateAlivePlayerControls()) { - byte colorId = PlayerTeams[player.PlayerId].GetColorId(); - if (player.CurrentOutfit.ColorId == colorId) continue; + try + { + byte colorId = PlayerTeams[player.PlayerId].GetColorId(); + if (player.CurrentOutfit.ColorId == colorId) continue; - player.RpcSetColor(colorId); + player.RpcSetColor(colorId); + } + catch (Exception e) { Utils.ThrowException(e); } } - catch (Exception e) { Utils.ThrowException(e); } - }*/ + } yield return null; diff --git a/Gamemodes/TheMindGame.cs b/Gamemodes/TheMindGame.cs index 497091ee1..03d3b91e0 100644 --- a/Gamemodes/TheMindGame.cs +++ b/Gamemodes/TheMindGame.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using EHR.Modules; using EHR.Roles; @@ -327,7 +328,6 @@ public static class TheMindGame foreach (PlayerControl pc in players) { Groups[pc.PlayerId] = group; - // pc.RpcSetColor(group.GetColorId()); pc.TP(location); ids.Add(pc.PlayerId); } @@ -402,8 +402,6 @@ public static class TheMindGame Round = 2; - // DefaultColorIds.DoIf(x => x.Key && x.Value is >= byte.MinValue and <= byte.MaxValue, x => x.Key.RpcSetColor((byte)x.Value)); - yield return NotifyEveryone("TMG.Notify.Round", 2, 2); if (Stop) yield break; @@ -997,6 +995,7 @@ public static class TheMindGame MindDetective } + [SuppressMessage("ReSharper", "UnusedMember.Local")] private enum Group { Red, diff --git a/Modules/AntiBlackout.cs b/Modules/AntiBlackout.cs index 587b42900..07047c73a 100644 --- a/Modules/AntiBlackout.cs +++ b/Modules/AntiBlackout.cs @@ -112,7 +112,7 @@ public static class AntiBlackout pc.RpcExiled(); if (GhostRolesManager.AssignedGhostRoles.TryGetValue(pc.PlayerId, out var ghostRole) && ghostRole.Instance.RoleTypes == RoleTypes.GuardianAngel) - pc.RpcResetAbilityCooldown(); + pc.AddAbilityCD(ghostRole.Instance.Cooldown); } } catch (Exception e) { Utils.ThrowException(e); } diff --git a/Modules/Camouflage.cs b/Modules/Camouflage.cs index 03fa61625..67ab40f60 100644 --- a/Modules/Camouflage.cs +++ b/Modules/Camouflage.cs @@ -159,6 +159,7 @@ public static class Camouflage public static void RpcSetSkin(PlayerControl target, bool forceRevert = false, bool revertToDefault = false, bool gameEnd = false, bool revive = false, bool notCommsOrCamo = false, CustomRpcSender sender = null) { + if (GameStates.CurrentServerType == GameStates.ServerType.Vanilla) return; if (!AmongUsClient.Instance.AmHost || (!Options.CommsCamouflage.GetBool() && !Camouflager.On && !revive && !notCommsOrCamo) || !target || (BlockCamouflage && !forceRevert && !revertToDefault && !gameEnd && !revive && !notCommsOrCamo)) return; Logger.Info($"New outfit for {target.GetNameWithRole()}", "Camouflage.RpcSetSkin"); diff --git a/Modules/CustomRoleSelector.cs b/Modules/CustomRoleSelector.cs index c4d1deb34..bd3536122 100644 --- a/Modules/CustomRoleSelector.cs +++ b/Modules/CustomRoleSelector.cs @@ -103,7 +103,7 @@ internal static class CustomRoleSelector switch (role) { - case CustomRoles.Camouflager or CustomRoles.Magistrate or CustomRoles.Devourer or CustomRoles.Venerer or CustomRoles.Amogus or CustomRoles.Shadow or CustomRoles.MoonDancer or CustomRoles.Merchant or CustomRoles.Catalyst or CustomRoles.Doppelganger when GameStates.CurrentServerType == GameStates.ServerType.Vanilla: + case CustomRoles.Camouflager or CustomRoles.Magistrate or CustomRoles.Devourer or CustomRoles.Venerer or CustomRoles.Amogus or CustomRoles.Shadow or CustomRoles.MoonDancer or CustomRoles.Merchant or CustomRoles.Catalyst or CustomRoles.Doppelganger or CustomRoles.Butcher when GameStates.CurrentServerType == GameStates.ServerType.Vanilla: case CustomRoles.Bargainer when Main.LIMap: case CustomRoles.AntiAdminer when Main.LIMap: case CustomRoles.CameraMan when Main.LIMap: diff --git a/Modules/ExtendedPlayerControl.cs b/Modules/ExtendedPlayerControl.cs index 0afc807a8..eb1013c3e 100644 --- a/Modules/ExtendedPlayerControl.cs +++ b/Modules/ExtendedPlayerControl.cs @@ -499,7 +499,7 @@ internal static class ExtendedPlayerControl if (Options.AnonymousBodies.GetBool() && Main.AllPlayerNames.TryGetValue(player.PlayerId, out string name)) RpcChangeSkin(player, new NetworkedPlayerInfo.PlayerOutfit().Set(name, 15, "", "", "", "", ""), sender); - // Camouflage.RpcSetSkin(player, sender: sender); + if (GameStates.CurrentServerType != GameStates.ServerType.Vanilla) Camouflage.RpcSetSkin(player, sender: sender); sender.SyncSettings(player); sender.SendMessage(); @@ -844,7 +844,7 @@ internal static class ExtendedPlayerControl public void AddKCDAsAbilityCD() { - player.AddAbilityCD((int)Math.Round(Main.AllPlayerKillCooldown.TryGetValue(player.PlayerId, out float kcd) ? kcd : Options.AdjustedDefaultKillCooldown)); + player.AddAbilityCD((int)Math.Round(Main.AllPlayerKillCooldown.GetValueOrDefault(player.PlayerId, Options.AdjustedDefaultKillCooldown))); } public void AddAbilityCD(bool includeDuration = true) @@ -1491,7 +1491,7 @@ internal static class ExtendedPlayerControl if (phantom && Options.CurrentGameMode != CustomGameMode.Standard) return; if (!Main.Invisible.Add(player.PlayerId)) return; - // player.RpcSetPet(""); + if (GameStates.CurrentServerType != GameStates.ServerType.Vanilla) player.RpcSetPet(""); if (!(phantom && PlayerControl.LocalPlayer.IsImpostor())) player.MakeInvisible(); diff --git a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs index c7858dc52..16b2a184b 100644 --- a/Modules/GameOptionsSender/PlayerGameOptionsSender.cs +++ b/Modules/GameOptionsSender/PlayerGameOptionsSender.cs @@ -471,7 +471,7 @@ public sealed class PlayerGameOptionsSender(PlayerControl player) : GameOptionsS { if (subRole.IsGhostRole()) { - AURoleOptions.GuardianAngelCooldown = subRole == CustomRoles.EvilSpirit ? Spiritcaller.SpiritAbilityCooldown.GetFloat() : GhostRolesManager.AssignedGhostRoles.Values.First(x => x.Role == subRole).Instance.Cooldown; + AURoleOptions.GuardianAngelCooldown = 5f; continue; } diff --git a/Modules/GhostRolesManager.cs b/Modules/GhostRolesManager.cs index 42b112ada..6167a02d6 100644 --- a/Modules/GhostRolesManager.cs +++ b/Modules/GhostRolesManager.cs @@ -32,6 +32,7 @@ internal static class GhostRolesManager IGhostRole instance = CreateGhostRoleInstance(suitableRole); pc.RpcSetCustomRole(suitableRole); pc.RpcSetRoleDesync(instance.RoleTypes, pc.OwnerId); + pc.AddAbilityCD(instance.Cooldown); instance.OnAssign(pc); Main.ResetCamPlayerList.Add(pc.PlayerId); AssignedGhostRoles[pc.PlayerId] = (suitableRole, instance); diff --git a/Modules/Utils.cs b/Modules/Utils.cs index 7e8a38382..2d10716db 100644 --- a/Modules/Utils.cs +++ b/Modules/Utils.cs @@ -2920,32 +2920,13 @@ public static class Utils SelfSuffix.Append(BuildSuffix(seer, seer, meeting: forMeeting)); - AppendSuffixIfNotEmpty(Spurt.GetSuffix(seer)); - AppendSuffixIfNotEmpty(Dynamo.GetSuffix(seer)); - AppendSuffixIfNotEmpty(CustomTeamManager.GetSuffix(seer)); - - static void AppendSuffixIfNotEmpty(string suffix) - { - if (string.IsNullOrEmpty(suffix)) return; - - bool hasNonWhite = false; - for (int i = 0; i < suffix.Length; i++) - { - if (!char.IsWhiteSpace(suffix[i])) - { - hasNonWhite = true; - break; - } - } - if (!hasNonWhite) return; - - SelfSuffix.Append('\n'); - SelfSuffix.Append(suffix); - } + AdditionalSuffixes.Add(Spurt.GetSuffix(seer)); + AdditionalSuffixes.Add(Dynamo.GetSuffix(seer)); + AdditionalSuffixes.Add(CustomTeamManager.GetSuffix(seer)); if (!forMeeting) { - if (Options.UsePets.GetBool() && Main.AbilityCD.TryGetValue(seer.PlayerId, out (long StartTimeStamp, int TotalCooldown) time)) + if (Main.AbilityCD.TryGetValue(seer.PlayerId, out (long StartTimeStamp, int TotalCooldown) time)) { long remainingCD = time.TotalCooldown - (now - time.StartTimeStamp) + 1; SelfSuffix.Append("\n" + string.Format(GetString("CDPT"), remainingCD > 30 ? "> 30" : remainingCD)); @@ -3042,7 +3023,7 @@ public static class Utils break; } - for (int i = 0; i < AdditionalSuffixes.Count; i++) + for (int i = AdditionalSuffixes.Count - 1; i >= 0; i--) { if (string.IsNullOrWhiteSpace(AdditionalSuffixes[i])) { @@ -4169,7 +4150,7 @@ public static class Utils { LateTask.New(() => { - if (GameStates.IsEnded) return; + if (GameStates.IsEnded || GameStates.CurrentServerType == GameStates.ServerType.Vanilla) return; string petId = PetsHelper.GetPetId(); PetsHelper.SetPet(pc, petId); pc.Data.DefaultOutfit.PetSequenceId += 10; diff --git a/Patches/ChatCommandPatch.cs b/Patches/ChatCommandPatch.cs index 8a5f24a88..68eb72f75 100644 --- a/Patches/ChatCommandPatch.cs +++ b/Patches/ChatCommandPatch.cs @@ -2055,7 +2055,7 @@ internal static class ChatCommands return; } - if (!player.IsHost() && !Options.PlayerCanSetColor.GetBool() && !IsPlayerVIP(player.FriendCode) && !player.FriendCode.GetDevUser().up) + if (GameStates.CurrentServerType == GameStates.ServerType.Vanilla || (!player.IsHost() && !Options.PlayerCanSetColor.GetBool() && !IsPlayerVIP(player.FriendCode) && !player.FriendCode.GetDevUser().up)) { Utils.SendMessage(GetString("DisableUseCommand"), player.PlayerId, importance: MessageImportance.Low); return; @@ -2070,7 +2070,7 @@ internal static class ChatCommands return; } - // player.RpcSetColor(color); + player.RpcSetColor(color); Utils.SendMessage(string.Format(GetString("Message.SetColor"), subArgs), player.PlayerId, importance: MessageImportance.Low); } diff --git a/Patches/CheckGameEndPatch.cs b/Patches/CheckGameEndPatch.cs index 62b7e2c16..1afed53b0 100644 --- a/Patches/CheckGameEndPatch.cs +++ b/Patches/CheckGameEndPatch.cs @@ -84,10 +84,9 @@ internal static class GameEndChecker Ended = true; LoadingEndScreen = true; - /*foreach (var pc in Main.CachedAllPlayerControls()) - { - Camouflage.RpcSetSkin(pc, true, true, true); - }*/ + if (GameStates.CurrentServerType != GameStates.ServerType.Vanilla) + foreach (var pc in Main.CachedAllPlayerControls()) + Camouflage.RpcSetSkin(pc, true, true, true); NameNotifyManager.Reset(); NotifyRoles(ForceLoop: true); diff --git a/Patches/HudPatch.cs b/Patches/HudPatch.cs index 0ef9ee3fd..63e118757 100644 --- a/Patches/HudPatch.cs +++ b/Patches/HudPatch.cs @@ -376,27 +376,21 @@ internal static class HudManagerPatch return string.Empty; } - string cdHUDText = !Options.UsePets.GetBool() || !Main.AbilityCD.TryGetValue(player.PlayerId, out (long StartTimeStamp, int TotalCooldown) CD) - ? string.Empty - : string.Format(GetString("CDPT"), CD.TotalCooldown - (Utils.TimeStamp - CD.StartTimeStamp) + 1); - - bool hasCD = cdHUDText != string.Empty; - - if (hasCD) + if (Main.AbilityCD.TryGetValue(player.PlayerId, out (long StartTimeStamp, int TotalCooldown) info)) { - if (CooldownTimerFlashColor.HasValue) cdHUDText = $"{Utils.ColorString(CooldownTimerFlashColor.Value, cdHUDText.RemoveHtmlTags())}"; - - LowerInfoText.text = $"{cdHUDText}\n{LowerInfoText.text}"; + string text = string.Format(GetString("CDPT"), info.TotalCooldown - (Utils.TimeStamp - info.StartTimeStamp) + 1); + if (CooldownTimerFlashColor.HasValue) text = $"{Utils.ColorString(CooldownTimerFlashColor.Value, text.RemoveHtmlTags())}"; + LowerInfoText.text = $"{text}\n{LowerInfoText.text}"; } - if (AchievementUnlockedText != string.Empty) + if (!string.IsNullOrWhiteSpace(AchievementUnlockedText)) { - LowerInfoText.text = LowerInfoText.text == string.Empty + LowerInfoText.text = string.IsNullOrWhiteSpace(LowerInfoText.text) ? AchievementUnlockedText : $"{AchievementUnlockedText}\n\n{LowerInfoText.text}\n\n\n\n"; } - LowerInfoText.enabled = hasCD || LowerInfoText.text != string.Empty; + LowerInfoText.enabled = !string.IsNullOrWhiteSpace(LowerInfoText.text); if ((!AmongUsClient.Instance.IsGameStarted && AmongUsClient.Instance.NetworkMode != NetworkModes.FreePlay) || GameStates.IsMeeting) LowerInfoText.enabled = false; @@ -462,6 +456,24 @@ internal static class HudManagerPatch __instance.AbilityButton?.Show(); __instance.AbilityButton?.SetEnabled(); __instance.AbilityButton?.OverrideText(GetString(player.GetRoleTypes() == RoleTypes.GuardianAngel ? StringNames.ProtectAbility : StringNames.HauntAbilityName)); + + LowerInfoText.text = string.Empty; + + if (Main.AbilityCD.TryGetValue(player.PlayerId, out (long StartTimeStamp, int TotalCooldown) info)) + { + string text = string.Format(GetString("CDPT"), info.TotalCooldown - (Utils.TimeStamp - info.StartTimeStamp) + 1); + if (CooldownTimerFlashColor.HasValue) text = $"{Utils.ColorString(CooldownTimerFlashColor.Value, text.RemoveHtmlTags())}"; + LowerInfoText.text = text; + } + + if (!string.IsNullOrWhiteSpace(AchievementUnlockedText)) + { + LowerInfoText.text = string.IsNullOrWhiteSpace(LowerInfoText.text) + ? AchievementUnlockedText + : $"{AchievementUnlockedText}\n\n{LowerInfoText.text}\n\n\n\n"; + } + + LowerInfoText.enabled = !string.IsNullOrWhiteSpace(LowerInfoText.text); } } diff --git a/Patches/NotificationPopperPatch.cs b/Patches/NotificationPopperPatch.cs index e2195cd6a..52a79fddc 100644 --- a/Patches/NotificationPopperPatch.cs +++ b/Patches/NotificationPopperPatch.cs @@ -61,7 +61,7 @@ internal static class NotificationPopperPatch private static void SendRpc(int optionId, bool playSound = true) { - if (!AmongUsClient.Instance.AmHost || Options.HideGameSettings.GetBool()) return; + if (!AmongUsClient.Instance.AmHost || Options.HideGameSettings.GetBool() || !Utils.DoRPC) return; var msg = AmongUsClient.Instance.StartRpcImmediately(PlayerControl.LocalPlayer.NetId, (byte)CustomRPC.NotificationPopper, Hazel.SendOption.None); msg.Write(optionId); msg.Write(playSound); diff --git a/Patches/PetActionsPatch.cs b/Patches/PetActionsPatch.cs index fc224ecb7..508da85f2 100644 --- a/Patches/PetActionsPatch.cs +++ b/Patches/PetActionsPatch.cs @@ -138,7 +138,7 @@ internal static class ExternalRpcPetPatch if (pc.HasAbilityCD()) { - if (!pc.IsHost()) pc.Notify(Translator.GetString("AbilityOnCooldown")); + if (!pc.AmOwner) pc.Notify(Translator.GetString("AbilityOnCooldown")); else Main.Instance.StartCoroutine(FlashCooldownTimer()); return; @@ -230,7 +230,7 @@ internal static class ExternalRpcPetPatch return target; } - private static IEnumerator FlashCooldownTimer() + public static IEnumerator FlashCooldownTimer() { var yellow = false; diff --git a/Patches/PlayerControlPatch.cs b/Patches/PlayerControlPatch.cs index ebfc79781..bb638718e 100644 --- a/Patches/PlayerControlPatch.cs +++ b/Patches/PlayerControlPatch.cs @@ -25,6 +25,14 @@ internal static class CheckProtectPatch Logger.Info($"CheckProtect: {__instance.GetNameWithRole().RemoveHtmlTags()} => {target.GetNameWithRole().RemoveHtmlTags()}", "CheckProtect"); + if (__instance.HasAbilityCD()) + { + if (!__instance.AmOwner) __instance.Notify(GetString("AbilityOnCooldown")); + else Main.Instance.StartCoroutine(ExternalRpcPetPatch.FlashCooldownTimer()); + + return true; + } + if (__instance.Is(CustomRoles.EvilSpirit)) { if (target.Is(CustomRoles.Spiritcaller)) @@ -32,24 +40,14 @@ internal static class CheckProtectPatch else Spiritcaller.HauntPlayer(target); - __instance.RpcResetAbilityCooldown(); + __instance.AddAbilityCD(Spiritcaller.SpiritAbilityCooldown.GetInt()); return true; } if (GhostRolesManager.AssignedGhostRoles.TryGetValue(__instance.PlayerId, out (CustomRoles Role, IGhostRole Instance) ghostRole)) { + __instance.AddAbilityCD(ghostRole.Instance.Cooldown); ghostRole.Instance.OnProtect(__instance, target); - __instance.RpcResetAbilityCooldown(); - return true; - } - - if (__instance.Is(CustomRoles.Sheriff)) - { - if (__instance.Data.IsDead) - { - Logger.Info("Blocked", "CheckProtect"); - return false; - } } return true; @@ -637,12 +635,6 @@ internal static class MurderPlayerPatch RandomSpawn.CustomNetworkTransformHandleRpcPatch.HasSpawned.Add(__instance.PlayerId); - /*if (!target.IsProtected() && !Doppelganger.DoppelVictim.ContainsKey(target.PlayerId) && !Camouflage.ResetSkinAfterDeathPlayers.Contains(target.PlayerId)) - { - Camouflage.ResetSkinAfterDeathPlayers.Add(target.PlayerId); - LateTask.New(() => Camouflage.RpcSetSkin(target, true), 0.2f, log: false); - }*/ - return true; } @@ -898,7 +890,11 @@ internal static class ShapeshiftPatch if (!AmongUsClient.Instance.AmHost) return true; - if (!shapeshifting) /*Camouflage.RpcSetSkin(shapeshifter);*/ {} + if (!shapeshifting) + { + if (GameStates.CurrentServerType != GameStates.ServerType.Vanilla) + Camouflage.RpcSetSkin(shapeshifter); + } else { PlagueBearer.CheckAndSpreadInfection(shapeshifter, target); @@ -1418,8 +1414,8 @@ internal static class ReportDeadBodyPatch { try { - /*if (Main.CheckShapeshift.ContainsKey(pc.PlayerId) && !Doppelganger.DoppelVictim.ContainsKey(pc.PlayerId)) - Camouflage.RpcSetSkin(pc, revertToDefault: true);*/ + if (GameStates.CurrentServerType != GameStates.ServerType.Vanilla && Main.CheckShapeshift.ContainsKey(pc.PlayerId) && !Doppelganger.DoppelVictim.ContainsKey(pc.PlayerId)) + Camouflage.RpcSetSkin(pc, revertToDefault: true); if (Main.CurrentMap == MapNames.Fungle && (pc.IsMushroomMixupActive() || IsActive(SystemTypes.MushroomMixupSabotage))) pc.FixMixedUpOutfit(); @@ -1796,7 +1792,7 @@ internal static class FixedUpdatePatch if (inTask && alive && !lowLoad) Asthmatic.OnFixedUpdate(); - if (!lowLoad && Options.UsePets.GetBool() && inTask && (!LastUpdate.TryGetValue(playerId, out long lastPetNotify) || lastPetNotify < now)) + if (!lowLoad && inTask && (!LastUpdate.TryGetValue(playerId, out long lastPetNotify) || lastPetNotify < now)) { if (Main.AbilityCD.TryGetValue(playerId, out (long StartTimeStamp, int TotalCooldown) timer)) { @@ -2144,7 +2140,7 @@ internal static class FixedUpdatePatch if (MeetingStates.FirstMeeting && Main.ShieldPlayer == target.FriendCode && !string.IsNullOrWhiteSpace(target.FriendCode) && !self && Options.CurrentGameMode is CustomGameMode.Standard or CustomGameMode.SoloPVP or CustomGameMode.FFA) AdditionalSuffixes.Add(GetString("DiedR1Warning")); - for (int i = 0; i < AdditionalSuffixes.Count; i++) + for (int i = AdditionalSuffixes.Count - 1; i >= 0; i--) { if (string.IsNullOrWhiteSpace(AdditionalSuffixes[i])) { diff --git a/Roles/Standard/Crewmate/Miscellaneous/Tar.cs b/Roles/Standard/Crewmate/Miscellaneous/Tar.cs index b0a56230d..476c09d98 100644 --- a/Roles/Standard/Crewmate/Miscellaneous/Tar.cs +++ b/Roles/Standard/Crewmate/Miscellaneous/Tar.cs @@ -52,7 +52,7 @@ public class Tar : RoleBase Main.AllPlayerSpeed[pc.PlayerId] = Main.MinSpeed; Main.PlayerStates[pc.PlayerId].IsBlackOut = true; - // pc.RpcSetColor(6); + if (GameStates.CurrentServerType != GameStates.ServerType.Vanilla) pc.RpcSetColor(6); pc.MarkDirtySettings(); Timer = new CountdownTimer(AbilityDuration.GetFloat(), () => @@ -61,7 +61,7 @@ public class Tar : RoleBase if (!pc || !pc.IsAlive()) return; Main.AllPlayerSpeed[pc.PlayerId] = Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod); Main.PlayerStates[pc.PlayerId].IsBlackOut = false; - // pc.RpcSetColor((byte)ColorId); + if (GameStates.CurrentServerType != GameStates.ServerType.Vanilla) pc.RpcSetColor((byte)ColorId); pc.MarkDirtySettings(); }, cancelOnMeeting: false, onCanceled: () => { @@ -93,7 +93,7 @@ public class Tar : RoleBase Timer = null; Main.AllPlayerSpeed[TarId] = Main.RealOptionsData.GetFloat(FloatOptionNames.PlayerSpeedMod); Main.PlayerStates[TarId].IsBlackOut = false; - // TarId.GetPlayer()?.RpcSetColor((byte)ColorId); + if (GameStates.CurrentServerType != GameStates.ServerType.Vanilla) TarId.GetPlayer()?.RpcSetColor((byte)ColorId); } } } \ No newline at end of file diff --git a/Roles/Standard/Crewmate/Power/Astral.cs b/Roles/Standard/Crewmate/Power/Astral.cs index fbd3abdab..388339415 100644 --- a/Roles/Standard/Crewmate/Power/Astral.cs +++ b/Roles/Standard/Crewmate/Power/Astral.cs @@ -89,7 +89,7 @@ public class Astral : RoleBase GhostRolesManager.RemoveGhostRole(pc.PlayerId); ReportDeadBodyPatch.AlreadyReportedBodies.Remove(pc.PlayerId); pc.RpcSetRoleGlobal(Options.UsePets.GetBool() ? RoleTypes.Crewmate : RoleTypes.Engineer); - // Camouflage.RpcSetSkin(pc); + if (GameStates.CurrentServerType != GameStates.ServerType.Vanilla) Camouflage.RpcSetSkin(pc); if (onMeeting) return; diff --git a/Roles/Standard/Ghost/Bloodmoon.cs b/Roles/Standard/Ghost/Bloodmoon.cs index 7093d6cc3..0034a7854 100644 --- a/Roles/Standard/Ghost/Bloodmoon.cs +++ b/Roles/Standard/Ghost/Bloodmoon.cs @@ -34,6 +34,7 @@ internal class Bloodmoon : IGhostRole ScheduledDeaths.TryAdd(target.PlayerId, (Utils.TimeStamp, pc.PlayerId)); Main.AllPlayerSpeed[pc.PlayerId] = Speed.GetFloat(); pc.MarkDirtySettings(); // failsafe check + pc.AddAbilityCD(Cooldown + Duration.GetInt()); } public void SetupCustomOption() diff --git a/Roles/Standard/Ghost/GA.cs b/Roles/Standard/Ghost/GA.cs index 41f8a9b8b..fda4ae80f 100644 --- a/Roles/Standard/Ghost/GA.cs +++ b/Roles/Standard/Ghost/GA.cs @@ -16,7 +16,12 @@ internal class GA : IGhostRole public void OnProtect(PlayerControl pc, PlayerControl target) { - if (ProtectionList.Add(target.PlayerId)) LateTask.New(() => ProtectionList.Remove(target.PlayerId), ProtectDuration.GetFloat()); + if (ProtectionList.Add(target.PlayerId)) + { + int duration = ProtectDuration.GetInt(); + LateTask.New(() => ProtectionList.Remove(target.PlayerId), duration); + pc.AddAbilityCD(Cooldown + duration); + } } public void OnAssign(PlayerControl pc) diff --git a/Roles/Standard/Ghost/Minion.cs b/Roles/Standard/Ghost/Minion.cs index 422d575dc..8307d8aad 100644 --- a/Roles/Standard/Ghost/Minion.cs +++ b/Roles/Standard/Ghost/Minion.cs @@ -22,11 +22,13 @@ internal class Minion : IGhostRole target.RPCPlayCustomSound("FlashBang"); target.MarkDirtySettings(); + int duration = BlindDuration.GetInt(); LateTask.New(() => { if (BlindPlayers.Remove(target.PlayerId)) target.MarkDirtySettings(); RPC.PlaySoundRPC(target.PlayerId, Sounds.TaskComplete); - }, BlindDuration.GetFloat(), "Remove Minion Blindness"); + }, duration, "Remove Minion Blindness"); + pc.AddAbilityCD(Cooldown + duration); } public void OnAssign(PlayerControl pc) { } diff --git a/Roles/Standard/Impostor/Concealing/Exclusionary.cs b/Roles/Standard/Impostor/Concealing/Exclusionary.cs index 9acd60f2d..ff2b93d8c 100644 --- a/Roles/Standard/Impostor/Concealing/Exclusionary.cs +++ b/Roles/Standard/Impostor/Concealing/Exclusionary.cs @@ -87,10 +87,13 @@ public class Exclusionary : RoleBase sender.StartMessage(target.OwnerId); } - /*sender.StartRpc(player.NetId, RpcCalls.SetPetStr) - .Write("") - .Write(player.GetNextRpcSequenceId(RpcCalls.SetPetStr)) - .EndRpc();*/ + if (GameStates.CurrentServerType != GameStates.ServerType.Vanilla) + { + sender.StartRpc(player.NetId, RpcCalls.SetPetStr) + .Write("") + .Write(player.GetNextRpcSequenceId(RpcCalls.SetPetStr)) + .EndRpc(); + } sender.StartRpc(player.NetTransform.NetId, RpcCalls.SnapTo) .WriteVector2(new Vector2(50f, 50f)) .Write(player.NetTransform.lastSequenceId) @@ -188,7 +191,7 @@ public class Exclusionary : RoleBase sender.StartMessage(pc.OwnerId); } - if (Options.UsePets.GetBool()) + if (Options.UsePets.GetBool() && GameStates.CurrentServerType != GameStates.ServerType.Vanilla) { sender.StartRpc(player.NetId, RpcCalls.SetPetStr) .Write(PetsHelper.GetPetId()) diff --git a/Roles/Standard/Impostor/Killing/Trapster.cs b/Roles/Standard/Impostor/Killing/Trapster.cs index 56b431e5d..8b24739d8 100644 --- a/Roles/Standard/Impostor/Killing/Trapster.cs +++ b/Roles/Standard/Impostor/Killing/Trapster.cs @@ -45,6 +45,7 @@ internal class Trapster : RoleBase public override void Add(byte playerId) { On = true; + if (GameStates.CurrentServerType == GameStates.ServerType.Vanilla) LegacyTrapster.SetValue(1); } public override void Init()