From c0a233bd3f4452abd9f764606fde82c17168cd9d Mon Sep 17 00:00:00 2001 From: Eisbison Date: Mon, 19 Jul 2021 15:25:51 +0200 Subject: [PATCH] Version 2.7.3 --- .gitignore | 2 + README.md | 29 ++- Source Code/.gitignore | 4 - Source Code/ChatCommands.cs | 54 ------ Source Code/CustomButton.cs | 169 ----------------- TheOtherRoles.sln | 16 ++ {Source Code => TheOtherRoles}/Buttons.cs | 1 + .../CustomOptions.cs | 0 {Source Code => TheOtherRoles}/GameHistory.cs | 2 +- {Source Code => TheOtherRoles}/Helpers.cs | 5 + {Source Code => TheOtherRoles}/Main.cs | 3 +- {Source Code => TheOtherRoles}/MapOptions.cs | 0 TheOtherRoles/Modules/ChatCommands.cs | 75 ++++++++ .../Modules}/CustomColors.cs | 6 +- .../Modules}/CustomHats.cs | 29 +-- TheOtherRoles/Modules/DynamicLobbies.cs | 85 +++++++++ .../Modules}/ModUpdater.cs | 2 +- .../Objects}/Arrow.cs | 2 +- TheOtherRoles/Objects/CustomButton.cs | 174 ++++++++++++++++++ .../Objects}/CustomMessage.cs | 2 +- .../Objects}/Footprint.cs | 2 +- .../Objects}/Garlic.cs | 2 +- .../Objects}/JackInTheBox.cs | 2 +- .../Patches}/ClientOptionsPatch.cs | 2 +- .../Patches}/CredentialsPatch.cs | 6 +- .../Patches}/EndGamePatch.cs | 2 +- .../Patches}/ExileControllerPatch.cs | 29 +-- .../Patches}/GameStartManagerPatch.cs | 2 +- .../Patches}/IntroPatch.cs | 7 +- .../Patches}/MeetingPatch.cs | 29 ++- .../Patches}/NameFix.cs | 2 +- .../Patches}/PlayerControlPatch.cs | 3 +- .../Patches}/RegionMenuPatch.cs | 2 +- .../Patches}/RoleAssignmentPatch.cs | 3 +- .../Patches}/ShipStatusPatch.cs | 2 +- .../Patches}/UpdatePatch.cs | 6 +- .../Patches}/UsablesPatch.cs | 38 ++-- {Source Code => TheOtherRoles}/RPC.cs | 2 + .../Resources/AnimatedVentSealed.png | Bin .../Resources/Arrow.png | Bin .../Resources/Banner.png | Bin .../Resources/CamoButton.png | Bin .../Resources/CleanButton.png | Bin .../Resources/CloseVentButton.png | Bin .../Resources/CurseButton.png | Bin .../Resources/CurseKillButton.png | Bin .../Resources/DouseButton.png | Bin .../Resources/EraserButton.png | Bin .../Resources/Footprint.png | Bin .../Resources/Garlic.png | Bin .../Resources/GarlicBackground.png | Bin .../Resources/GarlicButton.png | Bin .../Resources/HackerButton.png | Bin .../Resources/IgniteButton.png | Bin .../Resources/LighterButton.png | Bin .../Resources/LightsOutButton.png | Bin .../Resources/ModStamp.png | Bin .../Resources/MorphButton.png | Bin .../Resources/PlaceCameraButton.png | Bin .../Resources/PlaceJackInTheBoxButton.png | Bin .../Resources/RepairButton.png | Bin .../Resources/RewindButton.png | Bin .../Resources/SampleButton.png | Bin .../Resources/SeerButton.png | Bin .../Resources/ShieldButton.png | Bin .../Resources/ShiftButton.png | Bin .../Resources/SidekickButton.png | Bin .../Resources/Soul.png | Bin .../Resources/StaticVentSealed.png | Bin .../Resources/SwapperCheck.png | Bin .../Resources/TargetIcon.png | Bin .../Resources/TimeShieldButton.png | Bin .../Resources/TrackerButton.png | Bin .../TricksterAnimation/trickster_box_0001.png | Bin .../TricksterAnimation/trickster_box_0002.png | Bin .../TricksterAnimation/trickster_box_0003.png | Bin .../TricksterAnimation/trickster_box_0004.png | Bin .../TricksterAnimation/trickster_box_0005.png | Bin .../TricksterAnimation/trickster_box_0006.png | Bin .../TricksterAnimation/trickster_box_0007.png | Bin .../TricksterAnimation/trickster_box_0008.png | Bin .../TricksterAnimation/trickster_box_0009.png | Bin .../TricksterAnimation/trickster_box_0010.png | Bin .../TricksterAnimation/trickster_box_0011.png | Bin .../TricksterAnimation/trickster_box_0012.png | Bin .../TricksterAnimation/trickster_box_0013.png | Bin .../TricksterAnimation/trickster_box_0014.png | Bin .../TricksterAnimation/trickster_box_0015.png | Bin .../TricksterAnimation/trickster_box_0016.png | Bin .../TricksterAnimation/trickster_box_0017.png | Bin .../TricksterAnimation/trickster_box_0018.png | Bin .../Resources/TricksterVentButton.png | Bin .../Resources/VampireButton.png | Bin {Source Code => TheOtherRoles}/RoleInfo.cs | 0 .../TasksHandler.cs | 0 .../TheOtherRoles.cs | 1 + .../TheOtherRoles.csproj | 8 +- 97 files changed, 489 insertions(+), 321 deletions(-) create mode 100644 .gitignore delete mode 100644 Source Code/.gitignore delete mode 100644 Source Code/ChatCommands.cs delete mode 100644 Source Code/CustomButton.cs create mode 100644 TheOtherRoles.sln rename {Source Code => TheOtherRoles}/Buttons.cs (99%) rename {Source Code => TheOtherRoles}/CustomOptions.cs (100%) rename {Source Code => TheOtherRoles}/GameHistory.cs (97%) rename {Source Code => TheOtherRoles}/Helpers.cs (98%) rename {Source Code => TheOtherRoles}/Main.cs (98%) rename {Source Code => TheOtherRoles}/MapOptions.cs (100%) create mode 100644 TheOtherRoles/Modules/ChatCommands.cs rename {Source Code => TheOtherRoles/Modules}/CustomColors.cs (99%) rename {Source Code => TheOtherRoles/Modules}/CustomHats.cs (97%) create mode 100644 TheOtherRoles/Modules/DynamicLobbies.cs rename {Source Code => TheOtherRoles/Modules}/ModUpdater.cs (99%) rename {Source Code => TheOtherRoles/Objects}/Arrow.cs (98%) create mode 100644 TheOtherRoles/Objects/CustomButton.cs rename {Source Code => TheOtherRoles/Objects}/CustomMessage.cs (98%) rename {Source Code => TheOtherRoles/Objects}/Footprint.cs (98%) rename {Source Code => TheOtherRoles/Objects}/Garlic.cs (98%) rename {Source Code => TheOtherRoles/Objects}/JackInTheBox.cs (99%) rename {Source Code => TheOtherRoles/Patches}/ClientOptionsPatch.cs (99%) rename {Source Code => TheOtherRoles/Patches}/CredentialsPatch.cs (96%) rename {Source Code => TheOtherRoles/Patches}/EndGamePatch.cs (99%) rename {Source Code => TheOtherRoles/Patches}/ExileControllerPatch.cs (87%) rename {Source Code => TheOtherRoles/Patches}/GameStartManagerPatch.cs (99%) rename {Source Code => TheOtherRoles/Patches}/IntroPatch.cs (97%) rename {Source Code => TheOtherRoles/Patches}/MeetingPatch.cs (93%) rename {Source Code => TheOtherRoles/Patches}/NameFix.cs (94%) rename {Source Code => TheOtherRoles/Patches}/PlayerControlPatch.cs (99%) rename {Source Code => TheOtherRoles/Patches}/RegionMenuPatch.cs (99%) rename {Source Code => TheOtherRoles/Patches}/RoleAssignmentPatch.cs (99%) rename {Source Code => TheOtherRoles/Patches}/ShipStatusPatch.cs (99%) rename {Source Code => TheOtherRoles/Patches}/UpdatePatch.cs (99%) rename {Source Code => TheOtherRoles/Patches}/UsablesPatch.cs (93%) rename {Source Code => TheOtherRoles}/RPC.cs (99%) rename {Source Code => TheOtherRoles}/Resources/AnimatedVentSealed.png (100%) rename {Source Code => TheOtherRoles}/Resources/Arrow.png (100%) rename {Source Code => TheOtherRoles}/Resources/Banner.png (100%) rename {Source Code => TheOtherRoles}/Resources/CamoButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/CleanButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/CloseVentButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/CurseButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/CurseKillButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/DouseButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/EraserButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/Footprint.png (100%) rename {Source Code => TheOtherRoles}/Resources/Garlic.png (100%) rename {Source Code => TheOtherRoles}/Resources/GarlicBackground.png (100%) rename {Source Code => TheOtherRoles}/Resources/GarlicButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/HackerButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/IgniteButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/LighterButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/LightsOutButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/ModStamp.png (100%) rename {Source Code => TheOtherRoles}/Resources/MorphButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/PlaceCameraButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/PlaceJackInTheBoxButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/RepairButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/RewindButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/SampleButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/SeerButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/ShieldButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/ShiftButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/SidekickButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/Soul.png (100%) rename {Source Code => TheOtherRoles}/Resources/StaticVentSealed.png (100%) rename {Source Code => TheOtherRoles}/Resources/SwapperCheck.png (100%) rename {Source Code => TheOtherRoles}/Resources/TargetIcon.png (100%) rename {Source Code => TheOtherRoles}/Resources/TimeShieldButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/TrackerButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0001.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0002.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0003.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0004.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0005.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0006.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0007.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0008.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0009.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0010.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0011.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0012.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0013.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0014.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0015.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0016.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0017.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterAnimation/trickster_box_0018.png (100%) rename {Source Code => TheOtherRoles}/Resources/TricksterVentButton.png (100%) rename {Source Code => TheOtherRoles}/Resources/VampireButton.png (100%) rename {Source Code => TheOtherRoles}/RoleInfo.cs (100%) rename {Source Code => TheOtherRoles}/TasksHandler.cs (100%) rename {Source Code => TheOtherRoles}/TheOtherRoles.cs (99%) rename {Source Code => TheOtherRoles}/TheOtherRoles.csproj (76%) diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..16bb3c3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.vs +.vscode/tasks.json \ No newline at end of file diff --git a/README.md b/README.md index 54d7aad..24eff26 100644 --- a/README.md +++ b/README.md @@ -36,9 +36,9 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein # Releases | Among Us - Version| Mod Version | Link | |----------|-------------|-----------------| -| **2021.6.30**| v2.7.2 Beta| [Download](https://github.com/Eisbison/TheOtherRoles/releases/tag/v2.7.2) -| 2021.6.15| v2.7.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.7.1/TheOtherRoles.zip) -| 2021.6.15| v2.7.0| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.7.0/TheOtherRoles.zip) +| **2021.6.30s**| v2.7.3| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.7.3/TheOtherRoles.zip) +| 2021.6.15s| v2.7.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.7.1/TheOtherRoles.zip) +| 2021.6.15s| v2.7.0| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.7.0/TheOtherRoles.zip) | 2021.5.25.2s| v2.6.7| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.6.7/TheOtherRoles.zip) | 2021.5.10s| v2.6.6| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.6.6/TheOtherRoles.zip) | 2021.5.10s| v2.6.5| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.6.5/TheOtherRoles.zip) @@ -72,11 +72,19 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
Click to show the Changelog +**Version 2.7.3** +- Updated to Among Us v2021.6.30 +- Updated BepInEx version +- Updated Credentials +- Fixed some Colors being considered darker, when they should be lighter +- Added /size command for Lobby +- Added /color and /murder command to Freeplay (for the Hat Designers) + **Version 2.7.1** -- Fixed a bug where swapped votes were sometimes counted wrongly -- Fixed the positioning of the player name while morphed -- Fixed a bug where the window of the Guesser sometimes showed no "close button" -- Fixed a bug where the garlics were not displayed properly +- Fixed a bug where [swapped](#swapper) votes were sometimes counted wrongly +- Fixed the positioning of the player name while [morphed](#morphling) +- Fixed a bug where the window of the [Guesser](#guesser) sometimes showed no "close button" +- Fixed a bug where the [garlics](#vampire) were not displayed properly **Version 2.7.0** - **New Role:** [Bounty Hunter](#bounty-hunter) created by [Mallöris](https://github.com/Mallaris) @@ -322,7 +330,7 @@ Not working? You might want to install the dependency [vc_redist](https://aka.ms **Linux Manual** 1. Install Among Us via Steam 2. Download newest [release](https://github.com/Eisbison/TheOtherRoles/releases/latest) and extract it to ~/.steam/steam/steamapps/common/Among Us -3. Enable `winhttp.dll` via the proton winecfg (https://bepinex.github.io/bepinex_docs/master/articles/advanced/steam_interop.html#protonwine) +3. Enable `winhttp.dll` via the proton winecfg (https://docs.bepinex.dev/articles/advanced/steam_interop.html#open-winecfg-for-the-target-game) 4. Launch the game via Steam # Custom Servers and 10+ Players @@ -663,7 +671,7 @@ Depending on the options, there'll be an arrow pointing towards the current targ ### **Team: Crewmates or Impostors** The Guesser can be a Crewmate or an Impostor (depending on the settings).\ The Guesser can shoot a player during the meeting, by guessing its role. If the guess is wrong, the Guesser dies instead.\ -Only one person can be shot per meeting and you can set a maximum number of shots.\ +You can select how many players can be shot per meeting and how many players can be shot per game.\ The guesses Impostor and Crewmate are only right, if the player is part of the corresponding team and has no special role.\ You can only shoot during the voting time. @@ -679,7 +687,8 @@ You can only shoot during the voting time. |----------|:-------------:| | Guesser Spawn Chance | - | Chance That The Guesser Is An Impostor | - -| Guesser Number Of Shots | - +| Guesser Number Of Shots Per Game| - +| Guesser Number Of Shots Per Meeting| - ----------------------- diff --git a/Source Code/.gitignore b/Source Code/.gitignore deleted file mode 100644 index 80a85c7..0000000 --- a/Source Code/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -bin -obj -.vscode/tasks.json -.gitignore \ No newline at end of file diff --git a/Source Code/ChatCommands.cs b/Source Code/ChatCommands.cs deleted file mode 100644 index 2c91f41..0000000 --- a/Source Code/ChatCommands.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using System.Security.Cryptography; -using System.Text; -using BepInEx; -using BepInEx.Configuration; -using BepInEx.IL2CPP; -using HarmonyLib; -using UnityEngine; -using System.Linq; -using UnhollowerBaseLib; - -namespace TheOtherRoles { - [HarmonyPatch] - public static class ChatCommands { - [HarmonyPatch(typeof(ChatController), nameof(ChatController.SendChat))] - private static class SendChatPatch { - static bool Prefix(ChatController __instance) { - string text = __instance.TextArea.text; - bool handled = false; - if (AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.GameStates.Started) { - //using(MD5 md5 = MD5.Create()) { - // string hash = System.BitConverter.ToString(md5.ComputeHash(Encoding.UTF8.GetBytes("tor@" + text.ToLower() + "§eof"))).Replace("-", "").ToLowerInvariant(); - if (text.ToLower().StartsWith("/kick ")) { - string playerName = text.Substring(6); - PlayerControl target = PlayerControl.AllPlayerControls.ToArray().ToList().FirstOrDefault(x => x.Data.PlayerName.Equals(playerName)); - if (target != null && AmongUsClient.Instance != null && AmongUsClient.Instance.CanBan()) { - var client = AmongUsClient.Instance.GetClient(target.OwnerId); - if (client != null) { - AmongUsClient.Instance.KickPlayer(client.Id, false); - handled = true; - } - } - } else if (text.ToLower().StartsWith("/ban ")) { - string playerName = text.Substring(6); - PlayerControl target = PlayerControl.AllPlayerControls.ToArray().ToList().FirstOrDefault(x => x.Data.PlayerName.Equals(playerName)); - if (target != null && AmongUsClient.Instance != null && AmongUsClient.Instance.CanBan()) { - var client = AmongUsClient.Instance.GetClient(target.OwnerId); - if (client != null) { - AmongUsClient.Instance.KickPlayer(client.Id, true); - handled = true; - } - } - } - } - //} - if (handled) { - __instance.TextArea.Clear(); - __instance.quickChatMenu.ResetGlyphs(); - } - return !handled; - } - } - } -} diff --git a/Source Code/CustomButton.cs b/Source Code/CustomButton.cs deleted file mode 100644 index d47c77e..0000000 --- a/Source Code/CustomButton.cs +++ /dev/null @@ -1,169 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using UnityEngine; -using UnityEngine.UI; - -public class CustomButton -{ - public static List buttons = new List(); - public KillButtonManager killButtonManager; - public Vector3 PositionOffset; - public float MaxTimer = float.MaxValue; - public float Timer = 0f; - private Action OnClick; - private Action OnMeetingEnds; - private Func HasButton; - private Func CouldUse; - private Action OnEffectEnds; - public bool HasEffect; - public bool isEffectActive = false; - public float EffectDuration; - public Sprite Sprite; - private HudManager hudManager; - private bool mirror; - private KeyCode? hotkey; - - public CustomButton(Action OnClick, Func HasButton, Func CouldUse, Action OnMeetingEnds, Sprite Sprite, Vector3 PositionOffset, HudManager hudManager, KeyCode? hotkey, bool HasEffect, float EffectDuration, Action OnEffectEnds, bool mirror = false) - { - this.hudManager = hudManager; - this.OnClick = OnClick; - this.HasButton = HasButton; - this.CouldUse = CouldUse; - this.PositionOffset = PositionOffset; - this.OnMeetingEnds = OnMeetingEnds; - this.HasEffect = HasEffect; - this.EffectDuration = EffectDuration; - this.OnEffectEnds = OnEffectEnds; - this.Sprite = Sprite; - this.mirror = mirror; - this.hotkey = hotkey; - Timer = 16.2f; - buttons.Add(this); - killButtonManager = UnityEngine.Object.Instantiate(hudManager.KillButton, hudManager.transform); - PassiveButton button = killButtonManager.GetComponent(); - button.OnClick = new Button.ButtonClickedEvent(); - button.OnClick.AddListener((UnityEngine.Events.UnityAction)onClickEvent); - - setActive(false); - } - - public CustomButton(Action OnClick, Func HasButton, Func CouldUse, Action OnMeetingEnds, Sprite Sprite, Vector3 PositionOffset, HudManager hudManager, KeyCode? hotkey, bool mirror = false) - : this(OnClick, HasButton, CouldUse, OnMeetingEnds, Sprite, PositionOffset, hudManager, hotkey, false, 0f, () => {}, mirror) { } - - void onClickEvent() - { - if (this.Timer < 0f && HasButton() && CouldUse()) - { - killButtonManager.renderer.color = new Color(1f, 1f, 1f, 0.3f); - this.OnClick(); - - if (this.HasEffect && !this.isEffectActive) { - this.Timer = this.EffectDuration; - killButtonManager.TimerText.color = new Color(0F, 0.8F, 0F); - this.isEffectActive = true; - } - } - } - - public static void HudUpdate() - { - buttons.RemoveAll(item => item.killButtonManager == null); - - for (int i = 0; i < buttons.Count; i++) - { - try - { - buttons[i].Update(); - } - catch (NullReferenceException) - { - System.Console.WriteLine("[WARNING] NullReferenceException from HudUpdate().HasButton(), if theres only one warning its fine"); - } - } - } - - public static void MeetingEndedUpdate() { - buttons.RemoveAll(item => item.killButtonManager == null); - for (int i = 0; i < buttons.Count; i++) - { - try - { - buttons[i].OnMeetingEnds(); - buttons[i].Update(); - } - catch (NullReferenceException) - { - System.Console.WriteLine("[WARNING] NullReferenceException from MeetingEndedUpdate().HasButton(), if theres only one warning its fine"); - } - } - } - - public static void ResetAllCooldowns() { - for (int i = 0; i < buttons.Count; i++) - { - try - { - buttons[i].Timer = buttons[i].MaxTimer; - buttons[i].Update(); - } - catch (NullReferenceException) - { - System.Console.WriteLine("[WARNING] NullReferenceException from MeetingEndedUpdate().HasButton(), if theres only one warning its fine"); - } - } - } - - public void setActive(bool isActive) { - if (isActive) { - killButtonManager.gameObject.SetActive(true); - killButtonManager.renderer.enabled = true; - } else { - killButtonManager.gameObject.SetActive(false); - killButtonManager.renderer.enabled = false; - } - } - - private void Update() - { - if (PlayerControl.LocalPlayer.Data == null || MeetingHud.Instance || ExileController.Instance || !HasButton()) { - setActive(false); - return; - } - setActive(hudManager.UseButton.isActiveAndEnabled); - - killButtonManager.renderer.sprite = Sprite; - if (hudManager.UseButton != null) { - Vector3 pos = hudManager.UseButton.transform.localPosition; - if (mirror) pos = new Vector3(-pos.x, pos.y, pos.z); - killButtonManager.transform.localPosition = pos + PositionOffset; - if (hudManager.KillButton != null) hudManager.KillButton.transform.localPosition = hudManager.UseButton.transform.localPosition - new Vector3(1.3f, 0, 0); // Align the kill button (because it's on another position depending on the screen resolution) - } - if (CouldUse()) { - killButtonManager.renderer.color = Palette.EnabledColor; - killButtonManager.renderer.material.SetFloat("_Desat", 0f); - } else { - killButtonManager.renderer.color = Palette.DisabledClear; - killButtonManager.renderer.material.SetFloat("_Desat", 1f); - } - - if (Timer >= 0) { - if (HasEffect && isEffectActive) - Timer -= Time.deltaTime; - else if (!PlayerControl.LocalPlayer.inVent && PlayerControl.LocalPlayer.moveable) - Timer -= Time.deltaTime; - } - - if (Timer <= 0 && HasEffect && isEffectActive) { - isEffectActive = false; - killButtonManager.TimerText.color = Palette.EnabledColor; - OnEffectEnds(); - } - - killButtonManager.SetCoolDown(Timer, (HasEffect && isEffectActive) ? EffectDuration : MaxTimer); - - // Trigger OnClickEvent if the hotkey is being pressed down - if (hotkey.HasValue && Input.GetKeyDown(hotkey.Value)) onClickEvent(); - } -} \ No newline at end of file diff --git a/TheOtherRoles.sln b/TheOtherRoles.sln new file mode 100644 index 0000000..3de367d --- /dev/null +++ b/TheOtherRoles.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TheOtherRoles", "TheOtherRoles\TheOtherRoles.csproj", "{11FBC798-BAF5-4EE5-9511-BE6DB0592F99}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {11FBC798-BAF5-4EE5-9511-BE6DB0592F99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {11FBC798-BAF5-4EE5-9511-BE6DB0592F99}.Debug|Any CPU.Build.0 = Debug|Any CPU + {11FBC798-BAF5-4EE5-9511-BE6DB0592F99}.Release|Any CPU.ActiveCfg = Release|Any CPU + {11FBC798-BAF5-4EE5-9511-BE6DB0592F99}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/Source Code/Buttons.cs b/TheOtherRoles/Buttons.cs similarity index 99% rename from Source Code/Buttons.cs rename to TheOtherRoles/Buttons.cs index 4d03eb9..6520d34 100644 --- a/Source Code/Buttons.cs +++ b/TheOtherRoles/Buttons.cs @@ -3,6 +3,7 @@ using Hazel; using System; using UnityEngine; using static TheOtherRoles.TheOtherRoles; +using TheOtherRoles.Objects; namespace TheOtherRoles { diff --git a/Source Code/CustomOptions.cs b/TheOtherRoles/CustomOptions.cs similarity index 100% rename from Source Code/CustomOptions.cs rename to TheOtherRoles/CustomOptions.cs diff --git a/Source Code/GameHistory.cs b/TheOtherRoles/GameHistory.cs similarity index 97% rename from Source Code/GameHistory.cs rename to TheOtherRoles/GameHistory.cs index e4383e4..0594e87 100644 --- a/Source Code/GameHistory.cs +++ b/TheOtherRoles/GameHistory.cs @@ -4,7 +4,7 @@ using System; using UnityEngine; using static TheOtherRoles.TheOtherRoles; -namespace TheOtherRoles{ +namespace TheOtherRoles { public class DeadPlayer { public PlayerControl player; diff --git a/Source Code/Helpers.cs b/TheOtherRoles/Helpers.cs similarity index 98% rename from Source Code/Helpers.cs rename to TheOtherRoles/Helpers.cs index a930739..1d5915f 100644 --- a/Source Code/Helpers.cs +++ b/TheOtherRoles/Helpers.cs @@ -7,6 +7,7 @@ using UnhollowerBaseLib; using UnityEngine; using System.Linq; using static TheOtherRoles.TheOtherRoles; +using TheOtherRoles.Modules; using HarmonyLib; using Hazel; @@ -203,6 +204,10 @@ namespace TheOtherRoles { player.NameText.color = new Color(player.NameText.color.r, player.NameText.color.g, player.NameText.color.b, alpha); } + public static string GetString(this TranslationController t, StringNames key, params Il2CppSystem.Object[] parts) { + return t.GetString(key, parts); + } + public static string cs(Color c, string s) { return string.Format("{4}", ToByte(c.r), ToByte(c.g), ToByte(c.b), ToByte(c.a), s); } diff --git a/Source Code/Main.cs b/TheOtherRoles/Main.cs similarity index 98% rename from Source Code/Main.cs rename to TheOtherRoles/Main.cs index e06fbba..a61cf03 100644 --- a/Source Code/Main.cs +++ b/TheOtherRoles/Main.cs @@ -12,6 +12,7 @@ using System; using System.Reflection; using UnhollowerBaseLib; using UnityEngine; +using TheOtherRoles.Modules; namespace TheOtherRoles { @@ -20,7 +21,7 @@ namespace TheOtherRoles public class TheOtherRolesPlugin : BasePlugin { public const string Id = "me.eisbison.theotherroles"; - public const string VersionString = "2.7.1"; + public const string VersionString = "2.7.3"; public static System.Version Version = System.Version.Parse(VersionString); public Harmony Harmony { get; } = new Harmony(Id); diff --git a/Source Code/MapOptions.cs b/TheOtherRoles/MapOptions.cs similarity index 100% rename from Source Code/MapOptions.cs rename to TheOtherRoles/MapOptions.cs diff --git a/TheOtherRoles/Modules/ChatCommands.cs b/TheOtherRoles/Modules/ChatCommands.cs new file mode 100644 index 0000000..4ca9050 --- /dev/null +++ b/TheOtherRoles/Modules/ChatCommands.cs @@ -0,0 +1,75 @@ +using System; +using System.Security.Cryptography; +using System.Text; +using BepInEx; +using BepInEx.Configuration; +using BepInEx.IL2CPP; +using HarmonyLib; +using UnityEngine; +using System.Linq; +using UnhollowerBaseLib; + +namespace TheOtherRoles.Modules { + [HarmonyPatch] + public static class ChatCommands { + [HarmonyPatch(typeof(ChatController), nameof(ChatController.SendChat))] + private static class SendChatPatch { + static bool Prefix(ChatController __instance) { + string text = __instance.TextArea.text; + bool handled = false; + if (AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.GameStates.Started) { + if (text.ToLower().StartsWith("/kick ")) { + string playerName = text.Substring(6); + PlayerControl target = PlayerControl.AllPlayerControls.ToArray().ToList().FirstOrDefault(x => x.Data.PlayerName.Equals(playerName)); + if (target != null && AmongUsClient.Instance != null && AmongUsClient.Instance.CanBan()) { + var client = AmongUsClient.Instance.GetClient(target.OwnerId); + if (client != null) { + AmongUsClient.Instance.KickPlayer(client.Id, false); + handled = true; + } + } + } else if (text.ToLower().StartsWith("/ban ")) { + string playerName = text.Substring(6); + PlayerControl target = PlayerControl.AllPlayerControls.ToArray().ToList().FirstOrDefault(x => x.Data.PlayerName.Equals(playerName)); + if (target != null && AmongUsClient.Instance != null && AmongUsClient.Instance.CanBan()) { + var client = AmongUsClient.Instance.GetClient(target.OwnerId); + if (client != null) { + AmongUsClient.Instance.KickPlayer(client.Id, true); + handled = true; + } + } + } + } + + if (AmongUsClient.Instance.GameMode == GameModes.FreePlay) { + if (text.ToLower().Equals("/murder")) { + PlayerControl.LocalPlayer.Exiled(); + HudManager.Instance.KillOverlay.ShowKillAnimation(PlayerControl.LocalPlayer.Data, PlayerControl.LocalPlayer.Data); + handled = true; + } else if (text.ToLower().StartsWith("/color ")) { + handled = true; + int col; + if (!Int32.TryParse(text.Substring(7), out col)) { + __instance.AddChat(PlayerControl.LocalPlayer, "Unable to parse color id\nUsage: /color {id}"); + } + col = Math.Clamp(col, 0, Palette.PlayerColors.Length - 1); + PlayerControl.LocalPlayer.SetColor(col); + __instance.AddChat(PlayerControl.LocalPlayer, "Changed color succesfully");; + } + } + if (handled) { + __instance.TextArea.Clear(); + __instance.quickChatMenu.ResetGlyphs(); + } + return !handled; + } + } + [HarmonyPatch(typeof(HudManager), nameof(HudManager.Update))] + public static class EnableChat { + public static void Postfix(HudManager __instance) { + if (!__instance.Chat.isActiveAndEnabled && AmongUsClient.Instance.GameMode == GameModes.FreePlay) + __instance.Chat.SetVisible(true); + } + } + } +} diff --git a/Source Code/CustomColors.cs b/TheOtherRoles/Modules/CustomColors.cs similarity index 99% rename from Source Code/CustomColors.cs rename to TheOtherRoles/Modules/CustomColors.cs index bc80f39..e6a964c 100644 --- a/Source Code/CustomColors.cs +++ b/TheOtherRoles/Modules/CustomColors.cs @@ -8,10 +8,10 @@ using HarmonyLib; using UnhollowerBaseLib; using Assets.CoreScripts; -namespace TheOtherRoles { +namespace TheOtherRoles.Modules { public class CustomColors { protected static Dictionary ColorStrings = new Dictionary(); - public static List lighterColors = new List(){ 3, 4, 5, 7, 10, 11}; + public static List lighterColors = new List(){ 3, 4, 5, 7, 10, 11, 13, 14, 17 }; public static uint pickableColors = (uint)Palette.ColorNames.Length; /* version 1 @@ -213,4 +213,4 @@ namespace TheOtherRoles { } } } -} +} \ No newline at end of file diff --git a/Source Code/CustomHats.cs b/TheOtherRoles/Modules/CustomHats.cs similarity index 97% rename from Source Code/CustomHats.cs rename to TheOtherRoles/Modules/CustomHats.cs index f9c8ee5..6cb6cfa 100644 --- a/Source Code/CustomHats.cs +++ b/TheOtherRoles/Modules/CustomHats.cs @@ -21,10 +21,11 @@ using System.Security.Cryptography; using Newtonsoft.Json.Linq; using Newtonsoft.Json; -namespace TheOtherRoles { +namespace TheOtherRoles.Modules { [HarmonyPatch] public class CustomHats { private static bool LOADED = false; + private static bool RUNNING = false; public static Material hatShader; public static Dictionary CustomHatRegistry = new Dictionary(); @@ -195,7 +196,9 @@ namespace TheOtherRoles { [HarmonyPatch(typeof(HatManager), nameof(HatManager.GetHatById))] private static class HatManagerPatch { - static bool Prefix(HatManager __instance) { + static void Prefix(HatManager __instance) { + if (RUNNING) return; + RUNNING = true; // prevent simultanious execution try { if (!LOADED) { Assembly assembly = Assembly.GetExecutingAssembly(); @@ -207,19 +210,19 @@ namespace TheOtherRoles { List customhats = createCustomHatDetails(hats); foreach (CustomHat ch in customhats) __instance.AllHats.Add(CreateHatBehaviour(ch)); - - while (CustomHatLoader.hatdetails.Count > 0) { - __instance.AllHats.Add(CreateHatBehaviour(CustomHatLoader.hatdetails[0])); - CustomHatLoader.hatdetails.RemoveAt(0); - } - - LOADED = true; } - return true; + while (CustomHatLoader.hatdetails.Count > 0) { + __instance.AllHats.Add(CreateHatBehaviour(CustomHatLoader.hatdetails[0])); + CustomHatLoader.hatdetails.RemoveAt(0); + } } catch (System.Exception e) { - System.Console.WriteLine("Unable to add Custom Hats\n" + e); - return false; + if (!LOADED) + System.Console.WriteLine("Unable to add Custom Hats\n" + e); } + LOADED = true; + } + static void Postfix(HatManager __instance) { + RUNNING = false; } } @@ -515,7 +518,7 @@ namespace TheOtherRoles { } private static bool doesResourceRequireDownload(string respath, string reshash, MD5 md5) { - if (reshash == null || !File.Exists(respath)) + if (reshash == null || !File.Exists(respath)) return true; using (var stream = File.OpenRead(respath)) { diff --git a/TheOtherRoles/Modules/DynamicLobbies.cs b/TheOtherRoles/Modules/DynamicLobbies.cs new file mode 100644 index 0000000..152770d --- /dev/null +++ b/TheOtherRoles/Modules/DynamicLobbies.cs @@ -0,0 +1,85 @@ +using System; +using HarmonyLib; +using UnityEngine; +using Hazel; +using InnerNet; + +namespace TheOtherRoles.Modules { + [HarmonyPatch] + public static class DynamicLobbies { + public static int LobbyLimit = 15; + [HarmonyPatch(typeof(ChatController), nameof(ChatController.SendChat))] + private static class SendChatPatch { + static bool Prefix(ChatController __instance) { + string text = __instance.TextArea.text; + bool handled = false; + if (AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.GameStates.Started) { + if (text.ToLower().StartsWith("/size ")) { // Unfortunately server holds this - need to do more trickery + if (AmongUsClient.Instance.AmHost && AmongUsClient.Instance.CanBan()) { // checking both just cause + handled = true; + if (!Int32.TryParse(text.Substring(6), out LobbyLimit)) { + __instance.AddChat(PlayerControl.LocalPlayer, "Invalid Size\nUsage: /size {amount}"); + } else { + LobbyLimit = Math.Clamp(LobbyLimit, 4, 15); + if (LobbyLimit != PlayerControl.GameOptions.MaxPlayers) { + PlayerControl.GameOptions.MaxPlayers = LobbyLimit; + DestroyableSingleton.Instance.LastPlayerCount = LobbyLimit; + PlayerControl.LocalPlayer.RpcSyncSettings(PlayerControl.GameOptions); + __instance.AddChat(PlayerControl.LocalPlayer, $"Lobby Size changed to {LobbyLimit} players"); + } else { + __instance.AddChat(PlayerControl.LocalPlayer, $"Lobby Size is already {LobbyLimit}"); + } + } + } + } + } + if (handled) { + __instance.TextArea.Clear(); + __instance.quickChatMenu.ResetGlyphs(); + } + return !handled; + } + } + [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.HostGame))] + public static class InnerNetClientHostPatch { + public static void Prefix(InnerNet.InnerNetClient __instance, [HarmonyArgument(0)] GameOptionsData settings) { + DynamicLobbies.LobbyLimit = settings.MaxPlayers; + settings.MaxPlayers = 15; // Force 15 Player Lobby on Server + SaveManager.ChatModeType = InnerNet.QuickChatModes.FreeChatOrQuickChat; + } + public static void Postfix(InnerNet.InnerNetClient __instance, [HarmonyArgument(0)] GameOptionsData settings) { + settings.MaxPlayers = DynamicLobbies.LobbyLimit; + } + } + [HarmonyPatch(typeof(InnerNetClient), nameof(InnerNetClient.JoinGame))] + public static class InnerNetClientJoinPatch { + public static void Prefix(InnerNet.InnerNetClient __instance) { + SaveManager.ChatModeType = InnerNet.QuickChatModes.FreeChatOrQuickChat; + } + } + [HarmonyPatch(typeof(AmongUsClient), nameof(AmongUsClient.OnPlayerJoined))] + public static class AmongUsClientOnPlayerJoined { + public static bool Prefix(AmongUsClient __instance, [HarmonyArgument(0)] ClientData client) { + if (LobbyLimit < __instance.allClients.Count) { // TODO: Fix this canceling start + DisconnectPlayer(__instance, client.Id); + return false; + } + return true; + } + + private static void DisconnectPlayer(InnerNetClient _this, int clientId) { + if (!_this.AmHost) { + return; + } + MessageWriter messageWriter = MessageWriter.Get(SendOption.Reliable); + messageWriter.StartMessage(4); + messageWriter.Write(_this.GameId); + messageWriter.WritePacked(clientId); + messageWriter.Write((byte)DisconnectReasons.GameFull); + messageWriter.EndMessage(); + _this.SendOrDisconnect(messageWriter); + messageWriter.Recycle(); + } + } + } +} diff --git a/Source Code/ModUpdater.cs b/TheOtherRoles/Modules/ModUpdater.cs similarity index 99% rename from Source Code/ModUpdater.cs rename to TheOtherRoles/Modules/ModUpdater.cs index 2cbd6f3..36f5554 100644 --- a/Source Code/ModUpdater.cs +++ b/TheOtherRoles/Modules/ModUpdater.cs @@ -25,7 +25,7 @@ using Newtonsoft.Json.Linq; using Newtonsoft.Json; using Twitch; -namespace TheOtherRoles { +namespace TheOtherRoles.Modules { [HarmonyPatch(typeof(MainMenuManager), nameof(MainMenuManager.Start))] public class ModUpdaterButton { private static void Prefix(MainMenuManager __instance) { diff --git a/Source Code/Arrow.cs b/TheOtherRoles/Objects/Arrow.cs similarity index 98% rename from Source Code/Arrow.cs rename to TheOtherRoles/Objects/Arrow.cs index 946e0ff..d1ee062 100644 --- a/Source Code/Arrow.cs +++ b/TheOtherRoles/Objects/Arrow.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Collections; using UnityEngine; -namespace TheOtherRoles { +namespace TheOtherRoles.Objects { public class Arrow { public float perc = 0.925f; public SpriteRenderer image; diff --git a/TheOtherRoles/Objects/CustomButton.cs b/TheOtherRoles/Objects/CustomButton.cs new file mode 100644 index 0000000..ee45ec5 --- /dev/null +++ b/TheOtherRoles/Objects/CustomButton.cs @@ -0,0 +1,174 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using UnityEngine; +using UnityEngine.UI; + +namespace TheOtherRoles.Objects { + public class CustomButton + { + public static List buttons = new List(); + public KillButtonManager killButtonManager; + public Vector3 PositionOffset; + public float MaxTimer = float.MaxValue; + public float Timer = 0f; + private Action OnClick; + private Action OnMeetingEnds; + private Func HasButton; + private Func CouldUse; + private Action OnEffectEnds; + public bool HasEffect; + public bool isEffectActive = false; + private bool showButtonText = false; + public float EffectDuration; + public Sprite Sprite; + private HudManager hudManager; + private bool mirror; + private KeyCode? hotkey; + + public CustomButton(Action OnClick, Func HasButton, Func CouldUse, Action OnMeetingEnds, Sprite Sprite, Vector3 PositionOffset, HudManager hudManager, KeyCode? hotkey, bool HasEffect, float EffectDuration, Action OnEffectEnds, bool mirror = false) + { + this.hudManager = hudManager; + this.OnClick = OnClick; + this.HasButton = HasButton; + this.CouldUse = CouldUse; + this.PositionOffset = PositionOffset; + this.OnMeetingEnds = OnMeetingEnds; + this.HasEffect = HasEffect; + this.EffectDuration = EffectDuration; + this.OnEffectEnds = OnEffectEnds; + this.Sprite = Sprite; + this.mirror = mirror; + this.hotkey = hotkey; + Timer = 16.2f; + buttons.Add(this); + killButtonManager = UnityEngine.Object.Instantiate(hudManager.KillButton, hudManager.transform); + this.showButtonText = killButtonManager.renderer.sprite == Sprite; + PassiveButton button = killButtonManager.GetComponent(); + button.OnClick = new Button.ButtonClickedEvent(); + button.OnClick.AddListener((UnityEngine.Events.UnityAction)onClickEvent); + + setActive(false); + } + + public CustomButton(Action OnClick, Func HasButton, Func CouldUse, Action OnMeetingEnds, Sprite Sprite, Vector3 PositionOffset, HudManager hudManager, KeyCode? hotkey, bool mirror = false) + : this(OnClick, HasButton, CouldUse, OnMeetingEnds, Sprite, PositionOffset, hudManager, hotkey, false, 0f, () => {}, mirror) { } + + void onClickEvent() + { + if (this.Timer < 0f && HasButton() && CouldUse()) + { + killButtonManager.renderer.color = new Color(1f, 1f, 1f, 0.3f); + this.OnClick(); + + if (this.HasEffect && !this.isEffectActive) { + this.Timer = this.EffectDuration; + killButtonManager.TimerText.color = new Color(0F, 0.8F, 0F); + this.isEffectActive = true; + } + } + } + + public static void HudUpdate() + { + buttons.RemoveAll(item => item.killButtonManager == null); + + for (int i = 0; i < buttons.Count; i++) + { + try + { + buttons[i].Update(); + } + catch (NullReferenceException) + { + System.Console.WriteLine("[WARNING] NullReferenceException from HudUpdate().HasButton(), if theres only one warning its fine"); + } + } + } + + public static void MeetingEndedUpdate() { + buttons.RemoveAll(item => item.killButtonManager == null); + for (int i = 0; i < buttons.Count; i++) + { + try + { + buttons[i].OnMeetingEnds(); + buttons[i].Update(); + } + catch (NullReferenceException) + { + System.Console.WriteLine("[WARNING] NullReferenceException from MeetingEndedUpdate().HasButton(), if theres only one warning its fine"); + } + } + } + + public static void ResetAllCooldowns() { + for (int i = 0; i < buttons.Count; i++) + { + try + { + buttons[i].Timer = buttons[i].MaxTimer; + buttons[i].Update(); + } + catch (NullReferenceException) + { + System.Console.WriteLine("[WARNING] NullReferenceException from MeetingEndedUpdate().HasButton(), if theres only one warning its fine"); + } + } + } + + public void setActive(bool isActive) { + if (isActive) { + killButtonManager.gameObject.SetActive(true); + killButtonManager.renderer.enabled = true; + } else { + killButtonManager.gameObject.SetActive(false); + killButtonManager.renderer.enabled = false; + } + } + + private void Update() + { + if (PlayerControl.LocalPlayer.Data == null || MeetingHud.Instance || ExileController.Instance || !HasButton()) { + setActive(false); + return; + } + setActive(hudManager.UseButton.isActiveAndEnabled); + + killButtonManager.renderer.sprite = Sprite; + killButtonManager.killText.enabled = showButtonText; // Only show the text if it's a kill button + if (hudManager.UseButton != null) { + Vector3 pos = hudManager.UseButton.transform.localPosition; + if (mirror) pos = new Vector3(-pos.x, pos.y, pos.z); + killButtonManager.transform.localPosition = pos + PositionOffset; + if (hudManager.KillButton != null) hudManager.KillButton.transform.localPosition = hudManager.UseButton.transform.localPosition - new Vector3(1.3f, 0, 0); // Align the kill button (because it's on another position depending on the screen resolution) + } + if (CouldUse()) { + killButtonManager.renderer.color = killButtonManager.killText.color = Palette.EnabledColor; + killButtonManager.renderer.material.SetFloat("_Desat", 0f); + } else { + killButtonManager.renderer.color = killButtonManager.killText.color = Palette.DisabledClear; + killButtonManager.renderer.material.SetFloat("_Desat", 1f); + } + + if (Timer >= 0) { + if (HasEffect && isEffectActive) + Timer -= Time.deltaTime; + else if (!PlayerControl.LocalPlayer.inVent && PlayerControl.LocalPlayer.moveable) + Timer -= Time.deltaTime; + } + + if (Timer <= 0 && HasEffect && isEffectActive) { + isEffectActive = false; + killButtonManager.TimerText.color = Palette.EnabledColor; + OnEffectEnds(); + } + + killButtonManager.SetCoolDown(Timer, (HasEffect && isEffectActive) ? EffectDuration : MaxTimer); + + // Trigger OnClickEvent if the hotkey is being pressed down + if (hotkey.HasValue && Input.GetKeyDown(hotkey.Value)) onClickEvent(); + } + } +} \ No newline at end of file diff --git a/Source Code/CustomMessage.cs b/TheOtherRoles/Objects/CustomMessage.cs similarity index 98% rename from Source Code/CustomMessage.cs rename to TheOtherRoles/Objects/CustomMessage.cs index fe3d836..ec11542 100644 --- a/Source Code/CustomMessage.cs +++ b/TheOtherRoles/Objects/CustomMessage.cs @@ -2,7 +2,7 @@ using UnityEngine; using System.Collections.Generic; using System; -namespace TheOtherRoles{ +namespace TheOtherRoles.Objects { public class CustomMessage { diff --git a/Source Code/Footprint.cs b/TheOtherRoles/Objects/Footprint.cs similarity index 98% rename from Source Code/Footprint.cs rename to TheOtherRoles/Objects/Footprint.cs index d9ea9d6..83e88cc 100644 --- a/Source Code/Footprint.cs +++ b/TheOtherRoles/Objects/Footprint.cs @@ -4,7 +4,7 @@ using System.Collections; using UnityEngine; using static TheOtherRoles.TheOtherRoles; -namespace TheOtherRoles{ +namespace TheOtherRoles.Objects { class Footprint { private static List footprints = new List(); private static Sprite sprite; diff --git a/Source Code/Garlic.cs b/TheOtherRoles/Objects/Garlic.cs similarity index 98% rename from Source Code/Garlic.cs rename to TheOtherRoles/Objects/Garlic.cs index e988bd4..5041d7f 100644 --- a/Source Code/Garlic.cs +++ b/TheOtherRoles/Objects/Garlic.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Collections; using UnityEngine; -namespace TheOtherRoles{ +namespace TheOtherRoles.Objects { class Garlic { public static List garlics = new List(); diff --git a/Source Code/JackInTheBox.cs b/TheOtherRoles/Objects/JackInTheBox.cs similarity index 99% rename from Source Code/JackInTheBox.cs rename to TheOtherRoles/Objects/JackInTheBox.cs index 38901fe..13ae06c 100644 --- a/Source Code/JackInTheBox.cs +++ b/TheOtherRoles/Objects/JackInTheBox.cs @@ -4,7 +4,7 @@ using System.Collections; using UnityEngine; using System.Linq; -namespace TheOtherRoles { +namespace TheOtherRoles.Objects { public class JackInTheBox { public static System.Collections.Generic.List AllJackInTheBoxes = new System.Collections.Generic.List(); diff --git a/Source Code/ClientOptionsPatch.cs b/TheOtherRoles/Patches/ClientOptionsPatch.cs similarity index 99% rename from Source Code/ClientOptionsPatch.cs rename to TheOtherRoles/Patches/ClientOptionsPatch.cs index 2dd829c..c8a48ca 100644 --- a/Source Code/ClientOptionsPatch.cs +++ b/TheOtherRoles/Patches/ClientOptionsPatch.cs @@ -7,7 +7,7 @@ using System; using UnityEngine.UI; using UnityEngine.Events; -namespace TheOtherRoles { +namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(OptionsMenuBehaviour), nameof(OptionsMenuBehaviour.Start))] public class OptionsMenuBehaviourStartPatch { private static Vector3? origin; diff --git a/Source Code/CredentialsPatch.cs b/TheOtherRoles/Patches/CredentialsPatch.cs similarity index 96% rename from Source Code/CredentialsPatch.cs rename to TheOtherRoles/Patches/CredentialsPatch.cs index c5b28b5..ac4cefe 100644 --- a/Source Code/CredentialsPatch.cs +++ b/TheOtherRoles/Patches/CredentialsPatch.cs @@ -6,20 +6,18 @@ using System.Text; using System.Threading.Tasks; using UnityEngine; -namespace TheOtherRoles -{ +namespace TheOtherRoles.Patches { [HarmonyPatch] public static class CredentialsPatch { public static string fullCredentials = $@"TheOtherRoles v{TheOtherRolesPlugin.Version.ToString()} Modded by Eisbison, Thunderstorm584 & EndOfFile -Balanced with Dhalucard Button design by Bavari"; public static string mainMenuCredentials = $@"Modded by Eisbison, Thunderstorm584 & EndOfFile -Balanced with Dhalucard Design by Bavari"; +Design by Bavari"; [HarmonyPatch(typeof(VersionShower), nameof(VersionShower.Start))] private static class VersionShowerPatch diff --git a/Source Code/EndGamePatch.cs b/TheOtherRoles/Patches/EndGamePatch.cs similarity index 99% rename from Source Code/EndGamePatch.cs rename to TheOtherRoles/Patches/EndGamePatch.cs index b6fc905..f53b072 100644 --- a/Source Code/EndGamePatch.cs +++ b/TheOtherRoles/Patches/EndGamePatch.cs @@ -11,7 +11,7 @@ using UnhollowerBaseLib; using System; using System.Text; -namespace TheOtherRoles { +namespace TheOtherRoles.Patches { enum CustomGameOverReason { LoversWin = 10, TeamJackalWin = 11, diff --git a/Source Code/ExileControllerPatch.cs b/TheOtherRoles/Patches/ExileControllerPatch.cs similarity index 87% rename from Source Code/ExileControllerPatch.cs rename to TheOtherRoles/Patches/ExileControllerPatch.cs index 7c36c41..5b0eaa6 100644 --- a/Source Code/ExileControllerPatch.cs +++ b/TheOtherRoles/Patches/ExileControllerPatch.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using UnhollowerBaseLib; using static TheOtherRoles.TheOtherRoles; +using TheOtherRoles.Objects; using static TheOtherRoles.MapOptions; using System.Collections; using System; @@ -11,7 +12,7 @@ using System.Text; using UnityEngine; using System.Reflection; -namespace TheOtherRoles { +namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(ExileController), "Begin")] class ExileControllerBeginPatch { public static void Prefix(ExileController __instance, [HarmonyArgument(0)]ref GameData.PlayerInfo exiled, [HarmonyArgument(1)]bool tie) { @@ -147,18 +148,22 @@ namespace TheOtherRoles { [HarmonyPatch(typeof(TranslationController), nameof(TranslationController.GetString), new Type[] { typeof(StringNames), typeof(Il2CppReferenceArray) })] class ExileControllerMessagePatch { - static void Postfix(ref string __result, [HarmonyArgument(0)]StringNames id, [HarmonyArgument(1)]Il2CppReferenceArray parts) { - if (ExileController.Instance != null && ExileController.Instance.exiled != null) { - PlayerControl player = Helpers.playerById(ExileController.Instance.exiled.Object.PlayerId); - if (player == null) return; - // Exile role text - if (id == StringNames.ExileTextPN || id == StringNames.ExileTextSN || id == StringNames.ExileTextPP || id == StringNames.ExileTextSP) { - __result = player.Data.PlayerName + " was The " + String.Join(" ", RoleInfo.getRoleInfoForPlayer(player).Select(x => x.name).ToArray()); - } - // Hide number of remaining impostors on Jester win - if (id == StringNames.ImpostorsRemainP || id == StringNames.ImpostorsRemainS) { - if (Jester.jester != null && player.PlayerId == Jester.jester.PlayerId) __result = ""; + static void Postfix(ref string __result, [HarmonyArgument(0)]StringNames id) { + try { + if (ExileController.Instance != null && ExileController.Instance.exiled != null) { + PlayerControl player = Helpers.playerById(ExileController.Instance.exiled.Object.PlayerId); + if (player == null) return; + // Exile role text + if (id == StringNames.ExileTextPN || id == StringNames.ExileTextSN || id == StringNames.ExileTextPP || id == StringNames.ExileTextSP) { + __result = player.Data.PlayerName + " was The " + String.Join(" ", RoleInfo.getRoleInfoForPlayer(player).Select(x => x.name).ToArray()); + } + // Hide number of remaining impostors on Jester win + if (id == StringNames.ImpostorsRemainP || id == StringNames.ImpostorsRemainS) { + if (Jester.jester != null && player.PlayerId == Jester.jester.PlayerId) __result = ""; + } } + } catch { + // pass - Hopefully prevent leaving while exiling to softlock game } } } diff --git a/Source Code/GameStartManagerPatch.cs b/TheOtherRoles/Patches/GameStartManagerPatch.cs similarity index 99% rename from Source Code/GameStartManagerPatch.cs rename to TheOtherRoles/Patches/GameStartManagerPatch.cs index 84a3a44..bdcd01b 100644 --- a/Source Code/GameStartManagerPatch.cs +++ b/TheOtherRoles/Patches/GameStartManagerPatch.cs @@ -7,7 +7,7 @@ using Hazel; using System; using UnhollowerBaseLib; -namespace TheOtherRoles { +namespace TheOtherRoles.Patches { public class GameStartManagerPatch { public static Dictionary playerVersions = new Dictionary(); private static float timer = 600f; diff --git a/Source Code/IntroPatch.cs b/TheOtherRoles/Patches/IntroPatch.cs similarity index 97% rename from Source Code/IntroPatch.cs rename to TheOtherRoles/Patches/IntroPatch.cs index 05ce908..03b0321 100644 --- a/Source Code/IntroPatch.cs +++ b/TheOtherRoles/Patches/IntroPatch.cs @@ -5,8 +5,7 @@ using UnityEngine; using System.Collections.Generic; using System.Linq; -namespace TheOtherRoles -{ +namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(IntroCutscene), nameof(IntroCutscene.OnDestroy))] class IntroCutsceneOnDestroyPatch { @@ -19,7 +18,7 @@ namespace TheOtherRoles GameData.PlayerInfo data = p.Data; PoolablePlayer player = UnityEngine.Object.Instantiate(__instance.PlayerPrefab, HudManager.Instance.transform); PlayerControl.SetPlayerMaterialColors(data.ColorId, player.Body); - DestroyableSingleton.Instance.SetSkin(player.SkinSlot, data.SkinId); + DestroyableSingleton.Instance.SetSkin(player.Skin.layer, data.SkinId); player.HatSlot.SetHat(data.HatId, data.ColorId); PlayerControl.SetPetImage(data.PetId, data.ColorId, player.PetSlot); player.NameText.text = data.PlayerName; @@ -96,7 +95,7 @@ namespace TheOtherRoles var loversText = UnityEngine.Object.Instantiate(__instance.ImpostorText, __instance.ImpostorText.transform.parent); loversText.transform.localPosition += Vector3.down * 3f; PlayerControl otherLover = PlayerControl.LocalPlayer == Lovers.lover1 ? Lovers.lover2 : Lovers.lover1; - loversText.text = Helpers.cs(Lovers.color, $"❤ You are in love with {otherLover?.Data?.PlayerName ?? ""} ❤"); + loversText.text = Helpers.cs(Lovers.color, $"♥ You are in love with {otherLover?.Data?.PlayerName ?? ""} ♥"); } } diff --git a/Source Code/MeetingPatch.cs b/TheOtherRoles/Patches/MeetingPatch.cs similarity index 93% rename from Source Code/MeetingPatch.cs rename to TheOtherRoles/Patches/MeetingPatch.cs index 4e98b71..c0a8a00 100644 --- a/Source Code/MeetingPatch.cs +++ b/TheOtherRoles/Patches/MeetingPatch.cs @@ -11,8 +11,7 @@ using System.Text; using UnityEngine; using System.Reflection; -namespace TheOtherRoles -{ +namespace TheOtherRoles.Patches { [HarmonyPatch] class MeetingHudPatch { static bool[] selections; @@ -222,22 +221,29 @@ namespace TheOtherRoles private static GameObject guesserUI; static void guesserOnClick(int buttonTarget, MeetingHud __instance) { if (guesserUI != null || !(__instance.state == MeetingHud.VoteStates.Voted || __instance.state == MeetingHud.VoteStates.NotVoted)) return; + __instance.playerStates.ToList().ForEach(x => x.gameObject.SetActive(false)); Transform container = UnityEngine.Object.Instantiate(__instance.transform.FindChild("Background"), __instance.transform); + container.FindChild("BlackBG").gameObject.SetActive(false); container.transform.localPosition = new Vector3(0, 0, -5f); guesserUI = container.gameObject; int i = 0; var buttonTemplate = __instance.playerStates[0].transform.FindChild("votePlayerBase"); + var maskTemplate = __instance.playerStates[0].transform.FindChild("MaskArea"); var smallButtonTemplate = __instance.playerStates[0].Buttons.transform.Find("CancelButton"); var textTemplate = __instance.playerStates[0].NameText; - Transform exitButton = UnityEngine.Object.Instantiate(buttonTemplate.transform, container); - exitButton.transform.localPosition = new Vector3(2.725f, 2.1f, -5); - exitButton.transform.localScale = new Vector3(0.25f, 0.9f, 1); + Transform exitButtonParent = (new GameObject()).transform; + exitButtonParent.SetParent(container); + Transform exitButton = UnityEngine.Object.Instantiate(buttonTemplate.transform, exitButtonParent); + Transform exitButtonMask = UnityEngine.Object.Instantiate(maskTemplate, exitButtonParent); exitButton.gameObject.GetComponent().sprite = smallButtonTemplate.GetComponent().sprite; + exitButtonParent.transform.localPosition = new Vector3(2.725f, 2.1f, -5); + exitButtonParent.transform.localScale = new Vector3(0.25f, 0.9f, 1); exitButton.GetComponent().OnClick.RemoveAllListeners(); exitButton.GetComponent().OnClick.AddListener((UnityEngine.Events.UnityAction)(() => { + __instance.playerStates.ToList().ForEach(x => x.gameObject.SetActive(true)); UnityEngine.Object.Destroy(container.gameObject); })); @@ -246,13 +252,15 @@ namespace TheOtherRoles foreach (RoleInfo roleInfo in RoleInfo.allRoleInfos) { if (roleInfo.roleId == RoleId.Lover || roleInfo.roleId == RoleId.Guesser || roleInfo == RoleInfo.niceMini) continue; // Not guessable roles - - Transform button = UnityEngine.Object.Instantiate(buttonTemplate.transform, container); - buttons.Add(button); + Transform buttonParent = (new GameObject()).transform; + buttonParent.SetParent(container); + Transform button = UnityEngine.Object.Instantiate(buttonTemplate, buttonParent); + Transform buttonMask = UnityEngine.Object.Instantiate(maskTemplate, buttonParent); TMPro.TextMeshPro label = UnityEngine.Object.Instantiate(textTemplate, button); + buttons.Add(button); int row = i/4, col = i%4; - button.localPosition = new Vector3(-2.725f + 1.83f * col, 1.5f - 0.45f * row, -5); - button.localScale = new Vector3(0.55f, 0.55f, 1f); + buttonParent.localPosition = new Vector3(-2.725f + 1.83f * col, 1.5f - 0.45f * row, -5); + buttonParent.localScale = new Vector3(0.55f, 0.55f, 1f); label.text = Helpers.cs(roleInfo.color, roleInfo.name); label.alignment = TMPro.TextAlignmentOptions.Center; label.transform.localPosition = new Vector3(0, 0, label.transform.localPosition.z); @@ -278,6 +286,7 @@ namespace TheOtherRoles AmongUsClient.Instance.FinishRpcImmediately(writer); RPCProcedure.guesserShoot(target.PlayerId); + __instance.playerStates.ToList().ForEach(x => x.gameObject.SetActive(true)); UnityEngine.Object.Destroy(container.gameObject); __instance.playerStates.ToList().ForEach(x => { if (x.transform.FindChild("ShootButton") != null) UnityEngine.Object.Destroy(x.transform.FindChild("ShootButton").gameObject); }); } diff --git a/Source Code/NameFix.cs b/TheOtherRoles/Patches/NameFix.cs similarity index 94% rename from Source Code/NameFix.cs rename to TheOtherRoles/Patches/NameFix.cs index b861088..9a21ea7 100644 --- a/Source Code/NameFix.cs +++ b/TheOtherRoles/Patches/NameFix.cs @@ -1,6 +1,6 @@ using HarmonyLib; -namespace TheOtherRoles { +namespace TheOtherRoles.Patches { [Harmony] public class AccountManagerPatch { [HarmonyPatch(typeof(AccountManager), nameof(AccountManager.RandomizeName))] diff --git a/Source Code/PlayerControlPatch.cs b/TheOtherRoles/Patches/PlayerControlPatch.cs similarity index 99% rename from Source Code/PlayerControlPatch.cs rename to TheOtherRoles/Patches/PlayerControlPatch.cs index 34b807e..029143a 100644 --- a/Source Code/PlayerControlPatch.cs +++ b/TheOtherRoles/Patches/PlayerControlPatch.cs @@ -7,9 +7,10 @@ using System.Text; using System.Threading.Tasks; using static TheOtherRoles.TheOtherRoles; using static TheOtherRoles.GameHistory; +using TheOtherRoles.Objects; using UnityEngine; -namespace TheOtherRoles { +namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.FixedUpdate))] public static class PlayerControlFixedUpdatePatch { diff --git a/Source Code/RegionMenuPatch.cs b/TheOtherRoles/Patches/RegionMenuPatch.cs similarity index 99% rename from Source Code/RegionMenuPatch.cs rename to TheOtherRoles/Patches/RegionMenuPatch.cs index e5ceeeb..5c5e956 100644 --- a/Source Code/RegionMenuPatch.cs +++ b/TheOtherRoles/Patches/RegionMenuPatch.cs @@ -29,7 +29,7 @@ using UnityEngine.UI; using System; using UnityEngine.Events; -namespace TheOtherRoles { +namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(RegionMenu), nameof(RegionMenu.Open))] public static class RegionMenuOpenPatch { diff --git a/Source Code/RoleAssignmentPatch.cs b/TheOtherRoles/Patches/RoleAssignmentPatch.cs similarity index 99% rename from Source Code/RoleAssignmentPatch.cs rename to TheOtherRoles/Patches/RoleAssignmentPatch.cs index 56349ad..77b63bf 100644 --- a/Source Code/RoleAssignmentPatch.cs +++ b/TheOtherRoles/Patches/RoleAssignmentPatch.cs @@ -7,8 +7,7 @@ using UnityEngine; using System; using static TheOtherRoles.TheOtherRoles; -namespace TheOtherRoles -{ +namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.RpcSetInfected))] class SetInfectedPatch { diff --git a/Source Code/ShipStatusPatch.cs b/TheOtherRoles/Patches/ShipStatusPatch.cs similarity index 99% rename from Source Code/ShipStatusPatch.cs rename to TheOtherRoles/Patches/ShipStatusPatch.cs index 0ab4fb6..446db39 100644 --- a/Source Code/ShipStatusPatch.cs +++ b/TheOtherRoles/Patches/ShipStatusPatch.cs @@ -2,7 +2,7 @@ using HarmonyLib; using static TheOtherRoles.TheOtherRoles; using UnityEngine; -namespace TheOtherRoles { +namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(ShipStatus))] public class ShipStatusPatch { diff --git a/Source Code/UpdatePatch.cs b/TheOtherRoles/Patches/UpdatePatch.cs similarity index 99% rename from Source Code/UpdatePatch.cs rename to TheOtherRoles/Patches/UpdatePatch.cs index c233933..0b84777 100644 --- a/Source Code/UpdatePatch.cs +++ b/TheOtherRoles/Patches/UpdatePatch.cs @@ -4,11 +4,11 @@ using System.IO; using System.Net.Http; using UnityEngine; using static TheOtherRoles.TheOtherRoles; +using TheOtherRoles.Objects; using System.Collections.Generic; using System.Linq; -namespace TheOtherRoles -{ +namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(HudManager), nameof(HudManager.Update))] class HudManagerUpdatePatch { @@ -158,7 +158,7 @@ namespace TheOtherRoles // Lovers if (Lovers.lover1 != null && Lovers.lover2 != null && (Lovers.lover1 == PlayerControl.LocalPlayer || Lovers.lover2 == PlayerControl.LocalPlayer)) { - string suffix = Helpers.cs(Lovers.color, " ❤"); + string suffix = Helpers.cs(Lovers.color, " ♥"); Lovers.lover1.nameText.text += suffix; Lovers.lover2.nameText.text += suffix; diff --git a/Source Code/UsablesPatch.cs b/TheOtherRoles/Patches/UsablesPatch.cs similarity index 93% rename from Source Code/UsablesPatch.cs rename to TheOtherRoles/Patches/UsablesPatch.cs index 8cba747..bc6cfbd 100644 --- a/Source Code/UsablesPatch.cs +++ b/TheOtherRoles/Patches/UsablesPatch.cs @@ -9,8 +9,7 @@ using static TheOtherRoles.MapOptions; using System.Collections.Generic; -namespace TheOtherRoles -{ +namespace TheOtherRoles.Patches { [HarmonyPatch(typeof(Vent), "CanUse")] public static class VentCanUsePatch @@ -112,17 +111,28 @@ namespace TheOtherRoles // Trickster render special vent button if (__instance.currentTarget != null && Trickster.trickster != null && Trickster.trickster == PlayerControl.LocalPlayer) { Vent possibleVent = __instance.currentTarget.TryCast(); - if (possibleVent != null && possibleVent.gameObject != null && possibleVent.gameObject.name.StartsWith("JackInTheBoxVent_")) { - __instance.UseButton.sprite = Trickster.getTricksterVentButtonSprite(); + if (possibleVent != null && possibleVent.gameObject != null) { + var useButton = __instance.currentButtonShown; + if (possibleVent.gameObject.name.StartsWith("JackInTheBoxVent_")) { + useButton.graphic.sprite = Trickster.getTricksterVentButtonSprite(); + useButton.text.enabled = false; // clear text; + } else { + useButton.graphic.sprite = DestroyableSingleton.Instance.GetImage(ImageNames.VentButton); + useButton.text.enabled = false; + } } } // Jester sabotage if (Jester.canSabotage && Jester.jester != null && Jester.jester == PlayerControl.LocalPlayer && PlayerControl.LocalPlayer.CanMove) { + var useButton = __instance.currentButtonShown; if (!Jester.jester.Data.IsDead && __instance.currentTarget == null) { // no target, so sabotage - __instance.UseButton.sprite = DestroyableSingleton.Instance.GetImage(ImageNames.SabotageButton); - CooldownHelpers.SetCooldownNormalizedUvs(__instance.UseButton); - __instance.UseButton.color = UseButtonManager.EnabledColor; + useButton.graphic.sprite = DestroyableSingleton.Instance.GetImage(ImageNames.SabotageButton); + useButton.graphic.color = UseButtonManager.EnabledColor; + useButton.text.enabled = false; + } else { + useButton.graphic.sprite = DestroyableSingleton.Instance.GetImage(ImageNames.UseButton); + useButton.text.enabled = false; } } @@ -130,25 +140,25 @@ namespace TheOtherRoles bool blockSabotageJanitor = (Janitor.janitor != null && Janitor.janitor == PlayerControl.LocalPlayer); bool blockSabotageMafioso = (Mafioso.mafioso != null && Mafioso.mafioso == PlayerControl.LocalPlayer && Godfather.godfather != null && !Godfather.godfather.Data.IsDead); if (__instance.currentTarget == null && (blockSabotageJanitor || blockSabotageMafioso)) { - __instance.UseButton.sprite = DestroyableSingleton.Instance.GetImage(ImageNames.UseButton); - __instance.UseButton.color = new Color(1f, 1f, 1f, 0.3f); + var useButton = __instance.currentButtonShown; + useButton.graphic.sprite = DestroyableSingleton.Instance.GetImage(ImageNames.UseButton); + useButton.graphic.color = UseButtonManager.DisabledColor; + useButton.text.enabled = false; } } } - + [HarmonyPatch(typeof(UseButtonManager), nameof(UseButtonManager.DoClick))] class UseButtonDoClickPatch { static bool Prefix(UseButtonManager __instance) { if (__instance.currentTarget != null) return true; - // Jester sabotage - if (Jester.canSabotage && Jester.jester != null && Jester.jester == PlayerControl.LocalPlayer && !Jester.jester.Data.IsDead) { + if (Jester.canSabotage && Jester.jester != null && Jester.jester == PlayerControl.LocalPlayer && !PlayerControl.LocalPlayer.Data.IsDead) { Action action = m => m.ShowInfectedMap() ; DestroyableSingleton.Instance.ShowMap(action); return false; } - // Mafia sabotage button click patch bool blockSabotageJanitor = (Janitor.janitor != null && Janitor.janitor == PlayerControl.LocalPlayer); bool blockSabotageMafioso = (Mafioso.mafioso != null && Mafioso.mafioso == PlayerControl.LocalPlayer && Godfather.godfather != null && !Godfather.godfather.Data.IsDead); @@ -434,7 +444,7 @@ namespace TheOtherRoles camera.transform.SetParent(__instance.transform); camera.transform.position = new Vector3(surv.transform.position.x, surv.transform.position.y, 8f); camera.orthographicSize = 2.35f; - RenderTexture temporary = RenderTexture.GetTemporary(256, 256, 16, 0); + RenderTexture temporary = RenderTexture.GetTemporary(256, 256, 16, (RenderTextureFormat)0); __instance.textures[i] = temporary; camera.targetTexture = temporary; } diff --git a/Source Code/RPC.cs b/TheOtherRoles/RPC.cs similarity index 99% rename from Source Code/RPC.cs rename to TheOtherRoles/RPC.cs index d48e473..795557a 100644 --- a/Source Code/RPC.cs +++ b/TheOtherRoles/RPC.cs @@ -4,6 +4,8 @@ using static TheOtherRoles.TheOtherRoles; using static TheOtherRoles.HudManagerStartPatch; using static TheOtherRoles.GameHistory; using static TheOtherRoles.MapOptions; +using TheOtherRoles.Objects; +using TheOtherRoles.Patches; using System.Collections.Generic; using System.Linq; using UnityEngine; diff --git a/Source Code/Resources/AnimatedVentSealed.png b/TheOtherRoles/Resources/AnimatedVentSealed.png similarity index 100% rename from Source Code/Resources/AnimatedVentSealed.png rename to TheOtherRoles/Resources/AnimatedVentSealed.png diff --git a/Source Code/Resources/Arrow.png b/TheOtherRoles/Resources/Arrow.png similarity index 100% rename from Source Code/Resources/Arrow.png rename to TheOtherRoles/Resources/Arrow.png diff --git a/Source Code/Resources/Banner.png b/TheOtherRoles/Resources/Banner.png similarity index 100% rename from Source Code/Resources/Banner.png rename to TheOtherRoles/Resources/Banner.png diff --git a/Source Code/Resources/CamoButton.png b/TheOtherRoles/Resources/CamoButton.png similarity index 100% rename from Source Code/Resources/CamoButton.png rename to TheOtherRoles/Resources/CamoButton.png diff --git a/Source Code/Resources/CleanButton.png b/TheOtherRoles/Resources/CleanButton.png similarity index 100% rename from Source Code/Resources/CleanButton.png rename to TheOtherRoles/Resources/CleanButton.png diff --git a/Source Code/Resources/CloseVentButton.png b/TheOtherRoles/Resources/CloseVentButton.png similarity index 100% rename from Source Code/Resources/CloseVentButton.png rename to TheOtherRoles/Resources/CloseVentButton.png diff --git a/Source Code/Resources/CurseButton.png b/TheOtherRoles/Resources/CurseButton.png similarity index 100% rename from Source Code/Resources/CurseButton.png rename to TheOtherRoles/Resources/CurseButton.png diff --git a/Source Code/Resources/CurseKillButton.png b/TheOtherRoles/Resources/CurseKillButton.png similarity index 100% rename from Source Code/Resources/CurseKillButton.png rename to TheOtherRoles/Resources/CurseKillButton.png diff --git a/Source Code/Resources/DouseButton.png b/TheOtherRoles/Resources/DouseButton.png similarity index 100% rename from Source Code/Resources/DouseButton.png rename to TheOtherRoles/Resources/DouseButton.png diff --git a/Source Code/Resources/EraserButton.png b/TheOtherRoles/Resources/EraserButton.png similarity index 100% rename from Source Code/Resources/EraserButton.png rename to TheOtherRoles/Resources/EraserButton.png diff --git a/Source Code/Resources/Footprint.png b/TheOtherRoles/Resources/Footprint.png similarity index 100% rename from Source Code/Resources/Footprint.png rename to TheOtherRoles/Resources/Footprint.png diff --git a/Source Code/Resources/Garlic.png b/TheOtherRoles/Resources/Garlic.png similarity index 100% rename from Source Code/Resources/Garlic.png rename to TheOtherRoles/Resources/Garlic.png diff --git a/Source Code/Resources/GarlicBackground.png b/TheOtherRoles/Resources/GarlicBackground.png similarity index 100% rename from Source Code/Resources/GarlicBackground.png rename to TheOtherRoles/Resources/GarlicBackground.png diff --git a/Source Code/Resources/GarlicButton.png b/TheOtherRoles/Resources/GarlicButton.png similarity index 100% rename from Source Code/Resources/GarlicButton.png rename to TheOtherRoles/Resources/GarlicButton.png diff --git a/Source Code/Resources/HackerButton.png b/TheOtherRoles/Resources/HackerButton.png similarity index 100% rename from Source Code/Resources/HackerButton.png rename to TheOtherRoles/Resources/HackerButton.png diff --git a/Source Code/Resources/IgniteButton.png b/TheOtherRoles/Resources/IgniteButton.png similarity index 100% rename from Source Code/Resources/IgniteButton.png rename to TheOtherRoles/Resources/IgniteButton.png diff --git a/Source Code/Resources/LighterButton.png b/TheOtherRoles/Resources/LighterButton.png similarity index 100% rename from Source Code/Resources/LighterButton.png rename to TheOtherRoles/Resources/LighterButton.png diff --git a/Source Code/Resources/LightsOutButton.png b/TheOtherRoles/Resources/LightsOutButton.png similarity index 100% rename from Source Code/Resources/LightsOutButton.png rename to TheOtherRoles/Resources/LightsOutButton.png diff --git a/Source Code/Resources/ModStamp.png b/TheOtherRoles/Resources/ModStamp.png similarity index 100% rename from Source Code/Resources/ModStamp.png rename to TheOtherRoles/Resources/ModStamp.png diff --git a/Source Code/Resources/MorphButton.png b/TheOtherRoles/Resources/MorphButton.png similarity index 100% rename from Source Code/Resources/MorphButton.png rename to TheOtherRoles/Resources/MorphButton.png diff --git a/Source Code/Resources/PlaceCameraButton.png b/TheOtherRoles/Resources/PlaceCameraButton.png similarity index 100% rename from Source Code/Resources/PlaceCameraButton.png rename to TheOtherRoles/Resources/PlaceCameraButton.png diff --git a/Source Code/Resources/PlaceJackInTheBoxButton.png b/TheOtherRoles/Resources/PlaceJackInTheBoxButton.png similarity index 100% rename from Source Code/Resources/PlaceJackInTheBoxButton.png rename to TheOtherRoles/Resources/PlaceJackInTheBoxButton.png diff --git a/Source Code/Resources/RepairButton.png b/TheOtherRoles/Resources/RepairButton.png similarity index 100% rename from Source Code/Resources/RepairButton.png rename to TheOtherRoles/Resources/RepairButton.png diff --git a/Source Code/Resources/RewindButton.png b/TheOtherRoles/Resources/RewindButton.png similarity index 100% rename from Source Code/Resources/RewindButton.png rename to TheOtherRoles/Resources/RewindButton.png diff --git a/Source Code/Resources/SampleButton.png b/TheOtherRoles/Resources/SampleButton.png similarity index 100% rename from Source Code/Resources/SampleButton.png rename to TheOtherRoles/Resources/SampleButton.png diff --git a/Source Code/Resources/SeerButton.png b/TheOtherRoles/Resources/SeerButton.png similarity index 100% rename from Source Code/Resources/SeerButton.png rename to TheOtherRoles/Resources/SeerButton.png diff --git a/Source Code/Resources/ShieldButton.png b/TheOtherRoles/Resources/ShieldButton.png similarity index 100% rename from Source Code/Resources/ShieldButton.png rename to TheOtherRoles/Resources/ShieldButton.png diff --git a/Source Code/Resources/ShiftButton.png b/TheOtherRoles/Resources/ShiftButton.png similarity index 100% rename from Source Code/Resources/ShiftButton.png rename to TheOtherRoles/Resources/ShiftButton.png diff --git a/Source Code/Resources/SidekickButton.png b/TheOtherRoles/Resources/SidekickButton.png similarity index 100% rename from Source Code/Resources/SidekickButton.png rename to TheOtherRoles/Resources/SidekickButton.png diff --git a/Source Code/Resources/Soul.png b/TheOtherRoles/Resources/Soul.png similarity index 100% rename from Source Code/Resources/Soul.png rename to TheOtherRoles/Resources/Soul.png diff --git a/Source Code/Resources/StaticVentSealed.png b/TheOtherRoles/Resources/StaticVentSealed.png similarity index 100% rename from Source Code/Resources/StaticVentSealed.png rename to TheOtherRoles/Resources/StaticVentSealed.png diff --git a/Source Code/Resources/SwapperCheck.png b/TheOtherRoles/Resources/SwapperCheck.png similarity index 100% rename from Source Code/Resources/SwapperCheck.png rename to TheOtherRoles/Resources/SwapperCheck.png diff --git a/Source Code/Resources/TargetIcon.png b/TheOtherRoles/Resources/TargetIcon.png similarity index 100% rename from Source Code/Resources/TargetIcon.png rename to TheOtherRoles/Resources/TargetIcon.png diff --git a/Source Code/Resources/TimeShieldButton.png b/TheOtherRoles/Resources/TimeShieldButton.png similarity index 100% rename from Source Code/Resources/TimeShieldButton.png rename to TheOtherRoles/Resources/TimeShieldButton.png diff --git a/Source Code/Resources/TrackerButton.png b/TheOtherRoles/Resources/TrackerButton.png similarity index 100% rename from Source Code/Resources/TrackerButton.png rename to TheOtherRoles/Resources/TrackerButton.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0001.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0001.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0001.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0001.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0002.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0002.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0002.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0002.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0003.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0003.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0003.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0003.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0004.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0004.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0004.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0004.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0005.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0005.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0005.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0005.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0006.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0006.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0006.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0006.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0007.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0007.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0007.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0007.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0008.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0008.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0008.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0008.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0009.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0009.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0009.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0009.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0010.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0010.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0010.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0010.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0011.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0011.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0011.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0011.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0012.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0012.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0012.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0012.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0013.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0013.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0013.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0013.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0014.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0014.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0014.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0014.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0015.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0015.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0015.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0015.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0016.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0016.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0016.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0016.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0017.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0017.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0017.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0017.png diff --git a/Source Code/Resources/TricksterAnimation/trickster_box_0018.png b/TheOtherRoles/Resources/TricksterAnimation/trickster_box_0018.png similarity index 100% rename from Source Code/Resources/TricksterAnimation/trickster_box_0018.png rename to TheOtherRoles/Resources/TricksterAnimation/trickster_box_0018.png diff --git a/Source Code/Resources/TricksterVentButton.png b/TheOtherRoles/Resources/TricksterVentButton.png similarity index 100% rename from Source Code/Resources/TricksterVentButton.png rename to TheOtherRoles/Resources/TricksterVentButton.png diff --git a/Source Code/Resources/VampireButton.png b/TheOtherRoles/Resources/VampireButton.png similarity index 100% rename from Source Code/Resources/VampireButton.png rename to TheOtherRoles/Resources/VampireButton.png diff --git a/Source Code/RoleInfo.cs b/TheOtherRoles/RoleInfo.cs similarity index 100% rename from Source Code/RoleInfo.cs rename to TheOtherRoles/RoleInfo.cs diff --git a/Source Code/TasksHandler.cs b/TheOtherRoles/TasksHandler.cs similarity index 100% rename from Source Code/TasksHandler.cs rename to TheOtherRoles/TasksHandler.cs diff --git a/Source Code/TheOtherRoles.cs b/TheOtherRoles/TheOtherRoles.cs similarity index 99% rename from Source Code/TheOtherRoles.cs rename to TheOtherRoles/TheOtherRoles.cs index 4f472ed..9790580 100644 --- a/Source Code/TheOtherRoles.cs +++ b/TheOtherRoles/TheOtherRoles.cs @@ -10,6 +10,7 @@ using System.Collections.Generic; using System.Collections; using System.IO; using UnityEngine; +using TheOtherRoles.Objects; namespace TheOtherRoles { diff --git a/Source Code/TheOtherRoles.csproj b/TheOtherRoles/TheOtherRoles.csproj similarity index 76% rename from Source Code/TheOtherRoles.csproj rename to TheOtherRoles/TheOtherRoles.csproj index 1c13a0c..2f71f98 100644 --- a/Source Code/TheOtherRoles.csproj +++ b/TheOtherRoles/TheOtherRoles.csproj @@ -1,7 +1,7 @@ netstandard2.1 - 2.7.1 + 2.7.3 TheOtherRoles Eisbison @@ -19,12 +19,12 @@ - - + + - + \ No newline at end of file -- 2.39.5