Adds mod management (WIP)

This commit is contained in:
mstein
2022-07-05 00:10:08 +02:00
parent 8b6bfd2efb
commit c8d59588e0
18 changed files with 1181 additions and 171 deletions
+18 -11
View File
@@ -4,21 +4,24 @@
<th>{{localize "ITEM.TypeWeapon"}}</th>
<th>{{localize "midgard5.ew"}}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{{#each data.calc.gear.weapons as |item itemId|}}
<tr data-item="{{itemId}}">
<td class="padding edit-item">{{item.label}}</td>
<td class="center">{{item.calc.ew}}</td>
<td><button class="roll-weapon-button">{{localize "midgard5.roll"}}</button></td>
<td class="fixed-value">{{item.calc.ew}}</td>
<td class="fixed-value"><button class="roll-button roll-weapon-button"></button></td>
<td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
</tr>
{{/each}}
<tr data-item="{{itemId}}">
<td class="padding edit-item">{{localize "midgard5.brawl"}}</td>
<td class="center">{{data.calc.stats.brawlEw}}</td>
<td><button class="roll-brawl-button">{{localize "midgard5.roll"}}</button></td>
<td class="fixed-value"><button class="roll-button roll-brawl-button"></button></td>
<td class="fixed-value"></td>
</tr>
</tbody>
</table>
@@ -29,14 +32,16 @@
<th>{{localize "ITEM.TypeDefensiveWeapon"}}</th>
<th>{{localize "midgard5.ew"}}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{{#each data.calc.gear.defensiveWeapons as |item itemId|}}
<tr data-item="{{itemId}}">
<td class="padding edit-item">{{item.label}}</td>
<td class="center">{{item.calc.ew}}</td>
<td><button class="roll-weapon-button">{{localize "midgard5.roll"}}</button></td>
<td class="fixed-value">{{item.calc.ew}}</td>
<td class="fixed-value"><button class="roll-button roll-weapon-button"></button></td>
<td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
</tr>
{{/each}}
</tbody>
@@ -52,18 +57,20 @@
<th>{{localize "midgard5.defenseBonus-short"}}</th>
<th>B</th>
<th>Gw</th>
<th></th>
</tr>
</thead>
<tbody>
{{#each data.calc.gear.armor as |item itemId|}}
<tr data-item="{{itemId}}">
<td class="padding edit-item">{{item.label}}</td>
<td class="center">{{actorItemValue ../actor._id itemId "lpProtection"}}</td>
<td class="center">{{actorItemValue ../actor._id itemId "apProtection"}}</td>
<td class="center">{{actorItemValue ../actor._id itemId "stats.attackBonus"}}</td>
<td class="center">{{actorItemValue ../actor._id itemId "stats.defenseBonus"}}</td>
<td class="center">{{actorItemValue ../actor._id itemId "stats.movementBonus"}}</td>
<td class="center">{{actorItemValue ../actor._id itemId "attributeMod.gw"}}</td>
<td class="fixed-value">{{actorItemValue ../actor._id itemId "lpProtection"}}</td>
<td class="fixed-value">{{actorItemValue ../actor._id itemId "apProtection"}}</td>
<td class="fixed-value">{{actorItemValue ../actor._id itemId "stats.attackBonus"}}</td>
<td class="fixed-value">{{actorItemValue ../actor._id itemId "stats.defenseBonus"}}</td>
<td class="fixed-value">{{actorItemValue ../actor._id itemId "stats.movementBonus"}}</td>
<td class="fixed-value">{{actorItemValue ../actor._id itemId "attributeMod.gw"}}</td>
<td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
</tr>
{{/each}}
</tbody>
+30 -20
View File
@@ -6,16 +6,18 @@
<th>{{localize "midgard5.bonus"}}</th>
<th>{{localize "midgard5.ew"}}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{{#each data.calc.skills.general as |skill skillId|}}
<tr data-item="{{skillId}}">
<td class="padding edit-item">{{skill.label}}</td>
<td class="center">{{skill.fw}}</td>
<td class="center">{{skill.calc.bonus}}</td>
<td class="center">{{skill.calc.ew}}</td>
<td><button class="roll-learned-button">{{localize "midgard5.roll"}}</button></td>
<td class="fixed-value">{{skill.fw}}</td>
<td class="fixed-value">{{skill.calc.bonus}}</td>
<td class="fixed-value">{{skill.calc.ew}}</td>
<td class="fixed-value"><button class="roll-button roll-learned-button"></button></td>
<td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
</tr>
{{/each}}
</tbody>
@@ -29,16 +31,18 @@
<th>{{localize "midgard5.bonus"}}</th>
<th>{{localize "midgard5.ew"}}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{{#each data.calc.skills.language as |skill skillId|}}
<tr data-item="{{skillId}}">
<td class="padding edit-item">{{skill.label}}</td>
<td class="center">{{skill.fw}}</td>
<td class="center">{{skill.calc.bonus}}</td>
<td class="center">{{skill.calc.ew}}</td>
<td><button class="roll-learned-button">{{localize "midgard5.roll"}}</button></td>
<td class="fixed-value">{{skill.fw}}</td>
<td class="fixed-value">{{skill.calc.bonus}}</td>
<td class="fixed-value">{{skill.calc.ew}}</td>
<td class="fixed-value"><button class="roll-button roll-learned-button"></button></td>
<td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
</tr>
{{/each}}
</tbody>
@@ -52,16 +56,18 @@
<th>{{localize "midgard5.bonus"}}</th>
<th>{{localize "midgard5.ew"}}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{{#each data.calc.skills.innate as |skill skillId|}}
<tr data-item="{{skillId}}">
<td class="padding edit-item">{{skill.label}}</td>
<td class="center">{{skill.fw}}</td>
<td class="center">{{skill.calc.bonus}}</td>
<td class="center">{{skill.calc.ew}}</td>
<td><button class="roll-learned-button">{{localize "midgard5.roll"}}</button></td>
<td class="fixed-value">{{skill.fw}}</td>
<td class="fixed-value">{{skill.calc.bonus}}</td>
<td class="fixed-value">{{skill.calc.ew}}</td>
<td class="fixed-value"><button class="roll-button roll-learned-button"></button></td>
<td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
</tr>
{{/each}}
</tbody>
@@ -75,16 +81,18 @@
<th>{{localize "midgard5.bonus"}}</th>
<th>{{localize "midgard5.ew"}}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
{{#each data.calc.skills.combat as |skill skillId|}}
<tr data-item="{{skillId}}">
<td class="padding edit-item">{{skill.label}}</td>
<td class="center">{{skill.fw}}</td>
<td class="center">{{skill.calc.bonus}}</td>
<td class="center">{{skill.calc.ew}}</td>
<td><button class="roll-learned-button">{{localize "midgard5.roll"}}</button></td>
<td class="fixed-value">{{skill.fw}}</td>
<td class="fixed-value">{{skill.calc.bonus}}</td>
<td class="fixed-value">{{skill.calc.ew}}</td>
<td class="fixed-value"><button class="roll-button roll-learned-button"></button></td>
<td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
</tr>
{{/each}}
</tbody>
@@ -99,6 +107,7 @@
<th>{{localize "midgard5.bonus"}}</th>
<th>{{localize "midgard5.ew"}}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@@ -106,10 +115,11 @@
<tr data-skill="{{key}}">
<td><button class="learn-button">{{localize "midgard5.learn"}}</button></td>
<td class="padding">{{localizeMidgard key}}</td>
<td class="center">{{skill.fw}}</td>
<td class="center">{{skillBonus ../actor._id skill}}</td>
<td class="center">{{skillEw ../actor._id skill}}</td>
<td><button class="roll-general-button">{{localize "midgard5.roll"}}</button></td>
<td class="fixed-value">{{skill.fw}}</td>
<td class="fixed-value">{{skillBonus ../actor._id skill}}</td>
<td class="fixed-value">{{skillEw ../actor._id skill}}</td>
<td class="fixed-value"><button class="roll-button roll-general-button"></button></td>
<td class="fixed-value"></td>
</tr>
{{/each}}
</tbody>
+4 -2
View File
@@ -4,6 +4,7 @@
<th>{{localize "ITEM.TypeSpell"}}</th>
<th>{{localize "midgard5.ew"}}</th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
@@ -13,8 +14,9 @@
<span>{{item.label}}</span>
<span class="spell-process">{{localize item.process}}</span>
</td>
<td class="center">{{item.calc.ew}}</td>
<td><button class="roll-weapon-button">{{localize "midgard5.roll"}}</button></td>
<td class="fixed-value">{{item.calc.ew}}</td>
<td class="fixed-value"><button class="roll-button roll-weapon-button" /></td>
<td class="fixed-value"><a class="item-delete" title="Delete Item"><i class="fas fa-trash"></i></a></td>
</tr>
{{/each}}
</tbody>
+76 -30
View File
@@ -1,31 +1,77 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="item-img" src="{{item.img}}" data-edit="img" title="{{item.name}}" />
<h1><input name="name" type="text" value="{{item.name}}" placeholder="Name" /></h1>
</header>
<div class="sheet-content">
<table>
<tr>
<th>{{localize "midgard5.item-quantity"}}</th>
<th>{{localize "midgard5.item-value"}}</th>
<th>{{localize "midgard5.item-onbody"}}</th>
<th>{{localize "midgard5.item-ismagic"}}</th>
</tr>
<tr>
<td>
<input name="data.quantity" type="text" value="{{data.quantity}}" data-dtype="Number" />
</td>
<td>
<input name="data.value" type="text" value="{{data.value}}" data-dtype="Number" />
</td>
<td>
<input name="data.onbody" type="checkbox" {{checked data.onbody}} />
</td>
<td>
<input name="data.magic" type="checkbox" {{checked data.magic}} />
</td>
</tr>
</table>
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>
<form class="{{cssClass}} m5item-item" autocomplete="off">
<header class="sheet-header">
<img class="item-img" src="{{item.img}}" data-edit="img" title="{{item.name}}" />
<h1><input name="name" type="text" value="{{item.name}}" placeholder="Name" /></h1>
</header>
<div class="sheet-content">
<table>
<tr>
<td>
<input id="data.magic" type="checkbox" name="data.magic" {{checked data.magic}}>
<label for="data.magic">{{localize "midgard5.magic"}}</label>
</td>
<td>
<div class="flexrow">
<span>{{localize "midgard5.item-value"}}</span>
<input name="data.value" type="text" value="{{data.value}}" data-dtype="Number" />
</div>
</td>
</tr>
</table>
<table>
<thead>
<tr>
<th>Mods</th>
<th></th>
<th></th>
<th><button class="add-mod">+</button></th>
</tr>
</thead>
<tbody>
{{#each data.mods as |mod modId|}}
<tr>
<td>
<select class="select-mod-type" name="data.mods.{{modId}}.type" data-type="String">
{{#select mod.type}}
<option value="attribute">{{localize "midgard5.attribute"}}</option>
<option value="stat">{{localize "midgard5.bonus"}}</option>
<option value="skill">{{localize "midgard5.skill"}}</option>
{{/select}}
</select>
</td>
<td>
<select class="select-id" name="data.mods.{{modId}}.id" data-type="String">
{{#select mod.id}}
{{#each (lookup ../data.calc.mods modId) as |name key|}}
<option value="{{key}}">{{name}}</option>
{{/each}}
{{/select}}
</select>
</td>
<td>
<select class="select-mod-operation" name="data.mods.{{modId}}.operation" data-type="String">
{{#select mod.operation}}
{{#if (eq mod.type "attribute")}}
<option value="add100">{{localize "midgard5.mod-operation-add100"}}</option>
{{/if}}
<option value="add">{{localize "midgard5.mod-operation-add"}}</option>
<option value="set">{{localize "midgard5.mod-operation-set"}}</option>
<option value="fixed">{{localize "midgard5.mod-operation-fixed"}}</option>
{{/select}}
</select>
</td>
<td>
<input name="data.mods.{{modId}}.value" type="text" value="{{mod.value}}" data-dtype="Number" />
</td>
</tr>
{{/each}}
</tbody>
</table>
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>
</form>
+60
View File
@@ -0,0 +1,60 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="item-img" src="{{item.img}}" data-edit="img" title="{{item.name}}" />
<h1><input name="name" type="text" value="{{item.name}}" placeholder="Name" /></h1>
</header>
<div class="sheet-content">
<table>
<tbody>
<tr>
<td>{{localize "midgard5.mod-type"}}</td>
<td>
<select class="select-mod-type" name="data.type" data-type="String">
{{#select data.type}}
<option value="attribute">{{localize "midgard5.attribute"}}</option>
<option value="stat">{{localize "midgard5.bonus"}}</option>
<option value="skill">{{localize "midgard5.skill"}}</option>
{{/select}}
</select>
</td>
</tr>
<tr>
<td>{{localize "midgard5.mod-id"}}</td>
<td>
<select class="select-id" name="data.id" data-type="String">
{{#select data.id}}
{{#each data.calc.ids as |name key|}}
<option value="{{key}}">{{name}}</option>
{{/each}}
{{/select}}
</select>
</td>
</tr>
<tr>
<td>{{localize "midgard5.mod-operation"}}</td>
<td>
<select class="select-mod-operation" name="data.operation" data-type="String">
{{#select data.operation}}
{{#if (eq data.type "attribute")}}
<option value="add100">{{localize "midgard5.mod-operation-add100"}}</option>
{{/if}}
<option value="add">{{localize "midgard5.mod-operation-add"}}</option>
<option value="set">{{localize "midgard5.mod-operation-set"}}</option>
<option value="fixed">{{localize "midgard5.mod-operation-fixed"}}</option>
{{/select}}
</select>
</td>
</tr>
<tr>
<td>{{localize "midgard5.mod-value"}}</td>
<td><input name="data.value" type="text" value="{{data.value}}" data-dtype="Number" /></td>
</tr>
</tbody>
</table>
{{editor content=data.description target="data.description" button=true owner=owner editable=editable}}
</div>
</form>