Exemplo n.º 1
0
        internal static bool FilterClient(WorldRegion region, Client player, Packet packet)
        {
            if (packet.PacketID != PlayerPositionLookClient.ID)
                return false;

            CoordDouble pos = player.Session.Position;
            
            //Inner region
            if (region.SubRegions.Count == 0)
                return false;
            WorldRegion inner = region.SubRegions[0];
			
            //Find proportions between region edges
            double dOuter = pos.X - region.MinX;
            dOuter = Math.Min(dOuter, region.MaxX - pos.X);
            dOuter = Math.Min(dOuter, pos.Z - region.MinZ);
            dOuter = Math.Min(dOuter, region.MaxZ - pos.Z);
            double dInner = inner.MinX - pos.X;
            dInner = Math.Max(dInner, pos.X - inner.MaxX);
            dInner = Math.Max(dInner, inner.MinZ - pos.Z);
            dInner = Math.Max(dInner, pos.Z - inner.MaxZ);

            double frac = dOuter / (dOuter + dInner);
#if DEBUG
            //player.Tell(frac.ToString("0.00") + ": " + dOuter + " " + dInner);
#endif

            player.SendToClient(NightTime(frac));
			
            return false;
        }
Exemplo n.º 2
0
        static bool DiggProtect(Client player, PlayerDigging pd)
        {
            if (pd.Status == PlayerDigging.StatusEnum.FinishedDigging)
            {
                BlockChange bc = new BlockChange(pd.Position.Offset(pd.Face), BlockID.Fire);
                player.SendToClient(bc);

                player.TellAbove(Chat.Purple, "You are still in spawn");
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        internal static bool FilterClient(WorldRegion region, Client player, Packet packet)
        {
            if (packet.PacketID != PlayerPositionLookClient.ID)
            {
                return(false);
            }

            CoordDouble pos = player.Session.Position;

            //Inner region
            if (region.SubRegions.Count == 0)
            {
                return(false);
            }
            WorldRegion inner = region.SubRegions[0];

            //Find proportions between region edges
            double dOuter = pos.X - region.MinX;

            dOuter = Math.Min(dOuter, region.MaxX - pos.X);
            dOuter = Math.Min(dOuter, pos.Z - region.MinZ);
            dOuter = Math.Min(dOuter, region.MaxZ - pos.Z);
            double dInner = inner.MinX - pos.X;

            dInner = Math.Max(dInner, pos.X - inner.MaxX);
            dInner = Math.Max(dInner, inner.MinZ - pos.Z);
            dInner = Math.Max(dInner, pos.Z - inner.MaxZ);

            double frac = dOuter / (dOuter + dInner);

#if DEBUG
            //player.Tell(frac.ToString("0.00") + ": " + dOuter + " " + dInner);
#endif

            player.SendToClient(NightTime(frac));

            return(false);
        }
Exemplo n.º 4
0
 internal static void Leaving(Client player)
 {
     //Resume outside time
     player.SendToClient(World.Main.Time);
 }
Exemplo n.º 5
0
 static bool BlockClick(Client player, WindowClick wc)
 {
     player.SendToClient(new ConfirmTransactionServer(wc, false));
     return true;
 }
Exemplo n.º 6
0
 static bool BlockClick(Client player, WindowClick wc)
 {
     player.SendToClient(new ConfirmTransactionServer(wc, false));
     return(true);
 }
Exemplo n.º 7
0
        static internal void Leaving(Client player)
        {
            //Resume outside weather
            player.SendToClient(World.Main.Weather);
			
            player.TellAbove(Chat.Aqua, "Chat range: " + Parser.DistanceMax + " blocks");
        }
Exemplo n.º 8
0
 static public void Entering(Client player)
 {
     //Rain
     if (player.Session.Mode != GameMode.Creative)
         player.SendToClient(rain);
 }
Exemplo n.º 9
0
        static bool CursedLand(Client player, PlayerBlockPlacement placement)
        {
            SlotItem i = player.Session.ActiveItem;
            if (i != null && i.ItemID == BlockID.Bucket)
            {
                var pps = new PlayerPositionLookClient();
                pps.Position = placement.BlockPosition.CloneDouble();
                pps.OnGround = false;
                pps.Position.Y += 1.1;
                pps.Position.X += 0.5;
                pps.Position.Z += 0.5;
                pps.Pitch = Math.PI / 2;
                pps.Yaw = player.Session.Yaw;
                player.FromClient(pps);
				
                var ppc = new PlayerPositionLookServer(pps.Position);
                ppc.Pitch = Math.PI / 2;
                ppc.Yaw = player.Session.Yaw;
                player.SendToClient(ppc);
            }
			
            BlockChange bc = new BlockChange(placement.BlockPosition.Offset(placement.FaceDirection), BlockID.Air);
            player.SendToClient(bc);
			
            //Block all actions
            return true;
        }
Exemplo n.º 10
0
        static bool DiggProtect(Client player, PlayerDigging pd)
        {
            if (pd.Status == PlayerDigging.StatusEnum.FinishedDigging)
            {
                BlockChange bc = new BlockChange(pd.Position.Offset(pd.Face), BlockID.Fire);
                player.SendToClient(bc);
				
                player.TellAbove(Chat.Purple, "You are still in spawn");
                return true;
            }
			
            return false;
        }
Exemplo n.º 11
0
 internal static void Leaving(Client player)
 {
     //Resume outside time
     player.SendToClient(World.Main.Time);
 }