Beispiel #1
0
 public void DoAuthSuccess()
 {
     try
     {
         Account = new PlayerAccount();
         var m = server.NetServer.CreateMessage();
         m.Write(new OpenCharacterListPacket()
         {
             Info = new CharacterSelectInfo()
             {
                 ServerName        = server.ServerName,
                 ServerDescription = server.ServerDescription,
                 ServerNews        = server.ServerNews,
                 Characters        = new List <SelectableCharacter>()
             }
         });
         server.NetServer.SendMessage(m, connection, NetDeliveryMethod.ReliableOrdered);
     }
     catch (Exception ex)
     {
         FLLog.Error("NetPlayer", ex.Message);
         FLLog.Error("NetPlayer",
                     ex.StackTrace);
     }
 }
Beispiel #2
0
 public void AccountAccessed(PlayerAccount account)
 {
     /*account.LastVisit = DateTime.Now;
      * NonQuery("UPDATE accounts SET lastvisit = @visit WHERE accountID = @id",
      *                 "@id", account.ID,
      *                 "@visit", account.LastVisit);*/
 }
Beispiel #3
0
 public void DoAuthSuccess()
 {
     try
     {
         FLLog.Info("Server", "Account logged in");
         client.SendPacket(new LoginSuccessPacket(), NetDeliveryMethod.ReliableOrdered);
         Account = new PlayerAccount();
         client.SendPacket(new OpenCharacterListPacket()
         {
             Info = new CharacterSelectInfo()
             {
                 ServerName        = game.ServerName,
                 ServerDescription = game.ServerDescription,
                 ServerNews        = game.ServerNews,
                 Characters        = new List <SelectableCharacter>()
             }
         }, NetDeliveryMethod.ReliableOrdered);
     }
     catch (Exception ex)
     {
         FLLog.Error("Player", ex.Message);
         FLLog.Error("Player",
                     ex.StackTrace);
     }
 }
Beispiel #4
0
        //TODO: Fill this in (pending Yuri's work)

        //Account
        public void CreateAccount(PlayerAccount p)
        {
            /*NonQuery("INSERT INTO accounts (accountGUID,lastvisit,registered,email) VALUES (@guid, @_lastvisit, @_registered, @_email)",
             *                 "@guid", p.GUID.ToString(),
             *                 "@_lastvisit", p.LastVisit,
             *         "@_registered", p.Registered,
             *                 "@_email", p.Email);
             * var res = Scalar("SELECT accountID FROM accounts WHERE accountGUID=@guid", "@guid", p.GUID.ToString());
             * p.ID = Convert.ToInt32(res);*/
        }
Beispiel #5
0
 //Character
 public IEnumerable <ListedCharacter> GetOwnedCharacters(PlayerAccount account)
 {
     /*return Reader(
      *      "SELECT c.characterID, c.callsign, c.credits, s.nickname FROM characters c" +
      *      "LEFT JOIN systems s ON (c.systemID = s.systemID) WHERE c.accountID = @acc",
      *      (reader) =>
      * {
      *      var lc = new ListedCharacter();
      *      lc.ID = reader.GetInt32(0);
      *      lc.Name = reader.GetString(1);
      *      lc.Credits = reader.GetInt64(2);
      *      lc.Location = reader.GetString(3);
      *      return lc;
      * }, "@acc", account.ID);*/
     return(new List <ListedCharacter>());
 }
Beispiel #6
0
        public PlayerAccount GetAccount(Guid guid)
        {
            PlayerAccount acc = null;

            /*Reader("SELECT * FROM accounts WHERE accountGUID=@guid", (reader) =>
             * {
             *      acc = new PlayerAccount();
             *      acc.GUID = guid;
             *      acc.ID = reader.GetInt32(0);
             *      acc.Email = reader.GetNullableString(2);
             *      acc.Registered = reader.GetDateTime(3);
             *      acc.LastVisit = reader.GetDateTime(4);
             *      return false;
             * }, "@guid", guid.ToString());*/
            return(acc);
        }
Beispiel #7
0
        public void DoAuthSuccess()
        {
            try
            {
                //Basically start up everything
                if ((account = server.Database.GetAccount(playerGuid)) != null)
                {
                    server.Database.AccountAccessed(account);
                }
                else
                {
                    account           = new PlayerAccount();
                    account.GUID      = playerGuid;
                    account.LastVisit = DateTime.Now;
                    server.Database.CreateAccount(account);
                }

                //Get character list to send

                //Continue on
                var om = server.NetServer.CreateMessage();
                om.Write((byte)PacketKind.AuthenticationSuccess);
                om.Write(server.ServerNews);
                var ls = server.Database.GetOwnedCharacters(account).ToList();
                om.Write((int)ls.Count);
                foreach (var character in ls)
                {
                    om.Write(character.ID);
                    om.Write(character.Name);
                    om.Write(character.Location);
                    om.Write(character.Credits);
                }
                server.NetServer.SendMessage(om, connection, NetDeliveryMethod.ReliableOrdered);
            }
            catch (Exception ex)
            {
                FLLog.Error("NetPlayer", ex.Message);
                FLLog.Error("NetPlayer",
                            ex.StackTrace);
            }
        }
 public void AddCharacterToAccount(PlayerAccount account, ServerCharacter character)
 {
     account.Characters.Add(character);
 }
 //Character
 public IEnumerable <ServerCharacter> GetOwnedCharacters(PlayerAccount account)
 {
     return(account.Characters);
 }
 public void AccountAccessed(PlayerAccount account)
 {
     account.LastVisit = DateTime.Now;
 }
        //TODO: Fill this in (pending Yuri's work)

        //Account
        public void CreateAccount(PlayerAccount p)
        {
            accounts.Add(p);
        }