From c968e7bb3750b017fd01324ac088c79c8158b214 Mon Sep 17 00:00:00 2001 From: "gitlocalize-app[bot]" <55277160+gitlocalize-app[bot]@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:49:29 -0500 Subject: [PATCH 1/3] chore: Translate ru.json via GitLocalize (#1655) Authored-by: Duugrim --- static/lang/ru.json | 157 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 156 insertions(+), 1 deletion(-) diff --git a/static/lang/ru.json b/static/lang/ru.json index 313c77a1f..7985dd464 100644 --- a/static/lang/ru.json +++ b/static/lang/ru.json @@ -316,28 +316,183 @@ "RequestRoll": "Запросить бросок", "GMRequestsRoll": "ГМ запрашивает _TYPE_ проверку.", "normal": "обычный", + "AbilityCheck": "Проверка способности/характеристики", + "ApplyDamage": "Применить урон", + "ApplyDestructiveDamage": "Применить разрушительный урон (10x)", + "ApplyReducedDamage": "Применить незначительный урон (0.1x)", + "ApplyHealing": "Применить лечение", "DegreesOfSuccess": { + "ExceptionalFailure": "Исключительный Провал", + "Failure": "Провал", + "AverageFailure": "Средний Провал", + "MarginalFailure": "Незначительный Провал", + "MarginalSuccess": "Незначительный Успех", + "AverageSuccess": "Средний Успех", + "Success": "Успех", + "ExceptionalSuccess": "Исключительный Успех", + "none": "Нет", + "CE": "Cepheus Engine", + "other": "Другое" }, "RangeModifierTypes": { + "none": "Нет", + "singleBand": "Одно значение", + "doubleBand": "Два значения" }, "WeaponRangeTypes": { + "closeQuarters": "Ближний Бой", + "CQ": "ББ", + "extendedReach": "Увеличенная Дальность", + "reach": "Дальность", + "thrown": "Метательный", + "pistol": "Пистолет", + "rifle": "Винтовка", + "shotgun": "Дробовик", + "assaultWeapon": "Тяжёлое Орудие", + "AW": "ТО", + "rocket": "Ракета", + "none": "Нет", + "hands": "Руки", + "claws": "Когти", + "teeth": "Зубы", + "horns": "Рога", + "hooves": "Копыта", + "stinger": "Жало", + "thrasher": "Трэшер", + "club": "Дубина", + "dagger": "Кинжал", + "blade": "Лезвие", + "foil": "Рапира", + "cutlass": "Сабля", + "sword": "Меч", + "broadsword": "Палаш", + "bayonet": "Штык", + "spear": "Копье", + "halberd": "Алебарда", + "pike": "Пика", + "cudgel": "Палица", + "bodyPistol": "Пистолет (нательный)", + "autoPistol": "Пистолет (автоматический)", + "revolver": "Револьвер", + "carbine": "Карабин", + "autoRifle": "Автоматическая Винтовка", + "submachinegun": "Пистолет-пулемет", + "laserCarbine": "Лазерный карабин", + "laserRifle": "Лазерная винтовка", + "thras": "Треш", + "cutl": "Сабл", + "brdswd": "Палаш", + "bynt": "Штык", + "halb": "Алеб", + "bPistl": "ПистН", + "aPistl": "ПистА", + "AR": "АВ", + "subm": "ПП", + "LC": "ЛК", + "LR": "ЛВ", + "custom": "Кастомный", + "cust": "Кастом" }, "RangeBandTypes": { + "personal": "Персональная", + "close": "Близкая", + "short": "Короткая", + "medium": "Средняя", + "long": "Длинная", + "veryLong": "Очень Длинная", + "distant": "Дальняя", + "none": "Нет" }, "ArmorTypes": { - } + "nothing": "Ничего", + "jack": "Кожа", + "mesh": "Сетка", + "cloth": "Ткань", + "reflec": "Рефлек", + "ablat": "Аблат", + "combat": "Бой" + }, + "Dice": "Кость" } }, "Table": { + "TableResults": "Результаты таблицы" }, + "Create": "Создать", "Handlebars": { + "CantShowCharacteristic": "Вам необходимо перевыбрать характеристики для всех навыков, отмеченных XXX. Извините..." }, "Items": { + "Encumbrance": "Загруженность", + "Enc": "Вес", + "DocumentReference": "Референс на документ", + "Link": "Ссылка", + "DeleteReference": "Удалить референс", "Armor": { + "Armor": "Броня", + "PrimaryArmor": "Основная броня", + "SecondaryArmor": "Вторичная броня", + "TotalArmor": "Полная броня", + "RadProt": "Защита от радиации", + "IsPowered": "Силовая броня", + "Nonstackable": "Не стакается", + "SecondaryArmorProtectionTypes": "Типы вторичной защиты", + "armorDM": "DM", + "ArmorModifier": "Модификатор брони", + "ArmorType": "Тип брони", + "WearingReflec": "Носимый Рефлек" }, "Augmentation": { + "Arms": "Руки", + "AugEffect": "Эффект", + "AugLocation": "Место Аугментации", + "FullBody": "Всё Тело", + "Head": "Голова", + "Legs": "Ноги", + "Torso": "Туловище", + "None": "Нет", + "ValueCr": "Цена в Кр" }, "Component": { + "Ammunition": "Боеприпасы", + "componentName": "Компонент", + "accomodations": "каюты", + "armament": "вооружение", + "armor": "броня", + "bridge": "мостик", + "cargo": "груз", + "computer": "компьютер", + "dock": "док", + "drive": "двигатель", + "drone": "дрон", + "electronics": "электроника", + "fuel": "топливо", + "hull": "корпус", + "mount": "гнездо", + "power": "энергоустановка", + "sensor": "сенсор", + "shield": "щит", + "software": "программа", + "storage": "хранилище", + "vehicle": "техника", + "other": "прочее", + "otherExternal": "прочее - внешнее", + "otherInternal": "прочее - внутреннее", + "operational": "в строю", + "damaged": "повреждено", + "destroyed": "уничтожено", + "off": "выключено", + "powerDraw": "Потребляемая Энергия", + "powerGenerated": "Вырабатываемая Энергия", + "Power": "Энергия", + "status": "Статус", + "rating": "Рейтинг", + "Range": "Дистанция", + "totalQuantity": "Общее количество", + "availableQuantity": "Доступное количество", + "damage": "Урон", + "RadiationDamage": "Урон Радиацией", + "hits": "Хиты" }, "Equipment": { }, From dc1db8fd12d632f0b64412e3499fafa554a9eaa6 Mon Sep 17 00:00:00 2001 From: marvin9257 <72580196+marvin9257@users.noreply.github.com> Date: Tue, 8 Oct 2024 08:47:40 -0500 Subject: [PATCH 2/3] fix: button changes, component qty, and AE fixes (#1653) This update fixes several issue: * Robots and animals can now use active effects on skills - per comedian999 * Pressing enter on actor sheets no longer triggers initiative roll by default * Pressing enter on item sheets no longer trigger new active effect by default * Component state toggling on vehicle and battle sheet now works as intended * Armament quantity fixed and add popup indicator added for vehicle sheets * Component list headers on ship sheet are 'sticky' again * Prevents console error when entering negative skill values * Corrects error if weapon skill link is invalid * Improves tooltip for AE to include .mod and encumbrance.max values NOTE: Please test your world(s) before using in a real session. There have been many small changes with this release. --- src/module/entities/TwodsixActor.ts | 16 ++++++--- src/module/entities/TwodsixItem.ts | 10 +++--- src/module/handlebars.ts | 27 ++++++++++++--- src/module/hooks/addGMControlButtons.ts | 4 +-- src/module/hooks/diceTrayIntegration.ts | 2 +- .../sheets/AbstractTwodsixActorSheet.ts | 4 +-- src/module/sheets/TwodsixVehicleSheet.ts | 10 ++++-- src/module/utils/TwodsixDiceRoll.ts | 10 +++--- src/module/utils/TwodsixRollSettings.ts | 3 +- src/module/utils/sheetUtils.ts | 7 ++-- src/module/utils/utils.ts | 6 +++- static/styles/twodsix.css | 2 +- static/styles/twodsix_basic.css | 2 +- static/templates/actors/animal-sheet.html | 2 +- static/templates/actors/battle-sheet.html | 32 +++--------------- static/templates/actors/npc-sheet.html | 2 +- .../actors/parts/actor/actor-bgi-animal.html | 4 ++- .../actors/parts/actor/actor-bgi-robot.html | 3 +- .../actors/parts/actor/actor-consumable.html | 6 ++-- .../parts/actor/actor-npc-consumable.html | 4 +-- .../actors/parts/actor/actor-skill-item.html | 2 +- .../actors/parts/actor/actor-skills.html | 2 +- .../actors/parts/common/armament-qty.html | 10 ++++++ .../actors/parts/common/component-status.html | 10 ++++++ .../actors/parts/common/popup-state.html | 5 +++ .../ship/ship-component-double-item.html | 29 ++-------------- .../ship/ship-component-single-item.html | 33 +++---------------- .../parts/vehicle/vehicle-components.html | 22 ++++++------- static/templates/actors/robot-sheet.html | 2 +- static/templates/items/parts/footer.html | 6 ++-- 30 files changed, 135 insertions(+), 142 deletions(-) create mode 100644 static/templates/actors/parts/common/armament-qty.html create mode 100644 static/templates/actors/parts/common/component-status.html create mode 100644 static/templates/actors/parts/common/popup-state.html diff --git a/src/module/entities/TwodsixActor.ts b/src/module/entities/TwodsixActor.ts index 9ef66bdb8..aaa4cd50c 100644 --- a/src/module/entities/TwodsixActor.ts +++ b/src/module/entities/TwodsixActor.ts @@ -1,7 +1,8 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-nocheck This turns off *all* typechecking, make sure to remove this once foundry-vtt-types are updated to cover v10. -import { calcModFor, getDamageTypes, getKeyByValue } from "../utils/sheetUtils"; +import { calcModFor, getDamageTypes} from "../utils/sheetUtils"; +import { getKeyByValue } from "../utils/utils"; import { TWODSIX } from "../config"; import { TwodsixRollSettings} from "../utils/TwodsixRollSettings"; import { TwodsixDiceRoll } from "../utils/TwodsixDiceRoll"; @@ -347,6 +348,8 @@ export default class TwodsixActor extends Actor { if (this.overrides.system?.primaryArmor?.value) { system.totalArmor += this.overrides.system.primaryArmor.value - baseArmor; } + } else { + this.applyActiveEffectsCustom(); } } /** @@ -895,7 +898,7 @@ export default class TwodsixActor extends Actor { * @returns {Promise} * @public */ - public async modifyTokenAttribute(attribute, value, isDelta, isBar): Promise { + public async modifyTokenAttribute(attribute: string, value: number, isDelta: boolean, isBar: boolean): Promise { if ( attribute === "hits" && ["traveller", "animal", "robot"].includes(this.type)) { const hits = foundry.utils.getProperty(this.system, attribute); const delta = isDelta ? (-1 * value) : (hits.value - value); @@ -916,7 +919,7 @@ export default class TwodsixActor extends Actor { * @returns {Promise} A boolean promise of whether the drop was sucessful * @private */ - private async _addDroppedSkills(skillData): Promise{ + private async _addDroppedSkills(skillData: any): Promise{ // Handle item sorting within the same Actor SHOULD NEVER DO THIS const sameActor = this.items.get(skillData._id); if (sameActor) { @@ -1124,7 +1127,9 @@ export default class TwodsixActor extends Actor { derivedData.push(`system.skills.${simplifySkillName(skill.name)}`); } //Add specials - derivedData.push("system.encumbrance.max", "system.encumbrance.value", "system.primaryArmor.value", "system.secondaryArmor.value", "system.radiationProtection.value"); + if (this.type === 'traveller') { + derivedData.push("system.encumbrance.max", "system.encumbrance.value", "system.primaryArmor.value", "system.secondaryArmor.value", "system.radiationProtection.value"); + } //Define derived data keys that can have active effects const overrides = {}; @@ -1189,7 +1194,8 @@ export default class TwodsixActor extends Actor { const returnObject = {}; const skillsArray:TwodsixItem[] = sortByItemName(this.itemTypes.skills); for (const skill of skillsArray) { - if ((skill.system.value >= 0 || !game.settings.get('twodsix', 'hideUntrainedSkills')) || (skill.getFlag("twodsix", "untrainedSkill") === game.settings.get('twodsix', 'hideUntrainedSkills'))) { + if ((skill.system.value >= 0 || !game.settings.get('twodsix', 'hideUntrainedSkills') || this.system.skills[simplifySkillName(skill.name)] >= 0) + || (skill.getFlag("twodsix", "untrainedSkill") === game.settings.get('twodsix', 'hideUntrainedSkills'))) { Object.assign(returnObject, {[skill.uuid]: `${skill.name} (${this.system.skills[simplifySkillName(skill.name)]})`}); } } diff --git a/src/module/entities/TwodsixItem.ts b/src/module/entities/TwodsixItem.ts index ce1ddf65d..657cc8963 100644 --- a/src/module/entities/TwodsixItem.ts +++ b/src/module/entities/TwodsixItem.ts @@ -228,11 +228,13 @@ export default class TwodsixItem extends Item { }; // Set characteristic from skill - const skill:TwodsixItem = this.actor?.items.get(weapon.skill) as TwodsixItem; - if (skill) { - tmpSettings.rollModifiers.characteristic = (skill.system).characteristic || 'NONE'; - tmpSettings.rollType = skill.system.rolltype || "Normal"; + const skill:TwodsixItem | undefined = this.actor?.items.get(weapon.skill) ?? (game.settings.get("twodsix", "hideUntrainedSkills") ? this.actor?.getUntrainedSkill() : undefined); + if (!skill) { + ui.notifications.error(game.i18n.localize("TWODSIX.Errors.NoSkillForSkillRoll")); + return; } + tmpSettings.rollModifiers.characteristic = (skill.system).characteristic || 'NONE'; + tmpSettings.rollType = skill.system.rolltype || "Normal"; // Get fire mode parameters const { weaponType, isAutoFull, usedAmmo, numberOfAttacks } = this.getFireModeParams(rateOfFireCE, attackType, tmpSettings); diff --git a/src/module/handlebars.ts b/src/module/handlebars.ts index 1572a2394..f09c56d26 100644 --- a/src/module/handlebars.ts +++ b/src/module/handlebars.ts @@ -2,12 +2,13 @@ // @ts-nocheck This turns off *all* typechecking, make sure to remove this once foundry-vtt-types are updated to cover v10. /*import { advantageDisadvantageTerm } from "./i18n";*/ -import { getKeyByValue } from "./utils/sheetUtils"; +import { getKeyByValue} from "./utils/utils"; import { TWODSIX } from "./config"; import TwodsixItem from "./entities/TwodsixItem"; import TwodsixActor, { getPower, getWeight } from "./entities/TwodsixActor"; import { getCharacteristicList } from "./utils/TwodsixRollSettings"; import { simplifySkillName } from "./utils/utils"; +import { calcModFor } from "./utils/sheetUtils"; export default function registerHandlebarsHelpers(): void { @@ -305,11 +306,29 @@ export default function registerHandlebarsHelpers(): void { if (actor) { const modes = [``, ``, ``, ``, ``, ``]; if (foundry.utils.getProperty(actor.overrides, field) !== undefined) { - returnValue += field.includes('Armor') && actor.type === 'traveller' ? `- ` : ``; + returnValue += field.includes('Armor') ? `- ` : ``; const baseText = game.i18n.localize("TWODSIX.ActiveEffects.BaseValue"); const modifierText = game.i18n.localize("TWODSIX.ActiveEffects.Modifiers"); - const baseValue = foundry.utils.getProperty(actor._source, field); - returnValue += `${baseText}: ${baseValue > 0 ? baseValue : "?"}. ${modifierText}: `; + let baseValue = 0; + if (field.includes('skills')) { + const simplifiedName = field.replace('system.skills.', ''); + if (simplifiedName) { + const coreSkill = actor.itemTypes.skills.find(sk => simplifySkillName(sk.name) === simplifiedName); + baseValue = coreSkill?.system.value; + } + } else if (field.includes('encumbrance.max')) { + baseValue = actor.getMaxEncumbrance(); + } else if (field.includes('mod')) { + baseValue = calcModFor(foundry.utils.getProperty(actor._source, field.replace('mod', 'value'))); + } else { + baseValue = foundry.utils.getProperty(actor._source, field); + } + + if (baseValue === foundry.utils.getProperty(actor, field)) { + baseValue = undefined; + } + + returnValue += `${baseText}: ${isNaN(baseValue) ? "?" : baseValue}. ${modifierText}: `; const workingEffects = actor.appliedEffects; for (const effect of workingEffects) { const realChanges = effect.changes.filter(ch => ch.key === field); diff --git a/src/module/hooks/addGMControlButtons.ts b/src/module/hooks/addGMControlButtons.ts index 3219319a9..15fa1540c 100644 --- a/src/module/hooks/addGMControlButtons.ts +++ b/src/module/hooks/addGMControlButtons.ts @@ -4,7 +4,7 @@ import {TWODSIX} from "../config"; import { getDifficultiesSelectObject, getRollTypeSelectObject } from "../utils/sheetUtils"; //import {DICE_ROLL_MODES} from "@league-of-foundry-developers/foundry-vtt-types/src/foundry/common/constants.mjs"; import { _genUntranslatedCharacteristicList } from "../utils/TwodsixRollSettings"; -//import {getKeyByValue} from "./sheetUtils"; +//import {getKeyByValue} from "./utils"; import { simplifySkillName, sortObj } from "../utils/utils.ts"; Hooks.on("getSceneControlButtons", (controls) => { @@ -37,7 +37,7 @@ async function requestRoll(): Promise { } else { flavor = flavor.replace("_TYPE_", game.i18n.localize("TWODSIX.Chat.Roll.normal")); } - flavor += `
`; + flavor += `
`; ChatMessage.create({ flavor: flavor, flags: { diff --git a/src/module/hooks/diceTrayIntegration.ts b/src/module/hooks/diceTrayIntegration.ts index ec91f3df1..1ee71b15c 100644 --- a/src/module/hooks/diceTrayIntegration.ts +++ b/src/module/hooks/diceTrayIntegration.ts @@ -1,7 +1,7 @@ // DICE TRAY no longer supports custom buttons through a simple API as of V12 // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-nocheck This turns off *all* typechecking, make sure to remove this once foundry-vtt-types are updated to cover v10. -/*import { getKeyByValue } from "../utils/sheetUtils"; +/*import { getKeyByValue } from "../utils/utils"; import { simplifySkillName } from "../utils/utils"; import {TWODSIX} from "../config"; diff --git a/src/module/sheets/AbstractTwodsixActorSheet.ts b/src/module/sheets/AbstractTwodsixActorSheet.ts index 622445594..344e60f8d 100644 --- a/src/module/sheets/AbstractTwodsixActorSheet.ts +++ b/src/module/sheets/AbstractTwodsixActorSheet.ts @@ -548,8 +548,8 @@ export abstract class AbstractTwodsixActorSheet extends ActorSheet { const li = $(event.currentTarget).parents(".item"); const itemSelected = this.actor.items.get(li.data("itemId")); - if (itemSelected) { - if (itemSelected.type === "skills") { + if (itemSelected && Number.isInteger(newValue)) { + if (itemSelected.type === "skills" ) { itemSelected.update({"system.value": newValue}); } else if (itemSelected.type === "consumable") { itemSelected.update({"system.quantity": newValue}); diff --git a/src/module/sheets/TwodsixVehicleSheet.ts b/src/module/sheets/TwodsixVehicleSheet.ts index 976b5f82f..100635c7a 100644 --- a/src/module/sheets/TwodsixVehicleSheet.ts +++ b/src/module/sheets/TwodsixVehicleSheet.ts @@ -54,9 +54,15 @@ export class TwodsixVehicleSheet extends AbstractTwodsixActorSheet { } else { const li = $(event.currentTarget).parents(".item"); const itemSelected:Component = this.actor.items.get(li.data("itemId")); - if (itemSelected) { + if (!itemSelected) { + return; + } + const type = $(event.currentTarget).data("type"); + if (type === "status") { const newState = event.shiftKey ? (itemSelected.system.status === "off" ? "operational" : "off") : stateTransitions[itemSelected.system.status]; - itemSelected?.update({"system.status": newState}); + itemSelected.update({"system.status": newState}); + } else if (type === "popup") { + itemSelected.update({"system.isExtended": !itemSelected.system.isExtended}); } } } diff --git a/src/module/utils/TwodsixDiceRoll.ts b/src/module/utils/TwodsixDiceRoll.ts index cdc625903..53732ed6c 100644 --- a/src/module/utils/TwodsixDiceRoll.ts +++ b/src/module/utils/TwodsixDiceRoll.ts @@ -5,7 +5,7 @@ import {TWODSIX} from "../config"; import TwodsixActor from "../entities/TwodsixActor"; import TwodsixItem from "../entities/TwodsixItem"; import {advantageDisadvantageTerm} from "../i18n"; -import {getKeyByValue} from "./sheetUtils"; +import {getKeyByValue} from "./utils"; import {TwodsixRollSettings} from "./TwodsixRollSettings"; import Crit from "./crit"; import { simplifySkillName, addSign, capitalizeFirstLetter } from "./utils"; @@ -371,12 +371,12 @@ export class TwodsixDiceRoll { } //Add buttons - flavorText += `
`; + flavorText += `
`; if (this.isSuccess() && !game.settings.get("twodsix", "automateDamageRollOnHit") && (this.item?.type === "weapon" || (this.item?.type === "component" && this.item?.system?.subtype === "armament"))) { - flavorText += ``; + flavorText += ``; } else if (this.rollSettings.skillRoll && this.item?.type !== "weapon" && !(this.item?.type === "component" && this.item?.system?.subtype === "armament")) { - flavorText += ``; - flavorText += ``; + flavorText += ``; + flavorText += ``; } flavorText +=`
`; diff --git a/src/module/utils/TwodsixRollSettings.ts b/src/module/utils/TwodsixRollSettings.ts index a5b9331b6..a981d97f6 100644 --- a/src/module/utils/TwodsixRollSettings.ts +++ b/src/module/utils/TwodsixRollSettings.ts @@ -3,7 +3,8 @@ import {CE_DIFFICULTIES, CEL_DIFFICULTIES, TWODSIX} from "../config"; import type TwodsixItem from "../entities/TwodsixItem"; -import {getDifficultiesSelectObject, getKeyByValue, getRollTypeSelectObject} from "./sheetUtils"; +import {getDifficultiesSelectObject, getRollTypeSelectObject} from "./sheetUtils"; +import { getKeyByValue } from "./utils"; import {DICE_ROLL_MODES} from "@league-of-foundry-developers/foundry-vtt-types/src/foundry/common/constants.mjs"; import {Gear, Skills} from "../../types/template"; import TwodsixActor from "../entities/TwodsixActor"; diff --git a/src/module/utils/sheetUtils.ts b/src/module/utils/sheetUtils.ts index ee635b844..2aa473292 100644 --- a/src/module/utils/sheetUtils.ts +++ b/src/module/utils/sheetUtils.ts @@ -4,6 +4,7 @@ import { TWODSIX } from "../config"; import { advantageDisadvantageTerm } from "../i18n"; import { camelCase } from "../settings/settingsUtils"; +import { simplifySkillName } from "./utils"; // export function pseudoHex(value:number):string { // switch (value) { @@ -188,10 +189,6 @@ export function calcModFor(characteristic:number):number { // return calcModFor(characteristic); // } -export function getKeyByValue(object:{ [x:string]:unknown; }, value:unknown):string { - //TODO This assumes I always find the value. Bad form really. - return Object.keys(object).find(key => JSON.stringify(object[key]) === JSON.stringify(value)); -} export function getDataFromDropEvent(event:DragEvent):Record { try { @@ -296,7 +293,7 @@ export async function deletePDFReference(event): Promise { export function isDisplayableSkill(skill:Skills): boolean { if (skill.getFlag("twodsix", "untrainedSkill")) { return false; - } else if (skill.system.trainingNotes !== "" || skill.system.value >= 0) { + } else if (skill.system.trainingNotes !== "" || skill.system.value >= 0 || skill.actor?.system.skills[simplifySkillName(skill.name)] > 0) { return true; } else if (!game.settings.get('twodsix', 'hideUntrainedSkills')) { return true; diff --git a/src/module/utils/utils.ts b/src/module/utils/utils.ts index 5064b5691..2b88dec1a 100644 --- a/src/module/utils/utils.ts +++ b/src/module/utils/utils.ts @@ -1,6 +1,5 @@ // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-nocheck This turns off *all* typechecking, make sure to remove this once foundry-vtt-types are updated to cover v10. -import { getKeyByValue } from "./sheetUtils"; // https://stackoverflow.com/a/34749873 /** @@ -195,3 +194,8 @@ export function roundToMaxDecimals(num:number, maxDecimals:number): number { const decimalsToShow = Math.min(maxDecimals, Math.max(0, maxDecimals - Math.floor(Math.log10(Math.abs(num))))); return roundToDecimal(num, decimalsToShow); } + +export function getKeyByValue(object:{ [x:string]:unknown; }, value:unknown):string { + //TODO This assumes I always find the value. Bad form really. + return Object.keys(object).find(key => JSON.stringify(object[key]) === JSON.stringify(value)); +} diff --git a/static/styles/twodsix.css b/static/styles/twodsix.css index 4c1845c9c..57ad012f5 100644 --- a/static/styles/twodsix.css +++ b/static/styles/twodsix.css @@ -2725,7 +2725,7 @@ a.ship-crew-tab.active, a.ship-positions-tab.active , a.ship-storage-tab.active, margin-top: 1%; margin-left: 3%; /* margin-bottom: 32px; */ - overflow-y: auto; + /*overflow-y: auto;*/ /* height: 46%; */ /* align-self: center; */ } diff --git a/static/styles/twodsix_basic.css b/static/styles/twodsix_basic.css index 0c8ddbe60..9a1de6eb8 100644 --- a/static/styles/twodsix_basic.css +++ b/static/styles/twodsix_basic.css @@ -2199,7 +2199,7 @@ a.ship-positions-tab.active, a.ship-crew-tab.active, a.ship-component-tab.active .storage-wrapper { margin-top: 1.0em; - overflow-y: auto; + /*overflow-y: auto;*/ /* height: 290px; */ margin-left: 15px; } diff --git a/static/templates/actors/animal-sheet.html b/static/templates/actors/animal-sheet.html index b1afcee3e..ad2f5c32d 100644 --- a/static/templates/actors/animal-sheet.html +++ b/static/templates/actors/animal-sheet.html @@ -19,7 +19,7 @@ onClick="this.select();"/> {{#if settings.showInitiativeButton}}
- +
{{/if}} {{> "systems/twodsix/templates/actors/parts/actor/actor-reference.html"}} diff --git a/static/templates/actors/battle-sheet.html b/static/templates/actors/battle-sheet.html index 5d2b81c9c..f73bb47a0 100644 --- a/static/templates/actors/battle-sheet.html +++ b/static/templates/actors/battle-sheet.html @@ -48,26 +48,13 @@ {{#if item.system.hardened}}{{else}}—{{/if}} {{item.system.hits}} - - + + - - {{#iff item.system.status "===" 'operational'}} - {{else}} - {{#iff item.system.status "===" 'damaged'}} - {{else}} - {{#iff item.system.status "===" 'destroyed'}} - {{else}} - {{#iff item.system.status "===" 'off'}} - {{/iff}} {{/iff}} {{/iff}} {{/iff}} - - {{#if item.system.isPopup}} - - {{#if item.system.isExtended}}{{else}}{{/if}} - - {{/if}} + {{> "systems/twodsix/templates/actors/parts/common/component-status.html" item=item}} + {{> "systems/twodsix/templates/actors/parts/common/popup-state.html" item=item}} {{#iff item.system.rollModifier "!==" ""}}{{item.system.rollModifier}}{{else}}—{{/iff}} {{/if}} - {{#iff item.system.ammunition.max "!==" 0}} - {{item.system.ammunition.value}} - - - - - - {{else}} - {{#if item.system.availableQuantity}}{{item.system.availableQuantity}}/{{/if}}{{item.system.quantity}} - {{/iff}} + {{> "systems/twodsix/templates/actors/parts/common/armament-qty.html" item=item}} {{#iff item.system.damage "!==" ""}}{{twodsix_limitLength item.system.damage 3}}{{else}}—{{/iff}} diff --git a/static/templates/actors/npc-sheet.html b/static/templates/actors/npc-sheet.html index e4e737d26..d7ae439b5 100644 --- a/static/templates/actors/npc-sheet.html +++ b/static/templates/actors/npc-sheet.html @@ -18,7 +18,7 @@ onClick="this.select();" autocomplete="off"/> {{#if settings.showInitiativeButton}}
- +
{{/if}} {{> "systems/twodsix/templates/actors/parts/actor/actor-reference.html"}} diff --git a/static/templates/actors/parts/actor/actor-bgi-animal.html b/static/templates/actors/parts/actor/actor-bgi-animal.html index 309d998be..163ce60e8 100644 --- a/static/templates/actors/parts/actor/actor-bgi-animal.html +++ b/static/templates/actors/parts/actor/actor-bgi-animal.html @@ -69,7 +69,9 @@ {{else}} :+ + data-tooltip="{{concat (localize 'TWODSIX.Items.Armor.PrimaryArmor') (twodsix_getTooltip actor 'system.primaryArmor.value')}}"/>+ + +
: diff --git a/static/templates/actors/parts/actor/actor-bgi-robot.html b/static/templates/actors/parts/actor/actor-bgi-robot.html index d8914cf13..86d072bfc 100644 --- a/static/templates/actors/parts/actor/actor-bgi-robot.html +++ b/static/templates/actors/parts/actor/actor-bgi-robot.html @@ -23,7 +23,8 @@ {{else}} :+ + data-tooltip="{{concat (localize 'TWODSIX.Items.Armor.PrimaryArmor') (twodsix_getTooltip actor 'system.primaryArmor.value')}}"/>+ + : diff --git a/static/templates/actors/parts/actor/actor-consumable.html b/static/templates/actors/parts/actor/actor-consumable.html index da5d66a5e..d774b3048 100644 --- a/static/templates/actors/parts/actor/actor-consumable.html +++ b/static/templates/actors/parts/actor/actor-consumable.html @@ -6,11 +6,11 @@ {{currentCount}}/{{max}} - - + + - {{/with}} diff --git a/static/templates/actors/parts/actor/actor-npc-consumable.html b/static/templates/actors/parts/actor/actor-npc-consumable.html index 888ab88ff..c97630e62 100644 --- a/static/templates/actors/parts/actor/actor-npc-consumable.html +++ b/static/templates/actors/parts/actor/actor-npc-consumable.html @@ -4,8 +4,8 @@ {{currentCount}}/{{max}} - - + + {{/with}} diff --git a/static/templates/actors/parts/actor/actor-skill-item.html b/static/templates/actors/parts/actor/actor-skill-item.html index ddb1e3e55..107558c63 100644 --- a/static/templates/actors/parts/actor/actor-skill-item.html +++ b/static/templates/actors/parts/actor/actor-skill-item.html @@ -6,7 +6,7 @@ {{item.name}} - + {{twodsix_skillCharacteristic actor item.system.characteristic}} {{{twodsix_adjustedSkillValue actor item}}} {{twodsix_skillTotal actor item}} diff --git a/static/templates/actors/parts/actor/actor-skills.html b/static/templates/actors/parts/actor/actor-skills.html index f149266be..ae9b21c62 100644 --- a/static/templates/actors/parts/actor/actor-skills.html +++ b/static/templates/actors/parts/actor/actor-skills.html @@ -1,6 +1,6 @@ {{#if settings.showInitiativeButton}}
- +
{{/if}} diff --git a/static/templates/actors/parts/common/armament-qty.html b/static/templates/actors/parts/common/armament-qty.html new file mode 100644 index 000000000..69286a292 --- /dev/null +++ b/static/templates/actors/parts/common/armament-qty.html @@ -0,0 +1,10 @@ +{{#iff item.system.ammunition.max "!==" 0}} + {{item.system.ammunition.value}} + + + + + +{{else}} + {{#if item.system.availableQuantity}}{{item.system.availableQuantity}}/{{/if}}{{item.system.quantity}} +{{/iff}} diff --git a/static/templates/actors/parts/common/component-status.html b/static/templates/actors/parts/common/component-status.html new file mode 100644 index 000000000..ef2064c25 --- /dev/null +++ b/static/templates/actors/parts/common/component-status.html @@ -0,0 +1,10 @@ + + {{#iff item.system.status "===" 'operational'}} + {{else}} + {{#iff item.system.status "===" 'damaged'}} + {{else}} + {{#iff item.system.status "===" 'destroyed'}} + {{else}} + {{#iff item.system.status "===" 'off'}} + {{/iff}} {{/iff}} {{/iff}} {{/iff}} + diff --git a/static/templates/actors/parts/common/popup-state.html b/static/templates/actors/parts/common/popup-state.html new file mode 100644 index 000000000..6aaa09c65 --- /dev/null +++ b/static/templates/actors/parts/common/popup-state.html @@ -0,0 +1,5 @@ +{{#if item.system.isPopup}} + + {{#if item.system.isExtended}}{{else}}{{/if}} + +{{/if}} diff --git a/static/templates/actors/parts/ship/ship-component-double-item.html b/static/templates/actors/parts/ship/ship-component-double-item.html index 6ba0b094f..df1b7b745 100644 --- a/static/templates/actors/parts/ship/ship-component-double-item.html +++ b/static/templates/actors/parts/ship/ship-component-double-item.html @@ -7,38 +7,15 @@
{{item.name}}{{#if settings.allowDragDropOfListsShip}} {{/if}} {{/iff}} {{#iff item.system.subtype "===" "armament"}} - {{#iff item.system.ammunition.max "!==" 0}} - {{item.system.ammunition.value}} - - - - - - {{else}} - {{#if item.system.availableQuantity}}{{item.system.availableQuantity}}/{{/if}}{{item.system.quantity}} - {{/iff}} + {{> "systems/twodsix/templates/actors/parts/common/armament-qty.html"}} {{else}} {{#if item.system.availableQuantity}}{{item.system.availableQuantity}}/{{/if}}{{item.system.quantity}} {{/iff}} {{#iff item.system.techLevel ">" "0"}}{{item.system.techLevel}}{{else}}—{{/iff}} {{item.system.rating}} - - {{#iff item.system.status "===" 'operational'}} - {{else}} - {{#iff item.system.status "===" 'damaged'}} - {{else}} - {{#iff item.system.status "===" 'destroyed'}} - {{else}} - {{#iff item.system.status "===" 'off'}} - {{/iff}} {{/iff}} {{/iff}} {{/iff}} - - - {{#if item.system.isPopup}} - - {{#if item.system.isExtended}}{{else}}{{/if}} - - {{/if}} + {{> "systems/twodsix/templates/actors/parts/common/component-status.html"}} + {{> "systems/twodsix/templates/actors/parts/common/popup-state.html"}} {{getComponentPower item}} {{#iff item.system.subtype "===" "armament"}} - {{#iff item.system.ammunition.max "!==" 0}} - {{item.system.ammunition.value}} - - - - - - {{else}} - {{#if item.system.availableQuantity}}{{item.system.availableQuantity}}/{{/if}}{{item.system.quantity}} - {{/iff}} + {{> "systems/twodsix/templates/actors/parts/common/armament-qty.html"}} {{else}} {{#if item.system.availableQuantity}}{{item.system.availableQuantity}}/{{/if}}{{item.system.quantity}} {{/iff}} @@ -43,27 +34,13 @@ {{#if item.system.hardened}}{{else}}—{{/if}} {{item.system.hits}} - - + + - - {{#iff item.system.status "===" 'operational'}} - {{else}} - {{#iff item.system.status "===" 'damaged'}} - {{else}} - {{#iff item.system.status "===" 'destroyed'}} - {{else}} - {{#iff item.system.status "===" 'off'}} - {{/iff}} {{/iff}} {{/iff}} {{/iff}} - - - {{#if item.system.isPopup}} - - {{#if item.system.isExtended}}{{else}}{{/if}} - - {{/if}} + {{> "systems/twodsix/templates/actors/parts/common/component-status.html"}} + {{> "systems/twodsix/templates/actors/parts/common/popup-state.html"}} {{item.name}} {{#iff item.system.techLevel ">" "0"}}{{item.system.techLevel}}{{else}}—{{/iff}} {{#iff item.system.rollModifier "!==" ""}}{{item.system.rollModifier}}{{else}}—{{/iff}} - {{#if item.system.availableQuantity}}{{item.system.availableQuantity}}/{{/if}}{{item.system.quantity}} + {{#iff item.system.subtype "===" "armament"}} + {{> "systems/twodsix/templates/actors/parts/common/armament-qty.html" item=item}} + {{else}} + {{#if item.system.availableQuantity}}{{item.system.availableQuantity}}/{{/if}}{{item.system.quantity}} + {{/iff}} {{#iff item.system.damage "!==" ""}}{{twodsix_limitLength item.system.damage 3}}{{else}}—{{/iff}} {{item.system.hits}} - - + + - - {{#iff item.system.status "===" 'operational'}} - {{else}} - {{#iff item.system.status "===" 'damaged'}} - {{else}} - {{#iff item.system.status "===" 'destroyed'}} - {{else}} - {{#iff item.system.status "===" 'off'}} - {{/iff}} {{/iff}} {{/iff}} {{/iff}} + + {{> "systems/twodsix/templates/actors/parts/common/component-status.html" item=item}} + {{> "systems/twodsix/templates/actors/parts/common/popup-state.html" item=item}} {{#if settings.showInitiativeButton}}
- +
{{/if}} {{> "systems/twodsix/templates/actors/parts/actor/actor-reference.html"}} diff --git a/static/templates/items/parts/footer.html b/static/templates/items/parts/footer.html index aa4c0aaf7..6bcc3f462 100644 --- a/static/templates/items/parts/footer.html +++ b/static/templates/items/parts/footer.html @@ -1,8 +1,8 @@ From 856f71a149748f3f848da179cc67290373fccd43 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Tue, 8 Oct 2024 13:48:17 +0000 Subject: [PATCH 3/3] chore(release): 5.8.6 [skip ci] ## [5.8.6](https://github.com/xdy/twodsix-foundryvtt/compare/v5.8.5...v5.8.6) (2024-10-08) ### Bug Fixes * button changes, component qty, and AE fixes ([#1653](https://github.com/xdy/twodsix-foundryvtt/issues/1653)) ([dc1db8f](https://github.com/xdy/twodsix-foundryvtt/commit/dc1db8fd12d632f0b64412e3499fafa554a9eaa6)) --- CHANGELOG.md | 7 +++++++ package-lock.json | 4 ++-- package.json | 2 +- static/system.json | 4 ++-- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1361bd408..88cff38ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.8.6](https://github.com/xdy/twodsix-foundryvtt/compare/v5.8.5...v5.8.6) (2024-10-08) + + +### Bug Fixes + +* button changes, component qty, and AE fixes ([#1653](https://github.com/xdy/twodsix-foundryvtt/issues/1653)) ([dc1db8f](https://github.com/xdy/twodsix-foundryvtt/commit/dc1db8fd12d632f0b64412e3499fafa554a9eaa6)) + ## [5.8.5](https://github.com/xdy/twodsix-foundryvtt/compare/v5.8.4...v5.8.5) (2024-10-01) diff --git a/package-lock.json b/package-lock.json index 194ce5caf..6d30479c3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "twodsix", - "version": "5.8.5", + "version": "5.8.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "twodsix", - "version": "5.8.5", + "version": "5.8.6", "devDependencies": { "@league-of-foundry-developers/foundry-vtt-types": "^9.280.0", "@rollup/plugin-commonjs": "^24.1.0", diff --git a/package.json b/package.json index f1abcb6aa..eb5ad6f54 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "private": true, "name": "twodsix", - "version": "5.8.5", + "version": "5.8.6", "description": "A 2d6 system", "scripts": { "build": "gulp build", diff --git a/static/system.json b/static/system.json index 94e7e77d6..aa5d3f095 100644 --- a/static/system.json +++ b/static/system.json @@ -4,8 +4,8 @@ "url": "https://github.com/xdy/twodsix-foundryvtt/", "manifest": "https://github.com/xdy/twodsix-foundryvtt/releases/latest/download/system.json", "readme": "https://raw.githubusercontent.com/xdy/twodsix-foundryvtt/master/README.md", - "download": "https://github.com/xdy/twodsix-foundryvtt/releases/download/v5.8.5/twodsix.zip", - "version": "5.8.5", + "download": "https://github.com/xdy/twodsix-foundryvtt/releases/download/v5.8.6/twodsix.zip", + "version": "5.8.6", "socket": true, "background": "systems/twodsix/assets/pause/sunburst.svg", "changelog": "https://raw.githubusercontent.com/xdy/twodsix-foundryvtt/master/CHANGELOG.md",