Example #1
0
 /// <summary>
 /// Sets world as online and ready to user connections.
 /// </summary>
 /// <param name="id">World unique id.</param>
 internal static void SetActive(byte id)
 {
     if (m_WorldsSummary.ContainsKey(id))
     {
         WorldSummary ws = m_WorldsSummary[id];
         ws.IsOnline         = true;
         m_WorldsSummary[id] = ws;
     }
 }
Example #2
0
        /// <summary>
        /// Initializes new instance of <see cref="WorldsListResponse"/> struct.
        /// </summary>
        /// <param name="p"><see cref="Packet"/> to initialize from.</param>
        public WorldsListResponse(Packet p)
        {
            RequestID = p.ReadLong();
            byte count = p.ReadByte();

            Data = new WorldSummary[count];

            for (int i = 0; i < count; i++)
            {
                Data[i] = new WorldSummary(ref p);
            }
        }
Example #3
0
        /// <summary>
        /// Converts current struct to it's <see cref="Packet"/> equivalent.
        /// </summary>
        /// <returns><see cref="Packet"/> equivalent of current struct.</returns>
        public Packet ToPacket()
        {
            Packet p = new Packet(Opcodes);

            p.WriteLong(RequestID);
            p.WriteByte(( byte )Data.Length);

            foreach (WorldSummary ws in Data)
            {
                WorldSummary.Write(ws, ref p);
            }

            return(p);
        }
Example #4
0
 /// <summary>
 /// Appends world data to referenced <see cref="Packet"/> struct.
 /// </summary>
 /// <param name="ws"><see cref="WorldSummary"/> to write.</param>
 /// <param name="p">Referenced <see cref="Packet"/> struct.</param>
 public static void Write(WorldSummary ws, ref Packet p)
 {
     p.WriteByte(ws.ID);
     p.WriteBytesArray(ws.Address);
     p.WriteInt(ws.Port);
     p.WriteByte(ws.AgeLimit);
     p.InternalWriteBool(ws.IsPvP);
     p.WriteShort(ws.UsersMax);
     p.WriteShort(ws.UsersOnline);
     p.InternalWriteBool(ws.ShowBrackets);
     p.InternalWriteBool(ws.IsTestServer);
     p.InternalWriteBool(ws.ShowClock);
     p.InternalWriteBool(ws.IsOnline);
     p.WriteByte(ws.AccessLevel);
 }
Example #5
0
 /// <summary>
 /// Appends world data to referenced <see cref="Packet"/> struct.
 /// </summary>
 /// <param name="ws"><see cref="WorldSummary"/> to write.</param>
 /// <param name="p">Referenced <see cref="Packet"/> struct.</param>
 public static void Write( WorldSummary ws, ref Packet p )
 {
     p.WriteByte(ws.ID);
     p.WriteBytesArray(ws.Address);
     p.WriteInt(ws.Port);
     p.WriteByte(ws.AgeLimit);
     p.InternalWriteBool(ws.IsPvP);
     p.WriteShort(ws.UsersMax);
     p.WriteShort(ws.UsersOnline);
     p.InternalWriteBool(ws.ShowBrackets);
     p.InternalWriteBool(ws.IsTestServer);
     p.InternalWriteBool(ws.ShowClock);
     p.InternalWriteBool(ws.IsOnline);
     p.WriteByte(ws.AccessLevel);
 }
Example #6
0
 /// <summary>
 /// Gets <see cref="WorldSummary"/> array.
 /// </summary>
 /// <returns><see cref="WorldSummary"/> array.</returns>
 internal static WorldSummary[] Get()
 {
     WorldSummary[] current = new WorldSummary[m_WorldsSummary.Count];
     m_WorldsSummary.Values.CopyTo(current, 0);
     return(current);
 }