]> git.deb.at Git - rhonda/theotherroles.git/commitdiff
Version 3.4.5
authordwd0tcom <info@dominikwierl.com>
Sat, 9 Apr 2022 15:08:21 +0000 (17:08 +0200)
committerdwd0tcom <info@dominikwierl.com>
Sat, 9 Apr 2022 15:08:21 +0000 (17:08 +0200)
26 files changed:
README.md
TheOtherRoles/CustomOptionHolder.cs
TheOtherRoles/Helpers.cs
TheOtherRoles/Main.cs
TheOtherRoles/MapOptions.cs
TheOtherRoles/Modules/CustomHats.cs
TheOtherRoles/Modules/CustomOptions.cs
TheOtherRoles/Modules/ModUpdater.cs
TheOtherRoles/Patches/ClientOptionsPatch.cs
TheOtherRoles/Patches/CredentialsPatch.cs
TheOtherRoles/Patches/EndGamePatch.cs
TheOtherRoles/Patches/GameStartManagerPatch.cs
TheOtherRoles/Patches/IntroPatch.cs
TheOtherRoles/Patches/LightSourcePatch.cs [new file with mode: 0644]
TheOtherRoles/Patches/MainMenuPatch.cs [new file with mode: 0644]
TheOtherRoles/Patches/MeetingPatch.cs
TheOtherRoles/Patches/PlayerControlPatch.cs
TheOtherRoles/Patches/RegionMenuPatch.cs
TheOtherRoles/Patches/RoleAssignmentPatch.cs
TheOtherRoles/Patches/UsablesPatch.cs
TheOtherRoles/RPC.cs
TheOtherRoles/Resources/HorseModeButtonOff.png [new file with mode: 0644]
TheOtherRoles/Resources/HorseModeButtonOn.png [new file with mode: 0644]
TheOtherRoles/Resources/bannerTheHorseRoles.png [new file with mode: 0644]
TheOtherRoles/TheOtherRoles.cs
TheOtherRoles/TheOtherRoles.csproj

index a5020d77b56478ec52431886b1b094b24df540ce..06697fc769d2c59d20f8035113b8db56e604a5a9 100644 (file)
--- a/README.md
+++ b/README.md
@@ -41,6 +41,7 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
 # Releases
 | Among Us - Version| Mod Version | Link |
 |----------|-------------|-----------------|
+| 2022.3.29s| v3.4.5| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v3.4.5/TheOtherRoles.zip)
 | 2022.2.23s| v3.4.4| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v3.4.4/TheOtherRoles.zip)
 | 2021.12.15s| v3.4.3| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v3.4.3/TheOtherRoles.zip)
 | 2021.12.15s| v3.4.2| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v3.4.2/TheOtherRoles.zip)
@@ -100,8 +101,18 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
 <details>
   <summary>Click to show the Changelog</summary>
 
+**Version 3.4.5**
+- Update to Among Us version 2022.3.29s
+- Added horse-mode button in the main menu (bottom right)  
+- Added TheOtherRoles-discord button in the main menu (bottom left, report your bugs and feature suggestions here)
+- Fixed a bug where the deputy was not assigned properly
+- Fixed a bug where a promoted deputy had wrong cooldown 
+- Fixed a bug where the killer doesn't teleport to the body
+- Changed the light source to prevent vanilla bugs
+- Removed dlekS (for now) :c 
+  
 **Version 3.4.4**
-- Fixed a bug where games were not finished properly on official servers (special thanks to miniduikboot & 6pak)
+- Fixed a bug where games were not finished properly on offical servers (special thanks to miniduikboot & 6pak)
   
 **Version 3.4.3**
 - Fixed a bug where "Guesser Is Impostor Chance" crashed the role system
