Esempio n. 1
0
 public static void VersionInfo(LoginClient pClient, Packet pPacket)
 {
     ushort year;
     ushort version;
     if (!pPacket.TryReadUShort(out year) ||
         !pPacket.TryReadUShort(out version))
     {
         Log.WriteLine(LogLevel.Warn, "Invalid client version.");
         pClient.Disconnect();
         return;
     }
     Log.WriteLine(LogLevel.Debug, "Client version {0}:{1}.", year, version);
     using (Packet response = new Packet(SH3Type.VersionAllowed))
     {
         response.WriteShort(1);
         pClient.SendPacket(response);
     }
 }
Esempio n. 2
0
 private static void WorldList(LoginClient pClient, bool pPing)
 {
     using (var pack = new Packet(pPing ? SH3Type.WorldistResend : SH3Type.WorldlistNew))
     {
         pack.WriteByte((byte)WorldManager.Instance.WorldCount);
         foreach (var world in WorldManager.Instance.Worlds.Values)
         {
             pack.WriteByte(world.ID);
             pack.WriteString(world.Name, 16);
             pack.WriteByte((byte)world.Status);
         }
         pClient.SendPacket(pack);
     }
 }
Esempio n. 3
0
        private static void SendWorldServerIP(LoginClient pClient, WorldConnection wc, string hash)
        {
            using (var pack = new Packet(SH3Type.WorldServerIP))
            {
                pack.WriteByte((byte)wc.Status);

                string ip = pClient.Host == "127.0.0.1" ? "127.0.0.1" : wc.IP;
                pack.WriteString(wc.IP, 16);

                pack.WriteUShort(wc.Port);
                pack.WriteString(hash, 64);
                pClient.SendPacket(pack);
            }
        }
Esempio n. 4
0
 private static void SendFailedLogin(LoginClient pClient, ServerError pError)
 {
     using (Packet pack = new Packet(SH3Type.Error))
     {
         pack.WriteUShort((ushort)pError);
         pClient.SendPacket(pack);
     }
 }
Esempio n. 5
0
 private static void InvalidClientVersion(LoginClient pClient)
 {
     using (Packet pack = new Packet(SH3Type.IncorrectVersion))
     {
         pack.Fill(10, 0);
         pClient.SendPacket(pack);
     }
 }
Esempio n. 6
0
 private static void AllowFiles(LoginClient pClient, bool pIsOk)
 {
     using (Packet pack = new Packet(SH3Type.FilecheckAllow))
     {
         pack.WriteBool(pIsOk);
         pClient.SendPacket(pack);
     }
 }