]> git.deb.at Git - rhonda/theotherroles.git/commitdiff
Update v4.3.3
authorgendelo3 <gendelo3@gmail.com>
Sun, 16 Jul 2023 08:37:40 +0000 (10:37 +0200)
committergendelo3 <gendelo3@gmail.com>
Sun, 16 Jul 2023 08:37:40 +0000 (10:37 +0200)
24 files changed:
README.md
TheOtherRoles/Buttons.cs
TheOtherRoles/GameHistory.cs
TheOtherRoles/Helpers.cs
TheOtherRoles/Main.cs
TheOtherRoles/Modules/BepInExUpdater.cs
TheOtherRoles/Modules/ChatCommands.cs
TheOtherRoles/Modules/CustomHats.cs
TheOtherRoles/Modules/CustomOptions.cs
TheOtherRoles/Modules/DynamicLobbies.cs
TheOtherRoles/Modules/ModUpdater.cs
TheOtherRoles/Objects/Bomb.cs
TheOtherRoles/Patches/ConstantsPatch.cs [new file with mode: 0644]
TheOtherRoles/Patches/CredentialsPatch.cs
TheOtherRoles/Patches/ExileControllerPatch.cs
TheOtherRoles/Patches/HauntMenuMinigamePatch.cs
TheOtherRoles/Patches/MainMenuPatch.cs
TheOtherRoles/Patches/MeetingPatch.cs
TheOtherRoles/Patches/PlayerControlPatch.cs
TheOtherRoles/Patches/UpdatePatch.cs
TheOtherRoles/RPC.cs
TheOtherRoles/RoleInfo.cs
TheOtherRoles/TheOtherRoles.csproj
TheOtherRoles/packages.lock.json

index c9ab726e694ded4f22cd29bd89ec45311d19cfcf..d941df6d7c75e3449239c1d15b052f31b9701681 100644 (file)
--- a/README.md
+++ b/README.md
@@ -42,15 +42,16 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
 # Releases
 | Among Us - Version| Mod Version | Link |
 |----------|-------------|-----------------|
+| 2023.07.12s| v4.3.3| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.3.3/TheOtherRoles.zip)
 | 2023.03.28s| v4.3.2| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.3.2/TheOtherRoles.zip)
-| 2023.03.28s| v4.3.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.3.1/TheOtherRoles.zip)
-| 2023.02.28s| v4.3.0| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.3.0/TheOtherRoles.zip)
-| 2022.12.14s| v4.2.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.2.1/TheOtherRoles.zip)
 <details>
   <summary>Click to show older versions</summary>
   
 | Among Us - Version| Mod Version | Link |
 |----------|-------------|-----------------|
+| 2023.03.28s| v4.3.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.3.1/TheOtherRoles.zip)
+| 2023.02.28s| v4.3.0| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.3.0/TheOtherRoles.zip)
+| 2022.12.14s| v4.2.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.2.1/TheOtherRoles.zip)
 | 2022.10.25s| v4.2.0| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.2.0/TheOtherRoles.zip)
 | 2022.9.20s| v4.1.7| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.1.7/TheOtherRoles.zip)
 | 2022.6.21s| v4.1.6| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v4.1.6/TheOtherRoles.zip)
@@ -123,6 +124,15 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
 <details>
   <summary>Click to show the Changelog</summary>
   
+**Version 4.3.3**
+- Updated to Among Us version 2023.07.12
+- Fixed an issue where the swap icon of a swapper guesser would be in front of the witch icon on a spelled player 
+- Fixed an issue where haunting was impossible in vanilla Hide'n'Seek
+- Fixed an issue where the settings for the Trapper would not appear in the in-game settings shower
+- Fixed a bug where the Arsonists win would show "killed by" on dead players in the summary screen
+- Fixed a bug where placing a garlic would convert a random player into a horse for the rest of the round
+- Changed the Eraser Guesser: Jackal and Sidekick are no longer guessable after being fake-"erased"
+  
 **Version 4.3.2**
 - Added new option to Thief: Can Guess To Steal Role
 - Added new option to Guesser Mode: Force Thief Guesser
