Add project data
This commit is contained in:
64
Tabletop.Core/Models/Ability.cs
Normal file
64
Tabletop.Core/Models/Ability.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using DbController;
|
||||
using Tabletop.Core.Interfaces;
|
||||
using Tabletop.Core.Models.Abstract;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Ability : LocalizationModelBase<AbilityDescription>, IDbModel<int?>
|
||||
{
|
||||
[CompareField("ability_id")]
|
||||
public int AbilityId { get; set; }
|
||||
|
||||
[CompareField("quality")]
|
||||
public int Quality { get; set; }
|
||||
[CompareField("force")]
|
||||
public int Force { get; set; }
|
||||
|
||||
public int? GetIdentifier()
|
||||
{
|
||||
return AbilityId > 0 ? AbilityId : null;
|
||||
}
|
||||
|
||||
public IEnumerable<Dictionary<string, object?>> GetLocalizedParameters()
|
||||
{
|
||||
foreach (var description in Description)
|
||||
{
|
||||
yield return new Dictionary<string, object?>
|
||||
{
|
||||
{ "ABILITY_ID", AbilityId },
|
||||
{ "NAME", description.Name },
|
||||
{ "DESCRIPTION", description.Description },
|
||||
{ "MECHANIC", description.Mechanic }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "ABILITY_ID", AbilityId },
|
||||
{ "QUALITY", Quality },
|
||||
{ "FORCE", Force }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class AbilityDescription : ILocalizationHelper
|
||||
{
|
||||
[CompareField("ability_id")]
|
||||
public int AbilityId { get; set; }
|
||||
|
||||
[CompareField("code")]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("description")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("mechanic")]
|
||||
public string Mechanic { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
24
Tabletop.Core/Models/Abstract/ArmyBase.cs
Normal file
24
Tabletop.Core/Models/Abstract/ArmyBase.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using DbController;
|
||||
|
||||
namespace Tabletop.Core.Models.Abstract
|
||||
{
|
||||
public abstract class ArmyBase
|
||||
{
|
||||
[CompareField("fraction_id")]
|
||||
public int FractionId { get; set; }
|
||||
[CompareField("used_force")]
|
||||
public int UsedForce { get; set; }
|
||||
|
||||
public List<Unit> Units { get; set; } = [];
|
||||
public int TotalUnits { get; set; }
|
||||
|
||||
public virtual Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "FRACTION_ID", FractionId },
|
||||
{ "USED_FORCE", UsedForce }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
15
Tabletop.Core/Models/Abstract/LocalizationModelBase.cs
Normal file
15
Tabletop.Core/Models/Abstract/LocalizationModelBase.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Globalization;
|
||||
using Tabletop.Core.Interfaces;
|
||||
|
||||
namespace Tabletop.Core.Models.Abstract
|
||||
{
|
||||
public abstract class LocalizationModelBase<T> where T : ILocalizationHelper
|
||||
{
|
||||
public List<T> Description { get; set; } = [];
|
||||
public T? GetLocalization(CultureInfo culture)
|
||||
{
|
||||
var description = Description.FirstOrDefault(x => x.Code.Equals(culture.TwoLetterISOLanguageName, StringComparison.OrdinalIgnoreCase));
|
||||
return description;
|
||||
}
|
||||
}
|
||||
}
|
||||
27
Tabletop.Core/Models/Abstract/ZoneBase.cs
Normal file
27
Tabletop.Core/Models/Abstract/ZoneBase.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using DbController;
|
||||
|
||||
namespace Tabletop.Core.Models.Abstract
|
||||
{
|
||||
public abstract class ZoneBase
|
||||
{
|
||||
[CompareField("x")]
|
||||
public string X { get; set; } = string.Empty;
|
||||
[CompareField("y")]
|
||||
public string Y { get; set; } = string.Empty;
|
||||
[CompareField("width")]
|
||||
public string Width { get; set; } = string.Empty;
|
||||
[CompareField("height")]
|
||||
public string Height { get; set; } = string.Empty;
|
||||
|
||||
public virtual Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "X", X },
|
||||
{ "Y", Y },
|
||||
{ "WIDTH", Width },
|
||||
{ "HEIGHT", Height }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Tabletop.Core/Models/Capture.cs
Normal file
36
Tabletop.Core/Models/Capture.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using DbController;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Capture
|
||||
{
|
||||
[CompareField("capture_id")]
|
||||
public int CaptureId { get; set; }
|
||||
[CompareField("move_id")]
|
||||
public int MoveId { get; set; }
|
||||
[CompareField("player_id")]
|
||||
public int PlayerId { get; set; }
|
||||
[CompareField("team_id")]
|
||||
public int TeamId { get; set; }
|
||||
[CompareField("capture_zone_nr")]
|
||||
public int CaptureZoneNr { get; set; }
|
||||
[CompareField("nr_of_turns")]
|
||||
public int NrOfTurns { get; set; }
|
||||
[CompareField("points_received")]
|
||||
public int PointsReceived { get; set; }
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "CAPTURE_ID", CaptureId },
|
||||
{ "MOVE_ID", MoveId },
|
||||
{ "PLAYER_ID", PlayerId },
|
||||
{ "TEAM_ID", TeamId },
|
||||
{ "CAPTURE_ZONE_NR", CaptureZoneNr },
|
||||
{ "NR_OF_TURNS", NrOfTurns },
|
||||
{ "POINTS_RECEIVED", PointsReceived }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
22
Tabletop.Core/Models/CaptureZone.cs
Normal file
22
Tabletop.Core/Models/CaptureZone.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using DbController;
|
||||
using Tabletop.Core.Models.Abstract;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class CaptureZone : ZoneBase
|
||||
{
|
||||
[CompareField("capturezone_id")]
|
||||
public int CaptureZoneId { get; set; }
|
||||
[CompareField("points_per_round")]
|
||||
public int PointsPerRound { get; set; }
|
||||
|
||||
public override Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
var baseParams = base.GetParameters();
|
||||
baseParams["CAPTUREZONE_ID"] = CaptureZoneId;
|
||||
baseParams["POINTS_PER_ROUNDS"] = PointsPerRound;
|
||||
|
||||
return baseParams;
|
||||
}
|
||||
}
|
||||
}
|
||||
57
Tabletop.Core/Models/Class.cs
Normal file
57
Tabletop.Core/Models/Class.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using DbController;
|
||||
using Tabletop.Core.Interfaces;
|
||||
using Tabletop.Core.Models.Abstract;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Class : LocalizationModelBase<ClassDescription>
|
||||
{
|
||||
[CompareField("class_id")]
|
||||
public int ClassId { get; set; }
|
||||
|
||||
[CompareField("quantity")]
|
||||
public string Quantity { get; set; } = string.Empty;
|
||||
|
||||
public int? GetIdentifier()
|
||||
{
|
||||
return ClassId > 0 ? ClassId : null;
|
||||
}
|
||||
|
||||
public IEnumerable<Dictionary<string, object?>> GetLocalizedParameters()
|
||||
{
|
||||
foreach (var description in Description)
|
||||
{
|
||||
yield return new Dictionary<string, object?>
|
||||
{
|
||||
{ "CLASS_ID", ClassId },
|
||||
{ "NAME", description.Name },
|
||||
{ "DESCRIPTION", description.Description }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "CLASS_ID", ClassId },
|
||||
{ "QUANTITY", Quantity }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class ClassDescription : ILocalizationHelper
|
||||
{
|
||||
[CompareField("class_id")]
|
||||
public int ClassId { get; set; }
|
||||
|
||||
[CompareField("code")]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("description")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
63
Tabletop.Core/Models/ConnectionLog.cs
Normal file
63
Tabletop.Core/Models/ConnectionLog.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using DbController;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public enum DeviceType
|
||||
{
|
||||
Desktop,
|
||||
Tablet,
|
||||
Smartphone,
|
||||
Other
|
||||
}
|
||||
|
||||
public enum OperatingSystem
|
||||
{
|
||||
Windows,
|
||||
macOS,
|
||||
Linux,
|
||||
iOS,
|
||||
Android,
|
||||
Other
|
||||
}
|
||||
|
||||
public class ConnectionLog
|
||||
{
|
||||
[CompareField("ip_address")]
|
||||
public string IpAddress { get; set; } = string.Empty; // IP-Adresse des Besuchers
|
||||
[CompareField("connection_time")]
|
||||
public DateTime ConnectionTime { get; set; } // Zeitstempel des Zugriffs
|
||||
[CompareField("user_agent")]
|
||||
public string UserAgent { get; set; } = string.Empty; // User-Agent (Browser/OS)
|
||||
[CompareField("referrer")]
|
||||
public string Referrer { get; set; } = string.Empty; // Referrer (URL der vorherigen Seite)
|
||||
[CompareField("requested_url")]
|
||||
public string RequestedUrl { get; set; } = string.Empty; // Angeforderte URL
|
||||
[CompareField("geolocation")]
|
||||
public string? Geolocation { get; set; } = null; // Geografische Lage (optional, kann null sein)
|
||||
[CompareField("session_id")]
|
||||
public string SessionId { get; set; } = string.Empty; // Sitzungs-ID
|
||||
[CompareField("status_code")]
|
||||
public int StatusCode { get; set; } // HTTP-Statuscode der Antwort
|
||||
[CompareField("device_type")]
|
||||
public string DeviceType { get; set; } = string.Empty; // Gerätetyp (Desktop/Tablet/Smartphone)
|
||||
[CompareField("operating_system")]
|
||||
public string OperatingSystem { get; set; } = string.Empty; // Betriebssystem des Besuchers
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "IP_ADDRESS", IpAddress },
|
||||
{ "CONNECTION_TIME", ConnectionTime },
|
||||
{ "USER_AGENT", UserAgent },
|
||||
{ "REFERRER", Referrer },
|
||||
{ "REQUESTED_URL", RequestedUrl },
|
||||
{ "GEOLOCATION", Geolocation },
|
||||
{ "SESSION_ID", SessionId },
|
||||
{ "STATUS_CODE", StatusCode },
|
||||
{ "DEVICE_TYPE", DeviceType },
|
||||
{ "OPERATING_SYSTEM", OperatingSystem }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
49
Tabletop.Core/Models/Elimination.cs
Normal file
49
Tabletop.Core/Models/Elimination.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using DbController;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Elimination
|
||||
{
|
||||
[CompareField("elimination_id")]
|
||||
public int EliminationId { get; set; }
|
||||
[CompareField("move_id")]
|
||||
public int MoveId { get; set; }
|
||||
[CompareField("team_id")]
|
||||
public int TeamId { get; set; }
|
||||
[CompareField("atk_id")]
|
||||
public int AtkId { get; set; }
|
||||
[CompareField("atk_unit_id")]
|
||||
public int AtkUnitId { get; set; }
|
||||
[CompareField("atk_unit_nr")]
|
||||
public int AtkUnitNr { get; set; }
|
||||
[CompareField("def_id")]
|
||||
public int DefId { get; set; }
|
||||
[CompareField("def_unit_id")]
|
||||
public int DefUnitId { get; set; }
|
||||
[CompareField("def_unit_nr")]
|
||||
public int DefUnitNr { get; set; }
|
||||
[CompareField("elimination_nr")]
|
||||
public int EliminationNr { get; set; }
|
||||
[CompareField("ForcePointsEliminations")]
|
||||
public int ForcePointsEliminations { get; set; }
|
||||
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "ELIMINATION_ID", EliminationId },
|
||||
{ "MOVE_ID", MoveId },
|
||||
{ "TEAM_ID", TeamId },
|
||||
{ "ATK_ID", AtkId },
|
||||
{ "ATK_UNIT_ID", AtkUnitId },
|
||||
{ "ATK_UNIT_NR", AtkUnitNr },
|
||||
{ "DEF_ID", DefId },
|
||||
{ "DEF_UNIT_ID", DefUnitId },
|
||||
{ "DEF_UNIT_NR", DefUnitNr },
|
||||
{ "ELIMINATION_NR", EliminationNr },
|
||||
{ "FORCEPOINTSELIMINATIONS", ForcePointsEliminations }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
64
Tabletop.Core/Models/Fraction.cs
Normal file
64
Tabletop.Core/Models/Fraction.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using DbController;
|
||||
using Tabletop.Core.Interfaces;
|
||||
using Tabletop.Core.Models.Abstract;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Fraction : LocalizationModelBase<FractionDescription>, IDbModel<int?>
|
||||
{
|
||||
[CompareField("fraction_id")]
|
||||
public int FractionId { get; set; }
|
||||
|
||||
[CompareField("image")]
|
||||
public byte[]? Image { get; set; }
|
||||
|
||||
public string ConvertedImage { get; set; } = string.Empty;
|
||||
|
||||
public int? GetIdentifier()
|
||||
{
|
||||
return FractionId > 0 ? FractionId : null;
|
||||
}
|
||||
|
||||
public IEnumerable<Dictionary<string, object?>> GetLocalizedParameters()
|
||||
{
|
||||
foreach (var description in Description)
|
||||
{
|
||||
yield return new Dictionary<string, object?>
|
||||
{
|
||||
{ "PERMISSION_ID", FractionId },
|
||||
{ "NAME", description.Name },
|
||||
{ "SHORT_NAME", description.ShortName },
|
||||
{ "DESCRIPTION", description.Description }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "FRACTION_ID", FractionId },
|
||||
{ "IMAGE", Image }
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class FractionDescription : ILocalizationHelper
|
||||
{
|
||||
[CompareField("fraction_id")]
|
||||
public int FractionId { get; set; }
|
||||
|
||||
[CompareField("code")]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("short_name")]
|
||||
public string ShortName { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("description")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
62
Tabletop.Core/Models/Game.cs
Normal file
62
Tabletop.Core/Models/Game.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
using DbController;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Game : IDbModel<int?>
|
||||
{
|
||||
[CompareField("game_id")]
|
||||
public int GameId { get; set; }
|
||||
[CompareField("gamemode_id")]
|
||||
public int GamemodeId { get; set; }
|
||||
[CompareField("user_id")]
|
||||
public int UserId { get; set; }
|
||||
[CompareField("surface_id")]
|
||||
public int SurfaceId { get; set; }
|
||||
[CompareField("layout_id")]
|
||||
public int LayoutId { get; set; }
|
||||
[CompareField("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[CompareField("number_of_rounds")]
|
||||
public int? NumberOfRounds { get; set; }
|
||||
[CompareField("force")]
|
||||
public int Force { get; set; }
|
||||
[CompareField("number_of_teams")]
|
||||
public int NumberOfTeams { get; set; }
|
||||
[CompareField("number_of_players")]
|
||||
public int NumberOfPlayers { get; set; }
|
||||
[CompareField("date")]
|
||||
public DateTime Date { get; set; } = DateTime.Now;
|
||||
|
||||
public string Host { get; set; } = string.Empty;
|
||||
|
||||
public List<Player> Players { get; set; } = [];
|
||||
public List<Move> Rounds { get; set; } = [];
|
||||
public List<Capture> Captures { get; set; } = [];
|
||||
public List<Elimination> Elimination { get; set; } = [];
|
||||
|
||||
public string GUID { get; set; } = string.Empty;
|
||||
|
||||
public int? GetIdentifier()
|
||||
{
|
||||
return GameId > 0 ? GameId : null;
|
||||
}
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "GAME_ID", GameId },
|
||||
{ "GAMEMODE_ID", GamemodeId },
|
||||
{ "USER_ID", UserId },
|
||||
{ "SURFACE_ID", SurfaceId },
|
||||
{ "LAYOUT_ID", LayoutId },
|
||||
{ "NAME", Name },
|
||||
{ "NUMBER_OF_ROUNDS", NumberOfRounds },
|
||||
{ "FORCE", Force },
|
||||
{ "NUMBER_OF_TEAMS", NumberOfTeams },
|
||||
{ "NUMBER_OF_PLAYERS", NumberOfPlayers },
|
||||
{ "DATE", Date }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
63
Tabletop.Core/Models/GameMode.cs
Normal file
63
Tabletop.Core/Models/GameMode.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using DbController;
|
||||
using Tabletop.Core.Interfaces;
|
||||
using Tabletop.Core.Models.Abstract;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Gamemode : LocalizationModelBase<GamemodeDescription>, IDbModel<int?>
|
||||
{
|
||||
[CompareField("gamemode_id")]
|
||||
public int GamemodeId { get; set; }
|
||||
|
||||
[CompareField("image")]
|
||||
public byte[]? Image { get; set; }
|
||||
|
||||
public string ConvertedImage { get; set; } = string.Empty;
|
||||
|
||||
public int? GetIdentifier()
|
||||
{
|
||||
return GamemodeId > 0 ? GamemodeId : null;
|
||||
}
|
||||
|
||||
public IEnumerable<Dictionary<string, object?>> GetLocalizedParameters()
|
||||
{
|
||||
foreach (var description in Description)
|
||||
{
|
||||
yield return new Dictionary<string, object?>
|
||||
{
|
||||
{ "PERMISSION_ID", GamemodeId },
|
||||
{ "NAME", description.Name },
|
||||
{ "DESCRIPTION", description.Description },
|
||||
{ "MECHANIC", description.Mechanic }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "GAMEMODE_ID", GamemodeId },
|
||||
{ "IMAGE", Image }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class GamemodeDescription : ILocalizationHelper
|
||||
{
|
||||
[CompareField("gamemode_id")]
|
||||
public int GamemodeId { get; set; }
|
||||
|
||||
[CompareField("code")]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("description")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("mechanic")]
|
||||
public string Mechanic { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
19
Tabletop.Core/Models/Geolocation.cs
Normal file
19
Tabletop.Core/Models/Geolocation.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Geolocation
|
||||
{
|
||||
[JsonProperty("country_name")]
|
||||
public string CountryName { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("city")]
|
||||
public string City { get; set; } = string.Empty;
|
||||
|
||||
[JsonProperty("latitude")]
|
||||
public double Latitude { get; set; }
|
||||
|
||||
[JsonProperty("longitude")]
|
||||
public double Longitude { get; set; }
|
||||
}
|
||||
}
|
||||
64
Tabletop.Core/Models/Layout.cs
Normal file
64
Tabletop.Core/Models/Layout.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
using DbController;
|
||||
using Tabletop.Core.Interfaces;
|
||||
using Tabletop.Core.Models.Abstract;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Layout : LocalizationModelBase<LayoutDescription>, IDbModel<int?>
|
||||
{
|
||||
[CompareField("layout_id")]
|
||||
public int LayoutId { get; set; }
|
||||
[CompareField("gamemode_id")]
|
||||
public int GamemodeId { get; set; }
|
||||
[CompareField("teams")]
|
||||
public int Teams { get; set; }
|
||||
[CompareField("width")]
|
||||
public string Width { get; set; } = string.Empty;
|
||||
[CompareField("height")]
|
||||
public string Height { get; set; } = string.Empty;
|
||||
|
||||
public List<SetupZone> SetupZones { get; set; } = [];
|
||||
public List<CaptureZone> CaptureZones { get; set; } = [];
|
||||
|
||||
public int? GetIdentifier()
|
||||
{
|
||||
return LayoutId > 0 ? LayoutId : null;
|
||||
}
|
||||
|
||||
public IEnumerable<Dictionary<string, object?>> GetLocalizedParameters()
|
||||
{
|
||||
foreach (var description in Description)
|
||||
{
|
||||
yield return new Dictionary<string, object?>
|
||||
{
|
||||
{ "LAYOUT_ID", LayoutId },
|
||||
{ "NAME", description.Name }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "LAYOUT_ID", LayoutId },
|
||||
{ "GAMEMODE_ID", GamemodeId },
|
||||
{ "TEAMS", Teams },
|
||||
{ "WIDTH", Width },
|
||||
{ "HEIGHT", Height }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class LayoutDescription : ILocalizationHelper
|
||||
{
|
||||
[CompareField("layout_id")]
|
||||
public int LayoutId { get; set; }
|
||||
|
||||
[CompareField("code")]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
36
Tabletop.Core/Models/Move.cs
Normal file
36
Tabletop.Core/Models/Move.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using DbController;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Move
|
||||
{
|
||||
[CompareField("move_id")]
|
||||
public int MoveId { get; set; }
|
||||
[CompareField("player_id")]
|
||||
public int PlayerId { get; set; }
|
||||
[CompareField("game_id")]
|
||||
public int GameId { get; set; }
|
||||
[CompareField("turn_nr")]
|
||||
public int TurnNr { get; set; }
|
||||
[CompareField("move_nr")]
|
||||
public int MoveNr { get; set; }
|
||||
[CompareField("start_move")]
|
||||
public DateTime StartMove { get; set; }
|
||||
[CompareField("end_move")]
|
||||
public DateTime EndMove { get; set; }
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "move_id", MoveId },
|
||||
{ "player_id", PlayerId },
|
||||
{ "game_id", GameId },
|
||||
{ "turn_nr", TurnNr },
|
||||
{ "move_nr", MoveNr },
|
||||
{ "start_move", StartMove },
|
||||
{ "end_move", EndMove }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
57
Tabletop.Core/Models/Permission.cs
Normal file
57
Tabletop.Core/Models/Permission.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using DbController;
|
||||
using Tabletop.Core.Interfaces;
|
||||
using Tabletop.Core.Models.Abstract;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Permission : LocalizationModelBase<PermissionDescription>
|
||||
{
|
||||
[CompareField("permission_id")]
|
||||
public int PermissionId { get; set; }
|
||||
|
||||
[CompareField("identifier")]
|
||||
public string Identifier { get; set; } = string.Empty;
|
||||
|
||||
public int? GetIdentifier()
|
||||
{
|
||||
return PermissionId > 0 ? PermissionId : null;
|
||||
}
|
||||
|
||||
public IEnumerable<Dictionary<string, object?>> GetLocalizedParameters()
|
||||
{
|
||||
foreach (var description in Description)
|
||||
{
|
||||
yield return new Dictionary<string, object?>
|
||||
{
|
||||
{ "PERMISSION_ID", PermissionId },
|
||||
{ "NAME", description.Name },
|
||||
{ "DESCRIPTION", description.Description }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "PERMISSION_ID", PermissionId },
|
||||
{ "IDENTIFIER", Identifier }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class PermissionDescription : ILocalizationHelper
|
||||
{
|
||||
[CompareField("permission_id")]
|
||||
public int PermissionId { get; set; }
|
||||
|
||||
[CompareField("code")]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("description")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
58
Tabletop.Core/Models/Player.cs
Normal file
58
Tabletop.Core/Models/Player.cs
Normal file
@@ -0,0 +1,58 @@
|
||||
using DbController;
|
||||
using Tabletop.Core.Models.Abstract;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Player : ArmyBase
|
||||
{
|
||||
[CompareField("player_id")]
|
||||
public int PlayerId { get; set; }
|
||||
[CompareField("user_id")]
|
||||
public int UserId { get; set; }
|
||||
[CompareField("game_id")]
|
||||
public int GameId { get; set; }
|
||||
[CompareField("team")]
|
||||
public int Team { get; set; }
|
||||
[CompareField("color")]
|
||||
public string Color { get; set; } = string.Empty;
|
||||
[CompareField("points")]
|
||||
public int Points { get; set; }
|
||||
[CompareField("order_nr")]
|
||||
public int OrderNr { get; set; }
|
||||
[CompareField("start_zone")]
|
||||
public int StartZone { get; set; }
|
||||
[CompareField("number_of_eliminations")]
|
||||
public int NumberOfEliminations { get; set; }
|
||||
[CompareField("force_points_of_eliminations")]
|
||||
public int ForcePointsOfEliminations { get; set; }
|
||||
[CompareField("number_of_remaining_units")]
|
||||
public int NumberOfRemainingUnits { get; set; }
|
||||
[CompareField("own_force_points_left")]
|
||||
public int OwnForcePointsLeft { get; set; }
|
||||
|
||||
|
||||
public int AllowedForce { get; set; }
|
||||
public User User { get; set; } = new();
|
||||
|
||||
public string ConnectionId { get; set; } = string.Empty; // Verbindung zu SignalR
|
||||
public bool IsReady { get; set; }
|
||||
|
||||
public override Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
var baseParams = base.GetParameters();
|
||||
|
||||
baseParams["PLAYER_ID"] = PlayerId;
|
||||
baseParams["USER_ID"] = UserId;
|
||||
baseParams["GAME_ID"] = GameId;
|
||||
baseParams["TEAM"] = Team;
|
||||
baseParams["COLOR"] = Color;
|
||||
baseParams["ORDER_NR"] = OrderNr;
|
||||
baseParams["START_ZONE"] = StartZone;
|
||||
baseParams["NUMBER_OF_ELIMINATIONS"] = NumberOfEliminations;
|
||||
baseParams["FORCE_POINTS_OF_ELIMINATIONS"] = ForcePointsOfEliminations;
|
||||
baseParams["NUMBER_OF_REMAINING_UNITS"] = NumberOfRemainingUnits;
|
||||
baseParams["OWN_FORCE_POINTS_LEFT"] = OwnForcePointsLeft;
|
||||
return baseParams;
|
||||
}
|
||||
}
|
||||
}
|
||||
20
Tabletop.Core/Models/SetupZone.cs
Normal file
20
Tabletop.Core/Models/SetupZone.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using DbController;
|
||||
using Tabletop.Core.Models.Abstract;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class SetupZone : ZoneBase
|
||||
{
|
||||
[CompareField("setupzone_id")]
|
||||
public int SetupZoneId { get; set; }
|
||||
|
||||
public override Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
var baseParams = base.GetParameters();
|
||||
|
||||
baseParams["SETUPZONE_ID"] = SetupZoneId;
|
||||
|
||||
return baseParams;
|
||||
}
|
||||
}
|
||||
}
|
||||
59
Tabletop.Core/Models/Surface.cs
Normal file
59
Tabletop.Core/Models/Surface.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using DbController;
|
||||
using Tabletop.Core.Interfaces;
|
||||
using Tabletop.Core.Models.Abstract;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Surface : LocalizationModelBase<SurfaceDescription>, IDbModel<int?>
|
||||
{
|
||||
[CompareField("surface_id")]
|
||||
public int SurfaceId { get; set; }
|
||||
|
||||
[CompareField("image")]
|
||||
public byte[]? Image { get; set; }
|
||||
|
||||
public string ConvertedImage { get; set; } = string.Empty;
|
||||
|
||||
public int? GetIdentifier()
|
||||
{
|
||||
return SurfaceId > 0 ? SurfaceId : null;
|
||||
}
|
||||
|
||||
public IEnumerable<Dictionary<string, object?>> GetLocalizedParameters()
|
||||
{
|
||||
foreach (var description in Description)
|
||||
{
|
||||
yield return new Dictionary<string, object?>
|
||||
{
|
||||
{ "SURFACE_ID", SurfaceId },
|
||||
{ "NAME", description.Name },
|
||||
{ "DESCRIPTION", description.Description }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "SURFACE_ID", SurfaceId },
|
||||
{ "IMAGE", Image }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class SurfaceDescription : ILocalizationHelper
|
||||
{
|
||||
[CompareField("surface_id")]
|
||||
public int SurfaceId { get; set; }
|
||||
|
||||
[CompareField("code")]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("description")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
27
Tabletop.Core/Models/Team.cs
Normal file
27
Tabletop.Core/Models/Team.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using DbController;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Team
|
||||
{
|
||||
[CompareField("team_id")]
|
||||
public int TeamId { get; set; }
|
||||
[CompareField("game_id")]
|
||||
public int GameId { get; set; }
|
||||
[CompareField("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[CompareField("points")]
|
||||
public int Points { get; set; }
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "TEAM_ID", TeamId },
|
||||
{ "GAME_ID", GameId },
|
||||
{ "NAME", Name },
|
||||
{ "POINTS", Points}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
34
Tabletop.Core/Models/Template.cs
Normal file
34
Tabletop.Core/Models/Template.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
using DbController;
|
||||
using Tabletop.Core.Models.Abstract;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Template : ArmyBase, IDbModel<int?>
|
||||
{
|
||||
[CompareField("template_id")]
|
||||
public int TemplateId { get; set; }
|
||||
[CompareField("user_id")]
|
||||
public int UserId { get; set; }
|
||||
[CompareField("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[CompareField("force")]
|
||||
public int Force { get; set; }
|
||||
|
||||
public int? GetIdentifier()
|
||||
{
|
||||
return TemplateId > 0 ? TemplateId : null;
|
||||
}
|
||||
|
||||
public override Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
var baseParams = base.GetParameters();
|
||||
|
||||
baseParams["TEMPLATE_ID"] = TemplateId;
|
||||
baseParams["USER_ID"] = UserId;
|
||||
baseParams["NAME"] = Name;
|
||||
baseParams["FORCE"] = Force;
|
||||
|
||||
return baseParams;
|
||||
}
|
||||
}
|
||||
}
|
||||
105
Tabletop.Core/Models/Unit.cs
Normal file
105
Tabletop.Core/Models/Unit.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
using DbController;
|
||||
using Tabletop.Core.Interfaces;
|
||||
using Tabletop.Core.Models.Abstract;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Unit : LocalizationModelBase<UnitDescription>, IDbModel<int?>
|
||||
{
|
||||
[CompareField("unit_id")]
|
||||
public int UnitId { get; set; }
|
||||
|
||||
[CompareField("fraction_id")]
|
||||
public int FractionId { get; set; }
|
||||
[CompareField("class_id")]
|
||||
public int ClassId { get; set; }
|
||||
[CompareField("troop_quantity")]
|
||||
public int TroopQuantity { get; set; }
|
||||
|
||||
[CompareField("defense")]
|
||||
public int Defense { get; set; }
|
||||
|
||||
[CompareField("moving")]
|
||||
public int Moving { get; set; }
|
||||
|
||||
[CompareField("primary_weapon_id")]
|
||||
public int PrimaryWeaponId { get; set; }
|
||||
|
||||
[CompareField("secondary_weapon_id")]
|
||||
public int? SecondaryWeaponId { get; set; }
|
||||
[CompareField("first_ability_id")]
|
||||
public int? FirstAbilityId { get; set; }
|
||||
[CompareField("second_ability_id")]
|
||||
public int? SecondAbilityId { get; set; }
|
||||
|
||||
[CompareField("image")]
|
||||
public byte[]? Image { get; set; }
|
||||
public int Force { get; set; }
|
||||
public string ConvertedImage { get; set; } = string.Empty;
|
||||
|
||||
public Weapon? PrimaryWeapon { get; set; }
|
||||
public Weapon? SecondaryWeapon { get; set; }
|
||||
public Class? Class { get; set; }
|
||||
public Ability? FirstAbility { get; set; }
|
||||
public Ability? SecondAbility { get; set; }
|
||||
|
||||
[CompareField("quantity")]
|
||||
public int Quantity { get; set; }
|
||||
public int ForceOfQuantity { get; set; }
|
||||
|
||||
public int? GetIdentifier()
|
||||
{
|
||||
return UnitId > 0 ? UnitId : null;
|
||||
}
|
||||
|
||||
public IEnumerable<Dictionary<string, object?>> GetLocalizedParameters()
|
||||
{
|
||||
foreach (var description in Description)
|
||||
{
|
||||
yield return new Dictionary<string, object?>
|
||||
{
|
||||
{ "UNIT_ID", UnitId },
|
||||
{ "NAME", description.Name },
|
||||
{ "DESCRIPTION", description.Description },
|
||||
{ "MECHANIC", description.Mechanic }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "UNIT_ID", UnitId },
|
||||
{ "FRACTION_ID", FractionId },
|
||||
{ "CLASS_ID", ClassId },
|
||||
{ "TROOP_QUANTITY", TroopQuantity },
|
||||
{ "DEFENSE", Defense },
|
||||
{ "MOVING", Moving },
|
||||
{ "PRIMARY_WEAPON_ID", PrimaryWeaponId },
|
||||
{ "SECONDARY_WEAPON_ID", SecondaryWeaponId },
|
||||
{ "FIRST_ABILITY_ID", FirstAbilityId },
|
||||
{ "SECOND_ABILITY_ID" , SecondAbilityId },
|
||||
{ "QUANTITY", Quantity }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class UnitDescription : ILocalizationHelper
|
||||
{
|
||||
[CompareField("unit_id")]
|
||||
public int UnitId { get; set; }
|
||||
|
||||
[CompareField("code")]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("description")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("mechanic")]
|
||||
public string Mechanic { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
56
Tabletop.Core/Models/User.cs
Normal file
56
Tabletop.Core/Models/User.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using DbController;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public sealed class User : IDbModel<int?>
|
||||
{
|
||||
[CompareField("user_id")]
|
||||
public int UserId { get; set; }
|
||||
[CompareField("username")]
|
||||
public string Username { get; set; } = string.Empty;
|
||||
[CompareField("display_name")]
|
||||
public string DisplayName { get; set; } = string.Empty;
|
||||
[CompareField("description")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
[CompareField("main_fraction_id")]
|
||||
public int MainFractionId { get; set; }
|
||||
[CompareField("password")]
|
||||
public string Password { get; set; } = string.Empty;
|
||||
[CompareField("salt")]
|
||||
public string Salt { get; set; } = string.Empty;
|
||||
[CompareField("last_login")]
|
||||
public DateTime LastLogin { get; set; }
|
||||
[CompareField("registration_date")]
|
||||
public DateTime RegistrationDate { get; set; }
|
||||
[CompareField("image")]
|
||||
public byte[]? Image { get; set; }
|
||||
|
||||
public string ConvertedImage { get; set; } = string.Empty;
|
||||
|
||||
|
||||
public List<Permission> Permissions { get; set; } = [];
|
||||
public List<Unit> Units { get; set; } = [];
|
||||
|
||||
public int? GetIdentifier()
|
||||
{
|
||||
return UserId > 0 ? UserId : null;
|
||||
}
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "USER_ID", UserId },
|
||||
{ "USERNAME", Username },
|
||||
{ "DISPLAY_NAME", DisplayName },
|
||||
{ "DESCRIPTION", Description },
|
||||
{ "MAIN_FRACTION_ID", MainFractionId },
|
||||
{ "PASSWORD", Password },
|
||||
{ "SALT", Salt },
|
||||
{ "LAST_LOGIN", LastLogin },
|
||||
{ "REGISTRATION_DATE", RegistrationDate },
|
||||
{ "IMAGE", Image }
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
12
Tabletop.Core/Models/UserPermission.cs
Normal file
12
Tabletop.Core/Models/UserPermission.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using DbController;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public sealed class UserPermission
|
||||
{
|
||||
[CompareField("user_id")]
|
||||
public int UserId { get; set; }
|
||||
[CompareField("permission_id")]
|
||||
public int PermissionId { get; set; }
|
||||
}
|
||||
}
|
||||
69
Tabletop.Core/Models/Weapon.cs
Normal file
69
Tabletop.Core/Models/Weapon.cs
Normal file
@@ -0,0 +1,69 @@
|
||||
using DbController;
|
||||
using Tabletop.Core.Interfaces;
|
||||
using Tabletop.Core.Models.Abstract;
|
||||
|
||||
namespace Tabletop.Core.Models
|
||||
{
|
||||
public class Weapon : LocalizationModelBase<WeaponDescription>, IDbModel<int?>
|
||||
{
|
||||
[CompareField("weapon_id")]
|
||||
public int WeaponId { get; set; }
|
||||
|
||||
[CompareField("attack")]
|
||||
public int Attack { get; set; }
|
||||
|
||||
[CompareField("quality")]
|
||||
public int Quality { get; set; }
|
||||
|
||||
[CompareField("range")]
|
||||
public int Range { get; set; }
|
||||
|
||||
[CompareField("dices")]
|
||||
public int Dices { get; set; }
|
||||
|
||||
public int? GetIdentifier()
|
||||
{
|
||||
return WeaponId > 0 ? WeaponId : null;
|
||||
}
|
||||
|
||||
public IEnumerable<Dictionary<string, object?>> GetLocalizedParameters()
|
||||
{
|
||||
foreach (var description in Description)
|
||||
{
|
||||
yield return new Dictionary<string, object?>
|
||||
{
|
||||
{ "PERMISSION_ID", WeaponId },
|
||||
{ "NAME", description.Name },
|
||||
{ "DESCRIPTION", description.Description }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public Dictionary<string, object?> GetParameters()
|
||||
{
|
||||
return new Dictionary<string, object?>
|
||||
{
|
||||
{ "WEAPON_ID", WeaponId },
|
||||
{ "ATTACK", Attack },
|
||||
{ "QUALITY", Quality },
|
||||
{ "RANGE", Range },
|
||||
{ "DICES", Dices }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public class WeaponDescription : ILocalizationHelper
|
||||
{
|
||||
[CompareField("weapon_id")]
|
||||
public int WeaponId { get; set; }
|
||||
|
||||
[CompareField("code")]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[CompareField("description")]
|
||||
public string Description { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user