Compare commits
7 Commits
Author | SHA1 | Date |
---|---|---|
Erebus | a26cc89686 | |
Erebus | 58c3fbcd42 | |
Erebus | 6962d6fc04 | |
Erebus | 3f044c0b97 | |
erebus | cace9cc899 | |
erebus | 0c1729a4b4 | |
erebus | 77806b38c4 |
|
@ -72,6 +72,13 @@
|
|||
"MENU.SHOWROLLDIALOG": "Show diceroller dialog",
|
||||
"ROLL.OPENCLOSE": "Open / Close",
|
||||
"ROLL.EXCEPTIONAL": "Exceptional",
|
||||
"ROLL.SUBPAR": "Subpar result",
|
||||
"ROLL.LOW": "Low result",
|
||||
"ROLL.LIMITED": "Limited result",
|
||||
"ROLL.GOOD": "Good result",
|
||||
"ROLL.SUPERIOR": "Superior result",
|
||||
"ROLL.OR": "or",
|
||||
"ROLL.OPPOSITE": "Resisted by",
|
||||
|
||||
"SHIP.CARGO": "Cargo capacity",
|
||||
"SHIP.HULL": "Hull",
|
||||
|
@ -88,6 +95,7 @@
|
|||
"SKILL.COMBAT": "Combat",
|
||||
"SKILL.STARTVALUE": "Start value",
|
||||
"SKILL.LANGUAGE": "Language",
|
||||
"SKILL.NONE": "None",
|
||||
|
||||
"SPELL.DIFFICULTY": "Difficulty",
|
||||
"SPELL.ROLLTITLE": "Roll",
|
||||
|
|
|
@ -73,6 +73,13 @@
|
|||
"MENU.SHOWROLLDIALOG": "Visa tärningsdialog",
|
||||
"ROLL.OPENCLOSE": "Öppna / Stäng",
|
||||
"ROLL.EXCEPTIONAL": "Exceptionellt",
|
||||
"ROLL.SUBPAR": "Undermålig kvalitet",
|
||||
"ROLL.LOW": "Låg kvalitet",
|
||||
"ROLL.LIMITED": "Begränsad kvalitet",
|
||||
"ROLL.GOOD": "God kvalitet",
|
||||
"ROLL.SUPERIOR": "Överlägsen kvalitet",
|
||||
"ROLL.OR": "eller",
|
||||
"ROLL.OPPOSITE": "Motsatt av",
|
||||
|
||||
"SHIP.CARGO": "Lastförmåga",
|
||||
"SHIP.HULL": "Skrov",
|
||||
|
@ -89,6 +96,7 @@
|
|||
"SKILL.COMBAT": "Stridsfärdigheter",
|
||||
"SKILL.STARTVALUE": "Grundvärde",
|
||||
"SKILL.LANGUAGE": "Språk",
|
||||
"SKILL.NONE": "Ingen",
|
||||
|
||||
"SPELL.DIFFICULTY": "Svårighet",
|
||||
"SPELL.ROLLTITLE": "Slag",
|
||||
|
|
|
@ -154,13 +154,13 @@ export class ActorSheetKH extends ActorSheet {
|
|||
icon: '<i class="far dice"></i>',
|
||||
callback: (li) => {
|
||||
let itemId = li.data("itemId");
|
||||
let _item = this.actor.items.find((element) => element._id == itemId);
|
||||
let _item = this.actor.items.find((element) => element.id == itemId);
|
||||
|
||||
// Retrieve skill based on name
|
||||
let skill = this.actor.items.find((element) => element.name === _item.data.data.skill.value);
|
||||
let skill = this.actor.items.find((element) => element.name === _item.data.skill.value);
|
||||
|
||||
let skillName = skill.name
|
||||
let skillValue = skill.data.data.value
|
||||
let skillValue = skill.data.value
|
||||
let showValue = false
|
||||
|
||||
if(this.actor.data.type === "character") {
|
||||
|
@ -186,10 +186,10 @@ export class ActorSheetKH extends ActorSheet {
|
|||
icon: '<i class="far dice"></i>',
|
||||
callback: (li) => {
|
||||
let itemId = li.data("itemId");
|
||||
let _item = this.actor.items.find((element) => element._id == itemId);
|
||||
let _item = this.actor.items.find((element) => element.id == itemId);
|
||||
|
||||
let skillName = _item.name
|
||||
let skillValue = _item.data.data.value
|
||||
let skillValue = _item.data.value
|
||||
let showValue = false
|
||||
|
||||
if(this.actor.data.type === "character") {
|
||||
|
@ -214,14 +214,14 @@ export class ActorSheetKH extends ActorSheet {
|
|||
name: game.i18n.localize("MENU.SHOWROLLDIALOG"),
|
||||
icon: '<i class="far dice"></i>',
|
||||
callback: (li) => {
|
||||
let itemId = li.data("itemId");
|
||||
let _item = this.actor.items.find((element) => element._id == itemId);
|
||||
let itemId = li.data("item-id");
|
||||
let _item = this.actor.items.find((element) => element.id == itemId);
|
||||
|
||||
if (!_item) {
|
||||
_item = game.items.get(itemId);
|
||||
|
||||
if (!_item) {
|
||||
console.log("IMPORT ERROR")
|
||||
console.log("IMPORT ERROR 1")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -233,7 +233,7 @@ export class ActorSheetKH extends ActorSheet {
|
|||
showValue = true
|
||||
}
|
||||
|
||||
switch (_item.data.data.difficulty.value) {
|
||||
switch (_item.data.difficulty.value) {
|
||||
case "simple":
|
||||
difficulty = 5
|
||||
break;
|
||||
|
@ -248,33 +248,92 @@ export class ActorSheetKH extends ActorSheet {
|
|||
break;
|
||||
}
|
||||
|
||||
if(_item.data.data.roll.value === "roll" || _item.data.data.roll.value === "attackroll") {
|
||||
if(_item.data.roll.value === "roll" || _item.data.roll.value === "attackroll") {
|
||||
// Retrieve skill based on name
|
||||
let skill = this.actor.items.find((element) => element.name === _item.data.data.roll.skill);
|
||||
let skill = this.actor.items.find((element) => element.name === _item.data.roll.skill);
|
||||
|
||||
let skillName = _item.name
|
||||
let skillValue = skill.data.data.value
|
||||
let skillValue = skill.data.value
|
||||
|
||||
if(this.actor.data.type === "character") {
|
||||
skillName = _item.name + " (" + skill.name + ")"
|
||||
}
|
||||
|
||||
this.khRoller.rollSkillDialogInChat(skillName, skillValue, showValue, this.actor, difficulty)
|
||||
} else if(_item.data.data.roll.value === "opposite") {
|
||||
} else if(_item.data.roll.value === "opposite") {
|
||||
// Retrieve skill based on name
|
||||
let skill = this.actor.items.find((element) => element.name === _item.data.data.roll.skill);
|
||||
let skill = this.actor.items.find((element) => element.name === _item.data.roll.skill);
|
||||
|
||||
let skillName = _item.name
|
||||
let skillValue = skill.data.data.value
|
||||
let skillValue = skill.data.value
|
||||
|
||||
if(this.actor.data.type === "character") {
|
||||
skillName = _item.name + " (" + skill.name + ")"
|
||||
}
|
||||
|
||||
this.khRoller.rollSkillDialogInChat(skillName, skillValue, showValue, this.actor, difficulty)
|
||||
} else if(_item.data.data.roll.value === "ritual") {
|
||||
console.log("Not supported yet")
|
||||
this.khRoller.rollSkillDialogInChat("Ritual", -1, showValue, this.actor, difficulty)
|
||||
let opposite = []
|
||||
// Retrieve skill based on name
|
||||
|
||||
if(_item.data.roll.oppositeskill !== "") {
|
||||
let skill1 = this.actor.items.find((element) => element.name === _item.data.roll.oppositeskill);
|
||||
opposite.push(skill1.name)
|
||||
}
|
||||
|
||||
if(_item.data.roll.oppositeskilltwo !== "") {
|
||||
let skill2 = this.actor.items.find((element) => element.name === _item.data.roll.oppositeskilltwo);
|
||||
opposite.push(skill2.name)
|
||||
}
|
||||
|
||||
this.khRoller.rollSkillDialogInChat(skillName, skillValue, showValue, this.actor, difficulty, opposite)
|
||||
} else if(_item.data.roll.value === "ritual") {
|
||||
let skills = []
|
||||
|
||||
if(_item.data.roll.ritual.skillone !== "") {
|
||||
let skill1 = this.actor.items.find((element) => element.name === _item.data.roll.ritual.skillone);
|
||||
|
||||
skills.push({
|
||||
name: skill1.name,
|
||||
value: skill1.data.value
|
||||
});
|
||||
}
|
||||
|
||||
if(_item.data.roll.ritual.skilltwo !== "") {
|
||||
let skill2 = this.actor.items.find((element) => element.name === _item.data.roll.ritual.skilltwo);
|
||||
|
||||
skills.push({
|
||||
name: skill2.name,
|
||||
value: skill2.data.value
|
||||
});
|
||||
}
|
||||
|
||||
if(_item.data.roll.ritual.skillthree !== "") {
|
||||
let skill3 = this.actor.items.find((element) => element.name === _item.data.roll.ritual.skillthree);
|
||||
|
||||
skills.push({
|
||||
name: skill3.name,
|
||||
value: skill3.data.value
|
||||
});
|
||||
}
|
||||
|
||||
if(_item.data.roll.ritual.skillfour !== "") {
|
||||
let skill4 = this.actor.items.find((element) => element.name === _item.data.roll.ritual.skillfour);
|
||||
|
||||
skills.push({
|
||||
name: skill4.name,
|
||||
value: skill4.data.value
|
||||
});
|
||||
}
|
||||
|
||||
if(_item.data.roll.ritual.skillfive !== "") {
|
||||
let skill5 = this.actor.items.find((element) => element.name === _item.data.roll.ritual.skillfive);
|
||||
|
||||
skills.push({
|
||||
name: skill5.name,
|
||||
value: skill5.data.value
|
||||
});
|
||||
}
|
||||
|
||||
this.khRoller.rollSkillChallangeDialogInChat(_item.name, skills, showValue, this.actor, difficulty)
|
||||
}
|
||||
},
|
||||
},
|
||||
|
@ -329,6 +388,7 @@ export class ActorSheetKH extends ActorSheet {
|
|||
]);
|
||||
|
||||
html.find(".feature").click(async (ev) => {
|
||||
console.log("feature")
|
||||
const featureName = $(ev.currentTarget).data("feature");
|
||||
const featureValue = this.actor.data.data.feature[featureName].value;
|
||||
if (featureName === "one") {
|
||||
|
@ -347,7 +407,7 @@ export class ActorSheetKH extends ActorSheet {
|
|||
html.find(".item-delete").click((ev) => {
|
||||
let parent = $(ev.currentTarget).data("parent")
|
||||
const li = $(ev.currentTarget).parents(parent);
|
||||
const item = this.actor.getOwnedItem(li.data("itemId"));
|
||||
const item = this.actor.items.get(li.data("itemId"));
|
||||
|
||||
if(item) {
|
||||
if (item.type === "armor") {
|
||||
|
@ -358,10 +418,10 @@ export class ActorSheetKH extends ActorSheet {
|
|||
|
||||
this.actor.items.map((i) => {
|
||||
if (i.type === "armor") {
|
||||
if (i._id !== item._id && i.data.data.equipable.equipped && i.data?.data?.modifications) {
|
||||
for (let k of Object.keys(i.data.data.modifications)) {
|
||||
if (i.data.data.modifications[k].modtype === "init") {
|
||||
initValue = i.data.data.modifications[k].value;
|
||||
if (i.id !== item.id && i.data.equipable.equipped && i.data?.data?.modifications) {
|
||||
for (let k of Object.keys(i.data.modifications)) {
|
||||
if (i.data.modifications[k].modtype === "init") {
|
||||
initValue = i.data.modifications[k].value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -375,23 +435,26 @@ export class ActorSheetKH extends ActorSheet {
|
|||
}
|
||||
}
|
||||
|
||||
this.actor.deleteOwnedItem(li.data("itemId"));
|
||||
this.actor.deleteEmbeddedDocuments("Item", [li.data("itemId")]);
|
||||
|
||||
//this.actor.deleteOwnedItem(li.data("itemId"));
|
||||
|
||||
li.slideUp(200, () => this.render(false));
|
||||
});
|
||||
|
||||
// Edit Inventory Item
|
||||
html.find(".item-edit").click(async (ev) => {
|
||||
console.log("item-edit")
|
||||
let parent = $(ev.currentTarget).data("parent")
|
||||
let li = $(ev.currentTarget).parents(parent);
|
||||
let itemId = li.data("itemId");
|
||||
let item = this.actor.getOwnedItem(itemId);
|
||||
let item = this.actor.items.get(itemId);
|
||||
|
||||
if (!item) {
|
||||
item = game.items.get(itemId);
|
||||
|
||||
if (!item) {
|
||||
console.log("IMPORT ERROR")
|
||||
console.log("IMPORT ERROR 2")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -404,13 +467,13 @@ export class ActorSheetKH extends ActorSheet {
|
|||
html.find(".roll-spell-cost").click((ev) => {
|
||||
const li = $(ev.currentTarget).parents(".item-spell");
|
||||
let itemId = li.data("itemId");
|
||||
let spell = this.actor.getOwnedItem(itemId);
|
||||
let spell = this.actor.items.get(itemId);
|
||||
|
||||
if (!spell) {
|
||||
spell = game.items.get(itemId);
|
||||
|
||||
if (!spell) {
|
||||
console.log("IMPORT ERROR")
|
||||
console.log("IMPORT ERROR 3")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -427,14 +490,14 @@ export class ActorSheetKH extends ActorSheet {
|
|||
|
||||
html.find(".roll-spell-skill").click((ev) => {
|
||||
const li = $(ev.currentTarget).parents(".item-spell");
|
||||
let itemId = li.data("itemId");
|
||||
let spell = this.actor.getOwnedItem(itemId);
|
||||
let itemId = li.data("item-id");
|
||||
let spell = this.actor.items.get(itemId);
|
||||
|
||||
if (!spell) {
|
||||
spell = game.items.get(itemId);
|
||||
|
||||
if (!spell) {
|
||||
console.log("IMPORT ERROR")
|
||||
console.log("IMPORT ERROR 4")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -474,9 +537,20 @@ export class ActorSheetKH extends ActorSheet {
|
|||
|
||||
this.khRoller.rollSkillInChat(skillName, skillValue, showValue, this.actor, difficulty)
|
||||
} else if(spell.data.data.roll.value === "opposite") {
|
||||
let opposite = []
|
||||
// Retrieve skill based on name
|
||||
let skill = this.actor.items.find((element) => element.name === spell.data.data.roll.skill);
|
||||
|
||||
if(spell.data.data.roll.oppositeskill !== "") {
|
||||
let skill1 = this.actor.items.find((element) => element.name === spell.data.data.roll.oppositeskill);
|
||||
opposite.push(skill1.name)
|
||||
}
|
||||
|
||||
if(spell.data.data.roll.oppositeskilltwo !== "") {
|
||||
let skill2 = this.actor.items.find((element) => element.name === spell.data.data.roll.oppositeskilltwo);
|
||||
opposite.push(skill2.name)
|
||||
}
|
||||
|
||||
let skillName = spell.name
|
||||
let skillValue = skill.data.data.value
|
||||
|
||||
|
@ -484,17 +558,68 @@ export class ActorSheetKH extends ActorSheet {
|
|||
skillName = spell.name + " (" + skill.name + ")"
|
||||
}
|
||||
|
||||
this.khRoller.rollSkillInChat(skillName, skillValue, showValue, this.actor, difficulty)
|
||||
this.khRoller.rollSkillInChat(skillName, skillValue, showValue, this.actor, difficulty, opposite)
|
||||
} else if(spell.data.data.roll.value === "ritual") {
|
||||
console.log("Not supported yet")
|
||||
let skill1, skill2, skill3, skill4, skill5;
|
||||
let skills = []
|
||||
|
||||
// Retrieve skill based on name
|
||||
if(spell.data.data.roll.ritual.skillone !== "") {
|
||||
skill1 = this.actor.items.find((element) => element.name === spell.data.data.roll.ritual.skillone);
|
||||
|
||||
skills.push({
|
||||
name: skill1.name,
|
||||
value: skill1.data.data.value
|
||||
});
|
||||
}
|
||||
|
||||
if(spell.data.data.roll.ritual.skilltwo !== "") {
|
||||
skill2 = this.actor.items.find((element) => element.name === spell.data.data.roll.ritual.skilltwo);
|
||||
|
||||
skills.push({
|
||||
name: skill2.name,
|
||||
value: skill2.data.data.value
|
||||
});
|
||||
}
|
||||
|
||||
if(spell.data.data.roll.ritual.skillthree !== "") {
|
||||
skill3 = this.actor.items.find((element) => element.name === spell.data.data.roll.ritual.skillthree);
|
||||
|
||||
skills.push({
|
||||
name: skill3.name,
|
||||
value: skill3.data.data.value
|
||||
});
|
||||
}
|
||||
|
||||
if(spell.data.data.roll.ritual.skillfour !== "") {
|
||||
skill4 = this.actor.items.find((element) => element.name === spell.data.data.roll.ritual.skillfour);
|
||||
|
||||
skills.push({
|
||||
name: skill4.name,
|
||||
value: skill4.data.data.value
|
||||
});
|
||||
}
|
||||
|
||||
if(spell.data.data.roll.ritual.skillfive !== "") {
|
||||
skill5 = this.actor.items.find((element) => element.name === spell.data.data.roll.ritual.skillfive);
|
||||
|
||||
skills.push({
|
||||
name: skill5.name,
|
||||
value: skill5.data.data.value
|
||||
});
|
||||
}
|
||||
|
||||
let skillName = spell.name
|
||||
|
||||
this.khRoller.rollSkillRitualInChat(skillName, skills, showValue, this.actor, difficulty)
|
||||
}
|
||||
});
|
||||
|
||||
/* Roll skill */
|
||||
html.find(".roll-skill").click((ev) => {
|
||||
const li = $(ev.currentTarget).parents(".item-skill");
|
||||
let itemId = li.data("itemId");
|
||||
let _item = this.actor.items.find((element) => element._id == itemId);
|
||||
let itemId = li.data("item-id");
|
||||
let _item = this.actor.items.find((element) => element.id === itemId);
|
||||
|
||||
let skillName = _item.name
|
||||
let skillValue = _item.data.data.value
|
||||
|
@ -511,13 +636,13 @@ export class ActorSheetKH extends ActorSheet {
|
|||
html.find(".roll-weapon-skill").click((ev) => {
|
||||
const li = $(ev.currentTarget).parents(".item-weapon");
|
||||
let itemId = li.data("itemId");
|
||||
let weapon = this.actor.getOwnedItem(itemId);
|
||||
let weapon = this.actor.items.get(itemId);
|
||||
|
||||
if (!weapon) {
|
||||
weapon = game.items.get(itemId);
|
||||
|
||||
if (!weapon) {
|
||||
console.log("IMPORT ERROR")
|
||||
console.log("IMPORT ERROR 5")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -540,13 +665,13 @@ export class ActorSheetKH extends ActorSheet {
|
|||
html.find(".roll-damage").click((ev) => {
|
||||
const li = $(ev.currentTarget).parents(".item-weapon");
|
||||
let itemId = li.data("itemId");
|
||||
let weapon = this.actor.getOwnedItem(itemId);
|
||||
let weapon = this.actor.items.get(itemId);
|
||||
|
||||
if (!weapon) {
|
||||
weapon = game.items.get(itemId);
|
||||
|
||||
if (!weapon) {
|
||||
console.log("IMPORT ERROR")
|
||||
console.log("IMPORT ERROR 6")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -565,13 +690,13 @@ export class ActorSheetKH extends ActorSheet {
|
|||
html.find(".roll-armor").click((ev) => {
|
||||
const li = $(ev.currentTarget).parents(".item");
|
||||
let itemId = li.data("itemId");
|
||||
let armor = this.actor.getOwnedItem(itemId);
|
||||
let armor = this.actor.items.get(itemId);
|
||||
|
||||
if (!armor) {
|
||||
armor = game.items.get(itemId);
|
||||
|
||||
if (!armor) {
|
||||
console.log("IMPORT ERROR")
|
||||
console.log("IMPORT ERROR 7")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -626,13 +751,13 @@ export class ActorSheetKH extends ActorSheet {
|
|||
html.find(".roll-attack-damage").click((ev) => {
|
||||
const li = $(ev.currentTarget).parents(".item-attack");
|
||||
let itemId = li.data("itemId");
|
||||
let weapon = this.actor.getOwnedItem(itemId);
|
||||
let weapon = this.actor.items.get(itemId);
|
||||
|
||||
if (!weapon) {
|
||||
weapon = game.items.get(itemId);
|
||||
|
||||
if (!weapon) {
|
||||
console.log("IMPORT ERROR")
|
||||
console.log("IMPORT ERROR 8")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
@ -686,6 +811,12 @@ export class ActorSheetKH extends ActorSheet {
|
|||
|
||||
// Add or Remove relationship
|
||||
html.find(".learning-control").click(this._onClickLearningControl.bind(this));
|
||||
html.find(".learning-delete").click(async (event) => {
|
||||
event.preventDefault();
|
||||
const a = event.currentTarget.closest(".learning");
|
||||
const id = a.dataset["attribute"];
|
||||
this.object.update({ "data.learning": { ["-=" + id]: null } });
|
||||
});
|
||||
html.find(".learning-click").click(this._onClickLearingLearned.bind(this));
|
||||
|
||||
/* Hjältarnas Tid specefic */
|
||||
|
@ -697,6 +828,7 @@ export class ActorSheetKH extends ActorSheet {
|
|||
}
|
||||
|
||||
async _onClickLearingLearned(event) {
|
||||
console.log("_onClickLearingLearned")
|
||||
event.stopPropagation();
|
||||
const li1 = $(event.currentTarget);
|
||||
const li2 = $(event.currentTarget).parents(".learning");
|
||||
|
@ -716,13 +848,11 @@ export class ActorSheetKH extends ActorSheet {
|
|||
|
||||
async _onClickLearningControl(event) {
|
||||
event.preventDefault();
|
||||
const a = event.currentTarget;
|
||||
const action = a.dataset.action;
|
||||
const attrs = this.object.data.data.learning;
|
||||
const form = this.form;
|
||||
const action = event.currentTarget.dataset.action;
|
||||
|
||||
// Add new modification
|
||||
if (action === "create") {
|
||||
const form = this.form;
|
||||
const nk = new Date().getTime();
|
||||
let newKey = document.createElement("div");
|
||||
|
||||
|
@ -732,41 +862,43 @@ export class ActorSheetKH extends ActorSheet {
|
|||
await this._onSubmit(event);
|
||||
}
|
||||
|
||||
/*
|
||||
// Remove existing modification
|
||||
else if (action === "delete") {
|
||||
const li = a.closest(".learning");
|
||||
li.parentElement.removeChild(li);
|
||||
await this._onSubmit(event);
|
||||
const a = event.currentTarget.closest(".learning");
|
||||
const id = a.dataset["attribute"];
|
||||
this.object.update({ "data.learning": { ["-=" + id]: null } });
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
async _onClickRelationshipControl(event) {
|
||||
console.log("_onClickRelationshipControl")
|
||||
event.preventDefault();
|
||||
const a = event.currentTarget;
|
||||
const action = a.dataset.action;
|
||||
const attrs = this.object.data.data.relationships;
|
||||
const form = this.form;
|
||||
const action = event.currentTarget.dataset.action;
|
||||
|
||||
// Add new modification
|
||||
if (action === "create") {
|
||||
const form = this.form;
|
||||
const nk = new Date().getTime();
|
||||
let newKey = document.createElement("div");
|
||||
|
||||
newKey.innerHTML = `<input class="relation-key" type="text" name="data.relationships.attr${nk}.key" value="attr${nk}" style="display: none;" /><input class="relation-key" type="text" name="data.relationships.attr${nk}.value" value="" style="display: none;" />`;
|
||||
|
||||
form.appendChild(newKey);
|
||||
await this._onSubmit(event);
|
||||
}
|
||||
|
||||
// Remove existing modification
|
||||
else if (action === "delete") {
|
||||
const li = a.closest(".relation");
|
||||
li.parentElement.removeChild(li);
|
||||
await this._onSubmit(event);
|
||||
const ability = $(event.currentTarget).closest(".relation").data("attribute");
|
||||
await this.object.update({ "data.relationships": { ["-=" + ability]: null } });
|
||||
}
|
||||
|
||||
await this._onSubmit(event);
|
||||
}
|
||||
|
||||
async _onClickRelationshipUsed(event) {
|
||||
console.log("_onClickRelationshipUsed")
|
||||
event.stopPropagation();
|
||||
|
||||
const li = $(event.currentTarget).parents(".relation");
|
||||
|
@ -784,8 +916,9 @@ export class ActorSheetKH extends ActorSheet {
|
|||
}
|
||||
|
||||
async _toggleEquippedItem(event) {
|
||||
console.log("_toggleEquippedItem")
|
||||
const li = $(event.currentTarget);
|
||||
const item = this.actor.getOwnedItem(li.data("itemId"));
|
||||
const item = this.actor.items.get(li.data("itemId"));
|
||||
const actor = this.actor;
|
||||
|
||||
if(item) {
|
||||
|
@ -797,7 +930,7 @@ export class ActorSheetKH extends ActorSheet {
|
|||
|
||||
actor.items.map((i) => {
|
||||
if(i.type === "armor") {
|
||||
if(i._id !== item._id && i.data.data.equipable.equipped && i.data?.data?.modifications) {
|
||||
if(i.id !== item.id && i.data.data.equipable.equipped && i.data?.data?.modifications) {
|
||||
for(let k of Object.keys(i.data.data.modifications)) {
|
||||
if(i.data.data.modifications[k].modtype === "init") {
|
||||
initValue = i.data.data.modifications[k].value;
|
||||
|
@ -828,28 +961,30 @@ export class ActorSheetKH extends ActorSheet {
|
|||
}
|
||||
|
||||
async _increaseQuantity(event) {
|
||||
console.log("_increaseQuantity")
|
||||
event.stopPropagation();
|
||||
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
let itemId = li.data("itemId");
|
||||
let item = this.actor.getOwnedItem(itemId);
|
||||
let item = this.actor.items.get(itemId);
|
||||
|
||||
if (!item) {
|
||||
console.log("IMPORT ERROR")
|
||||
console.log("IMPORT ERROR 9")
|
||||
}
|
||||
|
||||
item.update({ ["data.quantity.value"]: item.data.data.quantity.value + 1 });
|
||||
}
|
||||
|
||||
async _decreaseQuantity(event) {
|
||||
console.log("_decreaseQuantity")
|
||||
event.stopPropagation();
|
||||
|
||||
const li = $(event.currentTarget).parents(".item");
|
||||
let itemId = li.data("itemId");
|
||||
let item = this.actor.getOwnedItem(itemId);
|
||||
let item = this.actor.items.get(itemId);
|
||||
|
||||
if (!item) {
|
||||
console.log("IMPORT ERROR")
|
||||
console.log("IMPORT ERROR 10")
|
||||
}
|
||||
|
||||
let count = item.data.data.quantity.value - 1 > 0 ? item.data.data.quantity.value - 1 : 0;
|
||||
|
@ -858,25 +993,27 @@ export class ActorSheetKH extends ActorSheet {
|
|||
}
|
||||
|
||||
async _onChangeSkillValue(event) {
|
||||
console.log("_decreaseQuantity")
|
||||
event.preventDefault();
|
||||
|
||||
const itemId = $(event.currentTarget).data("item-id");
|
||||
let _item = this.actor.items.find((element) => element._id == itemId);
|
||||
let _item = this.actor.items.find((element) => element.id == itemId);
|
||||
|
||||
if (_item) {
|
||||
let update = {
|
||||
_id: _item._id,
|
||||
_id: _item.id,
|
||||
data: { value: $(event.currentTarget).val() },
|
||||
};
|
||||
await this.actor.updateEmbeddedEntity("OwnedItem", update);
|
||||
await this.actor.updateEmbeddedDocuments("Item", [update]);
|
||||
}
|
||||
}
|
||||
|
||||
async _onClickSkill(event) {
|
||||
console.log("_onClickSkill")
|
||||
event.preventDefault();
|
||||
|
||||
const itemId = $(event.currentTarget).data("item-id");
|
||||
let _item = this.actor.items.find((element) => element._id == itemId);
|
||||
let _item = this.actor.items.find((element) => element.id == itemId);
|
||||
|
||||
if (_item) {
|
||||
let newVal = true;
|
||||
|
@ -886,10 +1023,10 @@ export class ActorSheetKH extends ActorSheet {
|
|||
}
|
||||
|
||||
let update = {
|
||||
_id: _item._id,
|
||||
_id: _item.id,
|
||||
data: { used: newVal },
|
||||
};
|
||||
await this.actor.updateEmbeddedEntity("OwnedItem", update);
|
||||
await this.actor.updateEmbeddedDocuments("Item", [update]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -905,14 +1042,15 @@ export class ActorSheetKH extends ActorSheet {
|
|||
* @private
|
||||
*/
|
||||
async _itemDetailsToChat(itemId) {
|
||||
let item = this.actor.getOwnedItem(itemId);
|
||||
console.log("_itemDetailsToChat")
|
||||
let item = this.actor.items.get(itemId);
|
||||
|
||||
if (!item) {
|
||||
item = game.items.get(itemId);
|
||||
}
|
||||
|
||||
if (!item) {
|
||||
console.log("IMPORT ERROR")
|
||||
console.log("IMPORT ERROR 11")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -920,11 +1058,11 @@ export class ActorSheetKH extends ActorSheet {
|
|||
const html = await renderTemplate("systems/kopparhavet/templates/chat/item-card.html", itemDetails);
|
||||
|
||||
const messageData = {
|
||||
user: game.user._id,
|
||||
user: game.user.id,
|
||||
type: CONST.CHAT_MESSAGE_TYPES.OTHER,
|
||||
content: html,
|
||||
speaker: {
|
||||
actor: this.actor._id,
|
||||
actor: this.actor.id,
|
||||
token: this.actor.token,
|
||||
alias: this.actor.name,
|
||||
},
|
||||
|
|
|
@ -13,8 +13,8 @@ export default class ActorHelpers {
|
|||
}, {});
|
||||
|
||||
// Remove modifications which are no longer used
|
||||
if (this.object.data?.data?.relationships) {
|
||||
for (let k of Object.keys(this.object.data.data.relationships)) {
|
||||
if (this.object.data?.relationships) {
|
||||
for (let k of Object.keys(this.object.data.relationships)) {
|
||||
if (!relationships.hasOwnProperty(k)) relationships[`-=${k}`] = null;
|
||||
}
|
||||
}
|
||||
|
@ -36,8 +36,8 @@ export default class ActorHelpers {
|
|||
}, {});
|
||||
|
||||
// Remove modifications which are no longer used
|
||||
if (this.object.data?.data?.learning) {
|
||||
for (let k of Object.keys(this.object.data.data.learning)) {
|
||||
if (this.object.data?.learning) {
|
||||
for (let k of Object.keys(this.object.data.learning)) {
|
||||
if (!learning.hasOwnProperty(k)) learning[`-=${k}`] = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@ export default class KHDiceRoller {
|
|||
|
||||
const roll = new Roll(formula);
|
||||
|
||||
let res = roll.roll();
|
||||
await roll.evaluate();
|
||||
|
||||
let rollData = {
|
||||
name: "SPELL.COST",
|
||||
res: res,
|
||||
res: roll,
|
||||
showFormula: true
|
||||
};
|
||||
|
||||
|
@ -23,9 +23,9 @@ export default class KHDiceRoller {
|
|||
await roll.toMessage({
|
||||
create: true,
|
||||
content: html,
|
||||
user: game.user._id,
|
||||
user: game.user.id,
|
||||
speaker: {
|
||||
actor: speaker._id,
|
||||
actor: speaker.id,
|
||||
token: speaker.token,
|
||||
alias: speaker.name,
|
||||
},
|
||||
|
@ -37,11 +37,11 @@ export default class KHDiceRoller {
|
|||
|
||||
const roll = new Roll(formula);
|
||||
|
||||
let res = roll.roll();
|
||||
await roll.evaluate();
|
||||
|
||||
let rollData = {
|
||||
name: "ITEM.DAMAGE",
|
||||
res: res,
|
||||
res: roll,
|
||||
showFormula: true
|
||||
};
|
||||
|
||||
|
@ -50,9 +50,9 @@ export default class KHDiceRoller {
|
|||
await roll.toMessage({
|
||||
create: true,
|
||||
content: html,
|
||||
user: game.user._id,
|
||||
user: game.user.id,
|
||||
speaker: {
|
||||
actor: speaker._id,
|
||||
actor: speaker.id,
|
||||
token: speaker.token,
|
||||
alias: speaker.name,
|
||||
},
|
||||
|
@ -68,11 +68,11 @@ export default class KHDiceRoller {
|
|||
|
||||
const roll = new Roll(formula);
|
||||
|
||||
let res = roll.roll();
|
||||
await roll.evaluate();
|
||||
|
||||
let rollData = {
|
||||
name: "ITEM.DEFENCE",
|
||||
res: res,
|
||||
res: roll,
|
||||
showFormula: true
|
||||
};
|
||||
|
||||
|
@ -81,19 +81,19 @@ export default class KHDiceRoller {
|
|||
await roll.toMessage({
|
||||
create: true,
|
||||
content: html,
|
||||
user: game.user._id,
|
||||
user: game.user.id,
|
||||
speaker: {
|
||||
actor: speaker._id,
|
||||
actor: speaker.id,
|
||||
token: speaker.token,
|
||||
alias: speaker.name,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async rollSkillInChat(skillName, skillValue, showValue, speaker, openclosed) {
|
||||
async rollSkillInChat(skillName, skillValue, showValue, speaker, openclosed, opposite) {
|
||||
const roll = new Roll(`1d100`);
|
||||
|
||||
let res = roll.roll();
|
||||
await roll.evaluate();
|
||||
|
||||
let computedName = skillName
|
||||
|
||||
|
@ -105,14 +105,28 @@ export default class KHDiceRoller {
|
|||
openclosed = 0
|
||||
}
|
||||
|
||||
if(opposite === undefined) {
|
||||
opposite = []
|
||||
}
|
||||
|
||||
let oppositeValue = ""
|
||||
|
||||
opposite.forEach(function(skill) {
|
||||
if(oppositeValue !== "") {
|
||||
oppositeValue = oppositeValue + " " + game.i18n.localize("ROLL.OR") + " "
|
||||
}
|
||||
oppositeValue = oppositeValue + skill
|
||||
})
|
||||
|
||||
let rollData = {
|
||||
name: computedName,
|
||||
res: res
|
||||
res: roll,
|
||||
opposite: oppositeValue
|
||||
};
|
||||
|
||||
if(skillValue > 0) {
|
||||
let oneRes = Math.floor((res.total / 1) % 10);
|
||||
let tenRes = Math.floor((res.total / 10) % 10);
|
||||
let oneRes = Math.floor((roll.total / 1) % 10);
|
||||
let tenRes = Math.floor((roll.total / 10) % 10);
|
||||
|
||||
if(openclosed < 0) {
|
||||
rollData.closed = Math.abs(openclosed)
|
||||
|
@ -129,7 +143,7 @@ export default class KHDiceRoller {
|
|||
// roll is opened
|
||||
rollData.success = true
|
||||
} else {
|
||||
if (res.total <= skillValue) {
|
||||
if (roll.total <= skillValue) {
|
||||
rollData.success = true
|
||||
} else {
|
||||
rollData.failure = true
|
||||
|
@ -146,16 +160,16 @@ export default class KHDiceRoller {
|
|||
await roll.toMessage({
|
||||
create: true,
|
||||
content: html,
|
||||
user: game.user._id,
|
||||
user: game.user.id,
|
||||
speaker: {
|
||||
actor: speaker._id,
|
||||
actor: speaker.id,
|
||||
token: speaker.token,
|
||||
alias: speaker.name,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async rollSkillDialogInChat(skillName, skillValue, showValue, speaker, startopen) {
|
||||
async rollSkillDialogInChat(skillName, skillValue, showValue, speaker, startopen, opposite) {
|
||||
const id = randomID();
|
||||
|
||||
if(startopen === undefined) {
|
||||
|
@ -180,6 +194,9 @@ export default class KHDiceRoller {
|
|||
const container = document.getElementById(id);
|
||||
let openclosed = container.querySelector('[name="openclosed"]').value
|
||||
|
||||
await this.rollSkillInChat(skillName, skillValue, showValue, speaker, openclosed, opposite)
|
||||
|
||||
/*
|
||||
const roll = new Roll(`1d100`);
|
||||
|
||||
let res = roll.roll();
|
||||
|
@ -239,6 +256,7 @@ export default class KHDiceRoller {
|
|||
alias: speaker.name,
|
||||
},
|
||||
});
|
||||
*/
|
||||
},
|
||||
},
|
||||
two: {
|
||||
|
@ -251,4 +269,208 @@ export default class KHDiceRoller {
|
|||
classes: ["dialog", "kopparhavet"],
|
||||
}).render(true);
|
||||
}
|
||||
|
||||
async rollSkillRitualInChat(ritualName, skills, showValue, speaker, openclosed) {
|
||||
let rollData = {
|
||||
name: ritualName,
|
||||
res: []
|
||||
};
|
||||
|
||||
if(openclosed === undefined) {
|
||||
openclosed = 0
|
||||
}
|
||||
|
||||
if(openclosed < 0) {
|
||||
rollData.closed = Math.abs(openclosed)
|
||||
}
|
||||
|
||||
if(openclosed > 0) {
|
||||
rollData.opened = Math.abs(openclosed)
|
||||
}
|
||||
|
||||
let successes = 0
|
||||
let totalrolls = 0
|
||||
|
||||
for (const skill of skills) {
|
||||
totalrolls++
|
||||
const roll = new Roll(`1d100`);
|
||||
|
||||
await roll.evaluate();
|
||||
|
||||
let skillName = skill.name
|
||||
let success = false
|
||||
let failure = false
|
||||
|
||||
if(showValue) {
|
||||
skillName = skillName + " (" + skill.value + ")"
|
||||
}
|
||||
|
||||
let rollData2 = {
|
||||
name: skillName,
|
||||
res: roll,
|
||||
};
|
||||
|
||||
if(openclosed < 0) {
|
||||
rollData2.closed = Math.abs(openclosed)
|
||||
}
|
||||
|
||||
if(openclosed > 0) {
|
||||
rollData2.opened = Math.abs(openclosed)
|
||||
}
|
||||
|
||||
if(skill.value > 0) {
|
||||
let oneRes = Math.floor((roll.total / 1) % 10);
|
||||
//let tenRes = Math.floor((res.total / 10) % 10);
|
||||
|
||||
if(openclosed < 0 && oneRes !== 0 && Math.abs(openclosed) >= oneRes) {
|
||||
// roll is closed
|
||||
failure = true
|
||||
} else if(openclosed > 0 && oneRes !== 0 && Math.abs(openclosed) >= oneRes){
|
||||
// roll is opened
|
||||
success = true
|
||||
successes++
|
||||
} else {
|
||||
if (roll.total <= skill.value) {
|
||||
success = true
|
||||
successes++
|
||||
} else {
|
||||
failure = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rollData.res.push({
|
||||
name: skillName,
|
||||
failure: failure,
|
||||
success: success,
|
||||
result: roll,
|
||||
})
|
||||
|
||||
rollData2.success = success
|
||||
rollData2.failure = failure
|
||||
|
||||
const html = await renderTemplate("systems/kopparhavet/templates/dice/roll.html", rollData2);
|
||||
|
||||
await roll.toMessage({
|
||||
create: true,
|
||||
content: html,
|
||||
user: game.user.id,
|
||||
speaker: {
|
||||
actor: speaker.id,
|
||||
token: speaker.token,
|
||||
alias: speaker.name,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
switch (totalrolls) {
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
if(successes === 0) {
|
||||
rollData.result = "0"
|
||||
} else if(successes === 1) {
|
||||
rollData.result = "2"
|
||||
} else if(successes === 2) {
|
||||
rollData.result = "3"
|
||||
} else if(successes === 3) {
|
||||
rollData.result = "4"
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
if(successes === 0) {
|
||||
rollData.result = "0"
|
||||
} else if(successes === 1) {
|
||||
rollData.result = "1"
|
||||
} else if(successes === 2) {
|
||||
rollData.result = "2"
|
||||
} else if(successes === 3) {
|
||||
rollData.result = "3"
|
||||
} else if(successes === 4) {
|
||||
rollData.result = "4"
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
if(successes === 0) {
|
||||
rollData.result = "0"
|
||||
} else if(successes === 1) {
|
||||
rollData.result = "1"
|
||||
} else if(successes === 2) {
|
||||
rollData.result = "1"
|
||||
} else if(successes === 3) {
|
||||
rollData.result = "2"
|
||||
} else if(successes === 4) {
|
||||
rollData.result = "3"
|
||||
} else if(successes === 5) {
|
||||
rollData.result = "4"
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
const html = await renderTemplate("systems/kopparhavet/templates/dice/ritual-roll.html", rollData);
|
||||
|
||||
/*
|
||||
await roll.toMessage({
|
||||
create: true,
|
||||
content: html,
|
||||
user: game.user._id,
|
||||
speaker: {
|
||||
actor: speaker._id,
|
||||
token: speaker.token,
|
||||
alias: speaker.name,
|
||||
},
|
||||
});
|
||||
*/
|
||||
|
||||
await ChatMessage.create({
|
||||
create: true,
|
||||
content: html,
|
||||
user: game.user.id,
|
||||
speaker: {
|
||||
actor: speaker.id,
|
||||
token: speaker.token,
|
||||
alias: speaker.name,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
async rollSkillChallangeDialogInChat(name, skills, showValue, speaker, startopen) {
|
||||
const id = randomID();
|
||||
|
||||
if(startopen === undefined) {
|
||||
startopen = 0
|
||||
}
|
||||
|
||||
const content = await renderTemplate("systems/kopparhavet/templates/roll-dialog.html", {
|
||||
id,
|
||||
startopen,
|
||||
name,
|
||||
});
|
||||
|
||||
await new Dialog({
|
||||
title: game.i18n.localize("ROLL.TITLE"),
|
||||
content,
|
||||
buttons: {
|
||||
one: {
|
||||
icon: '<i class="fas fa-check"></i>',
|
||||
label: game.i18n.localize("BUTTON.ROLL"),
|
||||
callback: async () => {
|
||||
const container = document.getElementById(id);
|
||||
let openclosed = container.querySelector('[name="openclosed"]').value
|
||||
|
||||
await this.rollSkillRitualInChat(name, skills, showValue, speaker, openclosed)
|
||||
},
|
||||
},
|
||||
two: {
|
||||
icon: '<i class="fas fa-times"></i>',
|
||||
label: game.i18n.localize("BUTTON.CANCEL"),
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
classes: ["dialog", "kopparhavet"],
|
||||
}).render(true);
|
||||
}
|
||||
}
|
|
@ -17,8 +17,8 @@ export default class ItemHelpers {
|
|||
}, {});
|
||||
|
||||
// Remove modifications which are no longer used
|
||||
if (this.object.data?.data?.modifications) {
|
||||
for (let k of Object.keys(this.object.data.data.modifications)) {
|
||||
if (this.object.data?.modifications) {
|
||||
for (let k of Object.keys(this.object.data.modifications)) {
|
||||
if (!modifications.hasOwnProperty(k)) modifications[`-=${k}`] = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ export class ItemSheetKH extends ItemSheet {
|
|||
data.dtypes = ["String", "Number", "Boolean"];
|
||||
|
||||
if (data?.data?.modifications) {
|
||||
for (let attr of Object.values(data.data.modifications)) {
|
||||
for (let attr of Object.values(data.modifications)) {
|
||||
attr.isCheckbox = attr.dtype === "Boolean";
|
||||
}
|
||||
}
|
||||
|
@ -39,23 +39,32 @@ export class ItemSheetKH extends ItemSheet {
|
|||
let skillList2
|
||||
|
||||
if(game.settings.get("kopparhavet", "gameSystem") === "hjaltarnas-tid") {
|
||||
skillList2 = await game.packs.get("kopparhavet.skills-ht").getContent();
|
||||
skillList2 = await game.packs.get("kopparhavet.skills-ht").getDocuments();
|
||||
} else {
|
||||
skillList2 = await game.packs.get("kopparhavet.skills").getContent();
|
||||
skillList2 = await game.packs.get("kopparhavet.skills").getDocuments();
|
||||
}
|
||||
|
||||
for (let item of skillList2) {
|
||||
if(item.data.type === "skill" && item.data.data.type.value === "combat") {
|
||||
skillList.push(item)
|
||||
skillList.push(item.data)
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieve any created skills as well
|
||||
for (let item of game.items.entities) {
|
||||
game.items.forEach((item) => {
|
||||
if(item.data.type === "skill" && item.data.data.type.value === "combat") {
|
||||
skillList.push(item)
|
||||
skillList.push(item.data)
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
for (let item of game.items.entities) {
|
||||
if(item.data.type === "skill" && item.data.type.value === "combat") {
|
||||
skillList.push(item.data)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
this.position.width = 530;
|
||||
this.position.height = 750;
|
||||
break;
|
||||
|
@ -77,23 +86,33 @@ export class ItemSheetKH extends ItemSheet {
|
|||
let skillList3
|
||||
|
||||
if(game.settings.get("kopparhavet", "gameSystem") === "hjaltarnas-tid") {
|
||||
skillList3 = await game.packs.get("kopparhavet.skills-ht").getContent();
|
||||
skillList3 = await game.packs.get("kopparhavet.skills-ht").getDocuments();
|
||||
} else {
|
||||
skillList3 = await game.packs.get("kopparhavet.skills").getContent();
|
||||
skillList3 = await game.packs.get("kopparhavet.skills").getDocuments();
|
||||
}
|
||||
|
||||
for (let item of skillList3) {
|
||||
if(item.data.type === "skill") {
|
||||
skillList.push(item)
|
||||
skillList.push(item.data)
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieve any created skills as well
|
||||
game.items.forEach((item) => {
|
||||
if(item.data.type === "skill") {
|
||||
skillList.push(item.data)
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
// Retrieve any created skills as well
|
||||
for (let item of game.items.entities) {
|
||||
if(item.data.type === "skill") {
|
||||
skillList.push(item)
|
||||
skillList.push(item.data)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
this.position.width = 450;
|
||||
this.position.height = 605;
|
||||
break;
|
||||
|
@ -102,23 +121,32 @@ export class ItemSheetKH extends ItemSheet {
|
|||
let skillList4
|
||||
|
||||
if(game.settings.get("kopparhavet", "gameSystem") === "hjaltarnas-tid") {
|
||||
skillList4 = await game.packs.get("kopparhavet.skills-ht").getContent();
|
||||
skillList4 = await game.packs.get("kopparhavet.skills-ht").getDocuments();
|
||||
} else {
|
||||
skillList4 = await game.packs.get("kopparhavet.skills").getContent();
|
||||
skillList4 = await game.packs.get("kopparhavet.skills").getDocuments();
|
||||
}
|
||||
|
||||
for (let item of skillList4) {
|
||||
if(item.data.type === "skill" && item.data.data.type.value === "combat") {
|
||||
skillList.push(item)
|
||||
skillList.push(item.data)
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieve any created skills as well
|
||||
game.items.forEach((item) => {
|
||||
if(item.data.type === "skill" && item.data.data.type.value === "combat") {
|
||||
skillList.push(item.data)
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
// Retrieve any created skills as well
|
||||
for (let item of game.items.entities) {
|
||||
if(item.data.type === "skill" && item.data.data.type.value === "combat") {
|
||||
skillList.push(item)
|
||||
skillList.push(item.data)
|
||||
}
|
||||
}
|
||||
*/
|
||||
this.position.width = 530;
|
||||
this.position.height = 750;
|
||||
break;
|
||||
|
@ -146,11 +174,11 @@ export class ItemSheetKH extends ItemSheet {
|
|||
const clickedName = $(ev.currentTarget).data("name");
|
||||
|
||||
if(clickedName === "equipped") {
|
||||
const equppiedValue = this.item.data.data.equipable.equipped;
|
||||
const equppiedValue = this.item.data.equipable.equipped;
|
||||
|
||||
this.item.update({ "data.equipped.equipped": !equppiedValue });
|
||||
} else {
|
||||
const clickedValue = (this.item.data.data[clickedName].value == undefined ? false : this.item.data.data[clickedName].value);
|
||||
const clickedValue = (this.item.data[clickedName].value == undefined ? false : this.item.data[clickedName].value);
|
||||
let dataName = "data." + clickedName + ".value"
|
||||
let tempData = {}
|
||||
|
||||
|
@ -174,7 +202,7 @@ export class ItemSheetKH extends ItemSheet {
|
|||
event.preventDefault();
|
||||
const a = event.currentTarget;
|
||||
const action = a.dataset.action;
|
||||
const attrs = this.object.data.data.modifications;
|
||||
const attrs = this.object.data.modifications;
|
||||
const form = this.form;
|
||||
|
||||
// Add new modification
|
||||
|
|
|
@ -27,7 +27,7 @@ export class ItemKH extends Item {
|
|||
const html = await renderTemplate("systems/kopparhavet/templates/chat/item-card.html", itemData);
|
||||
|
||||
const chatData = {
|
||||
user: game.user._id,
|
||||
user: game.user.id,
|
||||
rollMode: game.settings.get("core", "rollMode"),
|
||||
content: html,
|
||||
};
|
||||
|
|
|
@ -57,7 +57,7 @@ class KHDice {
|
|||
const html2 = await renderTemplate("systems/kopparhavet/templates/dice/roll.html", rollData);
|
||||
|
||||
await |