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
+49 -13
View File
@@ -11,9 +11,13 @@ import {
$thoughtsContainer,
$inventoryContainer,
$questsContainer,
$musicPlayerContainer
$musicPlayerContainer,
setInventoryContainer,
setQuestsContainer
} from '../../core/state.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.
@@ -248,6 +252,10 @@ export function updatePanelVisibility() {
* Updates the visibility of individual sections.
*/
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
// Use explicit .show()/.hide() instead of .toggle() to ensure proper state on reload
if (extensionSettings.showUserStats) {
@@ -268,20 +276,17 @@ export function updateSectionVisibility() {
$thoughtsContainer.hide();
}
if ($inventoryContainer) {
if (extensionSettings.showInventory) {
$inventoryContainer.show();
} else {
$inventoryContainer.hide();
}
// Use direct DOM selectors for inventory and quests to avoid stale references
if (extensionSettings.showInventory) {
$('#rpg-inventory').show();
} else {
$('#rpg-inventory').hide();
}
if ($questsContainer) {
if (extensionSettings.showQuests) {
$questsContainer.show();
} else {
$questsContainer.hide();
}
if (extensionSettings.showQuests) {
$('#rpg-quests').show();
} else {
$('#rpg-quests').hide();
}
if ($musicPlayerContainer) {
@@ -335,6 +340,37 @@ export function updateSectionVisibility() {
} else {
$('#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'));
}
}
/**