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.faith": "Glaube",
"midgard5.currency-gold": "Gold",
"midgard5.currency-silver": "Silber",
"midgard5.currency-copper": "Kupfer",
"midgard5.exp-overall": "Erfahrungsschatz",
"midgard5.exp-available": "Erfahrungspunkte",
"midgard5.grace": "Göttliche Gnade",

View File

@ -177,6 +177,8 @@ export class M5Character extends Actor {
magic: item.system.magic,
calc: item.system.calc,
equipped: item.system?.equipped,
value: item.system.value || 0,
currency: item.system.currency || "",
};
});
}

View File

@ -16,7 +16,10 @@
"caste": "",
"occupation": "",
"origin": "",
"faith": ""
"faith": "",
"gold": 0,
"silver": 0,
"copper": 0
}
},
"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>
<thead>
<tr>
@ -106,10 +123,12 @@
<thead>
<tr>
<th class="title">{{localize "TYPES.Item.item"}}</th>
<th class="title center">{{localize "midgard5.item-value"}}</th>
<th class="title"></th>
</tr>
</thead>
<tbody>
</tr>
{{#each data.calc.gear.items as |item itemId|}}
<tr data-item="{{itemId}}">
<td class="padding">
@ -118,6 +137,11 @@
<span class="spell-process">{{localize "midgard5.equipped"}}</span>
{{/if}}
</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>
</tr>
{{/each}}

View File

@ -23,7 +23,15 @@
<td>
<div class="flexrow">
<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>
</td>
</tr>