0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 09:50:43 -05:00

Localised various error messages

This commit is contained in:
Dev 2024-05-21 12:40:16 +01:00
parent 7b345b7513
commit 139b139581
16 changed files with 684 additions and 654 deletions

File diff suppressed because it is too large Load Diff

View File

@ -10,6 +10,7 @@ import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { EventOutputHolder } from "@spt-aki/routers/EventOutputHolder";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { SaveServer } from "@spt-aki/servers/SaveServer";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { ICloner } from "@spt-aki/utils/cloners/ICloner";
import { HashUtil } from "@spt-aki/utils/HashUtil";
@ -22,6 +23,7 @@ export class BuildController
@inject("EventOutputHolder") protected eventOutputHolder: EventOutputHolder,
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
@inject("LocalisationService") protected localisationService: LocalisationService,
@inject("ItemHelper") protected itemHelper: ItemHelper,
@inject("SaveServer") protected saveServer: SaveServer,
@inject("RecursiveCloner") protected cloner: ICloner,
@ -177,9 +179,7 @@ export class BuildController
}
// Not found in weapons,equipment or magazines, not good
this.logger.error(
`Unable to delete preset, cannot find ${idToRemove} in weapon, equipment or magazine presets`,
);
this.logger.error(this.localisationService.getText("build-unable_to_delete_preset", idToRemove));
}
/**

View File

@ -15,6 +15,7 @@ import { ICoreConfig } from "@spt-aki/models/spt/config/ICoreConfig";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { SaveServer } from "@spt-aki/servers/SaveServer";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { MailSendService } from "@spt-aki/services/MailSendService";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
@ -27,6 +28,7 @@ export class DialogueController
@inject("TimeUtil") protected timeUtil: TimeUtil,
@inject("DialogueHelper") protected dialogueHelper: DialogueHelper,
@inject("MailSendService") protected mailSendService: MailSendService,
@inject("LocalisationService") protected localisationService: LocalisationService,
@inject("ConfigServer") protected configServer: ConfigServer,
@injectAll("DialogueChatBot") protected dialogueChatBots: IDialogueChatBot[],
)
@ -296,7 +298,7 @@ export class DialogueController
const dialog = profile.dialogues[dialogueId];
if (!dialog)
{
this.logger.error(`No dialog in profile: ${sessionId} found with id: ${dialogueId}`);
this.logger.error(this.localisationService.getText("dialogue-unable_to_find_in_profile", { sessionId: sessionId, dialogueId: dialogueId }));
return;
}
@ -310,7 +312,7 @@ export class DialogueController
const dialog = this.dialogueHelper.getDialogsForProfile(sessionId)[dialogueId];
if (!dialog)
{
this.logger.error(`No dialog in profile: ${sessionId} found with id: ${dialogueId}`);
this.logger.error(this.localisationService.getText("dialogue-unable_to_find_in_profile", { sessionId: sessionId, dialogueId: dialogueId }));
return;
}
@ -329,7 +331,7 @@ export class DialogueController
const dialogs = this.dialogueHelper.getDialogsForProfile(sessionId);
if (!dialogs)
{
this.logger.error(`No dialog object in profile: ${sessionId}`);
this.logger.error(this.localisationService.getText("dialogue-unable_to_find_dialogs_in_profile", { sessionId: sessionId }));
return;
}
@ -354,7 +356,7 @@ export class DialogueController
const dialog = dialogs[dialogueId];
if (!dialog)
{
this.logger.error(`No dialog in profile: ${sessionId} found with id: ${dialogueId}`);
this.logger.error(this.localisationService.getText("dialogue-unable_to_find_in_profile", { sessionId: sessionId, dialogueId: dialogueId }));
return;
}

View File

@ -33,6 +33,7 @@ import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
import { SaveServer } from "@spt-aki/servers/SaveServer";
import { InsuranceService } from "@spt-aki/services/InsuranceService";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { MailSendService } from "@spt-aki/services/MailSendService";
import { MatchBotDetailsCacheService } from "@spt-aki/services/MatchBotDetailsCacheService";
import { PmcChatResponseService } from "@spt-aki/services/PmcChatResponseService";
@ -68,6 +69,7 @@ export class InraidController
@inject("HealthHelper") protected healthHelper: HealthHelper,
@inject("TraderHelper") protected traderHelper: TraderHelper,
@inject("TraderServicesService") protected traderServicesService: TraderServicesService,
@inject("LocalisationService") protected localisationService: LocalisationService,
@inject("InsuranceService") protected insuranceService: InsuranceService,
@inject("InRaidHelper") protected inRaidHelper: InRaidHelper,
@inject("ApplicationContext") protected applicationContext: ApplicationContext,
@ -96,7 +98,7 @@ export class InraidController
const profile = this.saveServer.getProfile(sessionID);
if (!profile)
{
this.logger.error(`No profile found with Id of: ${sessionID}`);
this.logger.error(this.localisationService.getText("inraid-no_profile_found", sessionID));
return;
}
@ -677,7 +679,7 @@ export class InraidController
const dialogueTemplates = this.databaseServer.getTables().traders[traderId].dialogue;
if (!dialogueTemplates)
{
this.logger.error(`Unable to deliver items as trader ${traderId} has no "dialogue" data`);
this.logger.error(this.localisationService.getText("inraid-unable_to_deliver_item_no_trader_found", traderId));
return;
}

View File

@ -411,13 +411,13 @@ export class InventoryController
const itemOne = playerData.Inventory.items.find((x) => x._id === request.item);
if (!itemOne)
{
this.logger.error(`Unable to find item: ${request.item} to swap positions with: ${request.item2}`);
this.logger.error(this.localisationService.getText("inventory-unable_to_find_item_to_swap", { item1Id: request.item, item2Id: request.item2 }));
}
const itemTwo = playerData.Inventory.items.find((x) => x._id === request.item2);
if (!itemTwo)
{
this.logger.error(`Unable to find item: ${request.item2} to swap positions with: ${request.item}`);
this.logger.error(this.localisationService.getText("inventory-unable_to_find_item_to_swap", { item1Id: request.item2, item2Id: request.item }));
}
// to.id is the parentid

View File

@ -220,7 +220,7 @@ export class RagfairController
}
else
{
this.logger.error("Unable to get categories from search criteria, see log for request data");
this.logger.error(this.localisationService.getText("ragfair-unable_to_get_categories"));
this.logger.debug(JSON.stringify(searchRequest));
return {};
}

View File

@ -85,10 +85,9 @@ export class LocationGenerator
const mapData: ILocation = db.locations[locationId];
const staticWeaponsOnMapClone = this.cloner.clone(mapData.staticContainers.staticWeapons);
if (!staticWeaponsOnMapClone)
{
this.logger.error(`Unable to find static weapon data for map: ${locationBase.Name}`);
this.logger.error(this.localisationService.getText("location-unable_to_find_static_weapon_for_map", locationBase.Name));
}
// Add mounted weapons to output loot
@ -98,7 +97,7 @@ export class LocationGenerator
if (!allStaticContainersOnMapClone)
{
this.logger.error(`Unable to find static container data for map: ${locationBase.Name}`);
this.logger.error(this.localisationService.getText("location-unable_to_find_static_container_for_map", locationBase.Name));
}
const staticRandomisableContainersOnMap = this.getRandomisableContainersOnMap(allStaticContainersOnMapClone);
@ -107,7 +106,7 @@ export class LocationGenerator
if (!staticForcedOnMapClone)
{
this.logger.error(`Unable to find forced static data for map: ${locationBase.Name}`);
this.logger.error(this.localisationService.getText("location-unable_to_find_forced_static_data_for_map", locationBase.Name));
}
// Keep track of static loot count
@ -367,7 +366,8 @@ export class LocationGenerator
const groupData = staticContainerGroupData.containers[container.template.Id];
if (!groupData)
{
this.logger.error(`Container ${container.template.Id} not found in statics.json, this is bad`);
this.logger.error(this.localisationService.getText("location-unable_to_find_container_in_statics_json", container.template.Id));
continue;
}
@ -376,6 +376,7 @@ export class LocationGenerator
this.logger.debug(
`Container ${container.template.Id} with group ${groupData.groupId} had 100% chance to spawn was picked as random container, skipping`,
);
continue;
}
mapping[groupData.groupId].containerIdsWithProbability[container.template.Id] = container.probability;

View File

@ -151,16 +151,15 @@ export class InRaidHelper
const matchingPreRaidCounter = profileData.TaskConditionCounters[backendCounterKey];
if (!matchingPreRaidCounter)
{
this.logger.error(`TaskConditionCounters: ${backendCounterKey} cannot be found in pre-raid data`);
this.logger.error(this.localisationService.getText("inraid-unable_to_find_key_in_taskconditioncounters", backendCounterKey));
continue;
}
if (matchingPreRaidCounter.value !== postRaidValue)
{
this.logger.error(
`TaskConditionCounters: ${backendCounterKey} value is different post raid, old: ${matchingPreRaidCounter.value} new: ${postRaidValue}`,
);
this.logger.error(this.localisationService.getText("inraid-taskconditioncounter_keys_differ",
{ key: backendCounterKey, oldValue: matchingPreRaidCounter.value, newValue: postRaidValue }));
}
}
}

View File

@ -304,7 +304,7 @@ export class InventoryHelper
catch (err)
{
const errorText = typeof err === "string" ? ` -> ${err}` : err.message;
this.logger.error(`Unable to fit item into inventory: ${errorText}`);
this.logger.error(this.localisationService.getText("inventory-unable_to_fit_item_into_inventory", errorText));
return false;
}
@ -1147,7 +1147,7 @@ export class InventoryHelper
const itemToMove = fromItems.find((x) => x._id === itemId);
if (!itemToMove)
{
this.logger.error(`Unable to find item to move: ${itemId}`);
this.logger.error(this.localisationService.getText("inventory-unable_to_find_item_to_move", itemId));
}
// Only adjust the values for parent item, not children (their values are already correctly tied to parent)

View File

@ -205,7 +205,7 @@ export class QuestHelper
const trader = profile.TradersInfo[<string>questProperties.target];
if (!trader)
{
this.logger.error(`Unable to find trader: ${questProperties.target} in profile`);
this.logger.error(this.localisationService.getText("quest-unable_to_find_trader_in_profile", questProperties.target));
}
return this.compareAvailableForValues(trader.loyaltyLevel, requiredLoyaltyLevel, questProperties.compareMethod);
@ -223,7 +223,7 @@ export class QuestHelper
const trader = profile.TradersInfo[<string>questProperties.target];
if (!trader)
{
this.logger.error(`Unable to find trader: ${questProperties.target} in profile`);
this.localisationService.getText("quest-unable_to_find_trader_in_profile", questProperties.target);
}
return this.compareAvailableForValues(trader.standing, requiredStanding, questProperties.compareMethod);
@ -435,7 +435,7 @@ export class QuestHelper
const questDbData = this.getQuestFromDb(acceptedQuest.qid, pmcData);
if (!questDbData)
{
this.logger.error(`Quest: ${acceptedQuest.qid} of type: ${acceptedQuest.type} not found`);
this.logger.error(this.localisationService.getText("quest-unable_to_find_quest_in_db", { questId: acceptedQuest.qid, questType: acceptedQuest.type }));
}
const waitTime = questDbData?.conditions.AvailableForStart.find((x) => x.availableAfter > 0);

View File

@ -59,7 +59,7 @@ export class TraderHelper
const pmcData = this.profileHelper.getPmcProfile(sessionID);
if (!pmcData)
{
this.logger.error(`No profile with sessionId: ${sessionID}`);
this.logger.error(this.localisationService.getText("trader-unable_to_find_profile_with_id", sessionID));
}
// Profile has traderInfo dict (profile beyond creation stage) but no requested trader in profile
@ -73,7 +73,7 @@ export class TraderHelper
const trader = this.databaseServer.getTables().traders?.[traderID]?.base;
if (!trader)
{
this.logger.error(`No trader with Id: ${traderID} found`);
this.logger.error(this.localisationService.getText("trader-unable_to_find_trader_by_id", traderID));
}
return trader;
@ -485,7 +485,7 @@ export class TraderHelper
if (keys.length === 0)
{
this.logger.error(`Unable to find trader: ${traderId} in Traders enum`);
this.logger.error(this.localisationService.getText("trader-unable_to_find_trader_in_enum", traderId));
return null;
}
@ -511,7 +511,7 @@ export class TraderHelper
{
if (!this.traderEnumHasKey(traderEnumValue))
{
this.logger.error(`Unable to find trader value: ${traderEnumValue} in Traders enum`);
this.logger.error(this.localisationService.getText("trader-unable_to_find_trader_in_enum", traderEnumValue));
return "";
}

View File

@ -41,7 +41,7 @@ export class BotEquipmentModPoolService
{
if (!items)
{
this.logger.error(`No items provided when attempting to generate ${poolType} pool, skipping`);
this.logger.error(this.localisationService.getText("bot-unable_to_generate_item_pool_no_items", poolType));
return;
}

View File

@ -1539,7 +1539,7 @@ export class FenceService
fenceAssortItem = this.fenceDiscountAssort.items.find((item) => item._id === assortId);
if (!fenceAssortItem)
{
this.logger.error(`Offer with id: ${assortId} not found`);
this.logger.error(this.localisationService.getText("fence-unable_to_find_offer_by_id", assortId));
return;
}

View File

@ -9,6 +9,7 @@ import { Gift, IGiftsConfig } from "@spt-aki/models/spt/config/IGiftsConfig";
import { ISendMessageDetails } from "@spt-aki/models/spt/dialog/ISendMessageDetails";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { LocalisationService } from "@spt-aki/services/LocalisationService";
import { MailSendService } from "@spt-aki/services/MailSendService";
import { HashUtil } from "@spt-aki/utils/HashUtil";
import { TimeUtil } from "@spt-aki/utils/TimeUtil";
@ -21,6 +22,7 @@ export class GiftService
constructor(
@inject("WinstonLogger") protected logger: ILogger,
@inject("MailSendService") protected mailSendService: MailSendService,
@inject("LocalisationService") protected localisationService: LocalisationService,
@inject("HashUtil") protected hashUtil: HashUtil,
@inject("TimeUtil") protected timeUtil: TimeUtil,
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
@ -190,7 +192,7 @@ export class GiftService
case GiftSenderType.USER:
return MessageType.USER_MESSAGE;
default:
this.logger.error(`Gift message type: ${giftData.sender} not handled`);
this.logger.error(this.localisationService.getText("gift-unable_to_handle_message_type_command", giftData.sender));
break;
}
}

View File

@ -482,7 +482,7 @@ export class MailSendService
{
if ("StackSlots" in itemTemplate._props)
{
this.logger.error(`Reward: ${itemTemplate._id} not handled`);
this.logger.error(this.localisationService.getText("mail-unable_to_give_gift_not_handled", itemTemplate._id));
}
// Item is sanitised and ready to be pushed into holding array

View File

@ -165,10 +165,9 @@ export class RagfairOfferService
public traderOffersNeedRefreshing(traderID: string): boolean
{
const trader = this.databaseServer.getTables().traders[traderID];
if (!trader || !trader.base)
{
this.logger.error(`Trader ${traderID} lacks a base file, cannot check for refresh status`);
this.logger.error(this.localisationService.getText("ragfair-trader_missing_base_file", traderID));
return false;
}