예제 #1
0
        public void rain(bool on, Player p)
        {
            if (on)
               {

                byte[] bytes = new byte[1];
                byte thisin = 1;
                bytes[0] = thisin;
                p.SendRaw(0x46, bytes);
                Israining = true;
               // p.SendMessage("Weather is: " + Israining.ToString());
                return;

            }
            if(!on)
            {
                byte[] bytes = new byte[1];
                bytes[0] = 2;
                p.SendRaw(0x46, bytes);
                Israining = false;
                return;
               // p.SendMessage("Weather is: " + Israining.ToString());
            }
            //
            //{

            //    Israining = false;
            //}
            //else
            //{
            //    Israining = true;
            //}
        }
예제 #2
0
 /// <summary>
 /// Updates the players experience bar
 /// </summary>
 /// <param name="expbarval">Value of the experience bar (0-19)</param>
 /// <param name="level">Ecperience level of player</param>
 /// <param name="totalexp">Players total experience</param>
 public static void SendExperience(Player p, byte expbarval, byte level, short totalexp)
 {
     byte[] bytes = new byte[4];
     bytes[0] = expbarval;
     bytes[1] = level;
     util.EndianBitConverter.Big.GetBytes(totalexp).CopyTo(bytes, 2);
     p.SendRaw(0x2B, bytes);
 }
예제 #3
0
 //public Weather()
 //    :base(0, 127, 0, "main", new Random().Next())
 //{
 //}
 public void SendLightning(int x, int y, int z, int EntityId, Player p)
 {
     byte[] bytes = new byte[17];
     util.EndianBitConverter.Big.GetBytes(EntityId).CopyTo(bytes, 0);
     util.EndianBitConverter.Big.GetBytes(true).CopyTo(bytes, 4);
     util.EndianBitConverter.Big.GetBytes(x).CopyTo(bytes, 5);
     util.EndianBitConverter.Big.GetBytes(y).CopyTo(bytes, 9);
     util.EndianBitConverter.Big.GetBytes(z).CopyTo(bytes, 13);
     p.SendRaw(0x47, bytes);
 }
예제 #4
0
        public static bool OpenDispenser(Player a, BCS b)
        {
            if(!a.level.windows.ContainsKey(b.pos))
            {
                new Windows(3, b.pos, a.level);
            }

            Windows window = a.level.windows[b.pos];
            short length = (short)window.name.Length;
            byte[] bytes = new byte[5 + (length)];

            bytes[0] = 1; //CHANGE THIS! (idk what the byte referances, i dont really see a use for it if its just a byte)
            bytes[1] = window.type;
            util.EndianBitConverter.Big.GetBytes(length).CopyTo(bytes, 2);
            UTF8Encoding.UTF8.GetBytes(window.name).CopyTo(bytes, 4);
            bytes[4 + (length)] = (byte)window.items.Length; //number of slots

            a.SendRaw(0x64, bytes);
            return false;
        }