ENH: retainers and items

master
U~man 2020-06-30 21:05:18 +02:00
parent 816c4d4a36
commit 0be4556bfe
10 changed files with 167 additions and 84 deletions

View File

@ -7,7 +7,7 @@
"OSE.Formula": "Formula", "OSE.Formula": "Formula",
"OSE.SitMod": "Situational Modifier", "OSE.SitMod": "Situational Modifier",
"OSE.RollMod": "Roll Mode", "OSE.RollMode": "Roll Mode",
"OSE.RollExample": "Roll Example", "OSE.RollExample": "Roll Example",
"OSE.Name": "Name", "OSE.Name": "Name",
@ -19,8 +19,13 @@
"OSE.Treasure": "Treasure type", "OSE.Treasure": "Treasure type",
"OSE.Size": "Size", "OSE.Size": "Size",
"OSE.Morale": "Morale", "OSE.Morale": "Morale",
"OSE.Retainer": "Retainer",
"OSE.Appearing": "NA", "OSE.Appearing": "NA",
"OSE.Loyalty": "Loyalty Rating",
"OSE.LoyaltyShort": "LR",
"OSE.AbilityCheck": "Ability Check",
"OSE.scores.str.long": "Strength", "OSE.scores.str.long": "Strength",
"OSE.scores.str.short": "STR", "OSE.scores.str.short": "STR",
"OSE.scores.wis.long": "Wisdom", "OSE.scores.wis.long": "Wisdom",
@ -52,7 +57,6 @@
"OSE.HitDiceShort": "HD", "OSE.HitDiceShort": "HD",
"OSE.Movement": "Movement", "OSE.Movement": "Movement",
"OSE.MovementShort": "MOV", "OSE.MovementShort": "MOV",
"OSE.SpecialMovement": "Special Movement",
"OSE.ArmorClass": "Armor Class", "OSE.ArmorClass": "Armor Class",
"OSE.ArmorClassShort": "AC", "OSE.ArmorClassShort": "AC",
"OSE.SpellDC": "DC", "OSE.SpellDC": "DC",

View File

@ -44,7 +44,6 @@
"OSE.HitDiceShort": "DV", "OSE.HitDiceShort": "DV",
"OSE.Movement": "Mouvement", "OSE.Movement": "Mouvement",
"OSE.MovementShort": "MOUV", "OSE.MovementShort": "MOUV",
"OSE.SpecialMovement": "Mouvement Spécial",
"OSE.ArmorClass": "Classe d'Armure", "OSE.ArmorClass": "Classe d'Armure",
"OSE.ArmorClassShort": "CA", "OSE.ArmorClassShort": "CA",
"OSE.SpellDC": "DF", "OSE.SpellDC": "DF",

View File

@ -133,6 +133,14 @@ export class OseActorSheetCharacter extends OseActorSheet {
// Item summaries // Item summaries
html.find('.item .item-name h4').click(event => this._onItemSummary(event)); html.find('.item .item-name h4').click(event => this._onItemSummary(event));
html.find('.ability-score .attribute-name a').click(ev => {
let actorObject = this.actor;
let element = event.currentTarget;
let score = element.parentElement.parentElement.dataset.score;
actorObject.rollCheck(score, { event: event });
})
// Handle default listeners last so system listeners are triggered first // Handle default listeners last so system listeners are triggered first
super.activateListeners(html); super.activateListeners(html);
} }

View File

@ -26,4 +26,19 @@ export class OseActor extends Actor {
title: `${label} ${game.i18n.localize('OSE.SavingThrow')}`, title: `${label} ${game.i18n.localize('OSE.SavingThrow')}`,
}); });
} }
rollCheck(score, options = {}) {
const label = game.i18n.localize(`OSE.scores.${score}.long`);
const rollParts = ['1d20'];
// Roll and return
return OseDice.Roll({
event: options.event,
parts: rollParts,
data: this.data,
speaker: ChatMessage.getSpeaker({ actor: this }),
flavor: `${label} ${game.i18n.localize('OSE.AbilityCheck')}`,
title: `${label} ${game.i18n.localize('OSE.AbilityCheck')}`,
});
}
} }

View File

