Skip to content

Commit 2f5108f

Browse files
AlexMacocianAlexandru Macocian
andcommitted
Fix party loadout loading (#1200)
Co-authored-by: Alexandru Macocian <amacocian@microsoft.com>
1 parent 9510fdc commit 2f5108f

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

Daybreak.API/Services/HashingService.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public uint Hash(string data, int maxLength = -1)
108108
}
109109

110110
seed1 = (seed1 << 3) ^ uc;
111-
seed2 += StringHashTable[seed1 & 0xff];
111+
seed2 += StringHashTable[seed1 & 0xf];
112112
hash ^= seed2 + seed1;
113113
}
114114

Daybreak.API/Services/PartyService.cs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,16 +73,15 @@ public async Task<bool> SetPartyLoadout(PartyLoadout partyLoadout, CancellationT
7373
return false;
7474
}
7575

76-
// TODO: Hashing is broken
77-
//var heroBehaviorSetup = await this.gameThreadService.QueueOnGameThread(() => this.GetHeroBehaviorSetup(partyLoadout), cancellationToken);
78-
//foreach (var heroBehaviorEntry in heroBehaviorSetup ?? [])
79-
//{
80-
// if (!await this.SetHeroBehavior(heroBehaviorEntry.AgentId, heroBehaviorEntry.Behavior, cancellationToken))
81-
// {
82-
// scopedLogger.LogWarning("Could not set hero behavior for agent {agentId} to {behavior}", heroBehaviorEntry.AgentId, heroBehaviorEntry.Behavior);
83-
// await this.chatService.AddMessageAsync($"Cannot set party loadout. Could not set behavior {behavior} for agent {agentId}.", "Daybreak.API", Channel.Moderator, cancellationToken);
84-
// }
85-
//}
76+
var heroBehaviorSetup = await this.gameThreadService.QueueOnGameThread(() => this.GetHeroBehaviorSetup(partyLoadout), cancellationToken);
77+
foreach (var heroBehaviorEntry in heroBehaviorSetup ?? [])
78+
{
79+
if (!await this.SetHeroBehavior(heroBehaviorEntry.AgentId, heroBehaviorEntry.Behavior, cancellationToken))
80+
{
81+
scopedLogger.LogWarning("Could not set hero behavior for agent {agentId} to {behavior}", heroBehaviorEntry.AgentId, heroBehaviorEntry.Behavior);
82+
await this.chatService.AddMessageAsync($"Cannot set party loadout. Could not set behavior {heroBehaviorEntry.Behavior} for agent {heroBehaviorEntry.AgentId}.", "Daybreak.API", Channel.Moderator, cancellationToken);
83+
}
84+
}
8685

8786
await this.chatService.AddMessageAsync("Party loadout set.", "Daybreak.API", Channel.Moderator, cancellationToken);
8887
return true;

0 commit comments

Comments
 (0)