Further comment improvements

This commit is contained in:
Dev 2023-07-15 11:00:35 +01:00
parent 76804c0326
commit 5d20b6b781
5 changed files with 41 additions and 8 deletions

View File

@ -49,6 +49,9 @@ export class ProfileController
) )
{ } { }
/**
* Handle /launcher/profiles
*/
public getMiniProfiles(): IMiniProfile[] public getMiniProfiles(): IMiniProfile[]
{ {
const miniProfiles: IMiniProfile[] = []; const miniProfiles: IMiniProfile[] = [];
@ -61,6 +64,9 @@ export class ProfileController
return miniProfiles; return miniProfiles;
} }
/**
* Handle launcher/profile/info
*/
public getMiniProfile(sessionID: string): any public getMiniProfile(sessionID: string): any
{ {
const maxlvl = this.profileHelper.getMaxLevel(); const maxlvl = this.profileHelper.getMaxLevel();
@ -100,11 +106,17 @@ export class ProfileController
return result; return result;
} }
/**
* Handle client/game/profile/list
*/
public getCompleteProfile(sessionID: string): IPmcData[] public getCompleteProfile(sessionID: string): IPmcData[]
{ {
return this.profileHelper.getCompleteProfile(sessionID); return this.profileHelper.getCompleteProfile(sessionID);
} }
/**
* Handle client/game/profile/create
*/
public createProfile(info: IProfileCreateRequestData, sessionID: string): void public createProfile(info: IProfileCreateRequestData, sessionID: string): void
{ {
const account = this.saveServer.getProfile(sessionID).info; const account = this.saveServer.getProfile(sessionID).info;
@ -117,7 +129,7 @@ export class ProfileController
this.saveServer.deleteProfileById(sessionID); this.saveServer.deleteProfileById(sessionID);
} }
// pmc // PMC
pmcData._id = `pmc${sessionID}`; pmcData._id = `pmc${sessionID}`;
pmcData.aid = sessionID; pmcData.aid = sessionID;
pmcData.savage = `scav${sessionID}`; pmcData.savage = `scav${sessionID}`;
@ -181,11 +193,11 @@ export class ProfileController
this.traderHelper.resetTrader(sessionID, traderID); this.traderHelper.resetTrader(sessionID, traderID);
} }
// store minimal profile and reload it // Store minimal profile and reload it
this.saveServer.saveProfile(sessionID); this.saveServer.saveProfile(sessionID);
this.saveServer.loadProfile(sessionID); this.saveServer.loadProfile(sessionID);
// completed account creation // Completed account creation
this.saveServer.getProfile(sessionID).info.wipe = false; this.saveServer.getProfile(sessionID).info.wipe = false;
this.saveServer.saveProfile(sessionID); this.saveServer.saveProfile(sessionID);
} }
@ -207,7 +219,7 @@ export class ProfileController
/** /**
* Generate a player scav object * Generate a player scav object
* pmc profile MUST exist first before pscav can be generated * PMC profile MUST exist first before pscav can be generated
* @param sessionID * @param sessionID
* @returns IPmcData object * @returns IPmcData object
*/ */
@ -216,6 +228,9 @@ export class ProfileController
return this.playerScavGenerator.generate(sessionID); return this.playerScavGenerator.generate(sessionID);
} }
/**
* Handle client/game/profile/nickname/validate
*/
public validateNickname(info: IValidateNicknameRequestData, sessionID: string): string public validateNickname(info: IValidateNicknameRequestData, sessionID: string): string
{ {
if (info.nickname.length < 3) if (info.nickname.length < 3)
@ -231,6 +246,10 @@ export class ProfileController
return "OK"; return "OK";
} }
/**
* Handle client/game/profile/nickname/change event
* Client allows player to adjust their profile name
*/
public changeNickname(info: IProfileChangeNicknameRequestData, sessionID: string): string public changeNickname(info: IProfileChangeNicknameRequestData, sessionID: string): string
{ {
const output = this.validateNickname(info, sessionID); const output = this.validateNickname(info, sessionID);
@ -246,12 +265,18 @@ export class ProfileController
return output; return output;
} }
/**
* Handle client/game/profile/voice/change event
*/
public changeVoice(info: IProfileChangeVoiceRequestData, sessionID: string): void public changeVoice(info: IProfileChangeVoiceRequestData, sessionID: string): void
{ {
const pmcData = this.profileHelper.getPmcProfile(sessionID); const pmcData = this.profileHelper.getPmcProfile(sessionID);
pmcData.Info.Voice = info.voice; pmcData.Info.Voice = info.voice;
} }
/**
* Handle client/game/profile/search
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars // eslint-disable-next-line @typescript-eslint/no-unused-vars
public getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[] public getFriends(info: ISearchFriendRequestData, sessionID: string): ISearchFriendResponse[]
{ {

View File

@ -58,6 +58,7 @@ export class QuestController
} }
/** /**
* Handle client/quest/list
* Get all quests visible to player * Get all quests visible to player
* Exclude quests with incomplete preconditions (level/loyalty) * Exclude quests with incomplete preconditions (level/loyalty)
* @param sessionID session id * @param sessionID session id
@ -237,6 +238,7 @@ export class QuestController
} }
/** /**
* Handle QuestAccept event
* Handle the client accepting a quest and starting it * Handle the client accepting a quest and starting it
* Send starting rewards if any to player and * Send starting rewards if any to player and
* Send start notification if any to player * Send start notification if any to player
@ -359,9 +361,10 @@ export class QuestController
} }
/** /**
* Handle QuestComplete event
* Update completed quest in profile * Update completed quest in profile
* Add newly unlocked quests to profile * Add newly unlocked quests to profile
* Also recalculate thier level due to exp rewards * Also recalculate their level due to exp rewards
* @param pmcData Player profile * @param pmcData Player profile
* @param body Completed quest request * @param body Completed quest request
* @param sessionID Session id * @param sessionID Session id
@ -535,7 +538,7 @@ export class QuestController
} }
/** /**
* * Handle QuestHandover event
* @param pmcData Player profile * @param pmcData Player profile
* @param handoverQuestRequest handover item request * @param handoverQuestRequest handover item request
* @param sessionID Session id * @param sessionID Session id

View File

@ -454,7 +454,7 @@ export class InventoryHelper
} }
/** /**
* Remove item from player inventory * Remove item from player inventory + insured items array
* @param pmcData Profile to remove item from * @param pmcData Profile to remove item from
* @param itemId Items id to remove * @param itemId Items id to remove
* @param sessionID Session id * @param sessionID Session id

View File

@ -34,6 +34,9 @@ export class BundleLoader
) )
{ } { }
/**
* Handle singleplayer/bundles
*/
public getBundles(local: boolean): BundleInfo[] public getBundles(local: boolean): BundleInfo[]
{ {
const result: BundleInfo[] = []; const result: BundleInfo[] = [];
@ -71,7 +74,8 @@ export class BundleLoader
} }
} }
public addBundle(key: string, b: BundleInfo): void { public addBundle(key: string, b: BundleInfo): void
{
this.bundles[key] = b; this.bundles[key] = b;
} }
} }

View File

@ -7,6 +7,7 @@ export interface IAkiProfile
{ {
info: Info info: Info
characters: Characters characters: Characters
/** Clothing purchases */
suits: string[] suits: string[]
weaponbuilds: WeaponBuild[] weaponbuilds: WeaponBuild[]
dialogues: Record<string, Dialogue> dialogues: Record<string, Dialogue>