RPG Companion index [done]

This commit is contained in:
Mingyu
2025-11-24 19:48:34 +08:00
committed by GitHub
parent ab33604ea0
commit 79f99a40c6
6 changed files with 42 additions and 18 deletions
+6 -2
View File
@@ -9,6 +9,7 @@ import {
setPendingDiceRoll
} from '../../core/state.js';
import { saveSettings } from '../../core/persistence.js';
import { i18n } from '../../core/i18n.js';
/**
* Rolls the dice and displays result.
@@ -85,10 +86,13 @@ export async function executeRollCommand(command) {
*/
export function updateDiceDisplay() {
const lastRoll = extensionSettings.lastDiceRoll;
const label = i18n.getTranslation('template.mainPanel.lastRoll') || 'Last Roll: ';
const noneValue = i18n.getTranslation('global.none') || 'None';
if (lastRoll) {
$('#rpg-last-roll-text').text(`Last Roll (${lastRoll.formula}): ${lastRoll.total}`);
$('#rpg-last-roll-text').text(`${label}(${lastRoll.formula}): ${lastRoll.total}`);
} else {
$('#rpg-last-roll-text').text('Last Roll: None');
$('#rpg-last-roll-text').text(label + noneValue);
}
}
+2
View File
@@ -11,6 +11,7 @@ import {
$thoughtsContainer,
$inventoryContainer
} from '../../core/state.js';
import { i18n } from '../../core/i18n.js';
/**
* Toggles the visibility of plot buttons based on settings.
@@ -92,6 +93,7 @@ export function updateCollapseToggleIcon() {
*/
export function setupCollapseToggle() {
const $collapseToggle = $('#rpg-collapse-toggle');
$collapseToggle.attr('title', i18n.getTranslation('template.mainPanel.collapseExpand'));
const $panel = $('#rpg-companion-panel');
const $icon = $collapseToggle.find('i');
+2
View File
@@ -23,6 +23,7 @@ import {
updateDiceDisplay as updateDiceDisplayCore,
addDiceQuickReply as addDiceQuickReplyCore
} from '../features/dice.js';
import { i18n } from '../../core/i18n.js';
/**
* Modern DiceModal ES6 Class
@@ -318,6 +319,7 @@ export function setupDiceRoller() {
e.stopPropagation(); // Prevent opening the dice popup
clearDiceRollCore();
});
$('#rpg-clear-dice').attr('title', i18n.getTranslation('template.mainPanel.clearLastRoll'));
return diceModal;
}