index 88a27968e90b3581c20e723398d4b7fbd6069fa9..72aa25080946f1c03331465efc8cca2d67aa17d2 100644 (file)
@@ -235,7 +235,6 @@ namespace TheOtherRoles {
         public static CustomOption dynamicMapEnableSkeld;
         public static CustomOption dynamicMapEnableMira;
         public static CustomOption dynamicMapEnablePolus;
-        public static CustomOption dynamicMapEnableDleks;
         public static CustomOption dynamicMapEnableAirShip;
 
 
@@ -477,7 +476,6 @@ namespace TheOtherRoles {
             dynamicMapEnableMira = CustomOption.Create(502, "Enable Mira Rotation", true, dynamicMap, false);
             dynamicMapEnablePolus = CustomOption.Create(503, "Enable Polus Rotation", true, dynamicMap, false);
             dynamicMapEnableAirShip = CustomOption.Create(504, "Enable Airship Rotation", true, dynamicMap, false);
-            dynamicMapEnableDleks = CustomOption.Create(505, "Enable dlekS Rotation", false, dynamicMap, false);
 
             blockedRolePairings.Add((byte)RoleId.Vampire, new [] { (byte)RoleId.Warlock});
             blockedRolePairings.Add((byte)RoleId.Warlock, new [] { (byte)RoleId.Vampire});
index 006b5a2b95a361eb7be6e2c049b20803620bef4c..87c6f952c422efc99f49eac34fbb9f66586a5990 100644 (file)
@@ -224,16 +224,16 @@ namespace TheOtherRoles {
             target.RawSetHat(hatId, colorId);
             target.RawSetName(hidePlayerName(PlayerControl.LocalPlayer, target) ? "" : playerName);
 
-            SkinData nextSkin = DestroyableSingleton<HatManager>.Instance.GetSkinById(skinId);
+            SkinViewData nextSkin = DestroyableSingleton<HatManager>.Instance.GetSkinById(skinId).viewData.viewData;
             PlayerPhysics playerPhysics = target.MyPhysics;
             AnimationClip clip = null;
             var spriteAnim = playerPhysics.Skin.animator;
             var currentPhysicsAnim = playerPhysics.Animator.GetCurrentAnimation();
-            if (currentPhysicsAnim == playerPhysics.RunAnim) clip = nextSkin.RunAnim;
-            else if (currentPhysicsAnim == playerPhysics.SpawnAnim) clip = nextSkin.SpawnAnim;
-            else if (currentPhysicsAnim == playerPhysics.EnterVentAnim) clip = nextSkin.EnterVentAnim;
-            else if (currentPhysicsAnim == playerPhysics.ExitVentAnim) clip = nextSkin.ExitVentAnim;
-            else if (currentPhysicsAnim == playerPhysics.IdleAnim) clip = nextSkin.IdleAnim;
+            if (currentPhysicsAnim == playerPhysics.CurrentAnimationGroup.RunAnim) clip = nextSkin.RunAnim;
+            else if (currentPhysicsAnim == playerPhysics.CurrentAnimationGroup.SpawnAnim) clip = nextSkin.SpawnAnim;
+            else if (currentPhysicsAnim == playerPhysics.CurrentAnimationGroup.EnterVentAnim) clip = nextSkin.EnterVentAnim;
+            else if (currentPhysicsAnim == playerPhysics.CurrentAnimationGroup.ExitVentAnim) clip = nextSkin.ExitVentAnim;
+            else if (currentPhysicsAnim == playerPhysics.CurrentAnimationGroup.IdleAnim) clip = nextSkin.IdleAnim;
             else clip = nextSkin.IdleAnim;
             float progress = playerPhysics.Animator.m_animator.GetCurrentAnimatorStateInfo(0).normalizedTime;
             playerPhysics.Skin.skin = nextSkin;
@@ -242,13 +242,31 @@ namespace TheOtherRoles {
             spriteAnim.m_animator.Update(0f);
 
             if (target.CurrentPet) UnityEngine.Object.Destroy(target.CurrentPet.gameObject);
-            target.CurrentPet = UnityEngine.Object.Instantiate<PetBehaviour>(DestroyableSingleton<HatManager>.Instance.GetPetById(petId).PetPrefab);
+            target.CurrentPet = UnityEngine.Object.Instantiate<PetBehaviour>(DestroyableSingleton<HatManager>.Instance.GetPetById(petId).viewData.viewData);
             target.CurrentPet.transform.position = target.transform.position;
             target.CurrentPet.Source = target;
             target.CurrentPet.Visible = target.Visible;
             PlayerControl.SetPlayerMaterialColors(colorId, target.CurrentPet.rend);
         }
 
+        public static void showFlash(Color color, float duration=1f) {
+            if (HudManager.Instance == null || HudManager.Instance.FullScreen == null) return;
+            HudManager.Instance.FullScreen.gameObject.SetActive(true);
+            HudManager.Instance.FullScreen.enabled = true;
+            HudManager.Instance.StartCoroutine(Effects.Lerp(duration, new Action<float>((p) => {
+                var renderer = HudManager.Instance.FullScreen;
+
+                if (p < 0.5) {
+                    if (renderer != null)
+                        renderer.color = new Color(color.r, color.g, color.b, Mathf.Clamp01(p * 2 * 0.75f));
+                } else {
+                    if (renderer != null)
+                        renderer.color = new Color(color.r, color.g, color.b, Mathf.Clamp01((1 - p) * 2 * 0.75f));
+                }
+                if (p == 1f && renderer != null) renderer.enabled = false;
+            })));
+        }
+
         public static bool roleCanUseVents(this PlayerControl player) {
             bool roleCouldUse = false;
             if (Engineer.engineer != null && Engineer.engineer == player)
index e87ffbad7d5434e485abdefd14abf88651670d38..f8b4144110aff876798ad4b2b4dd705bd87ca0c1 100644 (file)
@@ -21,7 +21,7 @@ namespace TheOtherRoles
     public class TheOtherRolesPlugin : BasePlugin
     {
         public const string Id = "me.eisbison.theotherroles";
-        public const string VersionString = "3.4.4";
+        public const string VersionString = "3.4.5";
 
         public static System.Version Version = System.Version.Parse(VersionString);
         internal static BepInEx.Logging.ManualLogSource Logger;
@@ -38,6 +38,7 @@ namespace TheOtherRoles
         public static ConfigEntry<bool> GhostsSeeVotes{ get; set; }
         public static ConfigEntry<bool> ShowRoleSummary { get; set; }
         public static ConfigEntry<bool> ShowLighterDarker { get; set; }
+        public static ConfigEntry<bool> EnableHorseMode { get; set; }
         public static ConfigEntry<string> StreamerModeReplacementText { get; set; }
         public static ConfigEntry<string> StreamerModeReplacementColor { get; set; }
         public static ConfigEntry<string> Ip { get; set; }
@@ -66,6 +67,7 @@ namespace TheOtherRoles
             GhostsSeeVotes = Config.Bind("Custom", "Ghosts See Votes", true);
             ShowRoleSummary = Config.Bind("Custom", "Show Role Summary", true);
             ShowLighterDarker = Config.Bind("Custom", "Show Lighter / Darker", true);
+            EnableHorseMode = Config.Bind("Custom", "Enable Horse Mode", false);
             ShowPopUpVersion = Config.Bind("Custom", "Show PopUp", "0");
             StreamerModeReplacementText = Config.Bind("Custom", "Streamer Mode Replacement Text", "\n\nThe Other Roles");
             StreamerModeReplacementColor = Config.Bind("Custom", "Streamer Mode Replacement Text Hex Color", "#87AAF5FF");
index 2c69f53df08ade673d048aca88462cf313be92b0..49b66694ed80a5e54176692bf1f006c4d65b3223 100644 (file)
@@ -17,6 +17,7 @@ namespace TheOtherRoles{
         public static bool showRoleSummary = true;
         public static bool allowParallelMedBayScans = false;
         public static bool showLighterDarker = true;
+        public static bool enableHorseMode = false;
 
         // Updating values
         public static int meetingsCount = 0;
@@ -24,7 +25,7 @@ namespace TheOtherRoles{
         public static List<Vent> ventsToSeal = new List<Vent>();
         public static Dictionary<byte, PoolablePlayer> playerIcons = new Dictionary<byte, PoolablePlayer>();
 
-public static void clearAndReloadMapOptions() {
+        public static void clearAndReloadMapOptions() {
             meetingsCount = 0;
             camerasToAdd = new List<SurvCamera>();
             ventsToSeal = new List<Vent>();
@@ -35,11 +36,16 @@ public static void clearAndReloadMapOptions() {
             noVoteIsSelfVote = CustomOptionHolder.noVoteIsSelfVote.getBool();
             hidePlayerNames = CustomOptionHolder.hidePlayerNames.getBool();
             allowParallelMedBayScans = CustomOptionHolder.allowParallelMedBayScans.getBool();
+        }
+
+        public static void reloadPluginOptions() {
             ghostsSeeRoles = TheOtherRolesPlugin.GhostsSeeRoles.Value;
             ghostsSeeTasks = TheOtherRolesPlugin.GhostsSeeTasks.Value;
             ghostsSeeVotes = TheOtherRolesPlugin.GhostsSeeVotes.Value;
             showRoleSummary = TheOtherRolesPlugin.ShowRoleSummary.Value;
             showLighterDarker = TheOtherRolesPlugin.ShowLighterDarker.Value;
+            enableHorseMode = TheOtherRolesPlugin.EnableHorseMode.Value;
+            Patches.ShouldAlwaysHorseAround.isHorseMode = TheOtherRolesPlugin.EnableHorseMode.Value;
         }
     }
 }
\ No newline at end of file
index b94279b83f82b515e4baf3a22ca0c0e482dd8e3c..0b86984e08fb0a3dee9c6a61361bcdc1e2550b88 100644 (file)
@@ -126,26 +126,24 @@ namespace TheOtherRoles.Modules {
             return sprite;
         }
 
-        private static HatBehaviour CreateHatBehaviour(CustomHat ch, bool fromDisk = false, bool testOnly = false) {
-            if (hatShader == null && DestroyableSingleton<HatManager>.InstanceExists) {
-                foreach (HatBehaviour h in DestroyableSingleton<HatManager>.Instance.AllHats) {
-                    if (h.AltShader != null) {
-                        hatShader = h.AltShader;
-                        break;
-                    }
-                }
+        private static HatData CreateHatBehaviour(CustomHat ch, bool fromDisk = false, bool testOnly = false) {
+            if (hatShader == null) {
+                Material tmpShader = new Material("PlayerMaterial");
+                tmpShader.shader = Shader.Find("Unlit/PlayerShader");
+                hatShader = tmpShader;
             }
 
-            HatBehaviour hat = ScriptableObject.CreateInstance<HatBehaviour>();
-            hat.MainImage = CreateHatSprite(ch.resource, fromDisk);
+            HatData hat = ScriptableObject.CreateInstance<HatData>();
+            hat.hatViewData.viewData = ScriptableObject.CreateInstance<HatViewData>();
+            hat.hatViewData.viewData.MainImage = CreateHatSprite(ch.resource, fromDisk);
             if (ch.backresource != null) {
-                hat.BackImage = CreateHatSprite(ch.backresource, fromDisk);
+                hat.hatViewData.viewData.BackImage = CreateHatSprite(ch.backresource, fromDisk);
                 ch.behind = true; // Required to view backresource
             }
             if (ch.climbresource != null)
-                hat.ClimbImage = CreateHatSprite(ch.climbresource, fromDisk);
+                hat.hatViewData.viewData.ClimbImage = CreateHatSprite(ch.climbresource, fromDisk);
             hat.name = ch.name;
-            hat.Order = 99;
+            hat.displayOrder = 99;
             hat.ProductId = "hat_" + ch.name.Replace(' ', '_');
             hat.InFront = !ch.behind;
             hat.NoBounce = !ch.bounce;
@@ -153,7 +151,7 @@ namespace TheOtherRoles.Modules {
             hat.Free = true;
 
             if (ch.adaptive && hatShader != null)
-                hat.AltShader = hatShader;
+                hat.hatViewData.viewData.AltShader = hatShader;
 
             HatExtension extend = new HatExtension();
             extend.author = ch.author != null ? ch.author : "Unknown";
@@ -175,7 +173,7 @@ namespace TheOtherRoles.Modules {
             return hat;
         }
 
-        private static HatBehaviour CreateHatBehaviour(CustomHatLoader.CustomHatOnline chd) {
+        private static HatData CreateHatBehaviour(CustomHatLoader.CustomHatOnline chd) {
             string filePath = Path.GetDirectoryName(Application.dataPath) + @"\TheOtherHats\";
             chd.resource = filePath + chd.resource;
             if (chd.backresource != null)
@@ -196,7 +194,7 @@ namespace TheOtherRoles.Modules {
                 RUNNING = true; // prevent simultanious execution
                 try {
                     while (CustomHatLoader.hatdetails.Count > 0) {
-                        __instance.AllHats.Add(CreateHatBehaviour(CustomHatLoader.hatdetails[0]));
+                        __instance.allHats.Add(CreateHatBehaviour(CustomHatLoader.hatdetails[0]));
                         CustomHatLoader.hatdetails.RemoveAt(0);
                     }
                 } catch (System.Exception e) {
@@ -214,7 +212,7 @@ namespace TheOtherRoles.Modules {
         private static class PlayerPhysicsHandleAnimationPatch {
             private static void Postfix(PlayerPhysics __instance) {
                 AnimationClip currentAnimation = __instance.Animator.GetCurrentAnimation();
-                if (currentAnimation == __instance.ClimbAnim || currentAnimation == __instance.ClimbDownAnim) return;
+                if (currentAnimation == __instance.CurrentAnimationGroup.ClimbAnim || currentAnimation == __instance.CurrentAnimationGroup.ClimbDownAnim) return;
                 HatParent hp = __instance.myPlayer.HatRenderer;
                 if (hp.Hat == null) return;
                 HatExtension extend = hp.Hat.getHatExtension();
@@ -223,14 +221,14 @@ namespace TheOtherRoles.Modules {
                     if (__instance.rend.flipX) {
                         hp.FrontLayer.sprite = extend.FlipImage;
                     } else {
-                        hp.FrontLayer.sprite = hp.Hat.MainImage;
+                        hp.FrontLayer.sprite = hp.hatView.MainImage;
                     }
                 }
                 if (extend.BackFlipImage != null) {
                     if (__instance.rend.flipX) {
                         hp.BackLayer.sprite = extend.BackFlipImage;
                     } else {
-                        hp.BackLayer.sprite = hp.Hat.BackImage;
+                        hp.BackLayer.sprite = hp.hatView.BackImage;
                     }
                 }
             }
@@ -261,7 +259,7 @@ namespace TheOtherRoles.Modules {
             public static string innerslothPackageName = "Innersloth Hats";
             private static TMPro.TMP_Text textTemplate;
 
-            public static float createHatPackage(List<System.Tuple<HatBehaviour, HatExtension>> hats, string packageName, float YStart, HatsTab __instance) {
+            public static float createHatPackage(List<System.Tuple<HatData, HatExtension>> hats, string packageName, float YStart, HatsTab __instance) {
                 bool isDefaultPackage = innerslothPackageName == packageName;
                 if (!isDefaultPackage)
                     hats = hats.OrderBy(x => x.Item1.name).ToList();
@@ -277,7 +275,7 @@ namespace TheOtherRoles.Modules {
                     offset -= 0.8f * __instance.YOffset;
                 }
                 for (int i = 0; i < hats.Count; i++) {
-                    HatBehaviour hat = hats[i].Item1;
+                    HatData hat = hats[i].Item1;
                     HatExtension ext = hats[i].Item2;
 
                     float xpos = __instance.XRange.Lerp((i % __instance.NumPerRow) / (__instance.NumPerRow - 1f));
@@ -327,20 +325,20 @@ namespace TheOtherRoles.Modules {
                     UnityEngine.Object.Destroy(__instance.scroller.Inner.GetChild(i).gameObject);
                 __instance.ColorChips = new Il2CppSystem.Collections.Generic.List<ColorChip>();
 
-                HatBehaviour[] unlockedHats = DestroyableSingleton<HatManager>.Instance.GetUnlockedHats();
-                Dictionary<string, List<System.Tuple<HatBehaviour, HatExtension>>> packages = new Dictionary<string, List<System.Tuple<HatBehaviour, HatExtension>>>();
+                HatData[] unlockedHats = DestroyableSingleton<HatManager>.Instance.GetUnlockedHats();
+                Dictionary<string, List<System.Tuple<HatData, HatExtension>>> packages = new Dictionary<string, List<System.Tuple<HatData, HatExtension>>>();
 
-                foreach (HatBehaviour hatBehaviour in unlockedHats) {
+                foreach (HatData hatBehaviour in unlockedHats) {
                     HatExtension ext = hatBehaviour.getHatExtension();
 
                     if (ext != null) {
                         if (!packages.ContainsKey(ext.package)) 
-                            packages[ext.package] = new List<System.Tuple<HatBehaviour, HatExtension>>();
-                        packages[ext.package].Add(new System.Tuple<HatBehaviour, HatExtension>(hatBehaviour, ext));
+                            packages[ext.package] = new List<System.Tuple<HatData, HatExtension>>();
+                        packages[ext.package].Add(new System.Tuple<HatData, HatExtension>(hatBehaviour, ext));
                     } else {
                         if (!packages.ContainsKey(innerslothPackageName)) 
-                            packages[innerslothPackageName] = new List<System.Tuple<HatBehaviour, HatExtension>>();
-                        packages[innerslothPackageName].Add(new System.Tuple<HatBehaviour, HatExtension>(hatBehaviour, null));
+                            packages[innerslothPackageName] = new List<System.Tuple<HatData, HatExtension>>();
+                        packages[innerslothPackageName].Add(new System.Tuple<HatData, HatExtension>(hatBehaviour, null));
                     }
                 }
 
@@ -353,7 +351,7 @@ namespace TheOtherRoles.Modules {
                     return 500;
                 });
                 foreach (string key in orderedKeys) {
-                    List<System.Tuple<HatBehaviour, HatExtension>> value = packages[key];
+                    List<System.Tuple<HatData, HatExtension>> value = packages[key];
                     YOffset = createHatPackage(value, key, YOffset, __instance);
                 }
 
@@ -497,7 +495,7 @@ namespace TheOtherRoles.Modules {
         }   
     }
     public static class CustomHatExtensions {
-        public static CustomHats.HatExtension getHatExtension(this HatBehaviour hat) {
+        public static CustomHats.HatExtension getHatExtension(this HatData hat) {
             CustomHats.HatExtension ret = null;
             if (CustomHats.TestExt != null && CustomHats.TestExt.condition.Equals(hat.name)) {
                 return CustomHats.TestExt;
index 7590699260f53c39d43159eec4e5094db54934b9..24589c7037fc019201ec34fa006ba7d21e0779a9 100644 (file)
@@ -295,26 +295,26 @@ namespace TheOtherRoles {
 
         public static void Postfix(GameSettingMenu __instance) {
             // Setup mapNameTransform
-            var mapNameTransform = __instance.AllItems.FirstOrDefault(x => x.gameObject.activeSelf && x.name.Equals("MapName", StringComparison.OrdinalIgnoreCase));
+            var mapNameTransform = __instance.AllItems.FirstOrDefault(x => x.name.Equals("MapName", StringComparison.OrdinalIgnoreCase));
             if (mapNameTransform == null) return;
-
             var options = new Il2CppSystem.Collections.Generic.List<Il2CppSystem.Collections.Generic.KeyValuePair<string, int>>();
             for (int i = 0; i < Constants.MapNames.Length; i++) {
+                if (i == 3) continue; // Ignore dlekS
                 var kvp = new Il2CppSystem.Collections.Generic.KeyValuePair<string, int>();
                 kvp.key = Constants.MapNames[i];
                 kvp.value = i;
                 options.Add(kvp);
             }
             mapNameTransform.GetComponent<KeyValueOption>().Values = options;
-        }
-    }
+            mapNameTransform.gameObject.active = true;
 
-    [HarmonyPatch(typeof(Constants), nameof(Constants.ShouldFlipSkeld))]
-    class ConstantsShouldFlipSkeldPatch {
-        public static bool Prefix(ref bool __result) {
-            if (PlayerControl.GameOptions == null) return true;
-            __result = PlayerControl.GameOptions.MapId == 3;
-            return false;
+            foreach (Transform i in __instance.AllItems.ToList()) {
+                float num = -0.5f;
+                if (i.name.Equals("MapName", StringComparison.OrdinalIgnoreCase)) num = -0.25f;
+                if (i.name.Equals("NumImpostors", StringComparison.OrdinalIgnoreCase) || i.name.Equals("ResetToDefault", StringComparison.OrdinalIgnoreCase)) num = 0f;
+                i.position += new Vector3(0, num, 0);
+            }
+            __instance.Scroller.ContentYBounds.max += 0.5F;
         }
     }
 
index 87b9b5bc2ed57c6c6337170e5d052efb17fcc92e..aab8679f1b4733dddfd61b11b957b4fda9373179 100644 (file)
@@ -36,17 +36,23 @@ namespace TheOtherRoles.Modules {
             if (template == null) return;
 
             var button = UnityEngine.Object.Instantiate(template, null);
-            button.transform.localPosition = new Vector3(button.transform.localPosition.x, button.transform.localPosition.y + 0.6f, button.transform.localPosition.z);
+            button.transform.localPosition = new Vector3(button.transform.localPosition.x, button.transform.localPosition.y + 1.2f, button.transform.localPosition.z);
 
             PassiveButton passiveButton = button.GetComponent<PassiveButton>();
+            SpriteRenderer buttonSprite = button.GetComponent<SpriteRenderer>();
             passiveButton.OnClick = new Button.ButtonClickedEvent();
             passiveButton.OnClick.AddListener((UnityEngine.Events.UnityAction)onClick);
-            
+
             var text = button.transform.GetChild(0).GetComponent<TMPro.TMP_Text>();
             __instance.StartCoroutine(Effects.Lerp(0.1f, new System.Action<float>((p) => {
-                text.SetText("Update\nThe Other Roles");
+                text.SetText("Update");
             })));
 
+            buttonSprite.color = text.color = Color.red;
+            passiveButton.OnMouseOut.AddListener((UnityEngine.Events.UnityAction)delegate {
+                buttonSprite.color = text.color = Color.red;
+            });
+
             TwitchManager man = DestroyableSingleton<TwitchManager>.Instance;
             ModUpdater.InfoPopup = UnityEngine.Object.Instantiate<GenericPopup>(man.TwitchPopup);
             ModUpdater.InfoPopup.TextAreaTMP.fontSize *= 0.7f;
@@ -85,6 +91,7 @@ namespace TheOtherRoles.Modules {
                 DestroyableSingleton<MainMenuManager>.Instance.Announcement.gameObject.SetActive(true);
                 TheOtherRolesPlugin.ShowPopUpVersion.Value = TheOtherRolesPlugin.VersionString;
             }
+            MapOptions.reloadPluginOptions();
         }
 
         public static void ExecuteUpdate() {
index 9f5a77bcfad8704e688f78710d395d0c20ac26fe..69837284c55cfee5f44f7965327df3e43079a74a 100644 (file)
@@ -88,13 +88,21 @@ namespace TheOtherRoles.Patches
         {
             var moreOptions = Object.Instantiate(buttonPrefab, __instance.CensorChatButton.transform.parent);
             var transform = __instance.CensorChatButton.transform;
+            __instance.CensorChatButton.Text.transform.localScale = new Vector3(1 / 0.66f, 1, 1);
             _origin ??= transform.localPosition;
-            
-            transform.localPosition = _origin.Value + Vector3.left * 1.3f;
-            moreOptions.transform.localPosition = _origin.Value + Vector3.right * 1.3f;
-            
+
+            transform.localPosition = _origin.Value + Vector3.left * 0.45f;
+            transform.localScale = new Vector3(0.66f, 1, 1);
+            __instance.EnableFriendInvitesButton.transform.localScale = new Vector3(0.66f, 1, 1);
+            __instance.EnableFriendInvitesButton.transform.localPosition += Vector3.right * 0.5f;
+            __instance.EnableFriendInvitesButton.Text.transform.localScale = new Vector3(1.2f, 1, 1);
+
+            moreOptions.transform.localPosition = _origin.Value + Vector3.right * 4f / 3f;
+            moreOptions.transform.localScale = new Vector3(0.66f, 1, 1);
+
             moreOptions.gameObject.SetActive(true);
             moreOptions.Text.text = "Mod Options...";
+            moreOptions.Text.transform.localScale = new Vector3(1 / 0.66f, 1, 1);
             var moreOptionsButton = moreOptions.GetComponent<PassiveButton>();
             moreOptionsButton.OnClick = new ButtonClickedEvent();
             moreOptionsButton.OnClick.AddListener((Action) (() =>
@@ -191,7 +199,7 @@ namespace TheOtherRoles.Patches
             }
         }
         
-        private class SelectionBehaviour
+        public class SelectionBehaviour
         {
             public string Title;
             public Func<bool> OnClick;
index d7d7edaa2cf8a4d027abc174d2d0de7075d435a6..0ee14ca07b0737c4ae5e45c87b34820d4775e0e0 100644 (file)
@@ -72,8 +72,12 @@ Design by <color=#FCCE03FF>Bavari</color>";
         }
 
         [HarmonyPatch(typeof(MainMenuManager), nameof(MainMenuManager.Start))]
-        private static class LogoPatch
+        public static class LogoPatch
         {
+            public static SpriteRenderer renderer;
+            public static Sprite bannerSprite;
+            public static Sprite horseBannerSprite;
+            private static PingTracker instance;
             static void Postfix(PingTracker __instance) {
                 var amongUsLogo = GameObject.Find("bannerLogo_AmongUs");
                 if (amongUsLogo != null) {
@@ -83,8 +87,34 @@ Design by <color=#FCCE03FF>Bavari</color>";
 
                 var torLogo = new GameObject("bannerLogo_TOR");
                 torLogo.transform.position = Vector3.up;
-                var renderer = torLogo.AddComponent<SpriteRenderer>();
+                renderer = torLogo.AddComponent<SpriteRenderer>();
+                loadSprites();
                 renderer.sprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.Banner.png", 300f);
+
+                instance = __instance;
+                loadSprites();
+                renderer.sprite = MapOptions.enableHorseMode ? horseBannerSprite : bannerSprite;
+            }
+
+            public static void loadSprites() {
+                if (bannerSprite == null) bannerSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.Banner.png", 300f);
+                if (horseBannerSprite == null) horseBannerSprite = Helpers.loadSpriteFromResources("TheOtherRoles.Resources.bannerTheHorseRoles.png", 300f);
+            }
+
+            public static void updateSprite() {
+                loadSprites();
+                if (renderer != null) {
+                    float fadeDuration = 1f;
+                    instance.StartCoroutine(Effects.Lerp(fadeDuration, new Action<float>((p) => {
+                        renderer.color = new Color(1, 1, 1, 1 - p);
+                        if (p == 1) {
+                            renderer.sprite = MapOptions.enableHorseMode ? horseBannerSprite : bannerSprite;
+                            instance.StartCoroutine(Effects.Lerp(fadeDuration, new Action<float>((p) => {
+                                renderer.color = new Color(1, 1, 1, p);
+                            })));
+                        }
+                    })));
+                }
             }
         }
     }
index 371b2c4a65c50da4f4d096019c2f42dab23b729c..28a2966a75adc180fa6f8f1631a113e12671c576 100644 (file)
@@ -249,7 +249,7 @@ namespace TheOtherRoles.Patches {
                 poolablePlayer.transform.localScale = vector;
                 poolablePlayer.UpdateFromPlayerOutfit(winningPlayerData2, winningPlayerData2.IsDead);
                 if (winningPlayerData2.IsDead) {
-                    poolablePlayer.Body.sprite = __instance.GhostSprite;
+                    poolablePlayer.CurrentBodySprite.BodySprite.sprite = poolablePlayer.CurrentBodySprite.GhostSprite;
                     poolablePlayer.SetDeadFlipX(i % 2 == 0);
                 } else {
                     poolablePlayer.SetFlipX(i % 2 == 0);
index 5229a8123bd71f82226705a4ffca37095efd05ed..7e323277badf9df6732ed3aa71ffa6f2a528ad30 100644 (file)
@@ -172,8 +172,6 @@ namespace TheOtherRoles.Patches {
                             possibleMaps.Add(1);
                         if (CustomOptionHolder.dynamicMapEnablePolus.getBool())
                             possibleMaps.Add(2);
-                        if (CustomOptionHolder.dynamicMapEnableDleks.getBool())
-                            possibleMaps.Add(3);
                         if (CustomOptionHolder.dynamicMapEnableAirShip.getBool())
                             possibleMaps.Add(4);
                         byte chosenMapId  = possibleMaps[TheOtherRoles.rnd.Next(possibleMaps.Count)];
index 1ce87e8aa0f159c59cc87cfc902a7ae2b4368662..5dcfae5701caefd4efaf9e4403187e6f32c6d383 100644 (file)
@@ -17,8 +17,8 @@ namespace TheOtherRoles.Patches {
                 foreach (PlayerControl p in PlayerControl.AllPlayerControls) {
                     GameData.PlayerInfo data = p.Data;
                     PoolablePlayer player = UnityEngine.Object.Instantiate<PoolablePlayer>(__instance.PlayerPrefab, HudManager.Instance.transform);
-                    PlayerControl.SetPlayerMaterialColors(data.DefaultOutfit.ColorId, player.Body);
-                    DestroyableSingleton<HatManager>.Instance.SetSkin(player.Skin.layer, data.DefaultOutfit.SkinId);
+                    PlayerControl.SetPlayerMaterialColors(data.DefaultOutfit.ColorId, player.CurrentBodySprite.BodySprite);
+                    player.SetSkin(data.DefaultOutfit.SkinId, data.DefaultOutfit.ColorId);
                     player.HatSlot.SetHat(data.DefaultOutfit.HatId, data.DefaultOutfit.ColorId);
                     PlayerControl.SetPetImage(data.DefaultOutfit.PetId, data.DefaultOutfit.ColorId, player.PetSlot);
                     player.NameText.text = data.PlayerName;
@@ -90,43 +90,56 @@ namespace TheOtherRoles.Patches {
             }
         }
 
-        [HarmonyPatch(typeof(IntroCutscene), nameof(IntroCutscene.SetUpRoleText))]
-        class SetUpRoleTextPatch {
-            public static void Postfix(IntroCutscene __instance) {
-                if (!CustomOptionHolder.activateRoles.getBool()) return; // Don't override the intro of the vanilla roles
+        public static IEnumerator<WaitForSeconds> EndShowRole(IntroCutscene __instance) {
+            yield return new WaitForSeconds(5f);
+
+            __instance.YouAreText.gameObject.SetActive(false);
+            __instance.RoleText.gameObject.SetActive(false);
+            __instance.RoleBlurbText.gameObject.SetActive(false);
+            __instance.ourCrewmate.gameObject.SetActive(false);
+           
+        }
 
+        [HarmonyPatch(typeof(IntroCutscene), nameof(IntroCutscene.ShowRole))]
+        class SetUpRoleTextPatch {
+            static public void SetRoleTexts(IntroCutscene __instance) {
+                // Don't override the intro of the vanilla roles
                 List<RoleInfo> infos = RoleInfo.getRoleInfoForPlayer(PlayerControl.LocalPlayer);
                 RoleInfo roleInfo = infos.Where(info => info.roleId != RoleId.Lover).FirstOrDefault();
-
                 if (roleInfo != null) {
                     __instance.RoleText.text = roleInfo.name;
                     __instance.RoleText.color = roleInfo.color;
                     __instance.RoleBlurbText.text = roleInfo.introDescription;
                     __instance.RoleBlurbText.color = roleInfo.color;
                 }
-
                 if (infos.Any(info => info.roleId == RoleId.Lover)) {
                     PlayerControl otherLover = PlayerControl.LocalPlayer == Lovers.lover1 ? Lovers.lover2 : Lovers.lover1;
                     __instance.RoleBlurbText.text += Helpers.cs(Lovers.color, $"\n♥ You are in love with {otherLover?.Data?.PlayerName ?? ""} ♥");
                 }
                 if (Deputy.knowsSheriff && Deputy.deputy != null && Sheriff.sheriff != null) {
-                    if (infos.Any(info => info.roleId == RoleId.Sheriff)) 
+                    if (infos.Any(info => info.roleId == RoleId.Sheriff))
                         __instance.RoleBlurbText.text += Helpers.cs(Sheriff.color, $"\nYour Deputy is {Deputy.deputy?.Data?.PlayerName ?? ""}");
                     else if (infos.Any(info => info.roleId == RoleId.Deputy))
                         __instance.RoleBlurbText.text += Helpers.cs(Sheriff.color, $"\nYour Sheriff is {Sheriff.sheriff?.Data?.PlayerName ?? ""}");
                 }
-
+            }
+            public static bool Prefix(IntroCutscene __instance) {
+                if (!CustomOptionHolder.activateRoles.getBool()) return true;
+                HudManager.Instance.StartCoroutine(Effects.Lerp(1f, new Action<float>((p) => {
+                    SetRoleTexts(__instance);
+                })));
+                return true;
             }
         }
 
         [HarmonyPatch(typeof(IntroCutscene), nameof(IntroCutscene.BeginCrewmate))]
         class BeginCrewmatePatch {
-            public static void Prefix(IntroCutscene __instance, ref  Il2CppSystem.Collections.Generic.List<PlayerControl> yourTeam) {
-                setupIntroTeamIcons(__instance, ref yourTeam);
+            public static void Prefix(IntroCutscene __instance, ref  Il2CppSystem.Collections.Generic.List<PlayerControl> teamToDisplay) {
+                setupIntroTeamIcons(__instance, ref teamToDisplay);
             }
 
-            public static void Postfix(IntroCutscene __instance, ref  Il2CppSystem.Collections.Generic.List<PlayerControl> yourTeam) {
-                setupIntroTeam(__instance, ref yourTeam);
+            public static void Postfix(IntroCutscene __instance, ref  Il2CppSystem.Collections.Generic.List<PlayerControl> teamToDisplay) {
+                setupIntroTeam(__instance, ref teamToDisplay);
             }
         }
 
@@ -141,5 +154,18 @@ namespace TheOtherRoles.Patches {
             }
         }
     }
+
+    [HarmonyPatch(typeof(Constants), nameof(Constants.ShouldHorseAround))]
+    public static class ShouldAlwaysHorseAround {
+        public static bool isHorseMode;
+        public static bool Prefix(ref bool __result) {
+            if (isHorseMode != MapOptions.enableHorseMode && LobbyBehaviour.Instance != null) __result = isHorseMode;
+            else {
+                __result = MapOptions.enableHorseMode;
+                isHorseMode = MapOptions.enableHorseMode;
+            }
+            return false;
+        }
+    }
 }
 
diff --git a/TheOtherRoles/Patches/LightSourcePatch.cs b/TheOtherRoles/Patches/LightSourcePatch.cs
new file mode 100644 (file)
index 0000000..0112baa
--- /dev/null
@@ -0,0 +1,36 @@
+using HarmonyLib;
+using System;
+using Hazel;
+using UnityEngine;
+using UnityEngine.Rendering;
+
+
+namespace TheOtherRoles.Patches {
+
+       [HarmonyPatch(typeof(LightSource), nameof(LightSource.DrawOcclusion))]
+
+       class LightSourceUpdatePatch {
+               static bool Prefix(LightSource __instance, float effectiveRadius) {
+                       if (__instance.cb == null) {
+                               __instance.cb = new CommandBuffer();
+                               __instance.cb.name = "Draw occlusion";
+                       }
+                       if (__instance.shadowTexture && __instance.shadowCasterMaterial) {
+                               float num = (float)__instance.shadowTexture.width;
+                               __instance.shadowCasterMaterial.SetFloat("_DepthCompressionValue", effectiveRadius);
+                               __instance.cb.Clear();
+                               __instance.cb.SetRenderTarget(__instance.shadowTexture);
+                               __instance.cb.ClearRenderTarget(true, true, new Color(1f, 1f, 1f, 1f));
+                               __instance.cb.SetGlobalTexture("_ShmapTexture", __instance.shadowTexture);
+                               __instance.cb.SetGlobalFloat("_Radius", __instance.LightRadius);
+                               __instance.cb.SetGlobalFloat("_Column", 0f);
+                               __instance.cb.SetGlobalVector("_lightPosition", __instance.transform.position + Vector3.down * 0.095f); ;
+                               __instance.cb.SetGlobalVector("_TexelSize", new Vector4(1f / num, 1f / num, num, num));
+                               __instance.cb.SetGlobalFloat("_DepthCompressionValue", effectiveRadius);
+                               __instance.cb.DrawMesh(__instance.occluderMesh, Matrix4x4.identity, __instance.shadowCasterMaterial);
+                               Graphics.ExecuteCommandBuffer(__instance.cb);
+                       }
+                       return false;
+               }
+       }
+}
\ No newline at end of file
diff --git a/TheOtherRoles/Patches/MainMenuPatch.cs b/TheOtherRoles/Patches/MainMenuPatch.cs
new file mode 100644 (file)
index 0000000..f98200d
--- /dev/null
@@ -0,0 +1,79 @@
+using HarmonyLib;
+using UnityEngine;
+using UnityEngine.UI;
+using static UnityEngine.UI.Button;
+using Object = UnityEngine.Object;
+using TheOtherRoles.Patches;
+
+namespace TheOtherRoles.Modules {
+    [HarmonyPatch(typeof(MainMenuManager), nameof(MainMenuManager.Start))]
+    public class MainMenuPatch {
+        private static bool horseButtonState = MapOptions.enableHorseMode;
+        private static Sprite horseModeOffSprite = null;
+        private static Sprite horseModeOnSprite = null;
+
+        private static void Prefix(MainMenuManager __instance) {
+            CustomHatLoader.LaunchHatFetcher();
+            var template = GameObject.Find("ExitGameButton");
+            if (template == null) return;
+
+            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);
+
+            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>();
+
+            passiveButtonDiscord.OnClick = new Button.ButtonClickedEvent();
+            passiveButtonDiscord.OnClick.AddListener((UnityEngine.Events.UnityAction)delegate {
+                Application.OpenURL("https://discord.gg/77RkMJHWsM");
+            });
+
+            Color discordColor = new Color32(88, 101, 242, byte.MaxValue);
+            buttonSpriteDiscord.color = textDiscord.color = discordColor;
+            passiveButtonDiscord.OnMouseOut.AddListener((UnityEngine.Events.UnityAction)delegate {
+                buttonSpriteDiscord.color = textDiscord.color = discordColor;
+            });
+
+
+            // Horse mode stuff
+            var horseModeSelectionBehavior = new ClientOptionsPatch.SelectionBehaviour("Enable Horse Mode", () => MapOptions.enableHorseMode = TheOtherRolesPlugin.EnableHorseMode.Value = !TheOtherRolesPlugin.EnableHorseMode.Value, TheOtherRolesPlugin.EnableHorseMode.Value);
+
+            var bottomTemplate = GameObject.Find("InventoryButton");
+            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((UnityEngine.Events.UnityAction)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();
+                }
+            });
+        }
+    }
+}
\ No newline at end of file
index 39596f28646b1035090344cebdb58af28b8fd34f..82ad8006e1a5255715f8ed4225d960e42ccc165d 100644 (file)
@@ -272,7 +272,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 = DestroyableSingleton<HatManager>.Instance.AllNamePlates[0].Image;
+                button.GetComponent<SpriteRenderer>().sprite = DestroyableSingleton<HatManager>.Instance.GetNamePlateById("nameplate_NoPlate")?.viewData?.viewData?.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);
index cbc9e8da43368065e510b02e0aeb57922c428778..69ef856a9905f66af70e8aacb1c8764ce1dc91f2 100644 (file)
@@ -47,17 +47,17 @@ namespace TheOtherRoles.Patches {
         }
 
         static void setPlayerOutline(PlayerControl target, Color color) {
-            if (target == null || target.myRend == null) return;
+            if (target == null || target.MyRend == null) return;
 
-            target.myRend.material.SetFloat("_Outline", 1f);
-            target.myRend.material.SetColor("_OutlineColor", color);
+            target.MyRend.material.SetFloat("_Outline", 1f);
+            target.MyRend.material.SetColor("_OutlineColor", color);
         }
 
         // Update functions
 
         static void setBasePlayerOutlines() {
             foreach (PlayerControl target in PlayerControl.AllPlayerControls) {
-                if (target == null || target.myRend == null) continue;
+                if (target == null || target.MyRend == null) continue;
 
                 bool isMorphedMorphling = target == Morphling.morphling && Morphling.morphTarget != null && Morphling.morphTimer > 0f;
                 bool hasVisibleShield = false;
@@ -68,11 +68,11 @@ namespace TheOtherRoles.Patches {
                 }
 
                 if (hasVisibleShield) {
-                    target.myRend.material.SetFloat("_Outline", 1f);
-                    target.myRend.material.SetColor("_OutlineColor", Medic.shieldedColor);
+                    target.MyRend.material.SetFloat("_Outline", 1f);
+                    target.MyRend.material.SetColor("_OutlineColor", Medic.shieldedColor);
                 }
                 else {
-                    target.myRend.material.SetFloat("_Outline", 0f);
+                    target.MyRend.material.SetFloat("_Outline", 0f);
                 }
             }
         }
@@ -962,25 +962,14 @@ namespace TheOtherRoles.Patches {
 
             // Warlock Button Sync
             if (Warlock.warlock != null && PlayerControl.LocalPlayer == Warlock.warlock && __instance == Warlock.warlock && HudManagerStartPatch.warlockCurseButton != null) {
-                if(Warlock.warlock.killTimer > HudManagerStartPatch.warlockCurseButton.Timer) {
+                if (Warlock.warlock.killTimer > HudManagerStartPatch.warlockCurseButton.Timer) {
                     HudManagerStartPatch.warlockCurseButton.Timer = Warlock.warlock.killTimer;
                 }
             }
 
             // Seer show flash and add dead player position
             if (Seer.seer != null && PlayerControl.LocalPlayer == Seer.seer && !Seer.seer.Data.IsDead && Seer.seer != target && Seer.mode <= 1) {
-                HudManager.Instance.FullScreen.enabled = true;
-                HudManager.Instance.StartCoroutine(Effects.Lerp(1f, new Action<float>((p) => {
-                    var renderer = HudManager.Instance.FullScreen;
-                    if (p < 0.5) {
-                        if (renderer != null)
-                            renderer.color = new Color(42f / 255f, 187f / 255f, 245f / 255f, Mathf.Clamp01(p * 2 * 0.75f));
-                    } else {
-                        if (renderer != null)
-                            renderer.color = new Color(42f / 255f, 187f / 255f, 245f / 255f, Mathf.Clamp01((1-p) * 2 * 0.75f));
-                    }
-                    if (p == 1f && renderer != null) renderer.enabled = false;
-                })));
+                Helpers.showFlash(new Color(42f / 255f, 187f / 255f, 245f / 255f));
             }
             if (Seer.deadBodyPositions != null) Seer.deadBodyPositions.Add(target.transform.position);
 
@@ -1010,19 +999,7 @@ namespace TheOtherRoles.Patches {
 
             // Show flash on bait kill to the killer if enabled
             if (Bait.bait != null && target == Bait.bait && Bait.showKillFlash && __instance == PlayerControl.LocalPlayer) {
-                HudManager.Instance.FullScreen.enabled = true;
-                HudManager.Instance.StartCoroutine(Effects.Lerp(1f, new Action<float>((p) => {
-                    var renderer = HudManager.Instance.FullScreen;
-                    if (p < 0.5) {
-                        if (renderer != null)
-                            renderer.color = new Color(204f / 255f, 102f / 255f, 0f / 255f, Mathf.Clamp01(p * 2 * 0.75f));
-                    }
-                    else {
-                        if (renderer != null)
-                            renderer.color = new Color(204f / 255f, 102f / 255f, 0f / 255f, Mathf.Clamp01((1 - p) * 2 * 0.75f));
-                    }
-                    if (p == 1f && renderer != null) renderer.enabled = false;
-                })));
+                Helpers.showFlash(new Color(204f / 255f, 102f / 255f, 0f / 255f));
             }
         }
     }
@@ -1044,7 +1021,7 @@ namespace TheOtherRoles.Patches {
 
     [HarmonyPatch(typeof(KillAnimation), nameof(KillAnimation.CoPerformKill))]
     class KillAnimationCoPerformKillPatch {
-        public static bool hideNextAnimation = true;
+        public static bool hideNextAnimation = false;
         public static void Prefix(KillAnimation __instance, [HarmonyArgument(0)]ref PlayerControl source, [HarmonyArgument(1)]ref PlayerControl target) {
             if (hideNextAnimation)
                 source = target;
@@ -1056,7 +1033,7 @@ namespace TheOtherRoles.Patches {
     class KillAnimationSetMovementPatch {
         private static int? colorId = null;
         public static void Prefix(PlayerControl source, bool canMove) {
-            Color color = source.myRend.material.GetColor("_BodyColor");
+            Color color = source.MyRend.material.GetColor("_BodyColor");
             if (color != null && Morphling.morphling != null && source.Data.PlayerId == Morphling.morphling.PlayerId) {
                 var index = Palette.PlayerColors.IndexOf(color);
                 if (index != -1) colorId = index;
index caef3065a7d4d0059eb7fc512ec50b87e37dbc70..aa009fcd2062d9b8f2da48cbd7a2337ffdde08a2 100644 (file)
@@ -38,6 +38,13 @@ namespace TheOtherRoles.Patches {
 
         public static void Postfix(RegionMenu __instance) {
             var template = DestroyableSingleton<JoinGameButton>.Instance;
+            var joinGameButtons = GameObject.FindObjectsOfType<JoinGameButton>();
+            foreach (var t in joinGameButtons) {  // The correct button has a background, the other 2 dont
+                if (t.GameIdText != null && t.GameIdText.Background != null) {
+                    template = t;
+                    break;
+                }
+            }
             if (template == null || template.GameIdText == null) return;
 
             if (ipField == null || ipField.gameObject == null) {
@@ -47,7 +54,7 @@ namespace TheOtherRoles.Patches {
                 if (arrow == null || arrow.gameObject == null) return;
                 UnityEngine.Object.DestroyImmediate(arrow.gameObject);
 
-                ipField.transform.localPosition = new Vector3(0, -1f, -100f);
+                ipField.transform.localPosition = new Vector3(0.225f, -1f, -100f);
                 ipField.characterLimit = 30;
                 ipField.AllowSymbols = true;
                 ipField.ForceUppercase = false;
@@ -80,7 +87,7 @@ namespace TheOtherRoles.Patches {
                 if (arrow == null || arrow.gameObject == null) return;
                 UnityEngine.Object.DestroyImmediate(arrow.gameObject);
 
-                portField.transform.localPosition = new Vector3(0, -1.75f, -100f);
+                portField.transform.localPosition = new Vector3(0.225f, -1.75f, -100f);
                 portField.characterLimit = 5;
                 portField.SetText(TheOtherRolesPlugin.Port.Value.ToString());
                 __instance.StartCoroutine(Effects.Lerp(0.1f, new Action<float>((p) => {
index cce8c3d5bfb9299166c06d5d3fe04becb3f17969..ac7aa85a3efe40ef363cd7c9678fd61c4e9968cb 100644 (file)
@@ -239,14 +239,13 @@ namespace TheOtherRoles.Patches {
             bool guesserFlag = CustomOptionHolder.guesserSpawnBothRate.getSelection() > 0 
                 && CustomOptionHolder.guesserSpawnRate.getSelection() > 0;
             bool sheriffFlag = CustomOptionHolder.deputySpawnRate.getSelection() > 0 
-                && CustomOptionHolder.sheriffSpawnRate.getSelection() > 0
-                && Sheriff.sheriff == null;
+                && CustomOptionHolder.sheriffSpawnRate.getSelection() > 0;
 
             if (!guesserFlag && !sheriffFlag) return; // assignDependentRoles is not needed
 
             int crew = data.crewmates.Count < data.maxCrewmateRoles ? data.crewmates.Count : data.maxCrewmateRoles; // Max number of crew loops
             int imp = data.impostors.Count < data.maxImpostorRoles ? data.impostors.Count : data.maxImpostorRoles; // Max number of imp loops
-            int crewSteps = crew / data.crewSettings.Keys.Count(); // Avarage crewvalues deducted after each loop
+            int crewSteps = crew / data.crewSettings.Keys.Count(); // Avarage crewvalues deducted after each loop 
             int impSteps = imp / data.impSettings.Keys.Count(); // Avarage impvalues deducted after each loop
 
             // set to false if needed, otherwise we can skip the loop
index 7dd49d7fcabd25049d56385322fe4fb034e6b478..2447b460f43b8ccd13e783a8b56106d1c56b3740 100644 (file)
@@ -369,8 +369,8 @@ namespace TheOtherRoles.Patches {
                                     if (!component || component.Data == null || component.Data.Disconnected || component.Data.IsDead)
                                     {
                                         num2--;
-                                    } else if (component?.myRend?.material != null) {
-                                        Color color = component.myRend.material.GetColor("_BodyColor");
+                                    } else if (component?.MyRend?.material != null) {
+                                        Color color = component.MyRend.material.GetColor("_BodyColor");
                                         if (Hacker.onlyColorType) {
                                             var id = Mathf.Max(0, Palette.PlayerColors.IndexOf(color));
                                             color = Helpers.isLighterColor((byte)id) ? Palette.PlayerColors[7] : Palette.PlayerColors[6];
index 1a014db423209d640bd3acaf7ae48a89c9a4e735..71e8143d6c046e6f570d364ab23c4a41db705866 100644 (file)
@@ -357,6 +357,7 @@ namespace TheOtherRoles
             }
             HudManager.Instance.FullScreen.color = new Color(0f, 0.5f, 0.8f, 0.3f);
             HudManager.Instance.FullScreen.enabled = true;
+            HudManager.Instance.FullScreen.gameObject.SetActive(true);
             HudManager.Instance.StartCoroutine(Effects.Lerp(TimeMaster.rewindTime / 2, new Action<float>((p) => {
                 if (p == 1f) HudManager.Instance.FullScreen.enabled = false;
             })));
@@ -391,21 +392,7 @@ namespace TheOtherRoles
             bool isShieldedAndShow = Medic.shielded == PlayerControl.LocalPlayer && Medic.showAttemptToShielded;
             bool isMedicAndShow = Medic.medic == PlayerControl.LocalPlayer && Medic.showAttemptToMedic;
 
-            if ((isShieldedAndShow || isMedicAndShow) && HudManager.Instance?.FullScreen != null) {
-                HudManager.Instance.FullScreen.enabled = true;
-                HudManager.Instance.StartCoroutine(Effects.Lerp(0.5f, new Action<float>((p) => {
-                    var renderer = HudManager.Instance.FullScreen;
-                    Color c = Palette.ImpostorRed;
-                    if (p < 0.5) {
-                        if (renderer != null)
-                            renderer.color = new Color(c.r, c.g, c.b, Mathf.Clamp01(p * 2 * 0.75f));
-                    } else {
-                        if (renderer != null)
-                            renderer.color = new Color(c.r, c.g, c.b, Mathf.Clamp01((1-p) * 2 * 0.75f));
-                    }
-                    if (p == 1f && renderer != null) renderer.enabled = false;
-                })));
-            }
+            if (isShieldedAndShow || isMedicAndShow) Helpers.showFlash(Palette.ImpostorRed, duration: 0.5f);
         }
 
         public static void shifterShift(byte targetId) {
diff --git a/TheOtherRoles/Resources/HorseModeButtonOff.png b/TheOtherRoles/Resources/HorseModeButtonOff.png
new file mode 100644 (file)
index 0000000..dac3a5d
Binary files /dev/null and b/TheOtherRoles/Resources/HorseModeButtonOff.png differ
diff --git a/TheOtherRoles/Resources/HorseModeButtonOn.png b/TheOtherRoles/Resources/HorseModeButtonOn.png
new file mode 100644 (file)
index 0000000..ddd7ccb
Binary files /dev/null and b/TheOtherRoles/Resources/HorseModeButtonOn.png differ
diff --git a/TheOtherRoles/Resources/bannerTheHorseRoles.png b/TheOtherRoles/Resources/bannerTheHorseRoles.png
new file mode 100644 (file)
index 0000000..3ff904a
Binary files /dev/null and b/TheOtherRoles/Resources/bannerTheHorseRoles.png differ
index 298b52e3eefa2eb99d24c0d815a0b506146981b3..83f4d73cc36e01cb4c915b4c67595cc204a07acc 100644 (file)
@@ -166,7 +166,7 @@ namespace TheOtherRoles
                 if (!formerSheriff) formerSheriff = sheriff;
                 sheriff = deputy;
                 currentTarget = null;
-                cooldown = CustomOptionHolder.jackalKillCooldown.getFloat();
+                cooldown = CustomOptionHolder.sheriffCooldown.getFloat();
             }
 
             public static void clearAndReload() {
index 4db5fc3b0bd632738d8db5b86b7460791575b502..a599017991dbd5509b963a03bb7d6e976f42400c 100644 (file)
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
     <PropertyGroup>
         <TargetFramework>netstandard2.1</TargetFramework>
-        <Version>3.4.4</Version>
+        <Version>3.4.5</Version>
         <Description>TheOtherRoles</Description>
         <Authors>Eisbison</Authors>
     </PropertyGroup>