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

Initial pass for 3.10 profile compatibility (#1085)

Initial pass to add 3.10 profile compatibility, can get into hideout and
seems to work as far as I can tell.
This commit is contained in:
Jesse 2025-01-15 20:23:14 +01:00 committed by GitHub
parent d5797b6f93
commit a7198c7f2a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 68 additions and 2 deletions

View File

@ -31,6 +31,7 @@ import { IHttpConfig } from "@spt/models/spt/config/IHttpConfig";
import { IRagfairConfig } from "@spt/models/spt/config/IRagfairConfig";
import type { ILogger } from "@spt/models/spt/utils/ILogger";
import { ConfigServer } from "@spt/servers/ConfigServer";
import { CreateProfileService } from "@spt/services/CreateProfileService";
import { CustomLocationWaveService } from "@spt/services/CustomLocationWaveService";
import { DatabaseService } from "@spt/services/DatabaseService";
import { GiftService } from "@spt/services/GiftService";
@ -70,6 +71,7 @@ export class GameController {
@inject("ProfileFixerService") protected profileFixerService: ProfileFixerService,
@inject("LocalisationService") protected localisationService: LocalisationService,
@inject("PostDbLoadService") protected postDbLoadService: PostDbLoadService,
@inject("CreateProfileService") protected createProfileService: CreateProfileService,
@inject("CustomLocationWaveService") protected customLocationWaveService: CustomLocationWaveService,
@inject("OpenZoneService") protected openZoneService: OpenZoneService,
@inject("SeasonalEventService") protected seasonalEventService: SeasonalEventService,
@ -142,6 +144,16 @@ export class GameController {
this.logger.success(`Migration of 3.9.x profile: ${fullProfile.info.username} completed successfully`);
}
//3.9 migrations
if (fullProfile.spt.version.includes("3.10.") && !fullProfile.spt.migrations["310x"]) {
this.migrate310xProfile(fullProfile);
// Flag as migrated
fullProfile.spt.migrations["310x"] = this.timeUtil.getTimestamp();
this.logger.success(`Migration of 3.10.x profile: ${fullProfile.info.username} completed successfully`);
}
if (Array.isArray(fullProfile.characters.pmc.WishList)) {
fullProfile.characters.pmc.WishList = {};
}
@ -200,6 +212,60 @@ export class GameController {
}
}
protected migrate310xProfile(fullProfile: ISptProfile) {
if (typeof fullProfile.customisationUnlocks === "undefined") {
fullProfile.customisationUnlocks = [];
this.createProfileService.addCustomisationUnlocksToProfile(fullProfile);
}
if (typeof fullProfile.characters.pmc.Prestige === "undefined") {
fullProfile.characters.pmc.Prestige = {};
}
if (typeof fullProfile.characters.pmc.Info.PrestigeLevel === "undefined") {
fullProfile.characters.pmc.Info.PrestigeLevel = 0;
}
if (typeof fullProfile.characters.pmc.Inventory.hideoutCustomizationStashId === "undefined") {
fullProfile.characters.pmc.Inventory.hideoutCustomizationStashId = "676db384777490e23c45b657";
this.createProfileService.addMissingInternalContainersToProfile(fullProfile.characters.pmc);
}
if (typeof fullProfile.characters.pmc.Hideout.Customization === "undefined") {
fullProfile.characters.pmc.Hideout.Customization = {
Wall: "675844bdf94a97cbbe096f1a",
Floor: "6758443ff94a97cbbe096f18",
Light: "675fe8abbc3deae49a0b947f",
Ceiling: "673b3f977038192ee006aa09",
ShootingRangeMark: "67585d416c72998cf60ed85a",
};
}
if (fullProfile.characters.pmc.Info.Side === "Bear") {
fullProfile.characters.pmc.Customization.DogTag = "674731c8bafff850080488bb"; //Bear base dogtag
if (fullProfile.characters.pmc.Info.GameVersion === "edge_of_darkness") {
fullProfile.characters.pmc.Customization.DogTag = "6746fd09bafff85008048838";
}
if (fullProfile.characters.pmc.Info.GameVersion === "unheard_edition") {
fullProfile.characters.pmc.Customization.DogTag = "67471928d17d6431550563b5";
}
}
if (fullProfile.characters.pmc.Info.Side === "Usec") {
fullProfile.characters.pmc.Customization.DogTag = "674731d1170146228c0d222a"; //Usec base dogtag
if (fullProfile.characters.pmc.Info.GameVersion === "edge_of_darkness") {
fullProfile.characters.pmc.Customization.DogTag = "67471938bafff850080488b7";
}
if (fullProfile.characters.pmc.Info.GameVersion === "unheard_edition") {
fullProfile.characters.pmc.Customization.DogTag = "6747193f170146228c0d2226";
}
}
}
protected migrate39xProfile(fullProfile: ISptProfile) {
// Karma & Favorite items
if (typeof fullProfile.characters.pmc.karmaValue === "undefined") {

View File

@ -205,7 +205,7 @@ export class CreateProfileService {
* DOES NOT check that stash exists
* @param pmcData Profile to check
*/
protected addMissingInternalContainersToProfile(pmcData: IPmcData): void {
public addMissingInternalContainersToProfile(pmcData: IPmcData): void {
if (!pmcData.Inventory.items.find((item) => item._id === pmcData.Inventory.hideoutCustomizationStashId)) {
pmcData.Inventory.items.push({
_id: pmcData.Inventory.hideoutCustomizationStashId,
@ -235,7 +235,7 @@ export class CreateProfileService {
}
}
protected addCustomisationUnlocksToProfile(fullProfile: ISptProfile) {
public addCustomisationUnlocksToProfile(fullProfile: ISptProfile) {
// Some game versions have additional dogtag variants, add them
switch (this.getGameEdition(fullProfile)) {
case GameEditions.EDGE_OF_DARKNESS: