diff options
| author | Leonardo Bishop <me@leonardobishop.com> | 2024-03-10 00:13:25 +0000 |
|---|---|---|
| committer | Leonardo Bishop <me@leonardobishop.com> | 2024-03-10 00:13:25 +0000 |
| commit | 9a11e0f4a38297006b89cc7bb2a60734111582e0 (patch) | |
| tree | 5ebddde79e67b659714b5dbdbfcea289f06a4ae5 /src/lib | |
| parent | 817478f3cf357fc09778d9dc3cf67a667e21f042 (diff) | |
Migrate to nuxt
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/materials.ts | 3 | ||||
| -rw-r--r-- | src/lib/questsLoader.ts | 68 | ||||
| -rw-r--r-- | src/lib/util.ts | 18 |
3 files changed, 0 insertions, 89 deletions
diff --git a/src/lib/materials.ts b/src/lib/materials.ts deleted file mode 100644 index 36c5aee..0000000 --- a/src/lib/materials.ts +++ /dev/null @@ -1,3 +0,0 @@ -import materials from '@/data/materials.json'; - -export default materials;
\ No newline at end of file diff --git a/src/lib/questsLoader.ts b/src/lib/questsLoader.ts deleted file mode 100644 index 0623f04..0000000 --- a/src/lib/questsLoader.ts +++ /dev/null @@ -1,68 +0,0 @@ -import type { EditorQuest, EditorTask, EditorCategory } from '../stores/session'; - -export function loadQuestsFromJson(config: any): EditorQuest[] { - return Object.keys(config).map((questid: any) => { - const quest = config[questid]; - - return { - id: questid, - display: { - name: quest.display.name, - lore: { - normal: quest.display['lore-normal'], - started: quest.display['lore-started'], - }, - type: quest.display.type, - }, - tasks: Object.fromEntries(Object.keys(quest.tasks).map((taskId: string) => { - return [taskId, { - id: taskId, - config: quest.tasks[taskId], - } as EditorTask]; - })), - rewards: quest.rewards, - ...(quest.startcommands && { startCommands: quest.startcommands }), - ...(quest.startstring && { startString: quest.startstring }), - ...(quest.rewardstring && { rewardString: quest.rewardstring }), - ...(quest.placeholders && { placeholders: quest.placeholders }), - options: { - category: quest.options.category, - requirements: quest.options.requires || [], - permissionRequired: quest.options['permission-required'] || false, - cancellable: quest.options.cancellable || false, - countsTowardsLimit: quest.options['counts-towards-limit'] || true, - repeatable: quest.options.repeatable || false, - cooldown: { - enabled: quest.options.cooldown?.enabled || false, - time: quest.options.cooldown?.time || 0, - }, - timeLimit: { - enabled: quest.options['time-limit']?.enabled || false, - time: quest.options['time-limit']?.time || 0, - }, - sortOrder: quest.options['sort-order'] || 0, - autostart: quest.options.autostart || false, - ...(quest.options['completed-display'] && { completedDisplay: quest.options['completed-display'] }), - ...(quest.options['cooldown-display'] && { cooldownDisplay: quest.options['cooldown-display'] }), - ...(quest.options['permission-display'] && { permissionDisplay: quest.options['permission-display'] }), - ...(quest.options['locked-display'] && { lockedDisplay: quest.options['locked-display'] }), - }, - } as EditorQuest; - }); -} - -export function loadCategoriesFromJson(config: any): EditorCategory[] { - return Object.keys(config).map((categoryid: any) => { - const category = config[categoryid]; - - return { - id: categoryid, - display: { - name: category.display.name, - lore: category.display.lore, - type: category.display.type, - }, - permissionRequired: category['permission-required'], - }; - }); -} diff --git a/src/lib/util.ts b/src/lib/util.ts deleted file mode 100644 index b8be8cb..0000000 --- a/src/lib/util.ts +++ /dev/null @@ -1,18 +0,0 @@ -const COLOR_CODE_REGEX = /&[0-9a-fk-or]/i; -const VALID_ID_REGEX = /^[a-z0-9_]+$/i; - -export function stripColorCodes(str: string): string { - return str.replace(COLOR_CODE_REGEX, ''); -} - -export function validateQuestId(id: string): boolean { - return VALID_ID_REGEX.test(id); -} - -export function validateCategoryId(id: string): boolean { - return VALID_ID_REGEX.test(id); -} - -export function validateTaskId(id: string): boolean { - return VALID_ID_REGEX.test(id); -}
\ No newline at end of file |
