Exemplo n.º 1
0
 /// <summary>
 /// Returns and integer of the Unix-time.
 /// </summary>
 /// <returns></returns>
 public static string GenerateUnixTime()
 {
     using (DateTimeAdapter Adapter = new DateTimeAdapter(DateTime.Now))
     {
         return Adapter.PopUnixTimestamp();
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Returns the progress-limit of an achievement.
 /// </summary>
 /// <param name="AchievementId"></param>
 /// <returns></returns>
 public int GetAchievementProgessLimit(int AchievementId)
 {
     switch (AchievementId)
     {
         default:
             return default(int);
         case 2:
             return System.HabboSystem.CharacterManager.GetDaysInARow(Logs);
         case 3: // RegistrationDuration
             using (DateTimeAdapter Adapter = new DateTimeAdapter(Registered))
             {
                 return (int)(DateTime.Now - Adapter.PopDateTime()).TotalDays;
             }
         case 5 :
             return TimeOnline;
         case 6:
             return (GetAchievementProgessLimit(5) >= 60 && GetAchievementProgessLimit(3) >= 3) ? 1 : 0;
         case 10: // HappyHour
             return ((DateTime.Now.Hour >= 14 && DateTime.Now.Hour <= 15) || Achievements.ContainsKey(10)) ? 1 : 0;
         case 11:
             return RespectGiven;
             // TODO more achievements
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// Returns an last seen, cache or sql.
        /// </summary>
        /// <param name="CharacterId"></param>
        /// <returns></returns>
        public string GetLastSeen(int CharacterId)
        {
            Session Session;

            if (GetStatus(CharacterId, out Session) == CharacterStatus.Online)
            {
                using (DateTimeAdapter Adapter = new DateTimeAdapter(Session.Character.LastSeen))
                {
                    return Adapter.GetAlternativestamp();
                }
            }

            Character Character;

            if (GetCharacter(CharacterId, out Character))
            {
                using (DateTimeAdapter Adapter = new DateTimeAdapter(Character.LastSeen))
                {
                    return Adapter.GetAlternativestamp();
                }
            }

            return string.Empty;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Returns an collection of characterlogs.
        /// </summary>
        /// <param name="CharacterId"></param>
        /// <returns></returns>
        public ICollection<DateTime> GetCharacterLogs(int CharacterId)
        {
            ICollection<DateTime> Output = new List<DateTime>();

            foreach (DataRow Row in System.MySQLManager.GetObject(new CharacterLogsQuery(CharacterId)).GetOutput<DataTable>().Rows)
            {
                using (RowAdapter Adapter = new RowAdapter(Row))
                {
                    string Stamp = Adapter.PopString("login_stamp");

                    using (DateTimeAdapter dtAdapter = new DateTimeAdapter(Stamp))
                    {
                        if (!Output.Contains(dtAdapter.PopDateTime()))
                        {
                            Output.Add(dtAdapter.PopDateTime());
                        }
                    }
                }
            }

            return Output;
        }