From 96de45e580ba4d90f4edbd49ca16a55e9f5ed7fb Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 9 Aug 2023 16:01:51 +0100 Subject: [PATCH] Expose SPT friend nickname in core config --- project/assets/configs/core.json | 1 + project/src/controllers/DialogueController.ts | 14 +++++++++++--- project/src/models/spt/config/ICoreConfig.ts | 1 + 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/project/assets/configs/core.json b/project/assets/configs/core.json index cebe294f..56e82c7c 100644 --- a/project/assets/configs/core.json +++ b/project/assets/configs/core.json @@ -4,6 +4,7 @@ "compatibleTarkovVersion": "0.13.1.25206", "serverName": "SPT Server", "profileSaveIntervalSeconds": 15, + "sptFriendNickname": "SPT", "fixes": { "fixShotgunDispersion": true, "removeModItemsFromProfile": false diff --git a/project/src/controllers/DialogueController.ts b/project/src/controllers/DialogueController.ts index b30dcd9d..4212c9dc 100644 --- a/project/src/controllers/DialogueController.ts +++ b/project/src/controllers/DialogueController.ts @@ -10,10 +10,13 @@ import { } from "../models/eft/dialog/IGetMailDialogViewResponseData"; import { ISendMessageRequest } from "../models/eft/dialog/ISendMessageRequest"; import { Dialogue, DialogueInfo, IAkiProfile, IUserDialogInfo, Message } from "../models/eft/profile/IAkiProfile"; +import { ConfigTypes } from "../models/enums/ConfigTypes"; import { GiftSentResult } from "../models/enums/GiftSentResult"; import { MemberCategory } from "../models/enums/MemberCategory"; import { MessageType } from "../models/enums/MessageType"; +import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { ILogger } from "../models/spt/utils/ILogger"; +import { ConfigServer } from "../servers/ConfigServer"; import { SaveServer } from "../servers/SaveServer"; import { GiftService } from "../services/GiftService"; import { MailSendService } from "../services/MailSendService"; @@ -24,6 +27,8 @@ import { TimeUtil } from "../utils/TimeUtil"; @injectable() export class DialogueController { + protected coreConfig: ICoreConfig; + constructor( @inject("WinstonLogger") protected logger: ILogger, @inject("SaveServer") protected saveServer: SaveServer, @@ -33,9 +38,12 @@ export class DialogueController @inject("RandomUtil") protected randomUtil: RandomUtil, @inject("MailSendService") protected mailSendService: MailSendService, @inject("GiftService") protected giftService: GiftService, - @inject("HashUtil") protected hashUtil: HashUtil + @inject("HashUtil") protected hashUtil: HashUtil, + @inject("ConfigServer") protected configServer: ConfigServer ) - {} + { + this.coreConfig = this.configServer.getConfig(ConfigTypes.CORE); + } /** Handle onUpdate spt event */ public update(): void @@ -418,7 +426,7 @@ export class DialogueController info: { Level: 1, MemberCategory: MemberCategory.DEVELOPER, - Nickname: "SPT", + Nickname: this.coreConfig.sptFriendNickname, Side: "Usec" } }; diff --git a/project/src/models/spt/config/ICoreConfig.ts b/project/src/models/spt/config/ICoreConfig.ts index 6a2a436a..5d65f828 100644 --- a/project/src/models/spt/config/ICoreConfig.ts +++ b/project/src/models/spt/config/ICoreConfig.ts @@ -8,6 +8,7 @@ export interface ICoreConfig extends IBaseConfig compatibleTarkovVersion: string serverName: string profileSaveIntervalSeconds: number + sptFriendNickname: string; fixes: IGameFixes commit: string }