add logger check wrapping debug logs
This commit is contained in:
@@ -253,14 +253,18 @@ public class DialogueController(
|
||||
};
|
||||
|
||||
if (request.Type != MessageType.USER_MESSAGE)
|
||||
{
|
||||
return profile.DialogueRecords[request.DialogId!];
|
||||
}
|
||||
|
||||
var dialogue = profile.DialogueRecords[request.DialogId!];
|
||||
dialogue.Users = [];
|
||||
var chatBot = _dialogueChatBots.FirstOrDefault(cb => cb.GetChatBot().Id == request.DialogId);
|
||||
|
||||
if (chatBot is null)
|
||||
{
|
||||
return profile.DialogueRecords[request.DialogId!];
|
||||
}
|
||||
|
||||
dialogue.Users ??= [];
|
||||
dialogue.Users.Add(chatBot.GetChatBot());
|
||||
@@ -286,7 +290,9 @@ public class DialogueController(
|
||||
result.AddRange(userDialogs);
|
||||
|
||||
if (result.Any(userDialog => userDialog.Id == fullProfile.ProfileInfo?.ProfileId))
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
// Player doesn't exist, add them in before returning
|
||||
var pmcProfile = fullProfile.CharacterData?.PmcData;
|
||||
@@ -492,10 +498,11 @@ public class DialogueController(
|
||||
{
|
||||
_mailSendService.SendPlayerMessageToNpc(sessionId, request.DialogId!, request.Text!);
|
||||
|
||||
return (_dialogueChatBots.FirstOrDefault(cb => cb.GetChatBot().Id == request.DialogId)
|
||||
?.HandleMessage(sessionId, request) ??
|
||||
request.DialogId) ??
|
||||
string.Empty;
|
||||
return (_dialogueChatBots.FirstOrDefault(cb =>
|
||||
cb.GetChatBot().Id == request.DialogId)
|
||||
?.HandleMessage(sessionId, request)
|
||||
?? request.DialogId)
|
||||
?? string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -88,24 +88,34 @@ public class GameController(
|
||||
fullProfile.FriendProfileIds ??= [];
|
||||
|
||||
if (fullProfile.ProfileInfo?.IsWiped is not null && fullProfile.ProfileInfo.IsWiped.Value)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
fullProfile.CharacterData!.PmcData!.WishList ??= new DictionaryOrList<string, int>(new Dictionary<string, int>(), []);
|
||||
fullProfile.CharacterData.ScavData!.WishList ??= new DictionaryOrList<string, int>(new Dictionary<string, int>(), []);
|
||||
|
||||
if (fullProfile.DialogueRecords is not null)
|
||||
{
|
||||
_profileFixerService.CheckForAndFixDialogueAttachments(fullProfile);
|
||||
}
|
||||
|
||||
if(_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"Started game with session {sessionId} {fullProfile.ProfileInfo?.Username}");
|
||||
}
|
||||
|
||||
var pmcProfile = fullProfile.CharacterData.PmcData;
|
||||
|
||||
if (_coreConfig.Fixes.FixProfileBreakingInventoryItemIssues)
|
||||
{
|
||||
_profileFixerService.FixProfileBreakingInventoryItemIssues(pmcProfile);
|
||||
}
|
||||
|
||||
if (pmcProfile.Health is not null)
|
||||
{
|
||||
UpdateProfileHealthValues(pmcProfile);
|
||||
}
|
||||
|
||||
if (pmcProfile.Inventory is not null)
|
||||
{
|
||||
@@ -134,7 +144,9 @@ public class GameController(
|
||||
}
|
||||
|
||||
if (pmcProfile.Skills?.Common is not null)
|
||||
{
|
||||
WarnOnActiveBotReloadSkill(pmcProfile);
|
||||
}
|
||||
|
||||
_seasonalEventService.GivePlayerSeasonalGifts(sessionId);
|
||||
}
|
||||
@@ -317,9 +329,11 @@ public class GameController(
|
||||
energyRegenPerHour += pmcProfile.Bonuses!
|
||||
.Where(bonus => bonus.Type == BonusType.EnergyRegeneration)
|
||||
.Aggregate(0d, (sum, bonus) => sum + (bonus.Value!.Value));
|
||||
|
||||
hydrationRegenPerHour += pmcProfile.Bonuses!
|
||||
.Where(bonus => bonus.Type == BonusType.HydrationRegeneration)
|
||||
.Aggregate(0d, (sum, bonus) => sum + (bonus.Value!.Value));
|
||||
|
||||
hpRegenPerHour += pmcProfile.Bonuses!
|
||||
.Where(bonus => bonus.Type == BonusType.HealthRegeneration)
|
||||
.Aggregate(0d, (sum, bonus) => sum + (bonus.Value!.Value));
|
||||
@@ -439,7 +453,7 @@ public class GameController(
|
||||
|
||||
// Get active mods
|
||||
_logger.Error("NOT IMPLEMENTED - _preSptModLoader SaveActiveModsToProfile()");
|
||||
//var activeMods = _preSptModLoader.GetImportedModDetails(); // TODO IMPLEMENT _preSptModLoader
|
||||
//var activeMods = _preSptModLoader.GetImportedModDetails(); // TODO: IMPLEMENT _preSptModLoader
|
||||
// var activeMods = new Dictionary<string, ModDetails>();
|
||||
// foreach (var modKvP in activeMods)
|
||||
// {
|
||||
|
||||
@@ -44,7 +44,8 @@ public class HealthController(
|
||||
|
||||
// Update medkit used (hpresource)
|
||||
var healingItemToUse = pmcData.Inventory.Items.FirstOrDefault(item => item.Id == request.Item);
|
||||
if (healingItemToUse is null) {
|
||||
if (healingItemToUse is null)
|
||||
{
|
||||
var errorMessage = _localisationService.GetText("health-healing_item_not_found", request.Item);
|
||||
_logger.Error(errorMessage);
|
||||
|
||||
@@ -54,9 +55,12 @@ public class HealthController(
|
||||
// Ensure item has a upd object
|
||||
_itemHelper.AddUpdObjectToItem(healingItemToUse);
|
||||
|
||||
if (healingItemToUse.Upd.MedKit is not null) {
|
||||
if (healingItemToUse.Upd.MedKit is not null)
|
||||
{
|
||||
healingItemToUse.Upd.MedKit.HpResource -= request.Count;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get max healing from db
|
||||
var maxhp = _itemHelper.GetItem(healingItemToUse.Template).Value.Properties.MaxHpResource;
|
||||
healingItemToUse.Upd.MedKit = new UpdMedKit { HpResource = maxhp - request.Count }; // Subtract amout used from max
|
||||
@@ -65,7 +69,8 @@ public class HealthController(
|
||||
}
|
||||
|
||||
// Resource in medkit is spent, delete it
|
||||
if (healingItemToUse.Upd.MedKit.HpResource <= 0) {
|
||||
if (healingItemToUse.Upd.MedKit.HpResource <= 0)
|
||||
{
|
||||
_inventoryHelper.RemoveItem(pmcData, request.Item, sessionID, output);
|
||||
}
|
||||
|
||||
@@ -73,7 +78,8 @@ public class HealthController(
|
||||
|
||||
var healItemEffectDetails = healingItemDbDetails.Value.Properties.EffectsDamage;
|
||||
BodyPartHealth bodyPartToHeal = pmcData.Health.BodyParts.GetValueOrDefault(request.Part.ToString());
|
||||
if (bodyPartToHeal is null) {
|
||||
if (bodyPartToHeal is null)
|
||||
{
|
||||
_logger.Warning($"Player: {sessionID} Tried to heal a non-existent body part: {request.Part}");
|
||||
|
||||
return output;
|
||||
@@ -84,13 +90,16 @@ public class HealthController(
|
||||
|
||||
// Check if healing item removes negative effects
|
||||
var itemRemovesEffects = healingItemDbDetails.Value.Properties.EffectsDamage.Count > 0;
|
||||
if (itemRemovesEffects && bodyPartToHeal.Effects is not null) {
|
||||
if (itemRemovesEffects && bodyPartToHeal.Effects is not null)
|
||||
{
|
||||
// Can remove effects and limb has effects to remove
|
||||
var effectsOnBodyPart = bodyPartToHeal.Effects.Keys;
|
||||
foreach (var effectKey in effectsOnBodyPart) {
|
||||
foreach (var effectKey in effectsOnBodyPart)
|
||||
{
|
||||
// Check if healing item removes the effect on limb
|
||||
var matchingEffectFromHealingItem = healItemEffectDetails.GetValueOrDefault(effectKey);
|
||||
if (matchingEffectFromHealingItem is null) {
|
||||
if (matchingEffectFromHealingItem is null)
|
||||
{
|
||||
// Healing item doesnt have matching effect, it doesnt remove the effect
|
||||
continue;
|
||||
}
|
||||
@@ -105,7 +114,8 @@ public class HealthController(
|
||||
bodyPartToHeal.Health.Current += amountToHealLimb;
|
||||
|
||||
// Ensure we've not healed beyond the limbs max hp
|
||||
if (bodyPartToHeal.Health.Current > bodyPartToHeal.Health.Maximum) {
|
||||
if (bodyPartToHeal.Health.Current > bodyPartToHeal.Health.Maximum)
|
||||
{
|
||||
bodyPartToHeal.Health.Current = bodyPartToHeal.Health.Maximum;
|
||||
}
|
||||
|
||||
@@ -262,7 +272,9 @@ public class HealthController(
|
||||
{
|
||||
// Found some, loop over them and remove from pmc profile
|
||||
foreach (var effect in partRequest.Effects)
|
||||
{
|
||||
pmcData.Health.BodyParts[bodyPartKvP.Key].Effects.Remove(effect);
|
||||
}
|
||||
|
||||
// Remove empty effect object
|
||||
if (pmcData.Health.BodyParts[bodyPartKvP.Key].Effects.Count == 0)
|
||||
|
||||
@@ -88,7 +88,9 @@ public class InsuranceController(
|
||||
if (profileInsuranceDetails.Count > 0)
|
||||
{
|
||||
if(_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"Found {profileInsuranceDetails.Count} insurance packages in profile {sessionId}");
|
||||
}
|
||||
}
|
||||
|
||||
return profileInsuranceDetails.Where(insured => insuranceTime >= insured.ScheduledTime).ToList();
|
||||
@@ -104,9 +106,11 @@ public class InsuranceController(
|
||||
protected void ProcessInsuredItems(List<Insurance> insuranceDetails, string sessionId)
|
||||
{
|
||||
if(_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug(
|
||||
$"Processing {insuranceDetails.Count} insurance packages, which includes a total of: {CountAllInsuranceItems(insuranceDetails)} items, in profile: {sessionId}"
|
||||
);
|
||||
}
|
||||
|
||||
// Iterate over each of the insurance packages.
|
||||
foreach (var insured in insuranceDetails)
|
||||
@@ -167,7 +171,9 @@ public class InsuranceController(
|
||||
.ToList();
|
||||
|
||||
if(_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"Removed processed insurance package. Remaining packages: {profile.InsuranceList.Count}");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -211,7 +217,9 @@ public class InsuranceController(
|
||||
if (!toDelete.Any())
|
||||
{
|
||||
if(_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"Marked {toDelete.Count} items for deletion from insurance.");
|
||||
}
|
||||
}
|
||||
|
||||
return toDelete;
|
||||
@@ -300,8 +308,6 @@ public class InsuranceController(
|
||||
{
|
||||
parent.Add(insuredItem);
|
||||
}
|
||||
|
||||
;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -436,7 +442,9 @@ public class InsuranceController(
|
||||
itemsMap.TryGetValue(parentObj.Key, out var parentItem);
|
||||
var parentName = _itemHelper.GetItemName(parentItem.Template);
|
||||
if(_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"Processing attachments of parent {parentName}");
|
||||
}
|
||||
|
||||
// Process the attachments for this individual parent item.
|
||||
ProcessAttachmentByParent(parentObj.Value, insuredTraderId, toDelete);
|
||||
@@ -481,7 +489,9 @@ public class InsuranceController(
|
||||
LogAttachmentsBeingRemoved(attachmentIdsToRemove, attachments, weightedAttachmentByPrice);
|
||||
|
||||
if(_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"Number of attachments to be deleted: {attachmentIdsToRemove.Count}");
|
||||
}
|
||||
}
|
||||
|
||||
private void LogAttachmentsBeingRemoved(List<string> attachmentIdsToRemove, List<Item> attachments, Dictionary<string, double> attachmentPrices)
|
||||
@@ -489,10 +499,13 @@ public class InsuranceController(
|
||||
var index = 1;
|
||||
foreach (var attachmentId in attachmentIdsToRemove)
|
||||
{
|
||||
_logger.Debug(
|
||||
$"Attachment {index} Id: {attachmentId} Tpl: {attachments.FirstOrDefault((x) => x.Id == attachmentId)?.Template} - " +
|
||||
$"Price: {attachmentPrices[attachmentId]}"
|
||||
);
|
||||
if (_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug(
|
||||
$"Attachment {index} Id: {attachmentId} Tpl: {attachments.FirstOrDefault((x) => x.Id == attachmentId)?.Template} - " +
|
||||
$"Price: {attachmentPrices[attachmentId]}"
|
||||
);
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@@ -579,8 +592,8 @@ public class InsuranceController(
|
||||
|
||||
private bool IsMapLabsAndInsuranceDisabled(Insurance insurance, string labsId = "laboratory")
|
||||
{
|
||||
return (
|
||||
insurance.SystemData?.Location?.ToLower() == labsId && !(_databaseService.GetLocation(labsId)?.Base?.Insurance.GetValueOrDefault(false) ?? false)
|
||||
return (insurance.SystemData?.Location?.ToLower() == labsId
|
||||
&& !(_databaseService.GetLocation(labsId)?.Base?.Insurance.GetValueOrDefault(false) ?? false)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -621,7 +634,9 @@ public class InsuranceController(
|
||||
var itemName = insuredItem is not null ? $"{_itemHelper.GetItemName(insuredItem.Template)}" : "";
|
||||
var status = roll ? "Delete" : "Keep";
|
||||
if(_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"Rolling {itemName} with {trader} - Return {traderReturnChance}% - Roll: {returnChance} - Status: {status}");
|
||||
}
|
||||
|
||||
return roll;
|
||||
}
|
||||
@@ -712,7 +727,10 @@ public class InsuranceController(
|
||||
foreach (var softInsertSlot in softInsertSlots)
|
||||
{
|
||||
if(_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"SoftInsertSlots: {softInsertSlot.SlotId}");
|
||||
}
|
||||
|
||||
pmcData.InsuredItems.Add(new InsuredItem { TId = body.TransactionId, ItemId = softInsertSlot.Id });
|
||||
}
|
||||
}
|
||||
@@ -744,7 +762,9 @@ public class InsuranceController(
|
||||
if (!inventoryItemsHash.ContainsKey(itemId))
|
||||
{
|
||||
if(_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"Item with id: {itemId} missing from player inventory, skipping");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,9 @@ public class InventoryController(
|
||||
// Item is moving into or out of place of fame dog tag slot
|
||||
if (moveRequest.To?.Container != null &&
|
||||
(moveRequest.To.Container.StartsWith("dogtag") || originalLocationSlotId.StartsWith("dogtag")))
|
||||
{
|
||||
_hideoutHelper.ApplyPlaceOfFameDogtagBonus(pmcData);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -345,16 +347,23 @@ public class InventoryController(
|
||||
inventoryItem.ParentId = change.ParentId;
|
||||
inventoryItem.SlotId = change.SlotId;
|
||||
if (change.Location is not null)
|
||||
{
|
||||
inventoryItem.Location = change.Location;
|
||||
}
|
||||
else
|
||||
{
|
||||
inventoryItem.Location = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ItemEventRouterResponse ReadEncyclopedia(PmcData pmcData, InventoryReadEncyclopediaRequestData body,
|
||||
string sessionId)
|
||||
{
|
||||
foreach (var id in body.Ids) pmcData.Encyclopedia[id] = true;
|
||||
foreach (var id in body.Ids)
|
||||
{
|
||||
pmcData.Encyclopedia[id] = true;
|
||||
}
|
||||
|
||||
return _eventOutputHolder.GetOutput(sessionId);
|
||||
}
|
||||
@@ -406,22 +415,29 @@ public class InventoryController(
|
||||
if (_presetHelper.IsPreset(request.Item)) return _presetHelper.GetBaseItemTpl(request.Item);
|
||||
|
||||
if (request.FromOwner.Id == Traders.FENCE)
|
||||
{
|
||||
// Get tpl from fence assorts
|
||||
return _fenceService.GetRawFenceAssorts().Items.FirstOrDefault(x => x.Id == request.Item)?.Template;
|
||||
}
|
||||
|
||||
if (request.FromOwner.Type == "Trader")
|
||||
{
|
||||
// Not fence
|
||||
// get tpl from trader assort
|
||||
return _databaseService
|
||||
.GetTrader(request.FromOwner.Id)
|
||||
.Assort.Items.FirstOrDefault(item => item.Id == request.Item)
|
||||
?.Template;
|
||||
}
|
||||
|
||||
if (request.FromOwner.Type == "RagFair")
|
||||
{
|
||||
// Try to get tplId from items.json first
|
||||
var item = _itemHelper.GetItem(request.Item);
|
||||
if (item.Key) return item.Value.Id;
|
||||
if (item.Key)
|
||||
{
|
||||
return item.Value.Id;
|
||||
}
|
||||
|
||||
// Try alternate way of getting offer if first approach fails
|
||||
var offer = _ragfairOfferService.GetOfferByOfferId(request.Item) ??
|
||||
@@ -429,7 +445,10 @@ public class InventoryController(
|
||||
|
||||
// Try find examine item inside offer items array
|
||||
var matchingItem = offer.Items.FirstOrDefault(offerItem => offerItem.Id == request.Item);
|
||||
if (matchingItem is not null) return matchingItem.Template;
|
||||
if (matchingItem is not null)
|
||||
{
|
||||
return matchingItem.Template;
|
||||
}
|
||||
|
||||
// Unable to find item in database or ragfair
|
||||
_logger.Warning(_localisationService.GetText("inventory-unable_to_find_item", request.Item));
|
||||
@@ -476,8 +495,7 @@ public class InventoryController(
|
||||
public void BindItem(PmcData pmcData, InventoryBindRequestData bindRequest, string sessionId,
|
||||
ItemEventRouterResponse output)
|
||||
{
|
||||
foreach (var kvp in pmcData.Inventory.FastPanel
|
||||
.Where(kvp => kvp.Value == bindRequest.Index))
|
||||
foreach (var kvp in pmcData.Inventory.FastPanel.Where(kvp => kvp.Value == bindRequest.Index))
|
||||
{
|
||||
pmcData.Inventory.FastPanel.Remove(kvp.Key);
|
||||
|
||||
@@ -542,7 +560,9 @@ public class InventoryController(
|
||||
|
||||
// We may be folding data on scav profile, get that profile instead
|
||||
if (request.FromOwner?.Type == "Profile" && request.FromOwner.Id != playerData.Id)
|
||||
{
|
||||
playerData = _profileHelper.GetScavProfile(sessionId);
|
||||
}
|
||||
|
||||
var itemToFold = playerData.Inventory.Items.FirstOrDefault(item => item?.Id == request.Item);
|
||||
if (itemToFold is null)
|
||||
@@ -573,7 +593,9 @@ public class InventoryController(
|
||||
// During post-raid scav transfer, the swap may be in the scav inventory
|
||||
var playerData = pmcData;
|
||||
if (request.FromOwner?.Type == "Profile" && request.FromOwner.Id != playerData.Id)
|
||||
{
|
||||
playerData = _profileHelper.GetScavProfile(sessionId);
|
||||
}
|
||||
|
||||
var itemOne = playerData.Inventory.Items.FirstOrDefault(x => x.Id == request.Item);
|
||||
if (itemOne is null)
|
||||
@@ -609,17 +631,24 @@ public class InventoryController(
|
||||
|
||||
// Request object has location data, add it in, otherwise remove existing location from object
|
||||
if (request.To.Location is not null)
|
||||
{
|
||||
itemOne.Location = request.To.Location;
|
||||
}
|
||||
else
|
||||
// biome-ignore lint/performance/noDelete: Delete is fine here as we entirely want to get rid of the location.
|
||||
{
|
||||
itemOne.Location = null;
|
||||
}
|
||||
|
||||
itemTwo.ParentId = request.To2.Id;
|
||||
itemTwo.SlotId = request.To2.Container;
|
||||
if (request.To2.Location is not null)
|
||||
{
|
||||
itemTwo.Location = request.To2.Location;
|
||||
}
|
||||
else
|
||||
{
|
||||
itemTwo.Location = null;
|
||||
}
|
||||
|
||||
// Client already informed of inventory locations, nothing for us to do
|
||||
return _eventOutputHolder.GetOutput(sessionId);
|
||||
@@ -667,11 +696,15 @@ public class InventoryController(
|
||||
|
||||
var sourceStackCount = sourceItem.Upd.StackObjectsCount;
|
||||
if (sourceStackCount > request.Count)
|
||||
{
|
||||
// Source items stack count greater than new desired count
|
||||
sourceItem.Upd.StackObjectsCount = sourceStackCount - request.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Moving a full stack onto a smaller stack
|
||||
sourceItem.Upd.StackObjectsCount = sourceStackCount - 1;
|
||||
}
|
||||
|
||||
destinationItem.Upd ??= new Upd { StackObjectsCount = 1 };
|
||||
|
||||
@@ -710,18 +743,27 @@ public class InventoryController(
|
||||
}
|
||||
|
||||
if (destinationItem.Upd?.StackObjectsCount is null)
|
||||
{
|
||||
// No stackcount on destination, add one
|
||||
destinationItem.Upd = new Upd { StackObjectsCount = 1 };
|
||||
}
|
||||
|
||||
if (sourceItem.Upd is null)
|
||||
{
|
||||
sourceItem.Upd = new Upd { StackObjectsCount = 1 };
|
||||
}
|
||||
else if (sourceItem.Upd.StackObjectsCount is null)
|
||||
{
|
||||
// Items pulled out of raid can have no stack count if the stack should be 1
|
||||
sourceItem.Upd.StackObjectsCount = 1;
|
||||
}
|
||||
|
||||
// Remove FiR status from destination stack when source stack has no FiR but destination does
|
||||
if (!sourceItem.Upd.SpawnedInSession.GetValueOrDefault(false) &&
|
||||
destinationItem.Upd.SpawnedInSession.GetValueOrDefault(false)) destinationItem.Upd.SpawnedInSession = false;
|
||||
destinationItem.Upd.SpawnedInSession.GetValueOrDefault(false))
|
||||
{
|
||||
destinationItem.Upd.SpawnedInSession = false;
|
||||
}
|
||||
|
||||
destinationItem.Upd.StackObjectsCount +=
|
||||
sourceItem.Upd.StackObjectsCount; // Add source stackcount to destination
|
||||
|
||||
@@ -199,7 +199,9 @@ public class LauncherV2Controller(
|
||||
{
|
||||
if (info.Username == profile.Value.ProfileInfo!.Username
|
||||
&& info.Password == profile.Value.ProfileInfo.Password)
|
||||
{
|
||||
return profile.Key;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -39,7 +39,9 @@ public class LocationController(
|
||||
if (mapBase == null)
|
||||
{
|
||||
if(_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"Map: {kvp} has no base json file, skipping generation");
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -190,7 +190,9 @@ public class QuestController(
|
||||
if (matchingQuest is not null)
|
||||
{
|
||||
if(_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"Accepted repeatable quest {acceptedQuest.QuestId} from {repeatableQuest.Name}");
|
||||
}
|
||||
matchingQuest.SptRepatableGroupName = repeatableQuest.Name;
|
||||
|
||||
return matchingQuest;
|
||||
|
||||
@@ -18,6 +18,7 @@ using Core.Generators;
|
||||
using System.Xml.Linq;
|
||||
using System;
|
||||
using Core.Models.Spt.Services;
|
||||
using LogLevel = Core.Models.Spt.Logging.LogLevel;
|
||||
|
||||
namespace Core.Controllers;
|
||||
|
||||
@@ -290,7 +291,10 @@ public class RagfairController
|
||||
else
|
||||
{
|
||||
_logger.Error(_localisationService.GetText("ragfair-unable_to_get_categories"));
|
||||
_logger.Debug(_jsonUtil.Serialize(searchRequest));
|
||||
if (_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug(_jsonUtil.Serialize(searchRequest));
|
||||
}
|
||||
return new Dictionary<string, int>();
|
||||
}
|
||||
|
||||
@@ -530,7 +534,7 @@ public class RagfairController
|
||||
private ItemEventRouterResponse CreateMultiOffer(string sessionID, AddOfferRequestData offerRequest, SptProfile fullProfile, ItemEventRouterResponse output)
|
||||
{
|
||||
var pmcData = fullProfile.CharacterData.PmcData;
|
||||
var itemsToListCount = offerRequest.Items.Count; // Does not count stack size, only items
|
||||
// var itemsToListCount = offerRequest.Items.Count; // Wasnt used to commented out for now // Does not count stack size, only items
|
||||
|
||||
// multi-offers are all the same item,
|
||||
// Get first item and its children and use as template
|
||||
@@ -631,7 +635,7 @@ public class RagfairController
|
||||
private ItemEventRouterResponse CreatePackOffer(string sessionID, AddOfferRequestData offerRequest, SptProfile fullProfile, ItemEventRouterResponse output)
|
||||
{
|
||||
var pmcData = fullProfile.CharacterData.PmcData;
|
||||
var itemsToListCount = offerRequest.Items.Count; // Does not count stack size, only items
|
||||
// var itemsToListCount = offerRequest.Items.Count; // Wasnt used so commented out for now // Does not count stack size, only items
|
||||
|
||||
// multi-offers are all the same item,
|
||||
// Get first item and its children and use as template
|
||||
@@ -731,7 +735,7 @@ public class RagfairController
|
||||
ItemEventRouterResponse output)
|
||||
{
|
||||
var pmcData = fullProfile.CharacterData.PmcData;
|
||||
//var itemsToListCount = offerRequest.Items.Count; // Does not count stack size, only items
|
||||
// var itemsToListCount = offerRequest.Items.Count; // Wasnt used so commented out for now // Does not count stack size, only items
|
||||
|
||||
// Find items to be listed on flea from player inventory
|
||||
var result = GetItemsToListOnFleaFromInventory(pmcData, offerRequest.Items);
|
||||
@@ -840,7 +844,10 @@ public class RagfairController
|
||||
offerRequest.SellInOnePiece.GetValueOrDefault(false)
|
||||
);
|
||||
|
||||
_logger.Debug($"Offer tax to charge: {tax}, pulled from client: {storedClientTaxValue.Count is not null}");
|
||||
if (_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"Offer tax to charge: {tax}, pulled from client: {storedClientTaxValue.Count is not null}");
|
||||
}
|
||||
|
||||
// cleanup of cache now we've used the tax value from it
|
||||
_ragfairTaxService.ClearStoredOfferTaxById(offerRequest.Items.First());
|
||||
|
||||
@@ -114,9 +114,12 @@ public class RepeatableQuestController(
|
||||
newRepeatableQuest.Side = repeatableConfig.Side;
|
||||
repeatablesOfTypeInProfile.ActiveQuests.Add(newRepeatableQuest);
|
||||
|
||||
_logger.Debug(
|
||||
$"Removing: {repeatableConfig.Name} quest: {questToReplace.Id} from trader: {questToReplace.TraderId} as its been replaced"
|
||||
);
|
||||
if (_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug(
|
||||
$"Removing: {repeatableConfig.Name} quest: {questToReplace.Id} from trader: {questToReplace.TraderId} as its been replaced"
|
||||
);
|
||||
}
|
||||
|
||||
RemoveQuestFromProfile(fullProfile, questToReplace.Id);
|
||||
|
||||
@@ -261,7 +264,7 @@ public class RepeatableQuestController(
|
||||
|
||||
if (attempts > maxAttempts)
|
||||
{
|
||||
_logger.Debug("We were stuck in repeatable quest generation. This should never happen. Please report");
|
||||
_logger.Error("We were stuck in repeatable quest generation. This should never happen. Please report");
|
||||
}
|
||||
|
||||
return newRepeatableQuest;
|
||||
@@ -333,7 +336,10 @@ public class RepeatableQuestController(
|
||||
{
|
||||
returnData.Add(generatedRepeatables);
|
||||
|
||||
_logger.Debug($"[Quest Check] {repeatableTypeLower} quests are still valid.");
|
||||
if (_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"[Quest Check] {repeatableTypeLower} quests are still valid.");
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -343,7 +349,10 @@ public class RepeatableQuestController(
|
||||
// Set endtime to be now + new duration
|
||||
generatedRepeatables.EndTime = currentTime + repeatableConfig.ResetTime;
|
||||
generatedRepeatables.InactiveQuests = [];
|
||||
_logger.Debug($"Generating new {repeatableTypeLower}");
|
||||
if (_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"Generating new {repeatableTypeLower}");
|
||||
}
|
||||
|
||||
// Put old quests to inactive (this is required since only then the client makes them fail due to non-completion)
|
||||
// Also need to push them to the "inactiveQuests" list since we need to remove them from offraidData.profile.Quests
|
||||
@@ -371,7 +380,7 @@ public class RepeatableQuestController(
|
||||
lifeline++;
|
||||
if (lifeline > 10)
|
||||
{
|
||||
_logger.Debug(
|
||||
_logger.Error(
|
||||
"We were stuck in repeatable quest generation. This should never happen. Please report"
|
||||
);
|
||||
|
||||
@@ -470,7 +479,10 @@ public class RepeatableQuestController(
|
||||
// Scav and daily quests not unlocked yet
|
||||
if (repeatableConfig.Side == "Scav" && !PlayerHasDailyScavQuestsUnlocked(pmcData))
|
||||
{
|
||||
_logger.Debug("Daily scav quests still locked, Intel center not built");
|
||||
if (_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug("Daily scav quests still locked, Intel center not built");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -516,9 +528,12 @@ public class RepeatableQuestController(
|
||||
if (questStatusInProfile.Status == QuestStatusEnum.AvailableForFinish)
|
||||
{
|
||||
questsToKeep.Add(activeQuest);
|
||||
_logger.Debug(
|
||||
$"Keeping repeatable quest: {activeQuest.Id} in activeQuests since it is available to hand in"
|
||||
);
|
||||
if (_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug( // TODO: this shouldnt happen, doesnt on live
|
||||
$"Keeping repeatable quest: {activeQuest.Id} in activeQuests since it is available to hand in"
|
||||
);
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -616,10 +631,12 @@ public class RepeatableQuestController(
|
||||
{
|
||||
var locationNames = new List<string>();
|
||||
foreach (var locationName in value)
|
||||
{
|
||||
if (IsPmcLevelAllowedOnLocation(locationName, pmcLevel))
|
||||
{
|
||||
locationNames.Add(locationName);
|
||||
}
|
||||
}
|
||||
|
||||
if (locationNames.Count > 0)
|
||||
{
|
||||
@@ -668,9 +685,7 @@ public class RepeatableQuestController(
|
||||
}
|
||||
|
||||
// Add elite bonus to daily quests
|
||||
if (repeatableConfig.Name.ToLower() == "daily" &&
|
||||
_profileHelper.HasEliteSkillLevel(SkillTypes.Charisma, pmcData)
|
||||
)
|
||||
if (repeatableConfig.Name.ToLower() == "daily" && _profileHelper.HasEliteSkillLevel(SkillTypes.Charisma, pmcData))
|
||||
{
|
||||
// Elite charisma skill gives extra daily quest(s)
|
||||
questCount += _databaseService
|
||||
|
||||
@@ -152,7 +152,10 @@ public class TradeController(
|
||||
if (PlayerLacksTraderLoyaltyLevelToBuyOffer(fleaOffer, pmcData))
|
||||
{
|
||||
var errorMessage = $"Unable to buy item: {fleaOffer.Items[0].Template} from trader: {fleaOffer.User.Id} as loyalty level too low, skipping";
|
||||
_logger.Debug(errorMessage);
|
||||
if (_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug(errorMessage);
|
||||
}
|
||||
|
||||
_httpResponseUtil.AppendErrorToOutput(output, errorMessage, BackendErrorCodes.RagfairUnavailable);
|
||||
|
||||
@@ -293,7 +296,10 @@ public class TradeController(
|
||||
int roublesToSend,
|
||||
string trader)
|
||||
{
|
||||
_logger.Debug($"Selling scav items to fence for {roublesToSend} roubles");
|
||||
if (_logger.IsLogEnabled(LogLevel.Debug))
|
||||
{
|
||||
_logger.Debug($"Selling scav items to fence for {roublesToSend} roubles");
|
||||
}
|
||||
|
||||
// Create single currency item with all currency on it
|
||||
Item rootCurrencyReward = new Item
|
||||
@@ -334,9 +340,10 @@ public class TradeController(
|
||||
var itemWithChildren = _itemHelper.FindAndReturnChildrenAsItems(items, parentItemId);
|
||||
|
||||
var totalPrice = 0;
|
||||
foreach (var itemToSell in itemWithChildren) {
|
||||
foreach (var itemToSell in itemWithChildren)
|
||||
{
|
||||
var itemDetails = _itemHelper.GetItem(itemToSell.Template);
|
||||
if (!(itemDetails.Key && _itemHelper.IsOfBaseclasses(itemDetails.Value.Id, traderDetails.ItemsBuy.Category)))
|
||||
if (!(itemDetails.Key && _itemHelper.IsOfBaseclasses(itemDetails.Value.Id, traderDetails.ItemsBuy.Category)))
|
||||
{
|
||||
// Skip if tpl isn't item OR item doesn't fulfil match traders buy categories
|
||||
continue;
|
||||
|
||||
@@ -102,7 +102,9 @@ public class TraderController(
|
||||
case Traders.FENCE:
|
||||
{
|
||||
if (_fenceService.NeedsPartialRefresh())
|
||||
{
|
||||
_fenceService.GenerateFenceAssorts();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@@ -134,7 +136,9 @@ public class TraderController(
|
||||
traders.Add(_traderHelper.GetTrader(traderId, sessionId));
|
||||
|
||||
if (pmcData?.Info != null)
|
||||
{
|
||||
_traderHelper.LevelUp(traderId, pmcData);
|
||||
}
|
||||
}
|
||||
|
||||
traders.Sort(SortByTraderId);
|
||||
|
||||
Reference in New Issue
Block a user