Ensure we hydrate the systemData object before calling addDialogueMessage()

This commit is contained in:
Dev 2023-05-27 23:04:39 +01:00
parent a4efdf9b43
commit b84d8a66c2

View File

@ -107,10 +107,8 @@ export class InsuranceService
const trader = this.traderHelper.getTrader(traderId, sessionID); const trader = this.traderHelper.getTrader(traderId, sessionID);
const insuranceReturnTimestamp = this.getInsuranceReturnTimestamp(pmcData, trader); const insuranceReturnTimestamp = this.getInsuranceReturnTimestamp(pmcData, trader);
const dialogueTemplates = this.databaseServer.getTables().traders[traderId].dialogue; const dialogueTemplates = this.databaseServer.getTables().traders[traderId].dialogue;
let messageContent = this.dialogueHelper.createMessageContext(this.randomUtil.getArrayValue(dialogueTemplates.insuranceStart), MessageType.NPC_TRADER, trader.insurance.max_storage_time); let messageContent = this.dialogueHelper.createMessageContext(this.randomUtil.getArrayValue(dialogueTemplates.insuranceStart), MessageType.NPC_TRADER, trader.insurance.max_storage_time);
this.dialogueHelper.addDialogueMessage(traderId, messageContent, sessionID);
messageContent = { messageContent = {
templateId: this.randomUtil.getArrayValue(dialogueTemplates.insuranceFound), templateId: this.randomUtil.getArrayValue(dialogueTemplates.insuranceFound),
type: MessageType.INSURANCE_RETURN, type: MessageType.INSURANCE_RETURN,
@ -124,6 +122,9 @@ export class InsuranceService
} }
}; };
// Must occur after systemData is hydrated
this.dialogueHelper.addDialogueMessage(traderId, messageContent, sessionID);
// Remove 'hideout' slotid property on all insurance items // Remove 'hideout' slotid property on all insurance items
this.removeLocationProperty(sessionID, traderId); this.removeLocationProperty(sessionID, traderId);