WIP for vehicle sheets

This commit is contained in:
sladecraven 2022-09-09 08:33:28 +02:00
parent ecf5a38eb0
commit f3ab75fa6b
6 changed files with 50 additions and 85 deletions

View File

@ -660,7 +660,7 @@ export class PegasusActor extends Actor {
return false return false
} }
} }
if (item.type == "power" && item.system.purchasedtext.length > 0 ) { if (item.type == "power" && item.system.purchasedtext.length > 0) {
ChatMessage.create({ content: `Power ${item.name} puchased : ${item.system.purchasedtext}` }) ChatMessage.create({ content: `Power ${item.name} puchased : ${item.system.purchasedtext}` })
} }
let dropID = $(event.target).parents(".item").attr("data-item-id") // Only relevant if container drop let dropID = $(event.target).parents(".item").attr("data-item-id") // Only relevant if container drop
@ -749,7 +749,7 @@ export class PegasusActor extends Actor {
if (spec) { if (spec) {
let powers = [] let powers = []
for (let power of spec.system.powers) { for (let power of spec.system.powers) {
if ( power.data ) { if (power.data) {
power.system = power.data power.system = power.data
} }
power.system.specId = specId power.system.specId = specId
@ -1730,4 +1730,34 @@ export class PegasusActor extends Actor {
ui.notifications.warn("Power not found !", powerId); ui.notifications.warn("Power not found !", powerId);
} }
} }
/* -------------------------------------------- */
/* VEHICLE STUFF */
manageCurrentSpeed(speed) {
if (speed == "fullstop") {
this.update({ 'system.secondary.moverange': "nomovement" })
}
if (speed == "crawling") {
this.update({ 'system.secondary.moverange': "threatzone" })
}
if (speed == "slow") {
this.update({ 'system.secondary.moverange': "close" })
}
if (speed == "average") {
this.update({ 'system.secondary.moverange': "medium" })
}
if (speed == "fast") {
this.update({ 'system.secondary.moverange': "long" })
}
if (speed == "extfast") {
this.update({ 'system.secondary.moverange': "extreme" })
}
}
/* -------------------------------------------- */
modifyVehicleStun(incDec) {
let stun = this.system.stun.value + incDec
this.update({ 'stun.value': stun })
}
} }

View File

@ -113,15 +113,9 @@ export class PegasusVehicleSheet extends ActorSheet {
this.actor.createEmbeddedDocuments('Item', [{ name: "NewItem", type: dataType }], { renderSheet: true }) this.actor.createEmbeddedDocuments('Item', [{ name: "NewItem", type: dataType }], { renderSheet: true })
}) })
html.find('.spec-group-activate').click(ev => { html.find('.current-speed-change').click(ev => {
const li = $(ev.currentTarget).parents(".item"); let speed = ev.currentTarget.value
let itemId = li.data("item-id"); this.actor.manageCurrentSpeed(speed)
this.actor.specPowerActivate( itemId)
});
html.find('.spec-group-deactivate').click(ev => {
const li = $(ev.currentTarget).parents(".item");
let itemId = li.data("item-id");
this.actor.specPowerDeactivate( itemId)
}); });
html.find('.equip-activate').click(ev => { html.find('.equip-activate').click(ev => {
@ -141,32 +135,6 @@ export class PegasusVehicleSheet extends ActorSheet {
this.actor.perkEffectUsed( itemId) this.actor.perkEffectUsed( itemId)
}); });
html.find('.perk-status').change(ev => {
const li = $(ev.currentTarget).parents(".item");
let itemId = li.data("item-id");
this.actor.updatePerkStatus( itemId, ev.currentTarget.value)
this.render()
});
html.find('.power-cost-spent').change(ev => {
const li = $(ev.currentTarget).parents(".item");
let itemId = li.data("item-id");
this.actor.updatePowerSpentCost( itemId, ev.currentTarget.value)
});
html.find('.power-dmg-roll').click(ev => {
const li = $(ev.currentTarget).parents(".item")
let itemId = li.data("item-id")
this.actor.powerDmgRoll( itemId )
})
html.find('.perk-used').change(ev => {
const li = $(ev.currentTarget).parents(".item")
let itemId = li.data("item-id")
let index = Number($(ev.currentTarget).data("use-index") )
this.actor.updatePerkUsed( itemId, index, ev.currentTarget.checked )
});
html.find('.subactor-edit').click(ev => { html.find('.subactor-edit').click(ev => {
const li = $(ev.currentTarget).parents(".item"); const li = $(ev.currentTarget).parents(".item");
let actorId = li.data("actor-id"); let actorId = li.data("actor-id");
@ -204,11 +172,11 @@ export class PegasusVehicleSheet extends ActorSheet {
this.actor.incDecAmmo( li.data("item-id"), +1 ) this.actor.incDecAmmo( li.data("item-id"), +1 )
} ); } );
html.find('.stun-minus').click(event => { html.find('.vehicle-stun-minus').click(event => {
this.actor.modifyStun( -1 ) this.actor.modifyVehicleStun( -1 )
} ) } )
html.find('.stun-plus').click(event => { html.find('.vehicle-stun-plus').click(event => {
this.actor.modifyStun( 1 ) this.actor.modifyVehicleStun( 1 )
} ) } )
@ -257,16 +225,6 @@ export class PegasusVehicleSheet extends ActorSheet {
this.rollIDR( li.data("item-id"), diceValue) this.rollIDR( li.data("item-id"), diceValue)
}) })
html.find('.roll-spec').click((event) => {
const li = $(event.currentTarget).parents(".item");
const specId = li.data("item-id");
this.actor.rollSpec(specId);
});
html.find('.power-roll').click((event) => {
const li = $(event.currentTarget).parents(".item");
const powerId = li.data("item-id");
this.actor.rollPower(powerId);
});
html.find('.weapon-roll').click((event) => { html.find('.weapon-roll').click((event) => {
const li = $(event.currentTarget).parents(".item"); const li = $(event.currentTarget).parents(".item");
const weaponId = li.data("item-id"); const weaponId = li.data("item-id");
@ -304,35 +262,12 @@ export class PegasusVehicleSheet extends ActorSheet {
this.actor.equipItem( li.data("item-id") ); this.actor.equipItem( li.data("item-id") );
this.render(true); this.render(true);
}); });
html.find('.power-activate').click(ev => {
const li = $(ev.currentTarget).parents(".item");
this.actor.activatePower( li.data("item-id") );
this.render(true);
});
html.find('.vice-virtue-activate').click(ev => {
const li = $(ev.currentTarget).parents(".item")
this.actor.activateViceOrVirtue( li.data("item-id") )
this.render(true);
})
html.find('.change-worstfear').change(ev => {
this.actor.manageWorstFear( ev.currentTarget.checked )
});
html.find('.change-desires').change(ev => {
this.actor.manageDesires( ev.currentTarget.checked )
});
html.find('.update-field').change(ev => { html.find('.update-field').change(ev => {
const fieldName = $(ev.currentTarget).data("field-name"); const fieldName = $(ev.currentTarget).data("field-name");
let value = Number(ev.currentTarget.value); let value = Number(ev.currentTarget.value);
this.actor.update( { [`${fieldName}`]: value } ); this.actor.update( { [`${fieldName}`]: value } );
}); });
html.find('.perk-active').click(ev => {
const li = $(ev.currentTarget).parents(".item");
this.actor.activatePerk( li.data("item-id") );
this.render(true);
});
} }
/* -------------------------------------------- */ /* -------------------------------------------- */

