v10 Migration
This commit is contained in:
@ -48,9 +48,9 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async getData() {
|
||||
const objectData = PegasusUtility.data(this.object);
|
||||
const objectData = this.object
|
||||
|
||||
let itemData = foundry.utils.deepClone(PegasusUtility.templateData(this.object));
|
||||
let itemData = foundry.utils.deepClone(objectData)
|
||||
let formData = {
|
||||
title: this.title,
|
||||
id: this.id,
|
||||
@ -61,7 +61,7 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
cssClass: this.isEditable ? "editable" : "locked",
|
||||
optionsDiceList: PegasusUtility.getOptionsDiceList(),
|
||||
optionsStatusList: PegasusUtility.getOptionsStatusList(),
|
||||
data: itemData,
|
||||
data: itemData.system,
|
||||
limited: this.object.limited,
|
||||
options: this.options,
|
||||
owner: this.document.isOwner,
|
||||
@ -69,7 +69,7 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
isGM: game.user.isGM
|
||||
}
|
||||
|
||||
this.options.editable = !(this.object.data.origin == "embeddedItem");
|
||||
this.options.editable = true //!(this.object.isEmbedded)
|
||||
console.log("ITEM DATA", formData, this);
|
||||
return formData;
|
||||
}
|
||||
@ -88,7 +88,7 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
|
||||
/* -------------------------------------------- */
|
||||
postItem() {
|
||||
let chatData = duplicate(PegasusUtility.data(this.item));
|
||||
let chatData = this.item.system
|
||||
if (this.actor) {
|
||||
chatData.actor = { id: this.actor.id };
|
||||
}
|
||||
@ -113,10 +113,10 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
async viewSubitem(ev) {
|
||||
let field = $(ev.currentTarget).data('type');
|
||||
let idx = Number($(ev.currentTarget).data('index'));
|
||||
let itemData = this.object.data.data[field][idx];
|
||||
let itemData = this.object.system[field][idx];
|
||||
if (itemData.name != 'None') {
|
||||
let spec = await Item.create(itemData, { temporary: true });
|
||||
spec.data.origin = "embeddedItem";
|
||||
spec.system.origin = "embeddedItem";
|
||||
new PegasusItemSheet(spec).render(true);
|
||||
}
|
||||
}
|
||||
@ -125,8 +125,8 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
async deleteSubitem(ev) {
|
||||
let field = $(ev.currentTarget).data('type');
|
||||
let idx = Number($(ev.currentTarget).data('index'));
|
||||
let oldArray = this.object.data.data[field];
|
||||
let itemData = this.object.data.data[field][idx];
|
||||
let oldArray = this.object.system[field];
|
||||
let itemData = this.object.system[field][idx];
|
||||
if (itemData.name != 'None') {
|
||||
let newArray = [];
|
||||
for (var i = 0; i < oldArray.length; i++) {
|
||||
@ -134,16 +134,16 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
newArray.push(oldArray[i]);
|
||||
}
|
||||
}
|
||||
this.object.update({ [`data.${field}`]: newArray });
|
||||
this.object.update({ [`system.${field}`]: newArray });
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async manageSpec() {
|
||||
let itemData = this.object.data.data.specialisation[0];
|
||||
let itemData = this.object.system.specialisation[0];
|
||||
if (itemData.name != 'None') {
|
||||
let spec = await Item.create(itemData, { temporary: true });
|
||||
spec.data.origin = "embeddedItem";
|
||||
spec.system.origin = "embeddedItem";
|
||||
new PegasusItemSheet(spec).render(true);
|
||||
}
|
||||
}
|
||||
@ -165,7 +165,7 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
});
|
||||
|
||||
html.find('.delete-spec').click(ev => {
|
||||
this.object.update({ "data.specialisation": [{ name: 'None' }] });
|
||||
this.object.update({ "system.specialisation": [{ name: 'None' }] });
|
||||
});
|
||||
|
||||
html.find('.delete-subitem').click(ev => {
|
||||
@ -174,9 +174,9 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
|
||||
html.find('.stat-choice-flag').click(ev => {
|
||||
let idx = $(ev.currentTarget).data("stat-idx");
|
||||
let array = duplicate(this.object.data.data.statincreasechoice);
|
||||
let array = duplicate(this.object.system.statincreasechoice);
|
||||
array[Number(idx)].flag = !array[Number(idx)].flag;
|
||||
this.object.update({ "data.statincreasechoice": array });
|
||||
this.object.update({ "system.statincreasechoice": array });
|
||||
});
|
||||
|
||||
// Update Inventory Item
|
||||
@ -197,225 +197,225 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addAbility(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID(dataItem.id.length);
|
||||
console.log("ABB", event, item, dataItem)
|
||||
async addAbility(event, item) {
|
||||
let newItem = duplicate(item)
|
||||
newItem._id = randomID(item.id.length);
|
||||
console.log("ABB", event, item)
|
||||
if (event.toElement.className == 'drop-abilities') {
|
||||
let abilityArray = duplicate(this.object.data.data.abilities);
|
||||
let abilityArray = duplicate(this.object.system.abilities);
|
||||
abilityArray.push(newItem);
|
||||
await this.object.update({ 'data.abilities': abilityArray });
|
||||
await this.object.update({ 'system.abilities': abilityArray });
|
||||
}
|
||||
if (event.toElement.className == 'drop-optionnal-abilities') {
|
||||
let abilityArray = duplicate(this.object.data.data.optionnalabilities);
|
||||
let abilityArray = duplicate(this.object.system.optionnalabilities);
|
||||
abilityArray.push(newItem);
|
||||
await this.object.update({ 'data.optionnalabilities': abilityArray });
|
||||
await this.object.update({ 'system.optionnalabilities': abilityArray });
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addRacePerk(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID(dataItem.id.length);
|
||||
async addRacePerk(event, item) {
|
||||
let newItem = duplicate(item);
|
||||
newItem._id = randomID(item.id);
|
||||
if (event.toElement.className == 'drop-race-perk') {
|
||||
let perkArray = duplicate(this.object.data.data.perks);
|
||||
let perkArray = duplicate(this.object.system.perks);
|
||||
perkArray.push(newItem);
|
||||
await this.object.update({ 'data.perks': perkArray });
|
||||
await this.object.update({ 'system.perks': perkArray });
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addSpecialisation(item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID(dataItem.id.length);
|
||||
async addSpecialisation(item) {
|
||||
let newItem = duplicate(item)
|
||||
newItem._id = randomID(item.id.length)
|
||||
let specArray = [newItem];
|
||||
await this.object.update({ 'data.specialisation': specArray });
|
||||
await this.object.update({ 'system.specialisation': specArray });
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addRoleSpecialisation(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID(dataItem.id.length);
|
||||
async addRoleSpecialisation(event, item) {
|
||||
let newItem = duplicate(item);
|
||||
newItem._id = randomID(item.id.length);
|
||||
console.log("Add spec", event, newItem);
|
||||
if (event.toElement.className == 'drop-spec1') {
|
||||
let specArray = duplicate(this.object.data.data.specialisationsplus1);
|
||||
let specArray = duplicate(this.object.system.specialisationsplus1);
|
||||
specArray.push(newItem);
|
||||
await this.object.update({ 'data.specialisationsplus1': specArray });
|
||||
await this.object.update({ 'system.specialisationsplus1': specArray });
|
||||
}
|
||||
if (event.toElement.className == 'drop-spec2') {
|
||||
let specArray = duplicate(this.object.data.data.specincrease);
|
||||
let specArray = duplicate(this.object.system.specincrease);
|
||||
specArray.push(newItem);
|
||||
await this.object.update({ 'data.specincrease': specArray });
|
||||
await this.object.update({ 'system.specincrease': specArray });
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addRolePerk(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID(dataItem.id.length);
|
||||
async addRolePerk(event, item) {
|
||||
let newItem = duplicate(item);
|
||||
newItem._id = randomID(item.id.length);
|
||||
if (event.toElement.className == 'drop-perk2') {
|
||||
let perkArray = duplicate(this.object.data.data.perks);
|
||||
let perkArray = duplicate(this.object.system.perks);
|
||||
perkArray.push(newItem);
|
||||
await this.object.update({ 'data.perks': perkArray });
|
||||
await this.object.update({ 'system.perks': perkArray });
|
||||
}
|
||||
if (event.toElement.className == 'drop-specialperk1') {
|
||||
let perkArray = duplicate(this.object.data.data.specialperk);
|
||||
let perkArray = duplicate(this.object.system.specialperk);
|
||||
perkArray.push(newItem);
|
||||
await this.object.update({ 'data.specialperk': perkArray });
|
||||
await this.object.update({ 'system.specialperk': perkArray });
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async addRoleAbility(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data)
|
||||
newItem._id = randomID(dataItem.id.length)
|
||||
async addRoleAbility(event, item) {
|
||||
let newItem = duplicate(item)
|
||||
newItem._id = randomID(item.id.length)
|
||||
if (event.toElement.className == 'drop-specialability') {
|
||||
let abiArray = duplicate(this.object.data.data.specialability)
|
||||
let abiArray = duplicate(this.object.system.specialability)
|
||||
abiArray.push(newItem)
|
||||
await this.object.update({ 'data.specialability': abiArray })
|
||||
await this.object.update({ 'system.specialability': abiArray })
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addPower(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID(dataItem.id.length);
|
||||
async addPower(event, item) {
|
||||
let newItem = duplicate(item);
|
||||
newItem._id = randomID(item.id.length);
|
||||
if (event.toElement.className == 'drop-spec-power') {
|
||||
let powArray = duplicate(this.object.data.data.powers);
|
||||
let powArray = duplicate(this.object.system.powers);
|
||||
powArray.push(newItem);
|
||||
await this.object.update({ 'data.powers': powArray });
|
||||
await this.object.update({ 'system.powers': powArray });
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addAbilityPower(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID(dataItem.id.length);
|
||||
async addAbilityPower(event, item) {
|
||||
let newItem = duplicate(item);
|
||||
newItem._id = randomID(item.id.length);
|
||||
if (event.toElement.className == 'drop-ability-power') {
|
||||
let powArray = duplicate(this.object.data.data.powersgained);
|
||||
let powArray = duplicate(this.object.system.powersgained);
|
||||
powArray.push(newItem);
|
||||
await this.object.update({ 'data.powersgained': powArray });
|
||||
await this.object.update({ 'system.powersgained': powArray });
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async addAbilityEffect(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID(dataItem.id.length);
|
||||
async addAbilityEffect(event, item) {
|
||||
let newItem = duplicate(item);
|
||||
newItem._id = randomID(item.id.length);
|
||||
if (event.toElement.className == 'drop-ability-effect') {
|
||||
let powArray = duplicate(this.object.data.data.effectsgained);
|
||||
let powArray = duplicate(this.object.system.effectsgained);
|
||||
powArray.push(newItem);
|
||||
await this.object.update({ 'data.effectsgained': powArray });
|
||||
await this.object.update({ 'system.effectsgained': powArray });
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addAbilitySpec(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID(dataItem.id.length);
|
||||
async addAbilitySpec(event, item) {
|
||||
let newItem = duplicate(item);
|
||||
newItem._id = randomID(item.id.length);
|
||||
if (event.toElement.className == 'drop-ability-spec') {
|
||||
let powArray = duplicate(this.object.data.data.specialisations);
|
||||
let powArray = duplicate(this.object.system.specialisations);
|
||||
powArray.push(newItem);
|
||||
await this.object.update({ 'data.specialisations': powArray });
|
||||
await this.object.update({ 'system.specialisations': powArray });
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async addAbilityWeaponArmor(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
newItem._id = randomID(dataItem.id.length);
|
||||
async addAbilityWeaponArmor(event, item) {
|
||||
let newItem = duplicate(item);
|
||||
newItem._id = randomID(item.id.length);
|
||||
if (event.toElement.className == 'drop-ability-weapon') {
|
||||
let weaponArray = duplicate(this.object.data.data.attackgained);
|
||||
let weaponArray = duplicate(this.object.system.attackgained);
|
||||
weaponArray.push(newItem);
|
||||
await this.object.update({ 'data.attackgained': weaponArray });
|
||||
await this.object.update({ 'system.attackgained': weaponArray });
|
||||
}
|
||||
if (event.toElement.className == 'drop-ability-armor') {
|
||||
let armorArray = duplicate(this.object.data.data.armorgained);
|
||||
let armorArray = duplicate(this.object.system.armorgained);
|
||||
armorArray.push(newItem);
|
||||
await this.object.update({ 'data.armorgained': armorArray });
|
||||
await this.object.update({ 'system.armorgained': armorArray });
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addPerkSpecialisation(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
async addPerkSpecialisation(event, item) {
|
||||
let newItem = duplicate(item);
|
||||
if (event.toElement.className == 'drop-spec-perk') {
|
||||
//console.log("PER SPEC", event)
|
||||
let key = event.toElement.dataset["key"];
|
||||
if (key == 'affectedspec') {
|
||||
await this.object.update({ 'data.features.affectedspec.value': newItem.name });
|
||||
await this.object.update({ 'system.features.affectedspec.value': newItem.name });
|
||||
} else {
|
||||
await this.object.update({ 'data.features.gainspecdice.value': newItem.name });
|
||||
await this.object.update({ 'system.features.gainspecdice.value': newItem.name });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addPerkEffect(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data)
|
||||
async addPerkEffect(event, item) {
|
||||
let newItem = duplicate(item)
|
||||
if (event.toElement.className == 'drop-perk-effect') {
|
||||
let effectArray = duplicate(this.object.data.data.effectsgained)
|
||||
let effectArray = duplicate(this.object.system.effectsgained)
|
||||
effectArray.push(newItem)
|
||||
await this.object.update({ 'data.effectsgained': effectArray })
|
||||
await this.object.update({ 'system.effectsgained': effectArray })
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addEffectPower(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data)
|
||||
async addEffectPower(event, item) {
|
||||
let newItem = duplicate(item)
|
||||
if (event.toElement.className == 'drop-power-effect') {
|
||||
let effectArray = duplicate(this.object.data.data.effectsgained)
|
||||
let effectArray = duplicate(this.object.system.effectsgained)
|
||||
effectArray.push(newItem);
|
||||
await this.object.update({ 'data.effectsgained': effectArray })
|
||||
await this.object.update({ 'system.effectsgained': effectArray })
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addEffectSpec(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
async addEffectSpec(event, item) {
|
||||
let newItem = duplicate(item);
|
||||
if (event.toElement.className == 'drop-effect-spec') {
|
||||
let specArray = duplicate(this.object.data.data.recoveryrollspec);
|
||||
let specArray = duplicate(this.object.system.recoveryrollspec);
|
||||
specArray.push(newItem);
|
||||
await this.object.update({ 'data.recoveryrollspec': specArray });
|
||||
await this.object.update({ 'system.recoveryrollspec': specArray });
|
||||
}
|
||||
if (event.toElement.className == 'drop-effect-specaffected') {
|
||||
let specArray = duplicate(this.object.data.data.specaffected);
|
||||
let specArray = duplicate(this.object.system.specaffected);
|
||||
specArray.push(newItem);
|
||||
await this.object.update({ 'data.specaffected': specArray });
|
||||
await this.object.update({ 'system.specaffected': specArray });
|
||||
}
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
async addEffectItem(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
async addEffectItem(event, item) {
|
||||
let newItem = duplicate(item);
|
||||
if (event.toElement.className == 'drop-equipment-effect') {
|
||||
let effectArray = duplicate(this.object.data.data.effects);
|
||||
let effectArray = duplicate(this.object.system.effects);
|
||||
effectArray.push(newItem);
|
||||
await this.object.update({ 'data.effects': effectArray });
|
||||
await this.object.update({ 'system.effects': effectArray });
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async addEffectVirtueVice(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
async addEffectVirtueVice(event, item) {
|
||||
let newItem = duplicate(item);
|
||||
if (event.toElement.className == 'drop-virtue-vice-effect') {
|
||||
let effectArray = duplicate(this.object.data.data.effectsgained);
|
||||
let effectArray = duplicate(this.object.system.effectsgained);
|
||||
effectArray.push(newItem);
|
||||
await this.object.update({ 'data.effectsgained': effectArray });
|
||||
await this.object.update({ 'system.effectsgained': effectArray });
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async addViceToVirtue(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
async addViceToVirtue(event, item) {
|
||||
let newItem = duplicate(item);
|
||||
if (event.toElement.className == 'drop-virtue-vice') {
|
||||
let viceArray = duplicate(this.object.data.data.unavailablevice);
|
||||
let viceArray = duplicate(this.object.system.unavailablevice);
|
||||
viceArray.push(newItem);
|
||||
await this.object.update({ 'data.unavailablevice': viceArray });
|
||||
await this.object.update({ 'system.unavailablevice': viceArray });
|
||||
}
|
||||
}
|
||||
/* -------------------------------------------- */
|
||||
async addVirtueToVice(event, item, dataItem) {
|
||||
let newItem = duplicate(item.data);
|
||||
async addVirtueToVice(event, item) {
|
||||
let newItem = duplicate(item);
|
||||
if (event.toElement.className == 'drop-vice-virtue') {
|
||||
let virtueArray = duplicate(this.object.data.data.unavailablevirtue);
|
||||
let virtueArray = duplicate(this.object.system.unavailablevirtue);
|
||||
virtueArray.push(newItem);
|
||||
await this.object.update({ 'data.unavailablevirtue': virtueArray });
|
||||
await this.object.update({ 'system.unavailablevirtue': virtueArray });
|
||||
}
|
||||
}
|
||||
|
||||
@ -423,140 +423,101 @@ export class PegasusItemSheet extends ItemSheet {
|
||||
/* -------------------------------------------- */
|
||||
async _onDrop(event) {
|
||||
|
||||
let data = event.dataTransfer.getData('text/plain')
|
||||
let dataItem = JSON.parse( data)
|
||||
console.log("DROP", event, dataItem )
|
||||
const item = fromUuidSync(dataItem.uuid)
|
||||
if (!item) {
|
||||
ui.notifications.warn("Unable to find relevant item - Aborting drag&drop " + data.uuid)
|
||||
return
|
||||
}
|
||||
|
||||
if (this.object.type == 'virtue' ) {
|
||||
let data = event.dataTransfer.getData('text/plain');
|
||||
if (data) {
|
||||
let dataItem = JSON.parse(data);
|
||||
let item = await PegasusUtility.searchItem(dataItem);
|
||||
if (item.data.type == 'effect') {
|
||||
return this.addEffectVirtueVice(event, item, dataItem);
|
||||
}
|
||||
if (item.data.type == 'vice') {
|
||||
return this.addViceToVirtue(event, item, dataItem);
|
||||
}
|
||||
if (item.type == 'effect') {
|
||||
return this.addEffectVirtueVice(event, item);
|
||||
}
|
||||
if (item.type == 'vice') {
|
||||
return this.addViceToVirtue(event, item);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.object.type == 'vice' ) {
|
||||
let data = event.dataTransfer.getData('text/plain');
|
||||
if (data) {
|
||||
let dataItem = JSON.parse(data);
|
||||
let item = await PegasusUtility.searchItem(dataItem);
|
||||
if (item.data.type == 'effect') {
|
||||
return this.addEffectVirtueVice(event, item, dataItem);
|
||||
}
|
||||
if (item.data.type == 'virtue') {
|
||||
return this.addVirtueToVice(event, item, dataItem);
|
||||
}
|
||||
if (item.type == 'effect') {
|
||||
return this.addEffectVirtueVice(event, item);
|
||||
}
|
||||
if (item.type == 'virtue') {
|
||||
return this.addVirtueToVice(event, item);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.object.type == 'weapon' || this.object.type == 'armor' || this.object.type == 'shield'
|
||||
|| this.object.type == 'equipment' || this.object.type == 'vehiclemodule'
|
||||
|| this.object.type == 'vehicleweaponmodule') {
|
||||
let data = event.dataTransfer.getData('text/plain');
|
||||
if (data) {
|
||||
let dataItem = JSON.parse(data);
|
||||
let item = await PegasusUtility.searchItem(dataItem);
|
||||
if (item.data.type == 'effect') {
|
||||
return this.addEffectItem(event, item, dataItem);
|
||||
}
|
||||
if (item.type == 'effect') {
|
||||
return this.addEffectItem(event, item);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.object.type == 'power') {
|
||||
let data = event.dataTransfer.getData('text/plain');
|
||||
if (data) {
|
||||
let dataItem = JSON.parse(data);
|
||||
let item = await PegasusUtility.searchItem(dataItem);
|
||||
if (item.data.type == 'effect') {
|
||||
return this.addEffectPower(event, item, dataItem);
|
||||
}
|
||||
if (item.type == 'effect') {
|
||||
return this.addEffectPower(event, item);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.object.type == 'effect') {
|
||||
let data = event.dataTransfer.getData('text/plain');
|
||||
if (data) {
|
||||
let dataItem = JSON.parse(data);
|
||||
let item = await PegasusUtility.searchItem(dataItem);
|
||||
if (item.data.type == 'specialisation') {
|
||||
return this.addEffectSpec(event, item, dataItem);
|
||||
}
|
||||
if (item.type == 'specialisation') {
|
||||
return this.addEffectSpec(event, item);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.object.type == 'race') {
|
||||
let data = event.dataTransfer.getData('text/plain');
|
||||
if (data) {
|
||||
let dataItem = JSON.parse(data);
|
||||
let item = await PegasusUtility.searchItem(dataItem);
|
||||
if (item.data.type == 'ability') {
|
||||
return this.addAbility(event, item, dataItem);
|
||||
}
|
||||
if (item.data.type == 'perk') {
|
||||
return this.addRacePerk(event, item, dataItem);
|
||||
}
|
||||
if (item.type == 'ability') {
|
||||
return this.addAbility(event, item);
|
||||
}
|
||||
if (item.type == 'perk') {
|
||||
return this.addRacePerk(event, item);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.object.type == 'perk') {
|
||||
let data = event.dataTransfer.getData('text/plain')
|
||||
if (data) {
|
||||
let dataItem = JSON.parse(data);
|
||||
let item = await PegasusUtility.searchItem(dataItem)
|
||||
if (item.data.type == 'specialisation') {
|
||||
return this.addPerkSpecialisation(event, item, dataItem)
|
||||
}
|
||||
if (item.data.type == 'effect') {
|
||||
return this.addPerkEffect(event, item, dataItem);
|
||||
}
|
||||
if (item.type == 'specialisation') {
|
||||
return this.addPerkSpecialisation(event, item)
|
||||
}
|
||||
if (item.type == 'effect') {
|
||||
return this.addPerkEffect(event, item);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.object.type == 'specialisation') {
|
||||
let data = event.dataTransfer.getData('text/plain');
|
||||
if (data) {
|
||||
let dataItem = JSON.parse(data);
|
||||
let item = await PegasusUtility.searchItem(dataItem);
|
||||
if (item.data.type == 'power') {
|
||||
return this.addPower(event, item, dataItem);
|
||||
}
|
||||
if (item.type == 'power') {
|
||||
return this.addPower(event, item);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.object.type == 'ability') {
|
||||
let data = event.dataTransfer.getData('text/plain');
|
||||
if (data) {
|
||||
let dataItem = JSON.parse(data);
|
||||
let item = await PegasusUtility.searchItem(dataItem);
|
||||
if (item.data.type == 'effect') {
|
||||
return this.addAbilityEffect(event, item, dataItem);
|
||||
}
|
||||
if (item.data.type == 'power') {
|
||||
return this.addAbilityPower(event, item, dataItem);
|
||||
}
|
||||
if (item.data.type == 'specialisation') {
|
||||
return this.addAbilitySpec(event, item, dataItem);
|
||||
}
|
||||
if (item.data.type == 'weapon' || item.data.type == 'armor') {
|
||||
return this.addAbilityWeaponArmor(event, item, dataItem);
|
||||
}
|
||||
if (item.type == 'effect') {
|
||||
return this.addAbilityEffect(event, item);
|
||||
}
|
||||
if (item.type == 'power') {
|
||||
return this.addAbilityPower(event, item);
|
||||
}
|
||||
if (item.type == 'specialisation') {
|
||||
return this.addAbilitySpec(event, item);
|
||||
}
|
||||
if (item.type == 'weapon' || item.type == 'armor') {
|
||||
return this.addAbilityWeaponArmor(event, item);
|
||||
}
|
||||
}
|
||||
|
||||
if (this.object.type == 'role') {
|
||||
let data = event.dataTransfer.getData('text/plain')
|
||||
if (data) {
|
||||
let dataItem = JSON.parse(data)
|
||||
let item = await PegasusUtility.searchItem(dataItem)
|
||||
if (item.data.type == 'specialisation') {
|
||||
return this.addRoleSpecialisation(event, item, dataItem)
|
||||
}
|
||||
if (item.data.type == 'perk') {
|
||||
return this.addRolePerk(event, item, dataItem)
|
||||
}
|
||||
if (item.data.type == 'ability') {
|
||||
return this.addRoleAbility(event, item, dataItem)
|
||||
}
|
||||
if (item.type == 'specialisation') {
|
||||
return this.addRoleSpecialisation(event, item)
|
||||
}
|
||||
if (item.type == 'perk') {
|
||||
return this.addRolePerk(event, item)
|
||||
}
|
||||
if (item.type == 'ability') {
|
||||
return this.addRoleAbility(event, item)
|
||||
}
|
||||
}
|
||||
ui.notifications.warn("This item can not be dropped over another item")
|
||||
|
Reference in New Issue
Block a user