]> git.deb.at Git - rhonda/theotherroles.git/commitdiff
Hotfix 2.6.1
authorEisbison <eisbison.creator@gmail.com>
Sun, 9 May 2021 15:01:08 +0000 (17:01 +0200)
committerEisbison <eisbison.creator@gmail.com>
Sun, 9 May 2021 15:01:08 +0000 (17:01 +0200)
README.md
Source Code/Buttons.cs
Source Code/CustomColors.cs
Source Code/CustomOptions.cs
Source Code/Helpers.cs
Source Code/IntroPatch.cs
Source Code/Main.cs
Source Code/MeetingPatch.cs
Source Code/RoleAssignmentPatch.cs
Source Code/TheOtherRoles.cs
Source Code/TheOtherRoles.csproj

index d7c6e0f79333ed5db6e79d52e9535ee538a1f1f6..22a0fd95205beef868375ba772c935c7f26b2ec8 100644 (file)
--- a/README.md
+++ b/README.md
@@ -33,6 +33,7 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
 # Releases\r
 | Among Us - Version| Mod Version | Link |\r
 |----------|-------------|-----------------|\r
+| 2021.4.14s| v2.6.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.6.1/TheOtherRoles.zip)\r
 | 2021.4.14s| v2.6.0| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.6.0/TheOtherRoles.zip)\r
 | 2021.4.14s| v2.5.1| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.5.1/TheOtherRoles.zip)\r
 | 2021.4.14s| v2.5.0| [Download](https://github.com/Eisbison/TheOtherRoles/releases/download/v2.5.0/TheOtherRoles.zip)\r
@@ -59,6 +60,12 @@ The [Role Assignment](#role-assignment) sections explains how the roles are bein
 <details>\r
   <summary>Click to show the Changelog</summary>\r
 \r
+**Version 2.6.1**\r
+- Fixed a bug where the Sheriff was unable to kill the Arsonist\r
+- Fixed a bug in the role assignment system\r
+- Added the option to select the Dleks map\r
+- Improved the overlay of the Arsonist\r
+\r
 **Version 2.6.0**\r
 - **New Role:** [Arsonist](#arsonist)\r
 - Added an Ingame Updater, to make it easier to update the Mod\r
@@ -327,6 +334,7 @@ The mod adds a few new settings to Among Us (in addition to the role settings):
 - **Allow Skips On Emergency Meetings:** If set to false, there will not be a skip button in emergency meetings. If a player does not vote, he'll vote himself.\r
 - **Hide Player Names:** Hides the names of all players that have role which is unknown to you. Team Lovers/Impostors/Jackal still see the names of their teammates. Impostors can alse see the name of the Spy and everyone can still see the age of the child.\r
 - **Ghosts Can See Roles And Remaining Tasks:** If set to true, ghosts can see the role and the number of remaining tasks of each player.\r
+- **Dleks:** You are now able to select the Dleks map. \r
 \r
 # Custom Hats\r
 ## Create and submit new hat designs\r
index 3fb0eebd6419016abe70eca7282643277bb5352e..bfb463883da2cf8df41988ca2a9f7d8ae84107ee 100644 (file)
@@ -174,7 +174,7 @@ namespace TheOtherRoles
                     byte targetId = 0;
                     if ((Sheriff.currentTarget.Data.IsImpostor && (Sheriff.currentTarget != Child.child || Child.isGrownUp())) || 
                         (Sheriff.spyCanDieToSheriff && Spy.spy == Sheriff.currentTarget) ||
-                        (Sheriff.canKillNeutrals && (Jester.jester == Sheriff.currentTarget || Jackal.jackal == Sheriff.currentTarget || Sidekick.sidekick == Sheriff.currentTarget))) {
+                        (Sheriff.canKillNeutrals && (Arsonist.arsonist == Sheriff.currentTarget || Jester.jester == Sheriff.currentTarget || Jackal.jackal == Sheriff.currentTarget || Sidekick.sidekick == Sheriff.currentTarget))) {
                         targetId = Sheriff.currentTarget.PlayerId;
                     }
                     else {
@@ -768,14 +768,9 @@ namespace TheOtherRoles
                     Arsonist.douseTarget = null;
                     arsonistButton.Timer = Arsonist.dousedEveryoneAlive() ? 0 : arsonistButton.MaxTimer;
 
-                    int playerCounter = 0;
-                    Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z);
-                    bottomLeft += new Vector3(-0.25f, -0.25f, 0);
                     foreach (PlayerControl p in Arsonist.dousedPlayers) {
                         if (Arsonist.dousedIcons.ContainsKey(p.PlayerId)) {
-                            Arsonist.dousedIcons[p.PlayerId].gameObject.SetActive(true);
-                            Arsonist.dousedIcons[p.PlayerId].transform.localPosition = bottomLeft + Vector3.right * playerCounter * 0.35f;
-                            playerCounter++;
+                            Arsonist.dousedIcons[p.PlayerId].setSemiTransparent(false);
                         }
                     }
                 }
index cc1e49dd05010bc6dd7bb0f6e13356a27cbcfa14..cab1fbc24879953ba82fd351afd2a44139b7e015 100644 (file)
@@ -163,6 +163,39 @@ namespace TheOtherRoles {
                     }
                 }
             }
