Feature: send launcher descriptions of profiles when calling connect() (!70)

Localise description text
Add `IConnectResponse` object for LauncherController.connect()
Move server name into core.json config

Co-authored-by: Dev <dev@noreply.dev.sp-tarkov.com>
Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/70
This commit is contained in:
chomp 2023-03-15 14:18:55 +00:00
parent 12c269fb57
commit b44f62bb99
6 changed files with 19848 additions and 19805 deletions

View File

@ -1,5 +1,6 @@
{
"akiVersion": "3.5.3",
"projectName": "SPT-AKI",
"compatibleTarkovVersion": "0.13.0.22173"
}
"compatibleTarkovVersion": "0.13.0.22173",
"serverName": "SPT Server"
}

File diff suppressed because it is too large Load Diff

View File

@ -340,5 +340,12 @@
"pmcresponse-suffix_15": "champ",
"pmcresponse-suffix_16": "amigo",
"pmcresponse-suffix_17": "bud",
"pmcresponse-suffix_18": "guy"
"pmcresponse-suffix_18": "guy",
"launcher-profile_standard": "Same as live, basic stash size (10x28), 500,000 roubles",
"launcher-profile_leftbehind": "Same as Standard plus; larger stash size (10x38), extra equipment/items, 500 dollars",
"launcher-profile_preparetoescape": "Same as Left Behind plus; larger stash size (10x48), extra equipment/items, higher starting reputation with traders, 250 euros",
"launcher-edgeofdarkness": "Same as Prepare To Escape plus; larger stash size (10x68), extra equipment/items, higher starting reputation with traders, 1000 dollars, 500 euros",
"launcher-profile_spteasystart": "Lots of Roubles/Dollars/Euros, Some QoL skills are level 20, trader rep maxed, starting level is 69, no quests completed",
"launcher-profile_sptzerotohero": "Start with almost nothing, no Roubles/Dollars/Euros, no trader rep, 1 knife, no quests completed",
"launcher-profile_sptdeveloper": "Testing profile, starting level is 69, lots of Roubles/Dollars/Euros, USEC start with all quests ready to start, BEAR start with all quests ready to hand in, invincibility balaclava"
}

View File

@ -5,11 +5,13 @@ import { IChangeRequestData } from "../models/eft/launcher/IChangeRequestData";
import { ILoginRequestData } from "../models/eft/launcher/ILoginRequestData";
import { IRegisterData } from "../models/eft/launcher/IRegisterData";
import { Info } from "../models/eft/profile/IAkiProfile";
import { IConnectResponse } from "../models/eft/profile/IConnectResponse";
import { ConfigTypes } from "../models/enums/ConfigTypes";
import { ICoreConfig } from "../models/spt/config/ICoreConfig";
import { ConfigServer } from "../servers/ConfigServer";
import { DatabaseServer } from "../servers/DatabaseServer";
import { SaveServer } from "../servers/SaveServer";
import { LocalisationService } from "../services/LocalisationService";
import { HashUtil } from "../utils/HashUtil";
@injectable()
@ -22,18 +24,43 @@ export class LauncherController
@inject("SaveServer") protected saveServer: SaveServer,
@inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper,
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
@inject("LocalisationService") protected localisationService: LocalisationService,
@inject("ConfigServer") protected configServer: ConfigServer
)
{
this.coreConfig = this.configServer.getConfig(ConfigTypes.CORE);
}
public connect(): any
public connect(): IConnectResponse
{
return {
backendUrl: this.httpServerHelper.getBackendUrl(),
name: "SPT-AKI Server",
editions: Object.keys(this.databaseServer.getTables().templates.profiles)
name: this.coreConfig.serverName,
editions: Object.keys(this.databaseServer.getTables().templates.profiles),
profileDescriptions: this.getProfileDescriptions()
};
}
/**
* Get descriptive text for each of the profile edtions a player can choose
* @returns
*/
protected getProfileDescriptions(): Record<string, string>
{
return {
"Standard": this.localisationService.getText("launcher-profile_standard"),
// eslint-disable-next-line @typescript-eslint/naming-convention
"Left Behind": this.localisationService.getText("launcher-profile_leftbehind"),
// eslint-disable-next-line @typescript-eslint/naming-convention
"Prepare To Escape": this.localisationService.getText("launcher-profile_preparetoescape"),
// eslint-disable-next-line @typescript-eslint/naming-convention
"Edge Of Darkness": this.localisationService.getText("launcher-edgeofdarkness"),
// eslint-disable-next-line @typescript-eslint/naming-convention
"SPT Easy start": this.localisationService.getText("launcher-profile_spteasystart"),
// eslint-disable-next-line @typescript-eslint/naming-convention
"SPT Zero to hero": this.localisationService.getText("launcher-profile_sptzerotohero"),
// eslint-disable-next-line @typescript-eslint/naming-convention
"SPT Developer": this.localisationService.getText("launcher-profile_sptdeveloper")
};
}

View File

@ -0,0 +1,7 @@
export interface IConnectResponse
{
backendUrl: string,
name: string,
editions: string[],
profileDescriptions: Record<string, string>
}

View File

@ -6,5 +6,6 @@ export interface ICoreConfig extends IBaseConfig
akiVersion: string
projectName: string
compatibleTarkovVersion: string,
serverName: string;
commit: string
}