Beispiel #1
0
        private void OnTogglePvp(object sender, GetDataHandlers.TogglePvpEventArgs args)
        {
            var ply = TShock.Players[args.PlayerId];
            var dt  = ply.GetData <RtPlayer>(Rtdataname);

            if (dt == null)
            {
                return;
            }

            if (dt.Pvp && !args.Pvp)
            {
                ply.SendErrorMessage("You can't change your PvP status in this region!");
                ply.SendData(PacketTypes.TogglePvp, "", args.PlayerId);
                args.Handled = true;
                return;
            }

            if (dt.NoPvp && args.Pvp)
            {
                ply.SendErrorMessage("You can't change your PvP status in this region!");
                ply.SendData(PacketTypes.TogglePvp, "", args.PlayerId);
                args.Handled = true;
                // ReSharper disable once RedundantJumpStatement
                return;
            }
        }
Beispiel #2
0
        private static void OnPvpToggle(object sender, GetDataHandlers.TogglePvpEventArgs args)
        {
            if (!args.Pvp)
            {
                return;
            }

            TShock.Players[args.PlayerId]
            .SendInfoMessage("你可以通过 {0} 查看你的战绩.", TShock.Utils.ColorTag("/pvp", Color.LightSkyBlue));
        }
Beispiel #3
0
        public void TogglePvPHook(object sender, GetDataHandlers.TogglePvpEventArgs e)
        {
            if (!Enforced)
            {
                return;
            }
            e.Handled = true;
            var index = e.PlayerId;

            Main.player[index].hostile = playerPvP[index];
            NetMessage.SendData((int)PacketTypes.TogglePvp, -1, -1, NetworkText.Empty, index);
        }
Beispiel #4
0
        private static void OnTogglePvp(object sender, GetDataHandlers.TogglePvpEventArgs args)
        {
            var ply = TShock.Players[args.PlayerId];
            var dt  = RtPlayer.GetPlayerInfo(ply);

            if (dt.ForcePvP == true && !args.Pvp ||
                dt.ForcePvP == false && args.Pvp ||
                !dt.CanTogglePvP)
            {
                ply.SendErrorMessage("You can't change your PvP status in this region!");
                ply.SendData(PacketTypes.TogglePvp, "", args.PlayerId);
                args.Handled = true;
            }
        }
Beispiel #5
0
        public void OnTogglePvp(object sender, GetDataHandlers.TogglePvpEventArgs args)
        {
            var player = TShock.Players[args.PlayerId];
            var arena  = ArenaManager.InArea(player);

            if (arena == null || args.Pvp == false)
            {
                return;
            }

            if (ParamContains(arena, "autospawn"))
            {
                int id = new Random().Next() % arena.Map.Spawns.Count();
                player.Teleport((arena.Position.X + arena.Map.Spawns[id].X) * 16, (arena.Position.X + arena.Map.Spawns[id].X) * 16);
            }
        }
 void TPVP(object sender, GetDataHandlers.TogglePvpEventArgs args)
 {
     if (TShock.Players[args.PlayerId] == null)
     {
         return;
     }
     if (args.Pvp && !pvPlayers.Contains(TShock.Players[args.PlayerId]))
     {
         pvPlayers.Add(TShock.Players[args.PlayerId]);
         args.Handled = true;
     }
     else if (!args.Pvp && pvPlayers.Contains(TShock.Players[args.PlayerId]))
     {
         pvPlayers.Remove(TShock.Players[args.PlayerId]);
         args.Handled = true;
     }
 }