forked from GitHub-Mirrors/foundry-sw5e
Merge pull request #25 from unrealkakeman89/Weapon-&-Armor-Properties
Weapon & Armor Properties
This commit is contained in:
commit
cce6b32587
5 changed files with 13 additions and 182 deletions
|
@ -212,76 +212,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
h4.armorproperties-header {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-weight: bold;
|
||||
line-height: 24px;
|
||||
color: @colorOlive;
|
||||
}
|
||||
|
||||
.armorproperties-parts {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
.armorproperties-part {
|
||||
flex: 0 0 100%;
|
||||
padding: 0;
|
||||
input {
|
||||
flex: 3;
|
||||
}
|
||||
select {
|
||||
margin-left: 5px;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.armorproperties-control {
|
||||
width: 18px;
|
||||
flex: 0 0 18px;
|
||||
line-height: 24px;
|
||||
float: right;
|
||||
text-align: right;
|
||||
color: @colorTan;
|
||||
}
|
||||
|
||||
h4.weaponproperties-header {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-weight: bold;
|
||||
line-height: 24px;
|
||||
color: @colorOlive;
|
||||
}
|
||||
|
||||
.weaponproperties-parts {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
||||
.weaponproperties-part {
|
||||
flex: 0 0 100%;
|
||||
padding: 0;
|
||||
input {
|
||||
flex: 3;
|
||||
}
|
||||
select {
|
||||
margin-left: 5px;
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.weaponproperties-control {
|
||||
width: 18px;
|
||||
flex: 0 0 18px;
|
||||
line-height: 24px;
|
||||
float: right;
|
||||
text-align: right;
|
||||
color: @colorTan;
|
||||
}
|
||||
|
||||
/* ----------------------------------------- */
|
||||
/* Item Actions */
|
||||
/* ----------------------------------------- */
|
||||
|
|
|
@ -251,10 +251,10 @@ export default class ItemSheet5e extends ItemSheet {
|
|||
html.find('.trait-selector.class-skills').click(this._onConfigureClassSkills.bind(this));
|
||||
|
||||
// Armor properties
|
||||
html.find(".armorproperties-control").click(this._onarmorpropertiesControl.bind(this));
|
||||
// html.find(".armorproperties-control").click(this._onarmorpropertiesControl.bind(this));
|
||||
|
||||
// Weapon properties
|
||||
html.find(".weaponproperties-control").click(this._onweaponpropertiesControl.bind(this));
|
||||
// html.find(".weaponproperties-control").click(this._onweaponpropertiesControl.bind(this));
|
||||
|
||||
}
|
||||
|
||||
|
@ -289,62 +289,6 @@ export default class ItemSheet5e extends ItemSheet {
|
|||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Add or remove a armorproperties part from the armorproperties formula
|
||||
* @param {Event} event The original click event
|
||||
* @return {Promise}
|
||||
* @private
|
||||
*/
|
||||
async _onarmorpropertiesControl(event) {
|
||||
event.preventDefault();
|
||||
const a = event.currentTarget;
|
||||
|
||||
// Add new armorproperties component
|
||||
if ( a.classList.contains("add-armorproperties") ) {
|
||||
await this._onSubmit(event); // Submit any unsaved changes
|
||||
const armorproperties = this.item.data.data.armorproperties;
|
||||
return this.item.update({"data.armorproperties.parts": armorproperties.parts.concat([["", ""]])});
|
||||
}
|
||||
|
||||
// Remove a armorproperties component
|
||||
if ( a.classList.contains("delete-armorproperties") ) {
|
||||
await this._onSubmit(event); // Submit any unsaved changes
|
||||
const li = a.closest(".armorproperties-part");
|
||||
const armorproperties = duplicate(this.item.data.data.armorproperties);
|
||||
armorproperties.parts.splice(Number(li.dataset.armorpropertiesPart), 1);
|
||||
return this.item.update({"data.armorproperties.parts": armorproperties.parts});
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
|
||||
/**
|
||||
* Add or remove a weaponproperties part from the weaponproperties formula
|
||||
* @param {Event} event The original click event
|
||||
* @return {Promise}
|
||||
* @private
|
||||
*/
|
||||
async _onweaponpropertiesControl(event) {
|
||||
event.preventDefault();
|
||||
const a = event.currentTarget;
|
||||
|
||||
// Add new weaponproperties component
|
||||
if ( a.classList.contains("add-weaponproperties") ) {
|
||||
await this._onSubmit(event); // Submit any unsaved changes
|
||||
const weaponproperties = this.item.data.data.weaponproperties;
|
||||
return this.item.update({"data.weaponproperties.parts": weaponproperties.parts.concat([["", ""]])});
|
||||
}
|
||||
|
||||
// Remove a weaponproperties component
|
||||
if ( a.classList.contains("delete-weaponproperties") ) {
|
||||
await this._onSubmit(event); // Submit any unsaved changes
|
||||
const li = a.closest(".weaponproperties-part");
|
||||
const weaponproperties = duplicate(this.item.data.data.weaponproperties);
|
||||
weaponproperties.parts.splice(Number(li.dataset.weaponpropertiesPart), 1);
|
||||
return this.item.update({"data.weaponproperties.parts": weaponproperties.parts});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle spawning the TraitSelector application which allows a checkbox of multiple trait options
|
||||
* @param {Event} event The click event which originated the selection
|
||||
|
|
5
sw5e.css
5
sw5e.css
|
@ -1313,7 +1313,10 @@
|
|||
color: #7a7971;
|
||||
}
|
||||
.sw5e.sheet.item .weapon-properties label.checkbox {
|
||||
flex: 0 0 98px;
|
||||
flex: 0 0 110px;
|
||||
}
|
||||
.sw5e.sheet.item .armor-properties label.checkbox {
|
||||
flex: 0 0 110px;
|
||||
}
|
||||
.sw5e.sheet.item .loot-header {
|
||||
margin-bottom: 10px;
|
||||
|
|
|
@ -76,32 +76,15 @@
|
|||
</div>
|
||||
{{/unless}}
|
||||
|
||||
{{#unless isWeapon }}
|
||||
{{!-- ArmorProperties Formula --}}
|
||||
<div class="form-group stacked weapon-properties">
|
||||
<h4 class="armorproperties-header">
|
||||
{{#unless isWeapon }}{{ localize "SW5E.ArmorProperties" }}{{ else }}{{ localize "SW5E.ItemWeaponProperties" }}{{/unless}}
|
||||
<a class="armorproperties-control add-armorproperties"><i class="fas fa-plus"></i></a>
|
||||
</h4>
|
||||
<ol class="armorproperties-parts form-group">
|
||||
{{#each data.armorproperties.parts as |part i| }}
|
||||
<li class="armorproperties-part flexrow" data-armorproperties-part="{{i}}">
|
||||
|
||||
<select name="data.armorproperties.parts.{{i}}.1">
|
||||
{{#select (lookup this "1") }}
|
||||
<option value="">{{ localize "SW5E.None" }}</option>
|
||||
{{#each ../config.armorpropertiesTypes as |name type|}}
|
||||
<option value="{{type}}">{{name}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
<input type="text" name="data.armorproperties.parts.{{i}}.0" value="{{lookup this "0"}}"/>
|
||||
<a class="armorproperties-control delete-armorproperties"><i class="fas fa-minus"></i></a>
|
||||
</li>
|
||||
{{!-- Armor Properties --}}
|
||||
<div class="form-group stacked armor-properties">
|
||||
<label>{{ localize "SW5E.ArmorProperties" }}</label>
|
||||
{{#each config.armorPropertiesTypes as |name prop|}}
|
||||
<label class="checkbox">
|
||||
<input type="checkbox" name="data.properties.{{prop}}" {{checked (lookup ../data.properties prop)}}/> {{ name }}
|
||||
</label>
|
||||
{{/each}}
|
||||
</ol>
|
||||
</div>
|
||||
{{/unless}}
|
||||
|
||||
{{!-- Armor Class --}}
|
||||
<div class="form-group">
|
||||
|
|
|
@ -77,7 +77,6 @@
|
|||
</div>
|
||||
{{/unless}}
|
||||
|
||||
{{#if sss}}
|
||||
{{!-- Weapon Properties --}}
|
||||
<div class="form-group stacked weapon-properties">
|
||||
<label>{{ localize "SW5E.ItemWeaponProperties" }}</label>
|
||||
|
@ -87,34 +86,6 @@
|
|||
</label>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if isWeapon }}
|
||||
<div class="form-group stacked weapon-properties">
|
||||
{{!-- weaponproperties Formula --}}
|
||||
<h4 class="weaponproperties-header">
|
||||
{{#unless isWeapon }}{{ localize "SW5E.ArmorProperties" }}{{ else }}{{ localize "SW5E.ItemWeaponProperties" }}{{/unless}}
|
||||
<a class="weaponproperties-control add-weaponproperties"><i class="fas fa-plus"></i></a>
|
||||
</h4>
|
||||
<ol class="weaponproperties-parts form-group">
|
||||
{{#each data.weaponproperties.parts as |part i| }}
|
||||
<li class="weaponproperties-part flexrow" data-weaponproperties-part="{{i}}">
|
||||
|
||||
<select name="data.weaponproperties.parts.{{i}}.1">
|
||||
{{#select (lookup this "1") }}
|
||||
<option value="">{{ localize "SW5E.None" }}</option>
|
||||
{{#each ../config.weaponProperties as |name type|}}
|
||||
<option value="{{type}}">{{name}}</option>
|
||||
{{/each}}
|
||||
{{/select}}
|
||||
</select>
|
||||
<input type="text" name="data.weaponproperties.parts.{{i}}.0" value="{{lookup this "0"}}"/>
|
||||
<a class="weaponproperties-control delete-weaponproperties"><i class="fas fa-minus"></i></a>
|
||||
</li>
|
||||
{{/each}}
|
||||
</ol>
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
{{#if isMountable}}
|
||||
<div class="form-group">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue