예제 #1
0
            static bool Prefix(MeetingHud __instance, [HarmonyArgument(0)] byte callId, [HarmonyArgument(1)] MessageReader reader)
            {
                switch (callId)
                {
                case 22:
                    __instance.Close();
                    break;

                case 23: {
                    byte[]     states     = reader.ReadBytesAndSize();
                    byte[]     votes      = reader.ReadBytesAndSize();
                    PlayerInfo playerById = GameData.Instance.GetPlayerById(reader.ReadByte());
                    bool       tie        = reader.ReadBoolean();
                    VotingComplete(__instance, states, votes, playerById, tie);
                    break;
                }

                case 24: {
                    byte  srcPlayerId     = reader.ReadByte();
                    sbyte suspectPlayerId = reader.ReadSByte();
                    __instance.CastVote(srcPlayerId, suspectPlayerId);
                    break;
                }

                case 25:
                    __instance.ClearVote();
                    break;
                }
                return(false);
            }
예제 #2
0
            public static bool Prefix(MeetingHud __instance, byte HKHMBLJFLMC, Hazel.MessageReader ALMCIJKELCP)
            {
                switch (HKHMBLJFLMC)
                {
                case 22:
                    __instance.Close();
                    break;

                case 23: {
                    byte[]     states     = ALMCIJKELCP.ReadBytesAndSize();
                    byte[]     votes      = ALMCIJKELCP.ReadBytesAndSize();
                    PlayerInfo playerById = GameData.Instance.GetPlayerById(ALMCIJKELCP.ReadByte());
                    bool       tie        = ALMCIJKELCP.ReadBoolean();
                    VotingComplete(__instance, states, votes, playerById, tie);
                    break;
                }

                case 24: {
                    byte  srcPlayerId     = ALMCIJKELCP.ReadByte();
                    sbyte suspectPlayerId = ALMCIJKELCP.ReadSByte();
                    __instance.CastVote(srcPlayerId, suspectPlayerId);
                    break;
                }

                case 25:
                    __instance.ClearVote();
                    break;
                }
                return(false);
            }
예제 #3
0
            public static void Postfix(MeetingHud __instance)
            {
                if (Input.GetKeyDown(KeyCode.UpArrow) || Input.mouseScrollDelta.y > 0f)
                {
                    currentPage = Mathf.Clamp(currentPage - 1, 0, maxPages - 1);
                }
                else if (Input.GetKeyDown(KeyCode.DownArrow) || Input.mouseScrollDelta.y < 0f)
                {
                    currentPage = Mathf.Clamp(currentPage + 1, 0, maxPages - 1);
                }

                if (__instance.TimerText.Text != lastTimerText)
                {
                    __instance.TimerText.Text = (lastTimerText = __instance.TimerText.Text + $" ({currentPage + 1}/{maxPages})");
                }

                PlayerVoteArea[] playerButtons = __instance.HBDFFAHBIGI.OrderBy(x => x.isDead).ToArray();
                int i = 0;

                foreach (PlayerVoteArea button in playerButtons)
                {
                    if (i >= currentPage * 10 && i < (currentPage + 1) * 10)
                    {
                        button.gameObject.SetActive(true);

                        int relativeIndex = i % 10;
                        button.transform.localPosition = __instance.VoteOrigin + new Vector3(__instance.VoteButtonOffsets.x * (relativeIndex % 2), __instance.VoteButtonOffsets.y * (relativeIndex / 2), -1f);
                    }
                    else
                    {
                        button.gameObject.SetActive(false);
                    }
                    i++;
                }
            }
예제 #4
0
            public static bool Prefix(MeetingHud __instance)
            {
                if (!__instance.HBDFFAHBIGI.All(ps => ps.isDead || ps.didVote))
                {
                    return(false);
                }
                byte[] self = calculateVotes(__instance.HBDFFAHBIGI);

                int        maxIdx = indexOfMax(self, out bool tie) - 1;
                PlayerInfo exiled = GameData.Instance.GetPlayerById((byte)maxIdx);

                byte[] states = __instance.HBDFFAHBIGI.Select(s => s.GetState()).ToArray();
                byte[] votes  = __instance.HBDFFAHBIGI.Select(s => (byte)s.votedFor).ToArray();
                if (AmongUsClient.Instance.BEIEANEKAFC)
                {
                    MessageWriter messageWriter = AmongUsClient.Instance.StartRpc(__instance.NetId, 23, SendOption.Reliable);
                    messageWriter.WriteBytesAndSize(states);
                    messageWriter.WriteBytesAndSize(votes);                     //Added because of the state's 4 bit vote id limit
                    messageWriter.Write(exiled?.JKOMCOJCAID ?? byte.MaxValue);
                    messageWriter.Write(tie);
                    messageWriter.EndMessage();
                }

                MeetingHudHandleRpcPatch.VotingComplete(__instance, states, votes, exiled, tie);
                return(false);
            }
