Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@
"SecuredContainer": false
},
"questItems": true,
"specialSlotItems": false
"specialSlotItems": false,
"wipeOnRaidStart": false
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public record LostOnDeathConfig : BaseConfig
/// </summary>
[JsonPropertyName("questItems")]
public bool QuestItems { get; set; }

[JsonPropertyName("wipeOnRaidStart")]
public bool WipeOnRaidStart { get; set; }
}

public record LostEquipment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ BtrDeliveryService btrDeliveryService
protected readonly RagfairConfig _ragfairConfig = configServer.GetConfig<RagfairConfig>();
protected readonly HideoutConfig _hideoutConfig = configServer.GetConfig<HideoutConfig>();
protected readonly PmcConfig _pmcConfig = configServer.GetConfig<PmcConfig>();
protected readonly LostOnDeathConfig _lostOnDeathConfig = configServer.GetConfig<LostOnDeathConfig>();

/// <summary>
/// Handle client/match/local/start
Expand Down Expand Up @@ -128,9 +129,25 @@ public virtual StartLocalRaidResponseData StartLocalRaid(MongoId sessionId, Star

GC.Collect(GC.MaxGeneration, GCCollectionMode.Aggressive, true, true);

// Handle Player Inventory Wiping checks for alt-f4 prevention
HandlePreRaidInventoryChecks(request.PlayerSide, playerProfile.CharacterData.PmcData, sessionId);

return result;
}

/// <summary>
/// Handle Pre Raid checks Alt-F4 Prevention and player inventory wiping
/// </summary>
protected void HandlePreRaidInventoryChecks(string playerSide, PmcData pmcData, string sessionId)
{
// If config enabled, remove players equipped items to prevent alt-F4 from persisting items
if (string.Equals(playerSide, "pmc", StringComparison.OrdinalIgnoreCase) && _lostOnDeathConfig.WipeOnRaidStart)
{
logger.Debug("Wiping player inventory on raid start to prevent alt-f4");
inRaidHelper.DeleteInventory(pmcData, sessionId);
}
}

/// <summary>
/// Replace map exits with scav exits when player is scavving
/// </summary>
Expand Down
Loading