LogoPixi’VN
indexClasses

Class: CommitmentBaseModel

Defined in: src/classes/activity/CommitmentBaseModel.ts:22

The base model of a commitment. I suggest you extend this class to create your own commitment model. You must use the saveCommitment function to save the commitment in the registered commitments.

Example

export const miaPlay = new CommitmentBaseModel("mia_play", mia, {
    name: "Test",
    image: "https://image.jpg",
    executionType: ExecutionTypeEnum.INTERACTION,
    onRun: (commitment) => {
        // Do something
    }
})
saveCommitment(miaPlay)

Extends

Constructors

Constructor

> new CommitmentBaseModel(id, character, props): CommitmentBaseModel

Defined in: src/classes/activity/CommitmentBaseModel.ts:28

Parameters

id

string

The id of the commitment, it must be unique.

character

string | CharacterInterface | (string | CharacterInterface)[] | undefined

The character or characters that are in the commitment and so in the room.

props

CommitmentProps

The properties of the commitment.

Returns

CommitmentBaseModel

Overrides

CommitmentStoredClass.constructor

Properties

_onRun

> protected readonly _onRun: OnRunEvent<CommitmentInterface>

Defined in: src/classes/activity/ActivityStoredClass.ts:19

Inherited from

CommitmentStoredClass._onRun


characters

> readonly characters: CharacterInterface[]

Defined in: src/classes/activity/CommitmentStoredClass.ts:72

The character or characters that are in the commitment and so in the room.

Inherited from

CommitmentStoredClass.characters


id

> readonly id: string

Defined in: node_modules/@drincs/pixi-vn/dist/StoredClassModel-uMifeNzV.d.ts:41

Is id of the stored class. is unique for this class.

Inherited from

CommitmentStoredClass.id


runOptions?

> optional runOptions?: CommitmentRunOptions

Defined in: src/classes/activity/CommitmentStoredClass.ts:111

Options for run.

Inherited from

CommitmentStoredClass.runOptions

Accessors

dateScheduling

Get Signature

> get dateScheduling(): DateSchedulingInterface | undefined

Defined in: src/classes/activity/ActivityStoredClass.ts:34

Used to schedule what date it will be added and removed.

Returns

DateSchedulingInterface | undefined

Inherited from

CommitmentStoredClass.dateScheduling


disabled

Get Signature

> get disabled(): boolean

Defined in: src/classes/activity/CommitmentBaseModel.ts:82

Whether is disabled. You can also pass a Pixi'VN flag name.

Returns

boolean

Set Signature

> set disabled(value): void

Defined in: src/classes/activity/CommitmentBaseModel.ts:89

Parameters
value

string | boolean

Returns

void


executionType

Get Signature

> get executionType(): ExecutionType

Defined in: src/classes/activity/CommitmentStoredClass.ts:74

Execution type. If is "automatic" the onRun() runned automatically when the palayer is in the room. If is "interaction" the player must interact with the character to run the onRun() function. If you set "automatic" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time.

Returns

ExecutionType

Set Signature

> set executionType(value): void

Defined in: src/classes/activity/CommitmentStoredClass.ts:77

Execution type. If is "automatic" the onRun() runned automatically when the palayer is in the room. If is "interaction" the player must interact with the character to run the onRun() function. If you set "automatic" remember to remove the commitment when it is no longer needed, because otherwise it repeats itself every time.

Parameters
value

ExecutionType

Returns

void

Inherited from

CommitmentStoredClass.executionType


expired

Get Signature

> get expired(): boolean

Defined in: src/classes/activity/ActivityStoredClass.ts:48

Whether the activity/commitment is a deadline, so it will then be removed or hidden.

It depends only on the date, not the time. So if you set { dateScheduling: { from: 0, to: 3 }, timeSlot { from: 10, to: 20 } } the activity/commitment hidden or deleted on date 3 at 0.

Returns

boolean

Inherited from

CommitmentStoredClass.expired


hidden

Get Signature

> get hidden(): boolean

Defined in: src/classes/activity/CommitmentBaseModel.ts:97

Whether is hidden. You can also pass a Pixi'VN flag name.