예제 #5
0
 public static void Postfix(MeetingHud __instance)
 {
     if (Sheriff.instance == null)
     {
         return;
     }
     Sheriff.instance.killTimer = CustomGameOptions.SheriffKillCD;
 }
예제 #6
0
 public static void updateMeetingHUD(MeetingHud __instance)
 {
     foreach (PlayerVoteArea player in __instance.HBDFFAHBIGI)
     {
         if (player.NameText.Text == PlayerControlPatch.Sweeper.name && PlayerControlPatch.IsSweeper(PlayerControl.LocalPlayer))
         {
             player.NameText.Color = new Color(0f, 0.33f, 0.79f, 1f);
         }
     }
 }
예제 #7
0
 public static void updateMeetingHUD(MeetingHud __instance)
 {
     foreach (PlayerVoteArea player in __instance.HBDFFAHBIGI)
     {
         if (player.NameText.Text == PlayerControlPatch.Torch.name && PlayerControlPatch.isTorch(PlayerControl.LocalPlayer))
         {
             player.NameText.Color = new Color(1f, 0.37f, 0.125f, 1f);
         }
     }
 }
예제 #8
0
 public static void updateMeetingHUD(MeetingHud __instance)
 {
     foreach (PlayerVoteArea player in __instance.HBDFFAHBIGI)
     {
         if (PlayerControlPatch.Mayor.name == player.NameText.Text && PlayerControlPatch.IsMayor(PlayerControl.LocalPlayer))
         {
             player.NameText.Color = new Color(0.44f, 0.31f, 0.66f, 1f);
         }
     }
 }
 public static void updateMeetingHud(MeetingHud __instance, PlayerController localPlayer)
 {
     foreach (PlayerMeeting player in __instance.HBDFFAHBIGI)
     {
         if (player.NameText.Text == localPlayer.PlayerControl.nameText.Text)
         {
             player.NameText.Color = ChameleonPlayer.color;
             return;
         }
     }
 }
예제 #10
0
 public static void updateOOCJALPKPEP(OOCJALPKPEP __instance)
 {
     foreach (HDJGDMFCHDN HDJGDMFCHDN in __instance.HBDFFAHBIGI)
     {
         if (HDJGDMFCHDN.NameText.Text == PlayerControlPatch.Sheriff.name)
         {
             if (CustomGameOptions.showSheriff | PlayerControlPatch.isSheriff(FFGALNAPKCD.LocalPlayer))
             {
                 HDJGDMFCHDN.NameText.Color = new Color(1, (float)(204.0 / 255.0), 0, 1);
             }
         }
     }
 }
예제 #11
0
 public static void Postfix(MeetingHud __instance)
 {
     foreach (var obj in __instance.HBDFFAHBIGI)
     {
         foreach (var role in AllRoles)
         {
             if (role.NameColorVisible && obj.NameText.Text == role.PlayerController.PlayerData.PlayerName)
             {
                 role.PlayerController.PlayerControl.nameText.Color = role.NameColor;
             }
         }
     }
 }
예제 #12
0
            public static void VotingComplete(MeetingHud __instance, byte[] states, byte[] votes, PlayerInfo exiled, bool tie)
            {
                if (__instance.DCCFKHIPIOF == MeetingHud.BAMDJGFKOFP.Results)
                {
                    return;
                }
                __instance.DCCFKHIPIOF = MeetingHud.BAMDJGFKOFP.Results;
                __instance.EKGJAHLFJFP = __instance.discussionTimer;
                __instance.LCJLLGKMINO = exiled;
                __instance.GEJDOOANNJD = tie;
                __instance.SkipVoteButton.gameObject.SetActive(false);
                __instance.SkippedVoting.gameObject.SetActive(true);

                PopulateResults(__instance, states, votes);
                __instance.GOJIAJFHPIB();
            }
