Item sheets, WIP

This commit is contained in:
sladecraven 2022-11-03 15:06:47 +01:00
parent c38c5e95bf
commit 1b04f6ce69
14 changed files with 304 additions and 211 deletions

View File

@ -57,8 +57,6 @@ export class Avd12ItemSheet extends ItemSheet {
name: this.object.name,
editable: this.isEditable,
cssClass: this.isEditable ? "editable" : "locked",
weaponSkills: CrucibleUtility.getWeaponSkills(),
shieldSkills: CrucibleUtility.getShieldSkills(),
system: duplicate(this.object.system),
limited: this.object.limited,
options: this.options,

View File

@ -64,12 +64,12 @@ export class Avd12Utility {
/* -------------------------------------------- */
static async ready() {
const skills = await Avd12Utility.loadCompendium("fvtt-crucible-rpg.skills")
const skills = await Avd12Utility.loadCompendium("fvtt-avd12.skills")
this.skills = skills.map(i => i.toObject())
this.weaponSkills = duplicate(this.skills.filter(item => item.system.isweaponskill))
this.shieldSkills = duplicate(this.skills.filter(item => item.system.isshieldskill))
const rollTables = await Avd12Utility.loadCompendium("fvtt-crucible-rpg.rolltables")
const rollTables = await Avd12Utility.loadCompendium("fvtt-avd12.rolltables")
this.rollTables = rollTables.map(i => i.toObject())
}
@ -93,98 +93,6 @@ export class Avd12Utility {
}
return false
}
/* -------------------------------------------- */
static isWeaponPenetrating(weapon) {
if (weapon && weapon.system.qualities.toLowerCase().includes("penetrating")) {
return true
}
return false
}
/* -------------------------------------------- */
static isWeaponLight(weapon) {
if (weapon && weapon.system.qualities.toLowerCase().includes("light")) {
return true
}
return false
}
/* -------------------------------------------- */
static isWeaponHeavy(weapon) {
if (weapon && weapon.system.qualities.toLowerCase().includes("heavy")) {
return true
}
return false
}
/* -------------------------------------------- */
static isWeaponHack(weapon) {
if (weapon && weapon.system.qualities.toLowerCase().includes("hack")) {
return true
}
return false
}
/* -------------------------------------------- */
static isWeaponUndamaging(weapon) {
if (weapon && weapon.system.qualities.toLowerCase().includes("undamaging")) {
return true
}
return false
}
/* -------------------------------------------- */
static isWeaponDangerous(weapon) {
if (weapon && weapon.system.qualities.toLowerCase().includes("dangerous")) {
return true
}
return false
}
/* -------------------------------------------- */
static isWeaponDeadly(weapon) {
if (weapon && weapon.system.qualities.toLowerCase().includes("deadly")) {
return true
}
return false
}
static getWeaponRange(weapon) {
if (weapon && weapon.system.isranged) {
let rangeValue = weapon.system.range.replace(/[^0-9]/g, '')
return Number(rangeValue)
}
return false
}
static getWeaponMaxRange(weapon) {
if (weapon && weapon.system.isranged) {
let rangeValue = weapon.system.maxrange.replace(/[^0-9]/g, '')
return Number(rangeValue)
}
return false
}
/* -------------------------------------------- */
static async getRollTableFromDiceColor(diceColor, displayChat = true) {
let rollTableName = __color2RollTable[diceColor]
if (rollTableName) {
const pack = game.packs.get("fvtt-crucible-rpg.rolltables")
const index = await pack.getIndex()
const entry = index.find(e => e.name === rollTableName)
let table = await pack.getDocument(entry._id)
const draw = await table.draw({ displayChat: displayChat, rollMode: "gmroll" })
return draw.results.length > 0 ? draw.results[0] : undefined
}
}
/* -------------------------------------------- */
static getSizeDice(sizeValue) {
return __size2Dice[sizeValue]
}
/* -------------------------------------------- */
static async getCritical(level, weapon) {
const pack = game.packs.get("fvtt-crucible-rpg.rolltables")
let tableName = "Crit " + level + " (" + this.upperFirst(weapon.system.damage) + ")"
const index = await pack.getIndex()
const entry = index.find(e => e.name === tableName)
let table = await pack.getDocument(entry._id)
const draw = await table.draw({ displayChat: false, rollMode: "gmroll" })
return draw.results.length > 0 ? draw.results[0] : undefined
}
/* -------------------------------------------- */
static async chatListeners(html) {
@ -216,14 +124,10 @@ export class Avd12Utility {
static async preloadHandlebarsTemplates() {
const templatePaths = [
'systems/fvtt-crucible-rpg/templates/editor-notes-gm.html',
'systems/fvtt-crucible-rpg/templates/partial-roll-select.html',
'systems/fvtt-crucible-rpg/templates/partial-actor-ability-block.html',
'systems/fvtt-crucible-rpg/templates/partial-actor-status.html',
'systems/fvtt-crucible-rpg/templates/partial-options-abilities.html',
'systems/fvtt-crucible-rpg/templates/partial-item-nav.html',
'systems/fvtt-crucible-rpg/templates/partial-item-description.html',
'systems/fvtt-crucible-rpg/templates/partial-actor-equipment.html'
'systems/fvtt-avd12/templates/actors/editor-notes-gm.hbs',
'systems/fvtt-avd12/templates/items/partial-item-nav.hbs',
'systems/fvtt-avd12/templates/items/partial-item-description.hbs',
'systems/fvtt-avd12/templates/items/partial-options-weapons-types.hbs'
]
return loadTemplates(templatePaths);
}
@ -319,7 +223,7 @@ export class Avd12Utility {
name: defender.name,
alias: defender.name,
//user: defender.id,
content: await renderTemplate(`systems/fvtt-crucible-rpg/templates/chat-request-defense.html`, rollData),
content: await renderTemplate(`systems/fvtt-avd12/templates/chat-request-defense.html`, rollData),
whisper: [defender.id].concat(ChatMessage.getWhisperRecipients('GM')),
})
}
@ -365,7 +269,7 @@ export class Avd12Utility {
/* -------------------------------------------- */
static async getFumble(weapon) {
const pack = game.packs.get("fvtt-crucible-rpg.rolltables")
const pack = game.packs.get("fvtt-avd12.rolltables")
const index = await pack.getIndex()
let entry
@ -404,7 +308,7 @@ export class Avd12Utility {
result.criticalText = result.critical.text
}
this.createChatWithRollMode(rollData.alias, {
content: await renderTemplate(`systems/fvtt-crucible-rpg/templates/chat-attack-defense-result.html`, rollData)
content: await renderTemplate(`systems/fvtt-avd12/templates/chat-attack-defense-result.html`, rollData)
})
console.log("Results processed", rollData)
}
@ -429,7 +333,7 @@ export class Avd12Utility {
if (game.user.isGM) {
this.processSuccessResult(rollData)
} else {
game.socket.emit("system.fvtt-crucible-rpg", { msg: "msg_gm_process_attack_defense", data: rollData });
game.socket.emit("system.fvtt-avd12", { msg: "msg_gm_process_attack_defense", data: rollData });
}
}
}
@ -638,7 +542,7 @@ export class Avd12Utility {
rollData.rollOrder = 1
rollData.rollType = (rollData.rollAdvantage == "roll-advantage") ? "Advantage" : "Disadvantage"
this.createChatWithRollMode(rollData.alias, {
content: await renderTemplate(`systems/fvtt-crucible-rpg/templates/chat-generic-result.html`, rollData)
content: await renderTemplate(`systems/fvtt-avd12/templates/chat-generic-result.html`, rollData)
})
rollData.rollOrder = 2
@ -648,7 +552,7 @@ export class Avd12Utility {
rollData.roll = myRoll2 // Tmp switch to display the proper results
rollData.nbSuccess = myRoll2.total
this.createChatWithRollMode(rollData.alias, {
content: await renderTemplate(`systems/fvtt-crucible-rpg/templates/chat-generic-result.html`, rollData)
content: await renderTemplate(`systems/fvtt-avd12/templates/chat-generic-result.html`, rollData)
})
rollData.roll = myRoll // Revert the tmp switch
rollData.nbSuccess = myRoll.total
@ -682,7 +586,7 @@ export class Avd12Utility {
actor.lastRoll = rollData
this.createChatWithRollMode(rollData.alias, {
content: await renderTemplate(`systems/fvtt-crucible-rpg/templates/chat-generic-result.html`, rollData)
content: await renderTemplate(`systems/fvtt-avd12/templates/chat-generic-result.html`, rollData)
})
console.log("Rolldata result", rollData)
@ -733,7 +637,7 @@ export class Avd12Utility {
chatGM.whisper = this.getUsers(user => user.isGM);
chatGM.content = "Blinde message of " + game.user.name + "<br>" + chatOptions.content;
console.log("blindMessageToGM", chatGM);
game.socket.emit("system.fvtt-crucible-rpg", { msg: "msg_gm_chat_message", data: chatGM });
game.socket.emit("system.fvtt-avd12", { msg: "msg_gm_chat_message", data: chatGM });
}

View File

@ -74,7 +74,7 @@
"value": 0,
"max": 0
},
"resistances": {
"mitigation": {
"physical": {
"label": "Physical Damage",
"abbrev": "physical",
@ -92,9 +92,9 @@
"iselemental": true,
"value": 0
},
"cool": {
"label": "Cool Damage",
"abbrev": "cool",
"cold": {
"label": "Cold Damage",
"abbrev": "cold",
"iselemental": true,
"value": 0
},
@ -113,11 +113,97 @@
"abbrev": "divine",
"value": 0
},
"arcane": {
"label": "Aracane Damage",
"abbrev": "arcane",
"value": 0
},
"poison": {
"label": "Poison Damage",
"abbrev": "poison",
"value": 0
},
"true": {
"label": "True Damage",
"abbrev": "true",
"value": 0
}
},
"bonus": {
"ranged": {
"attack": 0,
"damage": 0,
"crits": 0,
"brutals": 0
},
"slash": {
"attack": 0,
"damage": 0,
"crits": 0,
"brutals": 0
},
"blunt": {
"attack": 0,
"damage": 0,
"crits": 0,
"brutals": 0
},
"pierce": {
"attack": 0,
"damage": 0,
"crits": 0,
"brutals": 0
},
"unarmed": {
"attack": 0,
"damage": 0
},
"dodge": {
"armored": 0,
"light": 0,
"unarmored": 0
},
"stealth": {
"armored": 0,
"light": 0,
"unarmored": 0
},
"block": {
"armored": 0,
"light": 0,
"unarmored": 0
},
"physical": {
"armored": 0,
"light": 0,
"unarmored": 0
},
"elemental": {
"armored": 0,
"light": 0,
"unarmored": 0
},
"armored": {
"remove_stealth": false,
"cast_speed": 0
},
"craft": {
"smithing": 0,
"cooking": 0,
"scribing": 0,
"runecarving": 0,
"alchemy": 0,
"ammocraft": 0,
"engineering": 0
},
"weapon": {
"attack": 0,
"damage": 0
},
"spell": {
"attack": 0,
"damage": 0
}
}
},
"npccore": {
@ -143,6 +229,54 @@
"module",
"money"
],
"templates": {
"commonitem": {
"focuspointsbonus": 0,
"focusregenbonus": 0,
"burnchancebonus": 0,
"mitigation": {
"physical": {
"value": 0
},
"psychic": {
"value": 0
},
"fire": {
"value": 0
},
"lightning": {
"value": 0
},
"cold": {
"value": 0
},
"dark": {
"value": 0
},
"divine": {
"value": 0
},
"arcane": {
"value": 0
}
},
"bonus": {
"block": {
"value": 0
},
"dodge": {
"value": 0
},
"resistance": {
"value": 0
}
},
"weight": 0,
"cost": 0,
"health": 0,
"movespeed": 0
}
},
"skill": {
"attribute": "",
"value": 0,
@ -154,22 +288,24 @@
"description": ""
},
"armor": {
"weight": 0,
"cost": 0,
"templates": [
"commonitem"
],
"equipped": false,
"locationprotected": "",
"description": ""
},
"shield": {
"weight": 0,
"cost": 0,
"templates": [
"commonitem"
],
"equipped": false,
"description": ""
},
"equipment": {
"equiptype": "",
"cost": 0,
"weight": 0,
"templates": [
"commonitem"
],
"quantity": 0,
"equipped": false,
"description": ""
@ -182,11 +318,34 @@
},
"weapon": {
"weapontype": "",
"cost": 0,
"weight": 0,
"range": "",
"maxrange": "",
"category": "",
"templates": [
"commonitem"
],
"minrange": 0,
"maxrange": 0,
"throwrange": 0,
"magical": false,
"blackenediron": false,
"silvered": false,
"equipped": false,
"damages": {
"primary": {
"damagetype": "",
"dice": "",
"bonus": ""
},
"secondary": {
"damagetype": "",
"dice": "",
"bonus": ""
},
"tertiary": {
"damagetype": "",
"dice": "",
"bonus": ""
}
},
"description": ""
},
"module": {

View File

@ -0,0 +1,6 @@
{{#if data.isGM}}
<h3>GM Notes : </h3>
<div class="form-group editor">
{{editor data.gmnotes target="system.gmnotes" button=true owner=owner editable=editable}}
</div>
{{/if}}

View File

@ -0,0 +1,51 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="item-sheet-img" src="{{img}}" data-edit="img" title="{{name}}"/>
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name"/></h1>
</div>
</header>
{{> systems/fvtt-avd12/templates/items/partial-item-nav.hbs}}
{{!-- Sheet Body --}}
<section class="sheet-body">
{{> systems/fvtt-avd12/templates/items/partial-item-description.hbs}}
<div class="tab details" data-group="primary" data-tab="details">
<div class="tab" data-group="primary">
<ul>
<li class="flexrow"><label class="item-field-label-long">Weapon type</label>
<select class="competence-base flexrow" type="text" name="system.weapontype" value="{{system.weapontype}}" data-dtype="String">
{{#select system.weapontype}}
{{> systems/fvtt-avd12/templates/items/partial-weapon-types.hbs}}
{{/select}}
</select>
</li>
<li class="flexrow"><label class="item-field-label-long">Weapon category</label>
<select class="competence-base flexrow" type="text" name="system.category" value="{{system.category}}" data-dtype="String">
{{#select system.category}}
{{> systems/fvtt-avd12/templates/items/partial-weapon-categories.hbs}}
{{/select}}
</select>
</li>
{{> systems/fvtt-avd12/templates/items/partial-common-item-fields.hbs}}
<li class="flexrow"><label class="item-field-label-long">Min Range</label>
<input type="text" class="right" name="system.minrange" value="{{system.minrange}}" data-dtype="Number"/>
</li>
<li class="flexrow"><label class="generic-label">Max Range</label>
<input type="text" class="right" name="item-field-label-long" value="{{system.maxrange}}" data-dtype="Number"/>
</li>
</ul>
</div>
</div>
</section>
</form>

View File

@ -1,84 +0,0 @@
<form class="{{cssClass}}" autocomplete="off">
<header class="sheet-header">
<img class="item-sheet-img" src="{{img}}" data-edit="img" title="{{name}}"/>
<div class="header-fields">
<h1 class="charname"><input name="name" type="text" value="{{name}}" placeholder="Name"/></h1>
</div>
</header>
{{> systems/fvtt-crucible-rpg/templates/partial-item-nav.html}}
{{!-- Sheet Body --}}
<section class="sheet-body">
{{> systems/fvtt-crucible-rpg/templates/partial-item-description.html}}
<div class="tab details" data-group="primary" data-tab="details">
<div class="tab" data-group="primary">
<ul>
<!-- <li class="flexrow"><label class="generic-label">Ability</label>
<select class="competence-base flexrow" type="text" name="data.ability" value="{{data.ability}}" data-dtype="String">
{{#select data.ability}}
{{> systems/fvtt-crucible-rpg/templates/partial-options-abilities.html}}
{{/select}}
</select>
</li> -->
<li class="flexrow"><label class="generic-label">Is proficient ?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="system.isproficient" {{checked data.isproficient}}/></label>
</li>
<li class="flexrow"><label class="generic-label">Associated skill</label>
<select class="competence-base flexrow" type="text" name="system.skill" value="{{data.skill}}" data-dtype="String">
{{#select data.skill}}
{{#each weaponSkills as |skill idx|}}
<option value="{{skill.name}}">{{skill.name}}</option>
{{/each}}
{{/select}}
</select>
</li>
<li class="flexrow"><label class="generic-label">Qualities (comma separated list)</label>
<input type="text" class="padd-right" name="system.qualities" value="{{data.qualities}}" data-dtype="String"/>
</li>
<li class="flexrow"><label class="generic-label">Flaws (comma separated list)</label>
<input type="text" class="padd-right" name="system.flaws" value="{{data.flaws}}" data-dtype="String"/>
</li>
<li class="flexrow"><label class="generic-label">Damage</label>
<input type="text" class="right" name="system.damage" value="{{data.damage}}" data-dtype="String"/>
</li>
<li class="flexrow"><label class="generic-label">Is ranged weapon ?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="system.isranged" {{checked data.isranged}}/></label>
</li>
{{#if data.isranged}}
<li class="flexrow"><label class="generic-label">Effective Range</label>
<input type="text" class="right" name="system.range" value="{{data.range}}" data-dtype="String"/>
</li>
<li class="flexrow"><label class="generic-label">Max range</label>
<input type="text" class="right" name="system.maxrange" value="{{data.maxrange}}" data-dtype="String"/>
</li>
{{/if}}
<li class="flexrow"><label class="generic-label">Minimum strength</label>
<input type="text" class="input-numeric-short padd-right" name="system.minstr" value="{{data.minstr}}" data-dtype="Number"/>
</li>
<li class="flexrow"><label class="generic-label">Equipped ?</label>
<label class="attribute-value checkbox"><input type="checkbox" name="system.equipped" {{checked data.equipped}}/></label>
</li>
<li class="flexrow"><label class="generic-label">Cost</label>
<input type="text" class="input-numeric-short padd-right" name="system.cost" value="{{data.cost}}" data-dtype="Number"/>
</li>
</ul>
</div>
</div>
</section>
</form>

View File

@ -0,0 +1,38 @@
<li class='flexrow'>
<label class='item-field-label-long'>
Focus Points Bonus
</label>
<input
type='text'
class='padd-right'
name='system.focuspointsbonus'
value="{{system.focuspointsbonus}}"
data-dtype='Number'
/>
</li>
<li class='flexrow'>
<label class='item-field-label-long'>
Focus Regen Bonus
</label>
<input
type='text'
class='padd-right'
name='system.focusregenbonus'
value="{{system.focusregenbonus}}"
data-dtype='Number'
/>
</li>
<li class='flexrow'>
<label class='item-field-label-long'>
Burn Chance Bonus
</label>
<input
type='text'
class='padd-right'
name='system.burnchancebonus'
value="{{system.burnchancebonus}}"
data-dtype='Number'
/>
</li>

View File

@ -0,0 +1,8 @@
<div class="tab description" data-group="primary" data-tab="description">
<div>
<label class="generic-label">Description</label>
<div class="medium-editor item-text-long-line">
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
</div>
</div>

View File

@ -0,0 +1,5 @@
{{!-- Sheet Tab Navigation --}}
<nav class="sheet-tabs tabs" data-group="primary">
<a class="item" data-tab="description">Description</a>
<a class="item" data-tab="details">Details</a>
</nav>

View File

@ -0,0 +1,4 @@
<option value="ranged">Ranged</option>
<option value="blunt">Blunt</option>
<option value="slash">Slash</option>
<option value="pierce">Pierce</option>

View File

@ -0,0 +1,4 @@
<option value="ranged">Ranged</option>
<option value="blunt">Blunt</option>
<option value="slash">Slash</option>
<option value="pierce">Pierce</option>