mirror of
https://github.com/sp-tarkov/server.git
synced 2025-02-13 09:50:43 -05:00
Moved dogtag customisation options into profile controller instead of inside client/customization/storage
handler
Renamed variable to better reflect what it holds
This commit is contained in:
parent
9b16af7cb6
commit
b0d3d68d01
@ -235,94 +235,12 @@ export class CustomizationController {
|
|||||||
return customisationResultsClone;
|
return customisationResultsClone;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some game versions have additional dogtag variants, add them
|
|
||||||
switch (this.getGameEdition(profile)) {
|
|
||||||
case GameEditions.EDGE_OF_DARKNESS:
|
|
||||||
// Gets EoD tags
|
|
||||||
customisationResultsClone.push({
|
|
||||||
id: "6746fd09bafff85008048838",
|
|
||||||
source: "default",
|
|
||||||
type: "dogTag",
|
|
||||||
});
|
|
||||||
|
|
||||||
customisationResultsClone.push({
|
|
||||||
id: "67471938bafff850080488b7",
|
|
||||||
source: "default",
|
|
||||||
type: "dogTag",
|
|
||||||
});
|
|
||||||
|
|
||||||
break;
|
|
||||||
case GameEditions.UNHEARD:
|
|
||||||
// Gets EoD+Unheard tags
|
|
||||||
customisationResultsClone.push({
|
|
||||||
id: "6746fd09bafff85008048838",
|
|
||||||
source: "default",
|
|
||||||
type: "dogTag",
|
|
||||||
});
|
|
||||||
|
|
||||||
customisationResultsClone.push({
|
|
||||||
id: "67471938bafff850080488b7",
|
|
||||||
source: "default",
|
|
||||||
type: "dogTag",
|
|
||||||
});
|
|
||||||
|
|
||||||
customisationResultsClone.push({
|
|
||||||
id: "67471928d17d6431550563b5",
|
|
||||||
source: "default",
|
|
||||||
type: "dogTag",
|
|
||||||
});
|
|
||||||
|
|
||||||
customisationResultsClone.push({
|
|
||||||
id: "6747193f170146228c0d2226",
|
|
||||||
source: "default",
|
|
||||||
type: "dogTag",
|
|
||||||
});
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
const pretigeLevel = profile?.characters?.pmc?.Info?.PrestigeLevel;
|
|
||||||
if (pretigeLevel) {
|
|
||||||
if (pretigeLevel >= 1) {
|
|
||||||
customisationResultsClone.push({
|
|
||||||
id: "674dbf593bee1152d407f005",
|
|
||||||
source: "default",
|
|
||||||
type: "dogTag",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pretigeLevel >= 2) {
|
|
||||||
customisationResultsClone.push({
|
|
||||||
id: "675dcfea7ae1a8792107ca99",
|
|
||||||
source: "default",
|
|
||||||
type: "dogTag",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Append on customisations unlocked by player to results
|
// Append on customisations unlocked by player to results
|
||||||
customisationResultsClone.push(...(profile.hideoutCustomisationUnlocks ?? []));
|
customisationResultsClone.push(...(profile.customisationUnlocks ?? []));
|
||||||
|
|
||||||
return customisationResultsClone;
|
return customisationResultsClone;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected getGameEdition(profile: ISptProfile): string {
|
|
||||||
const edition = profile.characters?.pmc?.Info?.GameVersion;
|
|
||||||
if (!edition) {
|
|
||||||
// Edge case - profile not created yet, fall back to what launcher has set
|
|
||||||
const launcherEdition = profile.info.edition;
|
|
||||||
switch (launcherEdition.toLowerCase()) {
|
|
||||||
case "edge of darkness":
|
|
||||||
return GameEditions.EDGE_OF_DARKNESS;
|
|
||||||
case "unheard":
|
|
||||||
return GameEditions.UNHEARD;
|
|
||||||
default:
|
|
||||||
return GameEditions.STANDARD;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return edition;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Handle CustomizationSet event */
|
/** Handle CustomizationSet event */
|
||||||
public setClothing(
|
public setClothing(
|
||||||
sessionId: string,
|
sessionId: string,
|
||||||
|
@ -19,6 +19,7 @@ import { ISearchFriendRequestData } from "@spt/models/eft/profile/ISearchFriendR
|
|||||||
import { ISearchFriendResponse } from "@spt/models/eft/profile/ISearchFriendResponse";
|
import { ISearchFriendResponse } from "@spt/models/eft/profile/ISearchFriendResponse";
|
||||||
import { IInraid, ISptProfile, IVitality } from "@spt/models/eft/profile/ISptProfile";
|
import { IInraid, ISptProfile, IVitality } from "@spt/models/eft/profile/ISptProfile";
|
||||||
import { IValidateNicknameRequestData } from "@spt/models/eft/profile/IValidateNicknameRequestData";
|
import { IValidateNicknameRequestData } from "@spt/models/eft/profile/IValidateNicknameRequestData";
|
||||||
|
import { GameEditions } from "@spt/models/enums/GameEditions";
|
||||||
import { ItemTpl } from "@spt/models/enums/ItemTpl";
|
import { ItemTpl } from "@spt/models/enums/ItemTpl";
|
||||||
import { MessageType } from "@spt/models/enums/MessageType";
|
import { MessageType } from "@spt/models/enums/MessageType";
|
||||||
import { QuestStatus } from "@spt/models/enums/QuestStatus";
|
import { QuestStatus } from "@spt/models/enums/QuestStatus";
|
||||||
@ -127,10 +128,10 @@ export class ProfileController {
|
|||||||
*/
|
*/
|
||||||
public createProfile(info: IProfileCreateRequestData, sessionID: string): string {
|
public createProfile(info: IProfileCreateRequestData, sessionID: string): string {
|
||||||
const account = this.saveServer.getProfile(sessionID).info;
|
const account = this.saveServer.getProfile(sessionID).info;
|
||||||
const profileTemplate: ITemplateSide = this.cloner.clone(
|
const profileTemplateClone: ITemplateSide = this.cloner.clone(
|
||||||
this.databaseService.getProfiles()[account.edition][info.side.toLowerCase()],
|
this.databaseService.getProfiles()[account.edition][info.side.toLowerCase()],
|
||||||
);
|
);
|
||||||
const pmcData = profileTemplate.character;
|
const pmcData = profileTemplateClone.character;
|
||||||
|
|
||||||
// Delete existing profile
|
// Delete existing profile
|
||||||
this.deleteProfileBySessionId(sessionID);
|
this.deleteProfileBySessionId(sessionID);
|
||||||
@ -176,9 +177,9 @@ export class ProfileController {
|
|||||||
const profileDetails: ISptProfile = {
|
const profileDetails: ISptProfile = {
|
||||||
info: account,
|
info: account,
|
||||||
characters: { pmc: pmcData, scav: {} as IPmcData },
|
characters: { pmc: pmcData, scav: {} as IPmcData },
|
||||||
suits: profileTemplate.suits,
|
suits: profileTemplateClone.suits,
|
||||||
userbuilds: profileTemplate.userbuilds,
|
userbuilds: profileTemplateClone.userbuilds,
|
||||||
dialogues: profileTemplate.dialogues,
|
dialogues: profileTemplateClone.dialogues,
|
||||||
spt: this.profileHelper.getDefaultSptDataObject(),
|
spt: this.profileHelper.getDefaultSptDataObject(),
|
||||||
vitality: {} as IVitality,
|
vitality: {} as IVitality,
|
||||||
inraid: {} as IInraid,
|
inraid: {} as IInraid,
|
||||||
@ -186,18 +187,21 @@ export class ProfileController {
|
|||||||
traderPurchases: {},
|
traderPurchases: {},
|
||||||
achievements: {},
|
achievements: {},
|
||||||
friends: [],
|
friends: [],
|
||||||
|
customisationUnlocks: [],
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.addCustomisationUnlocksToProfile(profileDetails);
|
||||||
|
|
||||||
this.profileFixerService.checkForAndFixPmcProfileIssues(profileDetails.characters.pmc);
|
this.profileFixerService.checkForAndFixPmcProfileIssues(profileDetails.characters.pmc);
|
||||||
|
|
||||||
this.saveServer.addProfile(profileDetails);
|
this.saveServer.addProfile(profileDetails);
|
||||||
|
|
||||||
if (profileTemplate.trader.setQuestsAvailableForStart) {
|
if (profileTemplateClone.trader.setQuestsAvailableForStart) {
|
||||||
this.questHelper.addAllQuestsToProfile(profileDetails.characters.pmc, [QuestStatus.AvailableForStart]);
|
this.questHelper.addAllQuestsToProfile(profileDetails.characters.pmc, [QuestStatus.AvailableForStart]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Profile is flagged as wanting quests set to ready to hand in and collect rewards
|
// Profile is flagged as wanting quests set to ready to hand in and collect rewards
|
||||||
if (profileTemplate.trader.setQuestsAvailableForFinish) {
|
if (profileTemplateClone.trader.setQuestsAvailableForFinish) {
|
||||||
this.questHelper.addAllQuestsToProfile(profileDetails.characters.pmc, [
|
this.questHelper.addAllQuestsToProfile(profileDetails.characters.pmc, [
|
||||||
QuestStatus.AvailableForStart,
|
QuestStatus.AvailableForStart,
|
||||||
QuestStatus.Started,
|
QuestStatus.Started,
|
||||||
@ -226,6 +230,90 @@ export class ProfileController {
|
|||||||
return pmcData._id;
|
return pmcData._id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected addCustomisationUnlocksToProfile(fullProfile: ISptProfile) {
|
||||||
|
// Some game versions have additional dogtag variants, add them
|
||||||
|
switch (this.getGameEdition(fullProfile)) {
|
||||||
|
case GameEditions.EDGE_OF_DARKNESS:
|
||||||
|
// Gets EoD tags
|
||||||
|
fullProfile.customisationUnlocks.push({
|
||||||
|
id: "6746fd09bafff85008048838",
|
||||||
|
source: "default",
|
||||||
|
type: "dogTag",
|
||||||
|
});
|
||||||
|
|
||||||
|
fullProfile.customisationUnlocks.push({
|
||||||
|
id: "67471938bafff850080488b7",
|
||||||
|
source: "default",
|
||||||
|
type: "dogTag",
|
||||||
|
});
|
||||||
|
|
||||||
|
break;
|
||||||
|
case GameEditions.UNHEARD:
|
||||||
|
// Gets EoD+Unheard tags
|
||||||
|
fullProfile.customisationUnlocks.push({
|
||||||
|
id: "6746fd09bafff85008048838",
|
||||||
|
source: "default",
|
||||||
|
type: "dogTag",
|
||||||
|
});
|
||||||
|
|
||||||
|
fullProfile.customisationUnlocks.push({
|
||||||
|
id: "67471938bafff850080488b7",
|
||||||
|
source: "default",
|
||||||
|
type: "dogTag",
|
||||||
|
});
|
||||||
|
|
||||||
|
fullProfile.customisationUnlocks.push({
|
||||||
|
id: "67471928d17d6431550563b5",
|
||||||
|
source: "default",
|
||||||
|
type: "dogTag",
|
||||||
|
});
|
||||||
|
|
||||||
|
fullProfile.customisationUnlocks.push({
|
||||||
|
id: "6747193f170146228c0d2226",
|
||||||
|
source: "default",
|
||||||
|
type: "dogTag",
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
const pretigeLevel = fullProfile?.characters?.pmc?.Info?.PrestigeLevel;
|
||||||
|
if (pretigeLevel) {
|
||||||
|
if (pretigeLevel >= 1) {
|
||||||
|
fullProfile.customisationUnlocks.push({
|
||||||
|
id: "674dbf593bee1152d407f005",
|
||||||
|
source: "default",
|
||||||
|
type: "dogTag",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pretigeLevel >= 2) {
|
||||||
|
fullProfile.customisationUnlocks.push({
|
||||||
|
id: "675dcfea7ae1a8792107ca99",
|
||||||
|
source: "default",
|
||||||
|
type: "dogTag",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected getGameEdition(profile: ISptProfile): string {
|
||||||
|
const edition = profile.characters?.pmc?.Info?.GameVersion;
|
||||||
|
if (!edition) {
|
||||||
|
// Edge case - profile not created yet, fall back to what launcher has set
|
||||||
|
const launcherEdition = profile.info.edition;
|
||||||
|
switch (launcherEdition.toLowerCase()) {
|
||||||
|
case "edge of darkness":
|
||||||
|
return GameEditions.EDGE_OF_DARKNESS;
|
||||||
|
case "unheard":
|
||||||
|
return GameEditions.UNHEARD;
|
||||||
|
default:
|
||||||
|
return GameEditions.STANDARD;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return edition;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* make profiles pmcData.Inventory.equipment unique
|
* make profiles pmcData.Inventory.equipment unique
|
||||||
* @param pmcData Profile to update
|
* @param pmcData Profile to update
|
||||||
|
@ -629,8 +629,8 @@ export class ProfileHelper {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fullProfile.hideoutCustomisationUnlocks ||= [];
|
fullProfile.customisationUnlocks ||= [];
|
||||||
if (fullProfile.hideoutCustomisationUnlocks?.some((unlock) => unlock.id === hideoutCustomisationDb.id)) {
|
if (fullProfile.customisationUnlocks?.some((unlock) => unlock.id === hideoutCustomisationDb.id)) {
|
||||||
this.logger.warning(
|
this.logger.warning(
|
||||||
`Profile: ${fullProfile.info.id} already has hideout customisaiton reward: ${reward.target}, skipping`,
|
`Profile: ${fullProfile.info.id} already has hideout customisaiton reward: ${reward.target}, skipping`,
|
||||||
);
|
);
|
||||||
@ -643,6 +643,6 @@ export class ProfileHelper {
|
|||||||
type: hideoutCustomisationDb.type,
|
type: hideoutCustomisationDb.type,
|
||||||
};
|
};
|
||||||
|
|
||||||
fullProfile.hideoutCustomisationUnlocks.push(rewardToStore);
|
fullProfile.customisationUnlocks.push(rewardToStore);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ export interface ISptProfile {
|
|||||||
achievements: Record<string, number>;
|
achievements: Record<string, number>;
|
||||||
/** List of friend profile IDs */
|
/** List of friend profile IDs */
|
||||||
friends: string[];
|
friends: string[];
|
||||||
hideoutCustomisationUnlocks: ICustomisationStorage[];
|
customisationUnlocks: ICustomisationStorage[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ITraderPurchaseData {
|
export class ITraderPurchaseData {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user