CheckProjectilePermission() public static method

CheckProjectilePermission - Checks if a projectile is banned.
public static CheckProjectilePermission ( TShockAPI.TSPlayer player, int index, int type ) : bool
player TShockAPI.TSPlayer player - The TSPlayer object that created the projectile.
index int index - The projectile index.
type int type - The projectile type.
return bool
示例#1
0
        private static bool HandleProjectileNew(GetDataHandlerArgs args)
        {
            var ident     = args.Data.ReadInt16();
            var pos       = new Vector2(args.Data.ReadSingle(), args.Data.ReadSingle());
            var vel       = new Vector2(args.Data.ReadSingle(), args.Data.ReadSingle());
            var knockback = args.Data.ReadSingle();
            var dmg       = args.Data.ReadInt16();
            var owner     = args.Data.ReadInt8();
            var type      = args.Data.ReadInt8();

            var index = TShock.Utils.SearchProjectile(ident);

            if (index > Main.maxProjectiles || index < 0)
            {
                return(true);
            }

            if (args.Player.Index != owner)
            {
                args.Player.SendData(PacketTypes.ProjectileNew, "", index);
                return(true);
            }

            if (dmg > 175)
            {
                args.Player.SendData(PacketTypes.ProjectileNew, "", index);
                return(true);
            }

            if (TShock.CheckIgnores(args.Player))
            {
                args.Player.SendData(PacketTypes.ProjectileNew, "", index);
                return(true);
            }

            if (TShock.CheckProjectilePermission(args.Player, index, type))
            {
                args.Player.LastThreat = DateTime.UtcNow;
                args.Player.SendData(PacketTypes.ProjectileNew, "", index);
                return(true);
            }

            return(false);
        }
示例#2
0
        private static bool HandleProjectileKill(GetDataHandlerArgs args)
        {
            var ident = args.Data.ReadInt16();
            var owner = args.Data.ReadInt8();

            if (args.Player.Index != owner)
            {
                return(true);
            }

            var index = TShock.Utils.SearchProjectile(ident);

            if (index > Main.maxProjectiles || index < 0)
            {
                return(true);
            }

            int type = Main.projectile[index].type;

            if (args.Player.Index != Main.projectile[index].owner)
            {
                args.Player.SendData(PacketTypes.ProjectileNew, "", index);
                return(true);
            }

            if (TShock.CheckIgnores(args.Player))
            {
                args.Player.SendData(PacketTypes.ProjectileNew, "", index);
                return(true);
            }

            if (TShock.CheckProjectilePermission(args.Player, index, type))
            {
                args.Player.LastThreat = DateTime.UtcNow;
                args.Player.SendData(PacketTypes.ProjectileNew, "", index);
                return(true);
            }

            return(false);
        }