@ -2,6 +2,36 @@
"Actor": { "Actor": {
"types": ["character", "monster"], "types": ["character", "monster"],
"templates": { "templates": {
"common": {
"retainer": {
"enabled": false,
"loyalty": 0
},
"hp": {
"hd": "",
"value": 20,
"max": 20
},
"ac": {
"value": 0,
"mod": 0
},
"thac0": {
"value": 19,
"mod": 0
},
"saves": {
"death": 10,
"wand": 10,
"paralysis": 10,
"breath": 10,
"spell": 10
},
"movement": {
"base": 0,
"encounter": 0
}
},
"spellcaster": { "spellcaster": {
"spells": { "spells": {
"enabled": false, "enabled": false,
@ -34,7 +64,7 @@
} }
}, },
"character": { "character": {
"templates": ["spellcaster"], "templates": ["common", "spellcaster"],
"details": { "details": {
"biography": "", "biography": "",
"class": "", "class": "",
@ -76,32 +106,6 @@
"silver": 0, "silver": 0,
"copper": 0 "copper": 0
}, },
"hp": {
"hd": "",
"value": 20,
"max": 20
},
"ac": {
"value": 0,
"mod": 0
},
"thac0": {
"value": 19,
"mod": 0,
"missile": 0,
"melee": 0
},
"saves": {
"D": 10,
"W": 10,
"P": 10,
"B": 10,
"S": 10
},
"movement": {
"base": 0,
"encounter": 0
},
"initative": { "initative": {
"value": 0, "value": 0,
"mod": 0 "mod": 0
@ -109,7 +113,7 @@
"languages": [] "languages": []
}, },
"monster": { "monster": {
"templates": ["spellcaster"], "templates": ["common", "spellcaster"],
"details": { "details": {
"biography": "", "biography": "",
"alignment": "", "alignment": "",
@ -119,45 +123,44 @@
"appearing": "", "appearing": "",
"morale": 0 "morale": 0
}, },
"saves": {
"death": 10,
"wand": 10,
"paralysis": 10,
"breath": 10,
"spell": 10
},
"thac0": {
"value": 19,
"mod": 0
},
"hp": {
"hd": "",
"max": 0,
"value": 0
},
"ac": {
"value": 0,
"mod": 0
},
"attacks": { "attacks": {
"value": 1 "value": 1
},
"movement": {
"base": 0,
"encounter": 0
} }
} }
}, },
"Item": { "Item": {
"types": ["item", "spell", "ability"], "types": ["item", "weapon", "armor", "spell", "ability"],
"item": { "item": {
"description": "", "description": "",
"quantity": 1, "quantity": {
"value": 1,
"max": 0
},
"cost": 0,
"weight": 0
},
"weapon": {
"description": "",
"damage": "1d6",
"qualities": "",
"slow": false,
"melee": true,
"ranged": true,
"cost": 0,
"weight": 0
},
"armor": {
"description": "",
"ac": 9,
"aac": 10,
"cost": 0,
"weight": 0 "weight": 0
}, },
"spell": { "spell": {
"lvl": 1, "lvl": 1,
"class": "", "class": "Magic-User",
"duration": "",
"range": "",
"description": "" "description": ""
}, },
"ability": { "ability": {

View File

@ -11,6 +11,18 @@
/> />
</div> </div>
</div> </div>
<div class="form-group">
<label for="retainer">{{localize "OSE.Retainer"}}</label>
<div class="form-fields">
<input
type="checkbox"
name="data.retainer.enabled"
id="retainer"
{{checked
data.retainer.enabled}}
/>
</div>
</div>
<footer class="sheet-footer"> <footer class="sheet-footer">
<button type="submit"> <button type="submit">
<i class="fas fa-save"></i>{{localize "Save Changes"}} <i class="fas fa-save"></i>{{localize "Save Changes"}}

View File

@ -23,20 +23,6 @@
data-dtype="Number" /> data-dtype="Number" />
</div> </div>
</li> </li>
<li class="attribute">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.Melee' }}">{{ localize "OSE.MeleeShort" }}</h4>
<div class="attribute-value">
<input name="data.thac0.melee" type="text" value="{{data.thac0.melee}}" placeholder="0"
data-dtype="Number" />
</div>
</li>
<li class="attribute">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.Missile' }}">{{ localize "OSE.MissileShort" }}</h4>
<div class="attribute-value">
<input name="data.thac0.missile" type="text" value="{{data.thac0.missile}}" placeholder="0"
data-dtype="Number" />
</div>
</li>
{{#if config.individualInit}} {{#if config.individualInit}}
<li class="attribute"> <li class="attribute">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.Initiative' }}">{{ localize "OSE.InitiativeShort" }}</h4> <h4 class="attribute-name box-title" title="{{ localize 'OSE.Initiative' }}">{{ localize "OSE.InitiativeShort" }}</h4>
@ -46,6 +32,15 @@
</div> </div>
</li> </li>
{{/if}} {{/if}}
{{#if data.retainer.enabled}}
<li class="attribute">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.Loyalty' }}">{{ localize "OSE.LoyaltyShort" }}</h4>
<div class="attribute-value">
<input name="data.retainer.loyalty" type="text" value="{{data.retainer.loyalty}}"
placeholder="0" data-dtype="Number" />
</div>
</li>
{{/if}}
<li class="attribute"> <li class="attribute">
<h4 class="attribute-name box-title">{{ localize "OSE.MovementShort" }}</h4> <h4 class="attribute-name box-title">{{ localize "OSE.MovementShort" }}</h4>
<div class="attribute-value"> <div class="attribute-value">
@ -59,33 +54,33 @@
{{!-- Scores --}} {{!-- Scores --}}
<div class="attribute-group"> <div class="attribute-group">
<ul class="attributes"> <ul class="attributes">
<li class="attribute"> <li class="attribute ability-score" data-score="str">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.str.long' }}">{{ localize "OSE.scores.str.short" }}</h4> <h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.str.long' }}"><a>{{ localize "OSE.scores.str.short" }}</a></h4>
<div class="attribute-value"> <div class="attribute-value">
<input name="data.scores.str.value" type="text" value="{{data.scores.str.value}}" placeholder="0" data-dtype="Number"/> <input name="data.scores.str.value" type="text" value="{{data.scores.str.value}}" placeholder="0" data-dtype="Number"/>
</li> </li>
<li class="attribute"> <li class="attribute ability-score" data-score="int">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.int.long' }}">{{ localize "OSE.scores.int.short" }}</h4> <h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.int.long' }}"><a>{{ localize "OSE.scores.int.short" }}</a></h4>
<div class="attribute-value"> <div class="attribute-value">
<input name="data.scores.int.value" type="text" value="{{data.scores.int.value}}" placeholder="0" data-dtype="Number"/> <input name="data.scores.int.value" type="text" value="{{data.scores.int.value}}" placeholder="0" data-dtype="Number"/>
</li> </li>
<li class="attribute"> <li class="attribute ability-score" data-score="wis">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.wis.long' }}">{{ localize "OSE.scores.wis.short" }}</h4> <h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.wis.long' }}"><a>{{ localize "OSE.scores.wis.short" }}</a></h4>
<div class="attribute-value"> <div class="attribute-value">
<input name="data.scores.wis.value" type="text" value="{{data.scores.wis.value}}" placeholder="0" data-dtype="Number"/> <input name="data.scores.wis.value" type="text" value="{{data.scores.wis.value}}" placeholder="0" data-dtype="Number"/>
</li> </li>
<li class="attribute"> <li class="attribute ability-score" data-score="dex">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.dex.long' }}">{{ localize "OSE.scores.dex.short" }}</h4> <h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.dex.long' }}"><a>{{ localize "OSE.scores.dex.short" }}</a></h4>
<div class="attribute-value"> <div class="attribute-value">
<input name="data.scores.dex.value" type="text" value="{{data.scores.dex.value}}" placeholder="0" data-dtype="Number"/> <input name="data.scores.dex.value" type="text" value="{{data.scores.dex.value}}" placeholder="0" data-dtype="Number"/>
</li> </li>
<li class="attribute"> <li class="attribute ability-score" data-score="con">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.con.long' }}">{{ localize "OSE.scores.con.short" }}</h4> <h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.con.long' }}"><a>{{ localize "OSE.scores.con.short" }}</a></h4>
<div class="attribute-value"> <div class="attribute-value">
<input name="data.scores.con.value" type="text" value="{{data.scores.con.value}}" placeholder="0" data-dtype="Number"/> <input name="data.scores.con.value" type="text" value="{{data.scores.con.value}}" placeholder="0" data-dtype="Number"/>
</li> </li>
<li class="attribute"> <li class="attribute ability-score" data-score="cha">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.cha.long' }}">{{ localize "OSE.scores.cha.short" }}</h4> <h4 class="attribute-name box-title" title="{{ localize 'OSE.scores.cha.long' }}"><a>{{ localize "OSE.scores.cha.short" }}</a></h4>
<div class="attribute-value"> <div class="attribute-value">
<input name="data.scores.cha.value" type="text" value="{{data.scores.cha.value}}" placeholder="0" data-dtype="Number"/> <input name="data.scores.cha.value" type="text" value="{{data.scores.cha.value}}" placeholder="0" data-dtype="Number"/>
</li> </li>

View File

@ -30,6 +30,15 @@
data-dtype="Number" /> data-dtype="Number" />
</div> </div>
</li> </li>
{{#if data.retainer.enabled}}
<li class="attribute">
<h4 class="attribute-name box-title" title="{{ localize 'OSE.Loyalty' }}">{{ localize "OSE.LoyaltyShort" }}</h4>
<div class="attribute-value">
<input name="data.retainer.loyalty" type="text" value="{{data.retainer.loyalty}}"
placeholder="0" data-dtype="Number" />
</div>
</li>
{{/if}}
<li class="attribute"> <li class="attribute">
<h4 class="attribute-name box-title" title="{{localize 'OSE.Movement'}}">{{ localize "OSE.MovementShort" }}</h4> <h4 class="attribute-name box-title" title="{{localize 'OSE.Movement'}}">{{ localize "OSE.MovementShort" }}</h4>
<div class="attribute-value"> <div class="attribute-value">

View File

@ -0,0 +1,19 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}" />
<div class="header-col">
<h1 class="charname">
<input
name="name"
type="text"
value="{{item.name}}"
placeholder="Name"
/>
</h1>
</div>
</header>
<section class="sheet-body">
{{editor content=data.description target="data.description"
button=true owner=owner editable=editable}}
</section>
</form>

View File

@ -0,0 +1,19 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="profile-img" src="{{item.img}}" data-edit="img" title="{{item.name}}" />
<div class="header-col">
<h1 class="charname">
<input
name="name"
type="text"
value="{{item.name}}"
placeholder="Name"
/>
</h1>
</div>
</header>
<section class="sheet-body">
{{editor content=data.description target="data.description"
button=true owner=owner editable=editable}}
</section>
</form>