Fix post-raid PMC messages not working after bot gen changes

This commit is contained in:
Chomp
2025-02-18 09:31:20 +00:00
parent baf1a41c30
commit 440121514b
3 changed files with 14 additions and 8 deletions
@@ -315,6 +315,15 @@ public class BotController(
// Store bot details in cache so post-raid PMC messages can use data
_matchBotDetailsCacheService.CacheBot(botToCache);
// The client expects the Side for PMCs to be `Savage`
// We do this here so it's after we cache the bot in the match details lookup, as when you die, they will have the right side
if (botToCache.Info.Side is "Bear" or "Usec")
{
botToCache.Info.Side = "Savage";
}
_botGenerationCacheService.StoreBots(cacheKey, [botToCache]);
}
private GetRaidConfigurationRequestData? GetMostRecentRaidSettings()
@@ -133,13 +133,6 @@ public class BotGenerator(
_logger.Error($"Unable to retrieve: {botRole} bot template, cannot generate bot of this type");
}
// The client expects the Side for PMCs to be Savage
if (botRole is "Bear" or "Usec")
{
// TODO: cleanup later
preparedBotBase.Info.Side = "Savage";
}
return GenerateBot(sessionId, preparedBotBase, botJsonTemplateClone, botGenerationDetails);
}
@@ -101,6 +101,10 @@ public class PmcChatResponseService(
return;
}
// Because we've cached PMC sides as "Savage" for the client, we need to figure out
// what side it really is
var side = killerDetailsInCache.Info.Settings.Role == "pmcUSEC" ? "Usec" : "Bear";
var killerDetails = new UserDialogInfo
{
Id = killerDetailsInCache.Id,
@@ -108,7 +112,7 @@ public class PmcChatResponseService(
Info = new UserDialogDetails
{
Nickname = killerDetailsInCache.Info.Nickname,
Side = killerDetailsInCache.Info.Side,
Side = side,
Level = killerDetailsInCache.Info.Level,
MemberCategory = killerDetailsInCache.Info.MemberCategory,
SelectedMemberCategory = killerDetailsInCache.Info.SelectedMemberCategory