View File

@ -1,6 +1,6 @@
{ {
"description": "Pegasus RPG system for FoundryVTT", "description": "Pegasus RPG system for FoundryVTT",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.5.zip", "download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.6.zip",
"esmodules": [ "esmodules": [
"modules/pegasus-main.js" "modules/pegasus-main.js"
], ],
@ -254,6 +254,6 @@
], ],
"title": "Pegasus RPG", "title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg", "url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "10.0.5", "version": "10.0.6",
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp" "background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
} }

View File

@ -1,4 +1,4 @@
<option value="none">None</option> <option value="fullstop">Full stop</option>
<option value="crawling">Crawling</option> <option value="crawling">Crawling</option>
<option value="slow">Slow</option> <option value="slow">Slow</option>
<option value="average">Average</option> <option value="average">Average</option>

View File

@ -36,7 +36,7 @@
</div> </div>
{{/if}} {{/if}}
{{#if (eq key "size")}} {{#if (eq key "hr")}}
<div class="flexrow stat-text-white"> <div class="flexrow stat-text-white">
<span class="stat-label stat-margin" name="{{key}}">Size</span> <span class="stat-label stat-margin" name="{{key}}">Size</span>
<input type="text" class="input-numeric-short" name="system.statistics.{{key}}.size" value="{{stat.size}}" data-dtype="Number" /> <input type="text" class="input-numeric-short" name="system.statistics.{{key}}.size" value="{{stat.size}}" data-dtype="Number" />
@ -63,7 +63,7 @@
{{/select}} {{/select}}
</select> </select>
<span class="stat-label stat-margin" name="{{key}}">Curr. speed</span> <span class="stat-label stat-margin" name="{{key}}">Curr. speed</span>
<select class="status-small-label color-class-common" type="text" name="system.statistics.{{key}}.currentspeed" <select class="status-small-label color-class-common current-speed-change" type="text" name="system.statistics.{{key}}.currentspeed"
value="{{stat.currentspeed}}" data-dtype="String" {{#unless @root.editScore}}disabled{{/unless}}> value="{{stat.currentspeed}}" data-dtype="String" {{#unless @root.editScore}}disabled{{/unless}}>
{{#select stat.currentspeed}} {{#select stat.currentspeed}}
{{> systems/fvtt-pegasus-rpg/templates/partial-options-vehicle-speed.html}} {{> systems/fvtt-pegasus-rpg/templates/partial-options-vehicle-speed.html}}

View File

@ -124,8 +124,8 @@
<span class="flexrow"> <span class="flexrow">
<h3>Stun</h3> <h3>Stun</h3>
<span class="status-small-label no-grow"> <span class="status-small-label no-grow">
<a class="stun-plus plus-minus-button">+</a> <a class="vehicle-stun-plus plus-minus-button">+</a>
<a class="stun-minus plus-minus-button">&nbsp;-</a> <a class="vehicle-stun-minus plus-minus-button">&nbsp;-</a>
</span> </span>
</span> </span>
<ul class="stat-list alternate-list"> <ul class="stat-list alternate-list">