Add comments + improve comment consistency

This commit is contained in:
Dev 2023-07-15 10:56:00 +01:00
parent 195d0e3b1d
commit d2c2a39075
10 changed files with 97 additions and 38 deletions

View File

@ -36,6 +36,9 @@ export class BundleCallbacks
this.httpFileUtil.sendFile(resp, bundle.path);
}
/**
* Handle singleplayer/bundles
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getBundles(url: string, info: any, sessionID: string): string
{

View File

@ -23,8 +23,8 @@ export class CustomizationCallbacks
{ }
/**
* Handles client/trading/customization/storage
* @returns
* Handle client/trading/customization/storage
* @returns IGetSuitsResponse
*/
public getSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetSuitsResponse>
{
@ -36,7 +36,7 @@ export class CustomizationCallbacks
}
/**
* Handles client/trading/customization
* Handle client/trading/customization
* @returns ISuit[]
*/
public getTraderSuits(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<ISuit[]>
@ -47,11 +47,17 @@ export class CustomizationCallbacks
return this.httpResponse.getBody(this.customizationController.getTraderSuits(traderID, sessionID));
}
/**
* Handle CustomizationWear event
*/
public wearClothing(pmcData: IPmcData, body: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse
{
return this.customizationController.wearClothing(pmcData, body, sessionID);
}
/**
* Handle CustomizationBuy event
*/
public buyClothing(pmcData: IPmcData, body: IBuyClothingRequestData, sessionID: string): IItemEventRouterResponse
{
return this.customizationController.buyClothing(pmcData, body, sessionID);

View File

@ -33,7 +33,7 @@ export class DataCallbacks
{ }
/**
* Handles client/settings
* Handle client/settings
* @returns ISettingsBase
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -43,7 +43,7 @@ export class DataCallbacks
}
/**
* Handles client/globals
* Handle client/globals
* @returns IGlobals
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -54,7 +54,7 @@ export class DataCallbacks
}
/**
* Handles client/items
* Handle client/items
* @returns string
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -64,7 +64,7 @@ export class DataCallbacks
}
/**
* Handles client/handbook/templates
* Handle client/handbook/templates
* @returns IHandbookBase
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -74,7 +74,7 @@ export class DataCallbacks
}
/**
* Handles client/customization
* Handle client/customization
* @returns Record<string, ICustomizationItem
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -84,7 +84,7 @@ export class DataCallbacks
}
/**
* Handles client/account/customization
* Handle client/account/customization
* @returns string[]
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
@ -99,6 +99,10 @@ export class DataCallbacks
return this.httpResponse.getBody(Object.values(this.databaseServer.getTables().templates.quests));
}
/**
* 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>
{
@ -123,18 +127,27 @@ export class DataCallbacks
return this.httpResponse.getBody(this.databaseServer.getTables().hideout.scavcase);
}
/**
* Handle client/languages
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getLocalesLanguages(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<Record<string, string>>
{
return this.httpResponse.getBody(this.databaseServer.getTables().locales.languages);
}
/**
* 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/", "")]);
}
/**
* Handle client/locale
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getLocalesGlobal(url: string, info: IEmptyRequestData, sessionID: string): string
{

View File

@ -44,7 +44,7 @@ export class DialogueCallbacks implements OnUpdate
}
/**
* Handles client/friend/list
* Handle client/friend/list
* @returns IGetFriendListDataResponse
*/
public getFriendList(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IGetFriendListDataResponse>
@ -53,8 +53,8 @@ export class DialogueCallbacks implements OnUpdate
}
/**
* Handles client/chatServer/list
* @returns
* 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[]>
@ -106,18 +106,21 @@ export class DialogueCallbacks implements OnUpdate
return this.httpResponse.emptyArrayResponse();
}
/** Handle client/mail/dialog/pin */
public pinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData<any[]>
{
this.dialogueController.setDialoguePin(info.dialogId, true, sessionID);
return this.httpResponse.emptyArrayResponse();
}
/** Handle client/mail/dialog/unpin */
public unpinDialog(url: string, info: IPinDialogRequestData, sessionID: string): IGetBodyResponseData<any[]>
{
this.dialogueController.setDialoguePin(info.dialogId, false, sessionID);
return this.httpResponse.emptyArrayResponse();
}
/** Handle client/mail/dialog/read */
public setRead(url: string, info: ISetDialogReadRequestData, sessionID: string): IGetBodyResponseData<any[]>
{
this.dialogueController.setRead(info.dialogs, sessionID);
@ -125,7 +128,7 @@ export class DialogueCallbacks implements OnUpdate
}
/**
* Handles client/mail/dialog/getAllAttachments
* Handle client/mail/dialog/getAllAttachments
* @returns IGetAllAttachmentsResponse
*/
public getAllAttachments(url: string, info: IGetAllAttachmentsRequestData, sessionID: string): IGetBodyResponseData<IGetAllAttachmentsResponse>

View File

@ -40,7 +40,7 @@ export class InsuranceCallbacks implements OnUpdate
}
/**
* Handle Insure
* Handle Insure event
* @returns IItemEventRouterResponse
*/
public insure(pmcData: IPmcData, body: IInsureRequestData, sessionID: string): IItemEventRouterResponse

View File

@ -31,6 +31,9 @@ export class ProfileCallbacks
@inject("ProfileController") protected profileController: ProfileController)
{ }
/**
* Handle client/game/profile/create
*/
public createProfile(url: string, info: IProfileCreateRequestData, sessionID: string): IGetBodyResponseData<any>
{
this.profileController.createProfile(info, sessionID);
@ -38,11 +41,8 @@ export class ProfileCallbacks
}
/**
* Handle client/game/profile/list
* Get the complete player profile (scav + pmc character)
* @param url
* @param info Empty
* @param sessionID Session id
* @returns Profile object
*/
public getProfileData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IPmcData[]>
{
@ -50,6 +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
@ -64,10 +65,6 @@ export class ProfileCallbacks
/**
* Handle client/game/profile/voice/change event
* @param url
* @param info Change voice request object
* @param sessionID Session id
* @returns Client response
*/
public changeVoice(url: string, info: IProfileChangeVoiceRequestData, sessionID: string): INullResponseData
{
@ -78,10 +75,6 @@ export class ProfileCallbacks
/**
* Handle client/game/profile/nickname/change event
* Client allows player to adjust their profile name
* @param url
* @param info Change nickname request object
* @param sessionID Session id
* @returns client response
*/
public changeNickname(url: string, info: IProfileChangeNicknameRequestData, sessionID: string): IGetBodyResponseData<any>
{
@ -103,6 +96,9 @@ export class ProfileCallbacks
});
}
/**
* Handle client/game/profile/nickname/validate
*/
public validateNickname(url: string, info: IValidateNicknameRequestData, sessionID: string): IGetBodyResponseData<any>
{
const output = this.profileController.validateNickname(info, sessionID);
@ -120,6 +116,9 @@ export class ProfileCallbacks
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>
{
@ -127,11 +126,8 @@ export class ProfileCallbacks
}
/**
* Handle client/profile/status
* Called when creating a character when choosing a character face/voice
* @param url
* @param info response (empty)
* @param sessionID
* @returns
*/
public getProfileStatus(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<GetProfileStatusResponseData>
{
@ -166,22 +162,34 @@ export class ProfileCallbacks
return this.httpResponse.getBody(response);
}
/**
* Handle client/profile/settings
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getProfileSettings(url: string, info: IGetProfileSettingsRequest, sessionId: string): IGetBodyResponseData<string>
{
return this.httpResponse.emptyResponse();
}
/**
* Handle client/game/profile/search
*/
public searchFriend(url: string, info: ISearchFriendRequestData, sessionID: string): IGetBodyResponseData<ISearchFriendResponse[]>
{
return this.httpResponse.getBody(this.profileController.getFriends(info, sessionID));
}
/**
* Handle launcher/profile/info
*/
public getMiniProfile(url: string, info: IGetMiniProfileRequestData, sessionID: string): string
{
return this.httpResponse.noBody(this.profileController.getMiniProfile(sessionID));
}
/**
* Handle /launcher/profiles
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getAllMiniProfiles(url: string, info: any, sessionID: string): string
{

View File

@ -24,11 +24,17 @@ export class QuestCallbacks
@inject("RepeatableQuestController") protected repeatableQuestController: RepeatableQuestController)
{ }
/**
* Handle RepeatableQuestChange event
*/
public changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse
{
return this.repeatableQuestController.changeRepeatableQuest(pmcData, body, sessionID);
}
/**
* Handle QuestAccept event
*/
public acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse
{
if (body.type === "repeatable")
@ -39,11 +45,17 @@ export class QuestCallbacks
return this.questController.acceptQuest(pmcData, body, sessionID);
}
/**
* Handle QuestComplete event
*/
public completeQuest(pmcData: IPmcData, body: ICompleteQuestRequestData, sessionID: string): IItemEventRouterResponse
{
return this.questController.completeQuest(pmcData, body, sessionID);
}
/**
* Handle QuestHandover event
*/
public handoverQuest(pmcData: IPmcData, body: IHandoverQuestRequestData, sessionID: string): IItemEventRouterResponse
{
return this.questController.handoverQuest(pmcData, body, sessionID);
@ -51,16 +63,15 @@ export class QuestCallbacks
/**
* Handle client/quest/list
* @param url
* @param info
* @param sessionID
* @returns
*/
public listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData<IQuest[]>
{
return this.httpResponse.getBody(this.questController.getClientQuests(sessionID));
}
/**
* Handle client/repeatalbeQuests/activityPeriods
*/
public activityPeriods(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData<IPmcDataRepeatableQuest[]>
{
return this.httpResponse.getBody(this.repeatableQuestController.getClientRepeatableQuests(info, sessionID));

View File

@ -51,7 +51,10 @@ export class CustomizationController
return matchingSuits.filter(x => templates[x.suiteId]._props.Side.includes(pmcData.Info.Side));
}
/** Equip one to many clothing items to player */
/**
* Handle CustomizationWear event
* Equip one to many clothing items to player
*/
public wearClothing(pmcData: IPmcData, wearClothingRequest: IWearClothingRequestData, sessionID: string): IItemEventRouterResponse
{
for (const suitId of wearClothingRequest.suites)
@ -77,6 +80,7 @@ export class CustomizationController
}
/**
* Handle CustomizationBuy event
* Purchase/unlock a clothing item from a trader
* @param pmcData Player profile
* @param buyClothingRequest Request object
@ -122,8 +126,8 @@ export class CustomizationController
/**
* Has an outfit been purchased by a player
* @param suitId clothing id
* @param sessionID Session id
* @returns true if purchased already
* @param sessionID Session id of profile to check for clothing in
* @returns true if already purchased
*/
protected outfitAlreadyPurchased(suitId: string, sessionID: string): boolean
{
@ -151,7 +155,6 @@ export class CustomizationController
* @param pmcData Player profile
* @param clothingItem Clothing item purchased
* @param output Client response
* @returns
*/
protected payForClothingItem(sessionId: string, pmcData: IPmcData, clothingItem: ClothingItem, output: IItemEventRouterResponse): void
{

View File

@ -21,6 +21,7 @@ export class DialogueController
)
{ }
/** Handle onUpdate spt event */
public update(): void
{
const profiles = this.saveServer.getProfiles();
@ -30,6 +31,10 @@ export class DialogueController
}
}
/**
* Handle client/friend/list
* @returns IGetFriendListDataResponse
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
public getFriendList(sessionID: string): IGetFriendListDataResponse
{
@ -41,6 +46,7 @@ export class DialogueController
}
/**
* Handle client/mail/dialog/list
* Create array holding trader dialogs and mail interactions with player
* Set the content of the dialogue on the list tab.
* @param sessionID Session Id
@ -81,6 +87,7 @@ export class DialogueController
}
/**
* Handle client/mail/dialog/view
* Handle player clicking 'messenger' and seeing all the messages they've recieved
* Set the content of the dialogue on the details panel, showing all the messages
* for the specified dialogue.
@ -156,6 +163,7 @@ export class DialogueController
return messages.some(x => x.items?.data?.length > 0);
}
/** Handle client/mail/dialog/remove */
public removeDialogue(dialogueID: string, sessionID: string): void
{
delete this.saveServer.getProfile(sessionID).dialogues[dialogueID];
@ -166,6 +174,7 @@ export class DialogueController
this.saveServer.getProfile(sessionID).dialogues[dialogueID].pinned = shouldPin;
}
/** Handle client/mail/dialog/read */
public setRead(dialogueIDs: string[], sessionID: string): void
{
const dialogueData = this.saveServer.getProfile(sessionID).dialogues;
@ -177,6 +186,7 @@ export class DialogueController
}
/**
* Handle client/mail/dialog/getAllAttachments
* Get all uncollected items attached to mail in a particular dialog
* @param dialogueID Dialog to get mail attachments from
* @param sessionID Session id

View File

@ -146,6 +146,7 @@ export class InsuranceController
}
/**
* Handle Insure event
* Add insurance to an item
* @param pmcData Player profile
* @param body Insurance request
@ -205,6 +206,7 @@ export class InsuranceController
}
/**
* Handle client/insurance/items/list/cost
* Calculate insurance cost
* @param info request object
* @param sessionID session id