Skip to main content
The Deno 2 Release Candidate is here
Learn more
Latest
class ProfileHelper
Re-export
import { ProfileHelper } from "https://deno.land/x/sptaki@1.2.0/helpers/mod.ts";

Constructors

new
ProfileHelper(
logger: ILogger,
jsonUtil: JsonUtil,
hashUtil: HashUtil,
watermark: Watermark,
timeUtil: TimeUtil,
saveServer: SaveServer,
databaseServer: DatabaseServer,
itemHelper: ItemHelper,
profileSnapshotService: ProfileSnapshotService,
localisationService: LocalisationService,
configServer: ConfigServer,
)

Properties

protected
configServer: ConfigServer
protected
databaseServer: DatabaseServer
protected
hashUtil: HashUtil
protected
inventoryConfig: IInventoryConfig
protected
itemHelper: ItemHelper
protected
jsonUtil: JsonUtil
protected
localisationService: LocalisationService
protected
logger: ILogger
protected
profileSnapshotService: ProfileSnapshotService
protected
saveServer: SaveServer
protected
timeUtil: TimeUtil
protected
watermark: Watermark

Methods

protected
getServerVersion(): string
protected
isWiped(sessionID: string): boolean

is this profile flagged for data removal

protected
postRaidXpWorkaroundFix(
sessionId: string,
output: IPmcData[],
pmcProfile: IPmcData,
scavProfile: IPmcData,
): IPmcData[]

Fix xp doubling on post-raid xp reward screen by sending a 'dummy' profile to the post-raid screen Server saves the post-raid changes prior to the xp screen getting the profile, this results in the xp screen using the now updated profile values as a base, meaning it shows x2 xp gained Instead, clone the post-raid profile (so we dont alter its values), apply the pre-raid xp values to the cloned objects and return Delete snapshot of pre-raid profile prior to returning profile data

protected
profileHasInfoProperty(profile: IAkiProfile): boolean
protected
stringsMatch(stringA: string, stringB: string): boolean
addExperienceToPmc(sessionID: string, experienceToAdd: number): void

Add experience to a PMC inside the players profile

addGiftReceivedFlagToProfile(playerId: string, giftId: string): void

Flag a profile as having received a gift Store giftid in profile aki object

addSkillPointsToPlayer(
pmcProfile: IPmcData,
skill: SkillTypes,
pointsToAdd: number,
useSkillProgressRateMultipler?: boolean,
): void

Add points to a specific skill in player profile

addStashRowsBonusToProfile(sessionId: string, rowsToAdd: number): void

Add stash row bonus to profile or increments rows given count if it already exists

getCompleteProfile(sessionID: string): IPmcData[]

Get the pmc and scav profiles as an array by profile id

Get baseline counter values for a fresh profile

getExperience(level: number): number

Get the experiecne for the given level

getFullProfile(sessionID: string): IAkiProfile

Get full representation of a players profile json

getMaxLevel(): number

Get the max level a player can be

getPmcProfile(sessionID: string): IPmcData

Get a PMC profile by its session id

getProfileByPmcId(pmcId: string): IPmcData

Iterate all profiles and find matching pmc profile by provided id

getProfiles(): Record<string, IAkiProfile>

Get all profiles from server

getScavProfile(sessionID: string): IPmcData

Get a full profiles scav-specific sub-profile

Get a speciic common skill from supplied profile

hasEliteSkillLevel(skillType: SkillTypes, pmcProfile: IPmcData): boolean

Check if player has a skill at elite level

incrementStatCounter(counters: CounterKeyValue[], keyToIncrement: string): void

Find Stat in profile counters and increment by one

isDeveloperAccount(sessionID: string): boolean

Is the provided session id for a developer account

isNicknameTaken(nicknameRequest: IValidateNicknameRequestData, sessionID: string): boolean

Check if a nickname is used by another profile loaded by the server

playerHasRecievedGift(playerId: string, giftId: string): boolean

Check if profile has recieved a gift by id

removeQuestConditionFromProfile(pmcData: IPmcData, questConditionId: Record<string, string>): void

Remove/reset a completed quest condtion from players profile quest data

Iterate over player profile inventory items and find the secure container and remove it