v2.1: Add dynamic weather effects, clothing inventory, and bug fixes

Features:
- Add dynamic weather effects system (snow, rain, mist, sunshine, storm, wind, blizzard)
- Add separate Clothing tab in inventory system
- Weather effects auto-update based on Info Box weather field
- Combined effects for storm (rain+lightning) and blizzard (snow+wind)

Improvements:
- Settings migration system for automatic feature enablement
- Weather effects positioned behind chat interface (z-index: 1)
- Dynamic weather enabled by default for new users

Bug Fixes:
- Fix tab visibility issues (disabled tabs now properly hide)
- Fix theme-aware borders (remove hardcoded blue colors)
- Fix double scrollbar in Edit Trackers window
- Fix scroll position jumping when editing Present Characters
- Fix dynamic weather toggle hiding issue

Technical:
- Update inventory schema to v2.1 with clothing field
- Add automatic migration for existing v2 inventories
- Update parsers and prompts to handle clothing separately
- Add translations (EN/ZH-TW) for new features
This commit is contained in:
Spicy_Marinara
2026-01-02 13:58:43 +01:00
parent ddd59d124e
commit 62ed7ffb18
22 changed files with 1035 additions and 88 deletions
+35
View File
@@ -70,6 +70,7 @@ import { renderInventory } from './src/systems/rendering/inventory.js';
import { renderQuests } from './src/systems/rendering/quests.js'; import { renderQuests } from './src/systems/rendering/quests.js';
import { renderMusicPlayer } from './src/systems/rendering/musicPlayer.js'; import { renderMusicPlayer } from './src/systems/rendering/musicPlayer.js';
import { toggleSnowflakes, initSnowflakes } from './src/systems/ui/snowflakes.js'; import { toggleSnowflakes, initSnowflakes } from './src/systems/ui/snowflakes.js';
import { toggleDynamicWeather, initWeatherEffects, updateWeatherEffect } from './src/systems/ui/weatherEffects.js';
// Interaction modules // Interaction modules
import { initInventoryEventListeners } from './src/systems/interaction/inventoryActions.js'; import { initInventoryEventListeners } from './src/systems/interaction/inventoryActions.js';
@@ -397,6 +398,12 @@ async function initUI() {
toggleSnowflakes(extensionSettings.enableSnowflakes); toggleSnowflakes(extensionSettings.enableSnowflakes);
}); });
$('#rpg-toggle-dynamic-weather').on('change', function() {
extensionSettings.enableDynamicWeather = $(this).prop('checked');
saveSettings();
toggleDynamicWeather(extensionSettings.enableDynamicWeather);
});
$('#rpg-dismiss-promo').on('click', function() { $('#rpg-dismiss-promo').on('click', function() {
extensionSettings.dismissedHolidayPromo = true; extensionSettings.dismissedHolidayPromo = true;
saveSettings(); saveSettings();
@@ -561,6 +568,24 @@ async function initUI() {
updateFeatureTogglesVisibility(); updateFeatureTogglesVisibility();
}); });
$('#rpg-toggle-show-dynamic-weather-toggle').on('change', function() {
extensionSettings.showDynamicWeatherToggle = $(this).prop('checked');
// Also disable the feature when hiding the toggle
if (!extensionSettings.showDynamicWeatherToggle) {
extensionSettings.enableDynamicWeather = false;
$('#rpg-toggle-dynamic-weather').prop('checked', false);
toggleDynamicWeather(false);
}
saveSettings();
updateFeatureTogglesVisibility();
});
$('#rpg-toggle-show-snowflakes-toggle').on('change', function() {
extensionSettings.showSnowflakesToggle = $(this).prop('checked');
saveSettings();
updateFeatureTogglesVisibility();
});
// Auto avatar generation settings // Auto avatar generation settings
$('#rpg-toggle-auto-avatars').on('change', function() { $('#rpg-toggle-auto-avatars').on('change', function() {
extensionSettings.autoGenerateAvatars = $(this).prop('checked'); extensionSettings.autoGenerateAvatars = $(this).prop('checked');
@@ -757,11 +782,14 @@ async function initUI() {
$('#rpg-toggle-html-prompt').prop('checked', extensionSettings.enableHtmlPrompt); $('#rpg-toggle-html-prompt').prop('checked', extensionSettings.enableHtmlPrompt);
$('#rpg-toggle-spotify-music').prop('checked', extensionSettings.enableSpotifyMusic); $('#rpg-toggle-spotify-music').prop('checked', extensionSettings.enableSpotifyMusic);
$('#rpg-toggle-snowflakes').prop('checked', extensionSettings.enableSnowflakes); $('#rpg-toggle-snowflakes').prop('checked', extensionSettings.enableSnowflakes);
$('#rpg-toggle-dynamic-weather').prop('checked', extensionSettings.enableDynamicWeather);
// Feature toggle visibility settings // Feature toggle visibility settings
$('#rpg-toggle-show-html-toggle').prop('checked', extensionSettings.showHtmlToggle ?? true); $('#rpg-toggle-show-html-toggle').prop('checked', extensionSettings.showHtmlToggle ?? true);
$('#rpg-toggle-show-spotify-toggle').prop('checked', extensionSettings.showSpotifyToggle ?? true); $('#rpg-toggle-show-spotify-toggle').prop('checked', extensionSettings.showSpotifyToggle ?? true);
$('#rpg-toggle-show-snowflakes-toggle').prop('checked', extensionSettings.showSnowflakesToggle ?? true); $('#rpg-toggle-show-snowflakes-toggle').prop('checked', extensionSettings.showSnowflakesToggle ?? true);
$('#rpg-toggle-show-dynamic-weather-toggle').prop('checked', extensionSettings.showDynamicWeatherToggle ?? true);
$('#rpg-toggle-show-snowflakes-toggle').prop('checked', extensionSettings.showSnowflakesToggle ?? true);
// Hide holiday promo if previously dismissed // Hide holiday promo if previously dismissed
if (extensionSettings.dismissedHolidayPromo) { if (extensionSettings.dismissedHolidayPromo) {
@@ -825,6 +853,7 @@ async function initUI() {
toggleAnimations(); toggleAnimations();
updateFeatureTogglesVisibility(); updateFeatureTogglesVisibility();
togglePlotButtons(); // Initialize plot buttons and encounter button visibility togglePlotButtons(); // Initialize plot buttons and encounter button visibility
initWeatherEffects(); // Initialize dynamic weather effects
// Setup mobile toggle button // Setup mobile toggle button
setupMobileToggle(); setupMobileToggle();
@@ -865,6 +894,12 @@ async function initUI() {
// Initialize Lorebook Limiter // Initialize Lorebook Limiter
initLorebookLimiter(); initLorebookLimiter();
// Expose weather effect functions globally for cross-module access
if (!window.RPGCompanion) {
window.RPGCompanion = {};
}
window.RPGCompanion.updateWeatherEffect = updateWeatherEffect;
} }
+1 -1
View File
@@ -6,6 +6,6 @@
"js": "index.js", "js": "index.js",
"css": "style.css", "css": "style.css",
"author": "Marysia", "author": "Marysia",
"version": "2.0.0", "version": "2.1.0",
"homePage": "https://github.com/SpicyMarinara/rpg-companion-sillytavern" "homePage": "https://github.com/SpicyMarinara/rpg-companion-sillytavern"
} }
+1 -1
View File
@@ -30,7 +30,7 @@
</div> </div>
<div style="margin-top: 10px; text-align: center; opacity: 0.6; font-size: 0.85em;"> <div style="margin-top: 10px; text-align: center; opacity: 0.6; font-size: 0.85em;">
RPG Companion v2.0 RPG Companion v2.1
</div> </div>
</div> </div>
</div> </div>
+18
View File
@@ -78,6 +78,24 @@ export function loadSettings() {
} }
updateExtensionSettings(savedSettings); updateExtensionSettings(savedSettings);
// Perform settings migrations based on version
const currentVersion = extensionSettings.settingsVersion || 1;
let settingsChanged = false;
// Migration to version 2: Enable dynamic weather for existing users
if (currentVersion < 2) {
console.log('[RPG Companion] Migrating settings to version 2 (enabling dynamic weather)');
extensionSettings.enableDynamicWeather = true;
extensionSettings.settingsVersion = 2;
settingsChanged = true;
}
// Save migrated settings
if (settingsChanged) {
saveSettings();
}
// console.log('[RPG Companion] Settings loaded:', extensionSettings); // console.log('[RPG Companion] Settings loaded:', extensionSettings);
} else { } else {
// console.log('[RPG Companion] No saved settings found, using defaults'); // console.log('[RPG Companion] No saved settings found, using defaults');
+3
View File
@@ -10,6 +10,7 @@
* Extension settings - persisted to SillyTavern settings * Extension settings - persisted to SillyTavern settings
*/ */
export let extensionSettings = { export let extensionSettings = {
settingsVersion: 2, // Version number for settings migrations
enabled: true, enabled: true,
autoUpdate: true, autoUpdate: true,
updateDepth: 4, // How many messages to include in the context updateDepth: 4, // How many messages to include in the context
@@ -27,10 +28,12 @@ export let extensionSettings = {
enableSpotifyMusic: false, // Enable Spotify music integration (asks AI for Spotify URLs) enableSpotifyMusic: false, // Enable Spotify music integration (asks AI for Spotify URLs)
customSpotifyPrompt: '', // Custom Spotify prompt text (empty = use default) customSpotifyPrompt: '', // Custom Spotify prompt text (empty = use default)
enableSnowflakes: false, // Enable festive snowflakes effect enableSnowflakes: false, // Enable festive snowflakes effect
enableDynamicWeather: true, // Enable dynamic weather effects based on Info Box weather field (v2: enabled by default)
dismissedHolidayPromo: false, // User dismissed the holiday promotion banner dismissedHolidayPromo: false, // User dismissed the holiday promotion banner
showHtmlToggle: true, // Show Immersive HTML toggle in main panel showHtmlToggle: true, // Show Immersive HTML toggle in main panel
showSpotifyToggle: true, // Show Spotify Music toggle in main panel showSpotifyToggle: true, // Show Spotify Music toggle in main panel
showSnowflakesToggle: true, // Show Snowflakes Effect toggle in main panel showSnowflakesToggle: true, // Show Snowflakes Effect toggle in main panel
showDynamicWeatherToggle: true, // Show Dynamic Weather Effects toggle in main panel
skipInjectionsForGuided: 'none', // skip injections for instruct injections and quiet prompts (GuidedGenerations compatibility) skipInjectionsForGuided: 'none', // skip injections for instruct injections and quiet prompts (GuidedGenerations compatibility)
enablePlotButtons: true, // Show plot progression buttons above chat input enablePlotButtons: true, // Show plot progression buttons above chat input
saveTrackerHistory: false, // Save tracker data in chat history for each message saveTrackerHistory: false, // Save tracker data in chat history for each message
+14
View File
@@ -42,6 +42,7 @@
"template.settingsModal.display.showImmersiveHtmlToggle": "Show Immersive HTML", "template.settingsModal.display.showImmersiveHtmlToggle": "Show Immersive HTML",
"template.settingsModal.display.showSpotifyMusicToggle": "Show Spotify Music", "template.settingsModal.display.showSpotifyMusicToggle": "Show Spotify Music",
"template.settingsModal.display.showSnowflakesToggle": "Show Snowflakes Effect", "template.settingsModal.display.showSnowflakesToggle": "Show Snowflakes Effect",
"template.settingsModal.display.showDynamicWeatherToggle": "Show Dynamic Weather Effects",
"template.settingsModal.display.showPlotProgressionButtons": "Show Plot Progression Buttons", "template.settingsModal.display.showPlotProgressionButtons": "Show Plot Progression Buttons",
"template.settingsModal.display.showPlotProgressionButtonsNote": "Display buttons above chat input for plot progression prompts", "template.settingsModal.display.showPlotProgressionButtonsNote": "Display buttons above chat input for plot progression prompts",
"template.settingsModal.display.showDiceDisplay": "Show Dice Roll Display", "template.settingsModal.display.showDiceDisplay": "Show Dice Roll Display",
@@ -90,6 +91,13 @@
"template.trackerEditorModal.buttons.reset": "Reset to Defaults", "template.trackerEditorModal.buttons.reset": "Reset to Defaults",
"template.trackerEditorModal.buttons.cancel": "Cancel", "template.trackerEditorModal.buttons.cancel": "Cancel",
"template.trackerEditorModal.buttons.save": "Save & Apply", "template.trackerEditorModal.buttons.save": "Save & Apply",
"template.trackerEditorModal.buttons.export": "Export Preset",
"template.trackerEditorModal.buttons.import": "Import Preset",
"template.trackerEditorModal.messages.exportSuccess": "Tracker preset exported successfully!",
"template.trackerEditorModal.messages.exportError": "Failed to export tracker preset. Check console for details.",
"template.trackerEditorModal.messages.importSuccess": "Tracker preset imported successfully!",
"template.trackerEditorModal.messages.importError": "Failed to import tracker preset",
"template.trackerEditorModal.messages.importConfirm": "This will replace your current tracker configuration. Continue?",
"template.trackerEditorModal.userStatsTab.customStatsTitle": "Custom Stats", "template.trackerEditorModal.userStatsTab.customStatsTitle": "Custom Stats",
"template.trackerEditorModal.userStatsTab.addCustomStatButton": "Add Custom Stat", "template.trackerEditorModal.userStatsTab.addCustomStatButton": "Add Custom Stat",
"template.trackerEditorModal.userStatsTab.rpgAttributesTitle": "RPG Attributes", "template.trackerEditorModal.userStatsTab.rpgAttributesTitle": "RPG Attributes",
@@ -132,6 +140,7 @@
"template.mainPanel.immersiveHtml": "Immersive HTML", "template.mainPanel.immersiveHtml": "Immersive HTML",
"template.mainPanel.spotifyMusic": "Spotify Music", "template.mainPanel.spotifyMusic": "Spotify Music",
"template.mainPanel.snowflakesEffect": "Snowflakes Effect", "template.mainPanel.snowflakesEffect": "Snowflakes Effect",
"template.mainPanel.dynamicWeatherEffects": "Dynamic Weather",
"template.mainPanel.refreshRpgInfo": "Refresh RPG Info", "template.mainPanel.refreshRpgInfo": "Refresh RPG Info",
"template.mainPanel.updating": "Updating...", "template.mainPanel.updating": "Updating...",
"template.mainPanel.editTrackersButton": "Edit Trackers", "template.mainPanel.editTrackersButton": "Edit Trackers",
@@ -151,12 +160,17 @@
"infobox.recentEvents.title": "Recent Events", "infobox.recentEvents.title": "Recent Events",
"infobox.recentEvents.addEventPlaceholder": "Add event...", "infobox.recentEvents.addEventPlaceholder": "Add event...",
"inventory.section.onPerson": "On Person", "inventory.section.onPerson": "On Person",
"inventory.section.clothing": "Clothing",
"inventory.section.stored": "Stored", "inventory.section.stored": "Stored",
"inventory.section.assets": "Assets", "inventory.section.assets": "Assets",
"inventory.onPerson.empty": "No items carried", "inventory.onPerson.empty": "No items carried",
"inventory.onPerson.title": "Items Currently Carried", "inventory.onPerson.title": "Items Currently Carried",
"inventory.onPerson.addItemButton": "Add Item", "inventory.onPerson.addItemButton": "Add Item",
"inventory.onPerson.addItemPlaceholder": "Enter item name...", "inventory.onPerson.addItemPlaceholder": "Enter item name...",
"inventory.clothing.empty": "Not wearing anything",
"inventory.clothing.title": "Clothing & Armor",
"inventory.clothing.addItemButton": "Add Clothing",
"inventory.clothing.addItemPlaceholder": "Enter clothing item...",
"inventory.stored.title": "Storage Locations", "inventory.stored.title": "Storage Locations",
"inventory.stored.addLocationButton": "Add Location", "inventory.stored.addLocationButton": "Add Location",
"inventory.stored.addLocationPlaceholder": "Enter location name...", "inventory.stored.addLocationPlaceholder": "Enter location name...",
+14 -4
View File
@@ -38,8 +38,7 @@
"template.settingsModal.display.enableAnimationsNote": "屬性、內容更新和擲骰的動畫效果", "template.settingsModal.display.enableAnimationsNote": "屬性、內容更新和擲骰的動畫效果",
"template.settingsModal.display.showImmersiveHtmlToggle": "顯示沉浸式 HTML", "template.settingsModal.display.showImmersiveHtmlToggle": "顯示沉浸式 HTML",
"template.settingsModal.display.showSpotifyMusicToggle": "顯示 Spotify 音樂", "template.settingsModal.display.showSpotifyMusicToggle": "顯示 Spotify 音樂",
"template.settingsModal.display.showSnowflakesToggle": "顯示雪花效果", "template.settingsModal.display.showSnowflakesToggle": "顯示雪花效果", "template.settingsModal.display.showDynamicWeatherToggle": "顯示動態天氣效果", "template.settingsModal.display.showPlotProgressionButtons": "顯示劇情推進按鈕(QR",
"template.settingsModal.display.showPlotProgressionButtons": "顯示劇情推進按鈕(QR",
"template.settingsModal.display.showPlotProgressionButtonsNote": "在聊天輸入框上方顯示劇情推進提示按鈕(QR)", "template.settingsModal.display.showPlotProgressionButtonsNote": "在聊天輸入框上方顯示劇情推進提示按鈕(QR)",
"template.settingsModal.display.enableDebugMode": "Debug Mode", "template.settingsModal.display.enableDebugMode": "Debug Mode",
"template.settingsModal.display.enableDebugModeNote": "UI 面板中顯示日誌,對於故障排除很有用。", "template.settingsModal.display.enableDebugModeNote": "UI 面板中顯示日誌,對於故障排除很有用。",
@@ -83,6 +82,13 @@
"template.trackerEditorModal.buttons.reset": "重置為預設值", "template.trackerEditorModal.buttons.reset": "重置為預設值",
"template.trackerEditorModal.buttons.cancel": "取消", "template.trackerEditorModal.buttons.cancel": "取消",
"template.trackerEditorModal.buttons.save": "保存並應用", "template.trackerEditorModal.buttons.save": "保存並應用",
"template.trackerEditorModal.buttons.export": "匯出預設",
"template.trackerEditorModal.buttons.import": "匯入預設",
"template.trackerEditorModal.messages.exportSuccess": "追蹤器預設匯出成功!",
"template.trackerEditorModal.messages.exportError": "匯出追蹤器預設失敗。請檢查控制台以獲取詳細資訊。",
"template.trackerEditorModal.messages.importSuccess": "追蹤器預設匯入成功!",
"template.trackerEditorModal.messages.importError": "匯入追蹤器預設失敗",
"template.trackerEditorModal.messages.importConfirm": "這將替換您當前的追蹤器配置。繼續?",
"template.trackerEditorModal.userStatsTab.customStatsTitle": "自訂屬性", "template.trackerEditorModal.userStatsTab.customStatsTitle": "自訂屬性",
"template.trackerEditorModal.userStatsTab.addCustomStatButton": "添加自訂屬性", "template.trackerEditorModal.userStatsTab.addCustomStatButton": "添加自訂屬性",
"template.trackerEditorModal.userStatsTab.rpgAttributesTitle": "RPG 屬性", "template.trackerEditorModal.userStatsTab.rpgAttributesTitle": "RPG 屬性",
@@ -124,8 +130,7 @@
"template.mainPanel.clearLastRoll": "清除上次擲骰", "template.mainPanel.clearLastRoll": "清除上次擲骰",
"template.mainPanel.immersiveHtml": "沉浸式 HTML", "template.mainPanel.immersiveHtml": "沉浸式 HTML",
"template.mainPanel.spotifyMusic": "Spotify 音樂", "template.mainPanel.spotifyMusic": "Spotify 音樂",
"template.mainPanel.snowflakesEffect": "雪花效果", "template.mainPanel.snowflakesEffect": "雪花效果", "template.mainPanel.dynamicWeatherEffects": "動態天氣", "template.mainPanel.refreshRpgInfo": "刷新資訊",
"template.mainPanel.refreshRpgInfo": "刷新資訊",
"template.mainPanel.updating": "更新中...", "template.mainPanel.updating": "更新中...",
"template.mainPanel.editTrackersButton": "追蹤器編輯", "template.mainPanel.editTrackersButton": "追蹤器編輯",
"template.mainPanel.settingsButton": "設定", "template.mainPanel.settingsButton": "設定",
@@ -144,12 +149,17 @@
"infobox.recentEvents.title": "近期事件", "infobox.recentEvents.title": "近期事件",
"infobox.recentEvents.addEventPlaceholder": "添加事件...", "infobox.recentEvents.addEventPlaceholder": "添加事件...",
"inventory.section.onPerson": "隨身物品", "inventory.section.onPerson": "隨身物品",
"inventory.section.clothing": "服裝",
"inventory.section.stored": "倉庫物品", "inventory.section.stored": "倉庫物品",
"inventory.section.assets": "資產", "inventory.section.assets": "資產",
"inventory.onPerson.empty": "這裡什麼都沒有 (⚲□⚲)", "inventory.onPerson.empty": "這裡什麼都沒有 (⚲□⚲)",
"inventory.onPerson.title": "攜帶的物品", "inventory.onPerson.title": "攜帶的物品",
"inventory.onPerson.addItemButton": "添加物品", "inventory.onPerson.addItemButton": "添加物品",
"inventory.onPerson.addItemPlaceholder": "輸入物品名稱...", "inventory.onPerson.addItemPlaceholder": "輸入物品名稱...",
"inventory.clothing.empty": "未穿著任何服裝 (⚲□⚲)",
"inventory.clothing.title": "服裝與護甲",
"inventory.clothing.addItemButton": "添加服裝",
"inventory.clothing.addItemPlaceholder": "輸入服裝物品...",
"inventory.stored.title": "倉庫位置", "inventory.stored.title": "倉庫位置",
"inventory.stored.addLocationButton": "添加倉庫", "inventory.stored.addLocationButton": "添加倉庫",
"inventory.stored.addLocationPlaceholder": "輸入倉庫名稱...", "inventory.stored.addLocationPlaceholder": "輸入倉庫名稱...",
+10
View File
@@ -28,6 +28,7 @@ export function extractInventoryData(statsText) {
const result = { const result = {
version: 2, version: 2,
onPerson: "None", onPerson: "None",
clothing: "None",
stored: {}, stored: {},
assets: "None" assets: "None"
}; };
@@ -48,6 +49,14 @@ export function extractInventoryData(statsText) {
continue; continue;
} }
// Parse "Clothing: ..." line
const clothingMatch = trimmed.match(/^Clothing:\s*(.+)$/i);
if (clothingMatch) {
result.clothing = clothingMatch[1].trim() || "None";
foundAnyInventoryData = true;
continue;
}
// Parse "Stored - [Location]: ..." lines // Parse "Stored - [Location]: ..." lines
const storedMatch = trimmed.match(/^Stored\s*-\s*([^:]+):\s*(.+)$/i); const storedMatch = trimmed.match(/^Stored\s*-\s*([^:]+):\s*(.+)$/i);
if (storedMatch) { if (storedMatch) {
@@ -122,6 +131,7 @@ export function extractInventory(statsText) {
return { return {
version: 2, version: 2,
onPerson: v1Data, onPerson: v1Data,
clothing: "None",
stored: {}, stored: {},
assets: "None" assets: "None"
}; };
+5
View File
@@ -137,6 +137,11 @@ export function buildInventorySummary(inventory) {
summary += `On Person: ${inventory.onPerson}\n`; summary += `On Person: ${inventory.onPerson}\n`;
} }
// Add Clothing section
if (inventory.clothing && inventory.clothing !== 'None') {
summary += `Clothing: ${inventory.clothing}\n`;
}
// Add Stored sections for each location // Add Stored sections for each location
if (inventory.stored && Object.keys(inventory.stored).length > 0) { if (inventory.stored && Object.keys(inventory.stored).length > 0) {
for (const [location, items] of Object.entries(inventory.stored)) { for (const [location, items] of Object.entries(inventory.stored)) {
+11
View File
@@ -521,6 +521,11 @@ export function renderInfoBox() {
if (extensionSettings.enableAnimations) { if (extensionSettings.enableAnimations) {
setTimeout(() => $infoBoxContainer.removeClass('rpg-content-updating'), 500); setTimeout(() => $infoBoxContainer.removeClass('rpg-content-updating'), 500);
} }
// Update weather effect after rendering
if (window.RPGCompanion?.updateWeatherEffect) {
window.RPGCompanion.updateWeatherEffect();
}
} }
/** /**
@@ -878,6 +883,12 @@ function updateRecentEvent(field, value) {
saveChatData(); saveChatData();
renderInfoBox(); renderInfoBox();
// Update weather effect after rendering
if (window.RPGCompanion?.updateWeatherEffect) {
window.RPGCompanion.updateWeatherEffect();
}
console.log(`[RPG Companion] Updated recent event ${field}:`, value); console.log(`[RPG Companion] Updated recent event ${field}:`, value);
} }
} }
+89 -2
View File
@@ -24,8 +24,8 @@ export function getLocationId(locationName) {
} }
/** /**
* Renders the inventory sub-tab navigation (On Person, Stored, Assets) * Renders the inventory sub-tab navigation (On Person, Clothing, Stored, Assets)
* @param {string} activeTab - Currently active sub-tab ('onPerson', 'stored', 'assets') * @param {string} activeTab - Currently active sub-tab ('onPerson', 'clothing', 'stored', 'assets')
* @returns {string} HTML for sub-tab navigation * @returns {string} HTML for sub-tab navigation
*/ */
export function renderInventorySubTabs(activeTab = 'onPerson') { export function renderInventorySubTabs(activeTab = 'onPerson') {
@@ -34,6 +34,9 @@ export function renderInventorySubTabs(activeTab = 'onPerson') {
<button class="rpg-inventory-subtab ${activeTab === 'onPerson' ? 'active' : ''}" data-tab="onPerson" data-i18n-key="inventory.section.onPerson"> <button class="rpg-inventory-subtab ${activeTab === 'onPerson' ? 'active' : ''}" data-tab="onPerson" data-i18n-key="inventory.section.onPerson">
${i18n.getTranslation('inventory.section.onPerson')} ${i18n.getTranslation('inventory.section.onPerson')}
</button> </button>
<button class="rpg-inventory-subtab ${activeTab === 'clothing' ? 'active' : ''}" data-tab="clothing" data-i18n-key="inventory.section.clothing">
${i18n.getTranslation('inventory.section.clothing')}
</button>
<button class="rpg-inventory-subtab ${activeTab === 'stored' ? 'active' : ''}" data-tab="stored" data-i18n-key="inventory.section.stored"> <button class="rpg-inventory-subtab ${activeTab === 'stored' ? 'active' : ''}" data-tab="stored" data-i18n-key="inventory.section.stored">
${i18n.getTranslation('inventory.section.stored')} ${i18n.getTranslation('inventory.section.stored')}
</button> </button>
@@ -120,6 +123,82 @@ export function renderOnPersonView(onPersonItems, viewMode = 'list') {
`; `;
} }
/**
* Renders the "Clothing" inventory view with list or grid display
* @param {string} clothingItems - Current clothing items (comma-separated string)
* @param {string} viewMode - View mode ('list' or 'grid')
* @returns {string} HTML for clothing view with items and add button
*/
export function renderClothingView(clothingItems, viewMode = 'list') {
const items = parseItems(clothingItems);
let itemsHtml = '';
if (items.length === 0) {
itemsHtml = `<div class="rpg-inventory-empty" data-i18n-key="inventory.clothing.empty">${i18n.getTranslation('inventory.clothing.empty')}</div>`;
} else {
if (viewMode === 'grid') {
// Grid view: card-style items
itemsHtml = items.map((item, index) => `
<div class="rpg-item-card" data-field="clothing" data-index="${index}">
<button class="rpg-item-remove" data-action="remove-item" data-field="clothing" data-index="${index}" title="Remove item">
<i class="fa-solid fa-times"></i>
</button>
<span class="rpg-item-name rpg-editable" contenteditable="true" data-field="clothing" data-index="${index}" title="Click to edit">${escapeHtml(item)}</span>
</div>
`).join('');
} else {
// List view: full-width rows
itemsHtml = items.map((item, index) => `
<div class="rpg-item-row" data-field="clothing" data-index="${index}">
<span class="rpg-item-name rpg-editable" contenteditable="true" data-field="clothing" data-index="${index}" title="Click to edit">${escapeHtml(item)}</span>
<button class="rpg-item-remove" data-action="remove-item" data-field="clothing" data-index="${index}" title="Remove item">
<i class="fa-solid fa-times"></i>
</button>
</div>
`).join('');
}
}
const listViewClass = viewMode === 'list' ? 'rpg-item-list-view' : 'rpg-item-grid-view';
return `
<div class="rpg-inventory-section" data-section="clothing">
<div class="rpg-inventory-header">
<h4 data-i18n-key="inventory.clothing.title">${i18n.getTranslation('inventory.clothing.title')}</h4>
<div class="rpg-inventory-header-actions">
<div class="rpg-view-toggle">
<button class="rpg-view-btn ${viewMode === 'list' ? 'active' : ''}" data-action="switch-view" data-field="clothing" data-view="list" title="${i18n.getTranslation('global.listView')}">
<i class="fa-solid fa-list"></i>
</button>
<button class="rpg-view-btn ${viewMode === 'grid' ? 'active' : ''}" data-action="switch-view" data-field="clothing" data-view="grid" title="${i18n.getTranslation('global.gridView')}">
<i class="fa-solid fa-th"></i>
</button>
</div>
<button class="rpg-inventory-add-btn" data-action="add-item" data-field="clothing" title="Add new item">
<i class="fa-solid fa-plus"></i> <span data-i18n-key="inventory.clothing.addItemButton">${i18n.getTranslation('inventory.clothing.addItemButton')}</span>
</button>
</div>
</div>
<div class="rpg-inventory-content">
<div class="rpg-inline-form" id="rpg-add-item-form-clothing" style="display: none;">
<input type="text" class="rpg-inline-input" id="rpg-new-item-clothing" placeholder="${i18n.getTranslation('inventory.clothing.addItemPlaceholder')}" data-i18n-placeholder-key="inventory.clothing.addItemPlaceholder" />
<div class="rpg-inline-buttons">
<button class="rpg-inline-btn rpg-inline-cancel" data-action="cancel-add-item" data-field="clothing">
<i class="fa-solid fa-times"></i> <span data-i18n-key="global.cancel">${i18n.getTranslation('global.cancel')}</span>
</button>
<button class="rpg-inline-btn rpg-inline-save" data-action="save-add-item" data-field="clothing">
<i class="fa-solid fa-check"></i> <span data-i18n-key="global.add">${i18n.getTranslation('global.add')}</span>
</button>
</div>
</div>
<div class="rpg-item-list ${listViewClass}">
${itemsHtml}
</div>
</div>
</div>
`;
}
/** /**
* Renders the "Stored" inventory view with collapsible locations and list/grid views * Renders the "Stored" inventory view with collapsible locations and list/grid views
* @param {Object.<string, string>} stored - Stored items by location * @param {Object.<string, string>} stored - Stored items by location
@@ -372,6 +451,7 @@ function generateInventoryHTML(inventory, options = {}) {
v2Inventory = { v2Inventory = {
version: 2, version: 2,
onPerson: 'None', onPerson: 'None',
clothing: 'None',
stored: {}, stored: {},
assets: 'None' assets: 'None'
}; };
@@ -381,6 +461,9 @@ function generateInventoryHTML(inventory, options = {}) {
if (!v2Inventory.onPerson || typeof v2Inventory.onPerson !== 'string') { if (!v2Inventory.onPerson || typeof v2Inventory.onPerson !== 'string') {
v2Inventory.onPerson = 'None'; v2Inventory.onPerson = 'None';
} }
if (!v2Inventory.clothing || typeof v2Inventory.clothing !== 'string') {
v2Inventory.clothing = 'None';
}
if (!v2Inventory.stored || typeof v2Inventory.stored !== 'object' || Array.isArray(v2Inventory.stored)) { if (!v2Inventory.stored || typeof v2Inventory.stored !== 'object' || Array.isArray(v2Inventory.stored)) {
v2Inventory.stored = {}; v2Inventory.stored = {};
} }
@@ -397,6 +480,7 @@ function generateInventoryHTML(inventory, options = {}) {
// Get view modes from settings (default to 'list') // Get view modes from settings (default to 'list')
const viewModes = extensionSettings.inventoryViewModes || { const viewModes = extensionSettings.inventoryViewModes || {
onPerson: 'list', onPerson: 'list',
clothing: 'list',
stored: 'list', stored: 'list',
assets: 'list' assets: 'list'
}; };
@@ -406,6 +490,9 @@ function generateInventoryHTML(inventory, options = {}) {
case 'onPerson': case 'onPerson':
html += renderOnPersonView(v2Inventory.onPerson, viewModes.onPerson); html += renderOnPersonView(v2Inventory.onPerson, viewModes.onPerson);
break; break;
case 'clothing':
html += renderClothingView(v2Inventory.clothing, viewModes.clothing);
break;
case 'stored': case 'stored':
html += renderStoredView(v2Inventory.stored, collapsedLocations, viewModes.stored); html += renderStoredView(v2Inventory.stored, collapsedLocations, viewModes.stored);
break; break;
+14 -5
View File
@@ -311,6 +311,10 @@ export function renderThoughts() {
debugLog('[RPG Thoughts] showCharacterThoughts setting:', extensionSettings.showCharacterThoughts); debugLog('[RPG Thoughts] showCharacterThoughts setting:', extensionSettings.showCharacterThoughts);
debugLog('[RPG Thoughts] Container exists:', !!$thoughtsContainer); debugLog('[RPG Thoughts] Container exists:', !!$thoughtsContainer);
// Save scroll position before re-rendering
const scrollParent = $thoughtsContainer.closest('.rpg-content-box, .rpg-tab-content, .rpg-mobile-tab-content').filter(':visible').first();
const savedScrollTop = scrollParent.length > 0 ? scrollParent.scrollTop() : 0;
// Add updating class for animation // Add updating class for animation
if (extensionSettings.enableAnimations) { if (extensionSettings.enableAnimations) {
$thoughtsContainer.addClass('rpg-content-updating'); $thoughtsContainer.addClass('rpg-content-updating');
@@ -474,8 +478,8 @@ export function renderThoughts() {
const escapedDefaultName = escapeHtmlAttr(defaultName); const escapedDefaultName = escapeHtmlAttr(defaultName);
// Determine right-click action text based on auto-generate setting // Determine right-click action text based on auto-generate setting
const defaultAvatarRightClickAction = extensionSettings.autoGenerateAvatars const defaultAvatarRightClickAction = extensionSettings.autoGenerateAvatars
? 'Right-click to regenerate avatar' ? 'Right-click to regenerate avatar'
: 'Right-click to delete avatar'; : 'Right-click to delete avatar';
html += '<div class="rpg-thoughts-content">'; html += '<div class="rpg-thoughts-content">';
@@ -541,8 +545,8 @@ export function renderThoughts() {
const isCurrentlyGenerating = isGenerating(char.name); const isCurrentlyGenerating = isGenerating(char.name);
// Determine right-click action text based on auto-generate setting // Determine right-click action text based on auto-generate setting
const avatarRightClickAction = extensionSettings.autoGenerateAvatars const avatarRightClickAction = extensionSettings.autoGenerateAvatars
? 'Right-click to regenerate avatar' ? 'Right-click to regenerate avatar'
: 'Right-click to delete avatar'; : 'Right-click to delete avatar';
html += ` html += `
@@ -609,6 +613,11 @@ export function renderThoughts() {
$thoughtsContainer.html(html); $thoughtsContainer.html(html);
// Restore scroll position to prevent UI jumping
if (scrollParent.length > 0 && savedScrollTop > 0) {
scrollParent.scrollTop(savedScrollTop);
}
debugLog('[RPG Thoughts] ✓ HTML rendered to container'); debugLog('[RPG Thoughts] ✓ HTML rendered to container');
debugLog('[RPG Thoughts] ======================================================='); debugLog('[RPG Thoughts] =======================================================');
@@ -666,7 +675,7 @@ export function renderThoughts() {
try { try {
// Regenerate the avatar // Regenerate the avatar
const newUrl = await regenerateAvatar(characterName); const newUrl = await regenerateAvatar(characterName);
if (newUrl) { if (newUrl) {
console.log(`[RPG Companion] Successfully regenerated avatar for: ${characterName}`); console.log(`[RPG Companion] Successfully regenerated avatar for: ${characterName}`);
} else { } else {
+44 -22
View File
@@ -4,6 +4,7 @@
*/ */
import { i18n } from '../../core/i18n.js'; import { i18n } from '../../core/i18n.js';
import { extensionSettings } from '../../core/state.js';
/** /**
* Sets up desktop tab navigation for organizing content. * Sets up desktop tab navigation for organizing content.
@@ -31,23 +32,40 @@ export function setupDesktopTabs() {
return; return;
} }
// Create tab navigation // Build tab navigation dynamically based on enabled settings
const $tabNav = $(` const tabButtons = [];
<div class="rpg-tabs-nav"> const hasInventory = $inventory.length > 0 && extensionSettings.showInventory;
<button class="rpg-tab-btn active" data-tab="status"> const hasQuests = $quests.length > 0 && extensionSettings.showQuests;
<i class="fa-solid fa-chart-simple"></i>
<span data-i18n-key="global.status">Status</span> // Status tab (always present if any status content exists)
</button> tabButtons.push(`
<button class="rpg-tab-btn active" data-tab="status">
<i class="fa-solid fa-chart-simple"></i>
<span data-i18n-key="global.status">Status</span>
</button>
`);
// Inventory tab (only if enabled in settings)
if (hasInventory) {
tabButtons.push(`
<button class="rpg-tab-btn" data-tab="inventory"> <button class="rpg-tab-btn" data-tab="inventory">
<i class="fa-solid fa-box"></i> <i class="fa-solid fa-box"></i>
<span data-i18n-key="global.inventory">Inventory</span> <span data-i18n-key="global.inventory">Inventory</span>
</button> </button>
`);
}
// Quests tab (only if enabled in settings)
if (hasQuests) {
tabButtons.push(`
<button class="rpg-tab-btn" data-tab="quests"> <button class="rpg-tab-btn" data-tab="quests">
<i class="fa-solid fa-scroll"></i> <i class="fa-solid fa-scroll"></i>
<span data-i18n-key="global.quests">Quests</span> <span data-i18n-key="global.quests">Quests</span>
</button> </button>
</div> `);
`); }
const $tabNav = $(`<div class="rpg-tabs-nav">${tabButtons.join('')}</div>`);
// Create tab content containers // Create tab content containers
const $statusTab = $('<div class="rpg-tab-content active" data-tab-content="status"></div>'); const $statusTab = $('<div class="rpg-tab-content active" data-tab-content="status"></div>');
@@ -57,23 +75,25 @@ export function setupDesktopTabs() {
// Move sections into their respective tabs (detach to preserve event handlers) // Move sections into their respective tabs (detach to preserve event handlers)
if ($userStats.length > 0) { if ($userStats.length > 0) {
$statusTab.append($userStats.detach()); $statusTab.append($userStats.detach());
$userStats.show(); if (extensionSettings.showUserStats) $userStats.show();
} }
if ($infoBox.length > 0) { if ($infoBox.length > 0) {
$statusTab.append($infoBox.detach()); $statusTab.append($infoBox.detach());
$infoBox.show(); if (extensionSettings.showInfoBox) $infoBox.show();
} }
if ($thoughts.length > 0) { if ($thoughts.length > 0) {
$statusTab.append($thoughts.detach()); $statusTab.append($thoughts.detach());
$thoughts.show(); if (extensionSettings.showCharacterThoughts) $thoughts.show();
} }
if ($inventory.length > 0) { if ($inventory.length > 0) {
$inventoryTab.append($inventory.detach()); $inventoryTab.append($inventory.detach());
$inventory.show(); // Only show if enabled (will be part of tab structure)
if (hasInventory) $inventory.show();
} }
if ($quests.length > 0) { if ($quests.length > 0) {
$questsTab.append($quests.detach()); $questsTab.append($quests.detach());
$quests.show(); // Only show if enabled (will be part of tab structure)
if (hasQuests) $quests.show();
} }
// Hide dividers on desktop tabs (tabs separate content naturally) // Hide dividers on desktop tabs (tabs separate content naturally)
@@ -83,6 +103,9 @@ export function setupDesktopTabs() {
const $tabsContainer = $('<div class="rpg-tabs-container"></div>'); const $tabsContainer = $('<div class="rpg-tabs-container"></div>');
$tabsContainer.append($tabNav); $tabsContainer.append($tabNav);
$tabsContainer.append($statusTab); $tabsContainer.append($statusTab);
// Always append inventory and quests tabs to preserve the elements
// But they'll only show if enabled (via tab button visibility)
$tabsContainer.append($inventoryTab); $tabsContainer.append($inventoryTab);
$tabsContainer.append($questsTab); $tabsContainer.append($questsTab);
@@ -103,7 +126,7 @@ export function setupDesktopTabs() {
$(`.rpg-tab-content[data-tab-content="${tabName}"]`).addClass('active'); $(`.rpg-tab-content[data-tab-content="${tabName}"]`).addClass('active');
}); });
console.log('[RPG Desktop] Desktop tabs initialized');
} }
/** /**
@@ -145,12 +168,11 @@ export function removeDesktopTabs() {
$contentBox.append($quests); $contentBox.append($quests);
} }
// Show sections and dividers // Show/hide sections based on settings (respect visibility settings)
$userStats.show(); if (extensionSettings.showUserStats) $userStats.show();
$infoBox.show(); if (extensionSettings.showInfoBox) $infoBox.show();
$thoughts.show(); if (extensionSettings.showCharacterThoughts) $thoughts.show();
$inventory.show(); if (extensionSettings.showInventory) $inventory.show();
if (extensionSettings.showQuests) $quests.show();
$('.rpg-divider').show(); $('.rpg-divider').show();
console.log('[RPG Desktop] Desktop tabs removed');
} }
+49 -13
View File
@@ -11,9 +11,13 @@ import {
$thoughtsContainer, $thoughtsContainer,
$inventoryContainer, $inventoryContainer,
$questsContainer, $questsContainer,
$musicPlayerContainer $musicPlayerContainer,
setInventoryContainer,
setQuestsContainer
} from '../../core/state.js'; } from '../../core/state.js';
import { i18n } from '../../core/i18n.js'; import { i18n } from '../../core/i18n.js';
import { setupMobileTabs, removeMobileTabs } from './mobile.js';
import { setupDesktopTabs, removeDesktopTabs } from './desktop.js';
/** /**
* Toggles the visibility of plot buttons based on settings. * Toggles the visibility of plot buttons based on settings.
@@ -248,6 +252,10 @@ export function updatePanelVisibility() {
* Updates the visibility of individual sections. * Updates the visibility of individual sections.
*/ */
export function updateSectionVisibility() { export function updateSectionVisibility() {
// Refresh container references first (in case they were detached during tab operations)
setInventoryContainer($('#rpg-inventory'));
setQuestsContainer($('#rpg-quests'));
// Show/hide sections based on settings // Show/hide sections based on settings
// Use explicit .show()/.hide() instead of .toggle() to ensure proper state on reload // Use explicit .show()/.hide() instead of .toggle() to ensure proper state on reload
if (extensionSettings.showUserStats) { if (extensionSettings.showUserStats) {
@@ -268,20 +276,17 @@ export function updateSectionVisibility() {
$thoughtsContainer.hide(); $thoughtsContainer.hide();
} }
if ($inventoryContainer) { // Use direct DOM selectors for inventory and quests to avoid stale references
if (extensionSettings.showInventory) { if (extensionSettings.showInventory) {
$inventoryContainer.show(); $('#rpg-inventory').show();
} else { } else {
$inventoryContainer.hide(); $('#rpg-inventory').hide();
}
} }
if ($questsContainer) { if (extensionSettings.showQuests) {
if (extensionSettings.showQuests) { $('#rpg-quests').show();
$questsContainer.show(); } else {
} else { $('#rpg-quests').hide();
$questsContainer.hide();
}
} }
if ($musicPlayerContainer) { if ($musicPlayerContainer) {
@@ -335,6 +340,37 @@ export function updateSectionVisibility() {
} else { } else {
$('#rpg-divider-quests').hide(); $('#rpg-divider-quests').hide();
} }
// Rebuild tabs to reflect visibility changes for inventory and quests
const isMobile = window.innerWidth <= 1000;
const hasMobileTabs = $('.rpg-mobile-container').length > 0;
const hasDesktopTabs = $('.rpg-tabs-nav').length > 0;
// Only rebuild if tabs currently exist
if (hasMobileTabs || hasDesktopTabs) {
// Remove existing tabs
if (hasMobileTabs) {
removeMobileTabs();
// Force remove any lingering mobile tab elements (but not the content sections!)
$('.rpg-mobile-container').remove();
$('.rpg-mobile-tabs').remove();
} else {
removeDesktopTabs();
// Force remove any lingering desktop tab structure (but not the content sections!)
// The removeDesktopTabs() function already detached and restored the sections
}
// Rebuild tabs immediately
if (isMobile) {
setupMobileTabs();
} else {
setupDesktopTabs();
}
// Refresh container references
setInventoryContainer($('#rpg-inventory'));
setQuestsContainer($('#rpg-quests'));
}
} }
/** /**
+14 -13
View File
@@ -579,8 +579,8 @@ export function setupMobileTabs() {
const tabs = []; const tabs = [];
const hasStats = $userStats.length > 0; const hasStats = $userStats.length > 0;
const hasInfo = $infoBox.length > 0 || $thoughts.length > 0; const hasInfo = $infoBox.length > 0 || $thoughts.length > 0;
const hasInventory = $inventory.length > 0; const hasInventory = $inventory.length > 0 && extensionSettings.showInventory;
const hasQuests = $quests.length > 0; const hasQuests = $quests.length > 0 && extensionSettings.showQuests;
// Tab 1: Stats (User Stats only) // Tab 1: Stats (User Stats only)
if (hasStats) { if (hasStats) {
@@ -650,12 +650,12 @@ export function setupMobileTabs() {
const $mobileContainer = $('<div class="rpg-mobile-container"></div>'); const $mobileContainer = $('<div class="rpg-mobile-container"></div>');
$mobileContainer.append($tabNav); $mobileContainer.append($tabNav);
// Only append tab content wrappers that have content // Always append all tab content wrappers to preserve elements
if (hasStats) $mobileContainer.append($statsTab); // Tab buttons control visibility
if (hasInfo) $mobileContainer.append($infoTab); $mobileContainer.append($statsTab);
if (hasInventory) $mobileContainer.append($inventoryTab); $mobileContainer.append($infoTab);
if (hasQuests) $mobileContainer.append($questsTab); $mobileContainer.append($inventoryTab);
if (hasInventory) $mobileContainer.append($inventoryTab); $mobileContainer.append($questsTab);
// Insert mobile tab structure at the beginning of content box // Insert mobile tab structure at the beginning of content box
$contentBox.prepend($mobileContainer); $contentBox.prepend($mobileContainer);
@@ -712,11 +712,12 @@ export function removeMobileTabs() {
$contentBox.prepend($userStats); $contentBox.prepend($userStats);
} }
// Show sections and dividers // Show/hide sections based on settings (respect visibility settings)
$userStats.show(); if (extensionSettings.showUserStats) $userStats.show();
$infoBox.show(); if (extensionSettings.showInfoBox) $infoBox.show();
$thoughts.show(); if (extensionSettings.showCharacterThoughts) $thoughts.show();
$inventory.show(); if (extensionSettings.showInventory) $inventory.show();
if (extensionSettings.showQuests) $quests.show();
$('.rpg-divider').show(); $('.rpg-divider').show();
} }
+4 -1
View File
@@ -84,16 +84,19 @@ export function updateFeatureTogglesVisibility() {
const $htmlToggle = $('#rpg-html-toggle-wrapper'); const $htmlToggle = $('#rpg-html-toggle-wrapper');
const $spotifyToggle = $('#rpg-spotify-toggle-wrapper'); const $spotifyToggle = $('#rpg-spotify-toggle-wrapper');
const $snowflakesToggle = $('#rpg-snowflakes-toggle-wrapper'); const $snowflakesToggle = $('#rpg-snowflakes-toggle-wrapper');
const $dynamicWeatherToggle = $('#rpg-dynamic-weather-toggle-wrapper');
// Show/hide individual toggles // Show/hide individual toggles
$htmlToggle.toggle(extensionSettings.showHtmlToggle); $htmlToggle.toggle(extensionSettings.showHtmlToggle);
$spotifyToggle.toggle(extensionSettings.showSpotifyToggle); $spotifyToggle.toggle(extensionSettings.showSpotifyToggle);
$snowflakesToggle.toggle(extensionSettings.showSnowflakesToggle); $snowflakesToggle.toggle(extensionSettings.showSnowflakesToggle);
$dynamicWeatherToggle.toggle(extensionSettings.showDynamicWeatherToggle);
// Hide entire row if all toggles are hidden // Hide entire row if all toggles are hidden
const anyVisible = extensionSettings.showHtmlToggle || const anyVisible = extensionSettings.showHtmlToggle ||
extensionSettings.showSpotifyToggle || extensionSettings.showSpotifyToggle ||
extensionSettings.showSnowflakesToggle; extensionSettings.showSnowflakesToggle ||
extensionSettings.showDynamicWeatherToggle;
$featuresRow.toggle(anyVisible); $featuresRow.toggle(anyVisible);
} }
+107
View File
@@ -68,6 +68,16 @@ export function initTrackerEditor() {
$(document).on('click', '#rpg-open-tracker-editor', function() { $(document).on('click', '#rpg-open-tracker-editor', function() {
openTrackerEditor(); openTrackerEditor();
}); });
// Export button
$(document).on('click', '#rpg-editor-export', function() {
exportTrackerPreset();
});
// Import button
$(document).on('click', '#rpg-editor-import', function() {
importTrackerPreset();
});
} }
/** /**
@@ -188,6 +198,103 @@ function resetToDefaults() {
}; };
} }
/**
* Export current tracker configuration to a JSON file
*/
function exportTrackerPreset() {
try {
// Get the current tracker configuration
const config = extensionSettings.trackerConfig;
// Create a preset object with metadata
const preset = {
name: 'Custom Tracker Preset',
version: '1.0',
exportDate: new Date().toISOString(),
trackerConfig: JSON.parse(JSON.stringify(config)) // Deep copy
};
// Convert to JSON
const jsonString = JSON.stringify(preset, null, 2);
const blob = new Blob([jsonString], { type: 'application/json' });
// Create download link
const url = URL.createObjectURL(blob);
const link = document.createElement('a');
link.href = url;
// Generate filename with timestamp
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, -5);
link.download = `rpg-tracker-preset-${timestamp}.json`;
// Trigger download
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
URL.revokeObjectURL(url);
console.log('[RPG Companion] Tracker preset exported successfully');
toastr.success(i18n.getTranslation('template.trackerEditorModal.messages.exportSuccess') || 'Tracker preset exported successfully!');
} catch (error) {
console.error('[RPG Companion] Error exporting tracker preset:', error);
toastr.error(i18n.getTranslation('template.trackerEditorModal.messages.exportError') || 'Failed to export tracker preset. Check console for details.');
}
}
/**
* Import tracker configuration from a JSON file
*/
function importTrackerPreset() {
// Create file input
const input = document.createElement('input');
input.type = 'file';
input.accept = '.json';
input.onchange = async (e) => {
const file = e.target.files[0];
if (!file) return;
try {
const text = await file.text();
const data = JSON.parse(text);
// Validate the imported data
if (!data.trackerConfig) {
throw new Error('Invalid preset file: missing trackerConfig');
}
// Validate required sections
if (!data.trackerConfig.userStats || !data.trackerConfig.infoBox || !data.trackerConfig.presentCharacters) {
throw new Error('Invalid preset file: missing required configuration sections');
}
// Ask for confirmation
const confirmMessage = i18n.getTranslation('template.trackerEditorModal.messages.importConfirm') ||
'This will replace your current tracker configuration. Continue?';
if (!confirm(confirmMessage)) {
return;
}
// Apply the imported configuration
extensionSettings.trackerConfig = JSON.parse(JSON.stringify(data.trackerConfig)); // Deep copy
// Re-render the editor UI
renderEditorUI();
console.log('[RPG Companion] Tracker preset imported successfully');
toastr.success(i18n.getTranslation('template.trackerEditorModal.messages.importSuccess') || 'Tracker preset imported successfully!');
} catch (error) {
console.error('[RPG Companion] Error importing tracker preset:', error);
toastr.error(i18n.getTranslation('template.trackerEditorModal.messages.importError') ||
`Failed to import tracker preset: ${error.message}`);
}
};
// Trigger file selection
input.click();
}
/** /**
* Render the editor UI based on current config * Render the editor UI based on current config
*/ */
+289
View File
@@ -0,0 +1,289 @@
/**
* Dynamic Weather Effects Module
* Creates weather effects based on the Info Box weather field
*/
import { extensionSettings, lastGeneratedData, committedTrackerData } from '../../core/state.js';
let weatherContainer = null;
let currentWeatherType = null;
/**
* Parse weather text to determine effect type
*/
function parseWeatherType(weatherText) {
if (!weatherText) return 'none';
const text = weatherText.toLowerCase();
// Check for specific weather conditions (order matters - check combined effects first)
if (text.includes('blizzard')) {
return 'blizzard'; // Snow + Wind
}
if (text.includes('storm') || text.includes('thunder') || text.includes('lightning')) {
return 'storm'; // Rain + Lightning
}
if (text.includes('wind') || text.includes('breeze') || text.includes('gust') || text.includes('gale')) {
return 'wind';
}
if (text.includes('snow') || text.includes('flurries')) {
return 'snow';
}
if (text.includes('rain') || text.includes('drizzle') || text.includes('shower')) {
return 'rain';
}
if (text.includes('mist') || text.includes('fog') || text.includes('haze')) {
return 'mist';
}
if (text.includes('sunny') || text.includes('clear') || text.includes('bright')) {
return 'sunny';
}
if (text.includes('cloud') || text.includes('overcast') || text.includes('indoor') || text.includes('inside')) {
return 'none';
}
return 'none';
}
/**
* Extract weather from Info Box data
*/
function getCurrentWeather() {
const infoBoxData = lastGeneratedData.infoBox || committedTrackerData.infoBox || '';
// Parse the Info Box data to find Weather field
const lines = infoBoxData.split('\n');
for (const line of lines) {
const trimmed = line.trim();
if (trimmed.startsWith('Weather:')) {
return trimmed.substring('Weather:'.length).trim();
}
}
return null;
}
/**
* Create snowflakes effect
*/
function createSnowflakes() {
const container = document.createElement('div');
container.className = 'rpg-weather-particles';
// Create 50 snowflakes
for (let i = 0; i < 50; i++) {
const snowflake = document.createElement('div');
snowflake.className = 'rpg-weather-particle rpg-snowflake';
snowflake.textContent = '❄';
snowflake.style.left = `${Math.random() * 100}%`;
snowflake.style.animationDelay = `${Math.random() * 10}s`;
snowflake.style.animationDuration = `${10 + Math.random() * 10}s`;
container.appendChild(snowflake);
}
return container;
}
/**
* Create rain effect
*/
function createRain() {
const container = document.createElement('div');
container.className = 'rpg-weather-particles';
// Create 100 raindrops for heavier effect
for (let i = 0; i < 100; i++) {
const raindrop = document.createElement('div');
raindrop.className = 'rpg-weather-particle rpg-raindrop';
raindrop.style.left = `${Math.random() * 100}%`;
raindrop.style.animationDelay = `${Math.random() * 2}s`;
raindrop.style.animationDuration = `${0.5 + Math.random() * 0.5}s`;
container.appendChild(raindrop);
}
return container;
}
/**
* Create mist/fog effect
*/
function createMist() {
const container = document.createElement('div');
container.className = 'rpg-weather-particles';
// Create 5 mist layers
for (let i = 0; i < 5; i++) {
const mist = document.createElement('div');
mist.className = 'rpg-weather-particle rpg-mist';
mist.style.animationDelay = `${i * 2}s`;
mist.style.animationDuration = `${15 + i * 2}s`;
mist.style.opacity = `${0.1 + Math.random() * 0.2}`;
container.appendChild(mist);
}
return container;
}
/**
* Create sunshine rays effect
*/
function createSunshine() {
const container = document.createElement('div');
container.className = 'rpg-weather-particles';
// Create 8 sun rays
for (let i = 0; i < 8; i++) {
const ray = document.createElement('div');
ray.className = 'rpg-weather-particle rpg-sunray';
ray.style.left = `${10 + i * 12}%`;
ray.style.animationDelay = `${i * 0.5}s`;
ray.style.animationDuration = `${8 + Math.random() * 4}s`;
container.appendChild(ray);
}
return container;
}
/**
* Create lightning flash effect
*/
function createLightning() {
const container = document.createElement('div');
container.className = 'rpg-weather-particles';
// Create lightning flash overlay
const flash = document.createElement('div');
flash.className = 'rpg-weather-particle rpg-lightning';
container.appendChild(flash);
return container;
}
/**
* Create wind effect
*/
function createWind() {
const container = document.createElement('div');
container.className = 'rpg-weather-particles';
// Create 30 wind streaks
for (let i = 0; i < 30; i++) {
const streak = document.createElement('div');
streak.className = 'rpg-weather-particle rpg-wind-streak';
streak.style.top = `${Math.random() * 100}%`;
streak.style.animationDelay = `${Math.random() * 5}s`;
streak.style.animationDuration = `${1.5 + Math.random() * 1}s`;
container.appendChild(streak);
}
return container;
}
/**
* Remove current weather effect
*/
function removeWeatherEffect() {
if (weatherContainer) {
weatherContainer.remove();
weatherContainer = null;
currentWeatherType = null;
}
}
/**
* Update weather effect based on current weather
*/
export function updateWeatherEffect() {
// Check if dynamic weather is enabled
if (!extensionSettings.enableDynamicWeather) {
removeWeatherEffect();
return;
}
const weather = getCurrentWeather();
const weatherType = parseWeatherType(weather);
// Don't recreate if weather hasn't changed
if (weatherType === currentWeatherType) {
return;
}
// Remove existing effect
removeWeatherEffect();
// Create new effect based on weather type
if (weatherType === 'none') {
return; // No effect
}
currentWeatherType = weatherType;
switch (weatherType) {
case 'snow':
weatherContainer = createSnowflakes();
break;
case 'rain':
weatherContainer = createRain();
break;
case 'mist':
weatherContainer = createMist();
break;
case 'sunny':
weatherContainer = createSunshine();
break;
case 'wind':
weatherContainer = createWind();
break;
case 'storm': {
// Storm = Rain + Lightning (combined effects)
const rainContainer = createRain();
const lightningContainer = createLightning();
// Merge both containers
weatherContainer = document.createElement('div');
weatherContainer.className = 'rpg-weather-particles';
weatherContainer.appendChild(rainContainer);
weatherContainer.appendChild(lightningContainer);
break;
}
case 'blizzard': {
// Blizzard = Snow + Wind (combined effects)
const snowContainer = createSnowflakes();
const windContainer = createWind();
// Merge both containers
weatherContainer = document.createElement('div');
weatherContainer.className = 'rpg-weather-particles';
weatherContainer.appendChild(snowContainer);
weatherContainer.appendChild(windContainer);
break;
}
}
if (weatherContainer) {
document.body.appendChild(weatherContainer);
}
}
/**
* Initialize weather effects
*/
export function initWeatherEffects() {
updateWeatherEffect();
}
/**
* Toggle dynamic weather effects
*/
export function toggleDynamicWeather(enabled) {
if (enabled) {
updateWeatherEffect();
} else {
removeWeatherEffect();
}
}
/**
* Clean up weather effects
*/
export function cleanupWeatherEffects() {
removeWeatherEffect();
}
+1
View File
@@ -8,6 +8,7 @@
* @typedef {Object} InventoryV2 * @typedef {Object} InventoryV2
* @property {number} version - Schema version (always 2) * @property {number} version - Schema version (always 2)
* @property {string} onPerson - Items currently carried/worn by the character (plaintext list) * @property {string} onPerson - Items currently carried/worn by the character (plaintext list)
* @property {string} clothing - Clothing and armor currently worn (plaintext list)
* @property {Object.<string, string>} stored - Items stored at named locations (location name plaintext list) * @property {Object.<string, string>} stored - Items stored at named locations (location name plaintext list)
* @property {string} assets - Character's vehicles, property, and major possessions (plaintext list) * @property {string} assets - Character's vehicles, property, and major possessions (plaintext list)
*/ */
+13
View File
@@ -15,6 +15,7 @@
const DEFAULT_INVENTORY_V2 = { const DEFAULT_INVENTORY_V2 = {
version: 2, version: 2,
onPerson: "None", onPerson: "None",
clothing: "None",
stored: {}, stored: {},
assets: "None" assets: "None"
}; };
@@ -29,6 +30,17 @@ const DEFAULT_INVENTORY_V2 = {
export function migrateInventory(inventory) { export function migrateInventory(inventory) {
// Case 1: Already v2 format (has version property and is an object) // Case 1: Already v2 format (has version property and is an object)
if (inventory && typeof inventory === 'object' && inventory.version === 2) { if (inventory && typeof inventory === 'object' && inventory.version === 2) {
// Check if clothing field exists (v2.1 upgrade)
if (!inventory.hasOwnProperty('clothing')) {
// console.log('[RPG Companion Migration] Upgrading v2 inventory to v2.1 (adding clothing field)');
inventory.clothing = "None";
return {
inventory: inventory,
migrated: true,
source: 'v2-upgrade'
};
}
// console.log('[RPG Companion Migration] Inventory already v2, no migration needed'); // console.log('[RPG Companion Migration] Inventory already v2, no migration needed');
return { return {
inventory: inventory, inventory: inventory,
@@ -66,6 +78,7 @@ export function migrateInventory(inventory) {
inventory: { inventory: {
version: 2, version: 2,
onPerson: inventory, onPerson: inventory,
clothing: "None",
stored: {}, stored: {},
assets: "None" assets: "None"
}, },
+271 -22
View File
@@ -407,6 +407,14 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
color: var(--rpg-highlight); color: var(--rpg-highlight);
text-shadow: 0 0 8px var(--rpg-highlight); text-shadow: 0 0 8px var(--rpg-highlight);
letter-spacing: 0.031em; letter-spacing: 0.031em;
border-left: none !important;
padding-left: 0 !important;
}
.rpg-panel-header h3 i {
border-left: none !important;
padding-left: 0 !important;
color: var(--rpg-highlight);
} }
.rpg-btn-icon { .rpg-btn-icon {
@@ -2531,8 +2539,8 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
width: 100%; width: 100%;
padding: 0.75em 1em; padding: 0.75em 1em;
margin-bottom: 10px; margin-bottom: 10px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); background: linear-gradient(135deg, var(--rpg-border, #4a7ba7) 0%, var(--rpg-highlight, #e94560) 100%);
border: 2px solid rgba(102, 126, 234, 0.5); border: 2px solid var(--rpg-border-transparent, rgba(74, 123, 167, 0.5));
border-radius: 0.5em; border-radius: 0.5em;
color: #ffffff; color: #ffffff;
font-size: 14px; font-size: 14px;
@@ -2546,10 +2554,10 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
} }
.rpg-memory-recollection-btn:hover { .rpg-memory-recollection-btn:hover {
background: linear-gradient(135deg, #764ba2 0%, #667eea 100%); background: linear-gradient(135deg, var(--rpg-highlight, #e94560) 0%, var(--rpg-border, #4a7ba7) 100%);
border-color: rgba(102, 126, 234, 0.8); border-color: var(--rpg-border-opaque, rgba(74, 123, 167, 0.8));
transform: translateY(-2px); transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3); box-shadow: 0 4px 12px var(--rpg-border-transparent, rgba(74, 123, 167, 0.3));
} }
.rpg-memory-recollection-btn:active { .rpg-memory-recollection-btn:active {
@@ -2580,7 +2588,7 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
/* Modal Container */ /* Modal Container */
.rpg-memory-modal { .rpg-memory-modal {
background: var(--SmartThemeBlurTintColor, #1a1a2e); background: var(--SmartThemeBlurTintColor, #1a1a2e);
border: 2px solid var(--SmartThemeBorderColor, #667eea); border: 2px solid var(--rpg-border, var(--SmartThemeBorderColor, #4a7ba7));
border-radius: 12px; border-radius: 12px;
max-width: 500px; max-width: 500px;
width: 90%; width: 90%;
@@ -2602,7 +2610,7 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
/* Modal Header */ /* Modal Header */
.rpg-memory-modal-header { .rpg-memory-modal-header {
padding: 1.25em; padding: 1.25em;
border-bottom: 1px solid var(--SmartThemeBorderColor, #667eea); border-bottom: 1px solid var(--rpg-border, var(--SmartThemeBorderColor, #4a7ba7));
background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%); background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
} }
@@ -2625,10 +2633,10 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
} }
.rpg-memory-modal-info { .rpg-memory-modal-info {
background: rgba(102, 126, 234, 0.1); background: var(--rpg-border, rgba(102, 126, 234, 0.1));
padding: 1em; padding: 1em;
border-radius: 8px; border-radius: 8px;
border-left: 4px solid #667eea; border-left: 4px solid var(--rpg-border, var(--SmartThemeBorderColor, #4a7ba7));
margin-top: 1em; margin-top: 1em;
} }
@@ -2656,7 +2664,7 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
.rpg-memory-progress-fill { .rpg-memory-progress-fill {
height: 100%; height: 100%;
width: 0%; width: 0%;
background: linear-gradient(90deg, #667eea 0%, #764ba2 100%); background: linear-gradient(90deg, var(--rpg-border, #4a7ba7) 0%, var(--rpg-highlight, #e94560) 100%);
transition: width 0.3s ease; transition: width 0.3s ease;
display: flex; display: flex;
align-items: center; align-items: center;
@@ -2680,7 +2688,7 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
/* Modal Footer */ /* Modal Footer */
.rpg-memory-modal-footer { .rpg-memory-modal-footer {
padding: 1em 1.25em; padding: 1em 1.25em;
border-top: 1px solid var(--SmartThemeBorderColor, #667eea); border-top: 1px solid var(--rpg-border, var(--SmartThemeBorderColor, #4a7ba7));
display: flex; display: flex;
gap: 0.75em; gap: 0.75em;
justify-content: flex-end; justify-content: flex-end;
@@ -2709,15 +2717,15 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
} }
.rpg-memory-proceed { .rpg-memory-proceed {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); background: linear-gradient(135deg, var(--rpg-border, #4a7ba7) 0%, var(--rpg-highlight, #e94560) 100%);
color: white; color: white;
border: 2px solid rgba(102, 126, 234, 0.5); border: 2px solid var(--rpg-border-transparent, rgba(74, 123, 167, 0.5));
} }
.rpg-memory-proceed:hover { .rpg-memory-proceed:hover {
background: linear-gradient(135deg, #764ba2 0%, #667eea 100%); background: linear-gradient(135deg, var(--rpg-highlight, #e94560) 0%, var(--rpg-border, #4a7ba7) 100%);
border-color: rgba(102, 126, 234, 0.8); border-color: var(--rpg-border-opaque, rgba(74, 123, 167, 0.8));
box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3); box-shadow: 0 4px 12px var(--rpg-border-transparent, rgba(74, 123, 167, 0.3));
} }
/* ============================================ /* ============================================
@@ -3741,8 +3749,8 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
} }
.rpg-editor-tab-content { .rpg-editor-tab-content {
max-height: 60vh; max-height: none;
overflow-y: auto; overflow-y: visible;
} }
.rpg-editor-section { .rpg-editor-section {
@@ -4090,6 +4098,11 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
background: var(--rpg-accent); background: var(--rpg-accent);
} }
.rpg-footer-left {
display: flex;
gap: 0.5em;
}
.rpg-footer-right { .rpg-footer-right {
display: flex; display: flex;
gap: 0.5em; gap: 0.5em;
@@ -4280,6 +4293,14 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
display: flex; display: flex;
align-items: center; align-items: center;
gap: var(--modal-gap); gap: var(--modal-gap);
border-left: none !important;
padding-left: 0 !important;
}
.rpg-settings-popup-header h3 i {
border-left: none !important;
padding-left: 0 !important;
color: var(--rpg-highlight);
} }
/* Close button - touch-friendly */ /* Close button - touch-friendly */
@@ -6775,12 +6796,12 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
gap: 8px; gap: 8px;
padding: 8px 12px; padding: 8px 12px;
margin-bottom: 12px; margin-bottom: 12px;
background: linear-gradient(135deg, rgba(74, 158, 255, 0.15) 0%, rgba(74, 158, 255, 0.05) 100%); background: linear-gradient(135deg, var(--rpg-border-transparent, rgba(74, 158, 255, 0.15)) 0%, var(--rpg-border-transparent-fade, rgba(74, 158, 255, 0.05)) 100%);
border-left: 4px solid #4a9eff; border-left: 4px solid var(--rpg-border, #4a7ba7);
border-radius: 4px; border-radius: 4px;
font-size: 13px; font-size: 13px;
font-weight: 600; font-weight: 600;
color: #4a9eff; color: var(--rpg-highlight, #4a9eff);
animation: checkpoint-fade-in 0.3s ease-out; animation: checkpoint-fade-in 0.3s ease-out;
} }
@@ -6811,7 +6832,7 @@ body:has(.rpg-panel.rpg-position-left) #sheld {
top: 0; top: 0;
bottom: 0; bottom: 0;
width: 3px; width: 3px;
background: linear-gradient(180deg, #4a9eff 0%, transparent 100%); background: linear-gradient(180deg, var(--rpg-border, #4a7ba7) 0%, transparent 100%);
opacity: 0.5; opacity: 0.5;
} }
@@ -8580,6 +8601,234 @@ body[data-theme="cyberpunk"] .rpg-music-widget-play {
} }
} }
/* ============================================
DYNAMIC WEATHER EFFECTS
============================================ */
/* Weather particles container */
.rpg-weather-particles {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
pointer-events: none;
z-index: 1;
overflow: hidden;
}
/* Base particle */
.rpg-weather-particle {
position: absolute;
}
/* Rain drops */
.rpg-raindrop {
width: 2px;
height: 50px;
background: linear-gradient(to bottom, rgba(174, 194, 224, 0), rgba(174, 194, 224, 0.8));
animation: rpg-rainfall linear infinite;
top: -50px;
}
@keyframes rpg-rainfall {
0% {
transform: translateY(0);
opacity: 0.8;
}
100% {
transform: translateY(100vh);
opacity: 0.3;
}
}
.rpg-raindrop:nth-child(2n) {
height: 40px;
animation-duration: 0.6s;
}
.rpg-raindrop:nth-child(3n) {
height: 60px;
animation-duration: 0.8s;
}
/* Mist/Fog layers */
.rpg-mist {
width: 100%;
height: 40%;
background: radial-gradient(ellipse at center, rgba(200, 200, 220, 0.3) 0%, transparent 70%);
animation: rpg-mistFloat ease-in-out infinite;
top: 30%;
}
@keyframes rpg-mistFloat {
0%, 100% {
transform: translateX(-10%) scale(1);
opacity: 0.15;
}
50% {
transform: translateX(10%) scale(1.1);
opacity: 0.25;
}
}
.rpg-mist:nth-child(2) {
top: 10%;
background: radial-gradient(ellipse at center, rgba(180, 180, 200, 0.2) 0%, transparent 70%);
}
.rpg-mist:nth-child(3) {
top: 50%;
background: radial-gradient(ellipse at center, rgba(220, 220, 240, 0.25) 0%, transparent 70%);
}
/* Sunshine rays */
.rpg-sunray {
width: 3px;
height: 100vh;
background: linear-gradient(to bottom,
rgba(255, 250, 200, 0) 0%,
rgba(255, 250, 200, 0.3) 20%,
rgba(255, 250, 200, 0.15) 50%,
rgba(255, 250, 200, 0) 100%);
transform-origin: top;
animation: rpg-sunrayShine ease-in-out infinite;
top: -20%;
filter: blur(2px);
}
@keyframes rpg-sunrayShine {
0%, 100% {
opacity: 0.2;
transform: translateY(0) scaleY(1);
}
50% {
opacity: 0.4;
transform: translateY(5%) scaleY(1.05);
}
}
.rpg-sunray:nth-child(2n) {
width: 4px;
animation-duration: 10s;
}
.rpg-sunray:nth-child(3n) {
width: 2px;
animation-duration: 12s;
}
/* Mobile optimizations */
@media (max-width: 768px) {
.rpg-raindrop {
animation-duration: 1s !important;
}
.rpg-mist {
animation-duration: 20s;
}
.rpg-sunray {
animation-duration: 15s;
}
}
/* Lightning flash effect */
.rpg-lightning {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(255, 255, 255, 0);
animation: rpg-lightningFlash 6s ease-in-out infinite;
pointer-events: none;
}
@keyframes rpg-lightningFlash {
0%, 100% {
background: rgba(255, 255, 255, 0);
}
10% {
background: rgba(200, 220, 255, 0.4);
}
10.5% {
background: rgba(255, 255, 255, 0);
}
11% {
background: rgba(220, 235, 255, 0.6);
}
11.3% {
background: rgba(255, 255, 255, 0);
}
45% {
background: rgba(255, 255, 255, 0);
}
45.2% {
background: rgba(210, 225, 255, 0.5);
}
45.5% {
background: rgba(255, 255, 255, 0);
}
}
/* Wind streaks effect */
.rpg-wind-streak {
position: absolute;
width: 80px;
height: 2px;
background: linear-gradient(to right, rgba(200, 200, 220, 0), rgba(200, 200, 220, 0.5), rgba(200, 200, 220, 0));
animation: rpg-windBlow linear infinite;
left: -100px;
opacity: 0.6;
transform: skewX(-20deg);
}
@keyframes rpg-windBlow {
0% {
transform: translateX(0) skewX(-20deg);
opacity: 0;
}
10% {
opacity: 0.6;
}
90% {
opacity: 0.6;
}
100% {
transform: translateX(calc(100vw + 100px)) skewX(-20deg);
opacity: 0;
}
}
.rpg-wind-streak:nth-child(2n) {
width: 100px;
animation-duration: 2s;
opacity: 0.4;
}
.rpg-wind-streak:nth-child(3n) {
width: 60px;
animation-duration: 1.8s;
opacity: 0.7;
}
.rpg-wind-streak:nth-child(4n) {
height: 1px;
opacity: 0.5;
}
/* Mobile optimizations for new effects */
@media (max-width: 768px) {
.rpg-wind-streak {
animation-duration: 2.5s !important;
}
.rpg-lightning {
animation-duration: 8s;
}
}
/* ============================================ /* ============================================
HOLIDAY PROMOTION BANNER HOLIDAY PROMOTION BANNER
============================================ */ ============================================ */
+28 -4
View File
@@ -98,6 +98,15 @@
<span class="rpg-toggle-text" data-i18n-key="template.mainPanel.snowflakesEffect">Snowflakes Effect</span> <span class="rpg-toggle-text" data-i18n-key="template.mainPanel.snowflakesEffect">Snowflakes Effect</span>
</label> </label>
</div> </div>
<!-- Dynamic Weather Toggle -->
<div class="rpg-toggle-container rpg-feature-col" id="rpg-dynamic-weather-toggle-wrapper">
<label class="rpg-toggle-label" title="Dynamic Weather Effects">
<input type="checkbox" id="rpg-toggle-dynamic-weather">
<i class="fa-solid fa-cloud-sun-rain"></i>
<span class="rpg-toggle-text" data-i18n-key="template.mainPanel.dynamicWeatherEffects">Dynamic Weather</span>
</label>
</div>
</div> </div>
<!-- Manual Update Button --> <!-- Manual Update Button -->
@@ -293,6 +302,11 @@
<span data-i18n-key="template.settingsModal.display.showSnowflakesToggle">Show Snowflakes Effect</span> <span data-i18n-key="template.settingsModal.display.showSnowflakesToggle">Show Snowflakes Effect</span>
</label> </label>
<label class="checkbox_label">
<input type="checkbox" id="rpg-toggle-show-dynamic-weather-toggle" />
<span data-i18n-key="template.settingsModal.display.showDynamicWeatherToggle">Show Dynamic Weather Effects</span>
</label>
<label class="checkbox_label"> <label class="checkbox_label">
<input type="checkbox" id="rpg-toggle-plot-buttons" /> <input type="checkbox" id="rpg-toggle-plot-buttons" />
<span data-i18n-key="template.settingsModal.display.showPlotProgressionButtons">Show Plot <span data-i18n-key="template.settingsModal.display.showPlotProgressionButtons">Show Plot
@@ -672,10 +686,20 @@
</div> </div>
<footer class="rpg-settings-popup-footer"> <footer class="rpg-settings-popup-footer">
<button id="rpg-editor-reset" class="rpg-btn-secondary" type="button"> <div class="rpg-footer-left">
<i class="fa-solid fa-rotate-left"></i> <span <button id="rpg-editor-reset" class="rpg-btn-secondary" type="button">
data-i18n-key="template.trackerEditorModal.buttons.reset">Reset to Defaults</span> <i class="fa-solid fa-rotate-left"></i> <span
</button> data-i18n-key="template.trackerEditorModal.buttons.reset">Reset to Defaults</span>
</button>
<button id="rpg-editor-export" class="rpg-btn-secondary" type="button">
<i class="fa-solid fa-file-export"></i> <span
data-i18n-key="template.trackerEditorModal.buttons.export">Export Preset</span>
</button>
<button id="rpg-editor-import" class="rpg-btn-secondary" type="button">
<i class="fa-solid fa-file-import"></i> <span
data-i18n-key="template.trackerEditorModal.buttons.import">Import Preset</span>
</button>
</div>
<div class="rpg-footer-right"> <div class="rpg-footer-right">
<button id="rpg-editor-cancel" class="rpg-btn-secondary" type="button" <button id="rpg-editor-cancel" class="rpg-btn-secondary" type="button"
data-i18n-key="template.trackerEditorModal.buttons.cancel">Cancel</button> data-i18n-key="template.trackerEditorModal.buttons.cancel">Cancel</button>