Add crafting skills

This commit is contained in:
LeRatierBretonnien 2023-01-24 20:26:59 +01:00
parent 108cda292e
commit 57dc0505cc
11 changed files with 118 additions and 5 deletions

View File

@ -16,6 +16,7 @@
"TypeReaction": "Reaction", "TypeReaction": "Reaction",
"TypeStance": "Stance", "TypeStance": "Stance",
"TypeTrait": "Trait", "TypeTrait": "Trait",
"TypeCondition": "Condition" "TypeCondition": "Condition",
"TypeCraftingskill": "Crafting Skill"
} }
} }

View File

@ -45,6 +45,7 @@ export class Avd12ActorSheet extends ActorSheet {
equippedWeapons: this.actor.checkAndPrepareEquipments(duplicate(this.actor.getEquippedWeapons()) ), equippedWeapons: this.actor.checkAndPrepareEquipments(duplicate(this.actor.getEquippedWeapons()) ),
equippedArmor: this.actor.getEquippedArmor(), equippedArmor: this.actor.getEquippedArmor(),
equippedShield: this.actor.getEquippedShield(), equippedShield: this.actor.getEquippedShield(),
craftingSkills: this.actor.getCraftingSkills(),
subActors: duplicate(this.actor.getSubActors()), subActors: duplicate(this.actor.getSubActors()),
moneys: duplicate(this.actor.getMoneys()), moneys: duplicate(this.actor.getMoneys()),
focusData: this.actor.computeFinalFocusData(), focusData: this.actor.computeFinalFocusData(),
@ -129,6 +130,11 @@ export class Avd12ActorSheet extends ActorSheet {
const li = $(event.currentTarget).parents(".item"); const li = $(event.currentTarget).parents(".item");
this.actor.rollSpell( li.data("item-id") ) this.actor.rollSpell( li.data("item-id") )
}); });
html.find('.roll-crafting').click((event) => {
const li = $(event.currentTarget).parents(".item");
this.actor.rollCrafting( li.data("item-id") )
});
html.find('.roll-weapon').click((event) => { html.find('.roll-weapon').click((event) => {
const li = $(event.currentTarget).parents(".item"); const li = $(event.currentTarget).parents(".item");

View File

@ -176,7 +176,12 @@ export class Avd12Actor extends Actor {
Avd12Utility.sortArrayObjectsByName(comp) Avd12Utility.sortArrayObjectsByName(comp)
return comp; return comp;
} }
/* -------------------------------------------- */
getCraftingSkills() {
let comp = duplicate(this.items.filter(item => item.type == 'craftingskill') || [])
Avd12Utility.sortArrayObjectsByName(comp)
return comp;
}
/* -------------------------------------------- */ /* -------------------------------------------- */
getArmors() { getArmors() {
let comp = duplicate(this.items.filter(item => item.type == 'armor') || []); let comp = duplicate(this.items.filter(item => item.type == 'armor') || []);
@ -705,7 +710,20 @@ export class Avd12Actor extends Actor {
console.log("New fovcus", this.system, focusData) console.log("New fovcus", this.system, focusData)
this.update({ 'system.focus': focusData }) this.update({ 'system.focus': focusData })
} }
/* -------------------------------------------- */
rollCrafting(craftId) {
let crafting = this.items.get(craftId)
if (crafting) {
crafting = duplicate(crafting)
let rollData = this.getCommonRollData()
rollData.mode = "crafting"
rollData.crafting = crafting
rollData.img = crafting.img
this.startRoll(rollData)
} else {
ui.notifications.warn("Unable to find the relevant weapon ")
}
}
/* -------------------------------------------- */ /* -------------------------------------------- */
rollWeapon(weaponId) { rollWeapon(weaponId) {
let weapon = this.items.get(weaponId) let weapon = this.items.get(weaponId)
@ -722,6 +740,7 @@ export class Avd12Actor extends Actor {
ui.notifications.warn("Unable to find the relevant weapon ") ui.notifications.warn("Unable to find the relevant weapon ")
} }
} }
/* -------------------------------------------- */ /* -------------------------------------------- */
async rollWeaponDamage(weaponId, damageType) { async rollWeaponDamage(weaponId, damageType) {
let weapon = this.items.get(weaponId) let weapon = this.items.get(weaponId)

View File

@ -9,6 +9,7 @@ export const defaultItemImg = {
module: "systems/fvtt-avd12/images/icons/focus2.webp", module: "systems/fvtt-avd12/images/icons/focus2.webp",
money: "systems/fvtt-avd12/images/icons/focus2.webp", money: "systems/fvtt-avd12/images/icons/focus2.webp",
spell: "systems/fvtt-avd12/images/icons/spell1.webp", spell: "systems/fvtt-avd12/images/icons/spell1.webp",
craftingskill: "systems/fvtt-avd12/images/icons/cloak2.webp",
} }
/** /**

View File

@ -528,6 +528,9 @@ export class Avd12Utility {
if (rollData.skill) { if (rollData.skill) {
diceFormula += "+" + rollData.skill.finalvalue diceFormula += "+" + rollData.skill.finalvalue
} }
if (rollData.crafting) {
diceFormula += "+" + rollData.crafting.system.level
}
if (rollData.spellAttack) { if (rollData.spellAttack) {
diceFormula += "+" + rollData.spellAttack diceFormula += "+" + rollData.spellAttack
} }

View File

@ -64,7 +64,7 @@
], ],
"title": "AnyVenture D12 RPG", "title": "AnyVenture D12 RPG",
"url": "https://www.uberwald.me/gitea/public/fvtt-avd12", "url": "https://www.uberwald.me/gitea/public/fvtt-avd12",
"version": "10.0.22", "version": "10.0.23",
"download": "https://www.uberwald.me/gitea/public/fvtt-avd12/archive/fvtt-avd12-v10.0.22.zip", "download": "https://www.uberwald.me/gitea/public/fvtt-avd12/archive/fvtt-avd12-v10.0.23.zip",
"background": "systems/fvtt-avd12/images/ui/avd12_welcome_page.webp" "background": "systems/fvtt-avd12/images/ui/avd12_welcome_page.webp"
} }

View File

@ -356,6 +356,7 @@
"weapon", "weapon",
"module", "module",
"money", "money",
"craftingskill",
"condition", "condition",
"action", "action",
"freeaction", "freeaction",
@ -417,6 +418,10 @@
"movespeed": 0 "movespeed": 0
} }
}, },
"craftingskill" : {
"level": 0,
"description": ""
},
"action": { "action": {
"description": "" "description": ""
}, },

View File

@ -493,6 +493,39 @@
</div> </div>
{{!-- Equipement Tab --}}
<div class="tab crafting" data-group="primary" data-tab="crafting">
<ul class="item-list alternate-list">
<li class="item flexrow list-item items-title-bg">
<span class="item-name-label-header">
<h3><label class="items-title-text">Crafting</label></h3>
</span>
<span class="item-field-label-short">
<label class="short-label">Level</label>
</span>
<div class="item-controls item-controls-fixed">
<a class="item-control item-add" data-type="weapon" title="Create Item"><i class="fas fa-plus"></i></a>
</div>
</li>
{{#each craftingSkills as |crafting key|}}
<li class="item flexrow list-item list-item-shadow" data-item-id="{{crafting._id}}">
<a class="item-edit item-name-img" title="Edit Item"><img class="sheet-competence-img"
src="{{crafting.img}}" /></a>
<span class="item-name-label"> <a class="roll-crafting"><i class="fa-solid fa-dice-d12"> </i>{{crafting.name}}</a></span>
<span class="item-field-label-short"><label>{{crafting.system.level}}</label></span>
<div class="item-filler">&nbsp;</div>
<div class="item-controls item-controls-fixed">
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</div>
{{!-- Biography Tab --}} {{!-- Biography Tab --}}
<div class="tab biodata" data-group="primary" data-tab="biodata"> <div class="tab biodata" data-group="primary" data-tab="biodata">
<div class="grid grid-2col"> <div class="grid grid-2col">

View File

@ -23,6 +23,11 @@
</li> </li>
{{/if}} {{/if}}
{{#if crafting}}
<li>Crafting : {{crafting.name}} ({{crafting.system.level}})
</li>
{{/if}}
{{#if spell}} {{#if spell}}
<li>Spell : {{spell.name}} ({{spell.system.level}}) <li>Spell : {{spell.name}} ({{spell.system.level}})
</li> </li>
@ -30,6 +35,7 @@
</li> </li>
{{/if}} {{/if}}
<li>Bonus/Malus {{bonusMalusRoll}} </li>
<li>Dice Formula {{diceFormula}} </li> <li>Dice Formula {{diceFormula}} </li>
<li>Result {{roll.total}} </li> <li>Result {{roll.total}} </li>

View File

@ -15,6 +15,13 @@
</div> </div>
{{/if}} {{/if}}
{{#if crafting}}
<div class="flexrow">
<span class="roll-dialog-label">Crafting : </span>
<span class="roll-dialog-label">{{crafting.name}} ({{crafting.system.level}})</span>
</div>
{{/if}}
{{#if weapon}} {{#if weapon}}
<div class="flexrow"> <div class="flexrow">
<span class="roll-dialog-label">Weapon Attack Bonus : </span> <span class="roll-dialog-label">Weapon Attack Bonus : </span>

View File

@ -0,0 +1,32 @@
<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">Level</label>
<input type="text" class="item-field-label-short" name="system.level" value="{{system.level}}" data-dtype="Number"/>
</li>
</ul>
</div>
</div>
</section>
</form>