Пример #1
0
        static bool Prefix(MethodBase __originalMethod)
        {
            if (PlayerControlPatch.isSheriff(FFGALNAPKCD.LocalPlayer))
            {
                if (PlayerControlPatch.SheriffKillTimer() == 0)
                {
                    var dist = PlayerControlPatch.getDistBetweenPlayers(FFGALNAPKCD.LocalPlayer, PlayerControlPatch.closestPlayer);
                    if (dist < KMOGFLPJLLK.JMLGACIOLIK[FFGALNAPKCD.GameOptions.DLIBONBKPKL])
                    {
                        if (PlayerControlPatch.closestPlayer.NDGFFHMFGIG.DAPKNDBLKIA == false)
                        {
                            MessageWriter writer = FMLLKEACGIO.Instance.StartRpcImmediately(FFGALNAPKCD.LocalPlayer.NetId, (byte)CustomRPC.SheriffKill, Hazel.SendOption.None, -1);
                            writer.Write(FFGALNAPKCD.LocalPlayer.PlayerId);
                            writer.Write(FFGALNAPKCD.LocalPlayer.PlayerId);
                            FMLLKEACGIO.Instance.FinishRpcImmediately(writer);
                            FFGALNAPKCD.LocalPlayer.MurderPlayer(FFGALNAPKCD.LocalPlayer);
                        }
                        else
                        {
                            MessageWriter writer = FMLLKEACGIO.Instance.StartRpcImmediately(FFGALNAPKCD.LocalPlayer.NetId, (byte)CustomRPC.SheriffKill, Hazel.SendOption.None, -1);
                            writer.Write(FFGALNAPKCD.LocalPlayer.PlayerId);
                            writer.Write(PlayerControlPatch.closestPlayer.PlayerId);
                            FMLLKEACGIO.Instance.FinishRpcImmediately(writer);
                            FFGALNAPKCD.LocalPlayer.MurderPlayer(PlayerControlPatch.closestPlayer);
                        }

                        PlayerControlPatch.lastKilled = DateTime.UtcNow;
                    }
                }

                return(false);
            }
            return(true);
        }
Пример #2
0
 public static void Postfix(PENEIDJGGAF.CKACLKCOJFO __instance)
 {
     if (PlayerControlPatch.isSheriff(FFGALNAPKCD.LocalPlayer))
     {
         __instance.field_Public_PENEIDJGGAF_0.Title.Text                   = "Sheriff";
         __instance.field_Public_PENEIDJGGAF_0.Title.Color                  = new Color(1, (float)(204.0 / 255.0), 0, 1);
         __instance.field_Public_PENEIDJGGAF_0.ImpostorText.Text            = "Shoot the [FF0000FF]Impostor";
         __instance.field_Public_PENEIDJGGAF_0.BackgroundBar.material.color = new Color(1, (float)(204.0 / 255.0), 0, 1);
     }
 }
Пример #3
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);
             }
         }
     }
 }
Пример #4
0
        public static void Postfix(byte HKHMBLJFLMC, MessageReader ALMCIJKELCP)
        {
            try
            {
                switch (HKHMBLJFLMC)
                {
                case (byte)CustomRPC.SetSheriff:
                {
                    byte SheriffId = ALMCIJKELCP.ReadByte();
                    foreach (FFGALNAPKCD player in FFGALNAPKCD.AllPlayerControls)
                    {
                        if (player.PlayerId == SheriffId)
                        {
                            Sheriff = player;
                            if (CustomGameOptions.showSheriff)
                            {
                                player.nameText.Color = new Color(1, (float)(204.0 / 255.0), 0, 1);
                            }
                        }
                    }
                    break;
                }

                case (byte)CustomRPC.SyncCustomSettings:
                {
                    CustomGameOptions.showSheriff   = ALMCIJKELCP.ReadBoolean();
                    CustomGameOptions.SheriffKillCD = System.BitConverter.ToSingle(ALMCIJKELCP.ReadBytes(4).ToArray(), 0);
                    break;
                }

                case (byte)CustomRPC.SheriffKill:
                {
                    FFGALNAPKCD killer = PlayerControlPatch.getPlayerById(ALMCIJKELCP.ReadByte());
                    FFGALNAPKCD target = PlayerControlPatch.getPlayerById(ALMCIJKELCP.ReadByte());
                    if (PlayerControlPatch.isSheriff(killer))
                    {
                        killer.MurderPlayer(target);
                    }
                    break;
                }
                }
            }
            catch (Exception e) {
                SheriffMod.log.LogInfo("RPC error... possible reasons: Not all players in the lobby have installed the mod or Sheriff mod versions do not match");
            }
        }
Пример #5
0
        public static void Postfix(PIEFJFEOGOL __instance)
        {
            KillButton = __instance.KillButton;
            if (OOCJALPKPEP.Instance != null)
            {
                updateOOCJALPKPEP(OOCJALPKPEP.Instance);
            }

            UpdateGameSettingsText(__instance);

            if (FFGALNAPKCD.AllPlayerControls.Count > 1 & PlayerControlPatch.Sheriff != null)
            {
                if (PlayerControlPatch.isSheriff(FFGALNAPKCD.LocalPlayer))
                {
                    FFGALNAPKCD.LocalPlayer.nameText.Color = new Color(1, (float)(204.0 / 255.0), 0, 1);
                    if (FFGALNAPKCD.LocalPlayer.NDGFFHMFGIG.DLPCKPBIJOE)
                    {
                        KillButton.gameObject.SetActive(false);
                        KillButton.isActive = false;
                    }
                    else
                    {
                        KillButton.gameObject.SetActive(true);
                        KillButton.isActive = true;
                        KillButton.SetCoolDown(PlayerControlPatch.SheriffKillTimer(), FFGALNAPKCD.GameOptions.IGHCIKIDAMO + 15.0f);
                        PlayerControlPatch.closestPlayer = PlayerControlPatch.getClosestPlayer(FFGALNAPKCD.LocalPlayer);
                        double dist = PlayerControlPatch.getDistBetweenPlayers(FFGALNAPKCD.LocalPlayer, PlayerControlPatch.closestPlayer);
                        if (dist < KMOGFLPJLLK.JMLGACIOLIK[FFGALNAPKCD.GameOptions.DLIBONBKPKL])
                        {
                            KillButton.SetTarget(PlayerControlPatch.closestPlayer);
                        }
                        if (Input.GetKeyInt(KeyCode.Q))
                        {
                            KillButton.PerformKill();
                        }
                    }
                }
                else if (FFGALNAPKCD.LocalPlayer.NDGFFHMFGIG.DAPKNDBLKIA)
                {
                    if (FFGALNAPKCD.LocalPlayer.NDGFFHMFGIG.DLPCKPBIJOE)
                    {
                        KillButton.gameObject.SetActive(false);
                        KillButton.isActive = false;
                    }
                    else
                    {
                        KillButton.gameObject.SetActive(true);
                        KillButton.isActive = true;
                    }
                }
            }



            if (counter < 30)
            {
                counter++;
                return;
            }
            counter = 0;



            if (GameOptionMenuPatch.showSheriffOption != null && GameOptionMenuPatch.SheriffCooldown != null)
            {
                var isOptionsMenuActive = GameObject.FindObjectsOfType <PHCKLDDNJNP>().Count != 0;
                GameOptionMenuPatch.showSheriffOption.gameObject.SetActive(isOptionsMenuActive);
                GameOptionMenuPatch.SheriffCooldown.gameObject.SetActive(isOptionsMenuActive);
            }
        }