mirror of
https://github.com/RoY7x/worldbuilding.git
synced 2025-04-30 02:31:41 -04:00
Merge branch '12-resource-attr' into 'master'
12: Add resource attribute type Closes #12 See merge request foundrynet/worldbuilding!7
This commit is contained in:
commit
d3f030b4f7
7 changed files with 77 additions and 5 deletions
|
@ -5,5 +5,9 @@
|
|||
"SETTINGS.SimpleInitFormulaL": "Enter an initiative formula, such as d20+@dex",
|
||||
|
||||
"SIMPLE.NotifyInitFormulaUpdated": "Initiative formula was updated to:",
|
||||
"SIMPLE.NotifyInitFormulaInvalid": "Initiative formula was invalid:"
|
||||
"SIMPLE.NotifyInitFormulaInvalid": "Initiative formula was invalid:",
|
||||
|
||||
"SIMPLE.ResourceMin": "Min",
|
||||
"SIMPLE.ResourceValue": "Value",
|
||||
"SIMPLE.ResourceMax": "Max"
|
||||
}
|
|
@ -21,9 +21,10 @@ export class SimpleActorSheet extends ActorSheet {
|
|||
/** @override */
|
||||
getData() {
|
||||
const data = super.getData();
|
||||
data.dtypes = ["String", "Number", "Boolean", "Formula"];
|
||||
data.dtypes = ["String", "Number", "Boolean", "Formula", "Resource"];
|
||||
for ( let attr of Object.values(data.data.attributes) ) {
|
||||
attr.isCheckbox = attr.dtype === "Boolean";
|
||||
attr.isResource = attr.dtype === "Resource";
|
||||
}
|
||||
data.shorthand = !!game.settings.get("worldbuilding", "macroShorthand");
|
||||
return data;
|
||||
|
|
|
@ -20,9 +20,10 @@ export class SimpleItemSheet extends ItemSheet {
|
|||
/** @override */
|
||||
getData() {
|
||||
const data = super.getData();
|
||||
data.dtypes = ["String", "Number", "Boolean", "Formula"];
|
||||
data.dtypes = ["String", "Number", "Boolean", "Formula", "Resource"];
|
||||
for ( let attr of Object.values(data.data.attributes) ) {
|
||||
attr.isCheckbox = attr.dtype === "Boolean";
|
||||
attr.isResource = attr.dtype === "Resource";
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
|
|
@ -144,6 +144,17 @@
|
|||
line-height: 28px;
|
||||
border: none;
|
||||
}
|
||||
.worldbuilding .attributes-list .attribute-col label {
|
||||
font-size: 10px;
|
||||
text-align: center;
|
||||
line-height: 1;
|
||||
}
|
||||
.worldbuilding .attributes-list .attribute-col input {
|
||||
font-size: 11px;
|
||||
text-align: center;
|
||||
line-height: 1;
|
||||
height: 50%;
|
||||
}
|
||||
.worldbuilding.sheet.actor {
|
||||
min-width: 560px;
|
||||
min-height: 420px;
|
||||
|
|
|
@ -164,6 +164,21 @@
|
|||
line-height: 28px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.attribute-col {
|
||||
label {
|
||||
font-size: 10px;
|
||||
text-align: center;
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
input {
|
||||
font-size: 11px;
|
||||
text-align: center;
|
||||
line-height: 1;
|
||||
height: 50%;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,10 +77,30 @@
|
|||
{{#each data.attributes as |attr key|}}
|
||||
<li class="attribute flexrow" data-attribute="{{key}}">
|
||||
<input class="attribute-key" type="text" name="data.attributes.{{key}}.key" value="{{key}}"/>
|
||||
{{!-- Handle booleans. --}}
|
||||
{{#if attr.isCheckbox}}
|
||||
<label class="attribute-value checkbox"><input type="checkbox" name="data.attributes.{{key}}.value" {{checked attr.value}}/></label>
|
||||
{{else}}
|
||||
<input class="attribute-value" type="text" name="data.attributes.{{key}}.value" value="{{attr.value}}" data-dtype="{{attr.dtype}}"/>
|
||||
{{!-- Handle resources. --}}
|
||||
{{#if attr.isResource}}
|
||||
<div class="attribute-group flexrow">
|
||||
<span class="attribute-col flexcol">
|
||||
<label for="data.attributes.{{key}}.min">{{localize "SIMPLE.ResourceMin"}}</label>
|
||||
<input class="attribute-value" type="text" name="data.attributes.{{key}}.min" value="{{attr.min}}" data-dtype="{{attr.dtype}}"/>
|
||||
</span>
|
||||
<span class="attribute-col flexcol">
|
||||
<label for="data.attributes.{{key}}.value">{{localize "SIMPLE.ResourceValue"}}</label>
|
||||
<input class="attribute-value" type="text" name="data.attributes.{{key}}.value" value="{{attr.value}}" data-dtype="{{attr.dtype}}"/>
|
||||
</span>
|
||||
<span class="attribute-col flexcol">
|
||||
<label for="data.attributes.{{key}}.max">{{localize "SIMPLE.ResourceMax"}}</label>
|
||||
<input class="attribute-value" type="text" name="data.attributes.{{key}}.max" value="{{attr.max}}" data-dtype="{{attr.dtype}}"/>
|
||||
</span>
|
||||
</div>
|
||||
{{!-- Handle other input types. --}}
|
||||
{{else}}
|
||||
<input class="attribute-value" type="text" name="data.attributes.{{key}}.value" value="{{attr.value}}" data-dtype="{{attr.dtype}}"/>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
<input class="attribute-label" type="text" name="data.attributes.{{key}}.label" value="{{attr.label}}"/>
|
||||
<select class="attribute-dtype" name="data.attributes.{{key}}.dtype">
|
||||
|
|
|
@ -42,10 +42,30 @@
|
|||
{{#each data.attributes as |attr key|}}
|
||||
<li class="attribute flexrow" data-attribute="{{key}}">
|
||||
<input class="attribute-key" type="text" name="data.attributes.{{key}}.key" value="{{key}}"/>
|
||||
{{!-- Handle booleans. --}}
|
||||
{{#if attr.isCheckbox}}
|
||||
<label class="attribute-value checkbox"><input type="checkbox" name="data.attributes.{{key}}.value" {{checked attr.value}}/></label>
|
||||
{{else}}
|
||||
<input class="attribute-value" type="text" name="data.attributes.{{key}}.value" value="{{attr.value}}" data-dtype="{{attr.dtype}}"/>
|
||||
{{!-- Handle resources. --}}
|
||||
{{#if attr.isResource}}
|
||||
<div class="attribute-group flexrow">
|
||||
<span class="attribute-col flexcol">
|
||||
<label for="data.attributes.{{key}}.min">Min</label>
|
||||
<input class="attribute-value" type="text" name="data.attributes.{{key}}.min" value="{{attr.min}}" data-dtype="{{attr.dtype}}"/>
|
||||
</span>
|
||||
<span class="attribute-col flexcol">
|
||||
<label for="data.attributes.{{key}}.value">Current</label>
|
||||
<input class="attribute-value" type="text" name="data.attributes.{{key}}.value" value="{{attr.value}}" data-dtype="{{attr.dtype}}"/>
|
||||
</span>
|
||||
<span class="attribute-col flexcol">
|
||||
<label for="data.attributes.{{key}}.max">Max</label>
|
||||
<input class="attribute-value" type="text" name="data.attributes.{{key}}.max" value="{{attr.max}}" data-dtype="{{attr.dtype}}"/>
|
||||
</span>
|
||||
</div>
|
||||
{{!-- Handle other input types. --}}
|
||||
{{else}}
|
||||
<input class="attribute-value" type="text" name="data.attributes.{{key}}.value" value="{{attr.value}}" data-dtype="{{attr.dtype}}"/>
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
<input class="attribute-label" type="text" name="data.attributes.{{key}}.label" value="{{attr.label}}"/>
|
||||
<select class="attribute-dtype" name="data.attributes.{{key}}.dtype">
|
||||
|
|
Loading…
Add table
Reference in a new issue