예제 #1
0
 public static Player GetPlayer(string UserName)
 {
     if (!EvoSGameConfig.UseDatabase)
     {
         return(new Player()
         {
             AccountId = DateTime.Now.Ticks,
             UserName = UserName,
             LastSelectedCharacter = CharacterType.BazookaGirl,
             SelectedTitleID = -1,
             SelectedForegroundBannerID = -1,
             SelectedBackgroundBannerID = -1,
             SelectedRibbonID = -1
         });
     }
     foreach (var reader in MySQLDB.GetInstance().Query("SELECT AccountId, UserName, LastSelectedCharacter, SelectedTitleId, BannerForegroundId, BannerBackgroundId, RibbonId FROM Users WHERE UserName = ? LIMIT 1", new object[] { UserName }))
     {
         var player = new Player();
         player.AccountId                  = reader.GetInt32(0);
         player.UserName                   = reader.GetString(1);
         player.LastSelectedCharacter      = (CharacterType)reader.GetInt32(2);
         player.SelectedTitleID            = reader.GetInt32(3);
         player.SelectedForegroundBannerID = reader.GetInt32(4);
         player.SelectedBackgroundBannerID = reader.GetInt32(5);
         player.SelectedRibbonID           = reader.GetInt32(6);
         return(player);
     }
     return(null);
 }
예제 #2
0
        public static FriendList GetFriendList(long AccountId)
        {
            var friendList = new FriendList();

            friendList.IsDelta = false;
            friendList.Friends = new Dictionary <long, FriendInfo>();

            foreach (var item in MySQLDB.GetInstance().Query($"SELECT Users.AccountId, Users.UserName, Users.BannerForegroundId as EmblemId, Users.BannerBackgroundId as BannerID, Users.SelectedTitleId as TitleId, Users.RibbonId, FriendList.FriendStatus FROM FriendList INNER JOIN Users ON(Users.AccountId = AccountID_1 or Users.AccountId = AccountID_2) AND Users.AccountID <> {AccountId} WHERE AccountID_1 = {AccountId} or (AccountID_2 = {AccountId} and FriendStatus=1) ORDER BY FriendStatus", new object[] {}))
            {
                var info = new FriendInfo()
                {
                    FriendAccountId = item.GetInt32(0),
                    FriendHandle    = item.GetString(1),
                    IsOnline        = true,
                    FriendStatus    = (FriendStatus)item.GetByte(6),
                    BannerID        = item.GetInt16(3),
                    EmblemID        = item.GetInt16(2),
                    TitleID         = item.GetInt16(4),
                    RibbonID        = item.GetInt16(5),
                    StatusString    = "Online"
                };
                friendList.Friends[info.FriendAccountId] = info;
            }

            return(friendList);
        }
예제 #3
0
 public static void SaveSelectedCharacter(long AccountId, int CharacterType)
 {
     MySQLDB.GetInstance().ExecuteNonQuery("UPDATE Users SET LastSelectedCharacter=? WHERE AccountId = ?", new object[] { CharacterType, AccountId });
 }
예제 #4
0
 public static void CreatePlayer(string UserName)
 {
     MySQLDB.GetInstance().ExecuteNonQuery("INSERT INTO Users(UserName, LastSelectedCharacter, SelectedTitleId, BannerForegroundId, BannerBackgroundId, RibbonId)" + "VALUES(?, ?, -1, -1, -1, -1)", new object[] { UserName, (int)CharacterType.Scoundrel });
 }