From c7f6a38acfd2297c749ee9b0414dee23fc4c1108 Mon Sep 17 00:00:00 2001 From: mstein Date: Tue, 7 Jun 2022 00:58:21 +0200 Subject: [PATCH] Add skills as items --- lang/de.json | 12 +- source/index.ts | 29 +++- source/module/M5Base.ts | 19 +++ source/module/actors/M5Character.ts | 82 ++++------- source/module/items/M5Item.ts | 65 +++++++++ source/module/sheets/M5CharacterSheet.ts | 66 ++++++++- source/module/sheets/M5ItemSheet.ts | 32 ++++- source/style/Character-sheet.less | 14 ++ source/template.json | 130 ++++++++++-------- templates/sheets/character/base_values.hbs | 4 +- templates/sheets/character/skills.hbs | 59 ++++++-- .../{m5Item-Sheet.hbs => item/item.hbs} | 0 templates/sheets/item/skill.hbs | 23 ++++ 13 files changed, 399 insertions(+), 136 deletions(-) create mode 100644 source/module/M5Base.ts create mode 100644 source/module/items/M5Item.ts rename templates/sheets/{m5Item-Sheet.hbs => item/item.hbs} (100%) create mode 100644 templates/sheets/item/skill.hbs diff --git a/lang/de.json b/lang/de.json index 0fd6595..f1a3e3a 100644 --- a/lang/de.json +++ b/lang/de.json @@ -8,7 +8,16 @@ "ITEM.TypeArmor": "Rüstung", "ITEM.TypeSpell": "Zauber", + "midgard5.roll": "Würfeln", + "midgard5.learn": "Lernen", + "midgard5.description": "Beschreibung", + "midgard5.attribute": "Leiteigenschaft", + "midgard5.skill": "Fertigkeit", + "midgard5.skill-value": "Fertigkeitswert", + "midgard5.fw": "FW", + "midgard5.bonus": "Bonus", + "midgard5.ew": "EW", "midgard5.item-value": "Wert", "midgard5.item-quantity": "Menge", @@ -36,7 +45,6 @@ "midgard5.actor-wk": "Wk", "midgard5.actor-wk-long": "Willenskraft", - "midgard5.bonus": "Bonus", "midgard5.aktuell": "Akt.", "midgard5.maximum": "Max.", "midgard5.attrvalue": "Wert", @@ -48,7 +56,7 @@ "midgard5.class": "Klasse", "midgard5.race": "Rasse", - "midgard5.magic_using": "zauberkundig", + "midgard5.magicUsing": "zauberkundig", "midgard5.gender": "Geschlecht", "midgard5.weight": "Gewicht", "midgard5.height": "Größe", diff --git a/source/index.ts b/source/index.ts index 85f43e1..f997053 100644 --- a/source/index.ts +++ b/source/index.ts @@ -1,12 +1,22 @@ import Logger from "./utils/Logger" -import M5ItemSheet from "./module/sheets/M5ItemSheet" import M5CharacterSheet from "./module/sheets/M5CharacterSheet" import preloadTemplates from "./PreloadTemplates" -import M5Character from "./module/actors/M5Character" +import { M5Character } from "./module/actors/M5Character" +import { M5Skill } from "./module/M5Base" +import { M5ItemSheet } from "./module/sheets/M5ItemSheet" +import { M5Item } from "./module/items/M5Item" Hooks.once("init", async () => { Logger.log("M5 | Initialisierung Midgard 5") + Handlebars.registerHelper("eq", (lhs: any, rhs: any) => { + return lhs === rhs + }) + + Handlebars.registerHelper("array", (arr: any[], index: number) => { + return arr[index] + }) + Handlebars.registerHelper("localizeMidgard", (str: string) => { const template = Handlebars.compile("{{localize value}}") return template({ @@ -14,6 +24,20 @@ Hooks.once("init", async () => { }) }) + Handlebars.registerHelper("skillBonus", (actorId: string, skill: M5Skill) => { + const actor = (game as Game).actors.get(actorId) as M5Character + if (!actor || !skill) + console.log("Handlebars.skillBonus", actor, skill) + return actor.skillBonus(skill).toString() + }) + + Handlebars.registerHelper("skillEw", (actorId: string, skill: M5Skill) => { + const actor = (game as Game).actors.get(actorId) as M5Character + if (!actor || !skill) + console.log("Handlebars.skillEw", actor, skill) + return actor.skillEw(skill).toString() + }) + // Default Sheet für Items definieren und das Standardsheet deaktivieren Items.unregisterSheet("core", ItemSheet) Items.registerSheet("midgard5", M5ItemSheet, { makeDefault: true }) @@ -23,6 +47,7 @@ Hooks.once("init", async () => { Actors.registerSheet("midgard5", M5CharacterSheet, { makeDefault: true }) CONFIG.Actor.documentClass = M5Character + CONFIG.Item.documentClass = M5Item //RegisterSettings(); await preloadTemplates() diff --git a/source/module/M5Base.ts b/source/module/M5Base.ts new file mode 100644 index 0000000..cac908c --- /dev/null +++ b/source/module/M5Base.ts @@ -0,0 +1,19 @@ + +export interface M5Skill { + fw: number + attribute: string +} + +export interface M5SkillUnlearned extends M5Skill { + initial: number +} + +export interface M5SkillLearned extends M5Skill { + skill: string + type: string +} + +export interface M5Attribute { + value: number + bonus: number +} diff --git a/source/module/actors/M5Character.ts b/source/module/actors/M5Character.ts index 4832538..500d857 100644 --- a/source/module/actors/M5Character.ts +++ b/source/module/actors/M5Character.ts @@ -1,16 +1,4 @@ - -export interface M5Skill { - label: string - skill: string - attribute: string - fw: number - ew: number -} - -export interface M5Attribute { - value: number - bonus: number -} +import { M5Attribute, M5Skill, M5SkillLearned } from "../M5Base" export interface M5CharacterCalculatedData { level: number, @@ -29,10 +17,11 @@ export interface M5CharacterCalculatedData { enduranceBonus: number }, skills: { + general: {} } } -export default class M5Character extends Actor { +export class M5Character extends Actor { // constructor( // data: ConstructorParameters[0], @@ -61,7 +50,6 @@ export default class M5Character extends Actor { prepareDerivedData() { const context = (this as any).data; - //console.log(context) context.data.calc = { level: 0, @@ -79,7 +67,9 @@ export default class M5Character extends Actor { poisonResistance: 0, enduranceBonus: 0 }, - skills: {} + skills: { + general: {} + } } as M5CharacterCalculatedData const data = context.data @@ -98,10 +88,19 @@ export default class M5Character extends Actor { calc.stats.movementBonus = 0 calc.stats.resistanceMind = calc.stats.defense calc.stats.resistanceBody = calc.stats.defense + 1 - calc.stats.spellCasting = M5Character.spellCastingFromLevel(calc.level) + M5Character.attributeBonus(data.attributes.zt) + calc.stats.spellCasting = (data.info.magicUsing ? M5Character.spellCastingFromLevel(calc.level) : 3) + M5Character.attributeBonus(data.attributes.zt) calc.stats.brawl = Math.floor((st + gw) / 20) calc.stats.poisonResistance = 30 + Math.floor(ko / 2) calc.stats.enduranceBonus = Math.floor(ko/10) + Math.floor(st/20) + + //console.log("prepareDerivedData", context) + context.items?.filter(item => item.data.type === "skill").forEach(item => { + calc.skills.general[item.data.name] = { + fw: item.data.data.fw, + attribute: item.data.data.attribute, + id: item.data._id + } + }) } static readonly levelThreshold: Array = [0, 100, 250, 500, 750, 1000, 1250, 1500, 1750, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 6000, 7000, 8000, 9000, 10000, 12500, 15000, 17500, 20000, 22500, 25000, 30000, 35000, 40000, 45000, 50000, 55000, 60000, 65000, 70000, 75000, 80000, 85000, 90000, 95000, 100000, 105000, 110000, 115000, 120000, 125000, 130000, 135000, 140000, 145000, 150000, 155000, 160000, 165000, 170000, 175000, 180000, 185000, 190000, 195000, 200000, 205000, 210000, 215000, 220000, 225000, 230000, 235000, 240000, 245000, 250000, 255000, 260000, 265000, 270000, 275000, 280000] @@ -140,49 +139,20 @@ export default class M5Character extends Actor { return ret ? ret[1] : M5Character.spellCastingThreshold[M5Character.spellCastingThreshold.length - 1][1] } - attributeStrength() { - const data = (this as any).data.data - return M5Character.attributeMinMax(data.data.attributes.st) + skillBonus(skill: M5Skill, skillName?: string) { + const attribute = this.attribute(skill.attribute) + let ret = attribute ? M5Character.attributeBonus(attribute) : 0 + return ret } - attributeDexterity() { - const data = (this as any).data.data - return M5Character.attributeMinMax(data.data.attributes.gs) + skillEw(skill: M5Skill, skillName?: string) { + const bonus = this.skillBonus(skill, skillName) + return skill.fw + bonus } - attributeAgility() { - const data = (this as any).data.data - return M5Character.attributeMinMax(data.data.attributes.gw) - } - - attributeConstitution() { - const data = (this as any).data.data - return M5Character.attributeMinMax(data.data.attributes.ko) - } - - attributeIntelligence() { - const data = (this as any).data.data - return M5Character.attributeMinMax(data.data.attributes.in) - } - - attributeMagic() { - const data = (this as any).data.data - return M5Character.attributeMinMax(data.data.attributes.zt) - } - - attributeBeauty() { - const data = (this as any).data.data - return M5Character.attributeMinMax(data.data.attributes.au) - } - - attributeCharisma() { - const data = (this as any).data.data - return M5Character.attributeMinMax(data.data.attributes.pa) - } - - attributeWillpower() { - const data = (this as any).data.data - return M5Character.attributeMinMax(data.data.attributes.wk) + attribute(name: string): M5Attribute { + const context = (this as any).data + return context.data.attributes[name] } } diff --git a/source/module/items/M5Item.ts b/source/module/items/M5Item.ts new file mode 100644 index 0000000..f09829b --- /dev/null +++ b/source/module/items/M5Item.ts @@ -0,0 +1,65 @@ +import { M5Character } from "../actors/M5Character" +import { M5Skill } from "../M5Base" + +export class M5Item extends Item { + static readonly SKILL = "skill" + + getRollData() { + if (!this.actor) + return null + + const actor = this.actor as any + const context = (this as any).data + + let ret = null + if (context.type === "skill") { + const character = actor as M5Character + const actorData = actor.data.data + const itemData = context.data as M5Skill + + ret = { + fw: itemData.fw, + bonus: M5Character.attributeBonus(character.attribute(itemData.attribute)) + } + } else { + ret = actor.getRollData() + ret.item = foundry.utils.deepClone(context.data) + } + + return ret + } + + async roll() { + const item = (this as any).data + + // Initialize chat data. + const speaker = ChatMessage.getSpeaker({ actor: this.actor }) + const rollMode = (game as Game).settings.get('core', 'rollMode') + const label = `[${item.type}] ${item.name}` + + // If there's no roll data, send a chat message. + if (!item.data.formula) { + ChatMessage.create({ + speaker: speaker, + rollMode: rollMode, + flavor: label, + content: item.data.description ?? '' + }) + } else { // Otherwise, create a roll and send a chat message from it. + // Retrieve roll data. + const rollData = this.getRollData() + + // Invoke the roll and submit it to chat. + const roll = new Roll(item.data.formula, rollData) + // If you need to store the value first, uncomment the next line. + // let result = await roll.roll({async: true}) + roll.toMessage({ + speaker: speaker, + rollMode: rollMode, + flavor: label, + }) + return roll + } + } + +} diff --git a/source/module/sheets/M5CharacterSheet.ts b/source/module/sheets/M5CharacterSheet.ts index 4f95092..f41d785 100644 --- a/source/module/sheets/M5CharacterSheet.ts +++ b/source/module/sheets/M5CharacterSheet.ts @@ -1,5 +1,7 @@ import Logger from "../../utils/Logger" -import M5Character, { M5Attribute } from "../actors/M5Character" +import { M5Character } from "../actors/M5Character" +import { M5Item } from "../items/M5Item" +import { M5SkillLearned, M5SkillUnlearned } from "../M5Base" export default class M5CharacterSheet extends ActorSheet { @@ -27,7 +29,7 @@ export default class M5CharacterSheet extends ActorSheet { context.actor = actorData; context.data = actorData.data; - //console.log("Sheet Promise", context) + //console.log("Sheet Promise", context.actor, context.data) return context }) } @@ -35,8 +37,29 @@ export default class M5CharacterSheet extends ActorSheet { override activateListeners(html: JQuery) { super.activateListeners(html) - html.find(".roll-button").on("click", async (event) => { + html.find(".edit-skill").on("click", async (event) => { const row = event.target.parentElement + let skillId = row.dataset["skill"] + + const context = this.actor.data + const item = context.items.get(skillId) + item.sheet.render(true) + }) + + html.find(".roll-learned-button").on("click", async (event) => { + const row = event.target.parentElement.parentElement + let skillId = row.dataset["skill"] + + const actor = this.actor as any + const context = this.actor.data + const data = context.data + + const item = context.items.get(skillId) as M5Item + await item.roll() + }) + + html.find(".roll-general-button").on("click", async (event) => { + const row = event.target.parentElement.parentElement let skillName = row.dataset["skill"] const actor = this.actor as M5Character @@ -45,10 +68,10 @@ export default class M5CharacterSheet extends ActorSheet { const skill = data.skills.general[skillName] const attribute = data.attributes[skill.attribute] - console.log(skill, attribute) + //console.log(skill, attribute) const r = new Roll("1d20 + @fw + @bonus", { - fw: skill.fw + 12, + fw: skill.fw, bonus: M5Character.attributeBonus(attribute) }) await r.evaluate().then(value => { @@ -62,5 +85,38 @@ export default class M5CharacterSheet extends ActorSheet { return ChatMessage.create(chatData) }) }) + + html.find(".learn-button").on("click", async (event) => { + const row = event.target.parentElement.parentElement + let skillName = row.dataset["skill"] + + const data = this.actor.data.data + const unlearnedSkill = data.skills.general[skillName] as M5SkillUnlearned + + const itemData = { + name: (game as Game).i18n.localize("midgard5." + skillName), + type: "skill", + data: { + fw: unlearnedSkill.initial, + attribute: unlearnedSkill.attribute, + skill: skillName, + type: "general" + } as M5SkillLearned + } + + this.actor.createEmbeddedDocuments("Item", [itemData]).then(docs => { + const item = docs[0] + //console.log("createEmbeddedDocuments", item.data) + }) + }) + + // Drag & Drop + // const dragDropSkill = new DragDrop({ + // dragSelector: ".items-list .item", + // dropSelector: ".sheet-body", + // permissions: { dragstart: this._canDragStart.bind(this), drop: this._canDragDrop.bind(this) }, + // callbacks: { dragstart: this._onTransferItemDragStart.bind(this), drop: this._onTransferItemDrop.bind(this) }, + // }) + // dragDrop.bind(html[0]) } } diff --git a/source/module/sheets/M5ItemSheet.ts b/source/module/sheets/M5ItemSheet.ts index b3818b3..70b67f6 100644 --- a/source/module/sheets/M5ItemSheet.ts +++ b/source/module/sheets/M5ItemSheet.ts @@ -1,14 +1,40 @@ -export default class M5ItemSheet extends ItemSheet { + +export class M5ItemSheet extends ItemSheet { static get defaultOptions() { return mergeObject(super.defaultOptions, { width: 530, height: 340, classes: ["midgard5", "sheet", "item"] - }); + }) } get template() { - return 'systems/midgard5/templates/sheets/m5Item-Sheet.hbs'; + //console.log("M5ItemSheet", this.item.data.type) + const path = "systems/midgard5/templates/sheets/item" + return `${path}/${this.item.data.type}.hbs` } + + override getData(options?: Partial): ItemSheet.Data | Promise> { + return Promise.resolve(super.getData()).then(value => { + const context = value as any + + // Use a safe clone of the item data for further operations. + const itemData = context.item.data + + // Retrieve the roll data for TinyMCE editors. + context.rollData = {} + let actor = this.object?.parent ?? null + if (actor) { + context.rollData = actor.getRollData() + } + + // Add the actor's data to context.data for easier access, as well as flags. + context.data = itemData.data + context.flags = itemData.flags + + return context + }) + } + } diff --git a/source/style/Character-sheet.less b/source/style/Character-sheet.less index fabed6c..a1e1b06 100644 --- a/source/style/Character-sheet.less +++ b/source/style/Character-sheet.less @@ -40,4 +40,18 @@ text-align: right; font-weight: bold; } + + td { + &.center { + text-align: center; + } + + &.padding { + padding: 0 1rem 0 1rem; + } + } + + input.skill { + width: 5rem; + } } \ No newline at end of file diff --git a/source/template.json b/source/template.json index 352f2a7..3e9d580 100644 --- a/source/template.json +++ b/source/template.json @@ -7,7 +7,7 @@ "description": "", "class": "", "race": "", - "magic_using": false, + "magicUsing": false, "gender": "", "weight": "", "height": "", @@ -81,59 +81,58 @@ "skills": { "skills": { "preferredCombatSkill": "", - "learned": [], "general": { - "akrobatik": { "fw": 0, "attribute": "gw" }, - "alchimie": { "fw": 0, "attribute": "in" }, - "anfuehren": { "fw": 0, "attribute": "pa" }, - "athletik": { "fw": 0, "attribute": "st" }, - "balancieren": { "fw": 0, "attribute": "gw" }, - "beidhaendigerKampf": { "fw": 0, "attribute": "gs" }, - "beredsamkeit": { "fw": 0, "attribute": "pa" }, - "betaeuben": { "fw": 0, "attribute": "gs" }, - "bootfahren": { "fw": 0, "attribute": "gs" }, - "ersteHilfe": { "fw": 0, "attribute": "gs" }, - "etikette": { "fw": 0, "attribute": "in" }, - "fallenEntdecken": { "fw": 0, "attribute": "in" }, - "fallenmechanik": { "fw": 0, "attribute": "gs" }, - "faelschen": { "fw": 0, "attribute": "gs" }, - "fechten": { "fw": 0, "attribute": "gs" }, - "gassenwissen": { "fw": 0, "attribute": "in" }, - "gaukeln": { "fw": 0, "attribute": "gs" }, - "gelaendelauf": { "fw": 0, "attribute": "gw" }, - "geraetekunde": { "fw": 0, "attribute": "in" }, - "geschaeftssinn": { "fw": 0, "attribute": "in" }, - "gluecksspiel": { "fw": 0, "attribute": "gs" }, - "heilkunde": { "fw": 0, "attribute": "in" }, - "kampfInVollruestung": { "fw": 0, "attribute": "st" }, - "klettern": { "fw": 0, "attribute": "st" }, - "landeskunde": { "fw": 0, "attribute": "in" }, - "laufen": { "fw": 0, "attribute": "ko" }, - "lesenVonZauberschrift": { "fw": 0, "attribute": "in" }, - "meditieren": { "fw": 0, "attribute": "wk" }, - "menschenkenntnis": { "fw": 0, "attribute": "in" }, - "meucheln": { "fw": 0, "attribute": "gs" }, - "musizieren": { "fw": 0, "attribute": "gs" }, - "naturkunde": { "fw": 0, "attribute": "in" }, - "pflanzenkunde": { "fw": 0, "attribute": "in" }, - "reiten": { "fw": 0, "attribute": "gw" }, - "reiterkampf": { "fw": 0, "attribute": "gw" }, - "scharfschiessen": { "fw": 0, "attribute": "gs" }, - "schleichen": { "fw": 0, "attribute": "gw" }, - "schloesserOeffnen": { "fw": 0, "attribute": "gs" }, - "schwimmen": { "fw": 0, "attribute": "gw" }, - "seilkunst": { "fw": 0, "attribute": "gs" }, - "spurensuche": { "fw": 0, "attribute": "in" }, - "stehlen": { "fw": 0, "attribute": "gs" }, - "tarnen": { "fw": 0, "attribute": "gw" }, - "tauchen": { "fw": 0, "attribute": "ko" }, - "tierkunde": { "fw": 0, "attribute": "in" }, - "ueberleben": { "fw": 0, "attribute": "in" }, - "verfuehren": { "fw": 0, "attribute": "pa" }, - "verhoeren": { "fw": 0, "attribute": "pa" }, - "verstellen": { "fw": 0, "attribute": "pa" }, - "wagenlenken": { "fw": 0, "attribute": "gs" }, - "zauberkunde": { "fw": 0, "attribute": "in" } + "akrobatik": { "fw": 6, "attribute": "gw", "initial": 8 }, + "alchimie": { "fw": 0, "attribute": "in", "initial": 8 }, + "anfuehren": { "fw": 6, "attribute": "pa", "initial": 8 }, + "athletik": { "fw": 0, "attribute": "st", "initial": 8 }, + "balancieren": { "fw": 6, "attribute": "gw", "initial": 8 }, + "beidhaendigerKampf": { "fw": 0, "attribute": "gs", "initial": 8 }, + "beredsamkeit": { "fw": 3, "attribute": "pa", "initial": 8 }, + "betaeuben": { "fw": 6, "attribute": "gs", "initial": 8 }, + "bootfahren": { "fw": 3, "attribute": "gs", "initial": 8 }, + "ersteHilfe": { "fw": 0, "attribute": "gs", "initial": 8 }, + "etikette": { "fw": 0, "attribute": "in", "initial": 8 }, + "fallenEntdecken": { "fw": 0, "attribute": "in", "initial": 8 }, + "fallenmechanik": { "fw": 0, "attribute": "gs", "initial": 8 }, + "faelschen": { "fw": 0, "attribute": "gs", "initial": 8 }, + "fechten": { "fw": 0, "attribute": "gs", "initial": 8 }, + "gassenwissen": { "fw": 0, "attribute": "in", "initial": 8 }, + "gaukeln": { "fw": 0, "attribute": "gs", "initial": 8 }, + "gelaendelauf": { "fw": 6, "attribute": "gw", "initial": 8 }, + "geraetekunde": { "fw": 0, "attribute": "in", "initial": 8 }, + "geschaeftssinn": { "fw": 0, "attribute": "in", "initial": 8 }, + "gluecksspiel": { "fw": 0, "attribute": "gs", "initial": 8 }, + "heilkunde": { "fw": 0, "attribute": "in", "initial": 8 }, + "kampfInVollruestung": { "fw": 0, "attribute": "st", "initial": 8 }, + "klettern": { "fw": 6, "attribute": "st", "initial": 8 }, + "landeskunde": { "fw": 6, "attribute": "in", "initial": 8 }, + "laufen": { "fw": 0, "attribute": "ko", "initial": 8 }, + "lesenVonZauberschrift": { "fw": 0, "attribute": "in", "initial": 8 }, + "meditieren": { "fw": 0, "attribute": "wk", "initial": 8 }, + "menschenkenntnis": { "fw": 3, "attribute": "in", "initial": 8 }, + "meucheln": { "fw": 0, "attribute": "gs", "initial": 8 }, + "musizieren": { "fw": 0, "attribute": "gs", "initial": 8 }, + "naturkunde": { "fw": 0, "attribute": "in", "initial": 8 }, + "pflanzenkunde": { "fw": 0, "attribute": "in", "initial": 8 }, + "reiten": { "fw": 6, "attribute": "gw", "initial": 8 }, + "reiterkampf": { "fw": 0, "attribute": "gw", "initial": 8 }, + "scharfschiessen": { "fw": 0, "attribute": "gs", "initial": 8 }, + "schleichen": { "fw": 3, "attribute": "gw", "initial": 8 }, + "schloesserOeffnen": { "fw": 0, "attribute": "gs", "initial": 8 }, + "schwimmen": { "fw": 3, "attribute": "gw", "initial": 8 }, + "seilkunst": { "fw": 3, "attribute": "gs", "initial": 8 }, + "spurensuche": { "fw": 0, "attribute": "in", "initial": 8 }, + "stehlen": { "fw": 3, "attribute": "gs", "initial": 8 }, + "tarnen": { "fw": 3, "attribute": "gw", "initial": 8 }, + "tauchen": { "fw": 6, "attribute": "ko", "initial": 8 }, + "tierkunde": { "fw": 0, "attribute": "in", "initial": 8 }, + "ueberleben": { "fw": 6, "attribute": "in", "initial": 8 }, + "verfuehren": { "fw": 3, "attribute": "pa", "initial": 8 }, + "verhoeren": { "fw": 3, "attribute": "pa", "initial": 8 }, + "verstellen": { "fw": 3, "attribute": "pa", "initial": 8 }, + "wagenlenken": { "fw": 3, "attribute": "gs", "initial": 8 }, + "zauberkunde": { "fw": 0, "attribute": "in", "initial": 8 } }, "combat": {} } @@ -150,10 +149,10 @@ } }, "Item": { - "types": ["item", "weapon", "armor", "spell"], + "types": ["skill", "item", "weapon", "armor", "spell"], "templates": { "itemDescription": { - "description": " " + "description": "" }, "stats": { "damageBonus": 0, @@ -163,8 +162,29 @@ "resistanceMind": 0, "resistanceBody": 0, "spellBonus": 0 + }, + "attributeSelection": { + "attributes": { + "st": { "short": "midgard5.actor-st", "long": "midgard5.actor-st-long" }, + "gs": { "short": "midgard5.actor-gs", "long": "midgard5.actor-gs-long" }, + "gw": { "short": "midgard5.actor-gw", "long": "midgard5.actor-gw-long" }, + "ko": { "short": "midgard5.actor-ko", "long": "midgard5.actor-ko-long" }, + "in": { "short": "midgard5.actor-in", "long": "midgard5.actor-in-long" }, + "zt": { "short": "midgard5.actor-zt", "long": "midgard5.actor-zt-long" }, + "au": { "short": "midgard5.actor-au", "long": "midgard5.actor-au-long" }, + "pa": { "short": "midgard5.actor-pa", "long": "midgard5.actor-pa-long" }, + "wk": { "short": "midgard5.actor-wk", "long": "midgard5.actor-wk-long" } + } } }, + "skill": { + "templates": ["itemDescription", "attributeSelection"], + "fw": 0, + "attribute": "st", + "skill": "", + "type": "general", + "formula": "1d20 + @fw + @bonus" + }, "item": { "templates": ["itemDescription"], "quantity": 1, diff --git a/templates/sheets/character/base_values.hbs b/templates/sheets/character/base_values.hbs index f845e84..a102bce 100644 --- a/templates/sheets/character/base_values.hbs +++ b/templates/sheets/character/base_values.hbs @@ -2,8 +2,8 @@
{{localize "midgard5.class"}} - - + + Grad {{data.calc.level}}
diff --git a/templates/sheets/character/skills.hbs b/templates/sheets/character/skills.hbs index 3272b1e..b5331f7 100644 --- a/templates/sheets/character/skills.hbs +++ b/templates/sheets/character/skills.hbs @@ -1,12 +1,49 @@ +

Gelernte Fertigkeiten

+ + + + + + + + + + + + {{#each data.calc.skills.general as |skill label|}} + + + + + + + + {{/each}} + +
{{localize "midgard5.skill"}}{{localize "midgard5.fw"}}{{localize "midgard5.bonus"}}{{localize "midgard5.ew"}}
{{label}}{{skill.fw}}{{skillBonus ../actor._id skill}}{{skillEw ../actor._id skill}}
+

Ungelernte Fertigkeiten

-
    - {{#each actor.data.skills.general as |skill key|}} -
  1. -
    Roll
    - {{localizeMidgard key}} -
    - -
    -
  2. - {{/each}} -
\ No newline at end of file + + + + + + + + + + + + + {{#each actor.data.skills.general as |skill key|}} + + + + + + + + + {{/each}} + +
{{localize "midgard5.skill"}}{{localize "midgard5.fw"}}{{localize "midgard5.bonus"}}{{localize "midgard5.ew"}}
{{localizeMidgard key}}{{skill.fw}}{{skillBonus ../actor._id skill}}{{skillEw ../actor._id skill}}
\ No newline at end of file diff --git a/templates/sheets/m5Item-Sheet.hbs b/templates/sheets/item/item.hbs similarity index 100% rename from templates/sheets/m5Item-Sheet.hbs rename to templates/sheets/item/item.hbs diff --git a/templates/sheets/item/skill.hbs b/templates/sheets/item/skill.hbs new file mode 100644 index 0000000..04bf3f8 --- /dev/null +++ b/templates/sheets/item/skill.hbs @@ -0,0 +1,23 @@ +
+
+ +

+
+
+
+ {{localize "midgard5.skill-value"}} + + + {{localize "midgard5.attribute"}} + +
+ + {{editor content=data.description target="data.description" button=true owner=owner editable=editable}} +
+
\ No newline at end of file