+            [HarmonyPatch(typeof(SaveManager), nameof(SaveManager.LoadPlayerPrefs))]
+            private static class LoadPlayerPrefsPatch { // Fix Potential issues with broken colors
+                private static bool needsPatch = false;
+                public static void Prefix([HarmonyArgument(0)] bool overrideLoad) {
+                    if (!SaveManager.loaded || overrideLoad)
+                        needsPatch = true;
+                }
+                public static void Postfix() {
+                    if (!needsPatch) return;
+                    SaveManager.colorConfig %= (uint)CustomColors.pickableColors;
+                    needsPatch = false;
+                }
+            }
+            [HarmonyPatch(typeof(PlayerControl), nameof(PlayerControl.CheckColor))]
+            private static class PlayerControlCheckColorPatch {
+                private static bool isTaken(PlayerControl player, uint color) {
+                    foreach (GameData.PlayerInfo p in GameData.Instance.AllPlayers)
+                        if (!p.Disconnected && p.PlayerId != player.PlayerId && p.ColorId == color)
+                            return true;
+                    return false;
+                }
+                public static bool Prefix(PlayerControl __instance, [HarmonyArgument(0)] byte bodyColor) { // Fix incorrect color assignment
+                    uint color = (uint)bodyColor;
+                   if (isTaken(__instance, color) || color >= Palette.PlayerColors.Length) {
+                        int num = 0;
+                        while (num++ < 50 && (color >= CustomColors.pickableColors || isTaken(__instance, color))) {
+                            color = (color + 1) % (uint)CustomColors.pickableColors;
+                        }
+                    }
+                    __instance.RpcSetColor((byte)color);
+                    return false;
+                }
+            }
         }
     }
 }
index c777838355ff036cf34b946f81cbaa17e6b0547d..9fa79860144acc0db40db2c3a6fb6e00cadab2cc 100644 (file)
@@ -229,7 +229,7 @@ namespace TheOtherRoles {
 
             sheriffSpawnRate = CustomOption.Create(100, cs(Sheriff.color, "Sheriff"), rates, null, true);
             sheriffCooldown = CustomOption.Create(101, "Sheriff Cooldown", 30f, 10f, 60f, 2.5f, sheriffSpawnRate);
-            sheriffCanKillNeutrals = CustomOption.Create(102, "Neutrals Can Kill The Jester", false, sheriffSpawnRate);
+            sheriffCanKillNeutrals = CustomOption.Create(102, "Sheriff Can Kill Neutrals", false, sheriffSpawnRate);
 
 
             lighterSpawnRate = CustomOption.Create(110, cs(Lighter.color, "Lighter"), rates, null, true);
@@ -510,6 +510,29 @@ namespace TheOtherRoles {
         public static void Prefix(GameSettingMenu __instance) {
             __instance.HideForOnline = new Transform[]{};
         }
+
+        public static void Postfix(GameSettingMenu __instance) {
+            var mapNameTransform = __instance.AllItems.FirstOrDefault(x => x.gameObject.activeSelf && 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 < GameOptionsData.MapNames.Length; i++) {
+                var kvp = new Il2CppSystem.Collections.Generic.KeyValuePair<string, int>();
+                kvp.key = GameOptionsData.MapNames[i];
+                kvp.value = i;
+                options.Add(kvp);
+            }
+            mapNameTransform.GetComponent<KeyValueOption>().Values = options;
+        }
+    }
+
+    [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;
+        }
     }
 
     [HarmonyPatch] 
index 786aa00e719a8cad0a9c01e3e6147b44c0688217..8e0f346ad39a054d2688513e465b223c1dcc859f 100644 (file)
@@ -192,6 +192,13 @@ namespace TheOtherRoles {
                 player.Data.Tasks.Clear();
         }
 
+        public static void setSemiTransparent(this PoolablePlayer player, bool value) {
+            float alpha = value ? 0.25f : 1f;
+            foreach (SpriteRenderer r in player.gameObject.GetComponentsInChildren<SpriteRenderer>())
+                r.color = new Color(r.color.r, r.color.g, r.color.b, alpha);
+            player.NameText.color = new Color(player.NameText.color.r, player.NameText.color.g, player.NameText.color.b, alpha);
+        }
+
         public static string cs(Color c, string s) {
             return string.Format("<color=#{0:X2}{1:X2}{2:X2}{3:X2}>{4}</color>", ToByte(c.r), ToByte(c.g), ToByte(c.b), ToByte(c.a), s);
         }
index 910d619862568a5a9b2afef84c4434c0452703a5..c95696a93088fc6eb12fdfce228ef055437b27b0 100644 (file)
@@ -27,8 +27,7 @@ namespace TheOtherRoles
                         PlayerControl.SetPetImage(data.PetId, data.ColorId, poolablePlayer.PetSlot);
                         poolablePlayer.NameText.text = data.PlayerName;
                         poolablePlayer.SetFlipX(true);
