Skip to content

Commit

Permalink
Merge branch 'release/0.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
karl-sjogren committed Feb 15, 2025
2 parents be56d2b + b529dbd commit 699a1da
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
tagged-release:
name: 'Create release'

runs-on: ubuntu-latest-arm
runs-on: ubuntu-latest

steps:
- name: Create release
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<!-- Solution settings -->
<Version>0.0.3</Version>
<Version>0.0.4</Version>
<LangVersion>latest</LangVersion>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ Alliance management tool for Whiteout Survival. Currently used by AFO in state

* Log in with Discord to get access to the alliance management tool
* Add players by their player ID, name and furnace level is fetched automatically
* Syncs players with the game every hour and keeps record of name changes
* Mark players as in alliance or not, players in alliance have gift codes automatically remdeemed
* Add and redeem gift codes for all alliance members. Also tracks which players a code has been redeemed for
* Checks for new gift codes on external sites on a regular basis and auto redeems them
* Save message templates that all leaders might want to send to all members such as bear formations or alliance event sign ups

Project icon by [Freepik](https://www.flaticon.com/authors/freepik) from [Flaticon](https://www.flaticon.com/)
7 changes: 6 additions & 1 deletion src/Borealis.Core/Services/GiftCodeRedemptionQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ public async Task ProcessQueueAsync(CancellationToken cancellationToken) {
var result = await giftCodeService.RedeemGiftCodeAsync(item.Player.ExternalId, item.GiftCode.Code, cancellationToken);

if(!result.Success) {
_logger.LogError("Failed to redeem gift code for player {PlayerId}.", item.Player.ExternalId);
_logger.LogError("Failed to redeem gift code for player {PlayerId}. Reason: {Message}", item.Player.ExternalId, result.Message);

if(result.Message == "Gift code expired.") {
item.GiftCode.IsExpired = true;
await giftCodeService.UpdateAsync(item.GiftCode, cancellationToken);
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/Borealis.Core/Services/GiftCodeService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ public async Task<Result> RedeemGiftCodeAsync(int whiteoutSurvivalPlayerId, stri
return Results.NotFound("Gift code not found.");
}

if(giftCodeEntity.IsExpired) {
return Results.Failure("Gift code is expired.");
}

var existingRedemption = await _context.GiftCodeRedemptions.FirstOrDefaultAsync(x => x.PlayerId == player.Id && x.GiftCodeId == giftCodeEntity.Id, cancellationToken);

if(existingRedemption is not null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ protected override async Task ExecuteAsync(CancellationToken cancellationToken)
var whiteoutSurvivalHttpClient = scope.ServiceProvider.GetRequiredService<IWhiteoutSurvivalHttpClient>();

var playerResult = await whiteoutSurvivalHttpClient.GetPlayerInfoAsync(player.ExternalId, cancellationToken);
if(playerResult.Code == 0) {
if(playerResult.Code != 0) {
_logger.LogWarning("Failed to get player info for player {ExternalId}.", player.ExternalId);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) {
var playerService = scope.ServiceProvider.GetRequiredService<IPlayerService>();

try {
var players = await playerService.GetPagedAsync(new PlayerQuery { PageIndex = 0, PageSize = 10_000 }, stoppingToken);
var players = await playerService.GetPagedAsync(new PlayerQuery { PageIndex = 0, PageSize = 10_000, ShowAll = true }, stoppingToken);
foreach(var player in players.Items.OrderByDescending(x => x.UpdatedAt)) {
await playerService.SynchronizePlayerAsync(player.ExternalId, false, stoppingToken);
await Task.Delay(TimeSpan.FromSeconds(10), stoppingToken);
Expand Down

0 comments on commit 699a1da

Please sign in to comment.