diff --git a/src/lang/en.json b/src/lang/en.json index f984068..2c36ccc 100644 --- a/src/lang/en.json +++ b/src/lang/en.json @@ -25,6 +25,7 @@ "OSE.Retainer": "Retainer", "OSE.Appearing": "NA", "OSE.Attack": "Attack", + "OSE.Encumbrance": "Encumbrance", "OSE.Loyalty": "Loyalty Rating", "OSE.LoyaltyShort": "LR", @@ -116,11 +117,16 @@ "OSE.Setting.THAC0AttacksHint": "Attacks are resolved using the THAC0 value, not compatible with AAC", "OSE.Setting.VariableWeaponDamage": "Variable Weapon Damage", "OSE.Setting.VariableWeaponDamageHint": "Weapons have different damage dice", + "OSE.Setting.Encumbrance": "Encumbrance", + "OSE.Setting.EncumbranceHint": "Choose the way encumbrance is calculated", + "OSE.Setting.EncumbranceBasic": "Basic", + "OSE.Setting.EncumbranceDetailed": "Detailed", "OSE.items.Equip": "Equip", "OSE.items.Unequip": "Unequip", "OSE.items.Misc": "Misc", "OSE.items.Weapons": "Weapons", + "OSE.items.Treasure": "Treasure", "OSE.items.Armors": "Armors", "OSE.items.Weight": "Wgt.", "OSE.items.Qualities": "Qualities", diff --git a/src/module/actor/character-sheet.js b/src/module/actor/character-sheet.js index b474502..89d584a 100644 --- a/src/module/actor/character-sheet.js +++ b/src/module/actor/character-sheet.js @@ -52,6 +52,35 @@ export class OseActorSheetCharacter extends OseActorSheet { data.config.individualInit = game.settings.get("ose", "individualInit"); data.mods = this.actor.computeModifiers(); + + // Compute treasure + let total = 0; + data.owned.items.forEach(item => { + if (item.data.treasure) { + total += item.data.quantity.value * item.data.cost; + } + }); + data.treasure = total; + + let basic = game.settings.get('ose', 'encumbranceOption') == 'basic'; + // Compute encumbrance + let totalWeight = 0; + Object.values(data.owned).forEach(cat => { + cat.forEach(item => { + if (item.type == 'item' && (!basic || item.data.treasure)) { + totalWeight += item.data.quantity.value * item.data.weight; + } + else if (!basic) { + totalWeight += item.data.weight; + } + }) + }); + data.encumbrance = { + pct: Math.clamped(100 * parseFloat(totalWeight) / data.data.encumbrance.max, 0, 100), + max: data.data.encumbrance.max, + encumbered: totalWeight > data.data.encumbrance.max, + value: totalWeight + }; return data; } diff --git a/src/module/helpers.js b/src/module/helpers.js index 3613183..a2fabf5 100644 --- a/src/module/helpers.js +++ b/src/module/helpers.js @@ -17,7 +17,7 @@ export const registerHelpers = async function () { }); Handlebars.registerHelper("mult", function (lh, rh) { - return parseInt(lh) * parseInt(rh); + return parseFloat(lh) * parseFloat(rh); }); Handlebars.registerHelper("counter", function (status, value, max) { diff --git a/src/module/settings.js b/src/module/settings.js index 1b8af94..c58d51b 100644 --- a/src/module/settings.js +++ b/src/module/settings.js @@ -1,38 +1,51 @@ export const registerSettings = function () { - game.settings.register('ose', 'individualInit', { - name: game.i18n.localize('OSE.Setting.IndividualInit'), - hint: game.i18n.localize('OSE.Setting.IndividualInitHint'), - default: false, - scope: 'world', - type: Boolean, - config: true - }); + game.settings.register("ose", "individualInit", { + name: game.i18n.localize("OSE.Setting.IndividualInit"), + hint: game.i18n.localize("OSE.Setting.IndividualInitHint"), + default: false, + scope: "world", + type: Boolean, + config: true, + }); - game.settings.register('ose', 'ascendingAC', { - name: game.i18n.localize('OSE.Setting.AscendingAC'), - hint: game.i18n.localize('OSE.Setting.AscendingACHint'), - default: false, - scope: 'world', - type: Boolean, - config: true - }); + game.settings.register("ose", "ascendingAC", { + name: game.i18n.localize("OSE.Setting.AscendingAC"), + hint: game.i18n.localize("OSE.Setting.AscendingACHint"), + default: false, + scope: "world", + type: Boolean, + config: true, + }); - game.settings.register('ose', 'morale', { - name: game.i18n.localize('OSE.Setting.Morale'), - hint: game.i18n.localize('OSE.Setting.MoraleHint'), - default: false, - scope: 'world', - type: Boolean, - config: true - }); + game.settings.register("ose", "morale", { + name: game.i18n.localize("OSE.Setting.Morale"), + hint: game.i18n.localize("OSE.Setting.MoraleHint"), + default: false, + scope: "world", + type: Boolean, + config: true, + }); - game.settings.register('ose', 'variableWeaponDamage', { - name: game.i18n.localize('OSE.Setting.VariableWeaponDamage'), - hint: game.i18n.localize('OSE.Setting.VariableWeaponDamageHint'), - default: false, - scope: 'world', - type: Boolean, - config: true - }); -} - \ No newline at end of file + game.settings.register("ose", "variableWeaponDamage", { + name: game.i18n.localize("OSE.Setting.VariableWeaponDamage"), + hint: game.i18n.localize("OSE.Setting.VariableWeaponDamageHint"), + default: false, + scope: "world", + type: Boolean, + config: true, + }); + + game.settings.register("ose", "encumbranceOption", { + name: game.i18n.localize("OSE.Setting.Encumbrance"), + hint: game.i18n.localize("OSE.Setting.EncumbranceHint"), + default: false, + scope: "world", + type: String, + config: true, + default: "detailed", + choices: { + basic: "OSE.Setting.EncumbranceBasic", + detailed: "OSE.Setting.EncumbranceDetailed", + }, + }); +}; diff --git a/src/scss/actor-base.scss b/src/scss/actor-base.scss index 6997ee5..3c9990f 100644 --- a/src/scss/actor-base.scss +++ b/src/scss/actor-base.scss @@ -137,11 +137,12 @@ } .attribute-mod { position: absolute; - color: $colorTan; + color: $colorFaint; + text-shadow: 0 0 2px black; right: 1px; top: 1px; line-height: 10px; - font-size: 10px; + font-size: 8px; } .attribute-bonuses { display: none; @@ -196,7 +197,7 @@ } .item-titles { text-align: center; - padding: 4px; + padding: 4px 0; border: 1px solid $colorDark; box-shadow: 0 0 5px $colorDark; .item-name { @@ -298,7 +299,7 @@ } .item-controls { font-size: 12px; - flex-basis: 60px; + flex-basis: 50px; flex-grow: 0; text-align: right; margin-right: 4px; diff --git a/src/scss/character.scss b/src/scss/character.scss index 0f24094..01376aa 100644 --- a/src/scss/character.scss +++ b/src/scss/character.scss @@ -81,6 +81,68 @@ } } } + + /* Encumbrance Bar */ + .encumbrance { + height: 12px; + background: $darkBackground; + margin: 1px 15px 0 1px; + border: 1px solid $colorDark; + border-radius: 3px; + position: relative; + + .encumbrance-bar { + position: absolute; + background: rgba(255, 0, 0, 0.6); + height: 10px; + border: 1px solid #777; + border-radius: 2px; + } + + .encumbrance-label { + height: 10px; + padding: 0 5px; + position: absolute; + top: 0; + right: 10px; + font-size: 13px; + line-height: 12px; + text-align: right; + color: #EEE; + text-shadow: 0 0 5px #000; + } + + .encumbrance-breakpoint { + display: block; + position: absolute; + &.encumbrance-25 { left: 25% } + &.encumbrance-50 { left: 50% } + &.encumbrance-75 { left: 75% } + } + + .arrow-up { + bottom: 0; + width: 0; + height: 0; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-bottom: 4px solid $colorFaint; + } + + .arrow-down { + top: 0; + width: 0; + height: 0; + border-left: 4px solid transparent; + border-right: 4px solid transparent; + border-top: 4px solid $colorFaint; + } + + &.encumbered { + .arrow-up { border-bottom: 4px solid $colorDark; } + .arrow-down { border-top: 4px solid $colorDark; } + } + } /* ----------------------------------------- */ /* Item Controls */ /* ----------------------------------------- */ diff --git a/src/scss/variables.scss b/src/scss/variables.scss index a04b483..6a21dca 100644 --- a/src/scss/variables.scss +++ b/src/scss/variables.scss @@ -5,7 +5,7 @@ $darkBackground: url('/systems/ose/assets/back.png'); $colorDark: rgba(0, 0, 0, 0.9); -$colorFaint: #c9c7b8; +$colorFaint: #d8d6c9; $colorBeige: #b5b3a4; $colorTan: #7a7971; $colorOlive: #4b4a44; diff --git a/src/template.json b/src/template.json index 030209d..01e4953 100644 --- a/src/template.json +++ b/src/template.json @@ -13,12 +13,10 @@ "max": 20 }, "ac": { - "naked": 0, "value": 0, "mod": 0 }, "aac": { - "naked": 0, "value": 0, "mod": 0 }, @@ -118,15 +116,13 @@ "mod": 0 } }, - "currency": { - "gold": 0, - "silver": 0, - "copper": 0 - }, "initative": { "value": 0, "mod": 0 }, + "encumbrance": { + "max": 1600 + }, "languages": [] }, "monster": { @@ -151,6 +147,7 @@ "value": 1, "max": 0 }, + "treasure": false, "cost": 0, "weight": 80 }, diff --git a/src/templates/actors/dialogs/tweaks-dialog.html b/src/templates/actors/dialogs/tweaks-dialog.html index 9693a3a..036f5ca 100644 --- a/src/templates/actors/dialogs/tweaks-dialog.html +++ b/src/templates/actors/dialogs/tweaks-dialog.html @@ -71,6 +71,18 @@ /> +