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

Add armor plates to default profile

Implemented 2 achievement endpoints
This commit is contained in:
Dev 2023-12-27 22:43:42 +00:00
parent d9a9b67db4
commit fa01f1c2ae
7 changed files with 197 additions and 8 deletions

View File

@ -777,6 +777,26 @@
}
}
}, {
"_id": "658c3f38bb2016e5630bdbe5",
"_tpl": "65703d866584602f7d057a8a",
"parentId": "af4d8b34228a85208fb85895",
"slotId": "Soft_armor_front"
}, {
"_id": "658c3f38bb2016e5630bdbe6",
"_tpl": "65703fa06584602f7d057a8e",
"parentId": "af4d8b34228a85208fb85895",
"slotId": "Soft_armor_back"
}, {
"_id": "658c3f38bb2016e5630bdbe7",
"_tpl": "65703fe46a912c8b5c03468b",
"parentId": "af4d8b34228a85208fb85895",
"slotId": "Soft_armor_left"
}, {
"_id": "658c3f38bb2016e5630bdbe8",
"_tpl": "657040374e67e8ec7a0d261c",
"parentId": "af4d8b34228a85208fb85895",
"slotId": "soft_armor_right"
}, {
"_id": "01e9d751f10e4e9aebdd94d5",
"_tpl": "627a4e6b255f7527fb05a0f6",
"parentId": "5fe49444ae6628187a2e77b8",
@ -866,6 +886,26 @@
}
}
}, {
"_id": "658c3f38bb2016e5630bdbe5",
"_tpl": "65703d866584602f7d057a8a",
"parentId": "fb08ac9e01a36533563a4389",
"slotId": "Soft_armor_front"
}, {
"_id": "658c3f38bb2016e5630bdbe6",
"_tpl": "65703fa06584602f7d057a8e",
"parentId": "fb08ac9e01a36533563a4389",
"slotId": "Soft_armor_back"
}, {
"_id": "658c3f38bb2016e5630bdbe7",
"_tpl": "65703fe46a912c8b5c03468b",
"parentId": "fb08ac9e01a36533563a4389",
"slotId": "Soft_armor_left"
}, {
"_id": "658c3f38bb2016e5630bdbe8",
"_tpl": "657040374e67e8ec7a0d261c",
"parentId": "fb08ac9e01a36533563a4389",
"slotId": "soft_armor_right"
}, {
"_id": "686cfcc458f923cb2e76b8d7",
"_tpl": "5710c24ad2720bc3458b45a3",
"location": {
@ -37199,7 +37239,28 @@
"MaxDurability": 50
}
}
}, {
},
{
"_id": "658c3f38bb2016e5630bdbe5",
"_tpl": "65703d866584602f7d057a8a",
"parentId": "5fe4977574f15b4ad31b662b",
"slotId": "Soft_armor_front"
}, {
"_id": "658c3f38bb2016e5630bdbe6",
"_tpl": "65703fa06584602f7d057a8e",
"parentId": "5fe4977574f15b4ad31b662b",
"slotId": "Soft_armor_back"
}, {
"_id": "658c3f38bb2016e5630bdbe7",
"_tpl": "65703fe46a912c8b5c03468b",
"parentId": "5fe4977574f15b4ad31b662b",
"slotId": "Soft_armor_left"
}, {
"_id": "658c3f38bb2016e5630bdbe8",
"_tpl": "657040374e67e8ec7a0d261c",
"parentId": "5fe4977574f15b4ad31b662b",
"slotId": "soft_armor_right"
}, {
"_id": "5fe4977574f15b4ad31b662f",
"_tpl": "627a4e6b255f7527fb05a0f6",
"parentId": "5fe4977574f15b4ad31b6631",
@ -37288,7 +37349,27 @@
"MaxDurability": 50
}
}
}, {
}, {
"_id": "658c3f38bb2016e5630bdbe5",
"_tpl": "65703d866584602f7d057a8a",
"parentId": "5fe4977574f15b4ad31b6633",
"slotId": "Soft_armor_front"
}, {
"_id": "658c3f38bb2016e5630bdbe6",
"_tpl": "65703fa06584602f7d057a8e",
"parentId": "5fe4977574f15b4ad31b6633",
"slotId": "Soft_armor_back"
}, {
"_id": "658c3f38bb2016e5630bdbe7",
"_tpl": "65703fe46a912c8b5c03468b",
"parentId": "5fe4977574f15b4ad31b6633",
"slotId": "Soft_armor_left"
}, {
"_id": "658c3f38bb2016e5630bdbe8",
"_tpl": "657040374e67e8ec7a0d261c",
"parentId": "5fe4977574f15b4ad31b6633",
"slotId": "soft_armor_right"
}, {
"_id": "5fe4977574f15b4ad31b6634",
"_tpl": "5710c24ad2720bc3458b45a3",
"location": {
@ -37461,6 +37542,26 @@
}
}
}, {
"_id": "658c3f38bb2016e5630bdbe5",
"_tpl": "65703d866584602f7d057a8a",
"parentId": "5fe4977574f15b4ad31b6641",
"slotId": "Soft_armor_front"
}, {
"_id": "658c3f38bb2016e5630bdbe6",
"_tpl": "65703fa06584602f7d057a8e",
"parentId": "5fe4977574f15b4ad31b6641",
"slotId": "Soft_armor_back"
}, {
"_id": "658c3f38bb2016e5630bdbe7",
"_tpl": "65703fe46a912c8b5c03468b",
"parentId": "5fe4977574f15b4ad31b6641",
"slotId": "Soft_armor_left"
}, {
"_id": "658c3f38bb2016e5630bdbe8",
"_tpl": "657040374e67e8ec7a0d261c",
"parentId": "5fe4977574f15b4ad31b6641",
"slotId": "soft_armor_right"
}, {
"_id": "5fe4977574f15b4ad31b6642",
"_tpl": "5b40e5e25acfc4001a599bea",
"location": {
@ -39793,6 +39894,26 @@
}
}
}, {
"_id": "658c3f38bb2016e5630bdbe5",
"_tpl": "65703d866584602f7d057a8a",
"parentId": "5fe49cdfa19cac3fa905407f",
"slotId": "Soft_armor_front"
}, {
"_id": "658c3f38bb2016e5630bdbe6",
"_tpl": "65703fa06584602f7d057a8e",
"parentId": "5fe49cdfa19cac3fa905407f",
"slotId": "Soft_armor_back"
}, {
"_id": "658c3f38bb2016e5630bdbe7",
"_tpl": "65703fe46a912c8b5c03468b",
"parentId": "5fe49cdfa19cac3fa905407f",
"slotId": "Soft_armor_left"
}, {
"_id": "658c3f38bb2016e5630bdbe8",
"_tpl": "657040374e67e8ec7a0d261c",
"parentId": "5fe49cdfa19cac3fa905407f",
"slotId": "soft_armor_right"
}, {
"_id": "5fe49cdfa19cac3fa905407d",
"_tpl": "627a4e6b255f7527fb05a0f6",
"parentId": "5fe49cdfa19cac3fa905407f",
@ -40234,6 +40355,26 @@
}
}
}, {
"_id": "658c3f38bb2016e5630bdbe5",
"_tpl": "65703d866584602f7d057a8a",
"parentId": "5fe49cdfa19cac3fa905409d",
"slotId": "Soft_armor_front"
}, {
"_id": "658c3f38bb2016e5630bdbe6",
"_tpl": "65703fa06584602f7d057a8e",
"parentId": "5fe49cdfa19cac3fa905409d",
"slotId": "Soft_armor_back"
}, {
"_id": "658c3f38bb2016e5630bdbe7",
"_tpl": "65703fe46a912c8b5c03468b",
"parentId": "5fe49cdfa19cac3fa905409d",
"slotId": "Soft_armor_left"
}, {
"_id": "658c3f38bb2016e5630bdbe8",
"_tpl": "657040374e67e8ec7a0d261c",
"parentId": "5fe49cdfa19cac3fa905409d",
"slotId": "soft_armor_right"
}, {
"_id": "5fe49cdfa19cac3fa905409e",
"_tpl": "5448fee04bdc2dbc018b4567",
"location": {
@ -40340,6 +40481,26 @@
}
}
}, {
"_id": "658c3f38bb2016e5630bdbe5",
"_tpl": "65703d866584602f7d057a8a",
"parentId": "5fe49cdfa19cac3fa90540a5",
"slotId": "Soft_armor_front"
}, {
"_id": "658c3f38bb2016e5630bdbe6",
"_tpl": "65703fa06584602f7d057a8e",
"parentId": "5fe49cdfa19cac3fa90540a5",
"slotId": "Soft_armor_back"
}, {
"_id": "658c3f38bb2016e5630bdbe7",
"_tpl": "65703fe46a912c8b5c03468b",
"parentId": "5fe49cdfa19cac3fa90540a5",
"slotId": "Soft_armor_left"
}, {
"_id": "658c3f38bb2016e5630bdbe8",
"_tpl": "657040374e67e8ec7a0d261c",
"parentId": "5fe49cdfa19cac3fa90540a5",
"slotId": "soft_armor_right"
}, {
"_id": "5fe49cdfa19cac3fa90540a6",
"_tpl": "5e831507ea0a7c419c2f9bd9",
"location": {

View File

@ -1,5 +1,10 @@
import { AchievementController } from "@spt-aki/controllers/AchievementController";
import { ProfileController } from "@spt-aki/controllers/ProfileController";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement";
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse";
import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { inject, injectable } from "tsyringe";
@ -8,6 +13,7 @@ export class AchievementCallbacks
{
constructor(
@inject("AchievementController") protected achievementController: AchievementController,
@inject("ProfileController") protected profileController: ProfileController,
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
)
{}
@ -17,7 +23,7 @@ export class AchievementCallbacks
*
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getAchievements(url: string, info: IEmptyRequestData, sessionID: string): any
public getAchievements(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetAchievementsResponse>
{
return this.httpResponse.getBody(this.achievementController.getAchievements(sessionID));
@ -28,8 +34,8 @@ export class AchievementCallbacks
*
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public statistic(url: string, info: IEmptyRequestData, sessionID: string): any
public statistic(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ICompletedAchievementsResponse>
{
throw new Error("Not implemented");
return this.httpResponse.getBody(this.profileController.getCompletedAchievements(sessionID));
}
}

View File

@ -1,6 +1,6 @@
import { inject, injectable } from "tsyringe";
import { IAchievement } from "@spt-aki/models/eft/common/tables/IAchievement";
import { IGetAchievementsResponse } from "@spt-aki/models/eft/profile/IGetAchievementsResponse";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
@ -21,8 +21,8 @@ export class AchievementController
* Get base achievements
* @param sessionID Session id
*/
public getAchievements(sessionID: string): IAchievement[]
public getAchievements(sessionID: string): IGetAchievementsResponse
{
return this.databaseServer.getTables().templates.achievements;
return {elements: this.databaseServer.getTables().templates.achievements };
}
}

View File

@ -12,6 +12,7 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve
import { IMiniProfile } from "@spt-aki/models/eft/launcher/IMiniProfile";
import { GetProfileStatusResponseData } from "@spt-aki/models/eft/profile/GetProfileStatusResponseData";
import { IAkiProfile, Inraid, Vitality } from "@spt-aki/models/eft/profile/IAkiProfile";
import { ICompletedAchievementsResponse } from "@spt-aki/models/eft/profile/ICompletedAchievementsResponse";
import { IProfileChangeNicknameRequestData } from "@spt-aki/models/eft/profile/IProfileChangeNicknameRequestData";
import { IProfileChangeVoiceRequestData } from "@spt-aki/models/eft/profile/IProfileChangeVoiceRequestData";
import { IProfileCreateRequestData } from "@spt-aki/models/eft/profile/IProfileCreateRequestData";
@ -178,6 +179,7 @@ export class ProfileController
inraid: {} as Inraid,
insurance: [],
traderPurchases: {},
achievements: {}
};
this.profileFixerService.checkForAndFixPmcProfileIssues(profileDetails.characters.pmc);
@ -383,4 +385,11 @@ export class ProfileController
return response;
}
public getCompletedAchievements(sessionId: string): ICompletedAchievementsResponse
{
const profile = this.profileHelper.getFullProfile(sessionId);
return {elements: profile.achievements};
}
}

View File

@ -7,6 +7,7 @@ import { IProfileChangeEvent } from "@spt-aki/models/spt/dialog/ISendMessageDeta
export interface IAkiProfile
{
info: Info;
characters: Characters;
/** Clothing purchases */
@ -19,6 +20,8 @@ export interface IAkiProfile
insurance: Insurance[];
/** Assort purchases made by player since last trader refresh */
traderPurchases?: Record<string, Record<string, TraderPurchaseData>>;
/** Achievements earned by player */
achievements: Record<string, number>;
}
export class TraderPurchaseData

View File

@ -0,0 +1,4 @@
export interface ICompletedAchievementsResponse
{
elements: Record<string, number>
}

View File

@ -0,0 +1,6 @@
import { IAchievement } from "../common/tables/IAchievement";
export interface IGetAchievementsResponse
{
elements: IAchievement[]
}