# Class: CommitmentBaseModel (/jsdoc/nqtr/index/classes/CommitmentBaseModel)



Defined in: [src/classes/activity/CommitmentBaseModel.ts:22](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentBaseModel.ts#L22)

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 [#example]

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

## Extends [#extends]

* [`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass)

## Constructors [#constructors]

### Constructor [#constructor]

\> **new CommitmentBaseModel**(`id`, `character`, `props`): `CommitmentBaseModel`

Defined in: [src/classes/activity/CommitmentBaseModel.ts:28](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentBaseModel.ts#L28)

#### Parameters [#parameters]

##### id [#id]

`string`

The id of the commitment, it must be unique.

##### character [#character]

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

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

##### props [#props]

[`CommitmentProps`](/jsdoc/nqtr/index/interfaces/CommitmentProps)

The properties of the commitment.

#### Returns [#returns]

`CommitmentBaseModel`

#### Overrides [#overrides]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`constructor`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#constructor)

## Properties [#properties]

### \_onRun [#_onrun]

\> `protected` `readonly&#x60; **\_onRun**: [`OnRunEvent`](/jsdoc/nqtr/index/type-aliases/OnRunEvent)\<[`CommitmentInterface`](/jsdoc/nqtr/index/interfaces/CommitmentInterface)>

Defined in: [src/classes/activity/ActivityStoredClass.ts:19](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/ActivityStoredClass.ts#L19)

#### Inherited from [#inherited-from]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`_onRun`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#_onrun)

***

### characters [#characters]

\> `readonly` **characters**: `CharacterInterface`\[]

Defined in: [src/classes/activity/CommitmentStoredClass.ts:72](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentStoredClass.ts#L72)

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

#### Inherited from [#inherited-from-1]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`characters`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#characters)

***

### id [#id-1]

\> `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 [#inherited-from-2]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`id`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#id)

***

### runOptions? [#runoptions]

\> `optional` &#x2A;*runOptions?**: `CommitmentRunOptions`

Defined in: [src/classes/activity/CommitmentStoredClass.ts:111](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentStoredClass.ts#L111)

Options for [run](/jsdoc/nqtr/index/classes/CommitmentStoredClass#run).

#### Inherited from [#inherited-from-3]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`runOptions`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#runoptions)

## Accessors [#accessors]

### dateScheduling [#datescheduling]

#### Get Signature [#get-signature]

\> **get** **dateScheduling**(): [`DateSchedulingInterface`](/jsdoc/nqtr/index/interfaces/DateSchedulingInterface) | `undefined`

Defined in: [src/classes/activity/ActivityStoredClass.ts:34](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/ActivityStoredClass.ts#L34)

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

##### Returns [#returns-1]

[`DateSchedulingInterface`](/jsdoc/nqtr/index/interfaces/DateSchedulingInterface) | `undefined`

#### Inherited from [#inherited-from-4]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`dateScheduling`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#datescheduling)

***

### disabled [#disabled]

#### Get Signature [#get-signature-1]

\> **get** **disabled**(): `boolean`

Defined in: [src/classes/activity/CommitmentBaseModel.ts:82](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentBaseModel.ts#L82)

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

##### Returns [#returns-2]

`boolean`

#### Set Signature [#set-signature]

\> **set** **disabled**(`value`): `void`

Defined in: [src/classes/activity/CommitmentBaseModel.ts:89](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentBaseModel.ts#L89)

##### Parameters [#parameters-1]

###### value [#value]

`string` | `boolean`

##### Returns [#returns-3]

`void`

***

### executionType [#executiontype]

#### Get Signature [#get-signature-2]

\> **get** **executionType**(): [`ExecutionType`](/jsdoc/nqtr/index/type-aliases/ExecutionType)

Defined in: [src/classes/activity/CommitmentStoredClass.ts:74](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentStoredClass.ts#L74)

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 [#returns-4]

[`ExecutionType`](/jsdoc/nqtr/index/type-aliases/ExecutionType)

#### Set Signature [#set-signature-1]

\> **set** **executionType**(`value`): `void`

Defined in: [src/classes/activity/CommitmentStoredClass.ts:77](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentStoredClass.ts#L77)

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 [#parameters-2]

###### value [#value-1]

[`ExecutionType`](/jsdoc/nqtr/index/type-aliases/ExecutionType)

##### Returns [#returns-5]

`void`

#### Inherited from [#inherited-from-5]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`executionType`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#executiontype)

***

### expired [#expired]

#### Get Signature [#get-signature-3]

\> **get** **expired**(): `boolean`

Defined in: [src/classes/activity/ActivityStoredClass.ts:48](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/ActivityStoredClass.ts#L48)

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 [#returns-6]

`boolean`

#### Inherited from [#inherited-from-6]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`expired`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#expired)

***

### hidden [#hidden]

#### Get Signature [#get-signature-4]

\> **get** **hidden**(): `boolean`

Defined in: [src/classes/activity/CommitmentBaseModel.ts:97](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentBaseModel.ts#L97)

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

##### Returns [#returns-7]

`boolean`

#### Set Signature [#set-signature-2]

\> **set** **hidden**(`value`): `void`

Defined in: [src/classes/activity/CommitmentBaseModel.ts:104](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentBaseModel.ts#L104)

##### Parameters [#parameters-3]

###### value [#value-2]

`string` | `boolean`

##### Returns [#returns-8]

`void`

***

### icon [#icon]

#### Get Signature [#get-signature-5]

\> **get** **icon**(): `string` | `undefined`

Defined in: [src/classes/activity/CommitmentBaseModel.ts:74](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentBaseModel.ts#L74)

The icon of the commitment.

##### Returns [#returns-9]

`string` | `undefined`

***

### image [#image]

#### Get Signature [#get-signature-6]

\> **get** **image**(): `string` | `undefined`

Defined in: [src/classes/activity/CommitmentBaseModel.ts:66](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentBaseModel.ts#L66)

The image of the commitment.

##### Returns [#returns-10]

`string` | `undefined`

***

### name [#name]

#### Get Signature [#get-signature-7]

\> **get** **name**(): `string`

Defined in: [src/classes/activity/CommitmentBaseModel.ts:58](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentBaseModel.ts#L58)

The name of the commitment.

##### Returns [#returns-11]

`string`

***

### priority [#priority]

#### Get Signature [#get-signature-8]

\> **get** **priority**(): `number`

Defined in: [src/classes/activity/CommitmentStoredClass.ts:81](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentStoredClass.ts#L81)

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 [#returns-12]

`number`

#### Set Signature [#set-signature-3]

\> **set** **priority**(`value`): `void`

Defined in: [src/classes/activity/CommitmentStoredClass.ts:84](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentStoredClass.ts#L84)

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 [#parameters-4]

###### value [#value-3]

`number`

##### Returns [#returns-13]

`void`

#### Inherited from [#inherited-from-7]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`priority`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#priority)

***

### run [#run]

#### Get Signature [#get-signature-9]

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

Defined in: [src/classes/activity/CommitmentStoredClass.ts:120](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentStoredClass.ts#L120)

Executes the commitment's `onRun` callback.

##### Returns [#returns-14]

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

#### Inherited from [#inherited-from-8]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`run`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#run)

***

### timeSlot [#timeslot]

#### Get Signature [#get-signature-10]

\> **get** **timeSlot**(): [`TimeSchedulingInterface`](/jsdoc/nqtr/index/interfaces/TimeSchedulingInterface) | [`TimeSchedulingInterface`](/jsdoc/nqtr/index/interfaces/TimeSchedulingInterface)\[] | `undefined`

Defined in: [src/classes/activity/ActivityStoredClass.ts:29](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/ActivityStoredClass.ts#L29)

Time slot in which activity/commitment will be active.

##### Returns [#returns-15]

[`TimeSchedulingInterface`](/jsdoc/nqtr/index/interfaces/TimeSchedulingInterface) | [`TimeSchedulingInterface`](/jsdoc/nqtr/index/interfaces/TimeSchedulingInterface)\[] | `undefined`

#### Inherited from [#inherited-from-9]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`timeSlot`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#timeslot)

## Methods [#methods]

### addTempHistoryItem() [#addtemphistoryitem]

\> `protected` **addTempHistoryItem**(): `void`

Defined in: [src/classes/activity/CommitmentStoredClass.ts:87](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/CommitmentStoredClass.ts#L87)

#### Returns [#returns-16]

`void`

#### Inherited from [#inherited-from-10]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`addTempHistoryItem`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#addtemphistoryitem)

***

### getStorageProperty() [#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 [#type-parameters]

##### T [#t]

`T` = `StorageElementType`

#### Parameters [#parameters-5]

##### propertyName [#propertyname]

`string`

The name of the property to get.

##### idToUse? [#idtouse]

`string`

The id of the instance to get the property.

#### Returns [#returns-17]

`T` | `undefined`

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

#### Default [#default]

```ts
this.id
```

#### Inherited from [#inherited-from-11]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`getStorageProperty`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#getstorageproperty)

***

### isActive() [#isactive]

\> **isActive**(`options?`): `boolean`

Defined in: [src/classes/activity/ActivityStoredClass.ts:55](https://github.com/DRincs-Productions/nqtr/blob/db22fe9e7612d547ff25befcc444cf095348917d/src/classes/activity/ActivityStoredClass.ts#L55)

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

#### Parameters [#parameters-6]

##### options? [#options]

[`ActiveScheduling`](/jsdoc/nqtr/index/interfaces/ActiveScheduling) = `{}`

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

#### Returns [#returns-18]

`boolean`

#### Inherited from [#inherited-from-12]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`isActive`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#isactive)

***

### migrateOldStorage() [#migrateoldstorage]

\> `protected` **migrateOldStorage**(`oldCategoryId?`): `void`

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

#### Parameters [#parameters-7]

##### oldCategoryId? [#oldcategoryid]

`string`

#### Returns [#returns-19]

`void`

#### Inherited from [#inherited-from-13]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`migrateOldStorage`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#migrateoldstorage)

***

### setStorageProperty() [#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 [#type-parameters-1]

##### T [#t-1]

`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 [#parameters-8]

##### propertyName [#propertyname-1]

`string`

The name of the property to set.

##### value [#value-4]

`StorageElementType`

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

#### Returns [#returns-20]

`void`

#### Inherited from [#inherited-from-14]

[`CommitmentStoredClass`](/jsdoc/nqtr/index/classes/CommitmentStoredClass).[`setStorageProperty`](/jsdoc/nqtr/index/classes/CommitmentStoredClass#setstorageproperty)
