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;
        }
Beispiel #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);
        }
Beispiel #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);
        }
 internal static void Leaving(Client player)
 {
     //Resume outside time
     player.SendToClient(World.Main.Time);
 }
Beispiel #5
0
 static bool BlockClick(Client player, WindowClick wc)
 {
     player.SendToClient(new ConfirmTransactionServer(wc, false));
     return true;
 }
Beispiel #6
0
 static bool BlockClick(Client player, WindowClick wc)
 {
     player.SendToClient(new ConfirmTransactionServer(wc, false));
     return(true);
 }
Beispiel #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");
        }
Beispiel #8
0
 static public void Entering(Client player)
 {
     //Rain
     if (player.Session.Mode != GameMode.Creative)
         player.SendToClient(rain);
 }
Beispiel #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;
        }
Beispiel #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;
        }
Beispiel #11
0
 internal static void Leaving(Client player)
 {
     //Resume outside time
     player.SendToClient(World.Main.Time);
 }