Skip to content

Commit

Permalink
Add quest event group tracking (#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeFZ authored Aug 11, 2023
1 parent 640a641 commit 38c2d1d
Show file tree
Hide file tree
Showing 29 changed files with 3,043 additions and 107 deletions.
2 changes: 2 additions & 0 deletions DragaliaAPI.Database/ApiContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,5 +184,7 @@ but EF Core doesn't like this and the client probably stops you anyway?

public DbSet<DbEmblem> Emblems { get; set; }

public DbSet<DbQuestEvent> QuestEvents { get; set; }

public DbSet<DbPartyPower> PartyPowers { get; set; }
}
2 changes: 2 additions & 0 deletions DragaliaAPI.Database/Entities/DbPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,7 @@ public class DbPlayer

public virtual DbPlayerShopInfo? ShopInfo { get; set; }

public virtual ICollection<DbQuestEvent> QuestEvents { get; set; } = new List<DbQuestEvent>();

public virtual DbPartyPower? PartyPower { get; set; }
}
4 changes: 2 additions & 2 deletions DragaliaAPI.Database/Entities/DbQuest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public class DbQuest : IDbHasAccountId

public int WeeklyPlayCount { get; set; } = 0;

public int LastDailyResetTime { get; set; } = 0;
public DateTimeOffset LastDailyResetTime { get; set; } = DateTimeOffset.UnixEpoch;

public int LastWeeklyResetTime { get; set; } = 0;
public DateTimeOffset LastWeeklyResetTime { get; set; } = DateTimeOffset.UnixEpoch;

public bool IsAppear { get; set; } = true;

Expand Down
46 changes: 46 additions & 0 deletions DragaliaAPI.Database/Entities/DbQuestEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace DragaliaAPI.Database.Entities;

[Index(nameof(DeviceAccountId))]
[PrimaryKey(nameof(DeviceAccountId), nameof(QuestEventId))]
public class DbQuestEvent : IDbHasAccountId
{
/// <inheritdoc />
public virtual DbPlayer? Owner { get; set; }

/// <inheritdoc />
[ForeignKey(nameof(Owner))]
public required string DeviceAccountId { get; set; }

[Column("QuestEventId")]
public required int QuestEventId { get; set; }

[Column("DailyPlayCount")]
public int DailyPlayCount { get; set; }

[Column("LastDailyResetTime")]
public DateTimeOffset LastDailyResetTime { get; set; } = DateTimeOffset.UnixEpoch;

[Column("WeeklyPlayCount")]
public int WeeklyPlayCount { get; set; }

[Column("LastWeeklyResetTime")]
public DateTimeOffset LastWeeklyResetTime { get; set; } = DateTimeOffset.UnixEpoch;

[Column("QuestBonusReceiveCount")]
public int QuestBonusReceiveCount { get; set; }

[Column("QuestBonusStackCount")]
public int QuestBonusStackCount { get; set; }

[Column("QuestBonusStackTime")]
public DateTimeOffset QuestBonusStackTime { get; set; } = DateTimeOffset.UnixEpoch;

[Column("QuestBonusReserveCount")]
public int QuestBonusReserveCount { get; set; }

[Column("QuestBonusReserveTime")]
public DateTimeOffset QuestBonusReserveTime { get; set; } = DateTimeOffset.UnixEpoch;
}
Loading

0 comments on commit 38c2d1d

Please sign in to comment.