-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
RSamaium
committed
Nov 5, 2023
1 parent
9e5c8ba
commit f0a3bd6
Showing
7 changed files
with
141 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import type { RpgPlayer } from "@rpgjs/server"; | ||
import type { Block } from "../types/block"; | ||
import { Group } from "../types/group"; | ||
|
||
export type ChangeGold = { | ||
id: 'gold' | ||
value: number | ||
} | ||
|
||
export default (formatMessage): Block => ({ | ||
id: 'gold', | ||
group: Group.Param, | ||
title: formatMessage({ | ||
defaultMessage: 'Show Choices', | ||
description: 'Choices block', | ||
id: 'block.choice' | ||
}), | ||
description: formatMessage({ | ||
defaultMessage: 'Display a choice', | ||
description: 'Choices block description', | ||
id: 'block.choice.description' | ||
}), | ||
display: ['gold'], | ||
schema: { | ||
type: 'object', | ||
properties: { | ||
value: { | ||
type: 'number', | ||
title: formatMessage({ | ||
defaultMessage: 'Value', | ||
description: 'Set Value', | ||
}), | ||
} | ||
}, | ||
required: ['value'] | ||
}, | ||
async execute(player: RpgPlayer, dataBlock: ChangeGold) { | ||
player.gold += dataBlock.value | ||
return undefined | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,16 @@ | ||
import choice from './choice' | ||
import text from './text' | ||
import gold from './gold' | ||
import type { Choice } from './choice' | ||
import type { Text } from './text' | ||
import type { ChangeGold } from './gold' | ||
|
||
export type Flow = { | ||
[blockId: string]: Choice | Text | ||
[blockId: string]: Choice | Text | ChangeGold | ||
} | ||
|
||
export default [ | ||
choice, | ||
text | ||
text, | ||
gold | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
export enum Group { | ||
UI = 'ui', | ||
Logic = 'logic', | ||
Param = 'param', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters