Lots of data and model setup

This commit is contained in:
gamer147
2025-05-18 02:27:17 -04:00
parent 79505e0c1a
commit b2024af852
77 changed files with 81988 additions and 433 deletions

View File

@@ -0,0 +1,9 @@
using DCGEngine.Database.Models;
namespace SVSim.Database.Models;
public class BattlefieldEntry : BaseEntity<int>
{
public string Name { get; set; } = string.Empty;
public bool IsOpen { get; set; }
}

View File

@@ -3,7 +3,7 @@ using Microsoft.EntityFrameworkCore;
namespace SVSim.Database.Models;
[Owned]
public class CollectionInfo
public class CardCollectionInfo
{
public int CraftCost { get; set; }
public int DustReward { get; set; }

View File

@@ -9,4 +9,14 @@ public class ClassEntry : BaseEntity<int>
/// The name of the class.
/// </summary>
public string Name { get; set; } = string.Empty;
#region Navigation Properties
public List<LeaderSkinEntry> LeaderSkins { get; set; } = new List<LeaderSkinEntry>();
[NotMapped]
public LeaderSkinEntry? DefaultLeaderSkin => LeaderSkins.FirstOrDefault(skin => skin.Id == Id);
#endregion
}

View File

@@ -0,0 +1,8 @@
using DCGEngine.Database.Models;
namespace SVSim.Database.Models;
public class ClassExpEntry : BaseEntity<int>
{
public int NecessaryExp { get; set; }
}

View File

@@ -4,5 +4,9 @@ namespace SVSim.Database.Models;
public class DegreeEntry : BaseEntity<int>
{
#region Navigation Properties
public List<Viewer> Viewers { get; set; } = new List<Viewer>();
#endregion
}

View File

@@ -2,7 +2,11 @@ using DCGEngine.Database.Models;
namespace SVSim.Database.Models;
public class EmblemEntry : BaseEntity<long>
public class EmblemEntry : BaseEntity<int>
{
#region Navigation Properties
public List<Viewer> Viewers { get; set; } = new List<Viewer>();
#endregion
}

View File

@@ -0,0 +1,36 @@
using DCGEngine.Database.Models;
namespace SVSim.Database.Models;
public class GameConfiguration : BaseEntity<string>
{
public ulong DefaultCrystals { get; set; }
public ulong DefaultRupees { get; set; }
public ulong DefaultEther { get; set; }
public int MaxFriends { get; set; }
#region Foreign Keys
public int DefaultDegreeId { get; set; }
public int DefaultEmblemId { get; set; }
public int DefaultMyPageBackgroundId { get; set; }
public int DefaultSleeveId { get; set; }
#endregion
#region Navigation Properties
public DegreeEntry DefaultDegree { get; set; } = new DegreeEntry();
public EmblemEntry DefaultEmblem { get; set; } = new EmblemEntry();
public MyPageBackgroundEntry DefaultMyPageBackground { get; set; } = new MyPageBackgroundEntry();
public SleeveEntry DefaultSleeve { get; set; } = new SleeveEntry();
#endregion
}

View File

@@ -2,7 +2,7 @@ using DCGEngine.Database.Models;
namespace SVSim.Database.Models;
public class FormatEntry : BaseEntity<int>
public class ItemEntry : BaseEntity<int>
{
public string Name { get; set; } = string.Empty;
}

View File

@@ -0,0 +1,26 @@
using DCGEngine.Database.Models;
namespace SVSim.Database.Models;
public class LeaderSkinEntry : BaseEntity<int>
{
// Name of the skin
public string Name { get; set; } = string.Empty;
// ID of the emote associated with the skin
public int EmoteId { get; set; }
#region Foreign Keys
public int? ClassId { get; set; }
#endregion
#region Navigation Properties
public ClassEntry? Class { get; set; }
public List<Viewer> Viewers { get; set; } = new List<Viewer>();
#endregion
}

View File

@@ -0,0 +1,12 @@
using DCGEngine.Database.Models;
namespace SVSim.Database.Models;
public class MyPageBackgroundEntry : BaseEntity<int>
{
#region Navigation Properties
public List<Viewer> Viewers { get; set; } = new List<Viewer>();
#endregion
}

View File

@@ -0,0 +1,15 @@
using DCGEngine.Database.Models;
using Microsoft.EntityFrameworkCore;
namespace SVSim.Database.Models;
/// <summary>
/// Represents viewer ownership of a <see cref="ShadowverseCardEntry"/>.
/// </summary>
[Owned]
public class OwnedCardEntry
{
public CardEntry Card { get; set; } = new ShadowverseCardEntry();
public int Count { get; set; }
public bool IsProtected { get; set; }
}

View File

@@ -0,0 +1,17 @@
using Microsoft.EntityFrameworkCore;
namespace SVSim.Database.Models;
[Owned]
public class OwnedItemEntry
{
public int Count { get; set; }
#region Navigation Properties
public ItemEntry Item { get; set; } = new ItemEntry();
public Viewer Viewer { get; set; } = new Viewer();
#endregion
}

View File

@@ -0,0 +1,23 @@
using DCGEngine.Database.Models;
namespace SVSim.Database.Models;
public class RankInfoEntry : BaseEntity<int>
{
public string Name { get; set; } = string.Empty;
public int NecessaryPoint { get; set; }
public int AccumulatePoint { get; set; }
public int LowerLimitPoint { get; set; }
public int BaseAddBp { get; set; }
public int BaseDropBp { get; set; }
public int StreakBonusPt { get; set; }
public double WinBonus { get; set; }
public double LoseBonus { get; set; }
public int MaxWinBonus { get; set; }
public int MaxLoseBonus { get; set; }
public int IsPromotionWar { get; set; }
public int MatchCount { get; set; }
public int NecessaryWin { get; set; }
public int ResetLose { get; set; }
public int AccumulateMasterPoint { get; set; }
}

