Add skills as items
This commit is contained in:
parent
ab59b19e56
commit
c7f6a38acf
12
lang/de.json
12
lang/de.json
|
|
@ -8,7 +8,16 @@
|
||||||
"ITEM.TypeArmor": "Rüstung",
|
"ITEM.TypeArmor": "Rüstung",
|
||||||
"ITEM.TypeSpell": "Zauber",
|
"ITEM.TypeSpell": "Zauber",
|
||||||
|
|
||||||
|
"midgard5.roll": "Würfeln",
|
||||||
|
"midgard5.learn": "Lernen",
|
||||||
|
|
||||||
"midgard5.description": "Beschreibung",
|
"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-value": "Wert",
|
||||||
"midgard5.item-quantity": "Menge",
|
"midgard5.item-quantity": "Menge",
|
||||||
|
|
@ -36,7 +45,6 @@
|
||||||
"midgard5.actor-wk": "Wk",
|
"midgard5.actor-wk": "Wk",
|
||||||
"midgard5.actor-wk-long": "Willenskraft",
|
"midgard5.actor-wk-long": "Willenskraft",
|
||||||
|
|
||||||
"midgard5.bonus": "Bonus",
|
|
||||||
"midgard5.aktuell": "Akt.",
|
"midgard5.aktuell": "Akt.",
|
||||||
"midgard5.maximum": "Max.",
|
"midgard5.maximum": "Max.",
|
||||||
"midgard5.attrvalue": "Wert",
|
"midgard5.attrvalue": "Wert",
|
||||||
|
|
@ -48,7 +56,7 @@
|
||||||
|
|
||||||
"midgard5.class": "Klasse",
|
"midgard5.class": "Klasse",
|
||||||
"midgard5.race": "Rasse",
|
"midgard5.race": "Rasse",
|
||||||
"midgard5.magic_using": "zauberkundig",
|
"midgard5.magicUsing": "zauberkundig",
|
||||||
"midgard5.gender": "Geschlecht",
|
"midgard5.gender": "Geschlecht",
|
||||||
"midgard5.weight": "Gewicht",
|
"midgard5.weight": "Gewicht",
|
||||||
"midgard5.height": "Größe",
|
"midgard5.height": "Größe",
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,22 @@
|
||||||
import Logger from "./utils/Logger"
|
import Logger from "./utils/Logger"
|
||||||
import M5ItemSheet from "./module/sheets/M5ItemSheet"
|
|
||||||
import M5CharacterSheet from "./module/sheets/M5CharacterSheet"
|
import M5CharacterSheet from "./module/sheets/M5CharacterSheet"
|
||||||
import preloadTemplates from "./PreloadTemplates"
|
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 () => {
|
Hooks.once("init", async () => {
|
||||||
Logger.log("M5 | Initialisierung Midgard 5")
|
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) => {
|
Handlebars.registerHelper("localizeMidgard", (str: string) => {
|
||||||
const template = Handlebars.compile("{{localize value}}")
|
const template = Handlebars.compile("{{localize value}}")
|
||||||
return template({
|
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
|
// Default Sheet für Items definieren und das Standardsheet deaktivieren
|
||||||
Items.unregisterSheet("core", ItemSheet)
|
Items.unregisterSheet("core", ItemSheet)
|
||||||
Items.registerSheet("midgard5", M5ItemSheet, { makeDefault: true })
|
Items.registerSheet("midgard5", M5ItemSheet, { makeDefault: true })
|
||||||
|
|
@ -23,6 +47,7 @@ Hooks.once("init", async () => {
|
||||||
Actors.registerSheet("midgard5", M5CharacterSheet, { makeDefault: true })
|
Actors.registerSheet("midgard5", M5CharacterSheet, { makeDefault: true })
|
||||||
|
|
||||||
CONFIG.Actor.documentClass = M5Character
|
CONFIG.Actor.documentClass = M5Character
|
||||||
|
CONFIG.Item.documentClass = M5Item
|
||||||
|
|
||||||
//RegisterSettings();
|
//RegisterSettings();
|
||||||
await preloadTemplates()
|
await preloadTemplates()
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
@ -1,16 +1,4 @@
|
||||||
|
import { M5Attribute, M5Skill, M5SkillLearned } from "../M5Base"
|
||||||
export interface M5Skill {
|
|
||||||
label: string
|
|
||||||
skill: string
|
|
||||||
attribute: string
|
|
||||||
fw: number
|
|
||||||
ew: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface M5Attribute {
|
|
||||||
value: number
|
|
||||||
bonus: number
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface M5CharacterCalculatedData {
|
export interface M5CharacterCalculatedData {
|
||||||
level: number,
|
level: number,
|
||||||
|
|
@ -29,10 +17,11 @@ export interface M5CharacterCalculatedData {
|
||||||
enduranceBonus: number
|
enduranceBonus: number
|
||||||
},
|
},
|
||||||
skills: {
|
skills: {
|
||||||
|
general: {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class M5Character extends Actor {
|
export class M5Character extends Actor {
|
||||||
|
|
||||||
// constructor(
|
// constructor(
|
||||||
// data: ConstructorParameters<typeof foundry.documents.BaseActor>[0],
|
// data: ConstructorParameters<typeof foundry.documents.BaseActor>[0],
|
||||||
|
|
@ -61,7 +50,6 @@ export default class M5Character extends Actor {
|
||||||
|
|
||||||
prepareDerivedData() {
|
prepareDerivedData() {
|
||||||
const context = (this as any).data;
|
const context = (this as any).data;
|
||||||
//console.log(context)
|
|
||||||
|
|
||||||
context.data.calc = {
|
context.data.calc = {
|
||||||
level: 0,
|
level: 0,
|
||||||
|
|
@ -79,7 +67,9 @@ export default class M5Character extends Actor {
|
||||||
poisonResistance: 0,
|
poisonResistance: 0,
|
||||||
enduranceBonus: 0
|
enduranceBonus: 0
|
||||||
},
|
},
|
||||||
skills: {}
|
skills: {
|
||||||
|
general: {}
|
||||||
|
}
|
||||||
} as M5CharacterCalculatedData
|
} as M5CharacterCalculatedData
|
||||||
|
|
||||||
const data = context.data
|
const data = context.data
|
||||||
|
|
@ -98,10 +88,19 @@ export default class M5Character extends Actor {
|
||||||
calc.stats.movementBonus = 0
|
calc.stats.movementBonus = 0
|
||||||
calc.stats.resistanceMind = calc.stats.defense
|
calc.stats.resistanceMind = calc.stats.defense
|
||||||
calc.stats.resistanceBody = calc.stats.defense + 1
|
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.brawl = Math.floor((st + gw) / 20)
|
||||||
calc.stats.poisonResistance = 30 + Math.floor(ko / 2)
|
calc.stats.poisonResistance = 30 + Math.floor(ko / 2)
|
||||||
calc.stats.enduranceBonus = Math.floor(ko/10) + Math.floor(st/20)
|
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<number> = [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]
|
static readonly levelThreshold: Array<number> = [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]
|
return ret ? ret[1] : M5Character.spellCastingThreshold[M5Character.spellCastingThreshold.length - 1][1]
|
||||||
}
|
}
|
||||||
|
|
||||||
attributeStrength() {
|
skillBonus(skill: M5Skill, skillName?: string) {
|
||||||
const data = (this as any).data.data
|
const attribute = this.attribute(skill.attribute)
|
||||||
return M5Character.attributeMinMax(data.data.attributes.st)
|
let ret = attribute ? M5Character.attributeBonus(attribute) : 0
|
||||||
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
attributeDexterity() {
|
skillEw(skill: M5Skill, skillName?: string) {
|
||||||
const data = (this as any).data.data
|
const bonus = this.skillBonus(skill, skillName)
|
||||||
return M5Character.attributeMinMax(data.data.attributes.gs)
|
return skill.fw + bonus
|
||||||
}
|
}
|
||||||
|
|
||||||
attributeAgility() {
|
attribute(name: string): M5Attribute {
|
||||||
const data = (this as any).data.data
|
const context = (this as any).data
|
||||||
return M5Character.attributeMinMax(data.data.attributes.gw)
|
return context.data.attributes[name]
|
||||||
}
|
|
||||||
|
|
||||||
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)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
import Logger from "../../utils/Logger"
|
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 {
|
export default class M5CharacterSheet extends ActorSheet {
|
||||||
|
|
||||||
|
|
@ -27,7 +29,7 @@ export default class M5CharacterSheet extends ActorSheet {
|
||||||
context.actor = actorData;
|
context.actor = actorData;
|
||||||
context.data = actorData.data;
|
context.data = actorData.data;
|
||||||
|
|
||||||
//console.log("Sheet Promise", context)
|
//console.log("Sheet Promise", context.actor, context.data)
|
||||||
return context
|
return context
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -35,8 +37,29 @@ export default class M5CharacterSheet extends ActorSheet {
|
||||||
override activateListeners(html: JQuery) {
|
override activateListeners(html: JQuery) {
|
||||||
super.activateListeners(html)
|
super.activateListeners(html)
|
||||||
|
|
||||||
html.find(".roll-button").on("click", async (event) => {
|
html.find(".edit-skill").on("click", async (event) => {
|
||||||
const row = event.target.parentElement
|
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"]
|
let skillName = row.dataset["skill"]
|
||||||
|
|
||||||
const actor = this.actor as M5Character
|
const actor = this.actor as M5Character
|
||||||
|
|
@ -45,10 +68,10 @@ export default class M5CharacterSheet extends ActorSheet {
|
||||||
|
|
||||||
const skill = data.skills.general[skillName]
|
const skill = data.skills.general[skillName]
|
||||||
const attribute = data.attributes[skill.attribute]
|
const attribute = data.attributes[skill.attribute]
|
||||||
console.log(skill, attribute)
|
//console.log(skill, attribute)
|
||||||
|
|
||||||
const r = new Roll("1d20 + @fw + @bonus", {
|
const r = new Roll("1d20 + @fw + @bonus", {
|
||||||
fw: skill.fw + 12,
|
fw: skill.fw,
|
||||||
bonus: M5Character.attributeBonus(attribute)
|
bonus: M5Character.attributeBonus(attribute)
|
||||||
})
|
})
|
||||||
await r.evaluate().then(value => {
|
await r.evaluate().then(value => {
|
||||||
|
|
@ -62,5 +85,38 @@ export default class M5CharacterSheet extends ActorSheet {
|
||||||
return ChatMessage.create(chatData)
|
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])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,40 @@
|
||||||
export default class M5ItemSheet extends ItemSheet {
|
|
||||||
|
export class M5ItemSheet extends ItemSheet {
|
||||||
|
|
||||||
static get defaultOptions() {
|
static get defaultOptions() {
|
||||||
return mergeObject(super.defaultOptions, {
|
return mergeObject(super.defaultOptions, {
|
||||||
width: 530,
|
width: 530,
|
||||||
height: 340,
|
height: 340,
|
||||||
classes: ["midgard5", "sheet", "item"]
|
classes: ["midgard5", "sheet", "item"]
|
||||||
});
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
get template() {
|
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.Options>): ItemSheet.Data<ItemSheet.Options> | Promise<ItemSheet.Data<ItemSheet.Options>> {
|
||||||
|
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
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,4 +40,18 @@
|
||||||
text-align: right;
|
text-align: right;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
&.center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.padding {
|
||||||
|
padding: 0 1rem 0 1rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
input.skill {
|
||||||
|
width: 5rem;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
"description": "",
|
"description": "",
|
||||||
"class": "",
|
"class": "",
|
||||||
"race": "",
|
"race": "",
|
||||||
"magic_using": false,
|
"magicUsing": false,
|
||||||
"gender": "",
|
"gender": "",
|
||||||
"weight": "",
|
"weight": "",
|
||||||
"height": "",
|
"height": "",
|
||||||
|
|
@ -81,59 +81,58 @@
|
||||||
"skills": {
|
"skills": {
|
||||||
"skills": {
|
"skills": {
|
||||||
"preferredCombatSkill": "",
|
"preferredCombatSkill": "",
|
||||||
"learned": [],
|
|
||||||
"general": {
|
"general": {
|
||||||
"akrobatik": { "fw": 0, "attribute": "gw" },
|
"akrobatik": { "fw": 6, "attribute": "gw", "initial": 8 },
|
||||||
"alchimie": { "fw": 0, "attribute": "in" },
|
"alchimie": { "fw": 0, "attribute": "in", "initial": 8 },
|
||||||
"anfuehren": { "fw": 0, "attribute": "pa" },
|
"anfuehren": { "fw": 6, "attribute": "pa", "initial": 8 },
|
||||||
"athletik": { "fw": 0, "attribute": "st" },
|
"athletik": { "fw": 0, "attribute": "st", "initial": 8 },
|
||||||
"balancieren": { "fw": 0, "attribute": "gw" },
|
"balancieren": { "fw": 6, "attribute": "gw", "initial": 8 },
|
||||||
"beidhaendigerKampf": { "fw": 0, "attribute": "gs" },
|
"beidhaendigerKampf": { "fw": 0, "attribute": "gs", "initial": 8 },
|
||||||
"beredsamkeit": { "fw": 0, "attribute": "pa" },
|
"beredsamkeit": { "fw": 3, "attribute": "pa", "initial": 8 },
|
||||||
"betaeuben": { "fw": 0, "attribute": "gs" },
|
"betaeuben": { "fw": 6, "attribute": "gs", "initial": 8 },
|
||||||
"bootfahren": { "fw": 0, "attribute": "gs" },
|
"bootfahren": { "fw": 3, "attribute": "gs", "initial": 8 },
|
||||||
"ersteHilfe": { "fw": 0, "attribute": "gs" },
|
"ersteHilfe": { "fw": 0, "attribute": "gs", "initial": 8 },
|
||||||
"etikette": { "fw": 0, "attribute": "in" },
|
"etikette": { "fw": 0, "attribute": "in", "initial": 8 },
|
||||||
"fallenEntdecken": { "fw": 0, "attribute": "in" },
|
"fallenEntdecken": { "fw": 0, "attribute": "in", "initial": 8 },
|
||||||
"fallenmechanik": { "fw": 0, "attribute": "gs" },
|
"fallenmechanik": { "fw": 0, "attribute": "gs", "initial": 8 },
|
||||||
"faelschen": { "fw": 0, "attribute": "gs" },
|
"faelschen": { "fw": 0, "attribute": "gs", "initial": 8 },
|
||||||
"fechten": { "fw": 0, "attribute": "gs" },
|
"fechten": { "fw": 0, "attribute": "gs", "initial": 8 },
|
||||||
"gassenwissen": { "fw": 0, "attribute": "in" },
|
"gassenwissen": { "fw": 0, "attribute": "in", "initial": 8 },
|
||||||
"gaukeln": { "fw": 0, "attribute": "gs" },
|
"gaukeln": { "fw": 0, "attribute": "gs", "initial": 8 },
|
||||||
"gelaendelauf": { "fw": 0, "attribute": "gw" },
|
"gelaendelauf": { "fw": 6, "attribute": "gw", "initial": 8 },
|
||||||
"geraetekunde": { "fw": 0, "attribute": "in" },
|
"geraetekunde": { "fw": 0, "attribute": "in", "initial": 8 },
|
||||||
"geschaeftssinn": { "fw": 0, "attribute": "in" },
|
"geschaeftssinn": { "fw": 0, "attribute": "in", "initial": 8 },
|
||||||
"gluecksspiel": { "fw": 0, "attribute": "gs" },
|
"gluecksspiel": { "fw": 0, "attribute": "gs", "initial": 8 },
|
||||||
"heilkunde": { "fw": 0, "attribute": "in" },
|
"heilkunde": { "fw": 0, "attribute": "in", "initial": 8 },
|
||||||
"kampfInVollruestung": { "fw": 0, "attribute": "st" },
|
"kampfInVollruestung": { "fw": 0, "attribute": "st", "initial": 8 },
|
||||||
"klettern": { "fw": 0, "attribute": "st" },
|
"klettern": { "fw": 6, "attribute": "st", "initial": 8 },
|
||||||
"landeskunde": { "fw": 0, "attribute": "in" },
|
"landeskunde": { "fw": 6, "attribute": "in", "initial": 8 },
|
||||||
"laufen": { "fw": 0, "attribute": "ko" },
|
"laufen": { "fw": 0, "attribute": "ko", "initial": 8 },
|
||||||
"lesenVonZauberschrift": { "fw": 0, "attribute": "in" },
|
"lesenVonZauberschrift": { "fw": 0, "attribute": "in", "initial": 8 },
|
||||||
"meditieren": { "fw": 0, "attribute": "wk" },
|
"meditieren": { "fw": 0, "attribute": "wk", "initial": 8 },
|
||||||
"menschenkenntnis": { "fw": 0, "attribute": "in" },
|
"menschenkenntnis": { "fw": 3, "attribute": "in", "initial": 8 },
|
||||||
"meucheln": { "fw": 0, "attribute": "gs" },
|
"meucheln": { "fw": 0, "attribute": "gs", "initial": 8 },
|
||||||
"musizieren": { "fw": 0, "attribute": "gs" },
|
"musizieren": { "fw": 0, "attribute": "gs", "initial": 8 },
|
||||||
"naturkunde": { "fw": 0, "attribute": "in" },
|
"naturkunde": { "fw": 0, "attribute": "in", "initial": 8 },
|
||||||
"pflanzenkunde": { "fw": 0, "attribute": "in" },
|
"pflanzenkunde": { "fw": 0, "attribute": "in", "initial": 8 },
|
||||||
"reiten": { "fw": 0, "attribute": "gw" },
|
"reiten": { "fw": 6, "attribute": "gw", "initial": 8 },
|
||||||
"reiterkampf": { "fw": 0, "attribute": "gw" },
|
"reiterkampf": { "fw": 0, "attribute": "gw", "initial": 8 },
|
||||||
"scharfschiessen": { "fw": 0, "attribute": "gs" },
|
"scharfschiessen": { "fw": 0, "attribute": "gs", "initial": 8 },
|
||||||
"schleichen": { "fw": 0, "attribute": "gw" },
|
"schleichen": { "fw": 3, "attribute": "gw", "initial": 8 },
|
||||||
"schloesserOeffnen": { "fw": 0, "attribute": "gs" },
|
"schloesserOeffnen": { "fw": 0, "attribute": "gs", "initial": 8 },
|
||||||
"schwimmen": { "fw": 0, "attribute": "gw" },
|
"schwimmen": { "fw": 3, "attribute": "gw", "initial": 8 },
|
||||||
"seilkunst": { "fw": 0, "attribute": "gs" },
|
"seilkunst": { "fw": 3, "attribute": "gs", "initial": 8 },
|
||||||
"spurensuche": { "fw": 0, "attribute": "in" },
|
"spurensuche": { "fw": 0, "attribute": "in", "initial": 8 },
|
||||||
"stehlen": { "fw": 0, "attribute": "gs" },
|
"stehlen": { "fw": 3, "attribute": "gs", "initial": 8 },
|
||||||
"tarnen": { "fw": 0, "attribute": "gw" },
|
"tarnen": { "fw": 3, "attribute": "gw", "initial": 8 },
|
||||||
"tauchen": { "fw": 0, "attribute": "ko" },
|
"tauchen": { "fw": 6, "attribute": "ko", "initial": 8 },
|
||||||
"tierkunde": { "fw": 0, "attribute": "in" },
|
"tierkunde": { "fw": 0, "attribute": "in", "initial": 8 },
|
||||||
"ueberleben": { "fw": 0, "attribute": "in" },
|
"ueberleben": { "fw": 6, "attribute": "in", "initial": 8 },
|
||||||
"verfuehren": { "fw": 0, "attribute": "pa" },
|
"verfuehren": { "fw": 3, "attribute": "pa", "initial": 8 },
|
||||||
"verhoeren": { "fw": 0, "attribute": "pa" },
|
"verhoeren": { "fw": 3, "attribute": "pa", "initial": 8 },
|
||||||
"verstellen": { "fw": 0, "attribute": "pa" },
|
"verstellen": { "fw": 3, "attribute": "pa", "initial": 8 },
|
||||||
"wagenlenken": { "fw": 0, "attribute": "gs" },
|
"wagenlenken": { "fw": 3, "attribute": "gs", "initial": 8 },
|
||||||
"zauberkunde": { "fw": 0, "attribute": "in" }
|
"zauberkunde": { "fw": 0, "attribute": "in", "initial": 8 }
|
||||||
},
|
},
|
||||||
"combat": {}
|
"combat": {}
|
||||||
}
|
}
|
||||||
|
|
@ -150,7 +149,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Item": {
|
"Item": {
|
||||||
"types": ["item", "weapon", "armor", "spell"],
|
"types": ["skill", "item", "weapon", "armor", "spell"],
|
||||||
"templates": {
|
"templates": {
|
||||||
"itemDescription": {
|
"itemDescription": {
|
||||||
"description": ""
|
"description": ""
|
||||||
|
|
@ -163,7 +162,28 @@
|
||||||
"resistanceMind": 0,
|
"resistanceMind": 0,
|
||||||
"resistanceBody": 0,
|
"resistanceBody": 0,
|
||||||
"spellBonus": 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": {
|
"item": {
|
||||||
"templates": ["itemDescription"],
|
"templates": ["itemDescription"],
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
<div class="flexrow">
|
<div class="flexrow">
|
||||||
<span class="flex0">{{localize "midgard5.class"}}</span>
|
<span class="flex0">{{localize "midgard5.class"}}</span>
|
||||||
<input class="flex3" name="data.info.class" type="text" value="{{data.info.class}}" data-dtype="String" />
|
<input class="flex3" name="data.info.class" type="text" value="{{data.info.class}}" data-dtype="String" />
|
||||||
<input id="data.info.magic_using" type="checkbox" name="data.info.magic_using" {{checked data.info.magic_using}}>
|
<input id="data.info.magicUsing" type="checkbox" name="data.info.magicUsing" {{checked data.info.magicUsing}}>
|
||||||
<label class="flex0" for="data.info.magic_using">{{localize "midgard5.magic_using"}}</label>
|
<label class="flex0" for="data.info.magicUsing">{{localize "midgard5.magicUsing"}}</label>
|
||||||
<span class="level-display">Grad {{data.calc.level}}</span>
|
<span class="level-display">Grad {{data.calc.level}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,49 @@
|
||||||
<h3>Ungelernte Fertigkeiten</h3>
|
<h3>Gelernte Fertigkeiten</h3>
|
||||||
<ol class="attributes-list">
|
<table>
|
||||||
{{#each actor.data.skills.general as |skill key|}}
|
<thead>
|
||||||
<li class="attribute flexrow" data-skill="{{key}}">
|
<tr>
|
||||||
<div class="roll-button">Roll </div>
|
<th>{{localize "midgard5.skill"}}</th>
|
||||||
<span class="attribute-label flexrow" name="data.skills.{{key}}.label">{{localizeMidgard key}}</span>
|
<th>{{localize "midgard5.fw"}}</th>
|
||||||
<div class="attribute-editbox flexrow">
|
<th>{{localize "midgard5.bonus"}}</th>
|
||||||
<input class="attribute-value" type="text" name="data.skills.general.{{key}}.fw" value="{{skill.fw}}" data-dtype="Number" readonly />
|
<th>{{localize "midgard5.ew"}}</th>
|
||||||
</div>
|
<th></th>
|
||||||
</li>
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#each data.calc.skills.general as |skill label|}}
|
||||||
|
<tr data-skill="{{skill.id}}">
|
||||||
|
<td class="padding edit-skill">{{label}}</td>
|
||||||
|
<td class="center">{{skill.fw}}</td>
|
||||||
|
<td class="center">{{skillBonus ../actor._id skill}}</td>
|
||||||
|
<td class="center">{{skillEw ../actor._id skill}}</td>
|
||||||
|
<td><button class="roll-learned-button">{{localize "midgard5.roll"}}</button></td>
|
||||||
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</ol>
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<h3>Ungelernte Fertigkeiten</h3>
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th></th>
|
||||||
|
<th>{{localize "midgard5.skill"}}</th>
|
||||||
|
<th>{{localize "midgard5.fw"}}</th>
|
||||||
|
<th>{{localize "midgard5.bonus"}}</th>
|
||||||
|
<th>{{localize "midgard5.ew"}}</th>
|
||||||
|
<th></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#each actor.data.skills.general as |skill key|}}
|
||||||
|
<tr data-skill="{{key}}">
|
||||||
|
<td><button class="learn-button">{{localize "midgard5.learn"}}</button></td>
|
||||||
|
<td class="padding">{{localizeMidgard key}}</td>
|
||||||
|
<td class="center">{{skill.fw}}</td>
|
||||||
|
<td class="center">{{skillBonus ../actor._id skill}}</td>
|
||||||
|
<td class="center">{{skillEw ../actor._id skill}}</td>
|
||||||
|
<td><button class="roll-general-button">{{localize "midgard5.roll"}}</button></td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
@ -0,0 +1,23 @@
|
||||||
|
<form class="{{cssClass}}" autocomplete="off">
|
||||||
|
<header class="sheet-header">
|
||||||
|
<img class="item-img" src="{{item.img}}" data-edit="img" title="{{item.name}}" />
|
||||||
|
<h1><input name="name" type="text" value="{{item.name}}" placeholder="Name" /></h1>
|
||||||
|
</header>
|
||||||
|
<div class="sheet-content">
|
||||||
|
<div class="flexrow">
|
||||||
|
<span>{{localize "midgard5.skill-value"}}</span>
|
||||||
|
<input name="data.fw" type="text" value="{{data.fw}}" data-dtype="Number" />
|
||||||
|
|
||||||
|
<span>{{localize "midgard5.attribute"}}</span>
|
||||||
|
<select class="select-attribute" name="data.attribute" data-type="String">
|
||||||
|
{{#select data.attribute}}
|
||||||
|
{{#each data.attributes as |attribute key|}}
|
||||||
|
<option value="{{key}}">{{localize attribute.long}}</option>
|
||||||
|
{{/each}}
|
||||||
|
{{/select}}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
Loading…
Reference in New Issue