Reordered botbase properties

Cleaned up EndRaid code to improve consistency
This commit is contained in:
Chomp
2025-07-08 10:26:11 +01:00
parent daab33c4dc
commit 61cf11d3b8
2 changed files with 41 additions and 34 deletions
@@ -192,11 +192,6 @@ public record Info
set { _side = string.Intern(value); }
}
public bool? SquadInviteRestriction { get; set; }
// Confirmed in client
public int? PrestigeLevel { get; set; }
public string? Voice
{
get { return _voice; }
@@ -209,24 +204,20 @@ public record Info
// Confirmed in client
public int? Experience { get; set; }
public List<Ban>? Bans { get; set; }
public bool? BannedState { get; set; }
public long? BannedUntil { get; set; }
public bool? IsStreamerModeAvailable { get; set; }
// Confirmed in client
[JsonConverter(typeof(StringToNumberFactoryConverter))]
public int? RegistrationDate { get; set; }
public string? GameVersion { get; set; }
public double? AccountType { get; set; }
public MemberCategory? MemberCategory { get; set; }
public MemberCategory? SelectedMemberCategory { get; set; }
public List<Ban>? Bans { get; set; }
[JsonPropertyName("lockedMoveCommands")]
public bool? LockedMoveCommands { get; set; }
@@ -236,6 +227,8 @@ public record Info
public BotInfoSettings? Settings { get; set; }
public long? NicknameChangeDate { get; set; }
public List<object>? NeedWipeOptions { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
@@ -246,26 +239,33 @@ public record Info
[JsonPropertyName("lastWipeTimestamp")]
public LastCompleted? LastWipeTimestamp { get; set; }
public double? AccountType { get; set; }
public long? NicknameChangeDate { get; set; }
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
[JsonPropertyName("lastCompletedEvent")]
public LastCompleted? LastCompletedEvent { get; set; }
[JsonPropertyName("isMigratedSkills")]
public bool? IsMigratedSkills { get; set; }
public string? GroupId { get; set; }
public string? TeamId { get; set; }
public bool? BannedState { get; set; }
public long? BannedUntil { get; set; }
public bool? IsStreamerModeAvailable { get; set; }
public bool? SquadInviteRestriction { get; set; }
public bool? HasCoopExtension { get; set; }
public bool? HasPveGame { get; set; }
[JsonPropertyName("isMigratedSkills")]
public bool? IsMigratedSkills { get; set; }
public string? Type { get; set; }
// Confirmed in client
public int? PrestigeLevel { get; set; }
}
public record BotInfoSettings
@@ -419,17 +419,13 @@ public class LocationLifecycleService(
);
// Handle car extracts
if (ExtractWasViaCar(request.Results.ExitName))
if (TookCarExtract(request.Results))
{
HandleCarExtract(request.Results.ExitName, pmcProfile, sessionId);
}
// Handle coop exit
if (
request.Results.ExitName is not null
&& ExtractTakenWasCoop(request.Results.ExitName)
&& _traderConfig.Fence.CoopExtractGift.SendGift
)
if (TookCoopExtract(request.Results) && _traderConfig.Fence.CoopExtractGift.SendGift)
{
HandleCoopExtract(sessionId, pmcProfile, request.Results.ExitName);
SendCoopTakenFenceMessage(sessionId);
@@ -469,22 +465,32 @@ public class LocationLifecycleService(
/// <summary>
/// Was extract by car
/// </summary>
/// <param name="extractName"> Name of extract </param>
/// <param name="requestResults">Result object from completed raid</param>
/// <returns> True if extract was by car </returns>
protected bool ExtractWasViaCar(string extractName)
protected bool TookCarExtract(EndRaidResult? requestResults)
{
// exit name is undefined on death
if (string.IsNullOrEmpty(extractName))
if (string.IsNullOrEmpty(requestResults?.ExitName))
{
return false;
}
if (extractName.ToLowerInvariant().Contains("v-ex"))
if (requestResults.ExitName.ToLowerInvariant().Contains("v-ex"))
{
return true;
}
return _inRaidConfig.CarExtracts.Contains(extractName.Trim());
return _inRaidConfig.CarExtracts.Contains(requestResults.ExitName.Trim());
}
/// <summary>
/// Raid exit was via coop extract
/// </summary>
/// <param name="raidResult">Result object from completed raid</param>
/// <returns>True when exit was coop extract</returns>
protected bool TookCoopExtract(EndRaidResult? raidResult)
{
return raidResult?.ExitName is not null && ExtractTakenWasCoop(raidResult.ExitName);
}
/// <summary>
@@ -852,10 +858,11 @@ public class LocationLifecycleService(
// MUST occur prior to profile achievements being overwritten by post-raid achievements
ProcessAchievementRewards(fullServerProfile, postRaidProfile.Achievements);
// MUST occur AFTER ProcessAchievementRewards()
serverPmcProfile.Achievements = postRaidProfile.Achievements;
serverPmcProfile.Quests = ProcessPostRaidQuests(postRaidProfile.Quests);
// Handle edge case - must occur AFTER processPostRaidQuests()
// MUST occur AFTER processPostRaidQuests()
LightkeeperQuestWorkaround(
sessionId,
postRaidProfile.Quests,
@@ -875,9 +882,9 @@ public class LocationLifecycleService(
var fenceId = Traders.FENCE;
// Clamp fence standing
var currentFenceStanding = postRaidProfile.TradersInfo[fenceId].Standing;
var currentFenceStanding = postRaidProfile.TradersInfo[fenceId].Standing ?? 0d;
serverPmcProfile.TradersInfo[fenceId].Standing = Math.Min(
Math.Max((double)currentFenceStanding, -7),
Math.Max(currentFenceStanding, -7),
15
); // Ensure it stays between -7 and 15