48 lines
1.8 KiB
C#
48 lines
1.8 KiB
C#
using Tiger.Game.Rooms;
|
|
|
|
namespace Tiger.Game.Habbos;
|
|
|
|
public class Habbo
|
|
{
|
|
public virtual int Id { get; set; }
|
|
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!;
|
|
public virtual int Rank { get; set; }
|
|
public virtual int Credits { get; set; }
|
|
public virtual bool Online { get; set; }
|
|
public virtual string? SsoTicket { get; set; }
|
|
public virtual Badge? CurrentBadge { get; set; }
|
|
public virtual bool BadgeActive { get; set; }
|
|
public virtual ICollection<Badge> Badges { get; set; } = new List<Badge>();
|
|
public virtual ICollection<HabboSubscription> Subscriptions { get; set; } = new List<HabboSubscription>();
|
|
public virtual ICollection<Room> Rooms { get; set; } = new List<Room>();
|
|
|
|
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;
|
|
}
|
|
} |