Add availability to weapon sheet

This commit is contained in:
Johannes Loher 2020-10-29 17:48:56 +01:00
parent 3dd459660e
commit 1437dd6ee1
6 changed files with 38 additions and 6 deletions

View file

@ -376,7 +376,7 @@
} }
.ds4 .side-properties .side-property { .ds4 .side-properties .side-property {
margin: 0; margin: 2px 0;
display: -webkit-box; display: -webkit-box;
display: -ms-flexbox; display: -ms-flexbox;
display: flex; display: flex;
@ -394,9 +394,11 @@
font-weight: bold; font-weight: bold;
} }
.ds4 .side-properties .side-property input { .ds4 .side-properties .side-property input,
.ds4 .side-properties .side-property select {
text-align: right; text-align: right;
-webkit-box-flex: 1; -webkit-box-flex: 1;
-ms-flex: 1; -ms-flex: 1;
flex: 1; flex: 1;
width: calc(100% - 2px);
} }

View file

@ -11,5 +11,11 @@
"DS4.AttackTypeRanged": "Ranged", "DS4.AttackTypeRanged": "Ranged",
"DS4.AttackTypeMeleeRanged": "Melee / Ranged", "DS4.AttackTypeMeleeRanged": "Melee / Ranged",
"DS4.Quantity": "Quantity", "DS4.Quantity": "Quantity",
"DS4.PriceGold": "Price (Gold)" "DS4.PriceGold": "Price (Gold)",
"DS4.ItemAvailability": "Availability",
"DS4.ItemAvailabilityHamlet": "Hamlet",
"DS4.ItemAvailabilityVilage": "Village",
"DS4.ItemAvailabilityCity": "City",
"DS4.ItemAvailabilityElves": "Elves",
"DS4.ItemAvailabilityDwarves": "Dwarves"
} }

View file

@ -18,3 +18,15 @@ DS4.attackTypes = {
ranged: "DS4.AttackTypeRanged", ranged: "DS4.AttackTypeRanged",
meleeRanged: "DS4.AttackTypeMeleeRanged", meleeRanged: "DS4.AttackTypeMeleeRanged",
}; };
/**
* Define the set of item availabilties
* @type {Object}
*/
DS4.itemAvailabilities = {
hamlet: "DS4.ItemAvailabilityHamlet",
village: "DS4.ItemAvailabilityVilage",
city: "DS4.ItemAvailabilityCity",
elves: "DS4.ItemAvailabilityElves",
dwarves: "DS4.ItemAvailabilityDwarves",
};

View file

@ -37,7 +37,7 @@ Hooks.once("init", async function () {
*/ */
Hooks.once("setup", function () { Hooks.once("setup", function () {
// Localize CONFIG objects once up-front // Localize CONFIG objects once up-front
const toLocalize = ["attackTypes"]; const toLocalize = ["attackTypes", "itemAvailabilities"];
// Exclude some from sorting where the default order matters // Exclude some from sorting where the default order matters
const noSort = []; const noSort = [];

View file

@ -5,7 +5,7 @@
border-right: 2px groove #eeede0; border-right: 2px groove #eeede0;
.side-property { .side-property {
margin: 0; margin: 2px 0;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -15,9 +15,11 @@
font-weight: bold; font-weight: bold;
} }
input { input,
select {
text-align: right; text-align: right;
flex: 1; flex: 1;
width: calc(100% - 2px);
} }
} }
} }

View file

@ -48,6 +48,16 @@
<label for="data.price">{{localize "DS4.PriceGold"}}</label> <label for="data.price">{{localize "DS4.PriceGold"}}</label>
<input type="number" data-dtype="Number" name="data.price" value="{{data.price}}" /> <input type="number" data-dtype="Number" name="data.price" value="{{data.price}}" />
</div> </div>
<div class="side-property">
<label for="data.price">{{localize "DS4.ItemAvailability"}}</label>
<select name="data.availability" data-type="String">
{{#select data.availability}}
{{#each config.itemAvailabilities as |value key|}}
<option value="{{key}}">{{value}}</option>
{{/each}}
{{/select}}
</select>
</div>
</div> </div>
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}} {{editor content=data.description target="data.description" button=true owner=owner editable=editable}}