View File

@@ -17,7 +17,7 @@ public class ShadowverseCardEntry : CardEntry
/// <summary>
/// Info about this card in the collection, if it can be collected.
/// </summary>
public CollectionInfo? CollectionInfo { get; set; }
public CardCollectionInfo? CollectionInfo { get; set; }
#endregion
@@ -28,10 +28,5 @@ public class ShadowverseCardEntry : CardEntry
/// </summary>
public ClassEntry? Class { get; set; }
/// <summary>
/// The set this card belongs to.
/// </summary>
public CardSetEntry CardSet { get; set; } = new ShadowverseCardSetEntry();
#endregion
}

View File

@@ -5,4 +5,6 @@ namespace SVSim.Database.Models;
public class ShadowverseCardSetEntry : CardSetEntry
{
public bool IsInRotation { get; set; }
public bool IsBasic { get; set; }
}

View File

@@ -1,8 +1,22 @@
using DCGEngine.Database.Models;
using Microsoft.EntityFrameworkCore;
using SVSim.Database.Enums;
namespace SVSim.Database.Models;
public class ShadowverseDeckEntry : DeckEntry
{
public int Number { get; set; }
public Format Format { get; set; }
public bool RandomLeaderSkin { get; set; }
#region Navigation Properties
public ClassEntry Class { get; set; } = new ClassEntry();
public SleeveEntry Sleeve { get; set; } = new SleeveEntry();
public LeaderSkinEntry LeaderSkin { get; set; } = new LeaderSkinEntry();
#endregion
}

View File

@@ -0,0 +1,13 @@
using DCGEngine.Database.Models;
namespace SVSim.Database.Models;
public class SleeveEntry : BaseEntity<int>
{
#region Navigation Properties
public List<Viewer> Viewers = new List<Viewer>();
#endregion
}

View File

@@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations.Schema;
using DCGEngine.Database.Models;
using Microsoft.EntityFrameworkCore;
using SVSim.Database.Enums;
namespace SVSim.Database.Models;
@@ -7,11 +8,9 @@ namespace SVSim.Database.Models;
/// <summary>
/// A connection between a social account (ie facebook) and a viewer.
/// </summary>
public class SocialAccountConnection : BaseEntity<Guid>
[Owned]
public class SocialAccountConnection
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public override Guid Id { get; set; }
/// <summary>
/// The type of the social account.
/// </summary>
@@ -21,9 +20,9 @@ public class SocialAccountConnection : BaseEntity<Guid>
/// The identifier of the social account.
/// </summary>
public ulong AccountId { get; set; }
/// <summary>
/// The viewer connected.
/// </summary>
public Viewer Viewer { get; set; }
public Viewer Viewer { get; set; } = new Viewer();
}

View File

@@ -1,15 +1,17 @@
using System.ComponentModel.DataAnnotations.Schema;
using DCGEngine.Database.Models;
using Microsoft.EntityFrameworkCore;
namespace SVSim.Database.Models;
/// <summary>
/// A user within the game system.
/// </summary>
public class Viewer : BaseEntity<ulong>
[Index(nameof(ShortUdid))]
public class Viewer : BaseEntity<long>
{
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public override ulong Id { get; set; }
public override long Id { get; set; }
/// <summary>
/// This user's name displayed in game.
@@ -19,7 +21,7 @@ public class Viewer : BaseEntity<ulong>
/// <summary>
/// This user's short identifier.
/// </summary>
public ulong ShortUdid { get; set; }
public long ShortUdid { get; set; }
public DateTime LastLogin { get; set; }
@@ -31,6 +33,28 @@ public class Viewer : BaseEntity<ulong>
public ViewerCurrency Currency { get; set; } = new ViewerCurrency();
public List<ViewerClassData> Classes { get; set; } = new List<ViewerClassData>();
#endregion
#region Collection
public List<ShadowverseDeckEntry> Decks { get; set; } = new List<ShadowverseDeckEntry>();
public List<OwnedCardEntry> Cards { get; set; } = new List<OwnedCardEntry>();
public List<LeaderSkinEntry> LeaderSkins { get; set; } = new List<LeaderSkinEntry>();
public List<DegreeEntry> Degrees { get; set; } = new List<DegreeEntry>();
public List<EmblemEntry> Emblems { get; set; } = new List<EmblemEntry>();
public List<OwnedItemEntry> Items { get; set; } = new List<OwnedItemEntry>();
public List<SleeveEntry> Sleeves { get; set; } = new List<SleeveEntry>();
public List<MyPageBackgroundEntry> MyPageBackgrounds { get; set; } = new List<MyPageBackgroundEntry>();
#endregion
#region Navigation Properties

View File

@@ -0,0 +1,20 @@
using Microsoft.EntityFrameworkCore;
namespace SVSim.Database.Models;
[Owned]
public class ViewerClassData
{
public int Level { get; set; }
public int Exp { get; set; }
#region Navigation Properties
public ClassEntry Class { get; set; } = new ClassEntry();
public Viewer Viewer { get; set; } = new Viewer();
public LeaderSkinEntry LeaderSkin { get; set; } = new LeaderSkinEntry();
#endregion
}

View File

@@ -11,7 +11,6 @@ public class ViewerCurrency
public ulong SteamCrystals { get; set; }
public ulong DmmCrystals { get; set; }
public ulong FreeCrystals { get; set; }
public ulong TotalCrystals { get; set; }
public ulong LifeTotalCrystals { get; set; }
public ulong RedEther { get; set; }
public ulong Rupees { get; set; }