Fix numbering
This commit is contained in:
@ -17,6 +17,10 @@ export class PegasusUtility {
|
||||
Hooks.on("getCombatTrackerEntryContext", (html, options) => {
|
||||
PegasusUtility.pushInitiativeOptions(html, options);
|
||||
});
|
||||
Hooks.on("dropCanvasData", (canvas, data) => {
|
||||
PegasusUtility.dropItemOnToken(canvas, data)
|
||||
});
|
||||
|
||||
this.rollDataStore = {}
|
||||
this.defenderStore = {}
|
||||
this.diceList = [];
|
||||
@ -34,14 +38,14 @@ export class PegasusUtility {
|
||||
});
|
||||
Handlebars.registerHelper('notEmpty', function (list) {
|
||||
return list.length > 0;
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static pushInitiativeOptions(html, options) {
|
||||
console.log('Option pushed....')
|
||||
options.push( { name: "Apply -10", condition: true, icon: '<i class="fas fa-plus"></i>', callback: target => { PegasusCombat.decInitBy10(target.data('combatant-id'), -10); } } )
|
||||
options.push({ name: "Apply -10", condition: true, icon: '<i class="fas fa-plus"></i>', callback: target => { PegasusCombat.decInitBy10(target.data('combatant-id'), -10); } })
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
@ -55,6 +59,27 @@ export class PegasusUtility {
|
||||
this.specs = specs.map(i => i.toObject());
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async dropItemOnToken(canvas, data) {
|
||||
if (data.type != "Item") {
|
||||
return
|
||||
}
|
||||
|
||||
const position = canvas.grid.getTopLeft(data.x, data.y)
|
||||
let x = position[0]
|
||||
let y = position[1]
|
||||
const tokensList = [...canvas.tokens.placeables]
|
||||
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)
|
||||
token.actor.preprocessItem("none", item, false )
|
||||
console.log("Dropped !!!", item, token)
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async loadCompendiumData(compendium) {
|
||||
const pack = game.packs.get(compendium);
|
||||
@ -152,7 +177,6 @@ export class PegasusUtility {
|
||||
|
||||
const templatePaths = [
|
||||
'systems/fvtt-pegasus-rpg/templates/editor-notes-gm.html',
|
||||
'systems/fvtt-pegasus-rpg/templates/partial-roll-common-dices.html',
|
||||
'systems/fvtt-pegasus-rpg/templates/partial-roll-select-effects.html',
|
||||
'systems/fvtt-pegasus-rpg/templates/partial-options-statistics.html',
|
||||
'systems/fvtt-pegasus-rpg/templates/partial-options-level.html',
|
||||
@ -449,8 +473,8 @@ export class PegasusUtility {
|
||||
}
|
||||
// Init stuf
|
||||
if (rollData.isInit) {
|
||||
let combat = game.combats.get( rollData.combatId)
|
||||
combat.updateEmbeddedDocuments("Combatant", [ { _id: rollData.combatantId, initiative: rollData.finalScore } ]);
|
||||
let combat = game.combats.get(rollData.combatId)
|
||||
combat.updateEmbeddedDocuments("Combatant", [{ _id: rollData.combatantId, initiative: rollData.finalScore }]);
|
||||
}
|
||||
// And save the roll
|
||||
this.saveRollData(rollData);
|
||||
@ -539,6 +563,17 @@ export class PegasusUtility {
|
||||
game.socket.emit("system.fvtt-weapons-of-the-gods", { msg: "msg_gm_chat_message", data: chatGM });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static async searchItem(dataItem) {
|
||||
let item;
|
||||
if (dataItem.pack) {
|
||||
item = await fromUuid("Compendium." + dataItem.pack + "." + dataItem.id);
|
||||
} else {
|
||||
item = game.items.get(dataItem.id)
|
||||
}
|
||||
return item;
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static split3Columns(data) {
|
||||
|
||||
@ -580,7 +615,7 @@ export class PegasusUtility {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
static getBasicRollData() {
|
||||
let rollData = {
|
||||
let rollData = {
|
||||
rollId: randomID(16),
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
bonusDicesLevel: 0,
|
||||
@ -592,7 +627,7 @@ export class PegasusUtility {
|
||||
armorsList: [],
|
||||
weaponsList: [],
|
||||
equipmentsList: [],
|
||||
optionsDiceList: PegasusUtility.getOptionsDiceList()
|
||||
optionsDiceList: PegasusUtility.getOptionsDiceList()
|
||||
}
|
||||
PegasusUtility.updateWithTarget(rollData)
|
||||
return rollData
|
||||
|
Reference in New Issue
Block a user