diff --git a/src/Fragment.NetSlum.Core/Fragment.NetSlum.Core.csproj b/src/Fragment.NetSlum.Core/Fragment.NetSlum.Core.csproj index a9184e7..4aa7c87 100644 --- a/src/Fragment.NetSlum.Core/Fragment.NetSlum.Core.csproj +++ b/src/Fragment.NetSlum.Core/Fragment.NetSlum.Core.csproj @@ -8,7 +8,7 @@ - + IPNetwork2 diff --git a/src/Fragment.NetSlum.Server/Api/Controllers/PlayersController.cs b/src/Fragment.NetSlum.Server/Api/Controllers/PlayersController.cs index 21a8a95..4c02540 100644 --- a/src/Fragment.NetSlum.Server/Api/Controllers/PlayersController.cs +++ b/src/Fragment.NetSlum.Server/Api/Controllers/PlayersController.cs @@ -84,6 +84,23 @@ public IEnumerable GetOnlinePlayers() return _mapper.Map(player); } + /// + /// Returns character information for all characters associated with an account ID + /// + /// + /// + /// Account does not exist or no data could be found + [HttpGet("account/{accountId:int}")] + public IEnumerable GetAccountPlayerInfos(int accountId) + { + var players = _database.Characters + .AsNoTracking() + .Include(p => p.CharacterStats) + .Where(p => p.PlayerAccountId == accountId); + + return _mapper.Map>(players); + } + /// /// Returns historical statistics for the given player ID /// @@ -95,7 +112,7 @@ public IEnumerable GetPlayerStatHistory(int characterId) { var playerStats = _database.CharacterStatHistory .AsNoTracking() - .Where(p => p.Id == characterId) + .Where(p => p.CharacterId == characterId) .OrderByDescending(p => p.CreatedAt); foreach (var stats in playerStats) diff --git a/src/Fragment.NetSlum.Server/Api/Models/PlayerInfo.cs b/src/Fragment.NetSlum.Server/Api/Models/PlayerInfo.cs index 0a3b3d1..7970bf3 100644 --- a/src/Fragment.NetSlum.Server/Api/Models/PlayerInfo.cs +++ b/src/Fragment.NetSlum.Server/Api/Models/PlayerInfo.cs @@ -20,4 +20,5 @@ public class PlayerInfo public ushort BronzeCoinCount { get; set; } public uint ModelId { get; set; } public string AvatarId { get; set; } = ""; + public int AccountId { get; set; } } diff --git a/src/Fragment.NetSlum.Server/Fragment.NetSlum.Server.csproj b/src/Fragment.NetSlum.Server/Fragment.NetSlum.Server.csproj index 2786b2d..735933c 100644 --- a/src/Fragment.NetSlum.Server/Fragment.NetSlum.Server.csproj +++ b/src/Fragment.NetSlum.Server/Fragment.NetSlum.Server.csproj @@ -9,12 +9,12 @@ - - + + - + all runtime; build; native; contentfiles; analyzers; buildtransitive @@ -25,10 +25,10 @@ - + - + diff --git a/src/Fragment.NetSlum.Server/Mappings/CharacterProfile.cs b/src/Fragment.NetSlum.Server/Mappings/CharacterProfile.cs index 5840f5f..21d0f71 100644 --- a/src/Fragment.NetSlum.Server/Mappings/CharacterProfile.cs +++ b/src/Fragment.NetSlum.Server/Mappings/CharacterProfile.cs @@ -18,6 +18,7 @@ public CharacterProfile() .ForMember(x => x.Greeting, y => y.MapFrom(z => z.GreetingMessage)) .ForMember(x => x.ModelId, y => y.MapFrom(z => z.FullModelId)) .ForMember(x => x.GuildId, y => y.MapFrom(z => z.GuildId)) + .ForMember(x => x.AccountId, y => y.MapFrom(z => z.PlayerAccountId)) .ForMember(x => x.CurrentHp, y => y.MapFrom(z => z.CharacterStats.CurrentHp)) .ForMember(x => x.CurrentSp, y => y.MapFrom(z => z.CharacterStats.CurrentSp)) .ForMember(x => x.CurrentGp, y => y.MapFrom(z => z.CharacterStats.CurrentGp)) diff --git a/test/Fragment.NetSlum.Networking.Test/Fragment.NetSlum.Networking.Test.csproj b/test/Fragment.NetSlum.Networking.Test/Fragment.NetSlum.Networking.Test.csproj index a9e9e90..644aef1 100644 --- a/test/Fragment.NetSlum.Networking.Test/Fragment.NetSlum.Networking.Test.csproj +++ b/test/Fragment.NetSlum.Networking.Test/Fragment.NetSlum.Networking.Test.csproj @@ -8,8 +8,8 @@ - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all