@@ -777,6 +787,7 @@ docker run -d -p 22023:22023/udp --env IMPOSTOR_AntiCheatEnabled=false --env IMP
 [Ottomated](https://twitter.com/ottomated_) - Idea for the Morphling, Snitch and Camouflager role came from **Ottomated**\
 [Crowded-Mod](https://github.com/CrowdedMods/CrowdedMod) - Our implementation for 10+ player lobbies were inspired by the one from the **Crowded Mod Team**\
 [Goose-Goose-Duck](https://store.steampowered.com/app/1568590/Goose_Goose_Duck) - Idea for the Vulture role came from **Slushiegoose**\
+[TheEpicRoles](https://github.com/LaicosVK/TheEpicRoles) - Idea for the first kill shield (partly) and the tabbed option menu (fully + some code), by **LaicosVK** **DasMonschta** **Nova**\
 [Ninja](#ninja), [Thief](#thief), [Lawyer](#lawyer) / [Pursuer](#pursuer), [Deputy](#deputy), [Portalmaker](#portalmaker), [Guesser Modifier](#guesser-modifier) - Idea: [K3ndo](https://github.com/K3ndoo) ; Developed by [Gendelo](https://github.com/gendelo3) & [Mallöris](https://github.com/Mallaris)
 
 # Settings
@@ -1352,8 +1363,7 @@ If the Thief tries to kill any non-killing role (Crewmate or Neutral), they die
 **NOTE**
 - If the option "Thief Can Kill Sheriff" is On, the Thief has tasks which will ONLY begin to count, if they kill
 the Sheriff. While the Thief hasn't fired, their tasks do not count towards the taskwin.
-- If the option "Thief Can Kill Sheriff" is Off, the Thief will not have tasks.
-
+- If the option "Thief Can Kill Sheriff" is Off, the Thief will not have tasks. 
 - If the Thief kills the witch, already witched players stay witched (except for the Thief).
 - If the Thief can guess to steal the role, guessing the witch will either save all targets or none of the targets (depending on the setting for Witch: Voting The Witch Saves All The Targets)
 
@@ -2008,8 +2018,8 @@ Players can additionally have a modifier, if enabled (e.g. Medic Guesser Mini).
 | Number of Crew Guessers | -
 | Number of Neutral Guessers | -
 | Number of Impostor Guessers | -
-| Force Jackal Guesser | If set to "On", the first neutral role who will be Guesser is the Jackal.
-| Force Thief Guesser | If set to "On", the first (or second if Force Jackal Guesser) neutral role who will be Guesser is the Thief.
+| Force Jackal Guesser | If set to "On", the first neutral role who will be Guesser is the Jackal. 
+| Force Thief Guesser | If set to "On", the first (or second if Force Jackal Guesser) neutral role who will be Guesser is the Thief. 
 | Guessers Can Have A Modifier | -
 | Guesser Number Of Shots | -
 | Guesser Can Shoot Multiple Times Per Meeting | -
index f47b08708e2950c7f7f094e04bef377e605c11d8..1c8c47248c8a74b33350cc15a581146e8f5c36bd 100644 (file)
@@ -836,7 +836,6 @@ namespace TheOtherRoles
 
             garlicButton = new CustomButton(
                 () => {
-                    Utilities.EventUtility.StartEvent(EventUtility.EventTypes.Animation);
                     Vampire.localPlacedGarlic = true;
                     var pos = CachedPlayer.LocalPlayer.transform.position;
                     byte[] buff = new byte[sizeof(float) * 2];
@@ -1262,6 +1261,7 @@ namespace TheOtherRoles
                     if (GameOptionsManager.Instance.currentNormalGameOptions.MapId != 1) {
                         if (SecurityGuard.minigame == null) {
                             byte mapId = GameOptionsManager.Instance.currentNormalGameOptions.MapId;
+                            UnityEngine.Object.FindObjectsOfType<SystemConsole>().ToList().ForEach(x => TheOtherRolesPlugin.Logger.LogMessage($"{x.name} {x.GetType()}, {x.MinigamePrefab.TaskType}"));
                             var e = UnityEngine.Object.FindObjectsOfType<SystemConsole>().FirstOrDefault(x => x.gameObject.name.Contains("Surv_Panel") || x.name.Contains("Cam"));
                             if (mapId == 0 || mapId == 3) e = UnityEngine.Object.FindObjectsOfType<SystemConsole>().FirstOrDefault(x => x.gameObject.name.Contains("SurvConsole"));
                             else if (mapId == 4) e = UnityEngine.Object.FindObjectsOfType<SystemConsole>().FirstOrDefault(x => x.gameObject.name.Contains("task_cams"));
index c61ea5f75e1533ab8ec0a5aadf6c35d51c18fe20..015ac3dd450a450e81416b0bcb3ee9d42ddbb4c9 100644 (file)
@@ -15,7 +15,8 @@ namespace TheOtherRoles {
             LawyerSuicide,
             LoverSuicide, // not necessary
             WitchExile,
-            Bomb
+            Bomb,
+            Arson,
         };
 
         public PlayerControl player;
index 7b78aefe9e1521b160e579244dee951d8b683293..b582871a87468fea198ac207bac252acc2f8a753 100644 (file)
@@ -15,6 +15,7 @@ using System.Net;
 using TheOtherRoles.CustomGameModes;
 using Reactor.Utilities.Extensions;
 using AmongUs.GameOptions;
+using Innersloth.Assets;
 
 namespace TheOtherRoles {
 
@@ -288,7 +289,10 @@ namespace TheOtherRoles {
             target.RawSetHat(hatId, colorId);
             target.RawSetName(hidePlayerName(CachedPlayer.LocalPlayer.PlayerControl, target) ? "" : playerName);
 
-            SkinViewData nextSkin = FastDestroyableSingleton<HatManager>.Instance.GetSkinById(skinId).viewData.viewData;
+
+            SkinViewData nextSkin = null;
+            try { nextSkin = ShipStatus.Instance.CosmeticsCache.GetSkin(skinId); } catch { return; };
+            
             PlayerPhysics playerPhysics = target.MyPhysics;
             AnimationClip clip = null;
             var spriteAnim = playerPhysics.myPlayer.cosmetics.skin.animator;
@@ -309,12 +313,7 @@ namespace TheOtherRoles {
             spriteAnim.m_animator.Play("a", 0, progress % 1);
             spriteAnim.m_animator.Update(0f);
 
-            if (target.cosmetics.currentPet) UnityEngine.Object.Destroy(target.cosmetics.currentPet.gameObject);
-            target.cosmetics.currentPet = UnityEngine.Object.Instantiate<PetBehaviour>(FastDestroyableSingleton<HatManager>.Instance.GetPetById(petId).viewData.viewData);
-            target.cosmetics.currentPet.transform.position = target.transform.position;
-            target.cosmetics.currentPet.Source = target;
-            target.cosmetics.currentPet.Visible = target.Visible;
-            target.SetPlayerMaterialColors(target.cosmetics.currentPet.rend);
+            target.RawSetPet(petId, colorId);
 
             if (enforceNightVisionUpdate) Patches.SurveillanceMinigamePatch.enforceNightVision(target);
             Chameleon.update();  // so that morphling and camo wont make the chameleons visible
@@ -514,7 +513,7 @@ namespace TheOtherRoles {
                 HudManagerStartPatch.zoomOutButton.Sprite = zoomOutStatus ? Helpers.loadSpriteFromResources("TheOtherRoles.Resources.PlusButton.png", 75f) : Helpers.loadSpriteFromResources("TheOtherRoles.Resources.MinusButton.png", 150f);
                 HudManagerStartPatch.zoomOutButton.PositionOffset = zoomOutStatus ? new Vector3(0f, 3f, 0) : new Vector3(0.4f, 2.8f, 0);
             }
-            ResolutionManager.ResolutionChanged.Invoke((float)Screen.width / Screen.height); // This will move button positions to the correct position.
+            ResolutionManager.ResolutionChanged.Invoke((float)Screen.width / Screen.height, Screen.width, Screen.height, Screen.fullScreen); // This will move button positions to the correct position.
         }
 
         public static async Task checkBeta() {
index e5d0433866b56aaba2427e1641522f0324e9720c..e7f90f4d8dc8c486d9845af2d43eb7cabd900cc6 100644 (file)
@@ -31,7 +31,7 @@ namespace TheOtherRoles
     public class TheOtherRolesPlugin : BasePlugin
     {
         public const string Id = "me.eisbison.theotherroles";
-        public const string VersionString = "4.3.2";
+        public const string VersionString = "4.3.3";
         public static uint betaDays = 0;  // amount of days for the build to be usable (0 for infinite!)
 
         public static Version Version = Version.Parse(VersionString);
@@ -112,10 +112,9 @@ namespace TheOtherRoles
 
             DebugMode = Config.Bind("Custom", "Enable Debug Mode", "false");
             Harmony.PatchAll();
-
+            
             CustomOptionHolder.Load();
             CustomColors.Load();
-
             if (BepInExUpdater.UpdateRequired)
             {
                 AddComponent<BepInExUpdater>();
@@ -123,7 +122,6 @@ namespace TheOtherRoles
             }
 
             EventUtility.Load();
-
             SubmergedCompatibility.Initialize();
             AddComponent<ModUpdateBehaviour>();
             Modules.MainMenuPatch.addSceneChangeCallbacks();
@@ -205,4 +203,4 @@ namespace TheOtherRoles
                 .Select(s => s[random.Next(s.Length)]).ToArray());
         }
     }
-} 
+}
index 706214fda2e6136e105edec50aae6557e266c982..cff52ed329e3ea7bdb8a3236ac926c974093ab8a 100644 (file)
@@ -19,8 +19,8 @@ namespace TheOtherRoles.Modules;
 
 public class BepInExUpdater : MonoBehaviour
 {
-    public const string RequiredBepInExVersion = "6.0.0-be.664+0b23557c1355913983f3540797fa22c43a02247d";
-    public const string BepInExDownloadURL = "https://builds.bepinex.dev/projects/bepinex_be/664/BepInEx-Unity.IL2CPP-win-x86-6.0.0-be.664%2B0b23557.zip";
+    public const string RequiredBepInExVersion = "6.0.0-be.670+42a6727370c2b9356fc043ea601410540a8b4042";
+    public const string BepInExDownloadURL = "https://builds.bepinex.dev/projects/bepinex_be/670/BepInEx-Unity.IL2CPP-win-x86-6.0.0-be.670%2B42a6727.zip";
     public static bool UpdateRequired => Paths.BepInExVersion.ToString() != RequiredBepInExVersion;
 
     public void Awake()
index 08104697f0e154e469abd74e09a8fd3eb2cd4fa8..2ede8ec2e1247443cf38102de9a951f523e51c74 100644 (file)
@@ -12,7 +12,7 @@ namespace TheOtherRoles.Modules {
         [HarmonyPatch(typeof(ChatController), nameof(ChatController.SendChat))]
         private static class SendChatPatch {
             static bool Prefix(ChatController __instance) {
-                string text = __instance.TextArea.text;
+                string text = __instance.freeChatField.Text;
                 bool handled = false;
                 if (AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.GameStates.Started) {
                     if (text.ToLower().StartsWith("/kick ")) {
@@ -65,8 +65,8 @@ namespace TheOtherRoles.Modules {
                 }
 
                 if (handled) {
-                    __instance.TextArea.Clear();
-                    __instance.quickChatMenu.ResetGlyphs();
+                    __instance.freeChatField.Clear();
+                    __instance.quickChatMenu.Clear();
                 }
                 return !handled;
             }
index aeb250e61c32111f423ba0e17aa894a819cc8ee1..030723d76d5ea160df71b72d96a7756b5cb55e9c 100644 (file)
@@ -16,6 +16,10 @@ using AmongUs.Data.Legacy;
 using System.Reflection;
 using static Rewired.Controller;
 using static TheOtherRoles.Modules.CustomHatLoader;
+using Innersloth.Assets;
+using UnityEngine.AddressableAssets;
+using PowerTools;
+using System.Drawing;
 
 namespace TheOtherRoles.Modules {
     [HarmonyPatch]
@@ -25,6 +29,7 @@ namespace TheOtherRoles.Modules {
         public static Material hatShader;
 
         public static Dictionary<string, HatExtension> CustomHatRegistry = new Dictionary<string, HatExtension>();
+        public static Dictionary<string, HatViewData> CustomHatViewDatas = new Dictionary<string, HatViewData>();
         public static HatExtension TestExt = null;
 
         public class HatExtension {
@@ -129,16 +134,19 @@ namespace TheOtherRoles.Modules {
                 Material tmpShader = FastDestroyableSingleton<HatManager>.Instance.PlayerMaterial;
                 hatShader = tmpShader;
             }
-
+            var viewdata = ScriptableObject.CreateInstance<HatViewData>();
             HatData hat = ScriptableObject.CreateInstance<HatData>();
-            hat.hatViewData.viewData = ScriptableObject.CreateInstance<HatViewData>();
-            hat.hatViewData.viewData.MainImage = CreateHatSprite(ch.resource, fromDisk);
+
+            viewdata.MainImage = CreateHatSprite(ch.resource, fromDisk);
+            viewdata.FloorImage = viewdata.MainImage;
             if (ch.backresource != null) {
-                hat.hatViewData.viewData.BackImage = CreateHatSprite(ch.backresource, fromDisk);
+                viewdata.BackImage = CreateHatSprite(ch.backresource, fromDisk);
                 ch.behind = true; // Required to view backresource
             }
-            if (ch.climbresource != null)
-                hat.hatViewData.viewData.ClimbImage = CreateHatSprite(ch.climbresource, fromDisk);
+            if (ch.climbresource != null) {
+                viewdata.ClimbImage = CreateHatSprite(ch.climbresource, fromDisk);
+                viewdata.LeftClimbImage = viewdata.ClimbImage;
+            }
             hat.name = ch.name;
             hat.displayOrder = 99;
             hat.ProductId = "hat_" + ch.name.Replace(' ', '_');
@@ -148,7 +156,7 @@ namespace TheOtherRoles.Modules {
             hat.Free = true;
 
             if (ch.adaptive && hatShader != null)
-                hat.hatViewData.viewData.AltShader = hatShader;
+                viewdata.AltShader = hatShader;
 
             HatExtension extend = new HatExtension();
             extend.author = ch.author != null ? ch.author : "Unknown";
@@ -156,7 +164,7 @@ namespace TheOtherRoles.Modules {
             extend.condition = ch.condition != null ? ch.condition : "none";
 
             if (ch.flipresource != null)
-                 extend.FlipImage = CreateHatSprite(ch.flipresource, fromDisk);
+                extend.FlipImage = CreateHatSprite(ch.flipresource, fromDisk);
             if (ch.backflipresource != null)
                  extend.BackFlipImage = CreateHatSprite(ch.backflipresource, fromDisk);
 
@@ -166,7 +174,11 @@ namespace TheOtherRoles.Modules {
             } else {
                 CustomHatRegistry.Add(hat.name, extend);
             }
+            CustomHatViewDatas.Add(hat.name, viewdata);
+            var assetRef = new AssetReference(viewdata.Pointer);
 
+            hat.ViewDataRef = assetRef;
+            hat.CreateAddressableAsset();
             return hat;
         }
 
@@ -191,7 +203,7 @@ namespace TheOtherRoles.Modules {
         private static class HatManagerPatch {
             private static List<HatData> allHatsList;
             static void Prefix(HatManager __instance) {
-                if (RUNNING) return;
+                if (RUNNING || LOADED) return;
                 RUNNING = true; // prevent simultanious execution
                 allHatsList = __instance.allHats.ToList();
 
@@ -202,11 +214,11 @@ namespace TheOtherRoles.Modules {
                         CustomHatLoader.hatdetails.RemoveAt(0);
                     }
                     __instance.allHats = allHatsList.ToArray();
+                    LOADED = true;  // this will only be set to true if loading is succesful.
                 } catch (System.Exception e) {
                     if (!LOADED)
-                        System.Console.WriteLine("Unable to add Custom Hats\n" + e);
+                        TheOtherRolesPlugin.Logger.LogMessage("Unable to add Custom Hats\n" + e);
                 }
-                LOADED = true;
             }
             static void Postfix(HatManager __instance) {
                 RUNNING = false;
@@ -216,24 +228,26 @@ namespace TheOtherRoles.Modules {
         [HarmonyPatch(typeof(PlayerPhysics), nameof(PlayerPhysics.HandleAnimation))]
         private static class PlayerPhysicsHandleAnimationPatch {
             private static void Postfix(PlayerPhysics __instance) {
+                if (!CustomHatViewDatas.ContainsKey(__instance.myPlayer.cosmetics.hat.Hat.name)) return;
+                HatViewData viewData = CustomHatViewDatas[__instance.myPlayer.cosmetics.hat.Hat.name];
                 AnimationClip currentAnimation = __instance.Animations.Animator.GetCurrentAnimation();
                 if (currentAnimation == __instance.Animations.group.ClimbUpAnim || currentAnimation == __instance.Animations.group.ClimbDownAnim) return;
                 HatParent hp = __instance.myPlayer.cosmetics.hat;
-                if (hp.Hat == null) return;
+                if (hp == null || hp.Hat == null) return;
                 HatExtension extend = hp.Hat.getHatExtension();
                 if (extend == null) return;
                 if (extend.FlipImage != null) {
                     if (__instance.FlipX) {
                         hp.FrontLayer.sprite = extend.FlipImage;
                     } else {
-                        hp.FrontLayer.sprite = hp.hatView.MainImage;
+                        hp.FrontLayer.sprite = viewData.MainImage;
                     }
                 }
                 if (extend.BackFlipImage != null) {
                     if (__instance.FlipX) {
                         hp.BackLayer.sprite = extend.BackFlipImage;
                     } else {
-                        hp.BackLayer.sprite = hp.hatView.BackImage;
+                        hp.BackLayer.sprite = viewData.BackImage;
                     }
                 }
             }
@@ -262,27 +276,26 @@ namespace TheOtherRoles.Modules {
                 }     
             }
             
-            [HarmonyPatch(typeof(HatParent), nameof(HatParent.SetHat), typeof(HatData), typeof(HatViewData), typeof(int))]
+            [HarmonyPatch(typeof(HatParent), nameof(HatParent.SetHat), typeof(HatData), typeof(int))]
             private static class HatParentSetHatPatchExtra {
-                static bool Prefix(HatParent __instance, HatData hat, HatViewData hatViewData, int color)
+                static bool Prefix(HatParent __instance, HatData hat, int color)
                 {
                     if (!DestroyableSingleton<TutorialManager>.InstanceExists) return true;
                     
                     try 
                     {
                         __instance.Hat = hat;
-                        __instance.hatView = hatViewData;
-                        
+                        __instance.hatDataAsset = __instance.Hat.CreateAddressableAsset();
+
                         string filePath = Path.GetDirectoryName(Application.dataPath) + @"\TheOtherHats\Test";
                         if (!Directory.Exists(filePath)) return true;
                         DirectoryInfo d = new DirectoryInfo(filePath);
-                        string[] filePaths = d.GetFiles("*.png").Select(x => x.FullName).ToArray(); // Getting Text files
+                        string[] filePaths = d.GetFiles("*.png").Select(x => x.FullName).ToArray(); // Getting Test files
                         List<CustomHat> hats = createCustomHatDetails(filePaths, true);
                         if (hats.Count > 0) 
                         {
                             __instance.Hat = CreateHatBehaviour(hats[0], true, true);
-                            __instance.hatView = __instance.Hat.hatViewData.viewData;
-
+                            __instance.hatDataAsset = __instance.Hat.CreateAddressableAsset();
                         }
                     } 
                     catch (System.Exception e) 
@@ -291,7 +304,6 @@ namespace TheOtherRoles.Modules {
                         return true;
                     }
                     
-                    
                     __instance.PopulateFromHatViewData();
                     __instance.SetMaterialColor(color);
                     return false;
@@ -299,6 +311,175 @@ namespace TheOtherRoles.Modules {
             }
         }
 
+        [HarmonyPatch(typeof(HatParent), nameof(HatParent.SetHat), typeof(int))]
+        public class SetHatPatch {
+            public static bool Prefix(HatParent __instance, int color) {
+                if (!CustomHatRegistry.ContainsKey(__instance.Hat.name)) return true;
+                __instance.hatDataAsset = null;
+                __instance.PopulateFromHatViewData();
+                __instance.SetMaterialColor(color);
+                return false;
+            }
+        }
+
+        [HarmonyPatch(typeof(HatParent), nameof(HatParent.UpdateMaterial))]
+        public class UpdateMaterialPatch {
+            public static bool Prefix(HatParent __instance) {
+                HatViewData asset;
+                try {
+                    HatViewData vanillaAsset = __instance.hatDataAsset.GetAsset();
+                    return true;
+                } catch { 
+                    try {
+                       asset = CustomHatViewDatas[__instance.Hat.name];
+                    } catch {
+                        return false;
+                    }
+                }
+                if (asset.AltShader) {
+                    __instance.FrontLayer.sharedMaterial = asset.AltShader;
+                    if (__instance.BackLayer) {
+                        __instance.BackLayer.sharedMaterial = asset.AltShader;
+                    }
+                } else {
+                    __instance.FrontLayer.sharedMaterial = DestroyableSingleton<HatManager>.Instance.DefaultShader;
+                    if (__instance.BackLayer) {
+                        __instance.BackLayer.sharedMaterial = DestroyableSingleton<HatManager>.Instance.DefaultShader;
+                    }
+                }
+                int colorId = __instance.matProperties.ColorId;
+                PlayerMaterial.SetColors(colorId, __instance.FrontLayer);
+                if (__instance.BackLayer) {
+                    PlayerMaterial.SetColors(colorId, __instance.BackLayer);
+                }
+                __instance.FrontLayer.material.SetInt(PlayerMaterial.MaskLayer, __instance.matProperties.MaskLayer);
+                if (__instance.BackLayer) {
+                    __instance.BackLayer.material.SetInt(PlayerMaterial.MaskLayer, __instance.matProperties.MaskLayer);
+                }
+                PlayerMaterial.MaskType maskType = __instance.matProperties.MaskType;
+                if (maskType == PlayerMaterial.MaskType.ScrollingUI) {
+                    if (__instance.FrontLayer) {
+                        __instance.FrontLayer.maskInteraction = SpriteMaskInteraction.VisibleInsideMask;
+                    }
+                    if (__instance.BackLayer) {
+                        __instance.BackLayer.maskInteraction = SpriteMaskInteraction.VisibleInsideMask;
+                        return false;
+                    }
+                } else if (maskType == PlayerMaterial.MaskType.Exile) {
+                    if (__instance.FrontLayer) {
+                        __instance.FrontLayer.maskInteraction = SpriteMaskInteraction.VisibleOutsideMask;
+                    }
+                    if (__instance.BackLayer) {
+                        __instance.BackLayer.maskInteraction = SpriteMaskInteraction.VisibleOutsideMask;
+                        return false;
+                    }
+                } else {
+                    if (__instance.FrontLayer) {
+                        __instance.FrontLayer.maskInteraction = SpriteMaskInteraction.None;
+                    }
+                    if (__instance.BackLayer) {
+                        __instance.BackLayer.maskInteraction = SpriteMaskInteraction.None;
+                    }
+                }
+                return false;
+            }
+        }
+
+        [HarmonyPatch(typeof(HatParent), nameof(HatParent.SetFloorAnim))]
+        public class HatParentSetFloorAnimPatch {
+            public static bool Prefix(HatParent __instance) {
+                try {
+                    HatViewData vanillaAsset = __instance.hatDataAsset.GetAsset();
+                    return true;
+                } catch { }
+                HatViewData hatViewData = CustomHatViewDatas[__instance.Hat.name];
+                __instance.BackLayer.enabled = false;
+                __instance.FrontLayer.enabled = true;
+                __instance.FrontLayer.sprite = hatViewData.FloorImage;
+                return false;
+            }
+        }
+
+        [HarmonyPatch(typeof(HatParent), nameof(HatParent.SetIdleAnim))]
+        public class HatParentSetIdleAnimPatch {
+            public static bool Prefix(HatParent __instance, int colorId) {
+                if (!__instance.Hat) return false;
+                if (!CustomHatRegistry.ContainsKey(__instance.Hat.name))
+                    return true; 
+                HatViewData hatViewData = CustomHatViewDatas[__instance.Hat.name];
+                __instance.hatDataAsset = null;
+                __instance.PopulateFromHatViewData();
+                __instance.SetMaterialColor(colorId);
+                return false;
+            }
+        }
+
+        [HarmonyPatch(typeof(HatParent), nameof(HatParent.SetClimbAnim))]
+        public class HatParentSetClimbAnimPatch {
+            public static bool Prefix(HatParent __instance) {
+                try {
+                    HatViewData vanillaAsset = __instance.hatDataAsset.GetAsset();
+                    return true;
+                } catch { }
+
+                HatViewData hatViewData = CustomHatViewDatas[__instance.Hat.name];
+                if (!__instance.options.ShowForClimb) {
+                    return false;
+                }
+                __instance.BackLayer.enabled = false;
+                __instance.FrontLayer.enabled = true;
+                __instance.FrontLayer.sprite = hatViewData.ClimbImage;
+                return false;
+            }
+        }
+
+
+        [HarmonyPatch(typeof(HatParent), nameof(HatParent.PopulateFromHatViewData))]
+        public class PopulateFromHatViewDataPatch {
+            public static bool Prefix(HatParent __instance) {
+                try {
+                    HatViewData vanillaAsset = __instance.hatDataAsset.GetAsset();
+                    return true;
+                } catch { 
+                    if (__instance.Hat && !CustomHatViewDatas.ContainsKey(__instance.Hat.name))
+                        return true;
+                    }
+                
+
+                HatViewData asset = CustomHatViewDatas[__instance.Hat.name];
+
+                if (!asset) {
+                    return true;
+                }
+                __instance.UpdateMaterial();
+
+                SpriteAnimNodeSync spriteAnimNodeSync = __instance.SpriteSyncNode ?? __instance.GetComponent<SpriteAnimNodeSync>();
+                if (spriteAnimNodeSync) {
+                    spriteAnimNodeSync.NodeId = (__instance.Hat.NoBounce ? 1 : 0);
+                }
+                if (__instance.Hat.InFront) {
+                    __instance.BackLayer.enabled = false;
+                    __instance.FrontLayer.enabled = true;
+                    __instance.FrontLayer.sprite = asset.MainImage;
+                } else if (asset.BackImage) {
+                    __instance.BackLayer.enabled = true;
+                    __instance.FrontLayer.enabled = true;
+                    __instance.BackLayer.sprite = asset.BackImage;
+                    __instance.FrontLayer.sprite = asset.MainImage;
+                } else {
+                    __instance.BackLayer.enabled = true;
+                    __instance.FrontLayer.enabled = false;
+                    __instance.FrontLayer.sprite = null;
+                    __instance.BackLayer.sprite = asset.MainImage;
+                }
+                if (__instance.options.Initialized && __instance.HideHat()) {
+                    __instance.FrontLayer.enabled = false;
+                    __instance.BackLayer.enabled = false;
+                }
+                return false;
+            }
+        }
+
         [HarmonyPatch(typeof(HatsTab), nameof(HatsTab.OnEnable))]
         public class HatsTabOnEnablePatch {
             public static string innerslothPackageName = "Innersloth Hats";
index 8692cee380342101f3a5abdd6b0124216375d115..1328883ac83c8ed3a40e0674facc33dd444c7854 100644 (file)
@@ -1135,20 +1135,29 @@ namespace TheOtherRoles {
             int j = 0;
             for (int i = 0; i < blocks.Length; i++) {
                 curBlock = blocks[i];
-                if (Helpers.lineCount(curBlock) + Helpers.lineCount(curString) < 40) {
+                if (Helpers.lineCount(curBlock) + Helpers.lineCount(curString) < 43) {
                     curString += curBlock + "\n\n";
                 } else {
                     settingsTMPs[j].text = curString;
                     j++;
-                    
+
                     curString = "\n" + curBlock + "\n\n";
                     if (curString.Substring(0, 2) != "\n\n") curString = "\n" + curString;
                 }
             }
-            if (j < 3) settingsTMPs[j].text = curString;        
+            if (j < settingsTMPs.Length) settingsTMPs[j].text = curString;
+            int blockCount = 0;
+            foreach (var tmp in settingsTMPs) {
+                if (tmp.text != "")
+                    blockCount++;
+            }
+            for (int i = 0; i < blockCount; i++) {
+                TheOtherRolesPlugin.Logger.LogMessage(blockCount);
+                settingsTMPs[i].transform.localPosition = new Vector3(- blockCount * 1.2f + 2.7f * i, 2.2f, -500f);
+            }
         }
 
-        private static TMPro.TextMeshPro[] settingsTMPs = new TMPro.TextMeshPro[3];
+        private static TMPro.TextMeshPro[] settingsTMPs = new TMPro.TextMeshPro[4];
         private static GameObject settingsBackground;
         public static void OpenSettings(HudManager __instance) {
             if (__instance.FullScreen == null || MapBehaviour.Instance && MapBehaviour.Instance.IsOpen
@@ -1159,12 +1168,12 @@ namespace TheOtherRoles {
             var renderer = settingsBackground.GetComponent<SpriteRenderer>();
             renderer.color = new Color(0.2f, 0.2f, 0.2f, 0.9f);
             renderer.enabled = true;
-            for (int i = 0; i < 3; i++) {
+
+            for (int i = 0; i < settingsTMPs.Length; i++) {
                 settingsTMPs[i] = GameObject.Instantiate(__instance.KillButton.cooldownTimerText, __instance.transform);
                 settingsTMPs[i].alignment = TMPro.TextAlignmentOptions.TopLeft;
                 settingsTMPs[i].enableWordWrapping = false;
-                settingsTMPs[i].transform.localScale = Vector3.one * 0.25f;
-                settingsTMPs[i].transform.localPosition += new Vector3(-4f + 3f * i, 1.8f, -500f);
+                settingsTMPs[i].transform.localScale = Vector3.one * 0.25f; 
                 settingsTMPs[i].gameObject.SetActive(true);
             }
         }
@@ -1199,4 +1208,4 @@ namespace TheOtherRoles {
             toggleSettingsButtonObject.transform.localPosition = __instance.MapButton.transform.localPosition + new Vector3(0, -0.66f, -500f);
         }
     }
-}
\ No newline at end of file
+}
index dfe9ddddf8259acc2be2b0f7fbd2a318d2657d1e..3719bfeb85603ea860c8ef6dadbf57dc804ec94b 100644 (file)
@@ -14,7 +14,7 @@ namespace TheOtherRoles.Modules {
         [HarmonyPatch(typeof(ChatController), nameof(ChatController.SendChat))]
         private static class SendChatPatch {
             static bool Prefix(ChatController __instance) {
-                string text = __instance.TextArea.text;
+                string text = __instance.freeChatField.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
@@ -37,8 +37,8 @@ namespace TheOtherRoles.Modules {
                         }
                 }
                 if (handled) {
-                    __instance.TextArea.Clear();
-                    __instance.quickChatMenu.ResetGlyphs();
+                    __instance.freeChatField.Clear();
+                    __instance.quickChatMenu.Clear();
                 }
                 return !handled;
             }
index 57f5e2b63b6863c24a46e87c105bbf29dfe0a089..4404ff8ea737ff842a48b8b43d083b2b75b03d4a 100644 (file)
@@ -6,6 +6,7 @@ using System.Net.Http;
 using System.Reflection;
 using System.Threading.Tasks;
 using AmongUs.Data;
+using Assets.InnerNet;
 using BepInEx;
 using BepInEx.Bootstrap;
 using BepInEx.Unity.IL2CPP;
@@ -87,12 +88,10 @@ namespace TheOtherRoles.Modules
             
             var button = Instantiate(template, null);
             var buttonTransform = button.transform;
-            var pos = buttonTransform.localPosition;
-            pos.y += 1.2f;
-            buttonTransform.localPosition = pos;
+            //buttonTransform.localPosition = new Vector3(-2f, -2f);
+            button.GetComponent<AspectPosition>().anchorPoint = new Vector2(0.458f, 0.124f);
 
             PassiveButton passiveButton = button.GetComponent<PassiveButton>();
-            SpriteRenderer buttonSprite = button.GetComponent<SpriteRenderer>();
             passiveButton.OnClick = new Button.ButtonClickedEvent();
             passiveButton.OnClick.AddListener((Action) (() =>
             {
@@ -100,14 +99,13 @@ namespace TheOtherRoles.Modules
                 button.SetActive(false);
             }));
 
-            var text = button.transform.GetChild(0).GetComponent<TMP_Text>();
-            string t = "Update";
+            var text = button.transform.GetComponentInChildren<TMPro.TMP_Text>();
+            string t = "Update TOR";
             if (TORUpdate is null && SubmergedUpdate is not null) t = SubmergedCompatibility.Loaded ? $"Update\nSubmerged" : $"Download\nSubmerged";
 
             StartCoroutine(Effects.Lerp(0.1f, (System.Action<float>)(p => text.SetText(t))));
-
-            buttonSprite.color = text.color = Color.red;
-            passiveButton.OnMouseOut.AddListener((Action)(() => buttonSprite.color = text.color = Color.red));
+            passiveButton.OnMouseOut.AddListener((Action)(() => text.color = Color.red));
+            passiveButton.OnMouseOver.AddListener((Action)(() => text.color = Color.white));
 
             var isSubmerged = TORUpdate == null;
             var announcement = $"<size=150%>A new {(isSubmerged ? "Submerged" : "THE OTHER ROLES")} update to {(isSubmerged ? SubmergedUpdate.Tag : TORUpdate.Tag)} is available</size>\n{(isSubmerged ? SubmergedUpdate.Content : TORUpdate.Content)}";
@@ -161,25 +159,41 @@ namespace TheOtherRoles.Modules
 
         private static int announcementNumber = 501;
         [HideFromIl2Cpp]
-        public IEnumerator CoShowAnnouncement(string announcement, bool show=true, string shortTitle="TOR Update", string date="")
+        public IEnumerator CoShowAnnouncement(string announcement, bool show=true, string shortTitle="TOR Update", string title="", string date="")
         {
-            var popUp = Instantiate(FindObjectOfType<AnnouncementPopUp>(true));
-            popUp.gameObject.SetActive(show);
-            yield return popUp.Init(show);
-            
-            var announcementS = new Assets.InnerNet.Announcement();
-            announcementS.Title = "TOR Announcement";
-            announcementS.Text = announcement;    // Can add clickable urls like this: "[https://www.google.de/]Text[]"
-            announcementS.ShortTitle = shortTitle;
-            announcementS.Id = "torUpdateAnnouncement_" + announcementNumber.ToString();
-            announcementS.Language = 0;
-            announcementS.Number = announcementNumber++;
-            announcementS.SubTitle = "";
-            announcementS.PinState = true;
-            announcementS.Date = date == "" ? DateTime.Today.ToString() : date;
+            var mgr = FindObjectOfType<MainMenuManager>(true);
+            var popUpTemplate = UnityEngine.Object.FindObjectOfType<AnnouncementPopUp>(true);
+            if (popUpTemplate == null) {
+                TheOtherRolesPlugin.Logger.LogError("couldnt show credits, popUp is null");
+                yield return null;
+            }
+            var popUp = UnityEngine.Object.Instantiate(popUpTemplate);
 
-            DataManager.Player.Announcements.allAnnouncements.Insert(0, announcementS);
-            popUp.CreateAnnouncementList();
+            popUp.gameObject.SetActive(true);            
+
+            Assets.InnerNet.Announcement creditsAnnouncement = new() {
+                Id = "torAnnouncement",
+                Language = 0,
+                Number = announcementNumber++,
+                Title = title == "" ? "The Other Roles Announcement" : title,
+                ShortTitle = shortTitle,
+                SubTitle = "",
+                PinState = false,
+                Date = date == "" ? DateTime.Now.Date.ToString() : date,
+                Text = announcement,
+            };
+            mgr.StartCoroutine(Effects.Lerp(0.1f, new Action<float>((p) => {
+                if (p == 1) {
+                    var backup = DataManager.Player.Announcements.allAnnouncements;
+                    DataManager.Player.Announcements.allAnnouncements = new();
+                    popUp.Init(false);
+                    DataManager.Player.Announcements.SetAnnouncements(new Announcement[] { creditsAnnouncement });
+                    popUp.CreateAnnouncementList();
+                    popUp.UpdateAnnouncementText(creditsAnnouncement.Number);
+                    popUp.visibleAnnouncements[0].PassiveButton.OnClick.RemoveAllListeners();
+                    DataManager.Player.Announcements.allAnnouncements = backup;
+                }
+            })));
         }
 
         [HideFromIl2Cpp]
@@ -191,7 +205,6 @@ namespace TheOtherRoles.Modules
             {
                 Instance.TORUpdate = torUpdateCheck.Result;
             }
-            
             if (CheckForSubmergedUpdates)
             {
                 var submergedUpdateCheck = Task.Run(() => Instance.GetGithubUpdate("SubmergedAmongUs", "Submerged"));
@@ -202,7 +215,6 @@ namespace TheOtherRoles.Modules
                     if (Instance.SubmergedUpdate.Tag.Equals("2022.10.26")) Instance.SubmergedUpdate = null;
                 }
             }
-            
             Instance.OnSceneLoaded(SceneManager.GetActiveScene(), LoadSceneMode.Single);
         }
 
index 07d8c71d7d1c4ca31af879b6c5cae9d923e60653..69708f49b24448b030d813a72a933f8ac9001b24 100644 (file)
@@ -121,4 +121,4 @@ namespace TheOtherRoles.Objects {
             backgroundSprite = null;
         }
     }
-}
+}
\ No newline at end of file
diff --git a/TheOtherRoles/Patches/ConstantsPatch.cs b/TheOtherRoles/Patches/ConstantsPatch.cs
new file mode 100644 (file)
index 0000000..b310363
--- /dev/null
@@ -0,0 +1,11 @@
+using  HarmonyLib;
+
+namespace TheOtherRoles.Patches {
+    [HarmonyPatch(typeof(Constants), nameof(Constants.GetBroadcastVersion))]
+    public static class ConstantsPatch {
+        public static void Postfix(ref int __result) {
+            if (AmongUsClient.Instance.NetworkMode == NetworkModes.OnlineGame)
+                __result = Constants.GetVersion(2222, 0, 0, 0);
+        }
+    }
+}
index b11af6bf74b60a10fa715b8e8a471409b42fd2ff..d5c2ce819693ef98279e250c798abacacd1c9a3d 100644 (file)
@@ -4,6 +4,7 @@ using TheOtherRoles;
 using TheOtherRoles.CustomGameModes;
 using TheOtherRoles.Players;
 using TheOtherRoles.Utilities;
+using TMPro;
 using UnityEngine;
 
 namespace TheOtherRoles.Patches {
@@ -23,23 +24,6 @@ Design by <color=#FCCE03FF>Bavari</color>";
         public static string contributorsCredentials =
 $@"<size=60%> <color=#FCCE03FF>Special thanks to K3ndo & Smeggy</color></size>";
 
-        [HarmonyPatch(typeof(VersionShower), nameof(VersionShower.Start))]
-        private static class VersionShowerPatch
-        {
-            static void Postfix(VersionShower __instance) {
-                var amongUsLogo = GameObject.Find("bannerLogo_AmongUs");
-                if (amongUsLogo == null) return;
-
-                var credentials = UnityEngine.Object.Instantiate<TMPro.TextMeshPro>(__instance.text);
-                credentials.transform.position = new Vector3(0, 0, 0);
-                credentials.SetText($"v{TheOtherRolesPlugin.Version.ToString() + (TheOtherRolesPlugin.betaDays > 0 ? "-BETA" : "")}\n<size=30f%>\n</size>{mainMenuCredentials}\n<size=30%>\n</size>{contributorsCredentials}");
-                credentials.alignment = TMPro.TextAlignmentOptions.Center;
-                credentials.fontSize *= 0.75f;
-
-                credentials.transform.SetParent(amongUsLogo.transform);
-            }
-        }
-
         [HarmonyPatch(typeof(PingTracker), nameof(PingTracker.Update))]
         internal static class PingTrackerPatch
         {
@@ -91,14 +75,10 @@ $@"<size=60%> <color=#FCCE03FF>Special thanks to K3ndo & Smeggy</color></size>";
             public static Sprite banner2Sprite;
             private static PingTracker instance;
             static void Postfix(PingTracker __instance) {
-                var amongUsLogo = GameObject.Find("bannerLogo_AmongUs");
-                if (amongUsLogo != null) {
-                    amongUsLogo.transform.localScale *= 0.6f;
-                    amongUsLogo.transform.position += Vector3.up * 0.25f;
-                }
-
                 var torLogo = new GameObject("bannerLogo_TOR");
-                torLogo.transform.position = Vector3.up;
+                torLogo.transform.SetParent(GameObject.Find("RightPanel").transform, false);
+                torLogo.transform.localPosition = new Vector3(-0.4f, 1f, 5f);
+
                 renderer = torLogo.AddComponent<SpriteRenderer>();
                 loadSprites();
                 renderer.sprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.Banner.png", 300f);
@@ -107,6 +87,14 @@ $@"<size=60%> <color=#FCCE03FF>Special thanks to K3ndo & Smeggy</color></size>";
                 loadSprites();
                 // renderer.sprite = TORMapOptions.enableHorseMode ? horseBannerSprite : bannerSprite;
                 renderer.sprite = EventUtility.isEnabled ? banner2Sprite : bannerSprite;
+                var credentialObject = new GameObject("credentialsTOR");
+                var credentials = credentialObject.AddComponent<TextMeshPro>();
+                credentials.SetText($"v{TheOtherRolesPlugin.Version.ToString() + (TheOtherRolesPlugin.betaDays > 0 ? "-BETA" : "")}\n<size=30f%>\n</size>{mainMenuCredentials}\n<size=30%>\n</size>{contributorsCredentials}");
+                credentials.alignment = TMPro.TextAlignmentOptions.Center;
+                credentials.fontSize *= 0.05f;
+
+                credentials.transform.SetParent(torLogo.transform);
+                credentials.transform.localPosition = Vector3.down * 2;
             }
 
             public static void loadSprites() {
index b294f0be886e2e1764a75b421797b1fd6a145e3b..e2ad90a33fc07b29c1f0cdc476333206f756250d 100644 (file)
@@ -14,7 +14,7 @@ namespace TheOtherRoles.Patches {
     [HarmonyPriority(Priority.First)]
     class ExileControllerBeginPatch {
         public static GameData.PlayerInfo lastExiled;
-        public static void Prefix(ExileController __instance, [HarmonyArgument(0)] ref GameData.PlayerInfo exiled, [HarmonyArgument(1)] bool tie) {
+        public static void Prefix(ExileController __instance, [HarmonyArgument(0)]ref GameData.PlayerInfo exiled, [HarmonyArgument(1)]bool tie) {
             lastExiled = exiled;
 
             // Medic shield
@@ -38,13 +38,11 @@ namespace TheOtherRoles.Patches {
             // Eraser erase
             if (Eraser.eraser != null && AmongUsClient.Instance.AmHost && Eraser.futureErased != null) {  // We need to send the RPC from the host here, to make sure that the order of shifting and erasing is correct (for that reason the futureShifted and futureErased are being synced)
                 foreach (PlayerControl target in Eraser.futureErased) {
-                    if (target != null && target.canBeErased()) {
-                        MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.ErasePlayerRoles, Hazel.SendOption.Reliable, -1);
-                        writer.Write(target.PlayerId);
-                        AmongUsClient.Instance.FinishRpcImmediately(writer);
-                        RPCProcedure.erasePlayerRoles(target.PlayerId);
-                        Eraser.alreadyErased.Add(target.PlayerId);
-                    }
+                    MessageWriter writer = AmongUsClient.Instance.StartRpcImmediately(CachedPlayer.LocalPlayer.PlayerControl.NetId, (byte)CustomRPC.ErasePlayerRoles, Hazel.SendOption.Reliable, -1);
+                    writer.Write(target.PlayerId);
+                    AmongUsClient.Instance.FinishRpcImmediately(writer);
+                    RPCProcedure.erasePlayerRoles(target.PlayerId);
+                    Eraser.alreadyErased.Add(target.PlayerId);
                 }
             }
             Eraser.futureErased = new List<PlayerControl>();
@@ -64,7 +62,8 @@ namespace TheOtherRoles.Patches {
 
                 if ((witchDiesWithExiledLover || exiledIsWitch) && Witch.witchVoteSavesTargets) Witch.futureSpelled = new List<PlayerControl>();
                 foreach (PlayerControl target in Witch.futureSpelled) {
-                    if (target != null && !target.Data.IsDead && Helpers.checkMuderAttempt(Witch.witch, target, true) == MurderAttemptResult.PerformKill) {
+                    if (target != null && !target.Data.IsDead && Helpers.checkMuderAttempt(Witch.witch, target, true) == MurderAttemptResult.PerformKill)
+                    {
                         if (exiled != null && Lawyer.lawyer != null && (target == Lawyer.lawyer || target == Lovers.otherLover(Lawyer.lawyer)) && Lawyer.target != null && Lawyer.isProsecutor && Lawyer.target.PlayerId == exiled.PlayerId)
                             continue;
                         if (target == Lawyer.target && Lawyer.lawyer != null) {
@@ -102,7 +101,7 @@ namespace TheOtherRoles.Patches {
             TORMapOptions.camerasToAdd = new List<SurvCamera>();
 
             foreach (Vent vent in TORMapOptions.ventsToSeal) {
-                PowerTools.SpriteAnim animator = vent.GetComponent<PowerTools.SpriteAnim>();
+                PowerTools.SpriteAnim animator = vent.GetComponent<PowerTools.SpriteAnim>(); 
                 animator?.Stop();
                 vent.EnterVentAnim = vent.ExitVentAnim = null;
                 vent.myRend.sprite = animator == null ? SecurityGuard.getStaticVentSealedSprite() : SecurityGuard.getAnimatedVentSealedSprite();
@@ -180,14 +179,14 @@ namespace TheOtherRoles.Patches {
                     var rend = soul.AddComponent<SpriteRenderer>();
                     soul.AddSubmergedComponent(SubmergedCompatibility.Classes.ElevatorMover);
                     rend.sprite = Seer.getSoulSprite();
-
-                    if (Seer.limitSoulDuration) {
+                    
+                    if(Seer.limitSoulDuration) {
                         FastDestroyableSingleton<HudManager>.Instance.StartCoroutine(Effects.Lerp(Seer.soulDuration, new Action<float>((p) => {
                             if (rend != null) {
                                 var tmp = rend.color;
                                 tmp.a = Mathf.Clamp01(1 - p);
                                 rend.color = tmp;
-                            }
+                            }    
                             if (p == 1f && rend != null && rend.gameObject != null) UnityEngine.Object.Destroy(rend.gameObject);
                         })));
                     }
@@ -215,7 +214,8 @@ namespace TheOtherRoles.Patches {
             }
 
             // Deputy check Promotion, see if the sheriff still exists. The promotion will be after the meeting.
-            if (Deputy.deputy != null) {
+            if (Deputy.deputy != null)
+            {
                 PlayerControlFixedUpdatePatch.deputyCheckPromotion(isMeeting: true);
             }
 
@@ -256,7 +256,7 @@ namespace TheOtherRoles.Patches {
 
             foreach (Trap trap in Trap.traps) trap.triggerable = false;
             FastDestroyableSingleton<HudManager>.Instance.StartCoroutine(Effects.Lerp(GameOptionsManager.Instance.currentNormalGameOptions.KillCooldown / 2 + 2, new Action<float>((p) => {
-                if (p == 1f) foreach (Trap trap in Trap.traps) trap.triggerable = true;
+            if (p == 1f) foreach (Trap trap in Trap.traps) trap.triggerable = true;
             })));
         }
     }
@@ -271,7 +271,7 @@ namespace TheOtherRoles.Patches {
 
     [HarmonyPatch(typeof(TranslationController), nameof(TranslationController.GetString), new Type[] { typeof(StringNames), typeof(Il2CppReferenceArray<Il2CppSystem.Object>) })]
     class ExileControllerMessagePatch {
-        static void Postfix(ref string __result, [HarmonyArgument(0)] StringNames id) {
+        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);
@@ -292,4 +292,4 @@ namespace TheOtherRoles.Patches {
             }
         }
     }
-}
\ No newline at end of file
+}
index b378f326dbec31e4e3f4e9a75aec138f78721674..32040ba32ada7eabb75a4d04e3c083e503bc8f77 100644 (file)
@@ -71,11 +71,12 @@ namespace TheOtherRoles.Patches {
         [HarmonyPostfix]
         [HarmonyPatch(typeof(AbilityButton), nameof(AbilityButton.Update))]
         public static void showOrHideAbilityButtonPostfix(AbilityButton __instance) {
-            if (CachedPlayer.LocalPlayer.Data.IsDead && (CustomOptionHolder.finishTasksBeforeHauntingOrZoomingOut.getBool() || GameOptionsManager.Instance.currentGameOptions.GameMode == GameModes.HideNSeek)) {
+            bool isHideNSeek = GameOptionsManager.Instance.currentGameOptions.GameMode == GameModes.HideNSeek;
+            if (CachedPlayer.LocalPlayer.Data.IsDead && (CustomOptionHolder.finishTasksBeforeHauntingOrZoomingOut.getBool() || isHideNSeek)) {
                 // player has haunt button.
                 var (playerCompleted, playerTotal) = TasksHandler.taskInfo(CachedPlayer.LocalPlayer.Data);
                 int numberOfLeftTasks = playerTotal - playerCompleted;
-                if (numberOfLeftTasks <= 0)
+                if (numberOfLeftTasks <= 0 || isHideNSeek)
                     __instance.Show();
                 else
                     __instance.Hide();
index 19d6782ccb0f6e2273b57e3aa412cf75f9deec71..aa4ea4cb2798d2301a81b3e2c4a9a6161128ad24 100644 (file)
@@ -18,101 +18,71 @@ namespace TheOtherRoles.Modules {
         private static bool horseButtonState = TORMapOptions.enableHorseMode;
         //private static Sprite horseModeOffSprite = null;
         //private static Sprite horseModeOnSprite = null;
-        private static GameObject bottomTemplate;
         private static AnnouncementPopUp popUp;
 
         private static void Prefix(MainMenuManager __instance) {
             CustomHatLoader.LaunchHatFetcher();
             var template = GameObject.Find("ExitGameButton");
-            if (template == null) return;
+            var template2 = GameObject.Find("CreditsButton");
+            if (template == null || template2 == null) return;
+            template.transform.localScale = new Vector3(0.42f, 0.84f, 0.84f);
+            template.GetComponent<AspectPosition>().anchorPoint = new Vector2(0.625f, 0.5f);
+            template.transform.FindChild("FontPlacer").transform.localScale = new Vector3(1.8f, 0.9f, 0.9f);
+            template.transform.FindChild("FontPlacer").transform.localPosition = new Vector3(-1.1f, 0f, 0f);
 
-            var buttonDiscord = UnityEngine.Object.Instantiate(template, null);
-            buttonDiscord.transform.localPosition = new Vector3(buttonDiscord.transform.localPosition.x, buttonDiscord.transform.localPosition.y + 0.6f, buttonDiscord.transform.localPosition.z);
+            template2.transform.localScale = new Vector3(0.42f, 0.84f, 0.84f);
+            template2.GetComponent<AspectPosition>().anchorPoint = new Vector2(0.378f, 0.5f);
+            template2.transform.FindChild("FontPlacer").transform.localScale = new Vector3(1.8f, 0.9f, 0.9f);
+            template2.transform.FindChild("FontPlacer").transform.localPosition = new Vector3(-1.1f, 0f, 0f);
 
-            var textDiscord = buttonDiscord.transform.GetChild(0).GetComponent<TMPro.TMP_Text>();
-            __instance.StartCoroutine(Effects.Lerp(0.1f, new System.Action<float>((p) => {
-                textDiscord.SetText("Discord");
-            })));
 
-            PassiveButton passiveButtonDiscord = buttonDiscord.GetComponent<PassiveButton>();
-            SpriteRenderer buttonSpriteDiscord = buttonDiscord.GetComponent<SpriteRenderer>();
 
+            var buttonDiscord = UnityEngine.Object.Instantiate(template, template.transform.parent);
+            buttonDiscord.transform.localScale = new Vector3(0.42f, 0.84f, 0.84f);
+            buttonDiscord.GetComponent<AspectPosition>().anchorPoint = new Vector2(0.542f, 0.5f);
+
+            var textDiscord = buttonDiscord.transform.GetComponentInChildren<TMPro.TMP_Text>();
+            __instance.StartCoroutine(Effects.Lerp(0.5f, new System.Action<float>((p) => {
+                textDiscord.SetText("TOR Discord");
+            })));
+            PassiveButton passiveButtonDiscord = buttonDiscord.GetComponent<PassiveButton>();
+            
             passiveButtonDiscord.OnClick = new Button.ButtonClickedEvent();
             passiveButtonDiscord.OnClick.AddListener((System.Action)(() => Application.OpenURL("https://discord.gg/77RkMJHWsM")));
 
-            Color discordColor = new Color32(88, 101, 242, byte.MaxValue);
-            buttonSpriteDiscord.color = textDiscord.color = discordColor;
-            passiveButtonDiscord.OnMouseOut.AddListener((System.Action)delegate {
-                buttonSpriteDiscord.color = textDiscord.color = discordColor;
-            });
-
-
-            bottomTemplate = GameObject.Find("InventoryButton");
-            /*
-            // Horse mode stuff
-            var horseModeSelectionBehavior = new ClientOptionsPatch.SelectionBehaviour("Enable Horse Mode", () => TORMapOptions.enableHorseMode = TheOtherRolesPlugin.EnableHorseMode.Value = !TheOtherRolesPlugin.EnableHorseMode.Value, TheOtherRolesPlugin.EnableHorseMode.Value);
 
             
-            if (bottomTemplate == null) return;
-            var horseButton = Object.Instantiate(bottomTemplate, bottomTemplate.transform.parent);
-            var passiveHorseButton = horseButton.GetComponent<PassiveButton>();
-            var spriteHorseButton = horseButton.GetComponent<SpriteRenderer>();
-
-            horseModeOffSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.HorseModeButtonOff.png", 75f);
-            horseModeOnSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.HorseModeButtonOn.png", 75f);
-
-            spriteHorseButton.sprite = horseButtonState ? horseModeOnSprite : horseModeOffSprite;
-
-            passiveHorseButton.OnClick = new ButtonClickedEvent();
-
-            passiveHorseButton.OnClick.AddListener((System.Action)delegate {
-                horseButtonState = horseModeSelectionBehavior.OnClick();
-                if (horseButtonState) {
-                    if (horseModeOnSprite == null) horseModeOnSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.HorseModeButtonOn.png", 75f);
-                    spriteHorseButton.sprite = horseModeOnSprite;
-                } else {
-                    if (horseModeOffSprite == null) horseModeOffSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.HorseModeButtonOff.png", 75f);
-                    spriteHorseButton.sprite = horseModeOffSprite;
-                }
-                CredentialsPatch.LogoPatch.updateSprite();
-                // Avoid wrong Player Particles floating around in the background
-                var particles = GameObject.FindObjectOfType<PlayerParticles>();
-                if (particles != null) {
-                    particles.pool.ReclaimAll();
-                    particles.Start();
-                }
-            });*/
-
             // TOR credits button
-            if (bottomTemplate == null) return;
-            var creditsButton = Object.Instantiate(bottomTemplate, bottomTemplate.transform.parent);
-            var passiveCreditsButton = creditsButton.GetComponent<PassiveButton>();
-            var spriteCreditsButton = creditsButton.GetComponent<SpriteRenderer>();
+            if (template == null) return;
+            var creditsButton = Object.Instantiate(template, template.transform.parent);
 
-            spriteCreditsButton.sprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.CreditsButton.png", 75f);
+            creditsButton.transform.localScale = new Vector3(0.42f, 0.84f, 0.84f);
+            creditsButton.GetComponent<AspectPosition>().anchorPoint = new Vector2(0.462f, 0.5f);
+
+            var textCreditsButton = creditsButton.transform.GetComponentInChildren<TMPro.TMP_Text>();
+            __instance.StartCoroutine(Effects.Lerp(0.5f, new System.Action<float>((p) => {
+                textCreditsButton.SetText("TOR Credits");
+            })));
+            PassiveButton passiveCreditsButton = creditsButton.GetComponent<PassiveButton>();
 
-            passiveCreditsButton.OnClick = new ButtonClickedEvent();
+            passiveCreditsButton.OnClick = new Button.ButtonClickedEvent();
 
             passiveCreditsButton.OnClick.AddListener((System.Action)delegate {
                 // do stuff
                 if (popUp != null) Object.Destroy(popUp);
-                popUp = Object.Instantiate(Object.FindObjectOfType<AnnouncementPopUp>(true));
-                popUp.gameObject.SetActive(true);
+                var popUpTemplate = Object.FindObjectOfType<AnnouncementPopUp>(true);
+                if (popUpTemplate == null) {
+                    TheOtherRolesPlugin.Logger.LogError("couldnt show credits, popUp is null");
+                    return;
+                }
+                popUp = Object.Instantiate(popUpTemplate);
 
-                Assets.InnerNet.Announcement creditsAnnouncement = new Assets.InnerNet.Announcement();
-                creditsAnnouncement.Id = "torCredits";
-                creditsAnnouncement.Language = 0;
-                creditsAnnouncement.Number = 500;
-                creditsAnnouncement.Title = "The Other Roles Credits & Resources";
-                creditsAnnouncement.ShortTitle = "TOR Credits";
-                creditsAnnouncement.SubTitle = "";
-                creditsAnnouncement.PinState = false;
-                creditsAnnouncement.Date = "03.07.2020";
-                string creditsString = @$"<align=""center"">Github Contributors:
+                popUp.gameObject.SetActive(true);
+                string creditsString = @$"<align=""center""><b>Github Contributors:</b>
 Alex2911    amsyarasyiq    MaximeGillot
 Psynomit    probablyadnf    JustASysAdmin
 
-Discord Moderators:
+[https://discord.gg/77RkMJHWsM]Discord[] Moderators:
 Streamblox    Draco Cordraconis
 Thanks to all our discord helpers!
 
@@ -136,42 +106,37 @@ TooManyRolesMods - Idea for the Detective and Time Master roles comes from Harde
 TownOfUs - Idea for the Swapper, Shifter, Arsonist and a similar Mayor role came from Slushiegoose
 Ottomated - Idea for the Morphling, Snitch and Camouflager role came from Ottomated
 Crowded-Mod - Our implementation for 10+ player lobbies was inspired by the one from the Crowded Mod Team
-Goose-Goose-Duck - Idea for the Vulture role came from Slushiegoose</size>";
+Goose-Goose-Duck - Idea for the Vulture role came from Slushiegoose
+TheEpicRoles - Idea for the first kill shield (partly) and the tabbed option menu (fully + some code), by LaicosVK DasMonschta Nova</size>";
                 creditsString += "</align>";
-                creditsAnnouncement.Text = creditsString;
-                __instance.StartCoroutine(Effects.Lerp(0.01f, new Action<float>((p) => {
+
+                Assets.InnerNet.Announcement creditsAnnouncement = new() {
+                    Id = "torCredits",
+                    Language = 0,
+                    Number = 500,
+                    Title = "The Other Roles\nCredits & Resources",
+                    ShortTitle = "TOR Credits",
+                    SubTitle = "",
+                    PinState = false,
+                    Date = "01.07.2021",
+                    Text = creditsString,
+                };
+                __instance.StartCoroutine(Effects.Lerp(0.1f, new Action<float>((p) => {
                     if (p == 1) {
                         var backup = DataManager.Player.Announcements.allAnnouncements;
-                        popUp.Init(false);
                         DataManager.Player.Announcements.allAnnouncements = new();
-                        DataManager.Player.Announcements.allAnnouncements.Insert(0, creditsAnnouncement);
-                        foreach (var item in popUp.visibleAnnouncements) Object.Destroy(item);
-                        foreach (var item in Object.FindObjectsOfType<AnnouncementPanel>()) {
-                            if (item != popUp.ErrorPanel) Object.Destroy(item.gameObject);
-                        }
+                        popUp.Init(false);
+                        DataManager.Player.Announcements.SetAnnouncements(new Announcement[] { creditsAnnouncement });
                         popUp.CreateAnnouncementList();
+                        popUp.UpdateAnnouncementText(creditsAnnouncement.Number);
                         popUp.visibleAnnouncements[0].PassiveButton.OnClick.RemoveAllListeners();
                         DataManager.Player.Announcements.allAnnouncements = backup;
-                        var titleText = GameObject.Find("Title_Text").GetComponent<TMPro.TextMeshPro>();
-                        if (titleText != null) titleText.text = "";
                     }
                 })));
             });
             
         }
 
-        public static void Postfix(MainMenuManager __instance) {
-            __instance.StartCoroutine(Effects.Lerp(0.01f, new Action<float>((p) => {
-                if (p == 1) {
-                    bottomTemplate = GameObject.Find("InventoryButton");
-                    foreach (Transform tf in bottomTemplate.transform.parent.GetComponentsInChildren<Transform>()) {
-                        tf.localPosition = new Vector2(tf.localPosition.x * 0.8f, tf.localPosition.y);
-                    }
-                }
-            })));
-
-        }
-
         public static void addSceneChangeCallbacks() {
             SceneManager.add_sceneLoaded((Action<Scene, LoadSceneMode>)((scene, _) => {
                 if (!scene.name.Equals("MatchMaking", StringComparison.Ordinal)) return;
@@ -211,19 +176,4 @@ Goose-Goose-Duck - Idea for the Vulture role came from Slushiegoose</size>";
             }));
         }
     }
-
-    /*[HarmonyPatch(typeof(AnnouncementPopUp), nameof(AnnouncementPopUp.UpdateAnnounceText))]
-    public static class Announcement
-    {
-        public static ModUpdateBehaviour.UpdateData updateData = null;
-        public static bool Prefix(AnnouncementPopUp __instance)
-        {
-            if (ModUpdateBehaviour.showPopUp || updateData == null) return true;
-
-            var text = __instance.AnnounceTextMeshPro;            
-            text.text = $"<size=150%><color=#FC0303>THE OTHER ROLES </color> {(updateData.Tag)}\n{(updateData.Content)}";
-
-            return false;
-        }
-    }*/
 }
index ecefe9fd068de5a4636f380ce68936b323bc1f25..717a08c843b6724bb594e9ee501af7086090dbde 100644 (file)
@@ -9,6 +9,7 @@ using System;
 using TheOtherRoles.Players;
 using TheOtherRoles.Utilities;
 using UnityEngine;
+using Innersloth.Assets;
 
 namespace TheOtherRoles.Patches {
     [HarmonyPatch]
@@ -424,7 +425,7 @@ namespace TheOtherRoles.Patches {
                 Transform button = UnityEngine.Object.Instantiate(buttonTemplate, buttonParent);
                 Transform buttonMask = UnityEngine.Object.Instantiate(maskTemplate, buttonParent);
                 TMPro.TextMeshPro label = UnityEngine.Object.Instantiate(textTemplate, button);
-                button.GetComponent<SpriteRenderer>().sprite = FastDestroyableSingleton<HatManager>.Instance.GetNamePlateById("nameplate_NoPlate")?.viewData?.viewData?.Image;
+                button.GetComponent<SpriteRenderer>().sprite = ShipStatus.Instance.CosmeticsCache.GetNameplate("nameplate_NoPlate").Image;
                 buttons.Add(button);
                 int row = i/5, col = i%5;
                 buttonParent.localPosition = new Vector3(-3.47f + 1.75f * col, 1.5f - 0.45f * row, -5);
@@ -548,7 +549,8 @@ namespace TheOtherRoles.Patches {
 
                 Transform meetingExtraButtonMask = UnityEngine.Object.Instantiate(maskTemplate, meetingExtraButtonParent);
                 meetingExtraButtonLabel = UnityEngine.Object.Instantiate(textTemplate, meetingExtraButton);
-                meetingExtraButton.GetComponent<SpriteRenderer>().sprite = FastDestroyableSingleton<HatManager>.Instance.GetNamePlateById("nameplate_NoPlate")?.viewData?.viewData?.Image;
+                meetingExtraButton.GetComponent<SpriteRenderer>().sprite = ShipStatus.Instance.CosmeticsCache.GetNameplate("nameplate_NoPlate").Image;
+
                 meetingExtraButtonParent.localPosition = new Vector3(0, -2.225f, -5);
                 meetingExtraButtonParent.localScale = new Vector3(0.55f, 0.55f, 1f);
                 meetingExtraButtonLabel.alignment = TMPro.TextAlignmentOptions.Center;
@@ -575,7 +577,7 @@ namespace TheOtherRoles.Patches {
                     }
                 })));
             }
-            
+
             //Fix visor in Meetings 
             /**
             foreach (PlayerVoteArea pva in __instance.playerStates) {
@@ -584,6 +586,8 @@ namespace TheOtherRoles.Patches {
                 }
             } */
 
+            bool isGuesser = HandleGuesser.isGuesser(CachedPlayer.LocalPlayer.PlayerId);
+
             // Add overlay for spelled players
             if (Witch.witch != null && Witch.futureSpelled != null) {
                 foreach (PlayerVoteArea pva in __instance.playerStates) {
@@ -592,13 +596,13 @@ namespace TheOtherRoles.Patches {
                         rend.transform.SetParent(pva.transform);
                         rend.gameObject.layer = pva.Megaphone.gameObject.layer;
                         rend.transform.localPosition = new Vector3(-0.5f, -0.03f, -1f);
+                        if (CachedPlayer.LocalPlayer.PlayerControl == Swapper.swapper && isGuesser) rend.transform.localPosition = new Vector3(-0.725f, -0.15f, -1f);
                         rend.sprite = Witch.getSpelledOverlaySprite();
                     }
                 }
             }
 
             // Add Guesser Buttons
-            bool isGuesser = HandleGuesser.isGuesser(CachedPlayer.LocalPlayer.PlayerId);
             int remainingShots = HandleGuesser.remainingShots(CachedPlayer.LocalPlayer.PlayerId);
 
             if (isGuesser && !CachedPlayer.LocalPlayer.Data.IsDead && remainingShots > 0) {
@@ -707,7 +711,6 @@ namespace TheOtherRoles.Patches {
                             else message += p.Data.PlayerName + "\n";
                         }
                         FastDestroyableSingleton<HudManager>.Instance.Chat.AddChat(Trapper.trapper, $"{message}");
-
                     }
                 }
 
@@ -739,7 +742,6 @@ namespace TheOtherRoles.Patches {
                     }
                 }
 
-
                 if (CachedPlayer.LocalPlayer.Data.IsDead && output != "") FastDestroyableSingleton<HudManager>.Instance.Chat.AddChat(CachedPlayer.LocalPlayer, $"{output}");
 
                 Trapper.playersOnMap = new List<PlayerControl>();
index 1da097dba262c02d34c214d7dd830f19a9ada4ee..726772bf43f91f27e91a9e70e293aa5aa6bad7ba 100644 (file)
@@ -886,8 +886,6 @@ namespace TheOtherRoles.Patches {
             }
         }
 
-        
-
         public static void trapperUpdate() {
             if (Trapper.trapper == null || CachedPlayer.LocalPlayer.PlayerControl != Trapper.trapper || Trapper.trapper.Data.IsDead) return;
             var (playerCompleted, _) = TasksHandler.taskInfo(Trapper.trapper.Data);
@@ -958,6 +956,7 @@ namespace TheOtherRoles.Patches {
                 }
             }
         }
+
         public static void Postfix(PlayerControl __instance) {
             if (AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.GameStates.Started || GameOptionsManager.Instance.currentGameOptions.GameMode == GameModes.HideNSeek) return;
 
index f3bda2d87c098c4bff1268ce66378f5cd500131f..71573d71edbe9be891c98483c9a5cc59882b804b 100644 (file)
@@ -295,6 +295,7 @@ namespace TheOtherRoles.Patches {
         }
 
         static void updateReportButton(HudManager __instance) {
+            if (GameOptionsManager.Instance.currentGameOptions.GameMode == GameModes.HideNSeek) return;
             if (Deputy.handcuffedKnows.ContainsKey(CachedPlayer.LocalPlayer.PlayerId) && Deputy.handcuffedKnows[CachedPlayer.LocalPlayer.PlayerId] > 0 || MeetingHud.Instance) __instance.ReportButton.Hide();
             else if (!__instance.ReportButton.isActiveAndEnabled) __instance.ReportButton.Show();
         }
@@ -322,7 +323,7 @@ namespace TheOtherRoles.Patches {
 
         static void Postfix(HudManager __instance)
         {
-            if (AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.GameStates.Started) return;
+            if (AmongUsClient.Instance.GameState != InnerNet.InnerNetClient.GameStates.Started || GameOptionsManager.Instance.currentGameOptions.GameMode == GameModes.HideNSeek) return;
             
             EventUtility.Update();
 
@@ -347,6 +348,14 @@ namespace TheOtherRoles.Patches {
             updateUseButton(__instance);
             updateMapButton(__instance);
             if (!MeetingHud.Instance) __instance.AbilityButton?.Update();
+
+            // Fix dead player's pets being visible by just always updating whether the pet should be visible at all.
+            foreach (PlayerControl target in CachedPlayer.AllPlayers) {
+                var pet = target.GetPet();
+                if (pet != null) {
+                    pet.Visible = (PlayerControl.LocalPlayer.Data.IsDead && target.Data.IsDead || !target.Data.IsDead) && !target.inVent;
+                }
+            }
         }
     }
 }
index b149343c3cdf5850357423673d476b5099a240d4..86158d90c999dcac22703de75213c8d490ddac19 100644 (file)
@@ -685,7 +685,7 @@ namespace TheOtherRoles
         
         public static void erasePlayerRoles(byte playerId, bool ignoreModifier = true) {
             PlayerControl player = Helpers.playerById(playerId);
-            if (player == null) return;
+            if (player == null || !player.canBeErased()) return;
 
             // Crewmate roles
             if (player == Mayor.mayor) Mayor.clearAndReload();
@@ -903,7 +903,10 @@ namespace TheOtherRoles
         public static void arsonistWin() {
             Arsonist.triggerArsonistWin = true;
             foreach (PlayerControl p in CachedPlayer.AllPlayers) {
-                if (p != Arsonist.arsonist) p.Exiled();
+                if (p != Arsonist.arsonist) {
+                    p.Exiled();
+                    overrideDeathReasonAndKiller(p, DeadPlayer.CustomDeathReason.Arson, Arsonist.arsonist);
+                }
             }
         }
 
@@ -1191,7 +1194,9 @@ namespace TheOtherRoles
         }
 
         public static void defuseBomb() {
-            SoundEffectsManager.playAtPosition("bombDefused", Bomber.bomb.bomb.transform.position, range: Bomber.hearRange);
+            try {
+                SoundEffectsManager.playAtPosition("bombDefused", Bomber.bomb.bomb.transform.position, range: Bomber.hearRange);
+            } catch { }
             Bomber.clearBomb();
             bomberButton.Timer = bomberButton.MaxTimer;
             bomberButton.isEffectActive = false;
index 53d87bed126abf431a8422e95e464026f675ed2f..d2c3c807777e892217314402b5eaf4c6719f04f3 100644 (file)
@@ -270,6 +270,7 @@ namespace TheOtherRoles
                         roleName = roleName + Helpers.cs(Arsonist.color, $" ({CachedPlayer.AllPlayers.Count(x => { return x.PlayerControl != Arsonist.arsonist && !x.Data.IsDead && !x.Data.Disconnected && !Arsonist.dousedPlayers.Any(y => y.PlayerId == x.PlayerId); })} left)");
                     if (p == Jackal.fakeSidekick)
                         roleName = Helpers.cs(Sidekick.color, $" (fake SK)") + roleName;
+
                     // Death Reason on Ghosts
                     if (p.Data.IsDead) {
                         string deathReasonString = "";
@@ -312,6 +313,9 @@ namespace TheOtherRoles
                                 case DeadPlayer.CustomDeathReason.Bomb:
                                     deathReasonString = $" - bombed by {Helpers.cs(killerColor, deadPlayer.killerIfExisting.Data.PlayerName)}";
                                     break;
+                                case DeadPlayer.CustomDeathReason.Arson:
+                                    deathReasonString = $" - burnt by {Helpers.cs(killerColor, deadPlayer.killerIfExisting.Data.PlayerName)}";
+                                    break;
                             }
                             roleName = roleName + deathReasonString;
                         }
index 74a639b457fae9810cb25ca8df6b96fa7b0b00aa..fe23c004ec49bfd6001c8dd4b78410a377bdc5fc 100644 (file)
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
     <PropertyGroup>
         <TargetFramework>net6.0</TargetFramework>
-        <Version>4.3.2</Version>
+        <Version>4.3.3</Version>
         <Description>TheOtherRoles</Description>
         <Authors>Eisbison</Authors>
                <LangVersion>latest</LangVersion>
     </ItemGroup>
    
        <ItemGroup>
-        <PackageReference Include="AmongUs.GameLibs.Steam" Version="2023.03.28" />
-        <PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.664" />
-        <PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.0.1" />
-        <PackageReference Include="Reactor" Version="2.1.0" />
+               <PackageReference Include="AmongUs.GameLibs.Steam" Version="2023.7.11" />
+        <PackageReference Include="BepInEx.Unity.IL2CPP" Version="6.0.0-be.670" />
+               <PackageReference Include="BepInEx.IL2CPP.MSBuild" Version="2.1.0-rc.1" />
+        <PackageReference Include="Reactor" Version="2.2.0-ci.235" />
     </ItemGroup>
-
+   
     <Target Name="Date" BeforeTargets="BeforeBuild">  <!--Will make the compile time available s.t. we can let betas expire-->
     <WriteLinesToFile File="$(IntermediateOutputPath)gen.cs" Lines="static partial class Builtin { public static long CompileTime = $([System.DateTime]::UtcNow.Ticks) %3B }" Overwrite="true" />
     <ItemGroup>
index 406faf4d93f4864ca3a223838eb29e444244778f..74bc842deecd6bc9e102e8c77c174f14b740f11c 100644 (file)
@@ -4,51 +4,81 @@
     "net6.0": {
       "AmongUs.GameLibs.Steam": {
         "type": "Direct",
-        "requested": "[2023.3.28, )",
-        "resolved": "2023.3.28",
-        "contentHash": "EIaXNPlV9DMxlPfrC1yGZPXUIKbN7hAbmizYoL72gmxZVWiLLiJ8VbelM86OgyLocQ8+ma/UD7laPYIbePlrxw=="
+        "requested": "[2023.7.11, )",
+        "resolved": "2023.7.11",
+        "contentHash": "e5zbU+4AYnp1zAQDizO5GRIh1kemkgCa8rFVAcr9bxeupkBu5dwwdHxArWv/pUybIJTZfOPjkOnicZ2qKWLX7g=="
       },
       "BepInEx.IL2CPP.MSBuild": {
         "type": "Direct",
-        "requested": "[2.0.1, )",
-        "resolved": "2.0.1",
-        "contentHash": "hUZjCV0t8dkw/Z/zq4Zl405QP7frBk/LVfMdUmUz+7XOhGd7lYPKrR48A5vbGl2QeHudMxlkXzAr9WM3Duq2SQ=="
+        "requested": "[2.1.0-rc.1, )",
+        "resolved": "2.1.0-rc.1",
+        "contentHash": "WI/7TbJwWl5P4B6UXGtKI1VMe6fA6h3fcbp3ZjJKqOBQ5MJfDMmeVB4fb+RW1tUQdxnlSWV3Ul62PHFyTqp4PA=="
       },
       "BepInEx.Unity.IL2CPP": {
         "type": "Direct",
-        "requested": "[6.0.0-be.664, )",
-        "resolved": "6.0.0-be.664",
-        "contentHash": "y9vnaW6q+/Y3kjStV67kY5qdT/MxoEiEYTgLegHpNrCq+tM4g2x0p2sAU59VeONrWF+h06UQ3HNeoAww5S6Gwg==",
+        "requested": "[6.0.0-be.670, )",
+        "resolved": "6.0.0-be.670",
+        "contentHash": "dhzCrem44oFxhOICCJ9eoSUbaKSsGGyBUfUQW9WFljCwIK8o4Cx5BiuXAkYoRjr2DhpzLpPDyPZDRImUqH0bwA==",
         "dependencies": {
-          "BepInEx.Core": "6.0.0-be.664",
-          "BepInEx.Unity.Common": "6.0.0-be.664",
+          "BepInEx.Core": "6.0.0-be.670",
+          "BepInEx.Unity.Common": "6.0.0-be.670",
           "HarmonyX": "2.10.1",
-          "Iced": "1.17.0",
-          "Il2CppInterop.Generator": "1.4.1",
-          "Il2CppInterop.HarmonySupport": "1.4.1",
-          "Il2CppInterop.Runtime": "1.4.1",
+          "Iced": "1.18.0",
+          "Il2CppInterop.Generator": "1.4.6-ci.354",
+          "Il2CppInterop.HarmonySupport": "1.4.6-ci.354",
+          "Il2CppInterop.Runtime": "1.4.6-ci.354",
           "MonoMod.RuntimeDetour": "22.5.1.1",
-          "Samboy063.Cpp2IL.Core": "2022.0.7.2"
+          "Samboy063.Cpp2IL.Core": "2022.1.0-development.866"
         }
       },
       "Reactor": {
         "type": "Direct",
-        "requested": "[2.1.0, )",
-        "resolved": "2.1.0",
-        "contentHash": "sJaWGAn+c8efXKZS+sFcz+ybHYdp7CFJVdcX5+r0QbyPpruo/GotNdhrxvUUlCVAhhX/e0epIFKGRZJcprhp9w==",
+        "requested": "[2.2.0-ci.235, )",
+        "resolved": "2.2.0-ci.235",
+        "contentHash": "aa0VHgBs5QwuMHt7evQ/mldAHBqsWdLvnh7NS0RrVSwxi46KfTdALc1sebjzLrWs949USdwGXtFIePEMizGqrA==",
+        "dependencies": {
+          "BepInEx.Unity.IL2CPP": "6.0.0-be.670"
+        }
+      },
+      "AsmResolver": {
+        "type": "Transitive",
+        "resolved": "5.1.0",
+        "contentHash": "7PjujQzgQ3wjzqZYT4CY8SV6zx7FY6swIwj3Yk4QLolLqo9sBPb7FLF3W30QFvCsCkNfiVWXlSbeZKs4xGgQOQ=="
+      },
+      "AsmResolver.DotNet": {
+        "type": "Transitive",
+        "resolved": "5.1.0",
+        "contentHash": "oKrBU94OaSrbbTwydvpLRFalYxozrNXGkl13nIkm823ZFQtPNYOiOMJb5DQLvkCJlWyis7q865tg803T5zg9IA==",
+        "dependencies": {
+          "AsmResolver.PE": "5.1.0",
+          "System.Text.Json": "6.0.7"
+        }
+      },
+      "AsmResolver.PE": {
+        "type": "Transitive",
+        "resolved": "5.1.0",
+        "contentHash": "XD3iAgLSInJIODKUUlpHWXf8MR9H1SFMb1lsmabb4GxxxnDQRPjMxjglv2NOCjQQuNB2Oh0bvjHE7ewf82UqyQ==",
         "dependencies": {
-          "BepInEx.Unity.IL2CPP": "6.0.0-be.663"
+          "AsmResolver.PE.File": "5.1.0"
+        }
+      },
+      "AsmResolver.PE.File": {
+        "type": "Transitive",
+        "resolved": "5.1.0",
+        "contentHash": "YituBYe0Fh471sXQMfu+f4tWKX/JZvRwrX6g/SVsr4XkUIUzYi/aGT3/QvjHoYx19fE1KYOB6zBKqPkkOK7HPw==",
+        "dependencies": {
+          "AsmResolver": "5.1.0"
         }
       },
       "AssetRipper.VersionUtilities": {
         "type": "Transitive",
-        "resolved": "1.2.1",
-        "contentHash": "knQ/W1YwTZS2AbdaZh+nhyyBEZQPQDcahhSOnh88i+cdg4/FEoFJiCwaavgFvCMNuUeHTbcZc4qttF8WQ8xLIA=="
+        "resolved": "1.3.1",
+        "contentHash": "/1D18NOpqm7rS7+qVUbAReVMNWwgDuYpsnf0RkX1Aah/I0a0irqldoFJ+Kku7YdbSm0zqD+Z6iYUGKoP3GwTNQ=="
       },
       "BepInEx.Core": {
         "type": "Transitive",
-        "resolved": "6.0.0-be.664",
-        "contentHash": "44xtnHIQnOYfMGpQBzaDbKosdaoDE8huf3OyfpYtlQ3rZkWU79jjUGjH5+QYg+HzBQw1kqa/mlMujr5dhpU/Tg==",
+        "resolved": "6.0.0-be.670",
+        "contentHash": "7CbbMNZfb+1VHjFKh/ErFBOOEYrVCIkng/B3/HPcbNioySC7qdT1ztfYqs6YjQia4krEic+LV3ew86B/hTg+hw==",
         "dependencies": {
           "HarmonyX": "2.10.1",
           "MonoMod.Utils": "22.5.1.1",
       },
       "BepInEx.Unity.Common": {
         "type": "Transitive",
-        "resolved": "6.0.0-be.664",
-        "contentHash": "MSA/w+6Zejm59NRjmh2tKwWOR1WPzT9PTGjGdiPzytRv9k2oA8UZsOl1N1pLNUkBrgVZJdjzSJHg61VA0eYUMg==",
+        "resolved": "6.0.0-be.670",
+        "contentHash": "FSzWILgwepZ7CpA34ew1WyO75lNjxkfX86uwo2172lbhmLkgoAdQbNun8dxKJCDlIevmTDga76yr/WPrTXELvA==",
         "dependencies": {
           "AssetRipper.VersionUtilities": "1.2.1",
           "MonoMod.Utils": "22.5.1.1"
         }
       },
+      "Disarm": {
+        "type": "Transitive",
+        "resolved": "2022.1.0-master.26",
+        "contentHash": "YnZEbRGr0nG+N3G8WbRQ4Lkg8dTD3oso9iJlCVBmyhEyhLyqs+drBs1kWQbQqFPnb9mi/RJ++R9bPb+L3HF03Q=="
+      },
       "HarmonyX": {
         "type": "Transitive",
         "resolved": "2.10.1",
       },
       "Iced": {
         "type": "Transitive",
-        "resolved": "1.17.0",
-        "contentHash": "8x+HCVTl/HHTGpscH3vMBhV8sknN/muZFw9s3TsI8SA6+c43cOTCi2+jE4KsU8pNLbJ++iF2ZFcpcXHXtDglnw=="
+        "resolved": "1.18.0",
+        "contentHash": "G60lZOvbvqttA+SBSv/yY6/wUboXKJlkffhSNR9iOrx0M5gpcK1TRr6xrFR+qAhqIAhvrsPF1jkn9fYb4lEufQ=="
       },
       "Il2CppInterop.Common": {
         "type": "Transitive",
-        "resolved": "1.4.1",
-        "contentHash": "Vy6m6IgyUStu5u4K1WhfmlGCrWAujwDCv/qImdVmU6EMVgOzsx8wNa/ckGIg5eKVh3GRFBhdoDy6Ej6kk3oJTA==",
+        "resolved": "1.4.6-ci.354",
+        "contentHash": "aCP3kr39YQw5GVqE9Q8c5y7f9CEKdFxpUhIqYgQBtrEz5Z/KCbHhjuOf/lSuFrjl6Vub/BKk6k+UbMRdoSvC1w==",
         "dependencies": {
           "Iced": "1.17.0",
           "Microsoft.Extensions.Logging.Abstractions": "6.0.1",
       },
       "Il2CppInterop.Generator": {
         "type": "Transitive",
-        "resolved": "1.4.1",
-        "contentHash": "KIOCVq2KM7bHMsEggghq7HWxRyZIsigfb6ZNRhyMOUwrdXCfc9YAuN2jO5ZlhN+W2ItroTEGG4xAmsKz3fJ80g==",
+        "resolved": "1.4.6-ci.354",
+        "contentHash": "y30sxc9mMv0bUzCPDr73xiI6fiu7ksmnEm6XULTGU/5JEGv2aw++/71bLOEYCscNbZTa2JT4yYrLCXCj3GSekg==",
         "dependencies": {
-          "Il2CppInterop.Common": "1.4.1",
+          "Il2CppInterop.Common": "1.4.6-ci.354",
           "Mono.Cecil": "0.11.3"
         }
       },
       "Il2CppInterop.HarmonySupport": {
         "type": "Transitive",
-        "resolved": "1.4.1",
-        "contentHash": "6uvmnk1XsR6LGmZHJToxfY4IdvsjNVUr5V0mf2hLZasqXY6O25RBc6eMGC8daFuwof+sKpp4gVacoxDs4tXbZw==",
+        "resolved": "1.4.6-ci.354",
+        "contentHash": "mQV5A+B/qtI6kSXEGx/UswiqjFKw13/yyviawnStfRKbLMW+XFsdMgGSkOVZd/TiDtF9ZG4Xt7DbkbFu26WjyA==",
         "dependencies": {
           "HarmonyX": "2.10.0",
-          "Il2CppInterop.Runtime": "1.4.1"
+          "Il2CppInterop.Runtime": "1.4.6-ci.354"
         }
       },
       "Il2CppInterop.Runtime": {
         "type": "Transitive",
-        "resolved": "1.4.1",
-        "contentHash": "TbEIlv7FAoKS85/290uX8MyUwuOBHXbfiP2me9+2SiL/UwqsS6r87DEAY0B+S0VJG7JnngxBTnr5yA2iruuRlg==",
+        "resolved": "1.4.6-ci.354",
+        "contentHash": "Xe5md9z+KIthdEcjfUjmoOhvM3gTI3SPyocqvuzEHoov5jQ/HhIPv5hUZzTSm+2nzn3XplENNE8vlBPvQ1o6OA==",
         "dependencies": {
           "Iced": "1.17.0",
-          "Il2CppInterop.Common": "1.4.1"
+          "Il2CppInterop.Common": "1.4.6-ci.354"
         }
       },
-      "IndexRange": {
-        "type": "Transitive",
-        "resolved": "1.0.0",
-        "contentHash": "6TgS1JLSUkpmPLfXBPaAgB39ZUix8E4soXWk2XSDcscVe84i1JKzIAtA7jHbRHSkOOrcr6YA0MpLCeq98y9mYQ=="
-      },
       "js6pak.Gee.External.Capstone": {
         "type": "Transitive",
         "resolved": "2.1.0",
       },
       "Samboy063.Cpp2IL.Core": {
         "type": "Transitive",
-        "resolved": "2022.0.7.2",
-        "contentHash": "e17CAhKSxdAp7vFcYEVxjSc7t7rcvVGBipGhgE9tAjRXY85wZXLlHEVO0AEvMRkLmf9U+if4wK/nZEC1AX6VqQ==",
+        "resolved": "2022.1.0-development.876",
+        "contentHash": "yomWiPcMGaQ2JmsP5C22taGSJ75IOGTDme1ysw5V4DLfIt1FBBpxC1XBom2RYG6MZ1SbI1yvEaYNCuAHLZ7+xw==",
         "dependencies": {
-          "HarmonyX": "2.5.5",
-          "Iced": "1.11.1",
-          "IndexRange": "1.0.0",
-          "Mono.Cecil": "0.11.4",
-          "Samboy063.LibCpp2IL": "2022.0.7.2",
-          "System.Runtime.InteropServices": "4.3.0",
-          "System.ValueTuple": "4.5.0",
+          "AsmResolver.DotNet": "5.1.0",
+          "Disarm": "2022.1.0-master.26",
+          "Iced": "1.18.0",
+          "Samboy063.LibCpp2IL": "2022.1.0-development.876",
+          "StableNameDotNet": "0.1.0-development.876",
           "js6pak.Gee.External.Capstone": "2.1.0"
         }
       },
       "Samboy063.LibCpp2IL": {
         "type": "Transitive",
-        "resolved": "2022.0.7.2",
-        "contentHash": "DpVeU0dQkUJCpbw0f1xKOG8vimdK2oYhrVABC7HDE3/ikGjhnMZd3i5b1joKDHZ+AiL90TWOaEXPcy24rCZ0dA==",
+        "resolved": "2022.1.0-development.876",
+        "contentHash": "KrpK5sySZHMPdeatiCqv5Pw8F7oV4fTRfVBvzKVmRlnO7Ye6Lg6n6t/PQ7VjLH6FiF2kH3YPM2uIp4xMJhGXGg==",
         "dependencies": {
-          "IndexRange": "1.0.0",
-          "Samboy063.WasmDisassembler": "2022.0.2"
+          "AssetRipper.VersionUtilities": "1.3.1",
+          "Samboy063.WasmDisassembler": "2022.1.0-development.876"
         }
       },
       "Samboy063.WasmDisassembler": {
         "type": "Transitive",
-        "resolved": "2022.0.2",
-        "contentHash": "2uu+xBb7M3HKfBx9tAY6jiDieAf0hRnQjSmGX+7IdE6i24dYsx6TYgtrLvRx5lOuF2M8DijZ5H8yQ1pcuCs2SA=="
+        "resolved": "2022.1.0-development.876",
+        "contentHash": "QDDrTjL/WoGP66Fc1HBtPXpmPn7F+0JYiV1xaZetkYtZ4UNMT7k6i2b6Ge4gq2xkK5NV0YpLyuQcVPeuy7u4XA=="
       },
       "SemanticVersioning": {
         "type": "Transitive",
         "resolved": "2.0.2",
         "contentHash": "4EQgYdNZ92SyaO7YFk6olVnebF5V+jrHyMUjvPq89tLeMo8NSfgDF+6Zwq/lgh9j/0yfQp9Lkm0ZA0rUATCZFA=="
       },
+      "StableNameDotNet": {
+        "type": "Transitive",
+        "resolved": "0.1.0-development.876",
+        "contentHash": "e+yo57rKEJoQmTJ8scEbt6l/bqZvZu4hZUZMau/u1tyZI1I42JiXsjcH1+gE/nSQJlKPCykUrO/h+tUVm9I2nw=="
+      },
       "System.Collections": {
         "type": "Transitive",
         "resolved": "4.3.0",
           "Microsoft.NETCore.Targets": "1.1.0"
         }
       },
+      "System.Runtime.CompilerServices.Unsafe": {
+        "type": "Transitive",
+        "resolved": "6.0.0",
+        "contentHash": "/iUeP3tq1S0XdNNoMz5C9twLSrM/TH+qElHkXWaPvuNOt+99G75NrV0OS2EqHx5wMN7popYjpc8oTjC1y16DLg=="
+      },
       "System.Runtime.Extensions": {
         "type": "Transitive",
         "resolved": "4.3.0",
           "System.Runtime": "4.3.0"
         }
       },
+      "System.Text.Encodings.Web": {
+        "type": "Transitive",
+        "resolved": "6.0.0",
+        "contentHash": "Vg8eB5Tawm1IFqj4TVK1czJX89rhFxJo9ELqc/Eiq0eXy13RK00eubyU6TJE6y+GQXjyV5gSfiewDUZjQgSE0w==",
+        "dependencies": {
+          "System.Runtime.CompilerServices.Unsafe": "6.0.0"
+        }
+      },
+      "System.Text.Json": {
+        "type": "Transitive",
+        "resolved": "6.0.7",
+        "contentHash": "/Tf/9XjprpHolbcDOrxsKVYy/mUG/FS7aGd9YUgBVEiHeQH4kAE0T1sMbde7q6B5xcrNUsJ5iW7D1RvHudQNqA==",
+        "dependencies": {
+          "System.Runtime.CompilerServices.Unsafe": "6.0.0",
+          "System.Text.Encodings.Web": "6.0.0"
+        }
+      },
       "System.Threading": {
         "type": "Transitive",
         "resolved": "4.3.0",
           "Microsoft.NETCore.Targets": "1.1.0",
           "System.Runtime": "4.3.0"
         }
-      },
-      "System.ValueTuple": {
-        "type": "Transitive",
-        "resolved": "4.5.0",
-        "contentHash": "okurQJO6NRE/apDIP23ajJ0hpiNmJ+f0BwOlB/cSqTLQlw5upkf+5+96+iG2Jw40G1fCVCyPz/FhIABUjMR+RQ=="
       }
     }
   }