+ Button für Skills (#59)

Changes:
 + Styling anpassung für + buttons
 + CreatItem funktion angepasst, man kann optionen reingeben
 + button um skills zu erstellen eingefügt
Reviewed-on: #59
This commit is contained in:
Byroks 2024-02-21 22:29:58 +01:00
parent a46ef87e3f
commit 1624602407
8 changed files with 64 additions and 63 deletions

View File

@ -61,6 +61,13 @@ export enum M5ItemType {
EFFECT = "effect", EFFECT = "effect",
} }
export enum M5SkillType {
INNATE = "innate",
GENERAL = "general",
LANGUAGE = "language",
COMBAT = "combat",
}
export enum M5EwResult { export enum M5EwResult {
TBD = "", TBD = "",
FUMBLE = "roll-ew-result-fumble", FUMBLE = "roll-ew-result-fumble",

View File

@ -1,5 +1,5 @@
import { M5Item } from "../items/M5Item"; import { M5Item } from "../items/M5Item";
import { M5Attribute, M5CharacterCalculatedData, M5ItemMod, M5ItemType, M5ModOperation, M5ModResult, M5RollData, M5Skill, M5SkillCalculated, M5SkillLearned } from "../M5Base"; import { M5Attribute, M5CharacterCalculatedData, M5ItemMod, M5ItemType, M5ModOperation, M5ModResult, M5RollData, M5Skill, M5SkillCalculated, M5SkillLearned, M5SkillType } from "../M5Base";
import M5ModAggregate from "./M5ModAggregate"; import M5ModAggregate from "./M5ModAggregate";
export class M5Character extends Actor { export class M5Character extends Actor {
// constructor( // constructor(
@ -523,10 +523,11 @@ export class M5Character extends Actor {
}); });
} }
createItem(itemName: string, itemType: M5ItemType): Promise<M5Item> { createItem(itemName: string, itemType: M5ItemType, options?: any): Promise<M5Item> {
const itemData = { const itemData = {
name: itemName, name: itemName,
type: itemType, type: itemType,
data: options,
}; };
return (this as any).createEmbeddedDocuments("Item", [itemData]).then((docs) => { return (this as any).createEmbeddedDocuments("Item", [itemData]).then((docs) => {

View File

@ -1,7 +1,7 @@
import Logger from "../../utils/Logger"; import Logger from "../../utils/Logger";
import { M5Character } from "../actors/M5Character"; import { M5Character } from "../actors/M5Character";
import { M5Item } from "../items/M5Item"; import { M5Item } from "../items/M5Item";
import { M5ItemType, M5SkillLearned, M5SkillUnlearned } from "../M5Base"; import { M5ItemType, M5SkillLearned, M5SkillType, M5SkillUnlearned } from "../M5Base";
import { M5Roll } from "../rolls/M5Roll"; import { M5Roll } from "../rolls/M5Roll";
export default class M5CharacterSheet extends ActorSheet { export default class M5CharacterSheet extends ActorSheet {
@ -270,11 +270,12 @@ export default class M5CharacterSheet extends ActorSheet {
const context = this.actor as any; const context = this.actor as any;
const item = context.items.get(itemId); const item = context.items.get(itemId);
if (item.system.equipped === true) { item.update({
item.system.equipped = false; data: {
} else { equipped: !item.system.equipped,
item.system.equipped = true; },
} });
this.render(); this.render();
}); });
@ -282,14 +283,7 @@ export default class M5CharacterSheet extends ActorSheet {
const data = this.actor.system; const data = this.actor.system;
const character = this.actor as M5Character; const character = this.actor as M5Character;
character.createItem((game as Game).i18n.localize("TYPES.Item.item"), M5ItemType.ITEM).then((i) => { character.createItem((game as Game).i18n.localize("TYPES.Item.item"), M5ItemType.ITEM, { quantity: 1 });
const item = i as any;
item.update({
data: {
quantity: 1,
},
});
});
}); });
html.find(".add-weapon").on("click", async (event) => { html.find(".add-weapon").on("click", async (event) => {
@ -317,42 +311,51 @@ export default class M5CharacterSheet extends ActorSheet {
const data = this.actor.system; const data = this.actor.system;
const character = this.actor as M5Character; const character = this.actor as M5Character;
character.createItem((game as Game).i18n.localize("TYPES.Item.container"), M5ItemType.CONTAINER).then((i) => { character.createItem((game as Game).i18n.localize("TYPES.Item.container"), M5ItemType.CONTAINER, { quantity: 1 });
const item = i as any;
item.update({
data: {
quantity: 1,
},
}); });
html.find(".add-innate-skill").on("click", async (event) => {
const data = this.actor.system;
const character = this.actor as M5Character;
character.createItem((game as Game).i18n.localize("TYPES.Item.innate-ability"), M5ItemType.SKILL, { type: M5SkillType.INNATE });
}); });
html.find(".add-general-skill").on("click", async (event) => {
const data = this.actor.system;
const character = this.actor as M5Character;
character.createItem((game as Game).i18n.localize("TYPES.Item.skill"), M5ItemType.SKILL, { type: M5SkillType.GENERAL });
});
html.find(".add-combat-skill").on("click", async (event) => {
const data = this.actor.system;
const character = this.actor as M5Character;
character.createItem((game as Game).i18n.localize("TYPES.Item.weapon-skill"), M5ItemType.SKILL, { type: M5SkillType.COMBAT });
});
html.find(".add-language-skill").on("click", async (event) => {
const data = this.actor.system;
const character = this.actor as M5Character;
character.createItem((game as Game).i18n.localize("TYPES.Item.language"), M5ItemType.SKILL, { type: M5SkillType.LANGUAGE });
}); });
html.find(".add-spell").on("click", async (event) => { html.find(".add-spell").on("click", async (event) => {
const data = this.actor.system; const data = this.actor.system;
const character = this.actor as M5Character; const character = this.actor as M5Character;
character.createItem((game as Game).i18n.localize("TYPES.Item.spell"), M5ItemType.SPELL).then((i) => { character.createItem((game as Game).i18n.localize("TYPES.Item.spell"), M5ItemType.SPELL, { process: "none" });
const item = i as any;
item.update({
data: {
process: "none",
},
});
});
}); });
html.find(".add-kampfkunst").on("click", async (event) => { html.find(".add-kampfkunst").on("click", async (event) => {
const data = this.actor.system; const data = this.actor.system;
const character = this.actor as M5Character; const character = this.actor as M5Character;
character.createItem((game as Game).i18n.localize("TYPES.Item.kampfkunst"), M5ItemType.KAMPFKUNST).then((i) => { character.createItem((game as Game).i18n.localize("TYPES.Item.kampfkunst"), M5ItemType.KAMPFKUNST, {
const item = i as any;
item.update({
data: {
type: "angriff", type: "angriff",
variante: "anstuermen", variante: "anstuermen",
},
});
}); });
}); });

View File

@ -84,7 +84,7 @@
<th class="title">{{localize "midgard5.kampfkunst-variante-short"}}</th> <th class="title">{{localize "midgard5.kampfkunst-variante-short"}}</th>
<th class="title">{{localize "midgard5.ew"}}</th> <th class="title">{{localize "midgard5.ew"}}</th>
<th class="title"><img src="/icons/svg/d20.svg" class="table-icon"></th> <th class="title"><img src="/icons/svg/d20.svg" class="table-icon"></th>
<th class="title add-kampfkunst"><i class="fa-regular fa-plus"></i></th> <td><a class="title add-kampfkunst"><i class="fa-regular fa-plus"></i></a></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -2,7 +2,7 @@
<thead> <thead>
<tr> <tr>
<th class="title">{{localize "TYPES.Item.effect"}}</th> <th class="title">{{localize "TYPES.Item.effect"}}</th>
<th class="title add-effect"><i class="fa-regular fa-plus"></i></th> <td><a class="title add-effect"><i class="fa-regular fa-plus"></i></a></th>
</tr> </tr>
</thead> </thead>

View File

@ -42,7 +42,7 @@
<th class="title center">{{localize "midgard5.item-value"}}</th> <th class="title center">{{localize "midgard5.item-value"}}</th>
<th class="title center"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th> <th class="title center"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th>
<th class="title"><img src="/icons/svg/d20.svg" class="table-icon"></th> <th class="title"><img src="/icons/svg/d20.svg" class="table-icon"></th>
<th class="title add-container"><i class="fa-regular fa-plus"></i></th> <td><a class="title add-container"><i class="fa-regular fa-plus"></i></a></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -206,7 +206,6 @@
<label for="data.info.showAllItems" style="font-size: normal; font-weight: normal; font-style: italic; float: right;">{{localize "midgard5.showAll"}}&nbsp;</label> <label for="data.info.showAllItems" style="font-size: normal; font-weight: normal; font-style: italic; float: right;">{{localize "midgard5.showAll"}}&nbsp;</label>
</h3> </h3>
<div class="flexbox"> <div class="flexbox">
{{#unless (eq (count data.calc.gear.items) 0)}}
<div class="flexcolumn-2"> <div class="flexcolumn-2">
<div class="flexpart"> <div class="flexpart">
<div class="flexpart-header"><img src="icons/tools/hand/scale-balances-merchant-brown.webp" class="flexpart-icon">{{localize "midgard5.gear"}}</div> <div class="flexpart-header"><img src="icons/tools/hand/scale-balances-merchant-brown.webp" class="flexpart-icon">{{localize "midgard5.gear"}}</div>
@ -218,7 +217,7 @@
<th class="title center">{{localize "midgard5.item-value"}}</th> <th class="title center">{{localize "midgard5.item-value"}}</th>
<th class="title"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th> <th class="title"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th>
<th class="title"><img src="/icons/svg/d20.svg" class="table-icon"></th></th> <th class="title"><img src="/icons/svg/d20.svg" class="table-icon"></th></th>
<th class="title add-item"><i class="fa-regular fa-plus"></i></th> <td><a class="title add-item"><i class="fa-regular fa-plus"></i></a></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -256,9 +255,7 @@
</table> </table>
</div> </div>
</div> </div>
{{/unless}}
{{#unless (eq (count data.calc.gear.weapons) 0)}}
<div class="flexcolumn-2"> <div class="flexcolumn-2">
<div class="flexpart"> <div class="flexpart">
<div class="flexpart-header"> <div class="flexpart-header">
@ -269,7 +266,7 @@
<th class="title">{{localize "TYPES.Item.weapon"}}</th> <th class="title">{{localize "TYPES.Item.weapon"}}</th>
<th class="title center">{{localize "midgard5.item-value"}}</th> <th class="title center">{{localize "midgard5.item-value"}}</th>
<th class="title"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th> <th class="title"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th>
<th class="title add-weapon"><i class="fa-regular fa-plus"></i></th> <td><a class="title add-weapon"><i class="fa-regular fa-plus"></i></a></th>
</tr> </tr>
</thead> </thead>
@ -298,9 +295,7 @@
</table> </table>
</div> </div>
</div> </div>
{{/unless}}
{{#unless (eq (count data.calc.gear.defensiveWeapons) 0)}}
<div class="flexcolumn-2"> <div class="flexcolumn-2">
<div class="flexpart"> <div class="flexpart">
<div class="flexpart-header"><img src="icons/equipment/shield/heater-wooden-brown-axe.webp" class="flexpart-icon">{{localize "midgard5.defensive-weapons"}}</div> <div class="flexpart-header"><img src="icons/equipment/shield/heater-wooden-brown-axe.webp" class="flexpart-icon">{{localize "midgard5.defensive-weapons"}}</div>
@ -310,7 +305,7 @@
<th class="title">{{localize "TYPES.Item.defensiveWeapon"}}</th> <th class="title">{{localize "TYPES.Item.defensiveWeapon"}}</th>
<th class="title center">{{localize "midgard5.item-value"}}</th> <th class="title center">{{localize "midgard5.item-value"}}</th>
<th class="title"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th> <th class="title"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th>
<th class="title add-defensiveWeapon"><i class="fa-regular fa-plus"></i></th> <td><a class="title add-defensiveWeapon"><i class="fa-regular fa-plus"></i></a></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -338,9 +333,7 @@
</table> </table>
</div> </div>
</div> </div>
{{/unless}}
{{#unless (eq (count data.calc.gear.armor) 0)}}
<div class="flexcolumn-2"> <div class="flexcolumn-2">
<div class="flexpart"> <div class="flexpart">
<div class="flexpart-header"><img src="icons/equipment/hand/gauntlet-armored-steel-grey.webp" class="flexpart-icon">{{localize "midgard5.armor"}}</div> <div class="flexpart-header"><img src="icons/equipment/hand/gauntlet-armored-steel-grey.webp" class="flexpart-icon">{{localize "midgard5.armor"}}</div>
@ -350,7 +343,7 @@
<th class="title">{{localize "TYPES.Item.armor"}}</th> <th class="title">{{localize "TYPES.Item.armor"}}</th>
<th class="title center">{{localize "midgard5.item-value"}}</th> <th class="title center">{{localize "midgard5.item-value"}}</th>
<th class="title"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th> <th class="title"><img src="/systems/midgard5/assets/icons/icon/battle-gear.svg" class="table-icon"></th>
<th class="title add-armor"><i class="fa-regular fa-plus"></i></th> <td><a class="title add-armor"><i class="fa-regular fa-plus"></i></a></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -378,8 +371,5 @@
</table> </table>
</div> </div>
</div> </div>
{{/unless}}
</div> </div>

View File

@ -11,7 +11,7 @@
<th class="title">{{localize "midgard5.bonus"}}</th> <th class="title">{{localize "midgard5.bonus"}}</th>
<th class="title">{{localize "midgard5.ew"}}</th> <th class="title">{{localize "midgard5.ew"}}</th>
<th class="title"><img src="/icons/svg/d20.svg" class="table-icon"></th> <th class="title"><img src="/icons/svg/d20.svg" class="table-icon"></th>
<th class="title"></th> <th><a class="title add-innate-skill"><i class="fa-regular fa-plus"></i></a></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -56,7 +56,7 @@
<th class="title">{{localize "midgard5.ew"}}</th> <th class="title">{{localize "midgard5.ew"}}</th>
<th class="title">{{localize "midgard5.pp-short"}}</th> <th class="title">{{localize "midgard5.pp-short"}}</th>
<th class="title"><img src="/icons/svg/d20.svg" class="table-icon"></th> <th class="title"><img src="/icons/svg/d20.svg" class="table-icon"></th>
<th class="title"></th> <th><a class="title add-general-skill"><i class="fa-regular fa-plus"></i></a></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -66,7 +66,7 @@
<td class="fixed-value">{{skill.fw}}</td> <td class="fixed-value">{{skill.fw}}</td>
<td class="fixed-value">{{skill.calc.bonus}}</td> <td class="fixed-value">{{skill.calc.bonus}}</td>
<td class="fixed-value">{{skill.calc.ew}}</td> <td class="fixed-value">{{skill.calc.ew}}</td>
<td class="fixed-value"><input name="data.skills.general.{{key}}.pp" type="text" value="{{skill.pp}}" data-dtype="Number" /></td> <td class="fixed-value">{{skill.pp}}</td>
<td><button class="roll-button roll-learned-button"></button></td> <td><button class="roll-button roll-learned-button"></button></td>
<td><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td> <td><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
</tr> </tr>
@ -86,7 +86,7 @@
<th class="title">{{localize "midgard5.ew"}}</th> <th class="title">{{localize "midgard5.ew"}}</th>
<th class="title">{{localize "midgard5.pp-short"}}</th> <th class="title">{{localize "midgard5.pp-short"}}</th>
<th class="title"><img src="/icons/svg/d20.svg" class="table-icon"></th> <th class="title"><img src="/icons/svg/d20.svg" class="table-icon"></th>
<th class="title"></th> <th><a class="title add-combat-skill"><i class="fa-regular fa-plus"></i></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -116,7 +116,7 @@
<th class="title">{{localize "midgard5.ew"}}</th> <th class="title">{{localize "midgard5.ew"}}</th>
<th class="title">{{localize "midgard5.pp-short"}}</th> <th class="title">{{localize "midgard5.pp-short"}}</th>
<th class="title"><img src="/icons/svg/d20.svg" class="table-icon"></th> <th class="title"><img src="/icons/svg/d20.svg" class="table-icon"></th>
<th class="title"></th> <th><a class="title add-language-skill"><i class="fa-regular fa-plus"></i></a></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>

View File

@ -4,7 +4,7 @@
<th class="title">{{localize "TYPES.Item.spell"}}</th> <th class="title">{{localize "TYPES.Item.spell"}}</th>
<th class="title">{{localize "midgard5.ew"}}</th> <th class="title">{{localize "midgard5.ew"}}</th>
<th class="title"></th> <th class="title"></th>
<th class="title add-spell"><i class="fa-regular fa-plus"></i></th> <td><a class="title add-spell"><i class="fa-regular fa-plus"></i></a></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>