예제 #13
0
            public static void PopulateResults(MeetingHud __instance, byte[] states, byte[] votes)
            {
                __instance.TitleText.Text = "Voting Results";
                int num = 0;

                for (int i = 0; i < __instance.HBDFFAHBIGI.Length; i++)
                {
                    PlayerVoteArea playerVoteArea = __instance.HBDFFAHBIGI[i];
                    playerVoteArea.ClearForResults();
                    int num2 = 0;
                    for (int j = 0; j < states.Length; j++)
                    {
                        if ((states[j] & 128) == 0)                           //!isDead
                        {
                            PlayerInfo playerById = GameData.Instance.GetPlayerById((byte)__instance.HBDFFAHBIGI[j].HOBAOICNHFH);
                            int        votedFor   = (sbyte)votes[j];

                            SpriteRenderer spriteRenderer = UnityEngine.Object.Instantiate <SpriteRenderer>(__instance.PlayerVotePrefab);
                            if (PlayerControl.GameOptions.AGGKAFILPGD)
                            {
                                PlayerControl.SetPlayerMaterialColors(Palette.ICNEJBPIBDB, spriteRenderer);
                            }
                            else
                            {
                                PlayerControl.SetPlayerMaterialColors((int)playerById.EHAHBDFODKC, spriteRenderer);
                            }
                            spriteRenderer.transform.localScale = Vector3.zero;

                            if ((int)playerVoteArea.HOBAOICNHFH == votedFor)
                            {
                                spriteRenderer.transform.SetParent(playerVoteArea.transform);
                                spriteRenderer.transform.localPosition = __instance.FGJMDFDIKEK + new Vector3(__instance.IOHLPLMJHIB.x * (float)num2, 0f, 0f);
                                __instance.StartCoroutine(Effects.NJOHOOJGMBC((float)num2 * 0.5f, spriteRenderer.transform, 1f, 0.5f));
                                num2++;
                            }
                            else if (i == 0 && votedFor == -1)
                            {
                                spriteRenderer.transform.SetParent(__instance.SkippedVoting.transform);
                                spriteRenderer.transform.localPosition = __instance.FGJMDFDIKEK + new Vector3(__instance.IOHLPLMJHIB.x * (float)num, 0f, 0f);
                                __instance.StartCoroutine(Effects.NJOHOOJGMBC((float)num * 0.5f, spriteRenderer.transform, 1f, 0.5f));
                                num++;
                            }
                        }
                    }
                }
            }
예제 #14
0
 public static bool Prefix(MeetingHud __instance, ref Il2CppStructArray <byte> __result)
 {
     byte[] array = new byte[11];
     foreach (PlayerVoteArea player in __instance.HBDFFAHBIGI)
     {
         if (player.didVote)
         {
             int num = (int)(player.votedFor + 1);
             if (num >= 0 && num < array.Length)
             {
                 byte[] array2         = array;
                 int    num2           = num;
                 byte   voteImportance = player.NameText.Text == PlayerControlPatch.Mayor.nameText.Text ? (byte)2 : (byte)1;
                 array2[num2] += voteImportance;
             }
         }
     }
     __result = array;
     return(false);
 }
예제 #15
0
        public static void updateMeetingHUD(OOCJALPKPEP __instance)
        {
            if (Sheriff.instance == null)
            {
                return;
            }

            foreach (HDJGDMFCHDN HDJGDMFCHDN in __instance.HBDFFAHBIGI)
            {
                {
                    if (HDJGDMFCHDN.NameText.Text == Sheriff.instance.parent.playerdata.name)
                    {
                        if (Sheriff.instance.parent == PlayerController.LocalPlayer || CustomGameOptions.showSheriff)
                        {
                            HDJGDMFCHDN.NameText.Color = Sheriff.color;
                        }
                    }
                }
            }
        }
예제 #16
0
            public static void Postfix(MeetingHud __instance)
            {
                if (TheJester.GameMode.NumJesters == 0)
                {
                    return;
                }

                if (TheJester.GameMode.AllRolePlayers.Where(x => x.AmRolePlayer).Count() == 0)
                {
                    return;
                }

                foreach (var obj in __instance.HBDFFAHBIGI)
                {
                    foreach (var jester in TheJester.GameMode.AllRolePlayers)
                    {
                        if (obj.NameText.Text == jester.PlayerController.PlayerData.PlayerName)
                        {
                            obj.NameText.Color = new Color(0.74901960784f, 0, 1f);
                        }
                    }
                }
            }
예제 #17
0
 public static void Postfix(OOCJALPKPEP __instance)
 {
     PlayerControlPatch.lastKilled = DateTime.UtcNow;
     PlayerControlPatch.lastKilled = PlayerControlPatch.lastKilled.AddSeconds(8);
 }