Removed unnecessary TODOs and fixed typos
Removed unnecessary uses of `GetByJsonProp`
This commit is contained in:
@@ -279,7 +279,7 @@ public class BotController(
|
||||
pmcProfile,
|
||||
false,
|
||||
raidSettings,
|
||||
_botConfig.PresetBatch?.GetByJsonProp<int>(requestedBot?.Role ?? string.Empty),
|
||||
_botConfig.PresetBatch.GetValueOrDefault(requestedBot?.Role, 5),
|
||||
_botHelper.IsBotPmc(requestedBot?.Role)
|
||||
);
|
||||
|
||||
@@ -310,7 +310,7 @@ public class BotController(
|
||||
botGenerationDetails.Role = _botHelper.GetRandomizedPmcRole();
|
||||
botGenerationDetails.Side = _botHelper.GetPmcSideByRole(botGenerationDetails.Role);
|
||||
botGenerationDetails.BotDifficulty = GetPmcDifficulty(requestedBot?.Difficulty);
|
||||
botGenerationDetails.BotCountToGenerate = _botConfig.PresetBatch?.GetByJsonProp<int>(botGenerationDetails.Role);
|
||||
botGenerationDetails.BotCountToGenerate = _botConfig.PresetBatch?.GetValueOrDefault(botGenerationDetails.Role, 5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ public class BotController(
|
||||
var bossesToConvertToWeights = _botConfig.AssaultToBossConversion.BossesToConvertToWeights;
|
||||
if (bossConvertEnabled && botGenerationDetails.IsPmc is not null && !botGenerationDetails.IsPmc.Value)
|
||||
{
|
||||
var bossConvertPercent = bossConvertMinMax.GetByJsonProp<MinMax>(requestedBot?.Role?.ToLower() ?? string.Empty);
|
||||
var bossConvertPercent = bossConvertMinMax.GetValueOrDefault(requestedBot?.Role?.ToLower());
|
||||
if (bossConvertPercent is not null)
|
||||
// Roll a percentage check if we should convert scav to boss
|
||||
{
|
||||
@@ -374,7 +374,7 @@ public class BotController(
|
||||
|
||||
// Bosses are only ever 'normal'
|
||||
botGenerationDetails.BotDifficulty = "normal";
|
||||
botGenerationDetails.BotCountToGenerate = _botConfig.PresetBatch?.GetByJsonProp<int>(botGenerationDetails.Role);
|
||||
botGenerationDetails.BotCountToGenerate = _botConfig.PresetBatch?.GetValueOrDefault(botGenerationDetails.Role);
|
||||
}
|
||||
|
||||
private string? GetPmcDifficulty(string? requestedBotDifficulty)
|
||||
@@ -391,8 +391,8 @@ public class BotController(
|
||||
private MinMax? GetPmcConversionMinMaxForLocation(string? requestedBotRole, string? location)
|
||||
{
|
||||
return _pmcConfig.ConvertIntoPmcChance!.TryGetValue(location?.ToLower() ?? "", out var mapSpecificConversionValues)
|
||||
? mapSpecificConversionValues.GetByJsonProp<MinMax>(requestedBotRole?.ToLower())
|
||||
: _pmcConfig.ConvertIntoPmcChance.GetValueOrDefault("default")?.GetValueOrDefault(requestedBotRole);
|
||||
? mapSpecificConversionValues.GetValueOrDefault(requestedBotRole?.ToLower())
|
||||
: _pmcConfig.ConvertIntoPmcChance["default"]?.GetValueOrDefault(requestedBotRole);
|
||||
}
|
||||
|
||||
private GetRaidConfigurationRequestData? GetMostRecentRaidSettings()
|
||||
|
||||
@@ -107,7 +107,7 @@ public class CustomizationController(
|
||||
|
||||
var profile = _saveServer.GetProfile(sessionId);
|
||||
|
||||
//TODO: Merge with function _profileHelper.addHideoutCustomisationUnlock
|
||||
// TODO: Merge with function _profileHelper.addHideoutCustomisationUnlock
|
||||
var rewardToStore = new CustomisationStorage
|
||||
{
|
||||
Id = suitId,
|
||||
|
||||
@@ -36,7 +36,7 @@ public class MatchController(
|
||||
/// Handle client/match/group/delete
|
||||
/// </summary>
|
||||
/// <param name="info"></param>
|
||||
public void DeleteGroup(DeleteGroupRequest info) // TODO: info is `any` in the node server
|
||||
public void DeleteGroup(DeleteGroupRequest info)
|
||||
{
|
||||
_matchLocationService.DeleteGroup(info);
|
||||
}
|
||||
|
||||
@@ -148,7 +148,6 @@ public class PrestigeController(
|
||||
{
|
||||
newProfile.CharacterData.PmcData.Achievements.Add("676091c0f457869a94017a23", _timeUtil.GetTimeStamp());
|
||||
}
|
||||
// TODO: is there one for second prestige
|
||||
|
||||
// Add existing Stats to profile
|
||||
newProfile.CharacterData.PmcData.Stats = prePrestigePmc.Stats;
|
||||
|
||||
@@ -253,7 +253,7 @@ public class BotGenerator(
|
||||
bot.Info.Settings.UseSimpleAnimator = botJsonTemplate.BotExperience.UseSimpleAnimator ?? false;
|
||||
bot.Info.Voice = _weightedRandomHelper.GetWeightedValue(botJsonTemplate.BotAppearance.Voice);
|
||||
bot.Health = GenerateHealth(botJsonTemplate.BotHealth, botGenerationDetails.IsPlayerScav.GetValueOrDefault(false));
|
||||
bot.Skills = GenerateSkills(botJsonTemplate.BotSkills); // TODO: fix bad type, bot jsons store skills in dict, output needs to be array
|
||||
bot.Skills = GenerateSkills(botJsonTemplate.BotSkills);
|
||||
bot.Info.PrestigeLevel = 0;
|
||||
|
||||
if (botGenerationDetails.IsPmc.GetValueOrDefault(false))
|
||||
|
||||
@@ -698,7 +698,7 @@ public class LocationLootGenerator(
|
||||
|
||||
// Draw from random distribution
|
||||
var desiredSpawnpointCount = Math.Round(
|
||||
GetLooseLootMultiplerForLocation(locationName) *
|
||||
GetLooseLootMultiplierForLocation(locationName) *
|
||||
_randomUtil.GetNormallyDistributedRandomNumber(
|
||||
(double) dynamicLootDist.SpawnpointCount.Mean,
|
||||
(double) dynamicLootDist.SpawnpointCount.Std
|
||||
@@ -1087,16 +1087,6 @@ public class LocationLootGenerator(
|
||||
};
|
||||
}
|
||||
|
||||
private double GetLooseLootMultiplerForLocation(string location)
|
||||
{
|
||||
return _locationConfig.LooseLootMultiplier[location];
|
||||
}
|
||||
|
||||
protected double getStaticLootMultiplerForLocation(string location)
|
||||
{
|
||||
return _locationConfig.StaticLootMultiplier[location];
|
||||
}
|
||||
|
||||
|
||||
// TODO: rewrite, BIG yikes
|
||||
protected ContainerItem? CreateStaticLootItem(
|
||||
|
||||
@@ -419,7 +419,7 @@ public class RagfairOfferGenerator(
|
||||
? 1
|
||||
: randomUtil.GetDouble(config.OfferItemCount.Min.Value, config.OfferItemCount.Max.Value);
|
||||
|
||||
/* //TODO: ???????
|
||||
/* // TODO: ???????
|
||||
if (ProgramStatics.DEBUG && !ProgramStatics.COMPILED) {
|
||||
offerCount = 2;
|
||||
}
|
||||
|
||||
@@ -89,7 +89,7 @@ namespace Core.Loaders
|
||||
|
||||
public void AddBundles(string modPath)
|
||||
{
|
||||
//TODO: Implement
|
||||
// TODO: Implement
|
||||
|
||||
var modBundlesJson = _fileUtil.ReadFile(Path.Combine(modPath, "bundles.json"));
|
||||
var modBundles = _jsonUtil.Deserialize<IBundleManifest>(modBundlesJson);
|
||||
|
||||
@@ -344,11 +344,11 @@ public class BotEquipmentFilterService
|
||||
/// <param name="weightingAdjustments">Weighting change to apply to bot</param>
|
||||
/// <param name="botItemPool">Bot item dictionary to adjust</param>
|
||||
protected void AdjustWeighting(
|
||||
AdjustmentDetails weightingAdjustments,
|
||||
AdjustmentDetails? weightingAdjustments,
|
||||
Dictionary<EquipmentSlots, Dictionary<string, double>> botItemPool,
|
||||
bool showEditWarnings = true)
|
||||
{
|
||||
//TODO, bad typing by key with method below due to, EquipmentSlots
|
||||
// TODO: bad typing by key with method below due to, EquipmentSlots
|
||||
if (weightingAdjustments is null)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -14,9 +14,8 @@ public class I18nService
|
||||
|
||||
private readonly Dictionary<string, LazyLoad<Dictionary<string, string>>> _loadedLocales = new();
|
||||
private List<string> _locales;
|
||||
private string _setLocale;
|
||||
private string? _setLocale;
|
||||
|
||||
// TODO: try convert to primary ctor
|
||||
public I18nService(
|
||||
FileUtil fileUtil,
|
||||
JsonUtil jsonUtil,
|
||||
|
||||
@@ -151,7 +151,7 @@ public class LocationLifecycleService
|
||||
|
||||
// Only has value when transitioning into map from previous one
|
||||
if (request.Transition is not null)
|
||||
// TODO - why doesnt the raid after transit have any transit data?
|
||||
// TODO - why doesn't the raid after transit have any transit data?
|
||||
{
|
||||
result.Transition = request.Transition;
|
||||
}
|
||||
|
||||
@@ -12,12 +12,12 @@ namespace Core.Services.Mod;
|
||||
|
||||
[Injectable]
|
||||
public class CustomItemService(
|
||||
ISptLogger<CustomItemService> _logger,
|
||||
HashUtil _hashUtil,
|
||||
DatabaseService _databaseService,
|
||||
ItemHelper _itemHelper,
|
||||
ItemBaseClassService _itemBaseClassService,
|
||||
ICloner _cloner
|
||||
ISptLogger<CustomItemService> logger,
|
||||
HashUtil hashUtil,
|
||||
DatabaseService databaseService,
|
||||
ItemHelper itemHelper,
|
||||
ItemBaseClassService itemBaseClassService,
|
||||
ICloner cloner
|
||||
)
|
||||
{
|
||||
/**
|
||||
@@ -33,7 +33,7 @@ public class CustomItemService(
|
||||
public CreateItemResult CreateItemFromClone(NewItemFromCloneDetails newItemDetails)
|
||||
{
|
||||
var result = new CreateItemResult();
|
||||
var tables = _databaseService.GetTables();
|
||||
var tables = databaseService.GetTables();
|
||||
|
||||
// Generate new id for item if none supplied
|
||||
var newItemId = GetOrGenerateIdForItem(newItemDetails.NewId);
|
||||
@@ -49,7 +49,7 @@ public class CustomItemService(
|
||||
}
|
||||
|
||||
// Clone existing item
|
||||
var itemClone = _cloner.Clone(tables.Templates.Items[newItemDetails.ItemTplToClone]);
|
||||
var itemClone = cloner.Clone(tables.Templates.Items[newItemDetails.ItemTplToClone]);
|
||||
|
||||
// Update id and parentId of item
|
||||
itemClone.Id = newItemId;
|
||||
@@ -65,9 +65,9 @@ public class CustomItemService(
|
||||
|
||||
AddToFleaPriceDb(newItemId, newItemDetails.FleaPriceRoubles);
|
||||
|
||||
_itemBaseClassService.HydrateItemBaseClassCache();
|
||||
itemBaseClassService.HydrateItemBaseClassCache();
|
||||
|
||||
if (_itemHelper.IsOfBaseclass(itemClone.Id, BaseClasses.WEAPON))
|
||||
if (itemHelper.IsOfBaseclass(itemClone.Id, BaseClasses.WEAPON))
|
||||
{
|
||||
AddToWeaponShelf(newItemId);
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class CustomItemService(
|
||||
public CreateItemResult CreateItem(NewItemDetails newItemDetails)
|
||||
{
|
||||
var result = new CreateItemResult();
|
||||
var tables = _databaseService.GetTables();
|
||||
var tables = databaseService.GetTables();
|
||||
|
||||
var newItem = newItemDetails.NewItem;
|
||||
|
||||
@@ -109,9 +109,9 @@ public class CustomItemService(
|
||||
|
||||
AddToFleaPriceDb(newItem.Id, newItemDetails.FleaPriceRoubles);
|
||||
|
||||
_itemBaseClassService.HydrateItemBaseClassCache();
|
||||
itemBaseClassService.HydrateItemBaseClassCache();
|
||||
|
||||
if (_itemHelper.IsOfBaseclass(newItem.Id, BaseClasses.WEAPON))
|
||||
if (itemHelper.IsOfBaseclass(newItem.Id, BaseClasses.WEAPON))
|
||||
{
|
||||
AddToWeaponShelf(newItem.Id);
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public class CustomItemService(
|
||||
*/
|
||||
protected string GetOrGenerateIdForItem(string newId)
|
||||
{
|
||||
return newId == "" ? _hashUtil.Generate() : newId;
|
||||
return newId == "" ? hashUtil.Generate() : newId;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,9 +153,9 @@ public class CustomItemService(
|
||||
*/
|
||||
protected void AddToItemsDb(string newItemId, TemplateItem itemToAdd)
|
||||
{
|
||||
if (!_databaseService.GetItems().TryAdd(newItemId, itemToAdd))
|
||||
if (!databaseService.GetItems().TryAdd(newItemId, itemToAdd))
|
||||
{
|
||||
_logger.Warning($"Unable to add: {newItemId} To Database");
|
||||
logger.Warning($"Unable to add: {newItemId} To Database");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ public class CustomItemService(
|
||||
*/
|
||||
protected void AddToHandbookDb(string newItemId, string parentId, double? priceRoubles)
|
||||
{
|
||||
_databaseService
|
||||
databaseService
|
||||
.GetTemplates()
|
||||
.Handbook.Items.Add(
|
||||
new HandbookItem
|
||||
@@ -182,7 +182,7 @@ public class CustomItemService(
|
||||
|
||||
/**
|
||||
* Iterate through the passed in locale data and add to each locale in turn
|
||||
* If data is not provided for each langauge eft uses, the first object will be used in its place
|
||||
* If data is not provided for each language EFT uses, the first object will be used in its place
|
||||
* e.g.
|
||||
* en[0]
|
||||
* fr[1]
|
||||
@@ -193,22 +193,25 @@ public class CustomItemService(
|
||||
*/
|
||||
protected void AddToLocaleDbs(Dictionary<string, LocaleDetails> localeDetails, string newItemId)
|
||||
{
|
||||
var languages = _databaseService.GetLocales().Languages;
|
||||
var languages = databaseService.GetLocales().Languages;
|
||||
foreach (var shortNameKey in languages)
|
||||
{
|
||||
// Get locale details passed in, if not provided by caller use first record in newItemDetails.locales
|
||||
localeDetails.TryGetValue(shortNameKey.Key, out var newLocaleDetails);
|
||||
|
||||
if (newLocaleDetails is null)
|
||||
{
|
||||
newLocaleDetails = localeDetails[localeDetails.Keys.FirstOrDefault()];
|
||||
}
|
||||
newLocaleDetails ??= localeDetails[localeDetails.Keys.FirstOrDefault()];
|
||||
|
||||
// Create new record in locale file
|
||||
var globals = _databaseService.GetLocales();
|
||||
globals.Global[shortNameKey.Key].Value[$"{newItemId} Name"] = newLocaleDetails.Name;
|
||||
globals.Global[shortNameKey.Key].Value[$"{newItemId} ShortName"] = newLocaleDetails.ShortName;
|
||||
globals.Global[shortNameKey.Key].Value[$"{newItemId} Description"] = newLocaleDetails.Description;
|
||||
if (!databaseService.GetLocales().Global.TryGetValue(shortNameKey.Key, out var desiredGlobal))
|
||||
{
|
||||
logger.Error($"Unable to add locale keys to {shortNameKey.Key}");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
desiredGlobal.Value[$"{newItemId} Name"] = newLocaleDetails.Name;
|
||||
desiredGlobal.Value[$"{newItemId} ShortName"] = newLocaleDetails.ShortName;
|
||||
desiredGlobal.Value[$"{newItemId} Description"] = newLocaleDetails.Description;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,7 +222,7 @@ public class CustomItemService(
|
||||
*/
|
||||
protected void AddToFleaPriceDb(string newItemId, double? fleaPriceRoubles)
|
||||
{
|
||||
_databaseService.GetTemplates().Prices[newItemId] = fleaPriceRoubles ?? 0;
|
||||
databaseService.GetTemplates().Prices[newItemId] = fleaPriceRoubles ?? 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -237,7 +240,7 @@ public class CustomItemService(
|
||||
];
|
||||
foreach (var wallId in wallStashIds)
|
||||
{
|
||||
var wall = _itemHelper.GetItem(wallId);
|
||||
var wall = itemHelper.GetItem(wallId);
|
||||
if (wall.Key)
|
||||
{
|
||||
wall.Value.Properties.Grids[0].Props.Filters[0].Filter.Add(newItemId);
|
||||
@@ -253,32 +256,32 @@ public class CustomItemService(
|
||||
*/
|
||||
public void AddCustomWeaponToPMCs(string weaponTpl, double weaponWeight, string weaponSlot)
|
||||
{
|
||||
var weapon = _itemHelper.GetItem(weaponTpl);
|
||||
var weapon = itemHelper.GetItem(weaponTpl);
|
||||
if (!weapon.Key)
|
||||
{
|
||||
_logger.Warning($"Unable to add custom weapon {weaponTpl} to PMCs as it cannot be found in the Item db");
|
||||
logger.Warning($"Unable to add custom weapon {weaponTpl} to PMCs as it cannot be found in the Item db");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Dictionary<string, HashSet<string>?> baseWeaponModObject = new Dictionary<string, HashSet<string>?>();
|
||||
var baseWeaponModObject = new Dictionary<string, HashSet<string>?>();
|
||||
|
||||
// Get all slots weapon has and create a dictionary of them with possible mods that slot into each
|
||||
var weaponSlots = weapon.Value.Properties.Slots;
|
||||
foreach (var slot in weaponSlots)
|
||||
{
|
||||
baseWeaponModObject[slot.Name] = new HashSet<string>(slot.Props.Filters[0].Filter);
|
||||
baseWeaponModObject[slot.Name] = [..slot.Props.Filters[0].Filter];
|
||||
}
|
||||
|
||||
// Get PMCs
|
||||
var botTypes = _databaseService.GetBots().Types;
|
||||
var botTypes = databaseService.GetBots().Types;
|
||||
|
||||
// Add weapon base+mods into bear/usec data
|
||||
botTypes["usec"].BotInventory.Mods[weaponTpl] = baseWeaponModObject;
|
||||
botTypes["bear"].BotInventory.Mods[weaponTpl] = baseWeaponModObject;
|
||||
|
||||
// Add weapon to array of allowed weapons + weighting to be picked
|
||||
botTypes["usec"].BotInventory.Equipment.GetByJsonProp<Dictionary<string, double>>(weaponSlot)[weaponTpl] = weaponWeight;
|
||||
botTypes["bear"].BotInventory.Equipment.GetByJsonProp<Dictionary<string, double>>(weaponSlot)[weaponTpl] = weaponWeight;
|
||||
botTypes["usec"].BotInventory.Equipment[Enum.Parse<EquipmentSlots>(weaponSlot)][weaponTpl] = weaponWeight;
|
||||
botTypes["bear"].BotInventory.Equipment[Enum.Parse<EquipmentSlots>(weaponSlot)][weaponTpl] = weaponWeight;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class SptWebApplicationLogger<T> : ISptLogger<T>
|
||||
|
||||
public void WriteToLogFile(string data)
|
||||
{
|
||||
//TODO - implement + turn object into json
|
||||
// TODO: implement + turn object into json
|
||||
_logger.LogError("NOT IMPLEMENTED - WriteToLogFile");
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ public class ModDllLoader
|
||||
|
||||
private static void SortMods(List<SptMod> mods)
|
||||
{
|
||||
//TODO: implement
|
||||
// TODO: implement
|
||||
Console.WriteLine($"NOT IMPLEMENTED: SortMods");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user