2023-09-23 11:11:07 +00:00
|
|
|
namespace Tiger.Game.Habbos;
|
|
|
|
|
|
|
|
public class Habbo
|
|
|
|
{
|
2023-09-23 16:51:16 +00:00
|
|
|
public virtual int Id { get; set; }
|
2023-09-23 12:20:45 +00:00
|
|
|
public virtual string Username { get; set; } = null!;
|
|
|
|
public virtual string Email { get; set; } = null!;
|
|
|
|
public virtual DateTime AccountCreated { get; set; }
|
|
|
|
public virtual DateTime? LastLogin { get; set; }
|
|
|
|
public virtual string Motto { get; set; } = null!;
|
|
|
|
public virtual string Figure { get; set; } = null!;
|
|
|
|
public virtual string Gender { get; set; } = null!;
|
2023-09-23 16:51:16 +00:00
|
|
|
public virtual int Rank { get; set; }
|
|
|
|
public virtual int Credits { get; set; }
|
2023-09-23 12:20:45 +00:00
|
|
|
public virtual bool Online { get; set; }
|
2023-09-23 16:51:16 +00:00
|
|
|
public virtual int HomeRoom { get; set; }
|
|
|
|
public virtual int AchievementScore { get; set; }
|
|
|
|
public virtual int? GroupId { get; set; }
|
2023-09-23 12:20:45 +00:00
|
|
|
public virtual string? SsoTicket { get; set; }
|
2023-10-07 13:32:19 +00:00
|
|
|
public virtual IDictionary<int, Activitypoints> Activitypoints { get; set; } = new Dictionary<int, Activitypoints>();
|
|
|
|
public virtual ICollection<Badge> Badges { get; set; } = new List<Badge>();
|
|
|
|
|
|
|
|
public virtual IDictionary<int, HabboAchievement> Achievements { get; set; } = new Dictionary<int, HabboAchievement>();
|
2023-10-21 05:19:21 +00:00
|
|
|
public virtual ICollection<HabboSubscription> Subscriptions { get; set; } = new List<HabboSubscription>();
|
2023-10-07 13:32:19 +00:00
|
|
|
|
2023-10-21 05:19:21 +00:00
|
|
|
public virtual int GetActivityPoints(int type)
|
|
|
|
{
|
|
|
|
return Activitypoints.TryGetValue(type, out var activityPoints) ? activityPoints.Amount : 0;
|
|
|
|
}
|
2023-10-07 13:32:19 +00:00
|
|
|
public virtual void UpdateCurrency(int type, int amount)
|
|
|
|
{
|
|
|
|
if (!Activitypoints.ContainsKey(type))
|
|
|
|
{
|
|
|
|
Activitypoints.Add(type, new Activitypoints
|
|
|
|
{
|
|
|
|
Habbo = this,
|
|
|
|
Amount = amount,
|
|
|
|
Type = type
|
|
|
|
});
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
Activitypoints[type].Amount += amount;
|
|
|
|
}
|
2023-10-21 05:19:21 +00:00
|
|
|
|
|
|
|
public virtual HabboSubscription? GetActiveSubscription()
|
|
|
|
{
|
|
|
|
return Subscriptions.Where(s => s.Expires > DateTime.Now).MaxBy(s => s.Expires);
|
|
|
|
}
|
|
|
|
|
|
|
|
public virtual int GetPastSubscriptionDays()
|
|
|
|
{
|
|
|
|
int totalDays = 0;
|
|
|
|
|
|
|
|
foreach (var subscription in Subscriptions)
|
|
|
|
{
|
|
|
|
if(subscription.Expires < DateTime.Now) // If subscription has ended
|
|
|
|
{
|
|
|
|
totalDays += (subscription.Expires - subscription.Started).Days;
|
|
|
|
}
|
|
|
|
else if(subscription.Started < DateTime.Now) // If subscription is ongoing
|
|
|
|
{
|
|
|
|
totalDays += (DateTime.Now - subscription.Started).Days;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return totalDays;
|
|
|
|
}
|
2023-09-23 11:11:07 +00:00
|
|
|
}
|