Skip to content

Leaderboards and footraces #292

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 25, 2021
31 changes: 31 additions & 0 deletions Uchu.Core/Database/Models/ActivityScore.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System.ComponentModel.DataAnnotations;

namespace Uchu.Core
{
public class ActivityScore
{
[Key]
public long Id { get; set; }

[Required]
public int Activity { get; set; }

[Required]
public ushort Zone { get; set; }

[Required]
public long CharacterId { get; set; }

public int Points { get; set; }

public int Time { get; set; }

public long LastPlayed { get; set; }

public int NumPlayed { get; set; }

// YYYYWW for Weekly leaderboard entries
// 0 for All-time leaderboard entries
public int Week { get; set; }
}
}
4 changes: 3 additions & 1 deletion Uchu.Core/Database/Providers/UchuContextBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public abstract class UchuContextBase : DbContext, IAsyncDisposable
public DbSet<TradeTransactionItem> TransactionItems { get; set; }

public DbSet<CharacterFlag> Flags { get; set; }

public DbSet<ActivityScore> ActivityScores { get; set; }

public async Task EnsureUpdatedAsync()
{
Expand All @@ -49,4 +51,4 @@ public ValueTask DisposeAsync()
return new ValueTask(Task.Run(Dispose));
}
}
}
}
4 changes: 3 additions & 1 deletion Uchu.Core/Database/UchuContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public sealed class UchuContext : IAsyncDisposable, IDisposable

public DbSet<CharacterFlag> Flags => ContextBase.Flags;

public DbSet<ActivityScore> ActivityScores => ContextBase.ActivityScores;

public UchuContext()
{
var config = UchuContextBase.Config;
Expand Down Expand Up @@ -79,4 +81,4 @@ public async Task EnsureUpdatedAsync()

public void Dispose() => ContextBase?.Dispose();
}
}
}
Loading