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

Constructors

new
HealthHelper(
jsonUtil: JsonUtil,
logger: ILogger,
timeUtil: TimeUtil,
saveServer: SaveServer,
configServer: ConfigServer,
)

Properties

protected
configServer: ConfigServer
protected
healthConfig: IHealthConfig
protected
jsonUtil: JsonUtil
protected
logger: ILogger
protected
saveServer: SaveServer
protected
timeUtil: TimeUtil

Methods

protected
addEffect(
pmcData: IPmcData,
effectBodyPart: string,
effectType: string,
duration?: number,
): void

Add effect to body part in profile

protected
isEmpty(map: Record<string, { Time: number; }>): boolean
protected
saveEffects(
pmcData: IPmcData,
sessionId: string,
bodyPartsWithEffects: Effects,
deleteExistingEffects?: boolean,
): void

Save effects to profile Works by removing all effects and adding them back from profile Removes empty 'Effects' objects if found

protected
saveHealth(pmcData: IPmcData, sessionID: string): void

Adjust hydration/energy/temperate and body part hp values in player profile to values in profile.vitality

resetVitality(sessionID: string): IAkiProfile

Resets the profiles vitality/health and vitality/effects properties to their defaults

saveVitality(
pmcData: IPmcData,
sessionID: string,
addEffects?: boolean,
deleteExistingEffects?: boolean,
): void

Update player profile with changes from request object