-                        poolablePlayer.gameObject.SetActive(false);
-
+                        poolablePlayer.setSemiTransparent(true);
                         Arsonist.dousedIcons[player.PlayerId] = poolablePlayer;
                         playerCounter++;
                     }
index c5e50566d1184e6f26670ead5d7c55970d738644..a51e8db6e867bc4144d143e0870b6e0398f4f102 100644 (file)
@@ -19,7 +19,7 @@ namespace TheOtherRoles
     public class TheOtherRolesPlugin : BasePlugin
     {
         public const string Id = "me.eisbison.theotherroles";
-        public const string VersionString = "2.6.0";
+        public const string VersionString = "2.6.1";
         public static System.Version Version = System.Version.Parse(VersionString);
 
         public Harmony Harmony { get; } = new Harmony(Id);
index 43eb8326d37016cfd1108abba39ac20796929e34..f65d4c86074322b207ebb77075040d2e521631dc 100644 (file)
@@ -485,6 +485,22 @@ namespace TheOtherRoles
                     }
                     Seer.deadBodyPositions = new List<Vector3>();
                 }
+
+                // Arsonist deactivate dead poolable players
+                if (Arsonist.arsonist != null && Arsonist.arsonist == PlayerControl.LocalPlayer) {
+                    int visibleCounter = 0;
+                    Vector3 bottomLeft = new Vector3(-HudManager.Instance.UseButton.transform.localPosition.x, HudManager.Instance.UseButton.transform.localPosition.y, HudManager.Instance.UseButton.transform.localPosition.z);
+                    bottomLeft += new Vector3(-0.25f, -0.25f, 0);
+                    foreach (PlayerControl p in PlayerControl.AllPlayerControls) {
+                        if (!Arsonist.dousedIcons.ContainsKey(p.PlayerId)) continue;
+                        if (p.Data.IsDead || p.Data.Disconnected) {
+                            Arsonist.dousedIcons[p.PlayerId].gameObject.SetActive(true);
+                        } else {
+                            Arsonist.dousedIcons[p.PlayerId].transform.localPosition = bottomLeft + Vector3.right * visibleCounter * 0.35f;
+                            visibleCounter++;
+                        }                        
+                    }
+                }
             }
         }
     }
index ef7ec1dae60e534f7ec0843d0a70e0e88c7b9a77..34a4dbb193e31f7528ba0032c91e58335695748a 100644 (file)
@@ -81,7 +81,6 @@ namespace TheOtherRoles
             crewSettings.Add((byte)RoleId.Hacker, CustomOptionHolder.hackerSpawnRate.getSelection());
             crewSettings.Add((byte)RoleId.Tracker, CustomOptionHolder.trackerSpawnRate.getSelection());
             crewSettings.Add((byte)RoleId.Snitch, CustomOptionHolder.snitchSpawnRate.getSelection());
-            crewSettings.Add((byte)RoleId.Jackal, CustomOptionHolder.jackalSpawnRate.getSelection());
             if (impostors.Count > 1) // Spy is useless with less than 2 Impostors
                 crewSettings.Add((byte)RoleId.Spy, CustomOptionHolder.spySpawnRate.getSelection());
             crewSettings.Add((byte)RoleId.SecurityGuard, CustomOptionHolder.securityGuardSpawnRate.getSelection());
@@ -139,7 +138,7 @@ namespace TheOtherRoles
                         }
                     }
                 } else { // Other
-                    for (int j = 0; j < entry.Value; j++) crewTickets.Add(entry.Key);
+                    for (int j = 0; j < entry.Value; j++) neutralTickets.Add(entry.Key);
                 }
             }
 
index 644b85b0869c6511d78e5fe8433f1ca6c8ec9ea8..067c9b3590bf487f61026a28a0c6f626c34b672b 100644 (file)
@@ -893,7 +893,7 @@ namespace TheOtherRoles
         }
 
         public static bool dousedEveryoneAlive() {
-            return PlayerControl.AllPlayerControls.ToArray().All(x => { return x == Arsonist.arsonist || x.Data.IsDead || Arsonist.dousedPlayers.Any(y => y.PlayerId == x.PlayerId); });
+            return PlayerControl.AllPlayerControls.ToArray().All(x => { return x == Arsonist.arsonist || x.Data.IsDead || x.Data.Disconnected || Arsonist.dousedPlayers.Any(y => y.PlayerId == x.PlayerId); });
         }
 
         public static void clearAndReload() {
index 30d409db78e56ebaf4341d9db8c260b79bc90f49..ac8e6a2a1290e47bbc613bc67ad2389bd303ab7b 100644 (file)
@@ -1,7 +1,7 @@
 <Project Sdk="Microsoft.NET.Sdk">
     <PropertyGroup>
         <TargetFramework>netstandard2.1</TargetFramework>
-        <Version>2.6.0</Version>
+        <Version>2.6.1</Version>
         <Description>TheOtherRoles</Description>
         <Authors>Eisbison</Authors>
     </PropertyGroup>