From 2f5108fd3b9c5ae9489b90a3640ed349fc624ca2 Mon Sep 17 00:00:00 2001 From: Macocian Alexandru Victor Date: Fri, 2 Jan 2026 17:10:05 +0200 Subject: [PATCH] Fix party loadout loading (#1200) Co-authored-by: Alexandru Macocian --- Daybreak.API/Services/HashingService.cs | 2 +- Daybreak.API/Services/PartyService.cs | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Daybreak.API/Services/HashingService.cs b/Daybreak.API/Services/HashingService.cs index 730ebecc..5a0da859 100644 --- a/Daybreak.API/Services/HashingService.cs +++ b/Daybreak.API/Services/HashingService.cs @@ -108,7 +108,7 @@ public sealed class HashingService } seed1 = (seed1 << 3) ^ uc; - seed2 += StringHashTable[seed1 & 0xff]; + seed2 += StringHashTable[seed1 & 0xf]; hash ^= seed2 + seed1; } diff --git a/Daybreak.API/Services/PartyService.cs b/Daybreak.API/Services/PartyService.cs index 4cfc0591..206ad668 100644 --- a/Daybreak.API/Services/PartyService.cs +++ b/Daybreak.API/Services/PartyService.cs @@ -73,16 +73,15 @@ public sealed class PartyService( return false; } - // TODO: Hashing is broken - //var heroBehaviorSetup = await this.gameThreadService.QueueOnGameThread(() => this.GetHeroBehaviorSetup(partyLoadout), cancellationToken); - //foreach (var heroBehaviorEntry in heroBehaviorSetup ?? []) - //{ - // if (!await this.SetHeroBehavior(heroBehaviorEntry.AgentId, heroBehaviorEntry.Behavior, cancellationToken)) - // { - // scopedLogger.LogWarning("Could not set hero behavior for agent {agentId} to {behavior}", heroBehaviorEntry.AgentId, heroBehaviorEntry.Behavior); - // await this.chatService.AddMessageAsync($"Cannot set party loadout. Could not set behavior {behavior} for agent {agentId}.", "Daybreak.API", Channel.Moderator, cancellationToken); - // } - //} + var heroBehaviorSetup = await this.gameThreadService.QueueOnGameThread(() => this.GetHeroBehaviorSetup(partyLoadout), cancellationToken); + foreach (var heroBehaviorEntry in heroBehaviorSetup ?? []) + { + if (!await this.SetHeroBehavior(heroBehaviorEntry.AgentId, heroBehaviorEntry.Behavior, cancellationToken)) + { + scopedLogger.LogWarning("Could not set hero behavior for agent {agentId} to {behavior}", heroBehaviorEntry.AgentId, heroBehaviorEntry.Behavior); + await this.chatService.AddMessageAsync($"Cannot set party loadout. Could not set behavior {heroBehaviorEntry.Behavior} for agent {heroBehaviorEntry.AgentId}.", "Daybreak.API", Channel.Moderator, cancellationToken); + } + } await this.chatService.AddMessageAsync("Party loadout set.", "Daybreak.API", Channel.Moderator, cancellationToken); return true;