Returns

boolean

Set Signature

> set hidden(value): void

Defined in: src/classes/activity/CommitmentBaseModel.ts:104

Parameters
value

string | boolean

Returns

void


icon

Get Signature

> get icon(): string | undefined

Defined in: src/classes/activity/CommitmentBaseModel.ts:74

The icon of the commitment.

Returns

string | undefined


image

Get Signature

> get image(): string | undefined

Defined in: src/classes/activity/CommitmentBaseModel.ts:66

The image of the commitment.

Returns

string | undefined


name

Get Signature

> get name(): string

Defined in: src/classes/activity/CommitmentBaseModel.ts:58

The name of the commitment.

Returns

string


priority

Get Signature

> get priority(): number

Defined in: src/classes/activity/CommitmentStoredClass.ts:81

The priority. The higher the number, the higher the priority. To ensure that a character is not in 2 places at the same time, if there are 2 or more valid commits at the same time and with the same character, the one with the highest priority will be chosen.

Returns

number

Set Signature

> set priority(value): void

Defined in: src/classes/activity/CommitmentStoredClass.ts:84

The priority. The higher the number, the higher the priority. To ensure that a character is not in 2 places at the same time, if there are 2 or more valid commits at the same time and with the same character, the one with the highest priority will be chosen.

Parameters
value

number

Returns

void

Inherited from

CommitmentStoredClass.priority


run

Get Signature

> get run(): (props, options?) => Promise<any>

Defined in: src/classes/activity/CommitmentStoredClass.ts:120

Executes the commitment's onRun callback.

Returns

(props, options?) => Promise<any>

Inherited from

CommitmentStoredClass.run


timeSlot

Get Signature

> get timeSlot(): TimeSchedulingInterface | TimeSchedulingInterface[] | undefined

Defined in: src/classes/activity/ActivityStoredClass.ts:29

Time slot in which activity/commitment will be active.

Returns

TimeSchedulingInterface | TimeSchedulingInterface[] | undefined

Inherited from

CommitmentStoredClass.timeSlot

Methods

addTempHistoryItem()

> protected addTempHistoryItem(): void

Defined in: src/classes/activity/CommitmentStoredClass.ts:87

Returns

void

Inherited from

CommitmentStoredClass.addTempHistoryItem


getStorageProperty()

> protected getStorageProperty<T>(propertyName, idToUse?): T | undefined

Defined in: node_modules/@drincs/pixi-vn/dist/StoredClassModel-uMifeNzV.d.ts:56

Get a property from the storage.

Type Parameters

T

T = StorageElementType

Parameters

propertyName

string

The name of the property to get.

idToUse?

string

The id of the instance to get the property.

Returns

T | undefined

The value of the property. If the property is not found, returns undefined.

Default

this.id

Inherited from

CommitmentStoredClass.getStorageProperty


isActive()

> isActive(options?): boolean

Defined in: src/classes/activity/ActivityStoredClass.ts:55

Whether the activity/commitment is active, so it will be shown in the routine and can be runned.

Parameters

options?

ActiveScheduling = {}

The options to check if the activity/commitment is active.

Returns

boolean

Inherited from

CommitmentStoredClass.isActive


migrateOldStorage()

> protected migrateOldStorage(oldCategoryId?): void

Defined in: node_modules/@drincs/pixi-vn/dist/StoredClassModel-uMifeNzV.d.ts:37

Parameters

oldCategoryId?

string

Returns

void

Inherited from

CommitmentStoredClass.migrateOldStorage


setStorageProperty()

> protected setStorageProperty<T>(propertyName, value): void

Defined in: node_modules/@drincs/pixi-vn/dist/StoredClassModel-uMifeNzV.d.ts:49

Update a property in the storage.

Type Parameters

T

T

The type of the value to set. (Deprecated, it is not necessary to specify the type of the value, it will be inferred from the value)

Parameters

propertyName

string

The name of the property to set.

value

StorageElementType

The value to set. If is undefined, the property will be removed from the storage.

Returns

void

Inherited from

CommitmentStoredClass.setStorageProperty

On this page