Updated debug logs + added dict saftey
This commit is contained in:
@@ -105,7 +105,7 @@ public class RepeatableQuestController(
|
||||
{
|
||||
// Unable to find quest being replaced
|
||||
var message =
|
||||
$"Unable to generate repeatable quest of type: {repeatableTypeLower} to replace trader: ${replacedQuestTraderId} quest ${changeRequest.QuestId}";
|
||||
$"Unable to generate repeatable quest of type: {repeatableTypeLower} to replace trader: ${replacedQuestTraderId} quest: {changeRequest.QuestId}";
|
||||
_logger.Error(message);
|
||||
|
||||
return _httpResponseUtil.AppendErrorToOutput(output, message);
|
||||
|
||||
@@ -1105,7 +1105,7 @@ public class BotEquipmentModGenerator(
|
||||
|
||||
if (!desiredMagazineTpls.Any())
|
||||
{
|
||||
_logger.Warning("Magazine size filter for ${ weaponTpl} was too strict, ignoring filter");
|
||||
_logger.Warning($"Magazine size filter for { weaponTpl} was too strict, ignoring filter");
|
||||
|
||||
return modPool;
|
||||
}
|
||||
|
||||
@@ -376,7 +376,7 @@ public class LocationLootGenerator(
|
||||
if(_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug(
|
||||
$"Container {container.Template.Id} with group ${groupData.GroupId} had 100 % chance to spawn was picked as random container, skipping"
|
||||
$"Container {container.Template.Id} with group: {groupData.GroupId} had 100 % chance to spawn was picked as random container, skipping"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ public class LocationLootGenerator(
|
||||
var itemTemplate = _itemHelper.GetItem(rootItem.Template).Value;
|
||||
if (itemTemplate.Properties is null)
|
||||
{
|
||||
_logger.Error($"Unable to process item: ${{chosenTpl}}. it lacks _props");
|
||||
_logger.Error($"Unable to process item: {rootItem.Template}. it lacks _props");
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -1044,7 +1044,7 @@ public class LocationLootGenerator(
|
||||
var itemTemplate = _itemHelper.GetItem(chosenTpl).Value;
|
||||
if (itemTemplate.Properties is null)
|
||||
{
|
||||
_logger.Error($"Unable to process item: ${{chosenTpl}}. it lacks _props");
|
||||
_logger.Error($"Unable to process item: {chosenTpl}. it lacks _props");
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -363,7 +363,7 @@ public class LootGenerator(
|
||||
if (chosenPreset.Encyclopedia is null) {
|
||||
if(_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug("$Preset with id: {chosenPreset?.Id} lacks encyclopedia property, skipping");
|
||||
_logger.Debug($"Preset with id: {chosenPreset?.Id} lacks encyclopedia property, skipping");
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -820,7 +820,7 @@ public class RepeatableQuestGenerator(
|
||||
|
||||
if (possibleExits.Count == 0)
|
||||
{
|
||||
_logger.Error("Unable to choose specific exit on map: ${ locationKey}, Possible exit pool was empty");
|
||||
_logger.Error($"Unable to choose specific exit on map: {locationKey}, Possible exit pool was empty");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -159,7 +159,7 @@ public class GiveSptCommand(
|
||||
_mailSendService.SendUserMessageToPlayer(
|
||||
sessionId,
|
||||
commandHandler,
|
||||
$"Could not find exact match. Closest matches are:\n\n${itemList}\n\nUse 'spt give [number]' to select one.");
|
||||
$"Could not find exact match. Closest matches are:\n\n{itemList}\n\nUse 'spt give [number]' to select one.");
|
||||
|
||||
return request.DialogId;
|
||||
}
|
||||
|
||||
+2
-2
@@ -96,7 +96,7 @@ public class ProfileSptCommand(
|
||||
return request.DialogId;
|
||||
}
|
||||
|
||||
if (quantity < 0 || quantity > 51) {
|
||||
if (quantity is < 0 or > 51) {
|
||||
_mailSendService.SendUserMessageToPlayer(
|
||||
sessionId,
|
||||
commandHandler,
|
||||
@@ -116,7 +116,7 @@ public class ProfileSptCommand(
|
||||
_mailSendService.SendUserMessageToPlayer(
|
||||
sessionId,
|
||||
commandHandler,
|
||||
$"If you are reading this, this is bad. Please report this to SPT staff with a screenshot. Command ${command}."
|
||||
$"If you are reading this, this is bad. Please report this to SPT staff with a screenshot. Command: {command}."
|
||||
);
|
||||
return request.DialogId;
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ public class InventoryHelper(
|
||||
var stashFS2D = _cloner.Clone(GetStashSlotMap(pmcData, sessionId));
|
||||
if (stashFS2D is null)
|
||||
{
|
||||
_logger.Error($"Unable to get stash map for players: ${sessionId} stash");
|
||||
_logger.Error($"Unable to get stash map for players: {sessionId} stash");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -542,7 +542,7 @@ public class RagfairOfferHelper(
|
||||
// No trader assort data
|
||||
_logger.Warning(
|
||||
$"Unable to find trader: " +
|
||||
$"${offer.User.Nickname}assort for item: ${_itemHelper.GetItemName(offer.Items[0].Template)} " +
|
||||
$"${offer.User.Nickname}assort for item: {_itemHelper.GetItemName(offer.Items[0].Template)} " +
|
||||
$"{offer.Items[0].Template}, cannot check if buy restriction reached"
|
||||
);
|
||||
|
||||
@@ -969,33 +969,6 @@ public class RagfairOfferHelper(
|
||||
return offer.Items.Count > 1;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Should a ragfair offer be visible to the player
|
||||
/// </summary>
|
||||
/// <param name="searchRequest">Search request</param>
|
||||
/// <param name="itemsToAdd">?</param>
|
||||
/// <param name="traderAssorts">Trader assort items - used for filtering out locked trader items</param>
|
||||
/// <param name="offer">The flea offer</param>
|
||||
/// <param name="pmcProfile">Player profile</param>
|
||||
/// <param name="playerIsFleaBanned">Optional parameter</param>
|
||||
/// <returns>True = should be shown to player</returns>
|
||||
public bool DisplayableOffer(
|
||||
SearchRequestData searchRequest,
|
||||
List<string> itemsToAdd,
|
||||
Dictionary<string, TraderAssort> traderAssorts,
|
||||
RagfairOffer offer,
|
||||
PmcData pmcProfile,
|
||||
bool? playerIsFleaBanned = null
|
||||
)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool IsDisplayableOfferThatNeedsItem(SearchRequestData searchRequest, RagfairOffer offer)
|
||||
{
|
||||
return offer.Requirements.Any(requirement => requirement.Template == searchRequest.NeededSearchId);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does the passed in item have a condition property
|
||||
/// </summary>
|
||||
|
||||
@@ -66,7 +66,7 @@ public class CustomLocationWaveService(
|
||||
var locationBase = _databaseService.GetLocation(mapKvP.Key).Base;
|
||||
if (locationBase is null)
|
||||
{
|
||||
_logger.Warning($"Unable to add custom boss wave to location: ${mapKvP}, location not found");
|
||||
_logger.Warning($"Unable to add custom boss wave to location: {mapKvP}, location not found");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1257,13 +1257,18 @@ public class FenceService(
|
||||
traderConfig.Fence.ArmorMaxDurabilityPercentMinMax
|
||||
);
|
||||
|
||||
// Find items mod to apply dura changes to
|
||||
var modItemToAdjust = armorWithMods.FirstOrDefault(mod => mod.SlotId.ToLower() == plateSlot.Name.ToLower());
|
||||
// Find items mod to apply durability changes to
|
||||
var modItemToAdjust = armorWithMods.FirstOrDefault(mod => string.Equals(
|
||||
mod.SlotId,
|
||||
plateSlot.Name,
|
||||
StringComparison.OrdinalIgnoreCase
|
||||
)
|
||||
);
|
||||
|
||||
if (modItemToAdjust == null)
|
||||
{
|
||||
logger.Warning(
|
||||
$"Unable to randomise armor items {armorWithMods[0].Template} ${plateSlot.Name} slot as it cannot be found, skipping"
|
||||
$"Unable to randomise armor items {armorWithMods[0].Template} {plateSlot.Name} slot as it cannot be found, skipping"
|
||||
);
|
||||
continue;
|
||||
}
|
||||
@@ -1272,7 +1277,7 @@ public class FenceService(
|
||||
|
||||
if (modItemToAdjust?.Upd?.Repairable == null)
|
||||
{
|
||||
modItemToAdjust.Upd.Repairable = new UpdRepairable()
|
||||
modItemToAdjust.Upd.Repairable = new UpdRepairable
|
||||
{
|
||||
Durability = modItemDbDetails.Properties.MaxDurability,
|
||||
MaxDurability = modItemDbDetails.Properties.MaxDurability
|
||||
|
||||
@@ -225,7 +225,7 @@ public class LocationLifecycleService
|
||||
|
||||
// No matching bot in config, skip
|
||||
if (locationBotHostilityDetails is null) {
|
||||
_logger.Warning("No bot: ${botId} hostility values found on: ${location.Id}, can only edit existing. Skipping");
|
||||
_logger.Warning($"No bot: {botId} hostility values found on: {location.Id}, can only edit existing. Skipping");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ using Core.Models.Enums;
|
||||
using Core.Servers;
|
||||
using Core.Utils;
|
||||
using Core.Models.Eft.Common;
|
||||
using LogLevel = Core.Models.Spt.Logging.LogLevel;
|
||||
|
||||
namespace Core.Services;
|
||||
|
||||
@@ -480,13 +481,14 @@ public class RagfairPriceService(
|
||||
return new WeaponPreset { IsDefault = true, Preset = defaultPreset };
|
||||
}
|
||||
var nonDefaultPresets = _presetHelper.GetPresets(weapon.Template);
|
||||
if (nonDefaultPresets.Count == 1)
|
||||
|
||||
if (_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"Item Id: ${ weapon.Template} has no default encyclopedia entry but only one preset(${ nonDefaultPresets[0].Name}), choosing preset(${ nonDefaultPresets[0].Name})");
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.Debug($"Item Id: ${ weapon.Template} has no default encyclopedia entry, choosing first preset(${ nonDefaultPresets[0].Name}) of ${ nonDefaultPresets.Count}");
|
||||
_logger.Debug(
|
||||
nonDefaultPresets.Count == 1
|
||||
? $"Item Id: ${weapon.Template} has no default encyclopedia entry but only one preset: ({nonDefaultPresets[0].Name}), choosing preset: ({nonDefaultPresets[0].Name})"
|
||||
: $"Item Id: ${weapon.Template} has no default encyclopedia entry, choosing first preset(${nonDefaultPresets[0].Name}) of ${nonDefaultPresets.Count}"
|
||||
);
|
||||
}
|
||||
|
||||
return new WeaponPreset { IsDefault = false, Preset = nonDefaultPresets[0] };
|
||||
|
||||
@@ -14,6 +14,7 @@ using Core.Utils;
|
||||
using SptCommon.Annotations;
|
||||
using SptCommon.Extensions;
|
||||
using BonusSettings = Core.Models.Spt.Config.BonusSettings;
|
||||
using LogLevel = Core.Models.Spt.Logging.LogLevel;
|
||||
|
||||
namespace Core.Services;
|
||||
|
||||
@@ -97,9 +98,12 @@ public class RepairService(
|
||||
itemRepairCost.Value * repairItemDetails.Count.Value * repairRate.Value * _repairConfig.PriceMultiplier
|
||||
);
|
||||
|
||||
_logger.Debug($"item base repair cost: ${itemRepairCost}");
|
||||
_logger.Debug($"price multiplier: ${_repairConfig.PriceMultiplier}");
|
||||
_logger.Debug($"repair cost: ${repairCost}");
|
||||
if (_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"item base repair cost: {itemRepairCost}");
|
||||
_logger.Debug($"price multiplier: {_repairConfig.PriceMultiplier}");
|
||||
_logger.Debug($"repair cost: {repairCost}");
|
||||
}
|
||||
|
||||
return new RepairDetails
|
||||
{
|
||||
@@ -455,7 +459,11 @@ public class RepairService(
|
||||
var maxRepairAmount = repairKitDetails.Properties.MaxRepairResource;
|
||||
if (repairKitInInventory.Upd is null)
|
||||
{
|
||||
_logger.Debug($"Repair kit: ${repairKitInInventory.Id} in inventory lacks upd object, adding");
|
||||
if(_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"Repair kit: {repairKitInInventory.Id} in inventory lacks upd object, adding");
|
||||
}
|
||||
|
||||
repairKitInInventory.Upd = new Upd { RepairKit = new UpdRepairKit { Resource = maxRepairAmount } };
|
||||
}
|
||||
|
||||
|
||||
@@ -785,33 +785,33 @@ public class SeasonalEventService(
|
||||
/// <param name="mapIdWhitelist">OPTIONAL - Maps to add bosses to</param>
|
||||
protected void AddEventBossesToMaps(string eventType, List<string> mapIdWhitelist = null)
|
||||
{
|
||||
var botsToAddPerMap = _seasonalEventConfig.EventBossSpawns[eventType.ToLower()];
|
||||
if (botsToAddPerMap is null)
|
||||
if (!_seasonalEventConfig.EventBossSpawns.TryGetValue(eventType.ToLower(), out var botsToAddPerMap))
|
||||
{
|
||||
_logger.Warning($"Unable to add: ${eventType} bosses, eventBossSpawns is missing");
|
||||
_logger.Warning($"Unable to add: {eventType} bosses, eventBossSpawns is missing");
|
||||
return;
|
||||
}
|
||||
|
||||
var mapKeys = botsToAddPerMap;
|
||||
var locations = _databaseService.GetLocations().GetAllPropsAsDict();
|
||||
foreach (var map in mapKeys) {
|
||||
var bossesToAdd = botsToAddPerMap[map.Key];
|
||||
if (bossesToAdd is null)
|
||||
foreach (var (key, _) in mapKeys) {
|
||||
if (!botsToAddPerMap.TryGetValue(key, out var bossesToAdd))
|
||||
{
|
||||
_logger.Warning($"Unable to add: ${ eventType} bosses to: ${map.Key}");
|
||||
_logger.Warning($"Unable to add: {eventType} bosses to: {key}");
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (mapIdWhitelist is null || !mapIdWhitelist.Contains(map.Key))
|
||||
if (mapIdWhitelist is null || !mapIdWhitelist.Contains(key))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach (var boss in bossesToAdd) {
|
||||
var mapBosses = ((Location)locations[map.Key]).Base.BossLocationSpawn;
|
||||
if (!mapBosses.Any((bossSpawn) => bossSpawn.BossName == boss.BossName))
|
||||
var mapBosses = ((Location)locations[key]).Base.BossLocationSpawn;
|
||||
// If no bosses match by name
|
||||
if (mapBosses.All(bossSpawn => bossSpawn.BossName != boss.BossName))
|
||||
{
|
||||
((Location)locations[map.Key]).Base.BossLocationSpawn.AddRange(bossesToAdd);
|
||||
((Location)locations[key]).Base.BossLocationSpawn.AddRange(bossesToAdd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user