public static bool Prefix() { if (!Cleaner.GameMode.Enabled) { return(true); } if (Cleaner.GameMode.AllRolePlayers.Where(x => x.AmRolePlayer).Count() == 0) { return(true); } #region ----- Check Cooldown ----- if (Cleaner.GameMode.CleanStopwatch.Elapsed.TotalSeconds < Cleaner.GameMode.CleanCooldown) { return(false); } #endregion if (TargetId != byte.MaxValue) { Cleaner.GameMode.removeBody(TargetId); RpcManager.SendRpc(Cleaner.CleanerRpc, new byte[] { (byte)CleanerGameMode.CustomRpc.CleanBody, TargetId }); Cleaner.GameMode.CleanStopwatch.Restart(); TargetId = byte.MaxValue; } return(false); }
public override void OnSetInfected() { base.OnSetInfected(); if (NumJesters == 0 || !CheepsAmongUsMod.CheepsAmongUsMod.IsDecidingClient) { return; } var available = PlayerController.AllPlayerControls.Where(x => !x.PlayerData.IsImpostor && !RoleManager.HasPlayerAnyRole(x)).ToList(); for (int i = 0; i < NumJesters; i++) { if (available.Count > 0) { var player = available[Random.Next(available.Count)]; if (RoleManager.HasPlayerAnyRole(player)) { i--; continue; } available.Remove(player); RpcManager.SendRpc(TheJester.JesterRpc, new byte[] { (byte)TheJester.CustomRpc.SetJester, player.PlayerId }); setJester(player); } } }
public static bool Prefix() { var local = PlayerController.LocalPlayer; if (!BattleRoyale.GameMode.IsInGame || Target == null || (Functions.GetUnixTime() - BattleRoyale.GameMode.LastKilled < GameOptions.KillCooldown && BattleRoyale.GameMode.LastKilled != 0) || local.PlayerData.IsDead) { return(true); } var target = Target; BattleRoyale.GameMode.LastKilled = Functions.GetUnixTime(); #region ---------- Write Kill ---------- if (CheepsAmongUsMod.CheepsAmongUsMod.IsDecidingClient) { var killer = PlayerController.LocalPlayer; if (!killer.PlayerData.IsDead && !target.PlayerData.IsDead && CheepsAmongUsMod.CheepsAmongUsMod.IsDecidingClient) { RpcManager.SendRpc(BattleRoyale.BattleRoyalRpc, new byte[] { (byte)BattleRoyale.CustomRpcCalls.MurderPlayer, killer.PlayerId, target.PlayerId }); killer.PlayerControl.MurderPlayer(target.PlayerControl); target.PlayerData.IsDead = true; } } else { RpcManager.SendRpc(BattleRoyale.BattleRoyalRpc, new byte[] { (byte)BattleRoyale.CustomRpcCalls.KillPlayer, PlayerController.LocalPlayer.PlayerId, Target.PlayerId }); } #endregion return(false); }
private void sync() { RpcManager.SendRpc(Cleaner.CleanerRpc, new byte[] { (byte)CustomRpc.UpdateSettings, Convert.ToByte(Enabled) }); var writer = RpcManager.StartRpc(Cleaner.CleanerRpc); writer.Write((byte)CustomRpc.UpdateCooldown); writer.Write(CleanCooldown); writer.EndMessage(); }
public static void Prefix(PlayerControl __instance) { if (TheJester.GameMode.NumJesters == 0) { return; } if (TheJester.GameMode.AllRolePlayers.Where(x => x.PlayerController.Equals(new PlayerController(__instance))).Count() == 0) { return; } TheJester.GameMode.JesterWon(); RpcManager.SendRpc(TheJester.JesterRpc, (byte)TheJester.CustomRpc.JesterExiled); }
public override void OnSetInfected() { base.OnSetInfected(); if (PlayerController.AllPlayerControls.Where(x => x.PlayerData.IsImpostor).Count() < 2) { return; } var available = PlayerController.AllPlayerControls.Where(x => x.PlayerData.IsImpostor && !RoleManager.HasPlayerAnyRole(x)).ToList(); var ctrl = available[RoleGameModeManager.Random.Next(available.Count)]; setCleaner(ctrl); RpcManager.SendRpc(Cleaner.CleanerRpc, new byte[] { (byte)CustomRpc.SetCleaner, ctrl.PlayerId }); }
public override void Loop() { base.Loop(); GameModeSettingsAddition = $"\nTeleportation Delay: {Functions.ColorPurple}{TeleportationDelay}s[]"; if (!IsInGame) { return; } string toDisplay = "----- [7a31f7ff]Teleportation[] -----\n"; toDisplay += $"Teleportation in [11c5edff]{ TeleportationDelay - (Functions.GetUnixTime() - LastTeleported) }s[]"; if (TeleportationDelay - (Functions.GetUnixTime() - LastTeleported) <= 0 && LastTeleported != 0) { LastTeleported = Functions.GetUnixTime(); if (MapLocations.ContainsKey(GameOptions.Map) && CheepsAmongUsMod.CheepsAmongUsMod.IsDecidingClient) { Teleport(); RpcManager.SendRpc(Teleportation.TeleportationRpc, 1); } } string curText = PlayerHudManager.TaskText; if (!curText.Contains(Delimiter)) { PlayerHudManager.TaskText = toDisplay + Delimiter + PlayerHudManager.TaskText; } else if (!curText.Contains(toDisplay)) { string toReplace = curText.Split(new string[] { Delimiter }, StringSplitOptions.None)[0]; PlayerHudManager.TaskText = curText.Replace(toReplace, toDisplay); } }
public override void OnSetInfected() { base.OnSetInfected(); if (NumJesters == 0) { return; } var available = PlayerController.AllPlayerControls.Where(x => !x.PlayerData.IsImpostor && !RoleManager.HasPlayerAnyRole(x)).ToList(); for (int i = 0; i < NumJesters; i++) { if (available.Count > 0) { var player = available[Random.Next(available.Count)]; if (RoleManager.HasPlayerAnyRole(player)) { i--; continue; } if (Patching.Patch_PlayerControl_RpcSendChat.ForceJester && !PlayerController.LocalPlayer.PlayerData.IsImpostor) { Patching.Patch_PlayerControl_RpcSendChat.ForceJester = false; if (available.Where(x => x.PlayerId == PlayerController.LocalPlayer.PlayerId).Count() >= 0 && !RoleManager.HasPlayerAnyRole(player)) { player = PlayerController.LocalPlayer; } } available.Remove(player); RpcManager.SendRpc(TheJester.JesterRpc, new byte[] { (byte)TheJester.CustomRpc.SetJester, player.PlayerId }); setJester(player); } } }
public override void SyncSettings() { RpcManager.SendRpc(BattleRoyale.BattleRoyalRpc, new byte[] { (byte)BattleRoyale.CustomRpcCalls.UpdateRandomStartLocation, Convert.ToByte(RandomStartLocation) }); base.SyncSettings(); }
public override void Loop() { base.Loop(); GameModeSettingsAddition = $"\nRandom Start Location: {Functions.ColorPurple}{(RandomStartLocation ? "On" : "Off")}"; if (!IsInGame) { return; } #region ----- Display new task text ----- string ToDisplay = "----- [ff7b00ff]Battle Royale[] -----\n" + "Be the last man standing!\n" + "\n" + $"Players left: { PlayerController.AllPlayerControls.Where(x => !x.PlayerData.IsDead).Count() }/{ MaxPlayerCount }"; PlayerHudManager.TaskText = ToDisplay + "\n--------------------"; // Current text #endregion #region ----- Display Kill Button ----- PlayerHudManager.HudManager.KillButton.gameObject.SetActive(!PlayerController.LocalPlayer.PlayerData.IsDead); // Activate Kill Button PlayerHudManager.HudManager.KillButton.isActive = !PlayerController.LocalPlayer.PlayerData.IsDead; // Activate Kill Button PlayerHudManager.HudManager.KillButton.transform.position = PlayerHudManager.HudManager.UseButton.transform.position; // Move the Kill Button PlayerHudManager.HudManager.ReportButton.enabled = false; // Disable report button PlayerHudManager.HudManager.ReportButton.gameObject.SetActive(false); // Disable report button PlayerHudManager.HudManager.ReportButton.renderer.color = new Color(1, 1, 1, 0); // Hide report button PlayerHudManager.HudManager.UseButton.enabled = false; // Disable use button PlayerHudManager.HudManager.UseButton.gameObject.SetActive(false); // Disable use button PlayerHudManager.HudManager.UseButton.UseButton.color = new Color(1, 1, 1, 0); // Hide use button #region --- Update Cooldown --- if (GameOptions.KillCooldown - (Functions.GetUnixTime() - LastKilled) <= 0) { LastKilled = 0; } if (LastKilled != 0) { PlayerHudManager.HudManager.KillButton.SetCoolDown(GameOptions.KillCooldown - (Functions.GetUnixTime() - LastKilled), GameOptions.KillCooldown); } else { PlayerHudManager.HudManager.KillButton.SetCoolDown(0, GameOptions.KillCooldown); } #endregion #region ----- End Game If Required ----- if (PlayerController.AllPlayerControls.Where(x => !x.PlayerData.IsDead).Count() == 1 && Started) { Started = false; if (!CheepsAmongUsMod.CheepsAmongUsMod.IsDecidingClient) { return; } Task.Run(async() => { await Task.Delay(2500); Patching.PatchFinishEndGame.CanEndGame = true; ShipStatusClass.PLBGOMIEONF(GameEndReason.ImpostorByKill, false); }); var winner = PlayerController.AllPlayerControls.Where(x => !x.PlayerData.IsDead).First(); winner.PlayerData.IsImpostor = true; RolePlayer MyRole = new RolePlayer(PlayerController.LocalPlayer, "Default"); MyRole.RoleOutro.UseRoleOutro = true; MyRole.RoleOutro.UseRoleOutro = true; if (winner.IsLocalPlayer) { MyRole.RoleOutro.WinText = "Victory Royale"; MyRole.RoleOutro.WinTextColor = new Color(255 / 255f, 174 / 255f, 0 / 255f); MyRole.RoleOutro.BackgroundColor = new Color(1f, 0.8f, 0f); } else { MyRole.RoleOutro.WinText = winner.PlayerData.PlayerName; MyRole.RoleOutro.WinTextColor = new Color(255 / 255f, 174 / 255f, 0 / 255f); MyRole.RoleOutro.BackgroundColor = new Color(1f, 0f, 0f); } RpcManager.SendRpc(BattleRoyale.BattleRoyalRpc, new byte[] { (byte)BattleRoyale.CustomRpcCalls.SetWinner, winner.PlayerId }); } #endregion if (!Started) { return; } #region ----- Get Closest Player ----- IEnumerable <PlayerController> AvailablePlayers = PlayerController.AllPlayerControls.Where(x => !x.PlayerData.IsDead && !x.IsLocalPlayer); PlayerController closest = AvailablePlayers.ToList()[0]; foreach (var player in AvailablePlayers) { float DistOld = Vector2.Distance(closest.Position, PlayerController.LocalPlayer.Position); float DistNew = Vector2.Distance(player.Position, PlayerController.LocalPlayer.Position); if (DistNew < DistOld) { closest = player; } } #endregion #region --- Update Target --- if (Vector2.Distance(closest.Position, PlayerController.LocalPlayer.Position) <= KillDistance) { PlayerHudManager.HudManager.KillButton.SetTarget(closest.PlayerControl); PlayerHudManager.HudManager.KillButton.CurrentTarget = closest.PlayerControl; Patching.PatchPerformKill.Target = closest; } else { Patching.PatchPerformKill.Target = null; } #endregion #endregion }
private void BattleRoyaleGameMode_ValueChanged(object sender, CustomToggleOption.CustomToggleOptionEventArgs e) { RandomStartLocation = e.ToggleOption.Value; RpcManager.SendRpc(BattleRoyale.BattleRoyalRpc, new byte[] { (byte)BattleRoyale.CustomRpcCalls.UpdateRandomStartLocation, Convert.ToByte(RandomStartLocation) }); }
private void RpcManager_RpcReceived(object sender, RpcEventArgs e) { if (e.Command != BattleRoyale.BattleRoyalRpc) { return; } var command = e.MessageReader.ReadByte(); switch (command) { case (byte)BattleRoyale.CustomRpcCalls.UpdateRandomStartLocation: { RandomStartLocation = Convert.ToBoolean(e.MessageReader.ReadByte()); break; } case (byte)BattleRoyale.CustomRpcCalls.SendStartLocation: { var playerId = e.MessageReader.ReadByte(); float x = e.MessageReader.ReadSingle(); float y = e.MessageReader.ReadSingle(); var loc = new Vector2(x, y); var player = PlayerController.FromPlayerId(playerId); if (player.IsLocalPlayer) { player.RpcSnapTo(loc); } break; } case (byte)BattleRoyale.CustomRpcCalls.SetWinner: { var winner = PlayerController.FromPlayerId(e.MessageReader.ReadByte()); RolePlayer MyRole = new RolePlayer(PlayerController.LocalPlayer, "Default"); MyRole.RoleOutro.UseRoleOutro = true; if (winner.IsLocalPlayer) { MyRole.RoleOutro.WinText = "Victory Royale"; MyRole.RoleOutro.WinTextColor = new Color(255 / 255f, 174 / 255f, 0 / 255f); MyRole.RoleOutro.BackgroundColor = new Color(1f, 0.8f, 0f); } else { MyRole.RoleOutro.WinText = winner.PlayerData.PlayerName; MyRole.RoleOutro.WinTextColor = new Color(255 / 255f, 174 / 255f, 0 / 255f); MyRole.RoleOutro.BackgroundColor = new Color(1f, 0f, 0f); } winner.PlayerData.IsImpostor = true; break; } case (byte)BattleRoyale.CustomRpcCalls.KillPlayer: { var killer = PlayerController.FromPlayerId(e.MessageReader.ReadByte()); var target = PlayerController.FromPlayerId(e.MessageReader.ReadByte()); if (!killer.PlayerData.IsDead && !target.PlayerData.IsDead && CheepsAmongUsMod.CheepsAmongUsMod.IsDecidingClient) { RpcManager.SendRpc(BattleRoyale.BattleRoyalRpc, new byte[] { (byte)BattleRoyale.CustomRpcCalls.MurderPlayer, killer.PlayerId, target.PlayerId }); killer.PlayerControl.MurderPlayer(target.PlayerControl); target.PlayerData.IsDead = true; } break; } case (byte)BattleRoyale.CustomRpcCalls.MurderPlayer: { var killer = PlayerController.FromPlayerId(e.MessageReader.ReadByte()); var target = PlayerController.FromPlayerId(e.MessageReader.ReadByte()); killer.PlayerControl.MurderPlayer(target.PlayerControl); target.PlayerData.IsDead = true; break; } } }
public override void Loop() { base.Loop(); GameModeSettingsAddition = $"\nAbility Active Period: {Functions.ColorPurple}{OnTime}s[]\n" + $"Ability Cooldown: {Functions.ColorPurple}{UseCooldown}s[]"; if (!IsInGame) { return; } if (!PlayerController.LocalPlayer.PlayerData.IsImpostor) { return; } if (EnableDisableCollision == null) { EnableDisableCollision = new CustomButton(ButtonOffsetX, ButtonOffsetY, Functions.LoadSpriteFromAssemblyResource(Assembly.GetExecutingAssembly(), "QuantumTunnelingGameMode.Assets.collision.png")); } if (CollisionTextRenderer == null) { CollisionTextRenderer = new CustomText(TextOffsetX, TextOffsetY, $"{UseCooldown}"); CollisionTextRenderer.TextRenderer.scale = 2; CollisionTextRenderer.TextRenderer.Centered = true; CollisionTextRenderer.SetActive(false); } if (PlayerController.LocalPlayer.PlayerData.IsDead) { if (CollisionTextRenderer.Active) { CollisionTextRenderer.SetActive(false); } if (EnableDisableCollision.Active) { EnableDisableCollision.SetActive(false); } return; } string toDisplay = "--- [7a31f7ff]Quantum Tunneling[]---\n"; if (IsEnabled) { toDisplay += $"Collision in [11c5edff]{ OnTime - (Functions.GetUnixTime() - LastEnabled) }s[]"; CollisionTextRenderer.SetActive(true); CollisionTextRenderer.Text = $"{ OnTime - (Functions.GetUnixTime() - LastEnabled) }"; CollisionTextRenderer.Color = new Color(0, 1, 0); if (OnTime - (Functions.GetUnixTime() - LastEnabled) <= 0) { PlayerController ctrl = PlayerController.LocalPlayer; IsEnabled = false; RpcManager.SendRpc(QuantumTunneling.QuantumTunnelingRpc, new byte[] { 2, ctrl.PlayerId, Convert.ToByte(IsEnabled) }); PlayerHudManager.HudManager.ShadowQuad.gameObject.SetActive(!IsEnabled); ctrl.HasCollision = !IsEnabled; } } else { bool CanEnable = LastEnabled + OnTime + UseCooldown <= Functions.GetUnixTime(); if (CanEnable) { // ----- Can enable demat ----- if (((EnableDisableCollision.InBounds && Functions.GetKey(KeyCode.Mouse0)) || Functions.GetKey(UseKey)) && PlayerController.LocalPlayer.Moveable) { // ----- User pressed key ----- LastEnabled = Functions.GetUnixTime(); PlayerController ctrl = PlayerController.LocalPlayer; IsEnabled = true; EnableDisableCollision.SpriteRenderer.color = new Color(0.75f, 0.75f, 0.75f, 0.75f); RpcManager.SendRpc(QuantumTunneling.QuantumTunnelingRpc, new byte[] { 2, ctrl.PlayerId, Convert.ToByte(IsEnabled) }); PlayerHudManager.HudManager.ShadowQuad.gameObject.SetActive(!IsEnabled); ctrl.HasCollision = !IsEnabled; } else { // ----- Display can press key ----- toDisplay += $"Use [11c5edff]The Button[] to activate."; EnableDisableCollision.SpriteRenderer.color = new Color(1, 1, 1); CollisionTextRenderer.gameObject.SetActive(false); } } else { // ----- Cannot enable demat ----- toDisplay += $"Cooldown: [11c5edff]{ (UseCooldown + OnTime) - (Functions.GetUnixTime() - LastEnabled) }s[]"; CollisionTextRenderer.Text = $"{ (UseCooldown + OnTime) - (Functions.GetUnixTime() - LastEnabled) }"; CollisionTextRenderer.Color = new Color(1, 1, 1); } } string curText = PlayerHudManager.TaskText; if (!curText.Contains(Delimiter)) { PlayerHudManager.TaskText = toDisplay + Delimiter + PlayerHudManager.TaskText; } else if (!curText.Contains(toDisplay)) { string toReplace = curText.Split(new string[] { Delimiter }, StringSplitOptions.None)[0]; PlayerHudManager.TaskText = curText.Replace(toReplace, toDisplay); } }
public override void Loop() { base.Loop(); GameModeSettingsAddition = $"\nColor Swap Delay: {Functions.ColorPurple}{SwapDelay}s"; if (!IsInGame) { return; } string toDisplay = $"----- {Functions.ColorYellow}Color Swap []-----\n"; if (SwapDelay - (Functions.GetUnixTime() - LastSwapped) <= 0 && LastSwapped != 0) { LastSwapped = Functions.GetUnixTime(); Random random = new Random(); if (CheepsAmongUsMod.CheepsAmongUsMod.IsDecidingClient) { List <ColorType> AvailableColors = new List <ColorType>((IEnumerable <ColorType>)Enum.GetValues(typeof(ColorType))); foreach (var player in PlayerController.AllPlayerControls) { #region ---------- This is required, if more than 12 players are online, as the game only offers 12 colors ---------- if (AvailableColors.Count == 0) { AvailableColors = new List <ColorType>((IEnumerable <ColorType>)Enum.GetValues(typeof(ColorType))); } #endregion #region ---------- Select random color ---------- var toSwitchTo = AvailableColors[random.Next(AvailableColors.Count)]; AvailableColors.Remove(toSwitchTo); #endregion if (player.IsLocalPlayer) { player.RpcSetColor(toSwitchTo); player.RpcSetHat(HatType.NoHat); player.RpcSetName(""); player.RpcSetSkin(SkinType.None); player.RpcSetPet(PetType.NoPet); } else { RpcManager.SendRpc(ColorSwap.ColorSwapRpc, new byte[] { 1, player.PlayerId, (byte)toSwitchTo }); } } } } toDisplay += $"Color Swap in [11c5edff]{ SwapDelay - (Functions.GetUnixTime() - LastSwapped) }s[]"; string curText = PlayerHudManager.TaskText; if (!curText.Contains(Delimiter)) { PlayerHudManager.TaskText = toDisplay + Delimiter + PlayerHudManager.TaskText; } else if (!curText.Contains(toDisplay)) { string toReplace = curText.Split(new string[] { Delimiter }, StringSplitOptions.None)[0]; PlayerHudManager.TaskText = curText.Replace(toReplace, toDisplay); } }
public override void Loop() { base.Loop(); GameModeSettingsAddition = $"\nAbility Active Period: {Functions.ColorPurple}{OnTime}s[]\n" + $"Ability Cooldown: {Functions.ColorPurple}{UseCooldown}s[]"; if (!IsInGame) { return; } foreach (var playerId in InvisiblePlayers) { PlayerController player = PlayerController.FromPlayerId(playerId); if (PlayerController.LocalPlayer.PlayerData.IsImpostor || PlayerController.LocalPlayer.PlayerData.IsDead) { player.SetOpacity(0.5f); } else { player.IsVisible = false; } } if (!PlayerController.LocalPlayer.PlayerData.IsImpostor) { return; } if (EnableDisableInvisibility == null) { EnableDisableInvisibility = new CustomButton(ButtonOffsetX, ButtonOffsetY, Functions.LoadSpriteFromAssemblyResource(Assembly.GetExecutingAssembly(), "ImpostorInvisibility.Assets.invisibility.png")); } if (InvisibilityTextRenderer == null) { InvisibilityTextRenderer = new CustomText(TextOffsetX, TextOffsetY, $"{UseCooldown}"); InvisibilityTextRenderer.TextRenderer.scale = 2; InvisibilityTextRenderer.TextRenderer.Centered = true; InvisibilityTextRenderer.SetActive(false); } if (PlayerController.LocalPlayer.PlayerData.IsDead) { if (InvisibilityTextRenderer.Active) { InvisibilityTextRenderer.SetActive(false); } if (EnableDisableInvisibility.Active) { EnableDisableInvisibility.SetActive(false); } return; } string toDisplay = "--- [7a31f7ff]Impostor Invisibility[]---\n"; if (IsEnabled) { toDisplay += $"Visible in [11c5edff]{ OnTime - (Functions.GetUnixTime() - LastEnabled) }s[]"; InvisibilityTextRenderer.SetActive(true); InvisibilityTextRenderer.Text = $"{ OnTime - (Functions.GetUnixTime() - LastEnabled) }"; InvisibilityTextRenderer.Color = new Color(0, 1, 0); if (OnTime - (Functions.GetUnixTime() - LastEnabled) <= 0) { PlayerController ctrl = PlayerController.LocalPlayer; IsEnabled = false; RpcManager.SendRpc(ImpostorInvisibility.ImpostorInvisibilityRpc, new byte[] { 2, ctrl.PlayerId, Convert.ToByte(IsEnabled) }); if (IsEnabled) { InvisiblePlayers.Add(ctrl.PlayerId); } else if (InvisiblePlayers.Contains(ctrl.PlayerId)) { InvisiblePlayers.Remove(ctrl.PlayerId); var player = PlayerController.FromPlayerId(ctrl.PlayerId); player.SetOpacity(1); if (!player.PlayerControl.inVent) { player.IsVisible = true; } } } } else { bool CanEnable = LastEnabled + OnTime + UseCooldown <= Functions.GetUnixTime(); if (CanEnable) { // ----- Can enable demat ----- if (((EnableDisableInvisibility.InBounds && Functions.GetKey(KeyCode.Mouse0)) || Functions.GetKey(UseKey)) && PlayerController.LocalPlayer.Moveable) { // ----- User pressed key ----- LastEnabled = Functions.GetUnixTime(); PlayerController ctrl = PlayerController.LocalPlayer; IsEnabled = true; EnableDisableInvisibility.SpriteRenderer.color = new Color(0.75f, 0.75f, 0.75f, 0.75f); RpcManager.SendRpc(ImpostorInvisibility.ImpostorInvisibilityRpc, new byte[] { 2, ctrl.PlayerId, Convert.ToByte(IsEnabled) }); if (IsEnabled) { InvisiblePlayers.Add(ctrl.PlayerId); } else if (InvisiblePlayers.Contains(ctrl.PlayerId)) { InvisiblePlayers.Remove(ctrl.PlayerId); var player = PlayerController.FromPlayerId(ctrl.PlayerId); player.SetOpacity(1); if (!player.PlayerControl.inVent) { player.IsVisible = true; } } } else { // ----- Display can press key ----- toDisplay += $"Use [11c5edff]{ UseKey }[] to activate."; EnableDisableInvisibility.SpriteRenderer.color = new Color(1, 1, 1); InvisibilityTextRenderer.gameObject.SetActive(false); } } else { // ----- Cannot enable demat ----- toDisplay += $"Cooldown: [11c5edff]{ (UseCooldown + OnTime) - (Functions.GetUnixTime() - LastEnabled) }s[]"; InvisibilityTextRenderer.Text = $"{ (UseCooldown + OnTime) - (Functions.GetUnixTime() - LastEnabled) }"; InvisibilityTextRenderer.Color = new Color(1, 1, 1); } } string curText = PlayerHudManager.TaskText; if (!curText.Contains(Delimiter)) { PlayerHudManager.TaskText = toDisplay + Delimiter + PlayerHudManager.TaskText; } else if (!curText.Contains(toDisplay)) { string toReplace = curText.Split(new string[] { Delimiter }, StringSplitOptions.None)[0]; PlayerHudManager.TaskText = curText.Replace(toReplace, toDisplay); } }
private void sync() { RpcManager.SendRpc(TheJester.JesterRpc, new byte[] { (byte)TheJester.CustomRpc.UpdateJesterCount, (byte)NumJesters }); }