Revision of the gear tab:

- Use of flexboxes in two columns for better display
- Introduction of item containers for the different storage of items
This commit is contained in:
Ender
2023-12-31 11:00:17 +01:00
parent 6baf9a0269
commit a9d7bbb5b2
15 changed files with 465 additions and 165 deletions
+1
View File
@@ -187,6 +187,7 @@ export interface M5CharacterCalculatedData {
defensiveWeapons: {};
armor: {};
items: {};
containers: {};
effects: {};
};
spells: {};
+42
View File
@@ -32,6 +32,7 @@ export class M5Character extends Actor {
defensiveWeapons?: boolean;
armor?: boolean;
items?: boolean;
containers?: boolean;
spells?: boolean;
effects?: boolean;
kampfkuenste?: boolean;
@@ -85,6 +86,7 @@ export class M5Character extends Actor {
defensiveWeapons: {},
armor: {},
items: {},
containers: {},
effects: {},
},
spells: {},
@@ -171,6 +173,7 @@ export class M5Character extends Actor {
if (item.system.magic) {
label += "*";
}
let icon = item.img;
let rollable = false;
// console.log(item.system.rolls.formulas.map((p) => p.enabled));
@@ -182,9 +185,48 @@ export class M5Character extends Actor {
}
ret.gear.items[item.id] = {
label: label,
icon: icon,
magic: item.system.magic,
calc: item.system.calc,
equipped: item.system?.equipped,
weight: item.system.weight || 0,
containerId: item.system.containerId || "",
value: item.system.value || 0,
currency: item.system.currency || "",
quantity: item.system.quantity || 0,
rollExist: rollable,
};
});
}
if (!skip?.containers) {
context.items
?.filter((item) => item.type === "container")
.forEach((item) => {
item.prepareDerivedData();
let label = item.name;
if (item.system.magic) {
label += "*";
}
let icon = item.img;
let rollable = false;
// console.log(item.system.rolls.formulas.map((p) => p.enabled));
for (let key in item.system.rolls.formulas) {
rollable = item.system.rolls.formulas[key].enabled;
if (rollable) {
break;
}
}
ret.gear.containers[item.id] = {
label: label,
icon: icon,
magic: item.system.magic,
calc: item.system.calc,
equipped: item.system?.equipped,
weight: item.system.weight || 0,
containerId: item.system.containerId || "",
value: item.system.value || 0,
currency: item.system.currency || "",
quantity: item.system.quantity || 0,
+16 -1
View File
@@ -14,7 +14,22 @@ export class M5Item extends Item {
const itemData = (this as any).system;
const calc = itemData.calc;
if (itemType === "skill") {
if (itemType === "item") {
calc.containers = null;
if (actor) {
const actorCalc = actor.derivedData({ weapons: true, defensiveWeapons: true, armor: true, items: true, spells: true, effects: true, kampfkuenste: true });
if (actorCalc) {
calc.containers = actorCalc.gear.containers;
}
const container = character.getItem(itemData.containerId);
//console.log("M5Item.prepareDerivedData:containers", itemData, container?.system)
if (container) {
container.prepareDerivedData();
const containerData = container.system;
}
}
} else if (itemType === "skill") {
calc.fw = itemData.fw;
calc.bonus = 0;
+2 -2
View File
@@ -8,7 +8,7 @@ export default class M5CharacterSheet extends ActorSheet {
static get defaultOptions() {
return mergeObject(super.defaultOptions, {
template: "systems/midgard5/templates/sheets/character/main.hbs",
width: 800,
width: 1200,
height: 800,
classes: ["midgard5", "sheet", "character"],
tabs: [{ navSelector: ".sheet-navigation", contentSelector: ".sheet-content", initial: "base_values" }],
@@ -270,7 +270,7 @@ export default class M5CharacterSheet extends ActorSheet {
const item = this.actor.items.get(li.dataset.itemId);
// limit transfer on personal weapons/armour/gear
if (["skill", "item", "weapon", "defensiveWeapon", "armor", "spell", "effect", "kampfkunst"].includes(item.type)) {
if (["skill", "item", "weapon", "defensiveWeapon", "armor", "spell", "effect", "kampfkunst", "container"].includes(item.type)) {
const dragData = {
type: "Transfer",
actorId: this.actor.id,
+1 -1
View File
@@ -30,7 +30,7 @@ export class M5ItemSheet extends ItemSheet {
context.rollData = {}
let actor = this.object?.parent ?? null
if (actor) {
context.rollData = actor.getRollData()
context.rollData = actor.getRollData()
}
context.data = itemData.system
+40 -2
View File
@@ -3,6 +3,37 @@
@attributeBorderColor: rgba(0, 0, 0, 0.5);
.midgard5 {
.flexbox {
display: flex;
flex-direction: row;
flex-wrap: wrap
}
.flexcolumn-2 {
flex: 50%;
}
.flexpart {
gap: 0;
padding: 0;
margin: 10px;
background-color: beige;
border: 2px solid black;
}
.flexpart-header {
font-weight: bold;
font-size: large;
text-align: center;
color: black;
}
.flexpart-icon {
height: 2rem;
float: left;
border: 0px solid transparent;
}
.flexrow {
align-items: center;
}
@@ -33,7 +64,7 @@
.profile-img {
max-width: 128px;
height: 160px;
height: 128px;
border: 0px solid black;
}
@@ -68,6 +99,7 @@
table {
background-color: beige;
border: 0px solid transparent;
}
td,
@@ -104,10 +136,16 @@
padding: 0.5rem 0.5rem 0.5rem 0.5rem;
text-align: left;
font-weight: bold;
background-color: dimgray;
}
}
.table-icon {
height: 1rem;
width: 1rem;
float: left;
border: 0px solid transparent;
}
input.skill {
width: 5rem;
}
+18 -3
View File
@@ -138,17 +138,21 @@
"wahrsagen": { "fw": 0, "attribute": "zt", "initial": 8, "pp": 0 },
"wasserkampf": { "fw": 0, "attribute": "gw", "initial": 8, "pp": 0 },
"zauberkunde": { "fw": 0, "attribute": "in", "initial": 8, "pp": 0 }
}
}
}
},
"gear": {
"gear": {
}
}
},
"character": {
"templates": ["characterBars", "attributes", "characterDescription", "characterHeader", "skills"],
"templates": ["characterBars", "attributes", "characterDescription", "characterHeader", "skills", "gear"],
"calc": {}
}
},
"Item": {
"types": ["skill", "weapon", "defensiveWeapon", "armor", "spell", "kampfkunst", "item", "effect"],
"types": ["skill", "weapon", "defensiveWeapon", "armor", "spell", "kampfkunst", "item", "effect", "container"],
"templates": {
"itemDescription": {
"description": ""
@@ -202,6 +206,8 @@
},
"physical": {
"value": 0,
"weight": 0,
"containerId": "",
"magic": false
},
"durationSelection": {
@@ -305,6 +311,15 @@
"mods": {},
"calc": {}
},
"container": {
"templates": ["itemDescription", "equippable", "physical"],
"rolls": {
"formulas": {},
"output": ""
},
"mods": {},
"calc": {}
},
"effect": {
"templates": ["itemDescription", "equippable", "physical", "durationSelection"],
"rolls": {