Merge branch 'main' of https://github.com/sp-tarkov/server-csharp
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using SptCommon.Annotations;
|
||||
using SptCommon.Annotations;
|
||||
using Core.Controllers;
|
||||
using Core.Helpers;
|
||||
using Core.Models.Eft.Common;
|
||||
@@ -131,9 +131,9 @@ public class ProfileCallbacks(
|
||||
/**
|
||||
* Handle client/game/profile/search
|
||||
*/
|
||||
public string SearchFriend(string url, SearchFriendRequestData info, string sessionID)
|
||||
public string SearchProfiles(string url, SearchProfilesRequestData info, string sessionID)
|
||||
{
|
||||
return _httpResponse.GetBody(_profileController.GetFriends(info, sessionID));
|
||||
return _httpResponse.GetBody(_profileController.SearchProfiles(info, sessionID));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -496,7 +496,7 @@ public class HideoutController(
|
||||
recipe.Requirements.Where((r) => r.Type == "Item" || r.Type == "Tool")
|
||||
);
|
||||
|
||||
List<IdWithCount> itemsToDelete = new List<IdWithCount>();
|
||||
List<IdWithCount> itemsToDelete = [];
|
||||
var output = _eventOutputHolder.GetOutput(sessionID);
|
||||
itemsToDelete.AddRange(body.Tools);
|
||||
itemsToDelete.AddRange(body.Items);
|
||||
@@ -789,7 +789,7 @@ public class HideoutController(
|
||||
hoursCrafting += recipe.ProductionTime;
|
||||
if (hoursCrafting / _hideoutConfig.HoursForSkillCrafting >= 1)
|
||||
{
|
||||
// Spent enough time crafting to get a bonus xp multipler
|
||||
// Spent enough time crafting to get a bonus xp multiplier
|
||||
var multiplierCrafting = Math.Floor((double)hoursCrafting / _hideoutConfig.HoursForSkillCrafting);
|
||||
craftingExpAmount += (int)(1 * multiplierCrafting);
|
||||
hoursCrafting -= _hideoutConfig.HoursForSkillCrafting * multiplierCrafting;
|
||||
|
||||
@@ -257,9 +257,9 @@ public class InventoryController(
|
||||
var rewards = new List<List<Item>>();
|
||||
var unlockedWeaponCrates = new List<string>
|
||||
{
|
||||
"665829424de4820934746ce6",
|
||||
"665732e7ac60f009f270d1ef",
|
||||
"665888282c4a1b73af576b77"
|
||||
ItemTpl.RANDOMLOOTCONTAINER_ARENA_WEAPONCRATE_VIOLET_OPEN,
|
||||
ItemTpl.RANDOMLOOTCONTAINER_ARENA_WEAPONCRATE_BLUE_OPEN,
|
||||
ItemTpl.RANDOMLOOTCONTAINER_ARENA_WEAPONCRATE_GREEN_OPEN
|
||||
};
|
||||
// Temp fix for unlocked weapon crate hideout craft
|
||||
if (isSealedWeaponBox || unlockedWeaponCrates.Contains(containerDetailsDb.Value.Id))
|
||||
|
||||
@@ -177,9 +177,8 @@ public class ProfileController(
|
||||
/**
|
||||
* Handle client/game/profile/search
|
||||
*/
|
||||
public List<SearchFriendResponse> GetFriends(SearchFriendRequestData info, string sessionID)
|
||||
public List<SearchFriendResponse> SearchProfiles(SearchProfilesRequestData info, string sessionID)
|
||||
{
|
||||
// TODO: We should probably rename this method in the next client update
|
||||
var result = new List<SearchFriendResponse>();
|
||||
|
||||
// Find any profiles with a nickname containing the entered name
|
||||
|
||||
@@ -140,7 +140,7 @@ public class RagfairController
|
||||
var traderAssorts = _ragfairHelper.GetDisplayableAssorts(sessionID);
|
||||
var result = new GetOffersResult
|
||||
{
|
||||
Offers = new List<RagfairOffer>(),
|
||||
Offers = [],
|
||||
OffersCount = searchRequest.Limit,
|
||||
SelectedCategory = searchRequest.HandbookId,
|
||||
};
|
||||
@@ -986,7 +986,7 @@ public class RagfairController
|
||||
)
|
||||
);
|
||||
|
||||
pmcData.RagfairInfo.Offers = new List<RagfairOffer>();
|
||||
pmcData.RagfairInfo.Offers = [];
|
||||
}
|
||||
|
||||
var playerOfferIndex = playerProfileOffers.FindIndex(offer => offer.Id == removeRequest.OfferId);
|
||||
|
||||
@@ -39,6 +39,20 @@ public class BotInventoryGenerator(
|
||||
{
|
||||
private BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
|
||||
|
||||
// Slots handled individually inside `GenerateAndAddEquipmentToBot`
|
||||
List<EquipmentSlots> _excludedEquipmentSlots =
|
||||
[
|
||||
EquipmentSlots.Pockets,
|
||||
EquipmentSlots.FirstPrimaryWeapon,
|
||||
EquipmentSlots.SecondPrimaryWeapon,
|
||||
EquipmentSlots.Holster,
|
||||
EquipmentSlots.ArmorVest,
|
||||
EquipmentSlots.TacticalVest,
|
||||
EquipmentSlots.FaceCover,
|
||||
EquipmentSlots.Headwear,
|
||||
EquipmentSlots.Earpiece
|
||||
];
|
||||
|
||||
/// <summary>
|
||||
/// Add equipment/weapons/loot to bot
|
||||
/// </summary>
|
||||
@@ -142,20 +156,6 @@ public class BotInventoryGenerator(
|
||||
public void GenerateAndAddEquipmentToBot(string sessionId, BotTypeInventory templateInventory, Chances wornItemChances, string botRole,
|
||||
BotBaseInventory botInventory, int botLevel, string chosenGameVersion, GetRaidConfigurationRequestData raidConfig)
|
||||
{
|
||||
// These will be handled later
|
||||
var excludedSlots = new List<EquipmentSlots>()
|
||||
{
|
||||
EquipmentSlots.Pockets,
|
||||
EquipmentSlots.FirstPrimaryWeapon,
|
||||
EquipmentSlots.SecondPrimaryWeapon,
|
||||
EquipmentSlots.Holster,
|
||||
EquipmentSlots.ArmorVest,
|
||||
EquipmentSlots.TacticalVest,
|
||||
EquipmentSlots.FaceCover,
|
||||
EquipmentSlots.Headwear,
|
||||
EquipmentSlots.Earpiece
|
||||
};
|
||||
|
||||
_botConfig.Equipment.TryGetValue(_botGeneratorHelper.GetBotEquipmentRole(botRole), out var botEquipConfig);
|
||||
var randomistionDetails = _botHelper.GetBotRandomizationDetails(botLevel, botEquipConfig);
|
||||
|
||||
@@ -188,7 +188,7 @@ public class BotInventoryGenerator(
|
||||
{
|
||||
// Skip some slots as they need to be done in a specific order + with specific parameter values
|
||||
// e.g. Weapons
|
||||
if (excludedSlots.Contains(equipmentSlot))
|
||||
if (_excludedEquipmentSlots.Contains(equipmentSlot))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -394,7 +394,7 @@ public class BotWeaponGenerator(
|
||||
|
||||
return;
|
||||
}
|
||||
var isInternalMag = magTemplate.Properties.ReloadMagType == "InternalMagazine";
|
||||
var isInternalMag = magTemplate.Properties.ReloadMagType == ReloadMode.InternalMagazine;
|
||||
var ammoTemplate = _itemHelper.GetItem(generatedWeaponResult.ChosenAmmoTemplate).Value;
|
||||
if (ammoTemplate is null)
|
||||
{
|
||||
@@ -508,7 +508,7 @@ public class BotWeaponGenerator(
|
||||
{
|
||||
// Edge case - magazineless chamber loaded weapons dont have magazines, e.g. mp18
|
||||
// return default mag tpl
|
||||
if (weaponTemplate.Properties.ReloadMode == "OnlyBarrel")
|
||||
if (weaponTemplate.Properties.ReloadMode == ReloadMode.OnlyBarrel)
|
||||
{
|
||||
return _botWeaponGeneratorHelper.GetWeaponsDefaultMagazineTpl(weaponTemplate);
|
||||
}
|
||||
|
||||
@@ -586,7 +586,7 @@ public class LootGenerator(
|
||||
// Find a random item of the desired type and add as reward
|
||||
for (var index = 0; index < rewardCount; index++) {
|
||||
var chosenItem = _randomUtil.DrawRandomFromList(relatedItems.ToList());
|
||||
var reward = new List<Item> { new Item() { Id = _hashUtil.Generate(), Template = chosenItem[0].Id } };
|
||||
var reward = new List<Item> { new() { Id = _hashUtil.Generate(), Template = chosenItem[0].Id } };
|
||||
|
||||
modRewards.Add(reward);
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ public class PlayerScavGenerator(
|
||||
var itemTemplate = itemResult.Value;
|
||||
var itemsToAdd = new List<Item>()
|
||||
{
|
||||
new Item()
|
||||
new()
|
||||
{
|
||||
Id = _hashUtil.Generate(),
|
||||
Template = itemTemplate.Id,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using Core.Helpers;
|
||||
using Core.Helpers;
|
||||
using Core.Models.Common;
|
||||
using SptCommon.Annotations;
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
@@ -32,8 +32,8 @@ public class ScavCaseRewardGenerator(
|
||||
)
|
||||
{
|
||||
protected ScavCaseConfig _scavCaseConfig = _configServer.GetConfig<ScavCaseConfig>();
|
||||
protected List<TemplateItem> _dbItemsCache = new List<TemplateItem>();
|
||||
protected List<TemplateItem> _dbAmmoItemsCache = new List<TemplateItem>();
|
||||
protected List<TemplateItem> _dbItemsCache = [];
|
||||
protected List<TemplateItem> _dbAmmoItemsCache = [];
|
||||
|
||||
/// <summary>
|
||||
/// Create an array of rewards that will be given to the player upon completing their scav case build
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using SptCommon.Annotations;
|
||||
using SptCommon.Annotations;
|
||||
using Core.Helpers;
|
||||
using Core.Models.Enums;
|
||||
using Core.Utils;
|
||||
|
||||
namespace Core.Generators.WeaponGen.Implementations;
|
||||
@@ -17,7 +18,7 @@ public class BarrelInvetoryMagGen(
|
||||
|
||||
public bool CanHandleInventoryMagGen(InventoryMagGen inventoryMagGen)
|
||||
{
|
||||
return inventoryMagGen.GetWeaponTemplate().Properties.ReloadMode == "OnlyBarrel";
|
||||
return inventoryMagGen.GetWeaponTemplate().Properties.ReloadMode == ReloadMode.OnlyBarrel;
|
||||
}
|
||||
|
||||
public void Process(InventoryMagGen inventoryMagGen)
|
||||
|
||||
@@ -118,7 +118,7 @@ public class ExternalInventoryMagGen(
|
||||
}
|
||||
|
||||
// Edge case - some weapons (SKS + shotguns) have an internal magazine as default, choose random non-internal magazine to add to bot instead
|
||||
if (magTemplate.Properties.ReloadMagType == "InternalMagazine")
|
||||
if (magTemplate.Properties.ReloadMagType == ReloadMode.InternalMagazine)
|
||||
{
|
||||
var result = GetRandomExternalMagazineForInternalMagazineGun(
|
||||
inventoryMagGen.GetWeaponTemplate().Id,
|
||||
@@ -179,7 +179,7 @@ public class ExternalInventoryMagGen(
|
||||
}
|
||||
|
||||
// Non-internal magazines that fit into the weapon
|
||||
var externalMagazineOnlyPool = magazinePool.Where((x) => x.Properties.ReloadMagType != "InternalMagazine");
|
||||
var externalMagazineOnlyPool = magazinePool.Where((x) => x.Properties.ReloadMagType != ReloadMode.InternalMagazine);
|
||||
if (externalMagazineOnlyPool is null || externalMagazineOnlyPool?.Count() == 0)
|
||||
{
|
||||
return null;
|
||||
|
||||
+3
-2
@@ -1,5 +1,6 @@
|
||||
using SptCommon.Annotations;
|
||||
using SptCommon.Annotations;
|
||||
using Core.Helpers;
|
||||
using Core.Models.Enums;
|
||||
|
||||
namespace Core.Generators.WeaponGen.Implementations;
|
||||
|
||||
@@ -15,7 +16,7 @@ public class InternalMagazineInventoryMagGen(
|
||||
|
||||
public bool CanHandleInventoryMagGen(InventoryMagGen inventoryMagGen)
|
||||
{
|
||||
return inventoryMagGen.GetMagazineTemplate().Properties.ReloadMagType == "InternalMagazine";
|
||||
return inventoryMagGen.GetMagazineTemplate().Properties.ReloadMagType == ReloadMode.InternalMagazine;
|
||||
}
|
||||
|
||||
public void Process(InventoryMagGen inventoryMagGen)
|
||||
|
||||
@@ -72,7 +72,7 @@ public class DialogueHelper(
|
||||
// Check reward count when item being moved isn't in reward list
|
||||
// If count is 0, it means after this move occurs the reward array will be empty and all rewards collected
|
||||
if (message.Items.Data is null)
|
||||
message.Items.Data = new();
|
||||
message.Items.Data = [];
|
||||
|
||||
var rewardItems = message.Items.Data?.Where(x => x.Id != itemId);
|
||||
if (rewardItems.Count() == 0)
|
||||
@@ -85,7 +85,7 @@ public class DialogueHelper(
|
||||
}
|
||||
}
|
||||
|
||||
return new List<Item>();
|
||||
return [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -96,10 +96,7 @@ public class DialogueHelper(
|
||||
public Dictionary<string, Models.Eft.Profile.Dialogue> GetDialogsForProfile(string sessionId)
|
||||
{
|
||||
var profile = _profileHelper.GetFullProfile(sessionId);
|
||||
if (profile.DialogueRecords is null)
|
||||
profile.DialogueRecords = new();
|
||||
|
||||
return profile.DialogueRecords;
|
||||
return profile.DialogueRecords ?? (profile.DialogueRecords = new());
|
||||
}
|
||||
|
||||
public Models.Eft.Profile.Dialogue? GetDialogueFromProfile(string profileId, string dialogueId)
|
||||
|
||||
@@ -40,6 +40,9 @@ public class InventoryHelper(
|
||||
{
|
||||
protected InventoryConfig _inventoryConfig = _configServer.GetConfig<InventoryConfig>();
|
||||
|
||||
// Item types to ignore inside `GetSizeByInventoryItemHash`
|
||||
List<string> _itemBaseTypesToIgnore = [BaseClasses.BACKPACK, BaseClasses.SEARCHABLE_ITEM, BaseClasses.SIMPLE_CONTAINER];
|
||||
|
||||
/// <summary>
|
||||
/// Add multiple items to player stash (assuming they all fit)
|
||||
/// </summary>
|
||||
@@ -655,12 +658,8 @@ public class InventoryHelper(
|
||||
var forcedDown = 0;
|
||||
var forcedLeft = 0;
|
||||
var forcedRight = 0;
|
||||
var outX = (int)tmpItem.Properties.Width;
|
||||
var outY = (int)tmpItem.Properties.Height;
|
||||
|
||||
// Item types to ignore
|
||||
var skipThisItems = new List<string>
|
||||
{ BaseClasses.BACKPACK, BaseClasses.SEARCHABLE_ITEM, BaseClasses.SIMPLE_CONTAINER };
|
||||
var outX = tmpItem.Properties.Width;
|
||||
var outY = tmpItem.Properties.Height;
|
||||
|
||||
var rootIsFolded = rootItem?.Upd?.Foldable?.Folded == true;
|
||||
|
||||
@@ -669,7 +668,7 @@ public class InventoryHelper(
|
||||
outX -= tmpItem.Properties.SizeReduceRight.Value;
|
||||
|
||||
// Calculate size contribution from child items/attachments
|
||||
if (!skipThisItems.Contains(tmpItem.Parent))
|
||||
if (!_itemBaseTypesToIgnore.Contains(tmpItem.Parent))
|
||||
while (toDo.Count > 0)
|
||||
{
|
||||
if (inventoryItemHash.ByParentId.ContainsKey(toDo[0]))
|
||||
@@ -726,8 +725,8 @@ public class InventoryHelper(
|
||||
|
||||
return
|
||||
[
|
||||
outX + sizeLeft + sizeRight + forcedLeft + forcedRight,
|
||||
outY + sizeUp + sizeDown + forcedUp + forcedDown
|
||||
outX.Value + sizeLeft + sizeRight + forcedLeft + forcedRight,
|
||||
outY.Value + sizeUp + sizeDown + forcedUp + forcedDown
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -2045,8 +2045,8 @@ public class ItemHelper(
|
||||
public class ItemSize
|
||||
{
|
||||
[JsonPropertyName("width")]
|
||||
public double Width { get; set; }
|
||||
public int Width { get; set; }
|
||||
|
||||
[JsonPropertyName("height")]
|
||||
public double Height { get; set; }
|
||||
public int Height { get; set; }
|
||||
}
|
||||
|
||||
@@ -170,16 +170,16 @@ public class TradeHelper(
|
||||
|
||||
if (assortHasBuyRestrictions)
|
||||
{
|
||||
var itemPurchaseDat = new PurchaseDetails()
|
||||
var itemPurchaseDat = new PurchaseDetails
|
||||
{
|
||||
Items = new List<PurchaseItems>()
|
||||
{
|
||||
new PurchaseItems()
|
||||
Items =
|
||||
[
|
||||
new PurchaseItems
|
||||
{
|
||||
ItemId = buyRequestData.ItemId,
|
||||
Count = buyCount
|
||||
}
|
||||
},
|
||||
],
|
||||
TraderId = buyRequestData.TransactionId
|
||||
};
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Core.Models.Enums;
|
||||
using Core.Utils.Json.Converters;
|
||||
|
||||
namespace Core.Models.Eft.Common.Tables;
|
||||
@@ -56,17 +57,21 @@ public record Props
|
||||
[JsonPropertyName("BackgroundColor")]
|
||||
public string? BackgroundColor { get; set; }
|
||||
|
||||
// Type confirmed via client
|
||||
[JsonPropertyName("Width")]
|
||||
public double? Width { get; set; }
|
||||
public int? Width { get; set; }
|
||||
|
||||
// Type confirmed via client
|
||||
[JsonPropertyName("Height")]
|
||||
public double? Height { get; set; }
|
||||
public int? Height { get; set; }
|
||||
|
||||
// Type confirmed via client
|
||||
[JsonPropertyName("StackMaxSize")]
|
||||
public int? StackMaxSize { get; set; }
|
||||
|
||||
// Type confirmed via client
|
||||
[JsonPropertyName("Rarity")]
|
||||
public string? Rarity { get; set; }
|
||||
public LootRarity? Rarity { get; set; }
|
||||
|
||||
[JsonPropertyName("SpawnChance")]
|
||||
public double? SpawnChance { get; set; }
|
||||
@@ -134,10 +139,11 @@ public record Props
|
||||
[JsonPropertyName("QuestStashMaxCount")]
|
||||
public double? QuestStashMaxCount { get; set; }
|
||||
|
||||
// Type confirmed via client
|
||||
[JsonPropertyName("LootExperience")]
|
||||
public double? LootExperience { get; set; }
|
||||
public int? LootExperience { get; set; }
|
||||
|
||||
// Checked on live
|
||||
// Type confirmed via client
|
||||
[JsonPropertyName("ExamineExperience")]
|
||||
public int? ExamineExperience { get; set; }
|
||||
|
||||
@@ -147,11 +153,13 @@ public record Props
|
||||
[JsonPropertyName("InsuranceDisabled")]
|
||||
public bool? InsuranceDisabled { get; set; }
|
||||
|
||||
// Type confirmed via client
|
||||
[JsonPropertyName("RepairCost")]
|
||||
public double? RepairCost { get; set; }
|
||||
public int? RepairCost { get; set; }
|
||||
|
||||
// Type confirmed via client
|
||||
[JsonPropertyName("RepairSpeed")]
|
||||
public double? RepairSpeed { get; set; }
|
||||
public int? RepairSpeed { get; set; }
|
||||
|
||||
[JsonPropertyName("ExtraSizeLeft")]
|
||||
public int? ExtraSizeLeft { get; set; }
|
||||
@@ -201,8 +209,9 @@ public record Props
|
||||
[JsonPropertyName("UnlootableFromSide")]
|
||||
public List<string>? UnlootableFromSide { get; set; }
|
||||
|
||||
// Type confirmed via client
|
||||
[JsonPropertyName("AnimationVariantsNumber")]
|
||||
public double? AnimationVariantsNumber { get; set; }
|
||||
public int? AnimationVariantsNumber { get; set; }
|
||||
|
||||
[JsonPropertyName("DiscardingBlock")]
|
||||
public bool? DiscardingBlock { get; set; }
|
||||
@@ -222,8 +231,9 @@ public record Props
|
||||
[JsonPropertyName("DiscardLimit")]
|
||||
public double? DiscardLimit { get; set; }
|
||||
|
||||
// Type confirmed via client
|
||||
[JsonPropertyName("MaxResource")]
|
||||
public double? MaxResource { get; set; }
|
||||
public int? MaxResource { get; set; }
|
||||
|
||||
[JsonPropertyName("Resource")]
|
||||
public double? Resource { get; set; }
|
||||
@@ -457,7 +467,7 @@ public record Props
|
||||
public double? CheckOverride { get; set; }
|
||||
|
||||
[JsonPropertyName("ReloadMagType")]
|
||||
public string? ReloadMagType { get; set; }
|
||||
public ReloadMode? ReloadMagType { get; set; }
|
||||
|
||||
[JsonPropertyName("VisibleAmmoRangesString")]
|
||||
public string? VisibleAmmoRangesString { get; set; }
|
||||
@@ -546,9 +556,10 @@ public record Props
|
||||
[JsonPropertyName("armorZone")]
|
||||
public List<string>? ArmorZone { get; set; }
|
||||
|
||||
// Type confirmed via client
|
||||
[JsonPropertyName("armorClass")]
|
||||
[JsonConverter(typeof(StringToNumberFactoryConverter))]
|
||||
public double? ArmorClass { get; set; } // TODO: object here
|
||||
public int? ArmorClass { get; set; }
|
||||
|
||||
[JsonPropertyName("armorColliders")]
|
||||
public List<string>? ArmorColliders { get; set; }
|
||||
@@ -683,7 +694,7 @@ public record Props
|
||||
public double? CameraToWeaponAngleStep { get; set; }
|
||||
|
||||
[JsonPropertyName("ReloadMode")]
|
||||
public string? ReloadMode { get; set; }
|
||||
public ReloadMode? ReloadMode { get; set; }
|
||||
|
||||
[JsonPropertyName("AimPlane")]
|
||||
public double? AimPlane { get; set; }
|
||||
@@ -986,8 +997,9 @@ public record Props
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
|
||||
public Dictionary<string, EffectDamageProps>? EffectsDamage { get; set; }
|
||||
|
||||
// Confirmed in client
|
||||
[JsonPropertyName("MaximumNumberOfUsage")]
|
||||
public double? MaximumNumberOfUsage { get; set; }
|
||||
public int? MaximumNumberOfUsage { get; set; }
|
||||
|
||||
[JsonPropertyName("knifeHitDelay")]
|
||||
public double? KnifeHitDelay { get; set; }
|
||||
@@ -1067,8 +1079,9 @@ public record Props
|
||||
[JsonPropertyName("medEffectType")]
|
||||
public string? MedEffectType { get; set; }
|
||||
|
||||
// Confirmed in client
|
||||
[JsonPropertyName("MaxHpResource")]
|
||||
public double? MaxHpResource { get; set; }
|
||||
public int? MaxHpResource { get; set; }
|
||||
|
||||
[JsonPropertyName("hpResourceRate")]
|
||||
public double? HpResourceRate { get; set; }
|
||||
@@ -1082,8 +1095,9 @@ public record Props
|
||||
[JsonPropertyName("MaxOpticZoom")]
|
||||
public double? MaxOpticZoom { get; set; }
|
||||
|
||||
// Confirmed in client
|
||||
[JsonPropertyName("MaxRepairResource")]
|
||||
public double? MaxRepairResource { get; set; }
|
||||
public int? MaxRepairResource { get; set; }
|
||||
|
||||
[JsonPropertyName("TargetItemFilter")]
|
||||
public List<string>? TargetItemFilter { get; set; }
|
||||
@@ -1127,8 +1141,9 @@ public record Props
|
||||
[JsonPropertyName("buckshotBullets")]
|
||||
public double? BuckshotBullets { get; set; }
|
||||
|
||||
// Confirmed in client
|
||||
[JsonPropertyName("PenetrationPower")]
|
||||
public double? PenetrationPower { get; set; }
|
||||
public int? PenetrationPower { get; set; }
|
||||
|
||||
[JsonPropertyName("PenetrationPowerDeviation")]
|
||||
public double? PenetrationPowerDeviation { get; set; }
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@ using Core.Models.Utils;
|
||||
|
||||
namespace Core.Models.Eft.Profile;
|
||||
|
||||
public record SearchFriendRequestData : IRequestData
|
||||
public record SearchProfilesRequestData : IRequestData
|
||||
{
|
||||
[JsonPropertyName("nickname")]
|
||||
public string? Nickname { get; set; }
|
||||
@@ -48,6 +48,9 @@ public class HttpRouter
|
||||
wrapper.Output = wrapper.Output.Replace(sessionID, sessionID);
|
||||
}
|
||||
|
||||
//var filepath = $"c:\\SharpServer\\{req.Path.ToString().Substring(1).Replace("/", ".")}.json";
|
||||
//File.WriteAllText(filepath, wrapper.Output);
|
||||
|
||||
return wrapper.Output;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using SptCommon.Annotations;
|
||||
using SptCommon.Annotations;
|
||||
using Core.DI;
|
||||
using Core.Helpers;
|
||||
using Core.Models.Eft.Common.Tables;
|
||||
@@ -11,7 +11,7 @@ public class HealthSaveLoadRouter() : SaveLoadRouter
|
||||
{
|
||||
protected override List<HandledRoute> GetHandledRoutes()
|
||||
{
|
||||
return new List<HandledRoute>() { new HandledRoute("spt-health", false) };
|
||||
return [new("spt-health", false)];
|
||||
}
|
||||
|
||||
public override SptProfile HandleLoad(SptProfile profile)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using SptCommon.Annotations;
|
||||
using SptCommon.Annotations;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Profile;
|
||||
|
||||
@@ -9,7 +9,7 @@ public class InraidSaveLoadRouter : SaveLoadRouter
|
||||
{
|
||||
protected override List<HandledRoute> GetHandledRoutes()
|
||||
{
|
||||
return new List<HandledRoute>() { new HandledRoute("spt-inraid", false) };
|
||||
return [new("spt-inraid", false)];
|
||||
}
|
||||
|
||||
public override SptProfile HandleLoad(SptProfile profile)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using SptCommon.Annotations;
|
||||
using SptCommon.Annotations;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Profile;
|
||||
|
||||
@@ -9,7 +9,7 @@ public class InsuranceSaveLoadRouter : SaveLoadRouter
|
||||
{
|
||||
protected override List<HandledRoute> GetHandledRoutes()
|
||||
{
|
||||
return new List<HandledRoute>() { new HandledRoute("spt-insurance", false) };
|
||||
return [new ("spt-insurance", false)];
|
||||
}
|
||||
|
||||
public override SptProfile HandleLoad(SptProfile profile)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using SptCommon.Annotations;
|
||||
using SptCommon.Annotations;
|
||||
using Core.DI;
|
||||
using Core.Models.Eft.Profile;
|
||||
|
||||
@@ -9,7 +9,7 @@ public class ProfileSaveLoadRouter : SaveLoadRouter
|
||||
{
|
||||
protected override List<HandledRoute> GetHandledRoutes()
|
||||
{
|
||||
return new List<HandledRoute>() { new HandledRoute("spt-profile", false) };
|
||||
return [new ("spt-profile", false)];
|
||||
}
|
||||
|
||||
public override SptProfile HandleLoad(SptProfile profile)
|
||||
|
||||
@@ -103,8 +103,8 @@ public class ProfileStaticRouter : StaticRouter
|
||||
info,
|
||||
sessionID,
|
||||
output
|
||||
) => profileCallbacks.SearchFriend(url, info as SearchFriendRequestData, sessionID),
|
||||
typeof(SearchFriendRequestData)),
|
||||
) => profileCallbacks.SearchProfiles(url, info as SearchProfilesRequestData, sessionID),
|
||||
typeof(SearchProfilesRequestData)),
|
||||
new RouteAction(
|
||||
"/launcher/profile/info",
|
||||
(url, info, sessionID, output) =>
|
||||
|
||||
@@ -29,30 +29,15 @@ public class HashUtilTests
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void IsValidMongoIdTest()
|
||||
[DataRow("677ddb67406e9918a0264bbz", false, "677ddb67406e9918a0264bbz contains invalid char `z`, but result was true")]
|
||||
[DataRow("677ddb67406e9918a0264bbcc", false, "677ddb67406e9918a0264bbcc is 25 characters, but result was true")]
|
||||
[DataRow("677ddb67406e9918a0264bbc", true, "IsValidMongoId() `677ddb67406e9918a0264bbc` is a valid mongoId, but result was false")]
|
||||
public void IsValidMongoIdTest(string mongoId, bool passes, string failMessage)
|
||||
{
|
||||
// Invalid mongoId character
|
||||
var ResultBadChar = _hashUtil.IsValidMongoId("677ddb67406e9918a0264bbz");
|
||||
|
||||
Assert.AreEqual(
|
||||
false,
|
||||
ResultBadChar,
|
||||
"IsValidMongoId() `677ddb67406e9918a0264bbz` contains invalid char `z`, but result was true");
|
||||
|
||||
// Invalid mongoId length
|
||||
var resultBadLength = _hashUtil.IsValidMongoId("677ddb67406e9918a0264bbcc");
|
||||
|
||||
Assert.AreEqual(
|
||||
false,
|
||||
resultBadLength,
|
||||
"IsValidMongoId() `677ddb67406e9918a0264bbcc` is 25 characters, but result was true");
|
||||
|
||||
// Valid mongoId
|
||||
var resultPass = _hashUtil.IsValidMongoId("677ddb67406e9918a0264bbc");
|
||||
|
||||
Assert.AreEqual(
|
||||
true,
|
||||
resultPass,
|
||||
"IsValidMongoId() `677ddb67406e9918a0264bbc` is a valid mongoId, but result was false");
|
||||
var result = _hashUtil.IsValidMongoId(mongoId);
|
||||
Assert.AreEqual(
|
||||
passes,
|
||||
result,
|
||||
failMessage);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user