From e0a2ffc3735966ba2a05f47bb93fdcfe0d6fa04f Mon Sep 17 00:00:00 2001 From: "Kyle J. Kemp" Date: Mon, 16 Sep 2024 12:27:03 -0500 Subject: [PATCH] better handling of skill levels --- src/app/tabs/npcs/npcs-editor/npcs-editor.component.ts | 9 ++++++++- src/app/tabs/npcs/npcs.component.ts | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/app/tabs/npcs/npcs-editor/npcs-editor.component.ts b/src/app/tabs/npcs/npcs-editor/npcs-editor.component.ts index c6225ac..b6e14df 100644 --- a/src/app/tabs/npcs/npcs-editor/npcs-editor.component.ts +++ b/src/app/tabs/npcs/npcs-editor/npcs-editor.component.ts @@ -8,10 +8,11 @@ import { ItemSlot, ItemSlotType, Rollable, + Skill, SkillType, StatType, } from '../../../../interfaces'; -import { levelFromSkillXP } from '../../../helpers/export'; +import { levelFromSkillXP, skillXPFromLevel } from '../../../helpers/export'; import { EditorBaseComponent } from '../../../shared/components/editor-base/editor-base.component'; @Component({ @@ -508,6 +509,12 @@ export class NpcsEditorComponent delete (npc as any).triggers; } + Object.values(Skill).forEach((skill) => { + npc.skills[skill.toLowerCase() as SkillType] = skillXPFromLevel( + npc.skillLevels + ); + }); + this.editing.set(npc); super.doSave(); diff --git a/src/app/tabs/npcs/npcs.component.ts b/src/app/tabs/npcs/npcs.component.ts index 51032a9..a10b6f7 100644 --- a/src/app/tabs/npcs/npcs.component.ts +++ b/src/app/tabs/npcs/npcs.component.ts @@ -50,6 +50,13 @@ export class NpcsComponent extends EditorBaseTableComponent { cellDataType: 'number', filter: 'agNumberColumnFilter', }, + { + field: 'skillLevels', + headerName: 'Skill', + flex: 1, + cellDataType: 'number', + filter: 'agNumberColumnFilter', + }, { field: 'cr', headerName: 'Challenge Rating',