String to MongoId conversions

Removed unnecessary properties from quest object
This commit is contained in:
Chomp
2025-07-15 10:37:49 +01:00
parent c8faa33b51
commit 2639504471
52 changed files with 152 additions and 143 deletions
@@ -90,9 +90,9 @@
],
"changeStandingCost": 0,
"questStatus": {
"id": "mongoId",
"id": "000000000000000000000000",
"uid": "playerId",
"qid": "questId",
"qid": "000000000000000000000000",
"startTime": 0,
"status": 1,
"statusTimers": {}
@@ -143,9 +143,9 @@
],
"changeStandingCost": 0,
"questStatus": {
"id": "mongoId",
"id": "000000000000000000000000",
"uid": "playerId",
"qid": "questId",
"qid": "000000000000000000000000",
"startTime": 0,
"status": 1,
"statusTimers": {}
@@ -227,9 +227,9 @@
],
"changeStandingCost": 0,
"questStatus": {
"id": "mongoId",
"id": "000000000000000000000000",
"uid": "playerId",
"qid": "questId",
"qid": "000000000000000000000000",
"startTime": 0,
"status": 1,
"statusTimers": {}
@@ -331,9 +331,9 @@
],
"changeStandingCost": 0,
"questStatus": {
"id": "mongoId",
"id": "000000000000000000000000",
"uid": "playerId",
"qid": "questId",
"qid": "000000000000000000000000",
"startTime": 0,
"status": 1,
"statusTimers": {}
@@ -157,7 +157,7 @@ public class MatchCallbacks(
/// Handle client/putMetrics
/// </summary>
/// <returns></returns>
public ValueTask<string> PutMetrics(string url, PutMetricsRequestData info, MongoId sessionID)
public ValueTask<string> PutMetrics(string url, PutMetricsRequestData info, MongoId sessionId)
{
return new ValueTask<string>(httpResponseUtil.NullResponse());
}
@@ -166,7 +166,11 @@ public class MatchCallbacks(
/// Handle client/analytics/event-disconnect
/// </summary>
/// <returns></returns>
public ValueTask<string> EventDisconnect(string url, PutMetricsRequestData info, string MongoId)
public ValueTask<string> EventDisconnect(
string url,
PutMetricsRequestData request,
MongoId sessionId
)
{
return new ValueTask<string>(httpResponseUtil.NullResponse());
}
@@ -143,7 +143,7 @@ public class CustomizationController(
/// <param name="sessionId">Session/Player id</param>
/// <param name="offerId"></param>
/// <returns>Suit</returns>
protected Suit? GetTraderClothingOffer(MongoId sessionId, string? offerId)
protected Suit? GetTraderClothingOffer(MongoId sessionId, MongoId offerId)
{
var foundSuit = GetAllTraderSuits(sessionId).FirstOrDefault(s => s.Id == offerId);
if (foundSuit is null)
@@ -185,9 +185,9 @@ public class InsuranceController(
/// <param name="rootItemParentId">The ID that should be assigned to all "hideout"/root items</param>
/// <param name="insured">The insurance object containing the items to evaluate for deletion</param>
/// <returns>A Set containing the IDs of items that should be deleted</returns>
protected HashSet<string> FindItemsToDelete(string rootItemParentId, Insurance insured)
protected HashSet<MongoId> FindItemsToDelete(string rootItemParentId, Insurance insured)
{
var toDelete = new HashSet<string>();
var toDelete = new HashSet<MongoId>();
// Populate a Map object of items for quick lookup by their ID and use it to populate a Map of main-parent items
// and each of their attachments. For example, a gun mapped to each of its attachments.
@@ -388,7 +388,7 @@ public class InsuranceController(
/// <param name="parentAttachmentsMap">Dictionary containing parent item IDs to arrays of their attachment items</param>
protected void ProcessRegularItems(
Insurance insured,
HashSet<string> toDelete,
HashSet<MongoId> toDelete,
Dictionary<string, List<Item>> parentAttachmentsMap
)
{
@@ -440,8 +440,8 @@ public class InsuranceController(
protected void ProcessAttachments(
Dictionary<string, List<Item>> mainParentToAttachmentsMap,
Dictionary<MongoId, Item> itemsMap,
string? insuredTraderId,
HashSet<string> toDelete
MongoId? insuredTraderId,
HashSet<MongoId> toDelete
)
{
foreach (var parentObj in mainParentToAttachmentsMap)
@@ -462,7 +462,7 @@ public class InsuranceController(
}
// Process the attachments for this individual parent item.
ProcessAttachmentByParent(parentObj.Value, insuredTraderId, toDelete);
ProcessAttachmentByParent(parentObj.Value, insuredTraderId.Value, toDelete);
}
}
@@ -477,8 +477,8 @@ public class InsuranceController(
/// <param name="toDelete">array that accumulates the IDs of the items to be deleted</param>
protected void ProcessAttachmentByParent(
List<Item> attachments,
string? traderId,
HashSet<string> toDelete
MongoId traderId,
HashSet<MongoId> toDelete
)
{
// Create dict of item ids + their flea/handbook price (highest is chosen)
@@ -576,7 +576,7 @@ public class InsuranceController(
/// <returns>Attachment count to remove</returns>
protected double GetAttachmentCountToRemove(
Dictionary<MongoId, double> weightedAttachmentByPrice,
string? traderId
MongoId traderId
)
{
const int removeCount = 0;
@@ -599,7 +599,7 @@ public class InsuranceController(
/// </summary>
/// <param name="insured">The insured items to process</param>
/// <param name="toDelete">The items that should be deleted</param>
protected void RemoveItemsFromInsurance(Insurance insured, HashSet<string> toDelete)
protected void RemoveItemsFromInsurance(Insurance insured, HashSet<MongoId> toDelete)
{
insured.Items = insured.Items.Where(item => !toDelete.Contains(item.Id)).ToList();
}
@@ -613,7 +613,7 @@ public class InventoryController(
// get tpl from trader assort
{
return databaseService
.GetTrader(request.FromOwner.Id)
.GetTrader(request.FromOwner.Id.Value)
.Assort.Items.FirstOrDefault(item => item.Id == request.ItemId)
?.Template;
}
@@ -630,7 +630,7 @@ public class InventoryController(
// Try alternate way of getting offer if first approach fails
var offer =
ragfairOfferService.GetOfferByOfferId(request.ItemId)
?? ragfairOfferService.GetOfferByOfferId(request.FromOwner.Id);
?? ragfairOfferService.GetOfferByOfferId(request.FromOwner.Id.Value);
// Try find examine item inside offer items array
var matchingItem = offer.Items.FirstOrDefault(offerItem =>
@@ -1080,7 +1080,7 @@ public class InventoryController(
// Changes made to result apply to character inventory
var inventoryItems = inventoryHelper.GetOwnerInventoryItems(
request,
request.NewItem,
request.NewItem.Value,
sessionID
);
@@ -1117,7 +1117,7 @@ public class InventoryController(
.Items.NewItems.Add(
new Item
{
Id = request.NewItem,
Id = request.NewItem.Value,
Template = itemToSplit.Template,
Upd = updatedUpd,
}
@@ -1127,7 +1127,7 @@ public class InventoryController(
inventoryItems.To.Add(
new Item
{
Id = request.NewItem,
Id = request.NewItem.Value,
Template = itemToSplit.Template,
ParentId = request.Container.Id,
SlotId = request.Container.ContainerName,
@@ -197,7 +197,8 @@ public class BotEquipmentModGenerator(
);
switch (plateSlotFilteringOutcome.Result)
{
case Result.UNKNOWN_FAILURE or Result.NO_DEFAULT_FILTER:
case Result.UNKNOWN_FAILURE
or Result.NO_DEFAULT_FILTER:
if (logger.IsLogEnabled(LogLevel.Debug))
{
logger.Debug(
@@ -225,7 +226,7 @@ public class BotEquipmentModGenerator(
{
modTpl = exhaustableModPool.GetRandomValue();
if (
modTpl is not null
!modTpl.Value.IsEmpty()
&& !botGeneratorHelper
.IsItemIncompatibleWithCurrentItems(equipment, modTpl.Value, modSlotName)
.Incompatible.GetValueOrDefault(false)
@@ -1120,7 +1121,7 @@ public class BotEquipmentModGenerator(
// It's ammo, use predefined ammo parameter
if (GetAmmoContainers().Contains(request.ModSlot) && request.ModSlot != "mod_magazine")
{
return itemHelper.GetItem(request.AmmoTpl);
return itemHelper.GetItem(request.AmmoTpl.Value);
}
// Ensure there's a pool of mods to pick from
@@ -1258,7 +1259,7 @@ public class BotEquipmentModGenerator(
return null;
}
return itemHelper.GetItem(chosenModResult.ChosenTemplate);
return itemHelper.GetItem(chosenModResult.ChosenTemplate.Value);
}
/// <summary>
@@ -243,7 +243,7 @@ public class BotWeaponGenerator(
// Fill UBGL if found
var ubglMod = weaponWithModsArray.FirstOrDefault(x => x.SlotId == "mod_launcher");
string? ubglAmmoTpl = null;
MongoId? ubglAmmoTpl = null;
if (ubglMod is not null)
{
var ubglTemplate = itemHelper.GetItem(ubglMod.Template).Value;
@@ -252,7 +252,7 @@ public class BotWeaponGenerator(
// the default ammo passed from GetWeightCompatibleAmmo can be null
if (ubglAmmoTpl is not null)
{
FillUbgl(weaponWithModsArray, ubglMod, ubglAmmoTpl);
FillUbgl(weaponWithModsArray, ubglMod, ubglAmmoTpl.Value);
}
}
@@ -497,7 +497,10 @@ public class BotWeaponGenerator(
}
// Has an UBGL
if (generatedWeaponResult.ChosenUbglAmmoTemplate is not null)
if (
generatedWeaponResult.ChosenUbglAmmoTemplate is not null
&& !generatedWeaponResult.ChosenUbglAmmoTemplate.Value.IsEmpty()
)
{
AddUbglGrenadesToBotInventory(weaponAndMods, generatedWeaponResult, inventory);
}
@@ -548,7 +551,7 @@ public class BotWeaponGenerator(
// get ammo template from db
var ubglAmmoDbTemplate = itemHelper
.GetItem(generatedWeaponResult.ChosenUbglAmmoTemplate)
.GetItem(generatedWeaponResult.ChosenUbglAmmoTemplate.Value)
.Value;
// Add greandes to bot inventory
@@ -564,7 +567,12 @@ public class BotWeaponGenerator(
.Process(ubglAmmoGenModel);
// Store extra grenades in secure container
AddAmmoToSecureContainer(5, generatedWeaponResult.ChosenUbglAmmoTemplate, 20, inventory);
AddAmmoToSecureContainer(
5,
generatedWeaponResult.ChosenUbglAmmoTemplate.Value,
20,
inventory
);
}
/// <summary>
@@ -659,7 +667,7 @@ public class BotWeaponGenerator(
/// <param name="weaponTemplate">Weapon details from database we want to pick ammo for</param>
/// <returns>Ammo template that works with the desired gun</returns>
protected MongoId GetWeightedCompatibleAmmo(
Dictionary<string, Dictionary<string, double>> cartridgePool,
Dictionary<string, Dictionary<MongoId, double>> cartridgePool,
TemplateItem weaponTemplate
)
{
@@ -700,7 +708,7 @@ public class BotWeaponGenerator(
}
// Inner join the weapons allowed + passed in cartridge pool to get compatible cartridges
Dictionary<string, double> compatibleCartridges = new();
Dictionary<MongoId, double> compatibleCartridges = new();
foreach (var cartridge in cartridgePoolForWeapon)
{
if (compatibleCartridgesInTemplate.Contains(cartridge.Key))
@@ -1491,7 +1491,7 @@ public class ItemHelper(
return;
}
FillMagazineWithCartridge(magazine, magTemplate, cartridgeTpl, minSizePercent);
FillMagazineWithCartridge(magazine, magTemplate, cartridgeTpl.Value, minSizePercent);
}
/// <summary>
@@ -1621,7 +1621,7 @@ public class ItemHelper(
/// <param name="fallbackCartridgeTpl">If a cartridge cannot be found in the above staticAmmoDist param, use this instead</param>
/// <param name="cartridgeWhitelist">OPTIONAL whitelist for cartridges</param>
/// <returns>Tpl of cartridge</returns>
protected string? DrawAmmoTpl(
protected MongoId? DrawAmmoTpl(
string caliber,
Dictionary<string, List<StaticAmmoDetails>> staticAmmoDist,
MongoId? fallbackCartridgeTpl = null,
@@ -1647,19 +1647,19 @@ public class ItemHelper(
return null;
}
var ammoArray = new ProbabilityObjectArray<string, float?>(cloner);
var ammoArray = new ProbabilityObjectArray<MongoId, float?>(cloner);
foreach (var icd in ammos)
{
// Whitelist exists and tpl not inside it, skip
// Fixes 9x18mm kedr issues
if (cartridgeWhitelist is not null && !cartridgeWhitelist.Contains(icd.Tpl))
if (cartridgeWhitelist is not null && !cartridgeWhitelist.Contains(icd.Tpl.Value))
{
continue;
}
ammoArray.Add(
new ProbabilityObject<string, float?>(
icd.Tpl,
new ProbabilityObject<MongoId, float?>(
icd.Tpl.Value,
(double)icd.RelativeProbability,
null
)
@@ -120,6 +120,16 @@ public readonly struct MongoId : IEquatable<MongoId>
return left.Equals(right);
}
public static bool operator !=(MongoId left, MongoId? right)
{
return left.Equals(right);
}
public static bool operator ==(MongoId left, MongoId? right)
{
return left.Equals(right);
}
public static bool operator !=(MongoId left, MongoId right)
{
return !left.Equals(right);
@@ -1594,7 +1594,7 @@ public record WildBody
public string? Body { get; set; }
[JsonPropertyName("hands")]
public string? Hands { get; set; }
public MongoId? Hands { get; set; }
[JsonPropertyName("isNotRandom")]
public bool? IsNotRandom { get; set; }
@@ -118,7 +118,7 @@ public record ItemDistribution
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("tpl")]
public string? Tpl { get; set; }
public MongoId Tpl { get; set; }
[JsonPropertyName("relativeProbability")]
public float? RelativeProbability { get; set; }
@@ -169,7 +169,7 @@ public record StaticAmmoDetails
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("tpl")]
public string? Tpl { get; set; }
public MongoId? Tpl { get; set; }
[JsonPropertyName("relativeProbability")]
public float? RelativeProbability { get; set; }
@@ -455,12 +455,6 @@ public record Limit : MinMax<int>
{
[JsonPropertyName("items")]
public List<string>? Items { get; set; }
[JsonPropertyName("min")]
public int? Min { get; set; }
[JsonPropertyName("max")]
public int? Max { get; set; }
}
public record AirdropParameter
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
namespace SPTarkov.Server.Core.Models.Eft.Common.Request;
@@ -23,7 +24,7 @@ public record OwnerInfo
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("id")]
public string? Id { get; set; }
public MongoId? Id { get; set; }
[JsonPropertyName("type")]
public string? Type { get; set; }
@@ -936,7 +936,7 @@ public record BotHideoutArea
public List<HideoutSlot>? Slots { get; set; }
[JsonPropertyName("lastRecipe")]
public string? LastRecipe { get; set; }
public MongoId? LastRecipe { get; set; }
}
public record HideoutSlot
@@ -448,7 +448,7 @@ public record BotTypeInventory
[JsonPropertyName("equipment")]
public Dictionary<EquipmentSlots, Dictionary<MongoId, double>>? Equipment { get; set; }
public GlobalAmmo? Ammo { get; set; }
public Dictionary<string, Dictionary<MongoId, double>>? Ammo { get; set; }
[JsonPropertyName("items")]
public ItemPools? Items { get; set; }
@@ -105,9 +105,6 @@ public record Quest
[JsonPropertyName("side")]
public required string Side { get; set; }
[JsonPropertyName("acceptanceAndFinishingSource")]
public string? AcceptanceAndFinishingSource { get; set; }
[JsonPropertyName("progressSource")]
public string? ProgressSource { get; set; }
@@ -125,15 +122,6 @@ public record Quest
/// </summary>
[JsonPropertyName("sptStatus")]
public QuestStatusEnum? SptStatus { get; set; }
[JsonPropertyName("questStatus")]
public QuestStatus? QuestStatus { get; set; }
[JsonPropertyName("changeCost")]
public List<object> ChangeCost { get; set; }
[JsonPropertyName("changeStandingCost")]
public double ChangeStandingCost { get; set; }
}
/// <summary>
@@ -17,18 +17,6 @@ public record RepeatableQuest : Quest
[JsonPropertyName("acceptanceAndFinishingSource")]
public string? AcceptanceAndFinishingSource { get; set; }
[JsonPropertyName("progressSource")]
public string? ProgressSource { get; set; }
[JsonPropertyName("rankingModes")]
public List<string?>? RankingModes { get; set; }
[JsonPropertyName("gameModes")]
public List<string>? GameModes { get; set; }
[JsonPropertyName("arenaLocations")]
public List<string>? ArenaLocations { get; set; }
[JsonPropertyName("questStatus")]
public RepeatableQuestStatus? QuestStatus { get; set; }
}
@@ -57,13 +45,13 @@ public record RepeatableQuestStatus
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("id")]
public string? Id { get; set; }
public MongoId Id { get; set; }
[JsonPropertyName("uid")]
public string? Uid { get; set; }
[JsonPropertyName("qid")]
public string? QId { get; set; }
public MongoId QId { get; set; }
[JsonPropertyName("startTime")]
public long? StartTime { get; set; }
@@ -10,7 +10,7 @@ public record BuyClothingRequestData : InventoryBaseActionRequestData
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("offer")]
public string? Offer { get; set; }
public MongoId Offer { get; set; }
[JsonPropertyName("items")]
public List<PaymentItemForClothing>? Items { get; set; }
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Utils;
namespace SPTarkov.Server.Core.Models.Eft.Dialog;
@@ -9,5 +10,5 @@ public record DeleteFriendRequest : IRequestData
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("friend_id")]
public string? FriendId { get; set; }
public MongoId FriendId { get; set; }
}
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Models.Utils;
@@ -13,7 +14,7 @@ public record GetMailDialogViewRequestData : IRequestData
public MessageType? Type { get; set; }
[JsonPropertyName("dialogId")]
public string? DialogId { get; set; }
public MongoId DialogId { get; set; }
[JsonPropertyName("limit")]
public int? Limit { get; set; }
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Inventory;
namespace SPTarkov.Server.Core.Models.Eft.Insurance;
@@ -12,5 +13,5 @@ public record InsureRequestData : InventoryBaseActionRequestData
public string? TransactionId { get; set; }
[JsonPropertyName("items")]
public List<string>? Items { get; set; }
public List<MongoId>? Items { get; set; }
}
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
namespace SPTarkov.Server.Core.Models.Eft.Inventory;
@@ -8,8 +9,8 @@ public record InventoryMergeRequestData : InventoryBaseActionRequestData
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("item")]
public string? Item { get; set; }
public MongoId Item { get; set; }
[JsonPropertyName("with")]
public string? With { get; set; }
public MongoId? With { get; set; }
}
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
namespace SPTarkov.Server.Core.Models.Eft.Inventory;
@@ -8,5 +9,5 @@ public record InventoryRemoveRequestData : InventoryBaseActionRequestData
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("item")]
public string? Item { get; set; }
public MongoId Item { get; set; }
}
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
namespace SPTarkov.Server.Core.Models.Eft.Inventory;
@@ -11,13 +12,13 @@ public record InventorySplitRequestData : InventoryBaseActionRequestData
/// Id of item to split
/// </summary>
[JsonPropertyName("splitItem")]
public string? SplitItem { get; set; }
public MongoId? SplitItem { get; set; }
/// <summary>
/// Id of new item stack
/// </summary>
[JsonPropertyName("newItem")]
public string? NewItem { get; set; }
public MongoId? NewItem { get; set; }
/// <summary>
/// Destination new item will be placed in
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Request;
namespace SPTarkov.Server.Core.Models.Eft.Inventory;
@@ -9,13 +10,13 @@ public record InventorySwapRequestData : InventoryBaseActionRequestData
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("item")]
public string? Item { get; set; }
public MongoId? Item { get; set; }
[JsonPropertyName("to")]
public To? To { get; set; }
[JsonPropertyName("item2")]
public string? Item2 { get; set; }
public MongoId? Item2 { get; set; }
[JsonPropertyName("to2")]
public To? To2 { get; set; }
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
namespace SPTarkov.Server.Core.Models.Eft.Inventory;
@@ -8,7 +9,7 @@ public record InventoryTagRequestData : InventoryBaseActionRequestData
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("item")]
public string? Item { get; set; }
public MongoId? Item { get; set; }
[JsonPropertyName("TagName")]
public string? TagName { get; set; }
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
namespace SPTarkov.Server.Core.Models.Eft.Inventory;
@@ -8,7 +9,7 @@ public record InventoryToggleRequestData : InventoryBaseActionRequestData
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("item")]
public string? Item { get; set; }
public MongoId? Item { get; set; }
[JsonPropertyName("value")]
public bool? Value { get; set; }
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
namespace SPTarkov.Server.Core.Models.Eft.Inventory;
@@ -8,10 +9,10 @@ public record InventoryTransferRequestData : InventoryBaseActionRequestData
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("item")]
public string? Item { get; set; }
public MongoId Item { get; set; }
[JsonPropertyName("with")]
public string? With { get; set; }
public MongoId? With { get; set; }
[JsonPropertyName("count")]
public int? Count { get; set; }
@@ -8,5 +8,5 @@ public record EmptyItemEventRouterResponse : ItemEventRouterBase
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("profileChanges")]
public string? ProfileChanges { get; set; } = "";
public new string? ProfileChanges { get; set; } = string.Empty;
}
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Enums;
@@ -52,7 +53,7 @@ public record EndRaidResult
public ExitStatus? Result { get; set; }
[JsonPropertyName("killerId")]
public string? KillerId { get; set; }
public MongoId? KillerId { get; set; }
[JsonPropertyName("killerAid")]
public string? KillerAid { get; set; }
@@ -6,12 +6,6 @@ namespace SPTarkov.Server.Core.Models.Eft.Match;
public record GetRaidConfigurationRequestData : RaidSettings, IRequestData
{
[JsonPropertyName("keyId")]
public string? KeyId { get; set; }
[JsonPropertyName("onlinePveRaidStates")]
public Dictionary<string, bool>? OnlinePveRaidStates { get; set; }
[JsonPropertyName("MaxGroupCount")]
public int? MaxGroupCount { get; set; }
@@ -193,7 +193,7 @@ public record MagazineTemplateAmmoItem
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("TemplateId")]
public string? TemplateId { get; set; }
public MongoId TemplateId { get; set; }
[JsonPropertyName("Count")]
public int? Count { get; set; }
@@ -533,7 +533,7 @@ public record Insurance
public int? ScheduledTime { get; set; }
[JsonPropertyName("traderId")]
public string? TraderId { get; set; }
public MongoId TraderId { get; set; }
[JsonPropertyName("maxStorageTime")]
public int? MaxStorageTime { get; set; }
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Inventory;
namespace SPTarkov.Server.Core.Models.Eft.Quests;
@@ -12,7 +13,7 @@ public record CompleteQuestRequestData : InventoryBaseActionRequestData
/// Quest Id
/// </summary>
[JsonPropertyName("qid")]
public string? QuestId { get; set; }
public MongoId QuestId { get; set; }
[JsonPropertyName("removeExcessItems")]
public bool? RemoveExcessItems { get; set; }
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Inventory;
namespace SPTarkov.Server.Core.Models.Eft.Quests;
@@ -9,7 +10,7 @@ public record FailQuestRequestData : InventoryBaseActionRequestData
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("qid")]
public string? QuestId { get; set; }
public MongoId QuestId { get; set; }
[JsonPropertyName("removeExcessItems")]
public bool? RemoveExcessItems { get; set; }
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Inventory;
namespace SPTarkov.Server.Core.Models.Eft.Ragfair;
@@ -24,7 +25,7 @@ public record Requirement
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("_tpl")]
public string? Template { get; set; }
public MongoId Template { get; set; }
// Can be decimal value
[JsonPropertyName("count")]
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Utils;
namespace SPTarkov.Server.Core.Models.Eft.Ragfair;
@@ -9,10 +10,10 @@ public record StorePlayerOfferTaxAmountRequestData : IRequestData
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("id")]
public string? Id { get; set; }
public MongoId? Id { get; set; }
[JsonPropertyName("tpl")]
public string? Tpl { get; set; }
public MongoId? Tpl { get; set; }
[JsonPropertyName("count")]
public int? Count { get; set; }
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
namespace SPTarkov.Server.Core.Models.Eft.Trade;
@@ -17,7 +18,7 @@ public record SoldItem
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("id")]
public string? Id { get; set; }
public MongoId Id { get; set; }
[JsonPropertyName("count")]
public int? Count { get; set; }
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
namespace SPTarkov.Server.Core.Models.Spt.Bots;
@@ -14,7 +15,7 @@ public record ChooseRandomCompatibleModResult
public bool? Found { get; set; }
[JsonPropertyName("chosenTpl")]
public string? ChosenTemplate { get; set; }
public MongoId? ChosenTemplate { get; set; }
[JsonPropertyName("reason")]
public string? Reason { get; set; }
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
namespace SPTarkov.Server.Core.Models.Spt.Bots;
@@ -12,10 +13,10 @@ public record GenerateWeaponResult
public List<Item>? Weapon { get; set; }
[JsonPropertyName("chosenAmmoTpl")]
public string? ChosenAmmoTemplate { get; set; }
public MongoId ChosenAmmoTemplate { get; set; }
[JsonPropertyName("chosenUbglAmmoTpl")]
public string? ChosenUbglAmmoTemplate { get; set; }
public MongoId? ChosenUbglAmmoTemplate { get; set; }
[JsonPropertyName("weaponMods")]
public GlobalMods? WeaponMods { get; set; }
@@ -54,7 +54,7 @@ public record ModToSpawnRequest
/// Ammo tpl to use if slot requires a cartridge to be added (e.g. mod_magazine)
/// </summary>
[JsonPropertyName("ammoTpl")]
public string? AmmoTpl { get; set; }
public MongoId? AmmoTpl { get; set; }
/// <summary>
/// Parent item the mod will go into
@@ -440,10 +440,10 @@ public record AdjustmentDetails
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("add")]
public Dictionary<string, Dictionary<string, float>>? Add { get; set; }
public Dictionary<string, Dictionary<MongoId, float>>? Add { get; set; }
[JsonPropertyName("edit")]
public Dictionary<string, Dictionary<string, float>>? Edit { get; set; }
public Dictionary<string, Dictionary<MongoId, float>>? Edit { get; set; }
}
public class ArmorPlateWeights
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
using SPTarkov.Server.Core.Models.Eft.Profile;
using SPTarkov.Server.Core.Models.Enums;
@@ -39,7 +40,7 @@ public record Gift
/// Optional - supply a trader type to send from, not necessary when sending from SYSTEM or USER
/// </summary>
[JsonPropertyName("trader")]
public string? Trader { get; set; }
public MongoId? Trader { get; set; }
[JsonPropertyName("messageText")]
public string? MessageText { get; set; }
@@ -8,9 +8,11 @@ public record LocaleBase
[JsonExtensionData]
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("global")]
/// <summary>
/// DO NOT USE THIS PROPERTY DIRECTLY, USE LOCALESERVICE INSTEAD
/// THIS IS LAZY LOADED AND YOUR CHANGES WILL NOT BE SAVED
/// </summary>
[JsonPropertyName("global")]
public required Dictionary<string, LazyLoad<Dictionary<string, string>>> Global { get; set; }
[JsonPropertyName("menu")]
@@ -1,4 +1,5 @@
using System.Text.Json.Serialization;
using SPTarkov.Server.Core.Models.Common;
namespace SPTarkov.Server.Core.Models.Spt.Services;
@@ -8,10 +9,10 @@ public record LootItem
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("id")]
public string? Id { get; set; }
public MongoId? Id { get; set; }
[JsonPropertyName("tpl")]
public string? Tpl { get; set; }
public MongoId? Tpl { get; set; }
[JsonPropertyName("isPreset")]
public bool? IsPreset { get; set; }
@@ -6,7 +6,7 @@ using SPTarkov.Server.Core.Models.Enums;
namespace SPTarkov.Server.Core.Models;
[Injectable]
public record Prapor() : ITrader
public record Prapor : ITrader
{
[JsonExtensionData]
public Dictionary<string, object>? ExtensionData { get; set; }
@@ -16,7 +16,7 @@ public record Prapor() : ITrader
}
[Injectable]
public record Therapist() : ITrader
public record Therapist : ITrader
{
[JsonExtensionData]
public Dictionary<string, object>? ExtensionData { get; set; }
@@ -26,7 +26,7 @@ public record Therapist() : ITrader
}
[Injectable]
public record Fence() : ITrader
public record Fence : ITrader
{
[JsonExtensionData]
public Dictionary<string, object>? ExtensionData { get; set; }
@@ -36,7 +36,7 @@ public record Fence() : ITrader
}
[Injectable]
public record Skier() : ITrader
public record Skier : ITrader
{
[JsonExtensionData]
public Dictionary<string, object>? ExtensionData { get; set; }
@@ -46,7 +46,7 @@ public record Skier() : ITrader
}
[Injectable]
public record Peacekeeper() : ITrader
public record Peacekeeper : ITrader
{
[JsonExtensionData]
public Dictionary<string, object>? ExtensionData { get; set; }
@@ -56,7 +56,7 @@ public record Peacekeeper() : ITrader
}
[Injectable]
public record Mechanic() : ITrader
public record Mechanic : ITrader
{
[JsonExtensionData]
public Dictionary<string, object>? ExtensionData { get; set; }
@@ -66,7 +66,7 @@ public record Mechanic() : ITrader
}
[Injectable]
public record Ragman() : ITrader
public record Ragman : ITrader
{
[JsonExtensionData]
public Dictionary<string, object>? ExtensionData { get; set; }
@@ -76,7 +76,7 @@ public record Ragman() : ITrader
}
[Injectable]
public record Jaeger() : ITrader
public record Jaeger : ITrader
{
[JsonExtensionData]
public Dictionary<string, object>? ExtensionData { get; set; }
@@ -86,7 +86,7 @@ public record Jaeger() : ITrader
}
[Injectable]
public record LighthouseKeeper() : ITrader
public record LighthouseKeeper : ITrader
{
[JsonExtensionData]
public Dictionary<string, object>? ExtensionData { get; set; }
@@ -96,7 +96,7 @@ public record LighthouseKeeper() : ITrader
}
[Injectable]
public record Btr() : ITrader
public record Btr : ITrader
{
[JsonExtensionData]
public Dictionary<string, object>? ExtensionData { get; set; }
@@ -106,7 +106,7 @@ public record Btr() : ITrader
}
[Injectable]
public record Ref() : ITrader
public record Ref : ITrader
{
[JsonExtensionData]
public Dictionary<string, object>? ExtensionData { get; set; }
@@ -451,7 +451,7 @@ public class BotEquipmentFilterService(
/// <param name="showEditWarnings"></param>
protected void AdjustWeighting(
AdjustmentDetails? weightingAdjustments,
Dictionary<string, Dictionary<string, double>> botItemPool,
Dictionary<string, Dictionary<MongoId, double>> botItemPool,
bool showEditWarnings = true
)
{
@@ -1244,7 +1244,7 @@ public class LocationLifecycleService(
protected void MergePmcAndScavEncyclopedias(PmcData primary, PmcData secondary)
{
var mergedDicts = primary
.Encyclopedia?.Union(secondary.Encyclopedia)
.Encyclopedia?.UnionBy(secondary.Encyclopedia, kvp => kvp.Key)
.GroupBy(kvp => kvp.Key)
.ToDictionary(g => g.Key, g => g.Any(kvp => kvp.Value));
@@ -18,7 +18,6 @@ namespace SPTarkov.Server.Core.Utils.Collections;
/// // count the elements which should be distributed according to the relative probabilities
/// res.filter(x => x==="b").reduce((sum, x) => sum + 1 , 0)
/// </summary>
/// <typeparam name="T"></typeparam>
/// <typeparam name="K"></typeparam>
/// <typeparam name="V"></typeparam>
public class ProbabilityObjectArray<K, V> : List<ProbabilityObject<K, V>>
@@ -3,7 +3,7 @@ using SPTarkov.DI.Annotations;
namespace SPTarkov.Server.Core.Utils;
[Injectable]
public class FileUtil()
public class FileUtil
{
protected const string _modBasePath = "user/mods/";
@@ -83,7 +83,7 @@ public class FileSptLoggerReference : BaseSptLoggerReference
[JsonPropertyName("filePattern")]
public string FilePattern { get; set; }
private int _maxFileSizeMb;
private readonly int _maxFileSizeMb;
[JsonPropertyName("maxFileSizeMB")]
public int MaxFileSizeMb
@@ -99,7 +99,7 @@ public class FileSptLoggerReference : BaseSptLoggerReference
}
}
private int _maxRollingFiles;
private readonly int _maxRollingFiles;
[JsonPropertyName("maxRollingFiles")]
public int MaxRollingFiles
@@ -32,12 +32,12 @@ public class RagfairOfferHolder(
/// <summary>
/// Offer Ids keyed by tpl
/// </summary>
private readonly ConcurrentDictionary<MongoId, HashSet<string>> _offersByTemplate = new();
private readonly ConcurrentDictionary<MongoId, HashSet<MongoId>> _offersByTemplate = new();
/// <summary>
/// Offer ids keyed by trader Id
/// </summary>
private readonly ConcurrentDictionary<MongoId, HashSet<string>> _offersByTrader = new();
private readonly ConcurrentDictionary<MongoId, HashSet<MongoId>> _offersByTrader = new();
private readonly Lock _expiredOfferIdsLock = new();
private readonly Lock _ragfairOperationLock = new();
@@ -87,7 +87,7 @@ public class RagfairOfferHolder(
/// </summary>
/// <param name="traderId">Id of trader to get offers for</param>
/// <returns>RagfairOffer list</returns>
public List<RagfairOffer> GetOffersByTrader(string traderId)
public List<RagfairOffer> GetOffersByTrader(MongoId traderId)
{
if (!_offersByTrader.TryGetValue(traderId, out var offerIds))
{
+1 -1
View File
@@ -170,7 +170,7 @@ public class ItemTplGenerator(
}
else
{
var val = itemsObject.TryGetValue(itemKey, out var value) ? value : itemKey;
var val = itemsObject.GetValueOrDefault(itemKey, itemKey);
_logger.Error(
$"New itemOverride entry required: itemsObject already contains {itemKey} {val} => {item.Id}"
);