Interface: RoutineHandlerInterface
Defined in: src/interface/activity/RoutineHandlerInterface.ts:10
Handler that manages the routine of the characters: the commitments (fixed or added during the game session) and the rooms where they take place.
Properties
characterCommitments
> readonly characterCommitments: object
Defined in: src/interface/activity/RoutineHandlerInterface.ts:20
The commitments that are currently active, grouped by character id. Each value is a tuple with the commitment and the id of the room where it takes place. If a character has two or more commitments at the same time, only the one with the highest priority is kept.
Index Signature
[character: string]: [CommitmentInterface, string]
commitmentsIds
> readonly commitmentsIds: string[]
Defined in: src/interface/activity/RoutineHandlerInterface.ts:14
The ids of all the commitments: the fixed ones and the ones added during the game session.
currentRoutine
> readonly currentRoutine: CommitmentInterface[]
Defined in: src/interface/activity/RoutineHandlerInterface.ts:29
The current commitments. The hidden commitments are not included. In case there is a character who has two or more commitments at the same time, will be selected the commitment with the highest priority. Higher priority commitments are calculated using the following steps:
- The commitments that have Commitments BaseModel.priority set to a higher value will be selected first.
- If there are commitments with the same priority, the commitments that are not fixed will be selected first.
- If there are commitments with the same priority and the same fixed status, priority will be given to the commitment with a lower index.
roomCommitments
> readonly roomCommitments: object
Defined in: src/interface/activity/RoutineHandlerInterface.ts:33
The current commitments grouped by the id of the room where they take place.
Index Signature
[roomId: string]: CommitmentInterface[]
Methods
add()
> add(commitment, roomId, options?): void
Defined in: src/interface/activity/RoutineHandlerInterface.ts:40
Add commitments during the game session.
Parameters
commitment
string | CommitmentInterface | (string | CommitmentInterface)[]
The commitment or commitments (or their ids) to add.
roomId
string
The id of the room where the commitment is.
options?
The scheduling options of the commitment (e.g. when it starts and ends).
Returns
void
clearExpiredRoutine()
> clearExpiredRoutine(): void
Defined in: src/interface/activity/RoutineHandlerInterface.ts:63
Clear all the expired commitments.
Returns
void
find()
> find(id): CommitmentInterface | undefined
Defined in: src/interface/activity/RoutineHandlerInterface.ts:53
Get a registered commitment by its id.
Parameters
id
string
The id of the commitment.
Returns
CommitmentInterface | undefined
The commitment or undefined if not found.
getCommitmentByCharacter()
> getCommitmentByCharacter(character): CommitmentInterface | undefined
Defined in: src/interface/activity/RoutineHandlerInterface.ts:69
Get the current commitment of a character.
Parameters
character
string | CharacterInterface
The character or the character id.
Returns
CommitmentInterface | undefined
The commitment or undefined if not found.
remove()
> remove(commitment, roomId?): void
Defined in: src/interface/activity/RoutineHandlerInterface.ts:59
Remove a commitment added during the game session. Fixed commitments can't be removed.
Parameters
commitment
string | CommitmentInterface
The commitment or commitment id to remove.
roomId?
string
If set, the commitment is removed only if it was added to this room.
Returns
void