Add currency to character sheet

Changes:
 + add fields to track currency
 + show value of standard items
This commit is contained in:
Byroks 2023-12-15 20:38:48 +01:00
parent a5336faa94
commit e73720f8cf
5 changed files with 47 additions and 6 deletions

View File

@ -91,6 +91,10 @@
"midgard5.origin": "Heimat", "midgard5.origin": "Heimat",
"midgard5.faith": "Glaube", "midgard5.faith": "Glaube",
"midgard5.currency-gold": "Gold",
"midgard5.currency-silver": "Silber",
"midgard5.currency-copper": "Kupfer",
"midgard5.exp-overall": "Erfahrungsschatz", "midgard5.exp-overall": "Erfahrungsschatz",
"midgard5.exp-available": "Erfahrungspunkte", "midgard5.exp-available": "Erfahrungspunkte",
"midgard5.grace": "Göttliche Gnade", "midgard5.grace": "Göttliche Gnade",
@ -197,8 +201,8 @@
"midgard5.enduranceBonus": "Ausdauerbonus", "midgard5.enduranceBonus": "Ausdauerbonus",
"midgard5.lpProtection": "Rüstungsschutz (LP)", "midgard5.lpProtection": "Rüstungsschutz (LP)",
"midgard5.apProtection": "Rüstungsschutz (AP)", "midgard5.apProtection": "Rüstungsschutz (AP)",
"midgard5.perception" : "Wahrnehmung", "midgard5.perception": "Wahrnehmung",
"midgard5.drinking" : "Trinken", "midgard5.drinking": "Trinken",
"midgard5.new-skill": "Neue Fertigkeit", "midgard5.new-skill": "Neue Fertigkeit",
"midgard5.special": "Spezial", "midgard5.special": "Spezial",

View File

@ -67,9 +67,9 @@ export class M5Character extends Actor {
brawlFw: 0, brawlFw: 0,
poisonResistance: { value: 0, mods: [] }, poisonResistance: { value: 0, mods: [] },
enduranceBonus: 0, enduranceBonus: 0,
perception: {value: 0, mods: []}, perception: { value: 0, mods: [] },
perceptionFW: 0, perceptionFW: 0,
drinking: {value: 0, mods: []}, drinking: { value: 0, mods: [] },
drinkingFW: 0, drinkingFW: 0,
}, },
skillMods: {}, skillMods: {},
@ -177,6 +177,8 @@ export class M5Character extends Actor {
magic: item.system.magic, magic: item.system.magic,
calc: item.system.calc, calc: item.system.calc,
equipped: item.system?.equipped, equipped: item.system?.equipped,
value: item.system.value || 0,
currency: item.system.currency || "",
}; };
}); });
} }

View File

@ -16,7 +16,10 @@
"caste": "", "caste": "",
"occupation": "", "occupation": "",
"origin": "", "origin": "",
"faith": "" "faith": "",
"gold": 0,
"silver": 0,
"copper": 0
} }
}, },
"characterBars": { "characterBars": {

View File

@ -1,3 +1,20 @@
<table>
<thead>
<tr>
<th class="title" style="text-align: center">{{localize "midgard5.currency-gold"}}</th>
<th class="title" style="text-align: center">{{localize "midgard5.currency-silver"}}</th>
<th class="title" style="text-align: center">{{localize "midgard5.currency-copper"}}</th>
</tr>
</thead>
<tbody>
<tr>
<td class="fixed-value"><input type="number" name="data.info.gold" value="{{data.info.gold}}"></td>
<td class="fixed-value"><input type="number" name="data.info.silver" value="{{data.info.silver}}"></td>
<td class="fixed-value"><input type="number" name="data.info.copper" value="{{data.info.copper}}"></td>
</tr>
</tbody>
</table>
<table> <table>
<thead> <thead>
<tr> <tr>
@ -106,10 +123,12 @@
<thead> <thead>
<tr> <tr>
<th class="title">{{localize "TYPES.Item.item"}}</th> <th class="title">{{localize "TYPES.Item.item"}}</th>
<th class="title center">{{localize "midgard5.item-value"}}</th>
<th class="title"></th> <th class="title"></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
</tr>
{{#each data.calc.gear.items as |item itemId|}} {{#each data.calc.gear.items as |item itemId|}}
<tr data-item="{{itemId}}"> <tr data-item="{{itemId}}">
<td class="padding"> <td class="padding">
@ -118,6 +137,11 @@
<span class="spell-process">{{localize "midgard5.equipped"}}</span> <span class="spell-process">{{localize "midgard5.equipped"}}</span>
{{/if}} {{/if}}
</td> </td>
<td style="text-align: start">
{{#unless (or (eq item.value 0) (eq item.currency ""))}}
<span class="spell-process">{{item.value}} {{localize (m5concat "midgard5.currency-" item.currency)}}</span>
{{/unless}}
</td>
<td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td> <td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
</tr> </tr>
{{/each}} {{/each}}

View File

@ -23,7 +23,15 @@
<td> <td>
<div class="flexrow"> <div class="flexrow">
<span>{{localize "midgard5.item-value"}}</span> <span>{{localize "midgard5.item-value"}}</span>
<input name="data.value" type="text" value="{{data.value}}" data-dtype="Number" /> <input name="data.value" type="number" value="{{data.value}}" data-dtype="Number" />
<select class="select-mod-operation" name="data.currency" data-type="String">
{{#select data.currency}}
<option value=""></option>
<option value="copper">{{localize "midgard5.currency-copper"}}</option>
<option value="silver">{{localize "midgard5.currency-silver"}}</option>
<option value="gold">{{localize "midgard5.currency-gold"}}</option>
{{/select}}
</select>
</div> </div>
</td> </td>
</tr> </tr>