diff --git a/lang/en.json b/lang/en.json
index 0530a81..70d1616 100644
--- a/lang/en.json
+++ b/lang/en.json
@@ -23,6 +23,7 @@
"CURRENCY.QUARTER": "Quarter",
"CURRENCY.SHEKEL": "Shekel",
"CURRENCY.TITLE": "Currency",
+ "CURRENCY.SILVER": "Silver",
"DICE.ROLL": "Dice roll",
diff --git a/lang/sv.json b/lang/sv.json
index 8a2f3a7..04ec44e 100644
--- a/lang/sv.json
+++ b/lang/sv.json
@@ -24,6 +24,7 @@
"CURRENCY.QUARTER": "Kvarting",
"CURRENCY.SHEKEL": "Shekel",
"CURRENCY.TITLE": "Mynt",
+ "CURRENCY.SILVER": "Silver",
"DICE.ROLL": "Tärningsslag",
diff --git a/module/actors/actor-sheet.js b/module/actors/actor-sheet.js
index 252183a..74b2937 100644
--- a/module/actors/actor-sheet.js
+++ b/module/actors/actor-sheet.js
@@ -200,6 +200,85 @@ export class ActorSheetKH extends ActorSheet {
},
]);
+ new ContextMenu(html, "li.item-spell", [
+ {
+ name: game.i18n.localize("MENU.SHOWROLLDIALOG"),
+ icon: '',
+ callback: (li) => {
+ let itemId = li.data("itemId");
+ let _item = this.actor.items.find((element) => element._id == itemId);
+
+ if (!_item) {
+ _item = game.items.get(itemId);
+
+ if (!_item) {
+ console.log("IMPORT ERROR")
+ return
+ }
+ }
+
+ let showValue = false
+ let difficulty = 0
+
+ if(this.actor.data.type === "character") {
+ showValue = true
+ }
+
+ switch (_item.data.data.difficulty.value) {
+ case "simple":
+ difficulty = 5
+ break;
+ case "easy":
+ difficulty = 2
+ break;
+ case "hard":
+ difficulty = -2
+ break;
+ case "daunting":
+ difficulty = -5
+ break;
+ }
+
+ if(_item.data.data.roll.value === "roll" || _item.data.data.roll.value === "attackroll") {
+ // Retrieve skill based on name
+ let skill = this.actor.items.find((element) => element.name === _item.data.data.roll.skill);
+
+ let skillName = _item.name
+ let skillValue = skill.data.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") {
+ // Retrieve skill based on name
+ let skill = this.actor.items.find((element) => element.name === _item.data.data.roll.skill);
+
+ let skillName = _item.name
+ let skillValue = skill.data.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)
+ }
+ },
+ },
+ {
+ name: game.i18n.localize("MENU.SENTTOCHAT"),
+ icon: '',
+ callback: (li) => {
+ let itemId = li.data("itemId");
+ this._itemDetailsToChat(itemId);
+ },
+ },
+ ]);
+
new ContextMenu(html, "li.item-attack", [
{
name: game.i18n.localize("MENU.SHOWROLLDIALOG"),
@@ -226,6 +305,20 @@ export class ActorSheetKH extends ActorSheet {
},
]);
+ new ContextMenu(html, "li.item-defence", [
+ {
+ name: game.i18n.localize("MENU.SHOWROLLDIALOG"),
+ icon: '',
+ callback: (li) => {
+ const skillValue = li.data("defence");
+
+ let skillName = "ADVERSARY.DEFENCE";
+
+ this.khRoller.rollSkillDialogInChat(skillName, skillValue, false, this.actor)
+ },
+ }
+ ]);
+
html.find(".feature").click(async (ev) => {
const featureName = $(ev.currentTarget).data("feature");
const featureValue = this.actor.data.data.feature[featureName].value;
@@ -245,6 +338,33 @@ 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"));
+
+ if(item) {
+ if (item.type === "armor") {
+ let initValue = -1
+
+ if (item.data.data.equipable.equipped) {
+ initValue = 4
+
+ 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 (initValue > 0) {
+ this.actor.update({["data.combat.init"]: initValue});
+ }
+ }
+ }
this.actor.deleteOwnedItem(li.data("itemId"));
@@ -336,17 +456,25 @@ export class ActorSheetKH extends ActorSheet {
// Retrieve skill based on name
let skill = this.actor.items.find((element) => element.name === spell.data.data.roll.skill);
- let skillName = spell.name + " (" + skill.name + ")"
+ let skillName = spell.name
let skillValue = skill.data.data.value
+ if(this.actor.data.type === "character") {
+ skillName = spell.name + " (" + skill.name + ")"
+ }
+
this.khRoller.rollSkillInChat(skillName, skillValue, showValue, this.actor, difficulty)
} else if(spell.data.data.roll.value === "opposite") {
// Retrieve skill based on name
let skill = this.actor.items.find((element) => element.name === spell.data.data.roll.skill);
- let skillName = spell.name + " (" + skill.name + ")"
+ let skillName = spell.name
let skillValue = skill.data.data.value
+ if(this.actor.data.type === "character") {
+ skillName = spell.name + " (" + skill.name + ")"
+ }
+
this.khRoller.rollSkillInChat(skillName, skillValue, showValue, this.actor, difficulty)
} else if(spell.data.data.roll.value === "ritual") {
console.log("Not supported yet")
diff --git a/module/kh-hooks.js b/module/kh-hooks.js
index 49a7fb0..650d0ce 100644
--- a/module/kh-hooks.js
+++ b/module/kh-hooks.js
@@ -6,6 +6,9 @@ export default class KHHooks {
let actorbaseSkills;
if(game.settings.get("kopparhavet", "gameSystem") === "hjaltarnas-tid") {
+ // Set currency name
+ actor.update({ "data.currency.shekel.label": "CURRENCY.SILVER" });
+
actorbaseSkills = CONFIG.KH.baseSkillsHT
skillIndex = await game.packs.get("kopparhavet.skills-ht").getContent();
} else {
diff --git a/module/kh-main.js b/module/kh-main.js
index 18a5432..86d5a46 100644
--- a/module/kh-main.js
+++ b/module/kh-main.js
@@ -169,6 +169,20 @@ function registerHandlebarsHelpers() {
}
});
+ Handlebars.registerHelper("spellRoll", function (roll) {
+ roll = normalize(roll, "roll");
+ switch (roll) {
+ case "roll":
+ return game.i18n.localize("SPELL.ROLL");
+ case "attackroll":
+ return game.i18n.localize("SPELL.ATTACKROLL");
+ case "opposite":
+ return game.i18n.localize("SPELL.OPPOSITE");
+ case "ritual":
+ return game.i18n.localize("SPELL.RITUAL");
+ }
+ });
+
Handlebars.registerHelper('plaintextToHTML', function(value) {
// strip tags, add
tags
return new Handlebars.SafeString(value.replace(/(<([^>]+)>)/gi, "").replace(/(?:\r\n|\r|\n)/g, '
'));
diff --git a/styles/items.css b/styles/items.css
index 12964f9..43472d5 100644
--- a/styles/items.css
+++ b/styles/items.css
@@ -100,14 +100,9 @@
.items .items-list .item,
.items .items-list .item-spell,
.items .items-list .item-weapon,
-.items .items-list .item-skill {
- line-height: 24px;
- padding: 3px 0;
- border-bottom: 1px solid #bbb;
- text-align: center;
-}
-
-.items .items-list .item-nor {
+.items .items-list .item-skill,
+.items .items-list .item-nor,
+.items .items-list .item-defence {
line-height: 24px;
padding: 3px 0;
border-bottom: 1px solid #bbb;
diff --git a/system.json b/system.json
index 39f7639..90b6749 100644
--- a/system.json
+++ b/system.json
@@ -53,6 +53,6 @@
"url": "https://pi.rikspolisen.se/foundryvtt/kopparhavet",
"socket": true,
"manifest": "https://pi.rikspolisen.se/foundryvtt/kopparhavet/raw/branch/master/system.json",
- "download": "https://pi.rikspolisen.se/foundryvtt/kopparhavet/archive/v0.1.zip",
+ "download": "https://pi.rikspolisen.se/foundryvtt/kopparhavet/archive/v0.0.3.zip",
"license": ""
}
diff --git a/templates/chat/item-card.html b/templates/chat/item-card.html
index 553e89b..ec4f581 100644
--- a/templates/chat/item-card.html
+++ b/templates/chat/item-card.html
@@ -74,8 +74,7 @@
{{localize data.cost.label}}: {{data.cost.value}}
{{localize data.difficulty.label}}: {{rollDifficulty data.difficulty.value}}