Skip to content

Commit

Permalink
Update packages and add endpoints for website
Browse files Browse the repository at this point in the history
  • Loading branch information
Blackburn29 committed Jan 7, 2024
1 parent 2f085d8 commit 6a49e23
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/Fragment.NetSlum.Core/Fragment.NetSlum.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="EFCore.NamingConventions" Version="8.0.0-rc.2" />
<PackageReference Include="EFCore.NamingConventions" Version="8.0.2" />
<PackageReference Include="IPNetwork2" Version="2.6.618">
<Aliases>IPNetwork2</Aliases>
</PackageReference>
Expand Down
19 changes: 18 additions & 1 deletion src/Fragment.NetSlum.Server/Api/Controllers/PlayersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,23 @@ public IEnumerable<Client> GetOnlinePlayers()
return _mapper.Map<PlayerInfo>(player);
}

/// <summary>
/// Returns character information for all characters associated with an account ID
/// </summary>
/// <param name="accountId"></param>
/// <response code="200"></response>
/// <response code="204">Account does not exist or no data could be found</response>
[HttpGet("account/{accountId:int}")]
public IEnumerable<PlayerInfo> GetAccountPlayerInfos(int accountId)
{
var players = _database.Characters
.AsNoTracking()
.Include(p => p.CharacterStats)
.Where(p => p.PlayerAccountId == accountId);

return _mapper.Map<IEnumerable<PlayerInfo>>(players);
}

/// <summary>
/// Returns historical statistics for the given player ID
/// </summary>
Expand All @@ -95,7 +112,7 @@ public IEnumerable<PlayerStats> 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)
Expand Down
1 change: 1 addition & 0 deletions src/Fragment.NetSlum.Server/Api/Models/PlayerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
10 changes: 5 additions & 5 deletions src/Fragment.NetSlum.Server/Fragment.NetSlum.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AspNetCore.HealthChecks.System" Version="7.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="7.1.0" />
<PackageReference Include="AspNetCore.HealthChecks.System" Version="8.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="8.0.0" />
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
<PackageReference Include="Haukcode.HighResolutionTimer" Version="1.1.0" />
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="13.4.0" />
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="13.5.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand All @@ -25,10 +25,10 @@
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="NSwag.AspNetCore" Version="14.0.0-preview010" />
<PackageReference Include="NSwag.AspNetCore" Version="14.0.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
</ItemGroup>

Expand Down
1 change: 1 addition & 0 deletions src/Fragment.NetSlum.Server/Mappings/CharacterProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
<PackageReference Include="xunit" Version="2.6.5" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.6">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down

0 comments on commit 6a49e23

Please sign in to comment.