Compare commits

...

9 Commits

Author SHA1 Message Date
27029abc88 #Fix 78 : add role level 2022-09-29 20:04:55 +02:00
d8f8b7198c #Fix 78 : add role level 2022-09-29 20:04:27 +02:00
908cf4206a #Fix 78 : add role level 2022-09-29 14:14:48 +02:00
e531b636bc #Fix 78 : add role level 2022-09-29 14:12:16 +02:00
4065d46ffd #Fix 78 : add role level 2022-09-29 13:14:34 +02:00
1bb869e715 Release 10.0.23 2022-09-29 13:11:07 +02:00
c8cc9d6c82 Fix #75 Token drag&drop 2022-09-29 13:10:41 +02:00
cfcc9ca557 Fix #75 Token drag&drop 2022-09-29 13:07:57 +02:00
a5e17b8276 Fix #71 : Display perk text 2022-09-29 10:59:47 +02:00
10 changed files with 156 additions and 110 deletions

View File

@ -8,9 +8,11 @@ import { PegasusRollDialog } from "./pegasus-roll-dialog.js";
const __level2Dice = ["d0", "d4", "d6", "d8", "d10", "d12"]
const __name2DiceValue = { "0": 0, "d0": 0, "d4": 4, "d6": 6, "d8": 8, "d10": 10, "d12": 12 }
const __dice2Level = { "d0": 0, "d4": 1, "d6": 2, "d8": 3, "d10": 4, "d12": 5 }
const __rangeKeyToText = { notapplicable: "N/A", touch: "Self Only", touchself: "Touch/Self", tz: "Threat Zone", close: "Close", medium: "Medium",
long: "Long", extreme: "Extreme", sight: "Lineof Sight", tz_close: "TZ/Close", close_medium: "Close/Medium", medium_long: "Medium/Long",
long_extreme: "Long/Extreme"}
const __rangeKeyToText = {
notapplicable: "N/A", touch: "Self Only", touchself: "Touch/Self", tz: "Threat Zone", close: "Close", medium: "Medium",
long: "Long", extreme: "Extreme", sight: "Lineof Sight", tz_close: "TZ/Close", close_medium: "Close/Medium", medium_long: "Medium/Long",
long_extreme: "Long/Extreme"
}
/* -------------------------------------------- */
export class PegasusUtility {
@ -68,7 +70,7 @@ export class PegasusUtility {
Handlebars.registerHelper('getDice', function (a) {
return PegasusUtility.getDiceFromLevel(a)
})
}
/* -------------------------------------------- */
@ -112,7 +114,7 @@ export class PegasusUtility {
}
/* -------------------------------------------- */
static getRangeText( rangeKey) {
static getRangeText(rangeKey) {
return __rangeKeyToText[rangeKey] || "N/A"
}
@ -145,10 +147,10 @@ export class PegasusUtility {
let newDicePool = rollData.dicePool.filter(dice => dice.name != "effect-bonus-dice")
for (let effect of rollData.effectsList) {
if (effect && effect.applied && effect.type == "effect" && effect.effect && effect.effect.system.bonusdice) {
newDicePool = newDicePool.concat( this.buildDicePool("effect-bonus-dice", effect.effect.system.effectlevel, 0, effect.effect.name ))
newDicePool = newDicePool.concat(this.buildDicePool("effect-bonus-dice", effect.effect.system.effectlevel, 0, effect.effect.name))
}
if (effect && effect.applied && effect.type == "effect" && effect.value && effect.isdynamic) {
newDicePool = newDicePool.concat( this.buildDicePool("effect-bonus-dice", effect.value, 0, effect.name ))
newDicePool = newDicePool.concat(this.buildDicePool("effect-bonus-dice", effect.value, 0, effect.name))
}
}
rollData.dicePool = newDicePool
@ -159,7 +161,7 @@ export class PegasusUtility {
let newDicePool = rollData.dicePool.filter(dice => dice.name != "effect-hindrance")
for (let hindrance of rollData.effectsList) {
if (hindrance && hindrance.applied && (hindrance.type == "hindrance" || (hindrance.type == "effect" && hindrance.effect?.system?.hindrance))) {
newDicePool = newDicePool.concat( this.buildDicePool("effect-hindrance", (hindrance.value) ? hindrance.value : hindrance.effect.system.effectlevel, 0, hindrance.name ))
newDicePool = newDicePool.concat(this.buildDicePool("effect-hindrance", (hindrance.value) ? hindrance.value : hindrance.effect.system.effectlevel, 0, hindrance.name))
}
}
rollData.dicePool = newDicePool
@ -170,13 +172,13 @@ export class PegasusUtility {
let newDicePool = rollData.dicePool.filter(dice => dice.name != "armor-shield")
for (let armor of rollData.armorsList) {
if (armor.applied) {
newDicePool = newDicePool.concat( this.buildDicePool("armor-shield", armor.value, 0))
newDicePool = newDicePool.concat(this.buildDicePool("armor-shield", armor.value, 0))
}
}
newDicePool = rollData.dicePool.filter(dice => dice.name != "vehicle-shield")
for (let shield of rollData.vehicleShieldList) {
if (shield.applied) {
newDicePool = newDicePool.concat( this.buildDicePool("vehicle-shield", shield.value, 0))
newDicePool = newDicePool.concat(this.buildDicePool("vehicle-shield", shield.value, 0))
}
}
rollData.dicePool = newDicePool
@ -189,17 +191,17 @@ export class PegasusUtility {
let newDicePool = rollData.dicePool.filter(dice => dice.name != "damage")
for (let weapon of rollData.weaponsList) {
if (weapon.applied && weapon.type == "damage") {
newDicePool = newDicePool.concat( this.buildDicePool("damage", weapon.value, 0))
newDicePool = newDicePool.concat(this.buildDicePool("damage", weapon.value, 0))
}
}
for (let weapon of rollData.vehicleWeapons) {
if (weapon.applied) {
newDicePool = newDicePool.concat( this.buildDicePool("damage", weapon.value, 0))
newDicePool = newDicePool.concat(this.buildDicePool("damage", weapon.value, 0))
}
}
rollData.dicePool = newDicePool
}
}
}
/* -------------------------------------------- */
@ -207,13 +209,13 @@ export class PegasusUtility {
let newDicePool = rollData.dicePool.filter(dice => dice.name != "stat")
let statDice = rollData.dicePool.find(dice => dice.name == "stat")
if (statDice.level > 0) {
newDicePool = newDicePool.concat( this.buildDicePool( "stat", rollData.statDicesLevel, statDice.mod))
newDicePool = newDicePool.concat(this.buildDicePool("stat", rollData.statDicesLevel, statDice.mod))
}
if (rollData.vehicleStat) {
newDicePool = rollData.dicePool.filter(dice => dice.name != "vehiclestat")
if (rollData.vehicleStat.currentlevel > 0 ) {
newDicePool = newDicePool.concat( this.buildDicePool( "vehiclestat", rollData.vehicleStat.currentlevel, 0))
if (rollData.vehicleStat.currentlevel > 0) {
newDicePool = newDicePool.concat(this.buildDicePool("vehiclestat", rollData.vehicleStat.currentlevel, 0))
}
rollData.dicePool = newDicePool
}
@ -223,7 +225,7 @@ export class PegasusUtility {
static updateSpecDicePool(rollData) {
let newDicePool = rollData.dicePool.filter(dice => dice.name != "spec")
if (rollData.specDicesLevel > 0) {
newDicePool = newDicePool.concat( this.buildDicePool( "spec", rollData.specDicesLevel, 0))
newDicePool = newDicePool.concat(this.buildDicePool("spec", rollData.specDicesLevel, 0))
}
rollData.dicePool = newDicePool
}
@ -271,6 +273,7 @@ export class PegasusUtility {
/* -------------------------------------------- */
static async addItemDropToActor(actor, item) {
console.log("ITEM DROPPED", actor, item)
actor.preprocessItem("none", item, false)
let chatData = {
user: game.user.id,
@ -294,11 +297,16 @@ export class PegasusUtility {
for (let token of tokensList) {
if (x >= token.x && x <= (token.x + token.width)
&& y >= token.y && y <= (token.y + token.height)) {
let item = await this.searchItem(data)
const item = fromUuidSync(data.uuid)
if (item == undefined) {
item = this.actor.items.get(data.uuid)
}
let itemFull = await PegasusUtility.searchItem(item)
//console.log("DROPPED DATA", data.uuid)
if (game.user.isGM || token.actor.isOwner) {
this.addItemDropToActor(token.actor, item)
this.addItemDropToActor(token.actor, itemFull)
} else {
game.socket.emit("system.fvtt-pegasus-rpg", { name: "msg_gm_item_drop", data: { actorId: token.actor.id, itemId: item.id, isPack: item.pack } })
game.socket.emit("system.fvtt-pegasus-rpg", { name: "msg_gm_item_drop", data: { actorId: token.actor.id, itemId: itemFull.id, isPack: item.pack } })
}
return
}
@ -567,6 +575,21 @@ export class PegasusUtility {
return undefined;
}
/* -------------------------------------------- */
static computeDistance() {
let mytarget = game.user.targets.first()
console.log("target", mytarget, mytarget)
let mytoken = _token
if (mytarget) {
let dist = canvas.grid.measureDistances(
[{ ray: new Ray(mytoken.center, mytarget.center) }],
{ gridSpaces: true });
console.log("DIST", dist)
} else {
console.log("NO TARGET")
}
}
/* -------------------------------------------- */
static getDefenseState(actorId) {
return this.defenderStore[actorId];
@ -912,7 +935,7 @@ export class PegasusUtility {
let item
if (dataItem.pack) {
let id = dataItem.id || dataItem._id
let items = await this.loadCompendium( dataItem.pack, item => item.id == id)
let items = await this.loadCompendium(dataItem.pack, item => item.id == id)
//console.log(">>>>>> PACK", items)
item = items[0] || undefined
//item = await fromUuid(dataItem.pack + "." + id)

View File

@ -293,6 +293,12 @@ table {border: 1px solid #7a7971;}
padding: 0 3px;
}
.long-editor{
border: 2;
height: 400px;
padding: 0 3px;
}
.medium-editor {
border: 2;
height: 240px;

View File

@ -253,7 +253,7 @@
],
"title": "Pegasus RPG",
"url": "https://www.uberwald.me/data/files/fvtt-pegasus-rpg",
"version": "10.0.22",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.22.zip",
"version": "10.0.26",
"download": "https://www.uberwald.me/gitea/uberwald/fvtt-pegasus-rpg/archive/fvtt-pegasus-rpg-v10.0.26.zip",
"background": "systems/fvtt-pegasus-rpg/images/ui/pegasus_welcome_page.webp"
}

View File

@ -443,7 +443,8 @@
"specincrease": [],
"perks": [],
"perksrole": "",
"description": ""
"description": "",
"rolelevel": 1
},
"ability": {
"affectedstat": "str",

View File

@ -5,8 +5,8 @@
{{/if}}
<div>{{name}} has just activated the Perk: {{perk.name}}.</div>
{{#if (count perk.data.activatedtext)}}
<div>{{perk.data.activatedtext}}</div>
{{#if (count perk.system.activatedtext)}}
<div>{{perk.system.activatedtext}}</div>
{{/if}}
</div>

View File

@ -5,8 +5,8 @@
{{/if}}
<div>{{name}} has just deactivated the Perk: {{perk.name}}, make sure to manually delete all Effects provided by this Perk from Targets.</div>
{{#if (count perk.data.deactivatedtext)}}
<div>{{perk.data.deactivatedtext}}</div>
{{#if (count perk.system.deactivatedtext)}}
<div>{{perk.system.deactivatedtext}}</div>
{{/if}}
</div>

View File

@ -13,16 +13,20 @@
<div class="tab description" data-group="primary" data-tab="description">
<div class="medium-editor item-text-long-line">
<label class="generic-label">Power Ups</label>
<label class="generic-label"><strong>Power Ups</strong></label>
{{editor purchasedeffects target="system.purchasedeffects" button=true owner=owner
editable=editable}}
</div>
<div class="medium-editor item-text-long-line">
<label class="generic-label">Description</label>
<span><label>&nbsp;</label></span>
<hr>
<div class="long-editor item-text-long-line">
<label class="generic-label"><strong>Description</strong></label>
{{editor description target="system.description" button=true owner=owner editable=editable}}
</div>
<span><label>&nbsp;</label></span>
<hr>
<div class="medium-editor item-text-long-line">
<label class="generic-label">Available Upgrades</label>
<label class="generic-label"><strong>Available Upgrades</strong></label>
{{editor effects target="system.effects" button=true owner=owner editable=editable}}
</div>
</div>

View File

@ -1,80 +1,92 @@
<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-pegasus-rpg/templates/partial-item-nav.html}}
<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-pegasus-rpg/templates/partial-item-nav.html}}
{{!-- Sheet Body --}}
<section class="sheet-body">
{{!-- Sheet Body --}}
<section class="sheet-body">
{{> systems/fvtt-pegasus-rpg/templates/partial-item-description.html}}
{{> systems/fvtt-pegasus-rpg/templates/partial-item-description.html}}
<div class="tab details" data-group="primary" data-tab="details">
<ul>
<li class="flexrow"><label class="generic-label">Stat increase 1</label>
<select class="competence-base flexrow" type="text" name="system.statincrease1" value="{{data.statincrease1}}" data-dtype="String">
{{#select data.statincrease1}}
{{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=false mr=false}}
{{/select}}
</select>
</li>
<li class="flexrow"><label class="generic-label">Stat increase 2</label>
<select class="competence-base flexrow" type="text" name="system.statincrease2" value="{{data.statincrease2}}" data-dtype="String">
{{#select data.statincrease2}}
{{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=false mr=false}}
{{/select}}
</select>
</li>
<div class="tab details" data-group="primary" data-tab="details">
<ul>
<li class="flexrow"><label class="generic-label">Role Level</label>
<input type="text" class="input-numeric-short padd-right" name="system.rolelevel" value="{{data.rolelevel}}"
data-dtype="Number" />
</li>
<li class="flexrow">
<label class="generic-label">Role Ability</label>
</li>
<ul class="ul-level1">
<li class="flexrow"><div class="drop-specialability"><label>Drop Abilities here !</label></div>
</li>
{{#each data.specialability as |ability idx|}}
<li class="flexrow">
<label name="system.specialability[{{idx}}].name"><a class="view-subitem" data-type="specialability" data-index="{{idx}}">{{ability.name}}</a></label>
<div class="item-controls padd-left">
<a class="item-control delete-subitem padd-left" data-type="specialability" data-index="{{idx}}" title="Delete Ability"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
<li class="flexrow"><label class="generic-label">Stat increase 1</label>
<select class="competence-base flexrow" type="text" name="system.statincrease1" value="{{data.statincrease1}}"
data-dtype="String">
{{#select data.statincrease1}}
{{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=false mr=false}}
{{/select}}
</select>
</li>
<li class="flexrow"><label class="generic-label">Stat increase 2</label>
<select class="competence-base flexrow" type="text" name="system.statincrease2" value="{{data.statincrease2}}"
data-dtype="String">
{{#select data.statincrease2}}
{{> systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html notapplicable=false mr=false}}
{{/select}}
</select>
</li>
<li class="flexrow">
<label class="generic-label">Role Ability</label>
</li>
<ul class="ul-level1">
<li class="flexrow">
<div class="drop-specialability"><label>Drop Abilities here !</label></div>
</li>
<li class="flexrow"><label class="generic-label">Statistic increase (Choose 2 at +1 DT)</label>
</li>
<ul class="ul-level1">
<li class="flexrow">
{{#each data.statincreasechoice as |stat idx|}}
<label name="statchoice{{idx}}">{{stat.name}}</label>
<label class="attribute-value checkbox"><input type="checkbox" class="stat-choice-flag" data-stat-idx="{{idx}}" {{checked stat.flag}}/></label>
{{/each}}
</li>
</ul>
</li>
{{#each data.specialability as |ability idx|}}
<li class="flexrow">
<label name="system.specialability[{{idx}}].name"><a class="view-subitem" data-type="specialability"
data-index="{{idx}}">{{ability.name}}</a></label>
<div class="item-controls padd-left">
<a class="item-control delete-subitem padd-left" data-type="specialability" data-index="{{idx}}"
title="Delete Ability"><i class="fas fa-trash"></i></a>
</div>
</li>
{{/each}}
</ul>
</li>
<li class="flexrow"><label class="generic-label">Statistic increase (Choose 2 at +1 DT)</label>
</li>
<ul class="ul-level1">
<li class="flexrow">
{{#each data.statincreasechoice as |stat idx|}}
<label name="statchoice{{idx}}">{{stat.name}}</label>
<label class="attribute-value checkbox"><input type="checkbox" class="stat-choice-flag"
data-stat-idx="{{idx}}" {{checked stat.flag}} /></label>
{{/each}}
</li>
</ul>
</li>
<li class="flexrow"><label class="generic-label">Role category for available perks</label>
<select class="competence-base flexrow" type="text" name="system.perksrole" value="{{data.perksrole}}" data-dtype="String">
{{#select data.perksrole}}
<option value="agitator">Agitator</option>
<option value="defender">Defender</option>
<option value="enhancer">Enhancer</option>
<option value="scrapper">Scrapper</option>
<option value="ranged">Ranged</option>
<option value="tactician">Tactician</option>
{{/select}}
</select>
</li>
<li class="flexrow"><label class="generic-label">Role category for available perks</label>
<select class="competence-base flexrow" type="text" name="system.perksrole" value="{{data.perksrole}}"
data-dtype="String">
{{#select data.perksrole}}
<option value="agitator">Agitator</option>
<option value="defender">Defender</option>
<option value="enhancer">Enhancer</option>
<option value="scrapper">Scrapper</option>
<option value="ranged">Ranged</option>
<option value="tactician">Tactician</option>
{{/select}}
</select>
</li>
</ul>
</ul>
</div>
</div>
</section>
</form>
</section>
</form>

View File

@ -47,7 +47,7 @@
<li class="item flexrow list-item" data-item-id="{{trait.id}}">
<img class="sheet-competence-img" src="{{trait.img}}"/>
<span class="competence-label">{{trait.name}}</span>
<span class="competence-label">{{trait.data.data.type}}</span>
<span class="competence-label">{{trait.system.type}}</span>
<div class="item-controls">
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
@ -103,17 +103,17 @@
<img class="sheet-competence-img" src="{{weapon.img}}"/>
<span class="stat-label">{{weapon.name}}</span>
<div class="item-controls">
<a class="item-control item-equip" title="Worn">{{#if weapon.data.data.equipped}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-equip" title="Worn">{{#if weapon.system.equipped}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>
</li>
<li class="item stat flexrow list-item stats-table" data-armure-id="{{weapon.id}}" data-item-id="{{weapon.id}}">
{{#each weapon.data.data.weaponstats as |weaponstat statkey|}}
{{#each weapon.system.weaponstats as |weaponstat statkey|}}
<ul>
<li class="item stat flexrow list-item" data-item-id="{{weapon.id}}" data-stat-id={{statkey}}><span class="stat-label weapon-label"><a name="{{weapon.name}}">Attack with {{weaponstat.name}}</a></span>
</li>
<li>{{> "systems/fvtt-fragged-kingdom/templates/weapon-stats-section.html" stats=weaponstat.data.statstotal isfinal=false header=true}}
<li>{{> "systems/fvtt-fragged-kingdom/templates/weapon-stats-section.html" stats=weaponstat.system.statstotal isfinal=false header=true}}
</li>
</ul>
{{/each}}
@ -151,7 +151,7 @@
<span class="equipement-label">{{equip.name}}</span>
<span class="equipement-label">{{equip.type}}</span>
<div class="item-controls">
<a class="item-control item-equip" title="Worn">{{#if equip.data.data.equipped}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-equip" title="Worn">{{#if equip.system.equipped}}<i class="fas fa-circle"></i>{{else}}<i class="fas fa-genderless"></i>{{/if}}</a>
<a class="item-control item-edit" title="Edit Item"><i class="fas fa-edit"></i></a>
<a class="item-control item-delete" title="Delete Item"><i class="fas fa-trash"></i></a>
</div>

View File

@ -24,7 +24,7 @@
{{/if}}
</span>
<span class="item-field-label-short">
{{#if equip.data.iscontainer}}
{{#if equip.system.iscontainer}}
{{equip.system.contentsEnc}}
{{else}}
{{mul equip.system.weight equip.system.quantity}}
@ -32,7 +32,7 @@
</span>
<span class="item-field-label-medium">
{{#if equip.system.idrDice}}
<a class="roll-idr" data-dice-value="{{equip.data.idrDice}}">{{equip.system.idrDice}}</a>
<a class="roll-idr" data-dice-value="{{equip.system.idrDice}}">{{equip.system.idrDice}}</a>
{{else}}
&nbsp;-&nbsp;
{{/if}}