Auto-formatting for callback classes.
This commit is contained in:
parent
90cdd6eea1
commit
ab7f41b924
@ -12,15 +12,15 @@ export class BotCallbacks
|
||||
{
|
||||
constructor(
|
||||
@inject("BotController") protected botController: BotController,
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil)
|
||||
{ }
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Handle singleplayer/settings/bot/limit
|
||||
* Is called by client to define each bot roles wave limit
|
||||
* @returns string
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getBotLimit(url: string, info: IEmptyRequestData, sessionID: string): string
|
||||
{
|
||||
const splittedUrl = url.split("/");
|
||||
@ -32,7 +32,6 @@ export class BotCallbacks
|
||||
* Handle singleplayer/settings/bot/difficulty
|
||||
* @returns string
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getBotDifficulty(url: string, info: IEmptyRequestData, sessionID: string): string
|
||||
{
|
||||
const splittedUrl = url.split("/");
|
||||
@ -42,7 +41,6 @@ export class BotCallbacks
|
||||
{
|
||||
return this.httpResponse.noBody(this.botController.getBotCoreDifficulty());
|
||||
}
|
||||
|
||||
return this.httpResponse.noBody(this.botController.getBotDifficulty(type, difficulty));
|
||||
}
|
||||
|
||||
@ -50,7 +48,11 @@ export class BotCallbacks
|
||||
* Handle client/game/bot/generate
|
||||
* @returns IGetBodyResponseData
|
||||
*/
|
||||
public generateBots(url: string, info: IGenerateBotsRequestData, sessionID: string): IGetBodyResponseData<IBotBase[]>
|
||||
public generateBots(
|
||||
url: string,
|
||||
info: IGenerateBotsRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IBotBase[]>
|
||||
{
|
||||
return this.httpResponse.getBody(this.botController.generate(sessionID, info));
|
||||
}
|
||||
@ -72,4 +74,4 @@ export class BotCallbacks
|
||||
{
|
||||
return this.httpResponse.noBody(this.botController.getAiBotBrainTypes());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,13 +18,12 @@ export class BundleCallbacks
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("HttpFileUtil") protected httpFileUtil: HttpFileUtil,
|
||||
@inject("BundleLoader") protected bundleLoader: BundleLoader,
|
||||
@inject("ConfigServer") protected configServer: ConfigServer
|
||||
@inject("ConfigServer") protected configServer: ConfigServer,
|
||||
)
|
||||
{
|
||||
this.httpConfig = this.configServer.getConfig(ConfigTypes.HTTP);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public sendBundle(sessionID: string, req: any, resp: any, body: any): any
|
||||
{
|
||||
this.logger.info(`[BUNDLE]: ${req.url}`);
|
||||
@ -39,14 +38,12 @@ export class BundleCallbacks
|
||||
/**
|
||||
* Handle singleplayer/bundles
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getBundles(url: string, info: any, sessionID: string): string
|
||||
{
|
||||
const local = (this.httpConfig.ip === "127.0.0.1" || this.httpConfig.ip === "localhost");
|
||||
const local = this.httpConfig.ip === "127.0.0.1" || this.httpConfig.ip === "localhost";
|
||||
return this.httpResponse.noBody(this.bundleLoader.getBundles(local));
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getBundle(url: string, info: any, sessionID: string): string
|
||||
{
|
||||
return "BUNDLE";
|
||||
|
@ -10,17 +10,16 @@ export class ClientLogCallbacks
|
||||
{
|
||||
constructor(
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("ClientLogController") protected clientLogController: ClientLogController
|
||||
)
|
||||
{ }
|
||||
@inject("ClientLogController") protected clientLogController: ClientLogController,
|
||||
)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Handle /singleplayer/log
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public clientLog(url: string, info: IClientLogRequest, sessionID: string): INullResponseData
|
||||
{
|
||||
this.clientLogController.clientLog(info);
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,9 +18,9 @@ export class CustomizationCallbacks
|
||||
constructor(
|
||||
@inject("CustomizationController") protected customizationController: CustomizationController,
|
||||
@inject("SaveServer") protected saveServer: SaveServer,
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
)
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* Handle client/trading/customization/storage
|
||||
@ -30,7 +30,7 @@ export class CustomizationCallbacks
|
||||
{
|
||||
const result: IGetSuitsResponse = {
|
||||
_id: `pmc${sessionID}`,
|
||||
suites: this.saveServer.getProfile(sessionID).suits
|
||||
suites: this.saveServer.getProfile(sessionID).suits,
|
||||
};
|
||||
return this.httpResponse.getBody(result);
|
||||
}
|
||||
@ -62,4 +62,4 @@ export class CustomizationCallbacks
|
||||
{
|
||||
return this.customizationController.buyClothing(pmcData, body, sessionID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,15 +27,14 @@ export class DataCallbacks
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
@inject("RagfairController") protected ragfairController: RagfairController,
|
||||
@inject("HideoutController") protected hideoutController: HideoutController
|
||||
@inject("HideoutController") protected hideoutController: HideoutController,
|
||||
)
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* Handle client/settings
|
||||
* @returns ISettingsBase
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ISettingsBase>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().settings);
|
||||
@ -45,7 +44,6 @@ export class DataCallbacks
|
||||
* Handle client/globals
|
||||
* @returns IGlobals
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getGlobals(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGlobals>
|
||||
{
|
||||
this.databaseServer.getTables().globals.time = Date.now() / 1000;
|
||||
@ -56,7 +54,6 @@ export class DataCallbacks
|
||||
* Handle client/items
|
||||
* @returns string
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getTemplateItems(url: string, info: IEmptyRequestData, sessionID: string): string
|
||||
{
|
||||
return this.httpResponse.getUnclearedBody(this.databaseServer.getTables().templates.items);
|
||||
@ -66,8 +63,11 @@ export class DataCallbacks
|
||||
* Handle client/handbook/templates
|
||||
* @returns IHandbookBase
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getTemplateHandbook(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHandbookBase>
|
||||
public getTemplateHandbook(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IHandbookBase>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().templates.handbook);
|
||||
}
|
||||
@ -76,8 +76,11 @@ export class DataCallbacks
|
||||
* Handle client/customization
|
||||
* @returns Record<string, ICustomizationItem
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getTemplateSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<Record<string, ICustomizationItem>>
|
||||
public getTemplateSuits(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<Record<string, ICustomizationItem>>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().templates.customization);
|
||||
}
|
||||
@ -86,7 +89,6 @@ export class DataCallbacks
|
||||
* Handle client/account/customization
|
||||
* @returns string[]
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getTemplateCharacter(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<string[]>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().templates.character);
|
||||
@ -96,26 +98,38 @@ export class DataCallbacks
|
||||
* Handle client/hideout/settings
|
||||
* @returns IHideoutSettingsBase
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getHideoutSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHideoutSettingsBase>
|
||||
public getHideoutSettings(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IHideoutSettingsBase>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().hideout.settings);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getHideoutAreas(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHideoutArea[]>
|
||||
public getHideoutAreas(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IHideoutArea[]>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().hideout.areas);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public gethideoutProduction(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHideoutProduction[]>
|
||||
public gethideoutProduction(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IHideoutProduction[]>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().hideout.production);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getHideoutScavcase(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IHideoutScavCase[]>
|
||||
public getHideoutScavcase(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IHideoutScavCase[]>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().hideout.scavcase);
|
||||
}
|
||||
@ -123,8 +137,11 @@ export class DataCallbacks
|
||||
/**
|
||||
* Handle client/languages
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<Record<string, string>>
|
||||
public getLocalesLanguages(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<Record<string, string>>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().locales.languages);
|
||||
}
|
||||
@ -132,25 +149,26 @@ export class DataCallbacks
|
||||
/**
|
||||
* Handle client/menu/locale
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getLocalesMenu(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<string>
|
||||
{
|
||||
return this.httpResponse.getBody(this.databaseServer.getTables().locales.menu[url.replace("/client/menu/locale/", "")]);
|
||||
return this.httpResponse.getBody(
|
||||
this.databaseServer.getTables().locales.menu[url.replace("/client/menu/locale/", "")],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle client/locale
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string
|
||||
{
|
||||
return this.httpResponse.getUnclearedBody(this.databaseServer.getTables().locales.global[url.replace("/client/locale/", "")]);
|
||||
return this.httpResponse.getUnclearedBody(
|
||||
this.databaseServer.getTables().locales.global[url.replace("/client/locale/", "")],
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle client/hideout/qte/list
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getQteList(url: string, info: IEmptyRequestData, sessionID: string): string
|
||||
{
|
||||
return this.httpResponse.getUnclearedBody(this.hideoutController.getQteList(sessionID));
|
||||
@ -161,22 +179,24 @@ export class DataCallbacks
|
||||
* Called when viewing a traders assorts
|
||||
* TODO - fully implement this
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getItemPrices(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetItemPricesResponse>
|
||||
public getItemPrices(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IGetItemPricesResponse>
|
||||
{
|
||||
const handbookPrices = this.ragfairController.getStaticPrices();
|
||||
const response: IGetItemPricesResponse = {
|
||||
supplyNextTime: 1672236024, // todo: get trader refresh time?
|
||||
prices: handbookPrices,
|
||||
currencyCourses: {
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
/* eslint-disable @typescript-eslint/naming-convention */
|
||||
"5449016a4bdc2d6f028b456f": handbookPrices[Money.ROUBLES],
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
"569668774bdc2da2298b4568": handbookPrices[Money.EUROS],
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
"5696686a4bdc2da3298b456a": handbookPrices[Money.DOLLARS]
|
||||
}
|
||||
"5696686a4bdc2da3298b456a": handbookPrices[Money.DOLLARS],
|
||||
/* eslint-enable @typescript-eslint/naming-convention */
|
||||
},
|
||||
};
|
||||
return this.httpResponse.getBody(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,10 @@ import { inject, injectable } from "tsyringe";
|
||||
import { DialogueController } from "@spt-aki/controllers/DialogueController";
|
||||
import { OnUpdate } from "@spt-aki/di/OnUpdate";
|
||||
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
|
||||
import { IAcceptFriendRequestData, ICancelFriendRequestData } from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData";
|
||||
import {
|
||||
IAcceptFriendRequestData,
|
||||
ICancelFriendRequestData,
|
||||
} from "@spt-aki/models/eft/dialog/IAcceptFriendRequestData";
|
||||
import { IChatServer } from "@spt-aki/models/eft/dialog/IChatServer";
|
||||
import { IClearMailMessageRequest } from "@spt-aki/models/eft/dialog/IClearMailMessageRequest";
|
||||
import { IDeleteFriendRequest } from "@spt-aki/models/eft/dialog/IDeleteFriendRequest";
|
||||
@ -36,16 +39,19 @@ export class DialogueCallbacks implements OnUpdate
|
||||
@inject("HashUtil") protected hashUtil: HashUtil,
|
||||
@inject("TimeUtil") protected timeUtil: TimeUtil,
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("DialogueController") protected dialogueController: DialogueController
|
||||
@inject("DialogueController") protected dialogueController: DialogueController,
|
||||
)
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
/**
|
||||
* Handle client/friend/list
|
||||
* @returns IGetFriendListDataResponse
|
||||
*/
|
||||
public getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetFriendListDataResponse>
|
||||
public getFriendList(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IGetFriendListDataResponse>
|
||||
{
|
||||
return this.httpResponse.getBody(this.dialogueController.getFriendList(sessionID));
|
||||
}
|
||||
@ -54,45 +60,58 @@ export class DialogueCallbacks implements OnUpdate
|
||||
* Handle client/chatServer/list
|
||||
* @returns IChatServer[]
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getChatServerList(url: string, info: IGetChatServerListRequestData, sessionID: string): IGetBodyResponseData<IChatServer[]>
|
||||
public getChatServerList(
|
||||
url: string,
|
||||
info: IGetChatServerListRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IChatServer[]>
|
||||
{
|
||||
|
||||
const chatServer: IChatServer =
|
||||
{
|
||||
_id: this.hashUtil.generate(),
|
||||
RegistrationId: 20,
|
||||
DateTime: this.timeUtil.getTimestamp(),
|
||||
IsDeveloper: true,
|
||||
Regions: ["EUR"],
|
||||
VersionId: "bgkidft87ddd",
|
||||
Ip: "",
|
||||
Port: 0,
|
||||
Chats: [
|
||||
{
|
||||
_id: "0",
|
||||
Members: 0
|
||||
}
|
||||
]
|
||||
};
|
||||
const chatServer: IChatServer = {
|
||||
_id: this.hashUtil.generate(),
|
||||
RegistrationId: 20,
|
||||
DateTime: this.timeUtil.getTimestamp(),
|
||||
IsDeveloper: true,
|
||||
Regions: ["EUR"],
|
||||
VersionId: "bgkidft87ddd", // TODO: Is this... correct?
|
||||
Ip: "",
|
||||
Port: 0,
|
||||
Chats: [
|
||||
{
|
||||
_id: "0",
|
||||
Members: 0,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
return this.httpResponse.getBody([chatServer]);
|
||||
}
|
||||
|
||||
/** Handle client/mail/dialog/list */
|
||||
public getMailDialogList(url: string, info: IGetMailDialogListRequestData, sessionID: string): IGetBodyResponseData<DialogueInfo[]>
|
||||
public getMailDialogList(
|
||||
url: string,
|
||||
info: IGetMailDialogListRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<DialogueInfo[]>
|
||||
{
|
||||
return this.httpResponse.getBody(this.dialogueController.generateDialogueList(sessionID));
|
||||
}
|
||||
|
||||
/** Handle client/mail/dialog/view */
|
||||
public getMailDialogView(url: string, info: IGetMailDialogViewRequestData, sessionID: string): IGetBodyResponseData<IGetMailDialogViewResponseData>
|
||||
public getMailDialogView(
|
||||
url: string,
|
||||
info: IGetMailDialogViewRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IGetMailDialogViewResponseData>
|
||||
{
|
||||
return this.httpResponse.getBody(this.dialogueController.generateDialogueView(info, sessionID));
|
||||
}
|
||||
|
||||
/** Handle client/mail/dialog/info */
|
||||
public getMailDialogInfo(url: string, info: IGetMailDialogInfoRequestData, sessionID: string): IGetBodyResponseData<DialogueInfo>
|
||||
public getMailDialogInfo(
|
||||
url: string,
|
||||
info: IGetMailDialogInfoRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<DialogueInfo>
|
||||
{
|
||||
return this.httpResponse.getBody(this.dialogueController.getDialogueInfo(info.dialogId, sessionID));
|
||||
}
|
||||
@ -129,7 +148,11 @@ export class DialogueCallbacks implements OnUpdate
|
||||
* Handle client/mail/dialog/getAllAttachments
|
||||
* @returns IGetAllAttachmentsResponse
|
||||
*/
|
||||
public getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData<IGetAllAttachmentsResponse>
|
||||
public getAllAttachments(
|
||||
url: string,
|
||||
info: IGetAllAttachmentsRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IGetAllAttachmentsResponse>
|
||||
{
|
||||
return this.httpResponse.getBody(this.dialogueController.getAllAttachments(info.dialogId, sessionID));
|
||||
}
|
||||
@ -141,7 +164,6 @@ export class DialogueCallbacks implements OnUpdate
|
||||
}
|
||||
|
||||
/** Handle client/friend/request/list/outbox */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public listOutbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<any[]>
|
||||
{
|
||||
return this.httpResponse.getBody([]);
|
||||
@ -150,7 +172,6 @@ export class DialogueCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle client/friend/request/list/inbox
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public listInbox(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<any[]>
|
||||
{
|
||||
return this.httpResponse.getBody([]);
|
||||
@ -159,8 +180,11 @@ export class DialogueCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle client/friend/request/send
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public sendFriendRequest(url: string, request: IFriendRequestData, sessionID: string): IGetBodyResponseData<IFriendRequestSendResponse>
|
||||
public sendFriendRequest(
|
||||
url: string,
|
||||
request: IFriendRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IFriendRequestSendResponse>
|
||||
{
|
||||
return this.httpResponse.getBody({status: 0, requestid: "12345", retryAfter: 600});
|
||||
}
|
||||
@ -168,8 +192,11 @@ export class DialogueCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle client/friend/request/accept
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public acceptFriendRequest(url: string, request: IAcceptFriendRequestData, sessionID: string): IGetBodyResponseData<boolean>
|
||||
public acceptFriendRequest(
|
||||
url: string,
|
||||
request: IAcceptFriendRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<boolean>
|
||||
{
|
||||
return this.httpResponse.getBody(true);
|
||||
}
|
||||
@ -177,46 +204,43 @@ export class DialogueCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle client/friend/request/cancel
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public cancelFriendRequest(url: string, request: ICancelFriendRequestData, sessionID: string): IGetBodyResponseData<boolean>
|
||||
public cancelFriendRequest(
|
||||
url: string,
|
||||
request: ICancelFriendRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<boolean>
|
||||
{
|
||||
return this.httpResponse.getBody(true);
|
||||
}
|
||||
|
||||
/** Handle client/friend/delete */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public deleteFriend(url: string, request: IDeleteFriendRequest, sessionID: string): INullResponseData
|
||||
{
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
|
||||
/** Handle client/friend/ignore/set */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public ignoreFriend(url: string, request: {uid: string}, sessionID: string): any
|
||||
public ignoreFriend(url: string, request: {uid: string;}, sessionID: string): any
|
||||
{
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
|
||||
/** Handle client/friend/ignore/remove */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public unIgnoreFriend(url: string, request: {uid: string}, sessionID: string): any
|
||||
public unIgnoreFriend(url: string, request: {uid: string;}, sessionID: string): any
|
||||
{
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public clearMail(url: string, request: IClearMailMessageRequest, sessionID: string): IGetBodyResponseData<any[]>
|
||||
{
|
||||
return this.httpResponse.emptyArrayResponse();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public removeMail(url: string, request: IRemoveMailMessageRequest, sessionID: string): IGetBodyResponseData<any[]>
|
||||
{
|
||||
return this.httpResponse.emptyArrayResponse();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public async onUpdate(timeSinceLastRun: number): Promise<boolean>
|
||||
{
|
||||
this.dialogueController.update();
|
||||
|
@ -20,13 +20,13 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
||||
import { Watermark } from "@spt-aki/utils/Watermark";
|
||||
|
||||
@injectable()
|
||||
class GameCallbacks implements OnLoad
|
||||
export class GameCallbacks implements OnLoad
|
||||
{
|
||||
constructor(
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("Watermark") protected watermark: Watermark,
|
||||
@inject("SaveServer") protected saveServer: SaveServer,
|
||||
@inject("GameController") protected gameController: GameController
|
||||
@inject("GameController") protected gameController: GameController,
|
||||
)
|
||||
{}
|
||||
|
||||
@ -44,7 +44,6 @@ class GameCallbacks implements OnLoad
|
||||
* Handle client/game/version/validate
|
||||
* @returns INullResponseData
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public versionValidate(url: string, info: IVersionValidateRequestData, sessionID: string): INullResponseData
|
||||
{
|
||||
return this.httpResponse.nullResponse();
|
||||
@ -60,8 +59,7 @@ class GameCallbacks implements OnLoad
|
||||
const startTimeStampMS = Date.parse(today);
|
||||
this.gameController.gameStart(url, info, sessionID, startTimeStampMS);
|
||||
return this.httpResponse.getBody({
|
||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||
utc_time: startTimeStampMS / 1000
|
||||
utc_time: startTimeStampMS / 1000,
|
||||
});
|
||||
}
|
||||
|
||||
@ -70,12 +68,15 @@ class GameCallbacks implements OnLoad
|
||||
* Save profiles on game close
|
||||
* @returns IGameLogoutResponseData
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public gameLogout(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGameLogoutResponseData>
|
||||
public gameLogout(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IGameLogoutResponseData>
|
||||
{
|
||||
this.saveServer.save();
|
||||
return this.httpResponse.getBody({
|
||||
status: "ok"
|
||||
status: "ok",
|
||||
});
|
||||
}
|
||||
|
||||
@ -83,7 +84,11 @@ class GameCallbacks implements OnLoad
|
||||
* Handle client/game/config
|
||||
* @returns IGameConfigResponse
|
||||
*/
|
||||
public getGameConfig(url: string, info: IGameEmptyCrcRequestData, sessionID: string): IGetBodyResponseData<IGameConfigResponse>
|
||||
public getGameConfig(
|
||||
url: string,
|
||||
info: IGameEmptyCrcRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IGameConfigResponse>
|
||||
{
|
||||
return this.httpResponse.getBody(this.gameController.getGameConfig(sessionID));
|
||||
}
|
||||
@ -91,7 +96,6 @@ class GameCallbacks implements OnLoad
|
||||
/**
|
||||
* Handle client/server/list
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getServer(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IServerDetails[]>
|
||||
{
|
||||
return this.httpResponse.getBody(this.gameController.getServer(sessionID));
|
||||
@ -100,7 +104,11 @@ class GameCallbacks implements OnLoad
|
||||
/**
|
||||
* Handle client/match/group/current
|
||||
*/
|
||||
public getCurrentGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ICurrentGroupResponse>
|
||||
public getCurrentGroup(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<ICurrentGroupResponse>
|
||||
{
|
||||
return this.httpResponse.getBody(this.gameController.getCurrentGroup(sessionID));
|
||||
}
|
||||
@ -108,8 +116,11 @@ class GameCallbacks implements OnLoad
|
||||
/**
|
||||
* Handle client/checkVersion
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public validateGameVersion(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ICheckVersionResponse>
|
||||
public validateGameVersion(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<ICheckVersionResponse>
|
||||
{
|
||||
return this.httpResponse.getBody(this.gameController.getValidGameVersion(sessionID));
|
||||
}
|
||||
@ -118,8 +129,11 @@ class GameCallbacks implements OnLoad
|
||||
* Handle client/game/keepalive
|
||||
* @returns IGameKeepAliveResponse
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public gameKeepalive(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGameKeepAliveResponse>
|
||||
public gameKeepalive(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IGameKeepAliveResponse>
|
||||
{
|
||||
return this.httpResponse.getBody(this.gameController.getKeepAlive(sessionID));
|
||||
}
|
||||
@ -128,20 +142,15 @@ class GameCallbacks implements OnLoad
|
||||
* Handle singleplayer/settings/version
|
||||
* @returns string
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getVersion(url: string, info: IEmptyRequestData, sessionID: string): string
|
||||
{
|
||||
return this.httpResponse.noBody({
|
||||
Version: this.watermark.getInGameVersionLabel()
|
||||
Version: this.watermark.getInGameVersionLabel(),
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public reportNickname(url: string, info: IReportNicknameRequestData, sessionID: string): INullResponseData
|
||||
{
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
}
|
||||
|
||||
export { GameCallbacks };
|
||||
|
||||
|
@ -7,16 +7,17 @@ import { OnLoad } from "@spt-aki/di/OnLoad";
|
||||
export class HandbookCallbacks implements OnLoad
|
||||
{
|
||||
constructor(
|
||||
@inject("HandbookController") protected handbookController: HandbookController
|
||||
@inject("HandbookController") protected handbookController: HandbookController,
|
||||
)
|
||||
{
|
||||
}
|
||||
public async onLoad(): Promise<void>
|
||||
{}
|
||||
|
||||
public async onLoad(): Promise<void>
|
||||
{
|
||||
this.handbookController.load();
|
||||
}
|
||||
public getRoute(): string
|
||||
|
||||
public getRoute(): string
|
||||
{
|
||||
return "aki-handbook";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,13 @@ export class HealthCallbacks
|
||||
constructor(
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("ProfileHelper") protected profileHelper: ProfileHelper,
|
||||
@inject("HealthController") protected healthController: HealthController)
|
||||
{ }
|
||||
@inject("HealthController") protected healthController: HealthController,
|
||||
)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Custom aki server request found in modules/HealthSynchronizer.cs
|
||||
* @param url
|
||||
* @param url
|
||||
* @param info HealthListener.Instance.CurrentHealth class
|
||||
* @param sessionID session id
|
||||
* @returns empty response, no data sent back to client
|
||||
@ -36,7 +37,7 @@ export class HealthCallbacks
|
||||
|
||||
/**
|
||||
* Custom aki server request found in modules/QTEPatch.cs
|
||||
* @param url
|
||||
* @param url
|
||||
* @param info HealthListener.Instance.CurrentHealth class
|
||||
* @param sessionID session id
|
||||
* @returns empty response, no data sent back to client
|
||||
@ -44,9 +45,10 @@ export class HealthCallbacks
|
||||
public handleWorkoutEffects(url: string, info: IWorkoutData, sessionID: string): IGetBodyResponseData<string>
|
||||
{
|
||||
this.healthController.applyWorkoutChanges(
|
||||
this.profileHelper.getPmcProfile(sessionID), info, sessionID
|
||||
this.profileHelper.getPmcProfile(sessionID),
|
||||
info,
|
||||
sessionID,
|
||||
);
|
||||
|
||||
return this.httpResponse.emptyResponse();
|
||||
}
|
||||
|
||||
@ -72,7 +74,11 @@ export class HealthCallbacks
|
||||
* Handle RestoreHealth
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
public healthTreatment(pmcData: IPmcData, info: IHealthTreatmentRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public healthTreatment(
|
||||
pmcData: IPmcData,
|
||||
info: IHealthTreatmentRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.healthController.healthTreatment(pmcData, info, sessionID);
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ export class HideoutCallbacks implements OnUpdate
|
||||
|
||||
constructor(
|
||||
@inject("HideoutController") protected hideoutController: HideoutController, // TODO: delay needed
|
||||
@inject("ConfigServer") protected configServer: ConfigServer
|
||||
@inject("ConfigServer") protected configServer: ConfigServer,
|
||||
)
|
||||
{
|
||||
this.hideoutConfig = this.configServer.getConfig(ConfigTypes.HIDEOUT);
|
||||
@ -45,7 +45,11 @@ export class HideoutCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle HideoutUpgradeComplete event
|
||||
*/
|
||||
public upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public upgradeComplete(
|
||||
pmcData: IPmcData,
|
||||
body: IHideoutUpgradeCompleteRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.hideoutController.upgradeComplete(pmcData, body, sessionID);
|
||||
}
|
||||
@ -53,7 +57,11 @@ export class HideoutCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle HideoutPutItemsInAreaSlots
|
||||
*/
|
||||
public putItemsInAreaSlots(pmcData: IPmcData, body: IHideoutPutItemInRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public putItemsInAreaSlots(
|
||||
pmcData: IPmcData,
|
||||
body: IHideoutPutItemInRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.hideoutController.putItemsInAreaSlots(pmcData, body, sessionID);
|
||||
}
|
||||
@ -61,7 +69,11 @@ export class HideoutCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle HideoutTakeItemsFromAreaSlots event
|
||||
*/
|
||||
public takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public takeItemsFromAreaSlots(
|
||||
pmcData: IPmcData,
|
||||
body: IHideoutTakeItemOutRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.hideoutController.takeItemsFromAreaSlots(pmcData, body, sessionID);
|
||||
}
|
||||
@ -69,7 +81,11 @@ export class HideoutCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle HideoutToggleArea event
|
||||
*/
|
||||
public toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public toggleArea(
|
||||
pmcData: IPmcData,
|
||||
body: IHideoutToggleAreaRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.hideoutController.toggleArea(pmcData, body, sessionID);
|
||||
}
|
||||
@ -77,7 +93,11 @@ export class HideoutCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle HideoutSingleProductionStart event
|
||||
*/
|
||||
public singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public singleProductionStart(
|
||||
pmcData: IPmcData,
|
||||
body: IHideoutSingleProductionStartRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.hideoutController.singleProductionStart(pmcData, body, sessionID);
|
||||
}
|
||||
@ -85,7 +105,11 @@ export class HideoutCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle HideoutScavCaseProductionStart event
|
||||
*/
|
||||
public scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public scavCaseProductionStart(
|
||||
pmcData: IPmcData,
|
||||
body: IHideoutScavCaseStartRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.hideoutController.scavCaseProductionStart(pmcData, body, sessionID);
|
||||
}
|
||||
@ -93,7 +117,11 @@ export class HideoutCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle HideoutContinuousProductionStart
|
||||
*/
|
||||
public continuousProductionStart(pmcData: IPmcData, body: IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public continuousProductionStart(
|
||||
pmcData: IPmcData,
|
||||
body: IHideoutContinuousProductionStartRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.hideoutController.continuousProductionStart(pmcData, body, sessionID);
|
||||
}
|
||||
@ -101,7 +129,11 @@ export class HideoutCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle HideoutTakeProduction event
|
||||
*/
|
||||
public takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public takeProduction(
|
||||
pmcData: IPmcData,
|
||||
body: IHideoutTakeProductionRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.hideoutController.takeProduction(pmcData, body, sessionID);
|
||||
}
|
||||
@ -109,7 +141,11 @@ export class HideoutCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle HideoutQuickTimeEvent
|
||||
*/
|
||||
public handleQTEEvent(pmcData: IPmcData, request: IHandleQTEEventRequestData, sessionId: string): IItemEventRouterResponse
|
||||
public handleQTEEvent(
|
||||
pmcData: IPmcData,
|
||||
request: IHandleQTEEventRequestData,
|
||||
sessionId: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.hideoutController.handleQTEEventOutcome(sessionId, pmcData, request);
|
||||
}
|
||||
@ -117,7 +153,11 @@ export class HideoutCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle client/game/profile/items/moving - RecordShootingRangePoints
|
||||
*/
|
||||
public recordShootingRangePoints(pmcData: IPmcData, request: IRecordShootingRangePoints, sessionId: string): IItemEventRouterResponse
|
||||
public recordShootingRangePoints(
|
||||
pmcData: IPmcData,
|
||||
request: IRecordShootingRangePoints,
|
||||
sessionId: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.hideoutController.recordShootingRangePoints(sessionId, pmcData, request);
|
||||
}
|
||||
@ -125,7 +165,11 @@ export class HideoutCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle client/game/profile/items/moving - RecordShootingRangePoints
|
||||
*/
|
||||
public improveArea(pmcData: IPmcData, request: IHideoutImproveAreaRequestData, sessionId: string): IItemEventRouterResponse
|
||||
public improveArea(
|
||||
pmcData: IPmcData,
|
||||
request: IHideoutImproveAreaRequestData,
|
||||
sessionId: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.hideoutController.improveArea(sessionId, pmcData, request);
|
||||
}
|
||||
@ -133,7 +177,11 @@ export class HideoutCallbacks implements OnUpdate
|
||||
/**
|
||||
* Handle client/game/profile/items/moving - HideoutCancelProductionCommand
|
||||
*/
|
||||
public cancelProduction(pmcData: IPmcData, request: IHideoutCancelProductionRequestData, sessionId: string): IItemEventRouterResponse
|
||||
public cancelProduction(
|
||||
pmcData: IPmcData,
|
||||
request: IHideoutCancelProductionRequestData,
|
||||
sessionId: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.hideoutController.cancelProduction(sessionId, pmcData, request);
|
||||
}
|
||||
@ -145,12 +193,11 @@ export class HideoutCallbacks implements OnUpdate
|
||||
this.hideoutController.update();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public getRoute() :string
|
||||
public getRoute(): string
|
||||
{
|
||||
return "aki-hideout";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,22 +7,20 @@ import { HttpServer } from "@spt-aki/servers/HttpServer";
|
||||
export class HttpCallbacks implements OnLoad
|
||||
{
|
||||
constructor(
|
||||
@inject("HttpServer") protected httpServer: HttpServer
|
||||
@inject("HttpServer") protected httpServer: HttpServer,
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
{}
|
||||
|
||||
public async onLoad(): Promise<void>
|
||||
{
|
||||
this.httpServer.load();
|
||||
}
|
||||
|
||||
public getRoute(): string
|
||||
public getRoute(): string
|
||||
{
|
||||
return "aki-http";
|
||||
}
|
||||
|
||||
|
||||
public getImage(): string
|
||||
{
|
||||
return "";
|
||||
|
@ -14,14 +14,14 @@ export class InraidCallbacks
|
||||
{
|
||||
constructor(
|
||||
@inject("InraidController") protected inraidController: InraidController,
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
)
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* Handle client/location/getLocalloot
|
||||
* Store active map in profile + applicationContext
|
||||
* @param url
|
||||
* @param url
|
||||
* @param info register player request
|
||||
* @param sessionID Session id
|
||||
* @returns Null http response
|
||||
@ -34,7 +34,7 @@ export class InraidCallbacks
|
||||
|
||||
/**
|
||||
* Handle raid/profile/save
|
||||
* @param url
|
||||
* @param url
|
||||
* @param info Save progress request
|
||||
* @param sessionID Session id
|
||||
* @returns Null http response
|
||||
@ -47,7 +47,7 @@ export class InraidCallbacks
|
||||
|
||||
/**
|
||||
* Handle singleplayer/settings/raid/endstate
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
public getRaidEndState(): string
|
||||
{
|
||||
@ -58,7 +58,6 @@ export class InraidCallbacks
|
||||
* Handle singleplayer/settings/raid/menu
|
||||
* @returns JSON as string
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getRaidMenuSettings(): string
|
||||
{
|
||||
return this.httpResponse.noBody(this.inraidController.getInraidConfig().raidMenuSettings);
|
||||
@ -66,7 +65,7 @@ export class InraidCallbacks
|
||||
|
||||
/**
|
||||
* Handle singleplayer/settings/weapon/durability
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
public getWeaponDurability(): string
|
||||
{
|
||||
@ -81,4 +80,4 @@ export class InraidCallbacks
|
||||
{
|
||||
return this.httpResponse.noBody(this.inraidController.getAirdropConfig());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ export class InsuranceCallbacks implements OnUpdate
|
||||
@inject("InsuranceController") protected insuranceController: InsuranceController,
|
||||
@inject("InsuranceService") protected insuranceService: InsuranceService,
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("ConfigServer") protected configServer: ConfigServer
|
||||
@inject("ConfigServer") protected configServer: ConfigServer,
|
||||
)
|
||||
{
|
||||
this.insuranceConfig = this.configServer.getConfig(ConfigTypes.INSURANCE);
|
||||
@ -32,7 +32,11 @@ export class InsuranceCallbacks implements OnUpdate
|
||||
* Handle client/insurance/items/list/cost
|
||||
* @returns IGetInsuranceCostResponseData
|
||||
*/
|
||||
public getInsuranceCost(url: string, info: IGetInsuranceCostRequestData, sessionID: string): IGetBodyResponseData<IGetInsuranceCostResponseData>
|
||||
public getInsuranceCost(
|
||||
url: string,
|
||||
info: IGetInsuranceCostRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IGetInsuranceCostResponseData>
|
||||
{
|
||||
return this.httpResponse.getBody(this.insuranceController.cost(info, sessionID));
|
||||
}
|
||||
@ -53,7 +57,6 @@ export class InsuranceCallbacks implements OnUpdate
|
||||
this.insuranceController.processReturn();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,9 @@ import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEve
|
||||
export class InventoryCallbacks
|
||||
{
|
||||
constructor(
|
||||
@inject("InventoryController") protected inventoryController: InventoryController
|
||||
@inject("InventoryController") protected inventoryController: InventoryController,
|
||||
)
|
||||
{ }
|
||||
{}
|
||||
|
||||
/** Handle Move event */
|
||||
public moveItem(pmcData: IPmcData, body: IInventoryMoveRequestData, sessionID: string): IItemEventRouterResponse
|
||||
@ -52,7 +52,11 @@ export class InventoryCallbacks
|
||||
return this.inventoryController.mergeItem(pmcData, body, sessionID);
|
||||
}
|
||||
|
||||
public transferItem(pmcData: IPmcData, body: IInventoryTransferRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public transferItem(
|
||||
pmcData: IPmcData,
|
||||
body: IInventoryTransferRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.inventoryController.transferItem(pmcData, body, sessionID);
|
||||
}
|
||||
@ -84,41 +88,69 @@ export class InventoryCallbacks
|
||||
return this.inventoryController.bindItem(pmcData, body, sessionID);
|
||||
}
|
||||
|
||||
public examineItem(pmcData: IPmcData, body: IInventoryExamineRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public examineItem(
|
||||
pmcData: IPmcData,
|
||||
body: IInventoryExamineRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.inventoryController.examineItem(pmcData, body, sessionID);
|
||||
}
|
||||
|
||||
/** Handle ReadEncyclopedia */
|
||||
public readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public readEncyclopedia(
|
||||
pmcData: IPmcData,
|
||||
body: IInventoryReadEncyclopediaRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.inventoryController.readEncyclopedia(pmcData, body, sessionID);
|
||||
}
|
||||
|
||||
/** Handle ApplyInventoryChanges */
|
||||
public sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public sortInventory(
|
||||
pmcData: IPmcData,
|
||||
body: IInventorySortRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.inventoryController.sortInventory(pmcData, body, sessionID);
|
||||
}
|
||||
|
||||
public createMapMarker(pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public createMapMarker(
|
||||
pmcData: IPmcData,
|
||||
body: IInventoryCreateMarkerRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.inventoryController.createMapMarker(pmcData, body, sessionID);
|
||||
}
|
||||
|
||||
public deleteMapMarker(pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public deleteMapMarker(
|
||||
pmcData: IPmcData,
|
||||
body: IInventoryDeleteMarkerRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.inventoryController.deleteMapMarker(pmcData, body, sessionID);
|
||||
}
|
||||
|
||||
public editMapMarker(pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public editMapMarker(
|
||||
pmcData: IPmcData,
|
||||
body: IInventoryEditMarkerRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.inventoryController.editMapMarker(pmcData, body, sessionID);
|
||||
}
|
||||
|
||||
/** Handle OpenRandomLootContainer */
|
||||
public openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public openRandomLootContainer(
|
||||
pmcData: IPmcData,
|
||||
body: IOpenRandomLootContainerRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.inventoryController.openRandomLootContainer(pmcData, body, sessionID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,16 +13,25 @@ export class ItemEventCallbacks
|
||||
{
|
||||
constructor(
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("ItemEventRouter") protected itemEventRouter: ItemEventRouter
|
||||
@inject("ItemEventRouter") protected itemEventRouter: ItemEventRouter,
|
||||
)
|
||||
{ }
|
||||
{}
|
||||
|
||||
public handleEvents(url: string, info: IItemEventRouterRequest, sessionID: string): IGetBodyResponseData<IItemEventRouterResponse>
|
||||
public handleEvents(
|
||||
url: string,
|
||||
info: IItemEventRouterRequest,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IItemEventRouterResponse>
|
||||
{
|
||||
const eventResponse = this.itemEventRouter.handleEvents(info, sessionID);
|
||||
const result = (eventResponse.warnings.length > 0)
|
||||
? this.httpResponse.getBody(eventResponse, this.getErrorCode(eventResponse.warnings), eventResponse.warnings[0].errmsg) // TODO: map 228 to its enum value
|
||||
: this.httpResponse.getBody(eventResponse);
|
||||
const result = (eventResponse.warnings.length > 0) ?
|
||||
this.httpResponse.getBody(
|
||||
eventResponse,
|
||||
this.getErrorCode(eventResponse.warnings),
|
||||
eventResponse.warnings[0].errmsg,
|
||||
) // TODO: map 228 to its enum value
|
||||
:
|
||||
this.httpResponse.getBody(eventResponse);
|
||||
|
||||
return result;
|
||||
}
|
||||
@ -33,7 +42,6 @@ export class ItemEventCallbacks
|
||||
{
|
||||
return Number(warnings[0].code);
|
||||
}
|
||||
|
||||
return BackendErrorCodes.UNKNOWN_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,57 +11,51 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
||||
import { Watermark } from "@spt-aki/utils/Watermark";
|
||||
|
||||
@injectable()
|
||||
class LauncherCallbacks
|
||||
export class LauncherCallbacks
|
||||
{
|
||||
constructor(
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("LauncherController") protected launcherController: LauncherController,
|
||||
@inject("SaveServer") protected saveServer: SaveServer,
|
||||
@inject("Watermark") protected watermark: Watermark
|
||||
@inject("Watermark") protected watermark: Watermark,
|
||||
)
|
||||
{ }
|
||||
{}
|
||||
|
||||
public connect(): string
|
||||
{
|
||||
return this.httpResponse.noBody(this.launcherController.connect());
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public login(url: string, info: ILoginRequestData, sessionID: string): string
|
||||
{
|
||||
const output = this.launcherController.login(info);
|
||||
return (!output) ? "FAILED" : output;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public register(url: string, info: IRegisterData, sessionID: string): "FAILED" | "OK"
|
||||
{
|
||||
const output = this.launcherController.register(info);
|
||||
return (!output) ? "FAILED" : "OK";
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public get(url: string, info: ILoginRequestData, sessionID: string): string
|
||||
{
|
||||
const output = this.launcherController.find(this.launcherController.login(info));
|
||||
return this.httpResponse.noBody(output);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public changeUsername(url: string, info: IChangeRequestData, sessionID: string): "FAILED" | "OK"
|
||||
{
|
||||
const output = this.launcherController.changeUsername(info);
|
||||
return (!output) ? "FAILED" : "OK";
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public changePassword(url: string, info: IChangeRequestData, sessionID: string): "FAILED" | "OK"
|
||||
{
|
||||
const output = this.launcherController.changePassword(info);
|
||||
return (!output) ? "FAILED" : "OK";
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public wipe(url: string, info: IRegisterData, sessionID: string): "FAILED" | "OK"
|
||||
{
|
||||
const output = this.launcherController.wipe(info);
|
||||
@ -73,7 +67,6 @@ class LauncherCallbacks
|
||||
return this.httpResponse.noBody(this.watermark.getVersionTag());
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public ping(url: string, info: IEmptyRequestData, sessionID: string): string
|
||||
{
|
||||
return this.httpResponse.noBody("pong!");
|
||||
@ -99,6 +92,3 @@ class LauncherCallbacks
|
||||
return this.httpResponse.noBody(this.launcherController.getServerModsProfileUsed(sessionId));
|
||||
}
|
||||
}
|
||||
|
||||
export { LauncherCallbacks };
|
||||
|
||||
|
@ -13,26 +13,31 @@ export class LocationCallbacks
|
||||
{
|
||||
constructor(
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("LocationController") protected locationController: LocationController
|
||||
@inject("LocationController") protected locationController: LocationController,
|
||||
)
|
||||
{ }
|
||||
{}
|
||||
|
||||
/** Handle client/locations */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getLocationData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ILocationsGenerateAllResponse>
|
||||
public getLocationData(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<ILocationsGenerateAllResponse>
|
||||
{
|
||||
return this.httpResponse.getBody(this.locationController.generateAll(sessionID));
|
||||
}
|
||||
|
||||
/** Handle client/location/getLocalloot */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getLocation(url: string, info: IGetLocationRequestData, sessionID: string): IGetBodyResponseData<ILocationBase>
|
||||
public getLocation(
|
||||
url: string,
|
||||
info: IGetLocationRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<ILocationBase>
|
||||
{
|
||||
return this.httpResponse.getBody(this.locationController.get(sessionID, info));
|
||||
}
|
||||
|
||||
|
||||
/** Handle client/location/getAirdropLoot */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getAirdropLoot(url: string, info: IEmptyRequestData, sessionID: string): string
|
||||
{
|
||||
return this.httpResponse.noBody(this.locationController.getAirdropLoot());
|
||||
|
@ -31,53 +31,50 @@ export class MatchCallbacks
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("JsonUtil") protected jsonUtil: JsonUtil,
|
||||
@inject("MatchController") protected matchController: MatchController,
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer
|
||||
@inject("DatabaseServer") protected databaseServer: DatabaseServer,
|
||||
)
|
||||
{ }
|
||||
{}
|
||||
|
||||
/** Handle client/match/updatePing */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public updatePing(url: string, info: IUpdatePingRequestData, sessionID: string): INullResponseData
|
||||
{
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
|
||||
// Handle client/match/exit
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public exitMatch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
|
||||
{
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
|
||||
/** Handle client/match/group/exit_from_menu */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public exitToMenu(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
|
||||
{
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public startGroupSearch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
|
||||
{
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public stopGroupSearch(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData
|
||||
{
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
|
||||
/** Handle client/match/group/invite/send */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData<string>
|
||||
{
|
||||
return this.httpResponse.getBody("2427943f23698ay9f2863735");
|
||||
}
|
||||
|
||||
/** Handle client/match/group/invite/accept */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public acceptGroupInvite(url: string, info: IAcceptGroupInviteRequest, sessionID: string): IGetBodyResponseData<IAcceptGroupInviteResponse[]>
|
||||
public acceptGroupInvite(
|
||||
url: string,
|
||||
info: IAcceptGroupInviteRequest,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IAcceptGroupInviteResponse[]>
|
||||
{
|
||||
const result = [];
|
||||
result.push({});
|
||||
@ -86,41 +83,40 @@ export class MatchCallbacks
|
||||
}
|
||||
|
||||
/** Handle client/match/group/invite/cancel */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public cancelGroupInvite(url: string, info: ICancelGroupInviteRequest, sessionID: string): IGetBodyResponseData<boolean>
|
||||
public cancelGroupInvite(
|
||||
url: string,
|
||||
info: ICancelGroupInviteRequest,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<boolean>
|
||||
{
|
||||
return this.httpResponse.getBody(true);
|
||||
}
|
||||
|
||||
/** Handle client/match/group/transfer */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public transferGroup(url: string, info: ITransferGroupRequest, sessionID: string): IGetBodyResponseData<boolean>
|
||||
{
|
||||
return this.httpResponse.getBody(true);
|
||||
}
|
||||
|
||||
/** Handle client/match/group/invite/cancel-all */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData
|
||||
{
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
|
||||
/** @deprecated - not called on raid start/end or game start/exit */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public putMetrics(url: string, info: IPutMetricsRequestData, sessionID: string): INullResponseData
|
||||
{
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
|
||||
/** Handle raid/profile/list */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData<IPmcData[]>
|
||||
{
|
||||
return this.httpResponse.getBody(this.matchController.getProfile(info));
|
||||
}
|
||||
|
||||
// Handle client/match/available
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public serverAvailable(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<boolean>
|
||||
{
|
||||
const output = this.matchController.getEnabled();
|
||||
@ -129,13 +125,16 @@ export class MatchCallbacks
|
||||
}
|
||||
|
||||
/** Handle match/group/start_game */
|
||||
public joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData<IJoinMatchResult>
|
||||
public joinMatch(
|
||||
url: string,
|
||||
info: IJoinMatchRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IJoinMatchResult>
|
||||
{
|
||||
return this.httpResponse.getBody(this.matchController.joinMatch(info, sessionID));
|
||||
}
|
||||
|
||||
/** Handle client/getMetricsConfig */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData<string>
|
||||
{
|
||||
return this.httpResponse.getBody(this.jsonUtil.serialize(this.databaseServer.getTables().match.metrics));
|
||||
@ -144,9 +143,8 @@ export class MatchCallbacks
|
||||
/**
|
||||
* @deprecated - not called on raid start/end or game start/exit
|
||||
* Handle client/match/group/status
|
||||
* @returns
|
||||
* @returns
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getGroupStatus(url: string, info: IGetGroupStatusRequestData, sessionID: string): IGetBodyResponseData<any>
|
||||
{
|
||||
return this.httpResponse.getBody(this.matchController.getGroupStatus(info));
|
||||
@ -159,7 +157,6 @@ export class MatchCallbacks
|
||||
}
|
||||
|
||||
/** Handle client/match/group/delete */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public deleteGroup(url: string, info: any, sessionID: string): INullResponseData
|
||||
{
|
||||
this.matchController.deleteGroup(info);
|
||||
@ -167,14 +164,12 @@ export class MatchCallbacks
|
||||
}
|
||||
|
||||
// Handle client/match/group/leave
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public leaveGroup(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<boolean>
|
||||
{
|
||||
return this.httpResponse.getBody(true);
|
||||
}
|
||||
|
||||
/** Handle client/match/group/player/remove */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public removePlayerFromGroup(url: string, info: IRemovePlayerFromGroupRequest, sessionID: string): INullResponseData
|
||||
{
|
||||
return this.httpResponse.nullResponse();
|
||||
@ -188,7 +183,11 @@ export class MatchCallbacks
|
||||
}
|
||||
|
||||
/** Handle client/raid/configuration */
|
||||
public getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData
|
||||
public getRaidConfiguration(
|
||||
url: string,
|
||||
info: IGetRaidConfigurationRequestData,
|
||||
sessionID: string,
|
||||
): INullResponseData
|
||||
{
|
||||
this.matchController.startOfflineRaid(info, sessionID);
|
||||
return this.httpResponse.nullResponse();
|
||||
|
@ -11,7 +11,7 @@ import { HttpFileUtil } from "@spt-aki/utils/HttpFileUtil";
|
||||
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
||||
|
||||
@injectable()
|
||||
class ModCallbacks implements OnLoad
|
||||
export class ModCallbacks implements OnLoad
|
||||
{
|
||||
protected httpConfig: IHttpConfig;
|
||||
|
||||
@ -21,12 +21,12 @@ class ModCallbacks implements OnLoad
|
||||
@inject("HttpFileUtil") protected httpFileUtil: HttpFileUtil,
|
||||
@inject("PostAkiModLoader") protected postAkiModLoader: PostAkiModLoader,
|
||||
@inject("LocalisationService") protected localisationService: LocalisationService,
|
||||
@inject("ConfigServer") protected configServer: ConfigServer
|
||||
@inject("ConfigServer") protected configServer: ConfigServer,
|
||||
)
|
||||
{
|
||||
this.httpConfig = this.configServer.getConfig(ConfigTypes.HTTP);
|
||||
}
|
||||
|
||||
|
||||
public async onLoad(): Promise<void>
|
||||
{
|
||||
if (globalThis.G_MODS_ENABLED)
|
||||
@ -40,6 +40,3 @@ class ModCallbacks implements OnLoad
|
||||
return "aki-mods";
|
||||
}
|
||||
}
|
||||
|
||||
export { ModCallbacks };
|
||||
|
||||
|
@ -9,8 +9,9 @@ import { INoteActionData } from "@spt-aki/models/eft/notes/INoteActionData";
|
||||
export class NoteCallbacks
|
||||
{
|
||||
constructor(
|
||||
@inject("NoteController") protected noteController: NoteController)
|
||||
{ }
|
||||
@inject("NoteController") protected noteController: NoteController,
|
||||
)
|
||||
{}
|
||||
|
||||
/** Handle AddNote event */
|
||||
public addNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse
|
||||
|
@ -17,8 +17,9 @@ export class NotifierCallbacks
|
||||
@inject("HttpServerHelper") protected httpServerHelper: HttpServerHelper,
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("JsonUtil") protected jsonUtil: JsonUtil,
|
||||
@inject("NotifierController") protected notifierController: NotifierController)
|
||||
{ }
|
||||
@inject("NotifierController") protected notifierController: NotifierController,
|
||||
)
|
||||
{}
|
||||
|
||||
/**
|
||||
* If we don't have anything to send, it's ok to not send anything back
|
||||
@ -26,7 +27,6 @@ export class NotifierCallbacks
|
||||
* until we actually have something to send because otherwise we'd spam the client
|
||||
* and the client would abort the connection due to spam.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public sendNotification(sessionID: string, req: any, resp: any, data: any): void
|
||||
{
|
||||
const splittedUrl = req.url.split("/");
|
||||
@ -43,14 +43,17 @@ export class NotifierCallbacks
|
||||
|
||||
/** Handle push/notifier/get */
|
||||
/** Handle push/notifier/getwebsocket */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData<any[]>
|
||||
{
|
||||
return this.httpResponse.emptyArrayResponse();
|
||||
}
|
||||
|
||||
/** Handle client/notifier/channel/create */
|
||||
public createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<INotifierChannel>
|
||||
public createNotifierChannel(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<INotifierChannel>
|
||||
{
|
||||
return this.httpResponse.getBody(this.notifierController.getChannel(sessionID));
|
||||
}
|
||||
@ -59,17 +62,19 @@ export class NotifierCallbacks
|
||||
* Handle client/game/profile/select
|
||||
* @returns ISelectProfileResponse
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public selectProfile(url: string, info: ISelectProfileRequestData, sessionID: string): IGetBodyResponseData<ISelectProfileResponse>
|
||||
public selectProfile(
|
||||
url: string,
|
||||
info: ISelectProfileRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<ISelectProfileResponse>
|
||||
{
|
||||
return this.httpResponse.getBody({
|
||||
status: "ok"
|
||||
status: "ok",
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public notify(url: string, info: any, sessionID: string): string
|
||||
{
|
||||
return "NOTIFY";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,17 +15,26 @@ export class PresetBuildCallbacks
|
||||
{
|
||||
constructor(
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("PresetBuildController") protected presetBuildController: PresetBuildController)
|
||||
{ }
|
||||
@inject("PresetBuildController") protected presetBuildController: PresetBuildController,
|
||||
)
|
||||
{}
|
||||
|
||||
/** Handle client/handbook/builds/my/list */
|
||||
public getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IUserBuilds>
|
||||
public getHandbookUserlist(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IUserBuilds>
|
||||
{
|
||||
return this.httpResponse.getBody(this.presetBuildController.getUserBuilds(sessionID));
|
||||
}
|
||||
|
||||
/** Handle SaveWeaponBuild event */
|
||||
public saveWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public saveWeaponBuild(
|
||||
pmcData: IPmcData,
|
||||
body: IPresetBuildActionRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.presetBuildController.saveWeaponBuild(pmcData, body, sessionID);
|
||||
}
|
||||
@ -37,20 +46,32 @@ export class PresetBuildCallbacks
|
||||
}
|
||||
|
||||
/** Handle RemoveWeaponBuild event*/
|
||||
public removeWeaponBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public removeWeaponBuild(
|
||||
pmcData: IPmcData,
|
||||
body: IPresetBuildActionRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.presetBuildController.removeWeaponBuild(pmcData, body, sessionID);
|
||||
}
|
||||
|
||||
/** Handle SaveEquipmentBuild event */
|
||||
public saveEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public saveEquipmentBuild(
|
||||
pmcData: IPmcData,
|
||||
body: IPresetBuildActionRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.presetBuildController.saveEquipmentBuild(pmcData, body, sessionID);
|
||||
}
|
||||
|
||||
/** Handle RemoveEquipmentBuild event*/
|
||||
public removeEquipmentBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public removeEquipmentBuild(
|
||||
pmcData: IPmcData,
|
||||
body: IPresetBuildActionRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.presetBuildController.removeEquipmentBuild(pmcData, body, sessionID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,16 +7,16 @@ import { OnLoad } from "@spt-aki/di/OnLoad";
|
||||
export class PresetCallbacks implements OnLoad
|
||||
{
|
||||
constructor(
|
||||
@inject("PresetController") protected presetController: PresetController)
|
||||
{
|
||||
}
|
||||
@inject("PresetController") protected presetController: PresetController,
|
||||
)
|
||||
{}
|
||||
|
||||
public async onLoad(): Promise<void>
|
||||
{
|
||||
this.presetController.initialize();
|
||||
}
|
||||
|
||||
public getRoute(): string
|
||||
public getRoute(): string
|
||||
{
|
||||
return "aki-presets";
|
||||
}
|
||||
|
@ -24,8 +24,9 @@ export class ProfileCallbacks
|
||||
constructor(
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("TimeUtil") protected timeUtil: TimeUtil,
|
||||
@inject("ProfileController") protected profileController: ProfileController)
|
||||
{ }
|
||||
@inject("ProfileController") protected profileController: ProfileController,
|
||||
)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Handle client/game/profile/create
|
||||
@ -33,7 +34,7 @@ export class ProfileCallbacks
|
||||
public createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData<any>
|
||||
{
|
||||
this.profileController.createProfile(info, sessionID);
|
||||
return this.httpResponse.getBody({ uid: `pmc${sessionID}` });
|
||||
return this.httpResponse.getBody({uid: `pmc${sessionID}`});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -49,7 +50,7 @@ export class ProfileCallbacks
|
||||
* Handle client/game/profile/savage/regenerate
|
||||
* Handle the creation of a scav profile for player
|
||||
* Occurs post-raid and when profile first created immediately after character details are confirmed by player
|
||||
* @param url
|
||||
* @param url
|
||||
* @param info empty
|
||||
* @param sessionID Session id
|
||||
* @returns Profile object
|
||||
@ -72,7 +73,11 @@ export class ProfileCallbacks
|
||||
* Handle client/game/profile/nickname/change event
|
||||
* Client allows player to adjust their profile name
|
||||
*/
|
||||
public changeNickname(url: string, info: IProfileChangeNicknameRequestData, sessionID: string): IGetBodyResponseData<any>
|
||||
public changeNickname(
|
||||
url: string,
|
||||
info: IProfileChangeNicknameRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<any>
|
||||
{
|
||||
const output = this.profileController.changeNickname(info, sessionID);
|
||||
|
||||
@ -88,14 +93,18 @@ export class ProfileCallbacks
|
||||
|
||||
return this.httpResponse.getBody({
|
||||
status: 0,
|
||||
nicknamechangedate: this.timeUtil.getTimestamp()
|
||||
nicknamechangedate: this.timeUtil.getTimestamp(),
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle client/game/profile/nickname/validate
|
||||
*/
|
||||
public validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData<any>
|
||||
public validateNickname(
|
||||
url: string,
|
||||
info: IValidateNicknameRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<any>
|
||||
{
|
||||
const output = this.profileController.validateNickname(info, sessionID);
|
||||
|
||||
@ -109,13 +118,12 @@ export class ProfileCallbacks
|
||||
return this.httpResponse.getBody(null, 256, "256 - ");
|
||||
}
|
||||
|
||||
return this.httpResponse.getBody({ status: "ok" });
|
||||
return this.httpResponse.getBody({status: "ok"});
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle client/game/profile/nickname/reserved
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getReservedNickname(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<string>
|
||||
{
|
||||
return this.httpResponse.getBody("SPTarkov");
|
||||
@ -125,7 +133,11 @@ export class ProfileCallbacks
|
||||
* Handle client/profile/status
|
||||
* Called when creating a character when choosing a character face/voice
|
||||
*/
|
||||
public getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<GetProfileStatusResponseData>
|
||||
public getProfileStatus(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<GetProfileStatusResponseData>
|
||||
{
|
||||
const response: GetProfileStatusResponseData = {
|
||||
maxPveCountExceeded: false,
|
||||
@ -141,8 +153,7 @@ export class ProfileCallbacks
|
||||
location: "bigmap",
|
||||
raidMode: "Online",
|
||||
mode: "deathmatch",
|
||||
shortId: "xxx1x1"
|
||||
|
||||
shortId: "xxx1x1",
|
||||
},
|
||||
{
|
||||
profileid: `pmc${sessionID}`,
|
||||
@ -150,9 +161,9 @@ export class ProfileCallbacks
|
||||
status: "Free",
|
||||
sid: "",
|
||||
ip: "",
|
||||
port: 0
|
||||
}
|
||||
]
|
||||
port: 0,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
return this.httpResponse.getBody(response);
|
||||
@ -161,8 +172,11 @@ export class ProfileCallbacks
|
||||
/**
|
||||
* Handle client/profile/settings
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getProfileSettings(url: string, info: IGetProfileSettingsRequest, sessionId: string): IGetBodyResponseData<string>
|
||||
public getProfileSettings(
|
||||
url: string,
|
||||
info: IGetProfileSettingsRequest,
|
||||
sessionId: string,
|
||||
): IGetBodyResponseData<string>
|
||||
{
|
||||
return this.httpResponse.emptyResponse();
|
||||
}
|
||||
@ -170,7 +184,11 @@ export class ProfileCallbacks
|
||||
/**
|
||||
* Handle client/game/profile/search
|
||||
*/
|
||||
public searchFriend(url: string, info: ISearchFriendRequestData, sessionID: string): IGetBodyResponseData<ISearchFriendResponse[]>
|
||||
public searchFriend(
|
||||
url: string,
|
||||
info: ISearchFriendRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<ISearchFriendResponse[]>
|
||||
{
|
||||
return this.httpResponse.getBody(this.profileController.getFriends(info, sessionID));
|
||||
}
|
||||
@ -186,9 +204,8 @@ export class ProfileCallbacks
|
||||
/**
|
||||
* Handle /launcher/profiles
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getAllMiniProfiles(url: string, info: IEmptyRequestData, sessionID: string): string
|
||||
{
|
||||
return this.httpResponse.noBody(this.profileController.getMiniProfiles());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -21,13 +21,18 @@ export class QuestCallbacks
|
||||
constructor(
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("QuestController") protected questController: QuestController,
|
||||
@inject("RepeatableQuestController") protected repeatableQuestController: RepeatableQuestController)
|
||||
{ }
|
||||
@inject("RepeatableQuestController") protected repeatableQuestController: RepeatableQuestController,
|
||||
)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Handle RepeatableQuestChange event
|
||||
*/
|
||||
public changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse
|
||||
public changeRepeatableQuest(
|
||||
pmcData: IPmcData,
|
||||
body: IRepeatableQuestChangeRequest,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.repeatableQuestController.changeRepeatableQuest(pmcData, body, sessionID);
|
||||
}
|
||||
@ -41,14 +46,17 @@ export class QuestCallbacks
|
||||
{
|
||||
return this.questController.acceptRepeatableQuest(pmcData, body, sessionID);
|
||||
}
|
||||
|
||||
return this.questController.acceptQuest(pmcData, body, sessionID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle QuestComplete event
|
||||
*/
|
||||
public completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public completeQuest(
|
||||
pmcData: IPmcData,
|
||||
body: ICompleteQuestRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.questController.completeQuest(pmcData, body, sessionID);
|
||||
}
|
||||
@ -56,7 +64,11 @@ export class QuestCallbacks
|
||||
/**
|
||||
* Handle QuestHandover event
|
||||
*/
|
||||
public handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public handoverQuest(
|
||||
pmcData: IPmcData,
|
||||
body: IHandoverQuestRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.questController.handoverQuest(pmcData, body, sessionID);
|
||||
}
|
||||
@ -72,7 +84,11 @@ export class QuestCallbacks
|
||||
/**
|
||||
* Handle client/repeatalbeQuests/activityPeriods
|
||||
*/
|
||||
public activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IPmcDataRepeatableQuest[]>
|
||||
public activityPeriods(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IPmcDataRepeatableQuest[]>
|
||||
{
|
||||
return this.httpResponse.getBody(this.repeatableQuestController.getClientRepeatableQuests(info, sessionID));
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ export class RagfairCallbacks implements OnLoad, OnUpdate
|
||||
@inject("RagfairServer") protected ragfairServer: RagfairServer,
|
||||
@inject("RagfairController") protected ragfairController: RagfairController,
|
||||
@inject("RagfairTaxService") protected ragfairTaxService: RagfairTaxService,
|
||||
@inject("ConfigServer") protected configServer: ConfigServer
|
||||
@inject("ConfigServer") protected configServer: ConfigServer,
|
||||
)
|
||||
{
|
||||
this.ragfairConfig = this.configServer.getConfig(ConfigTypes.RAGFAIR);
|
||||
@ -67,7 +67,6 @@ export class RagfairCallbacks implements OnLoad, OnUpdate
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -81,8 +80,11 @@ export class RagfairCallbacks implements OnLoad, OnUpdate
|
||||
}
|
||||
|
||||
/** Handle client/ragfair/itemMarketPrice */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData<IGetItemPriceResult>
|
||||
public getMarketPrice(
|
||||
url: string,
|
||||
info: IGetMarketPriceRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<IGetItemPriceResult>
|
||||
{
|
||||
return this.httpResponse.getBody(this.ragfairController.getItemMinAvgMaxFleaPriceValues(info));
|
||||
}
|
||||
@ -93,7 +95,7 @@ export class RagfairCallbacks implements OnLoad, OnUpdate
|
||||
return this.ragfairController.addPlayerOffer(pmcData, info, sessionID);
|
||||
}
|
||||
|
||||
/** \Handle RagFairRemoveOffer event */
|
||||
/** Handle RagFairRemoveOffer event */
|
||||
public removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse
|
||||
{
|
||||
return this.ragfairController.removeOffer(info.offerId, sessionID);
|
||||
@ -109,23 +111,28 @@ export class RagfairCallbacks implements OnLoad, OnUpdate
|
||||
* Handle /client/items/prices
|
||||
* Called when clicking an item to list on flea
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getFleaPrices(url: string, request: IEmptyRequestData, sessionID: string): IGetBodyResponseData<Record<string, number>>
|
||||
public getFleaPrices(
|
||||
url: string,
|
||||
request: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<Record<string, number>>
|
||||
{
|
||||
return this.httpResponse.getBody(this.ragfairController.getAllFleaPrices());
|
||||
}
|
||||
|
||||
/** Handle client/reports/ragfair/send */
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData
|
||||
{
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
|
||||
public storePlayerOfferTaxAmount(url: string, request: IStorePlayerOfferTaxAmountRequestData, sessionId: string): INullResponseData
|
||||
public storePlayerOfferTaxAmount(
|
||||
url: string,
|
||||
request: IStorePlayerOfferTaxAmountRequestData,
|
||||
sessionId: string,
|
||||
): INullResponseData
|
||||
{
|
||||
this.ragfairTaxService.storeClientOfferTaxValue(sessionId, request);
|
||||
return this.httpResponse.nullResponse();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -10,8 +10,9 @@ import { ITraderRepairActionDataRequest } from "@spt-aki/models/eft/repair/ITrad
|
||||
export class RepairCallbacks
|
||||
{
|
||||
constructor(
|
||||
@inject("RepairController") protected repairController: RepairController)
|
||||
{ }
|
||||
@inject("RepairController") protected repairController: RepairController,
|
||||
)
|
||||
{}
|
||||
|
||||
/**
|
||||
* Handle TraderRepair event
|
||||
@ -21,7 +22,11 @@ export class RepairCallbacks
|
||||
* @param sessionID Session id
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
public traderRepair(pmcData: IPmcData, traderRepairRequest: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse
|
||||
public traderRepair(
|
||||
pmcData: IPmcData,
|
||||
traderRepairRequest: ITraderRepairActionDataRequest,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.repairController.traderRepair(sessionID, traderRepairRequest, pmcData);
|
||||
}
|
||||
@ -34,8 +39,12 @@ export class RepairCallbacks
|
||||
* @param sessionID Session id
|
||||
* @returns IItemEventRouterResponse
|
||||
*/
|
||||
public repair(pmcData: IPmcData, repairRequest: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse
|
||||
public repair(
|
||||
pmcData: IPmcData,
|
||||
repairRequest: IRepairActionDataRequest,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.repairController.repairWithKit(sessionID, repairRequest, pmcData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,18 +14,18 @@ export class SaveCallbacks implements OnLoad, OnUpdate
|
||||
|
||||
constructor(
|
||||
@inject("SaveServer") protected saveServer: SaveServer,
|
||||
@inject("ConfigServer") protected configServer: ConfigServer
|
||||
@inject("ConfigServer") protected configServer: ConfigServer,
|
||||
)
|
||||
{
|
||||
this.coreConfig = this.configServer.getConfig(ConfigTypes.CORE);
|
||||
}
|
||||
|
||||
|
||||
public async onLoad(): Promise<void>
|
||||
{
|
||||
this.saveServer.load();
|
||||
}
|
||||
|
||||
public getRoute(): string
|
||||
public getRoute(): string
|
||||
{
|
||||
return "aki-save";
|
||||
}
|
||||
@ -38,7 +38,6 @@ export class SaveCallbacks implements OnLoad, OnUpdate
|
||||
this.saveServer.save();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,28 +11,40 @@ import { ISellScavItemsToFenceRequestData } from "@spt-aki/models/eft/trade/ISel
|
||||
export class TradeCallbacks
|
||||
{
|
||||
constructor(
|
||||
@inject("TradeController") protected tradeController: TradeController
|
||||
@inject("TradeController") protected tradeController: TradeController,
|
||||
)
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* Handle client/game/profile/items/moving TradingConfirm event
|
||||
*/
|
||||
public processTrade(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public processTrade(
|
||||
pmcData: IPmcData,
|
||||
body: IProcessBaseTradeRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
// body can be IProcessBuyTradeRequestData or IProcessSellTradeRequestData
|
||||
return this.tradeController.confirmTrading(pmcData, body, sessionID);
|
||||
}
|
||||
|
||||
/** Handle RagFairBuyOffer event */
|
||||
public processRagfairTrade(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public processRagfairTrade(
|
||||
pmcData: IPmcData,
|
||||
body: IProcessRagfairTradeRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.tradeController.confirmRagfairTrading(pmcData, body, sessionID);
|
||||
}
|
||||
|
||||
/** Handle SellAllFromSavage event */
|
||||
public sellAllFromSavage(pmcData: IPmcData, body: ISellScavItemsToFenceRequestData, sessionID: string): IItemEventRouterResponse
|
||||
public sellAllFromSavage(
|
||||
pmcData: IPmcData,
|
||||
body: ISellScavItemsToFenceRequestData,
|
||||
sessionID: string,
|
||||
): IItemEventRouterResponse
|
||||
{
|
||||
return this.tradeController.sellScavItemsToFence(pmcData, body, sessionID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,10 +12,11 @@ import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
||||
export class TraderCallbacks implements OnLoad, OnUpdate
|
||||
{
|
||||
constructor(
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("TraderController") protected traderController: TraderController) // TODO: delay required
|
||||
{
|
||||
}
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil, // TODO: delay required
|
||||
@inject("TraderController") protected traderController: TraderController,
|
||||
)
|
||||
{}
|
||||
|
||||
public async onLoad(): Promise<void>
|
||||
{
|
||||
this.traderController.load();
|
||||
@ -26,13 +27,17 @@ export class TraderCallbacks implements OnLoad, OnUpdate
|
||||
return this.traderController.update();
|
||||
}
|
||||
|
||||
public getRoute(): string
|
||||
public getRoute(): string
|
||||
{
|
||||
return "aki-traders";
|
||||
}
|
||||
|
||||
/** Handle client/trading/api/traderSettings */
|
||||
public getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ITraderBase[]>
|
||||
public getTraderSettings(
|
||||
url: string,
|
||||
info: IEmptyRequestData,
|
||||
sessionID: string,
|
||||
): IGetBodyResponseData<ITraderBase[]>
|
||||
{
|
||||
return this.httpResponse.getBody(this.traderController.getAllTraders(sessionID));
|
||||
}
|
||||
@ -50,4 +55,4 @@ export class TraderCallbacks implements OnLoad, OnUpdate
|
||||
const traderID = url.replace("/client/trading/api/getTraderAssort/", "");
|
||||
return this.httpResponse.getBody(this.traderController.getAssort(sessionID, traderID));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,17 +11,16 @@ export class WeatherCallbacks
|
||||
{
|
||||
constructor(
|
||||
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
||||
@inject("WeatherController") protected weatherController: WeatherController
|
||||
@inject("WeatherController") protected weatherController: WeatherController,
|
||||
)
|
||||
{ }
|
||||
{}
|
||||
|
||||
/**
|
||||
* Handle client/weather
|
||||
* @returns IWeatherData
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
public getWeather(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IWeatherData>
|
||||
{
|
||||
return this.httpResponse.getBody(this.weatherController.generate());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,9 @@ import { IWishlistActionData } from "@spt-aki/models/eft/wishlist/IWishlistActio
|
||||
export class WishlistCallbacks
|
||||
{
|
||||
constructor(
|
||||
@inject("WishlistController") protected wishlistController: WishlistController)
|
||||
{ }
|
||||
@inject("WishlistController") protected wishlistController: WishlistController,
|
||||
)
|
||||
{}
|
||||
|
||||
/** Handle AddToWishList event */
|
||||
public addToWishlist(pmcData: IPmcData, body: IWishlistActionData, sessionID: string): IItemEventRouterResponse
|
||||
@ -23,4 +24,4 @@ export class WishlistCallbacks
|
||||
{
|
||||
return this.wishlistController.removeFromWishList(pmcData, body, sessionID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user