adds currency to compendia.
Also fixes skittish hover-behavior of equipment items.pull/61/head
parent
e7a1e3d3cf
commit
8cf8a61730
|
|
@ -113,6 +113,7 @@ async function prepareDB() {
|
||||||
convert("./src/packs/_source/nachteile", "./src/packs/__source/vorteile", "Advantage", false);
|
convert("./src/packs/_source/nachteile", "./src/packs/__source/vorteile", "Advantage", false);
|
||||||
convert("./src/packs/_source/sonderfertigkeiten", "./src/packs/__source/sonderfertigkeiten", "SpecialAbility");
|
convert("./src/packs/_source/sonderfertigkeiten", "./src/packs/__source/sonderfertigkeiten", "SpecialAbility");
|
||||||
convert("./src/packs/_source/waffen", "./src/packs/__source/waffen", "Equipment");
|
convert("./src/packs/_source/waffen", "./src/packs/__source/waffen", "Equipment");
|
||||||
|
convert("./src/packs/_source/waehrungen", "./src/packs/__source/waehrungen", "Equipment");
|
||||||
convert("./src/packs/_source/munition", "./src/packs/__source/munition", "Equipment");
|
convert("./src/packs/_source/munition", "./src/packs/__source/munition", "Equipment");
|
||||||
convert("./src/packs/_source/ruestzeug", "./src/packs/__source/ruestzeug", "Equipment");
|
convert("./src/packs/_source/ruestzeug", "./src/packs/__source/ruestzeug", "Equipment");
|
||||||
convert("./src/packs/_source/liturgien-und-segnungen", "./src/packs/__source/liturgien", "Liturgy");
|
convert("./src/packs/_source/liturgien-und-segnungen", "./src/packs/__source/liturgien", "Liturgy");
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,9 @@ export class EquipmentDataModel extends BaseItem {
|
||||||
max: new NumberField({required: true, initial: 1}),
|
max: new NumberField({required: true, initial: 1}),
|
||||||
count: new NumberField({required: true, initial: 1}),
|
count: new NumberField({required: true, initial: 1}),
|
||||||
}, {required: false}),
|
}, {required: false}),
|
||||||
|
|
||||||
|
currencyName: new StringField({required: false}),
|
||||||
|
currencyDenominator: new NumberField({required: false}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,17 @@ export default {
|
||||||
context.maxcarryingcapacity = actorData.system.attribute.kk.aktuell
|
context.maxcarryingcapacity = actorData.system.attribute.kk.aktuell
|
||||||
context.carryingpercentage = Math.min((context.carryingweight / context.maxcarryingcapacity) * 100, 100);
|
context.carryingpercentage = Math.min((context.carryingweight / context.maxcarryingcapacity) * 100, 100);
|
||||||
|
|
||||||
|
context.wealth = 0
|
||||||
|
|
||||||
|
actorData.itemTypes["Equipment"].forEach(coin => {
|
||||||
|
console.log(coin.name, coin.system.category)
|
||||||
|
if (coin.system.category.indexOf("Währung") !== -1) {
|
||||||
|
console.log(context.wealth, coin)
|
||||||
|
context.wealth += (coin.system.quantity * coin.system.currencyDenominator)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.log(context.wealth)
|
||||||
|
|
||||||
const maxSets = 3
|
const maxSets = 3
|
||||||
const romanNumerals = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"]
|
const romanNumerals = ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X"]
|
||||||
context.sets = []
|
context.sets = []
|
||||||
|
|
|
||||||
|
|
@ -62,6 +62,9 @@ export class EquipmentSheet extends HandlebarsApplicationMixin(DocumentSheetV2)
|
||||||
ammunition: {
|
ammunition: {
|
||||||
template: `systems/DSA_4-1/templates/item/equipment/tab-ammunition.hbs`
|
template: `systems/DSA_4-1/templates/item/equipment/tab-ammunition.hbs`
|
||||||
},
|
},
|
||||||
|
currency: {
|
||||||
|
template: 'systems/DSA_4-1/templates/item/equipment/tab-currency.hbs'
|
||||||
|
},
|
||||||
armor: {
|
armor: {
|
||||||
template: `systems/DSA_4-1/templates/item/equipment/tab-armor.hbs`
|
template: `systems/DSA_4-1/templates/item/equipment/tab-armor.hbs`
|
||||||
},
|
},
|
||||||
|
|
@ -101,6 +104,8 @@ export class EquipmentSheet extends HandlebarsApplicationMixin(DocumentSheetV2)
|
||||||
delete normalisedFormData.isAmmunition
|
delete normalisedFormData.isAmmunition
|
||||||
if (normalisedFormData.isArmor) normalisedFormData['system.category'].push("Rüstung")
|
if (normalisedFormData.isArmor) normalisedFormData['system.category'].push("Rüstung")
|
||||||
delete normalisedFormData.isArmor
|
delete normalisedFormData.isArmor
|
||||||
|
if (normalisedFormData.isCurrency) normalisedFormData['system.category'].push("Währung")
|
||||||
|
delete normalisedFormData.isCurrency
|
||||||
|
|
||||||
await this.document.update(normalisedFormData) // Note: formData.object
|
await this.document.update(normalisedFormData) // Note: formData.object
|
||||||
}
|
}
|
||||||
|
|
@ -119,6 +124,12 @@ export class EquipmentSheet extends HandlebarsApplicationMixin(DocumentSheetV2)
|
||||||
case 'armor':
|
case 'armor':
|
||||||
this.#prepareArmorContext(context)
|
this.#prepareArmorContext(context)
|
||||||
break;
|
break;
|
||||||
|
case 'ammunition':
|
||||||
|
this.#prepareAmmunitionContext(context)
|
||||||
|
break;
|
||||||
|
case 'currency':
|
||||||
|
this.#prepareCurrencyContext(context)
|
||||||
|
break;
|
||||||
case 'settings':
|
case 'settings':
|
||||||
this.#prepareSettingsContext(context)
|
this.#prepareSettingsContext(context)
|
||||||
break;
|
break;
|
||||||
|
|
@ -196,11 +207,16 @@ export class EquipmentSheet extends HandlebarsApplicationMixin(DocumentSheetV2)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#prepareCurrencyContext(context) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
#prepareSettingsContext(context) {
|
#prepareSettingsContext(context) {
|
||||||
context.isMelee = this.document.system.category.includes("Nahkampfwaffe")
|
context.isMelee = this.document.system.category.includes("Nahkampfwaffe")
|
||||||
context.isRanged = this.document.system.category.includes("Fernkampfwaffe")
|
context.isRanged = this.document.system.category.includes("Fernkampfwaffe")
|
||||||
context.isAmmunition = this.document.system.category.includes("Munition")
|
context.isAmmunition = this.document.system.category.includes("Munition")
|
||||||
context.isArmor = this.document.system.category.includes("Rüstung")
|
context.isArmor = this.document.system.category.includes("Rüstung")
|
||||||
|
context.isCurrency = this.document.system.category.includes("Währung")
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -234,6 +250,11 @@ export class EquipmentSheet extends HandlebarsApplicationMixin(DocumentSheetV2)
|
||||||
id: 'armor', group: group, label: 'Rüstung'
|
id: 'armor', group: group, label: 'Rüstung'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
if (category.includes("Währung")) {
|
||||||
|
tabs.tabs.push({
|
||||||
|
id: 'currency', group: group, label: 'Währung'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
tabs.tabs.push({
|
tabs.tabs.push({
|
||||||
id: 'settings', group: group, label: 'Einstellungen'
|
id: 'settings', group: group, label: 'Einstellungen'
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"name": "Dukate",
|
||||||
|
"image": "icons/commodities/currency/coin-embossed-cobra-gold.webp",
|
||||||
|
"category": [
|
||||||
|
"Gegenstand",
|
||||||
|
"Währung"
|
||||||
|
],
|
||||||
|
"weight": 0,
|
||||||
|
"price": 10,
|
||||||
|
"currencyDenominator": 10,
|
||||||
|
"currencyName": "Mittelreich"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"name": "Heller",
|
||||||
|
"image": "icons/commodities/currency/coin-inset-copper-axe.webp",
|
||||||
|
"category": [
|
||||||
|
"Gegenstand",
|
||||||
|
"Währung"
|
||||||
|
],
|
||||||
|
"weight": 0,
|
||||||
|
"price": 0.01,
|
||||||
|
"currencyDenominator": 0.01,
|
||||||
|
"currencyName": "Mittelreich"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"name": "Kreuzer",
|
||||||
|
"image": "icons/commodities/currency/coin-inset-compass-silver.webp",
|
||||||
|
"category": [
|
||||||
|
"Gegenstand",
|
||||||
|
"Währung"
|
||||||
|
],
|
||||||
|
"weight": 0,
|
||||||
|
"price": 0.1,
|
||||||
|
"currencyDenominator": 0.1,
|
||||||
|
"currencyName": "Mittelreich"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,12 @@
|
||||||
|
{
|
||||||
|
"name": "Silbertaler",
|
||||||
|
"image": "icons/commodities/currency/coins-engraved-face-silver.webp",
|
||||||
|
"category": [
|
||||||
|
"Gegenstand",
|
||||||
|
"Währung"
|
||||||
|
],
|
||||||
|
"weight": 0,
|
||||||
|
"price": 1,
|
||||||
|
"currencyDenominator": 1,
|
||||||
|
"currencyName": "Mittelreich"
|
||||||
|
}
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
border: 1px solid #ccc;
|
border: 1px solid #ccc;
|
||||||
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5);
|
box-shadow: 2px 2px 2px rgba(0, 0, 0, 0.5);
|
||||||
margin: -4px 4px 4px -4px;
|
margin: -4px 4px 4px -4px;
|
||||||
padding: 0 0 0 0;
|
padding: 0 4px 4px 0;
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -63,6 +63,14 @@
|
||||||
"path": "packs/vorteile",
|
"path": "packs/vorteile",
|
||||||
"private": false
|
"private": false
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "Currency",
|
||||||
|
"label": "Währung",
|
||||||
|
"system": "DSA_4-1",
|
||||||
|
"type": "Item",
|
||||||
|
"path": "packs/waehrungen",
|
||||||
|
"private": false
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "Weapons",
|
"name": "Weapons",
|
||||||
"label": "Waffen",
|
"label": "Waffen",
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
|
|
||||||
<div class="inventory">
|
<div class="inventory">
|
||||||
<h3>Inventar</h3>
|
<h3>Inventar {{currency this.wealth}}</h3>
|
||||||
|
|
||||||
{{> "systems/DSA_4-1/templates/ui/partial-equipment-button.hbs" equipments}}
|
{{> "systems/DSA_4-1/templates/ui/partial-equipment-button.hbs" equipments}}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
<section class="tab {{tabs.currency.id}} {{tabs.currency.cssClass}}"
|
||||||
|
data-tab="{{tabs.currency.id}}"
|
||||||
|
data-group="{{tabs.currency.group}}">
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<label>Nenner einer Währung
|
||||||
|
<input type="text" name="system.currencyDenominator" value="{{system.currencyDenominator}}"/>
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
Name der Währung
|
||||||
|
<input type="text" name="system.currencyName" value="{{system.currencyName}}"/>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
|
@ -16,6 +16,10 @@
|
||||||
<input type="checkbox" name="isAmmunition" {{checked isAmmunition}}>
|
<input type="checkbox" name="isAmmunition" {{checked isAmmunition}}>
|
||||||
<span>Munition</span>
|
<span>Munition</span>
|
||||||
</label>
|
</label>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="isCurrency" {{checked isCurrency}}>
|
||||||
|
<span>Währung</span>
|
||||||
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" name="isArmor" {{checked isArmor}}>
|
<input type="checkbox" name="isArmor" {{checked isArmor}}>
|
||||||
<span>Rüstzeug</span>
|
<span>Rüstzeug</span>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue