Commit Graph

73 Commits

Author SHA1 Message Date
Z. Cliffe Schreuders
8fa5b15412 fix: enhance interaction mechanics by adding player facing direction for NPC and object interactions 2026-02-19 14:46:55 +00:00
Z. Cliffe Schreuders
f30dd7f279 Update scenario.json.erb: Change NPC sprite and add closing debrief triggers
- Updated spriteSheet for Sarah Martinez from "female_office_worker" to "female_blowse".
- Added new event triggers for closing debrief upon entering the main office area and confronting Derek.
- Modified Agent 0x99 to use a person type NPC with updated event mappings and properties.
2026-02-17 16:33:49 +00:00
Z. Cliffe Schreuders
8dfc5f04f4 feat: Add player preferences modal for character configuration and enhance sprite selection functionality 2026-02-17 01:25:44 +00:00
Z. Cliffe Schreuders
3d1570a030 feat: Implement strong parameters for room state synchronization and enhance item validation against NPC inventory 2026-02-17 00:34:19 +00:00
Z. Cliffe Schreuders
dbd532fdce feat: Add NPC state management with server synchronization for KO and health changes 2026-02-17 00:07:16 +00:00
Z. Cliffe Schreuders
e18e1d7228 feat: Implement dynamic room state management with server synchronization for items, NPCs, and object states 2026-02-16 23:51:59 +00:00
Z. Cliffe Schreuders
1b7c112fbe feat: Enhance inventory management by preventing duplicate items and adding error handling 2026-02-13 16:44:31 +00:00
Z. Cliffe Schreuders
61afc0a666 Refactor character assets and player preferences
- Deleted unused character images: woman_in_science_lab_coat.png and woman_with_black_long_hair_bow_in_hair_long_sleeve_(1).png.
- Added new padlock icon asset for UI.
- Introduced player_preferences.css for styling the player preferences configuration screen.
- Updated game.js to load new character atlases with simplified filenames.
- Enhanced player.js to create custom idle animations for characters.
- Implemented sprite-grid.js for sprite selection UI, including a preview feature.
- Updated database schema to include break_escape_player_preferences table for storing player settings.
- Modified convert_pixellab_to_spritesheet.py to map character names to simplified filenames and extract headshots from character images.
2026-02-12 14:35:14 +00:00
Z. Cliffe Schreuders
d1e38bad29 Refactor inventory handling to prevent duplicates and clean up game state
- Updated the games_controller to remove starting items from the inventory response, ensuring no duplicates are sent to the client.
- Enhanced the inventory processing logic in JavaScript to check for existing items by ID, type, or name before adding new items, preventing duplicate entries in the player's inventory.

Files modified:
- games_controller.rb: Adjusted inventory response handling.
- inventory.js: Added duplicate item check during inventory processing.
2026-02-10 16:17:36 +00:00
Z. Cliffe Schreuders
321a500f24 Enhance object unlocking logic, add locked field to containers, and validate scenario schema 2026-02-10 14:12:39 +00:00
Z. Cliffe Schreuders
5c28743144 Update CSS file paths and enhance tutorial system
- Changed CSS file paths in index.html and show.html.erb to reflect new directory structure under public/break_escape.
- Added a new tutorial.css file with styles tailored for the tutorial system, ensuring a cohesive pixel-art aesthetic.
- Enhanced the tutorial manager to track player interactions, including clicks to move and inventory item usage, improving the tutorial experience for new players.
- Updated tutorial steps to dynamically include objectives based on the current scenario.

Files modified:
- index.html: Updated CSS links.
- show.html.erb: Updated CSS links.
- tutorial.css: New styles for the tutorial system.
- player.js: Added notifications for player actions.
- tutorial-manager.js: Enhanced logic for tracking tutorial progress and objectives.
- interactions.js: Added notifications for inventory interactions.
2026-01-19 09:54:15 +00:00
Z. Cliffe Schreuders
b7223af010 Refactor MissionsController and enhance mission display
- Refactored the MissionsController to use local variable `missions` instead of instance variable `@missions` for better clarity and performance.
- Introduced grouping of missions by collection for display, improving the organization of mission listings.
- Updated the view to iterate over `@missions_by_collection`, enhancing the presentation of missions by their respective collections.
- Added new CSS styles for collection headings to improve UI aesthetics.

Additionally, removed invalid missions from the database and updated mission collections for better categorization.

Files modified:
- missions_controller.rb: Refactored mission retrieval logic.
- index.html.erb: Updated mission display logic and added new styles.
- migration file: Added cleanup for invalid missions.
- Various mission JSON files: Updated collections for consistency.
2026-01-14 13:24:46 +00:00
Z. Cliffe Schreuders
aad985ee98 Add new functionality to open workstations in new tabs
- Introduced buttons in the Crypto and Lab Workstation title bars to allow users to open the respective workstations in new tabs.
- Implemented JavaScript functions `openCryptoWorkstationInNewTab` and `openLabWorkstationInNewTab` to handle the new tab functionality.
- Updated CSS styles for the new buttons to ensure proper positioning and visual appeal.
- Made necessary imports and exports in helper files to integrate the new functionality across the application.
2025-12-05 15:37:31 +00:00
Z. Cliffe Schreuders
f0ffb3fdfd Refactor code to remove trailing whitespace and improve readability
- Cleaned up trailing whitespace in `games_controller.rb`, `game.rb`, and `validate_scenario.rb` to enhance code quality and maintain consistency across the codebase.
- Updated migration file `remove_unique_game_constraint.rb` to remove unnecessary whitespace, ensuring a cleaner migration history.
- Improved overall readability of the code by eliminating redundant blank lines in various files.
2025-12-04 23:17:34 +00:00
Z. Cliffe Schreuders
d327380fac Enhance scenario validation and improve timed conversation structure
- Updated `validate_scenario.rb` to enforce correct usage of `targetKnot` in timed conversations, ensuring compliance with new requirements.
- Added checks for missing properties in timed conversations, including `delay` and `targetKnot`, to improve scenario integrity.
- Enhanced logging for validation issues, providing clearer feedback on scenario configuration errors.
- Updated relevant scenarios to align with the new validation rules, ensuring consistency across gameplay elements.
2025-12-04 23:15:03 +00:00
Z. Cliffe Schreuders
629aa229b3 Enhance inventory and container management for improved gameplay experience
- Added functionality to include current player inventory in game state for page reload recovery, allowing players to restore their inventory seamlessly.
- Implemented filtering of container contents to exclude items already in the player's inventory, enhancing user experience and gameplay clarity.
- Updated game mechanics to support both type-based and ID-based matching for inventory items, improving task validation and objectives tracking.
- Enhanced logging for better visibility into inventory processing and container content loading, aiding in debugging and game state management.
- Updated scenarios to reflect changes in item identification and task requirements, ensuring consistency across gameplay elements.
2025-12-04 15:42:01 +00:00
Z. Cliffe Schreuders
333ea39c56 Implement submit_flags task functionality and enhance game mechanics
- Added support for submit_flags tasks in GamesController, allowing players to submit flags for validation and task completion.
- Updated game state management to track submitted flags and validate against required flags for task completion.
- Enhanced ObjectivesManager to handle flag submissions, including syncing progress with the server and managing task states.
- Introduced a new locksmith NPC for lockpicking tutorials, expanding gameplay elements and player engagement.
- Updated scenario schema to include submit_flags task type and associated properties, ensuring proper integration into the game mechanics.
- Improved logging and debugging information for flag submissions and task progress updates, enhancing visibility into game state changes.
2025-12-04 14:00:26 +00:00
Z. Cliffe Schreuders
289c0ce1c7 Add lab workstation functionality and integrate into gameplay
- Introduced a lab workstation popup in the game interface for accessing lab sheets via an iframe.
- Implemented JavaScript functions to create, open, and close the lab workstation, enhancing user interaction.
- Updated CSS styles for the lab workstation popup to ensure a seamless visual experience.
- Enhanced interaction handling to allow players to open lab workstations from inventory items.
- Added new scenario files for the Linux Fundamentals and Security Lab, including detailed instructions and objectives for players.
- Updated scenario schema to include the new lab workstation type, ensuring proper integration into the game mechanics.
2025-12-04 02:10:35 +00:00
Z. Cliffe Schreuders
7ac541a286 Enhance NPC encounter tracking and logging in GamesController
- Added logging for the number of NPCs in a room when loading it, improving visibility into game state.
- Ensured NPC encounters are tracked when unlocking doors, even when using cached room data, to maintain accurate encounter statistics.
2025-12-01 17:42:28 +00:00
Z. Cliffe Schreuders
a4606f596c Enhance NPC encounter logging and fix item type references in scenario scripts 2025-12-01 17:31:12 +00:00
Z. Cliffe Schreuders
19db2f530d Refactor whitespace and comments for consistency in BreakEscape controllers and models
- Cleaned up unnecessary whitespace in `games_controller.rb`, `missions_controller.rb`, `game.rb`, `mission.rb`, `routes.rb`, `seeds.rb`, and migration files to enhance code readability.
- Standardized comment formatting across various files to maintain consistency and improve clarity.
2025-11-30 00:06:54 +00:00
Z. Cliffe Schreuders
a8c4f6576f Enhance standalone mode with VM IP handling and UI updates
- Updated `GamesController` to parse and store VM IPs from JSON input, improving player state management.
- Modified `Game` model to include VM IPs in the context for better integration with gameplay.
- Enhanced `Mission` model's `vm_object` method to override IPs from the context when available.
- Revamped `new.html.erb` to provide a clearer interface for entering VM IP addresses and flag hints.
- Improved `vm-launcher-minigame.js` to display VM IPs and provide connection instructions in standalone mode.
2025-11-30 00:02:08 +00:00
Z. Cliffe Schreuders
ef8e2f294a Refactor RFID handling and enhance game logic
- Updated `GamesController` and `Game` model to include RFID lock types in the filtering logic for 'requires' attributes, ensuring proper handling of biometric, bluetooth, and RFID types.
- Improved `RFIDMinigame` to standardize card ID retrieval, supporting both `card_id` and `key_id`.
- Enhanced `unlock-system.js` to prioritize physical keycard checks and streamline the unlocking process with detailed logging.
- Adjusted scenario JSON files to replace `keyId` with `card_id` for consistency and added new lock requirements for various rooms.
2025-11-29 23:43:30 +00:00
Z. Cliffe Schreuders
92330b04dc Enhance flag handling and XML integration for standalone mode
- Updated `GamesController` to support XML flag hints for standalone mode, improving backward compatibility with legacy flag input.
- Introduced `parse_flag_hints_xml` method in `Mission` model to extract flags from XML content.
- Enhanced `Game` model to incorporate `flags_by_vm` from player state for better flag management.
- Modified `new.html.erb` to update UI for flag hints input, replacing the previous comma-separated flags format.
- Improved `FlagStationMinigame` to display accepted VM flags and handle flag submissions more effectively.
- Adjusted scenario JSON to include flag stations with VM-specific flag handling.
2025-11-29 20:57:39 +00:00
Z. Cliffe Schreuders
bb2b0c206e Implement VM object retrieval and enhance game visuals
- Added `vm_object` method in `mission.rb` to fetch VM details from context or return a fallback.
- Introduced new images for VM launchers and flag stations in the assets directory.
- Updated `game.js` to preload new VM launcher and flag station images.
- Refactored `vm-launcher-minigame.js` to streamline VM handling and improve UI messaging.
- Adjusted scenario JSON to utilize the new `vm_object` method for VM data retrieval.
2025-11-29 01:35:20 +00:00
Z. Cliffe Schreuders
ca44cef068 Enhance game setup for VM and standalone modes
- Updated `GamesController` to use `current_player` for VM set retrieval.
- Improved `MissionsController` to handle redirection for both Hacktivity and standalone modes.
- Modified `new.html.erb` to include UI for standalone flag input alongside VM set selection.
- Added new CSS styles for standalone mode instructions and flags input form.
- Introduced new mission configuration for the SecGen VM Lab, integrating VM and flag capture elements.
2025-11-28 17:41:17 +00:00
Z. Cliffe Schreuders
0d250d71f0 Refactor game redirection and VM context handling
- Updated `MissionsController` to use explicit paths for redirection to ensure compatibility in engine context.
- Enhanced `Game` model to build VM context conditionally based on mission requirements and Hacktivity mode.
- Adjusted `show.html.erb` to reflect explicit API base paths and improved handling of player state for JSON responses.
2025-11-28 16:28:25 +00:00
Z. Cliffe Schreuders
ea079b11c9 WiP implementing VM integration 2025-11-28 15:36:10 +00:00
Z. Cliffe Schreuders
6b1d73f987 feat: Enhance objectives system with new NPC interactions and Ink dialogue integration 2025-11-26 11:18:25 +00:00
Z. Cliffe Schreuders
412cebb65c feat: Add objectives system with policy methods and test scenarios 2025-11-26 09:43:06 +00:00
Z. Cliffe Schreuders
9d6d7709c3 feat: Implement Objectives System with UI and Server Sync
- Added ObjectivesManager to track mission objectives and tasks.
- Created ObjectivesPanel for displaying objectives in a collapsible HUD.
- Integrated objectives state restoration from the server during game initialization.
- Implemented task completion and unlocking mechanisms via game actions.
- Added CSS styles for the objectives panel with a pixel-art aesthetic.
- Developed a test scenario to validate the objectives system functionality.
- Updated database schema to include fields for tracking completed objectives and tasks.
2025-11-26 00:50:32 +00:00
Z. Cliffe Schreuders
150518b4c4 feat: Include objectives state in server response and implement event emissions for door unlocks and key pickups 2025-11-25 23:19:11 +00:00
Z. Cliffe Schreuders
26fc297ad8 Refactor tests and improve NPC handling
- Updated NPC ink loading tests to ensure proper handling of missing story files.
- Adjusted lazy loading tests for rooms to enhance clarity and maintainability.
- Enhanced unlock system tests by adding inventory checks for keys.
- Refined filtered scenario tests to ensure accurate preservation of game state.
- Improved game model tests to validate unlock functionality with various inventory scenarios.
2025-11-25 16:28:18 +00:00
Z. Cliffe Schreuders
659644b3da feat: Update CyBOK logo and enhance mission index styles with new CSS files 2025-11-25 16:03:09 +00:00
Z. Cliffe Schreuders
3cc9fafcec feat: Enhance mission management with CyBOK integration and collection filtering
- Added `Cybok` model to manage CyBOK entries associated with missions.
- Implemented `by_collection` scope in `Mission` model for filtering missions by collection.
- Updated `missions_controller` to filter missions based on the selected collection.
- Introduced `CybokSyncService` for syncing CyBOK data from mission metadata to the database.
- Created new views and partials for displaying CyBOK information with tooltips using Tippy.js.
- Added metadata fields to `break_escape_missions` for `secgen_scenario` and `collection`.
- Enhanced mission seeding logic to support new metadata and CyBOK entries.
- Added multiple new mission scenarios with associated metadata.
2025-11-25 15:20:05 +00:00
Z. Cliffe Schreuders
b4b95928da feat: Enhance inventory management with server-side validation and CSRF protection 2025-11-24 11:17:39 +00:00
Z. Cliffe Schreuders
140def5650 Add Spotify play button and styles for improved music integration 2025-11-22 01:54:00 +00:00
Z. Cliffe Schreuders
ac727f4422 Enhance unlock functionality: refactor door unlocking to async, validate NPC permissions via server, and ensure player state integrity 2025-11-22 01:25:36 +00:00
Z. Cliffe Schreuders
ef27265c8c Simplify NPC unlock to use standard unlock flow
PROBLEM:
Previous implementation had unnecessary complexity with npcUnlockedTargets
tracking. NPC unlocks should just work like any other unlock method.

SOLUTION:
1. Removed npcUnlockedTargets tracking (not needed)
2. NPC unlocks now use standard unlockedRooms/unlockedObjects arrays
3. Updated validate_unlock to check if already unlocked FIRST:
   - If in player_state unlocked list → grant access
   - If method='unlocked' → verify against scenario data locked field
   - Otherwise → validate normally

This fixes the race condition issue:
- NPC calls unlock API with method='npc'
- Server validates NPC has permission
- Server adds to unlockedRooms (normal unlock)
- Later when player opens door, client sends method='unlocked'
- Server sees it's already in unlockedRooms OR unlocked in scenario → grants access

Changes:
- app/models/break_escape/game.rb: Remove npc_unlock_target!/npc_unlocked?, check unlocked state first
- app/controllers/break_escape/games_controller.rb: Remove npc_unlock_target! calls
- test/integration/unlock_system_test.rb: Update tests for simplified approach

All 37 tests passing, 122 assertions
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
a36c0da04e Fix test errors and add route name for room endpoint
- Added 'as: room' to room route to fix room_game_url helper
- Fixed TypeError in initialize_player_state by using .dup instead of .deep_dup
- Simplified npcUnlockedTargets initialization test to avoid edge case
- All 38 tests now passing with 129 assertions
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
c5eca9cc60 Fix NPC unlock race condition with persistent server-side tracking
PROBLEM:
NPC unlocks had timing-dependent behavior:
- If NPC unlocked door BEFORE room loaded: client saw it as unlocked
- If NPC unlocked door AFTER room loaded: door sprite stayed locked

SOLUTION:
1. Server-side persistent tracking:
   - Added npcUnlockedTargets array to player_state
   - Track all NPC unlocks separately from unlockedRooms/unlockedObjects
   - Initialize npcUnlockedTargets in new games

2. Server merges NPC unlock state:
   - filtered_room_data checks npcUnlockedTargets
   - Marks doors/containers as unlocked if NPC unlocked them
   - Works regardless of when room is loaded

3. Client updates existing sprites:
   - NPC unlock handler finds ALL door sprites for target room
   - Updates sprite state immediately after server unlock
   - Handles both pre-loaded and late-loaded rooms

Changes:
- app/models/break_escape/game.rb: Add npc_unlock_target!, npc_unlocked?, merge state in filtered_room_data
- app/controllers/break_escape/games_controller.rb: Track NPC unlocks in unlock endpoint
- public/break_escape/js/minigames/person-chat/person-chat-conversation.js: Update all door sprites after NPC unlock
- public/break_escape/js/systems/doors.js: Export unlockDoor globally
- test/integration/unlock_system_test.rb: Add 4 tests for persistent NPC unlock state
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
d3b31b4368 Add comprehensive unlock system tests
Created test suite with 34 tests covering all unlock scenarios and security:

DOOR TESTS (10 tests):
- PIN/password validation (correct/incorrect, case sensitivity)
- Key unlocks (client-validated)
- Unlocked doors (method='unlocked')

CONTAINER TESTS (8 tests):
- PIN/password validation
- Key, lockpick, biometric, bluetooth, RFID unlocks
- Unlocked containers

NPC UNLOCK TESTS (6 tests):
 NPC can unlock door/container if encountered and has permission
🔒 SECURITY: Fails if NPC not encountered
🔒 SECURITY: Fails if NPC lacks permission for that target
🔒 SECURITY: Fails for non-existent NPC
🔒 SECURITY: Fails if unlockable is not an array

SECURITY TESTS - BYPASS PREVENTION (4 tests):
🔒 CRITICAL: Locked door CANNOT be bypassed with method='unlocked'
🔒 CRITICAL: Locked container CANNOT be bypassed with method='unlocked'
 Unlocked door CAN use method='unlocked'
 Unlocked container CAN use method='unlocked'

ERROR CASES (3 tests):
- Non-existent doors/objects return 422
- Invalid methods return 422

DATA FILTERING (2 tests):
- Verify 'requires' field filtered from responses
- Verify recursive filtering of contents

INTEGRATION (1 test):
- Multiple sequential unlocks
- Idempotent operations

Test Results: 34 runs, 115 assertions, 0 failures

Server Implementation:
- validate_npc_unlock: Validates NPC encounter and permission list
- find_npc_in_scenario: Searches all rooms for NPC
- method='npc': New unlock method requiring NPC id as attempt

Client Implementation:
- Updated handleUnlockDoor to call server API with method='npc'
- Server validates all NPC unlock requests
- No client-side lock manipulation

Security Principle: All unlock authorization is server-side.
Client cannot bypass locks by manipulating state or claiming NPC unlocks.
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
65ede66810 CRITICAL SECURITY FIX: Prevent client bypass with method='unlocked'
Fixed critical vulnerability where ANY locked door/container could be bypassed
by sending method='unlocked' to the server.

The Vulnerability:
- Server used OR logic: if method == 'unlocked' || !room['locked']
- This meant: "If client says unlocked OR room is unlocked, grant access"
- Attacker could bypass ANY lock by sending method='unlocked'
- Example exploit: {targetType: "door", targetId: "ceo", method: "unlocked"}

The Fix:
- Changed to AND logic: if method == 'unlocked' && !room['locked']
- Now means: "Only if client says unlocked AND room is ACTUALLY unlocked"
- Added explicit rejection: return false if method='unlocked' on locked item
- Server now logs SECURITY VIOLATION when bypass is attempted

Changes:
- game.rb:151: Changed || to && for doors
- game.rb:157-160: Added explicit rejection for locked doors
- game.rb:185: Changed || to && for objects
- game.rb:191-194: Added explicit rejection for locked objects

Tests Added (4 new security tests):
1. Verify locked door CANNOT be bypassed with method='unlocked' (422 error)
2. Verify locked container CANNOT be bypassed with method='unlocked' (422 error)
3. Verify unlocked door CAN use method='unlocked' (200 success)
4. Verify unlocked container CAN use method='unlocked' (200 success)

Test Results: 28 tests, 95 assertions, 0 failures

Security Principle: Client state is NEVER trusted for authorization.
Server validates against its own scenario_data, not client claims.
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
81e9c71b6f Add comprehensive unlock system tests
Created extensive test suite covering all lock types and unlock scenarios:

DOOR TESTS:
- PIN validation (server-side) - correct/incorrect attempts
- Password validation (server-side) - correct/incorrect, case sensitivity
- Key unlocks (client-validated, server-trusted)
- Unlocked doors (method='unlocked')

CONTAINER TESTS:
- PIN validation (server-side) - correct/incorrect attempts
- Password validation (server-side) - correct/incorrect, empty attempts
- Key unlocks (client-validated)
- Lockpick unlocks (client-validated)
- Biometric unlocks (client-validated)
- Bluetooth unlocks (client-validated)
- RFID unlocks (client-validated)
- Unlocked containers (method='unlocked')

ERROR CASES:
- Non-existent doors/objects
- Invalid methods
- Multiple unlocks and idempotency

SECURITY TESTS:
- Verify 'requires' field is filtered from responses
- Verify contents are filtered recursively

INTEGRATION TESTS:
- Multiple sequential unlocks
- State persistence
- Idempotent operations

Also fixed: Game model generate_scenario_data now uses ||= to allow
test scenarios to override mission data.

Test Results: 24 tests, 83 assertions, 0 failures
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
b2c8362d91 Allow unlocked doors and containers to notify server for access
Fixed issue where unlocked doors/containers couldn't be opened because
the server wasn't being notified to add them to unlockedRooms/unlockedObjects.

Server changes (game.rb):
- Updated validate_unlock to accept method='unlocked' for unlocked targets
- Added logic to grant access for unlocked doors/objects without validation

Client changes (doors.js):
- Updated handleDoorInteraction to notify server for unlocked doors
- Calls notifyServerUnlock with method='unlocked' before opening

Client changes (interactions.js):
- Added notifyServerForUnlockedContainer helper function
- Updated container interaction to notify server before launching minigame

This ensures that all room/container access is properly authorized on the
server side, preventing 403 Forbidden errors when loading room/container data.
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
3494c739a5 Trust client validation for item-based unlock methods
Updated validate_unlock to use two-tier validation model:
- Server trusts client validation for item-based locks (key, lockpick, biometric, bluetooth, rfid)
- Server validates knowledge-based locks (pin, password)

This fixes 422 errors when unlocking with keys/lockpicking where attempt is nil,
since these methods don't require server-side answer validation.
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
77544520aa Return container contents in unlock API response
- Add find_object_in_scenario helper to locate objects by ID or name
- Include hasContents and contents fields in unlock response for containers
- Update password and PIN minigames to populate scenarioData.contents from server response
- This allows the container minigame to launch after successful server-side unlock

Without this, the contents field was filtered for security, preventing the container UI from launching.
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
8328374e5f Add logging and name fallback to unlock validation
- Add detailed logging to validate_unlock method to debug validation issues
- Check both object 'id' and 'name' fields when searching for objects
- Log password comparison details for debugging

This helps diagnose why correct passwords might not be accepted.
2025-11-22 00:46:56 +00:00
Z. Cliffe Schreuders
b27cde13d0 Fix unlock detection to work with server-side data filtering
- Update unlock-system.js to check 'locked' field instead of 'requires' for lock detection
- Pass null for key/pin/password required values (server validates)
- Preserve 'requires' field for biometric/bluetooth locks (contains item identifiers, not answers)
- Update both Game model and controller filtering methods

Fixes issue where locked objects didn't prompt for unlock after server-side filtering was implemented.
2025-11-22 00:46:55 +00:00
Z. Cliffe Schreuders
cb2d342802 Fix Array into String conversion error in track_npc_encounters
Changes:
- Add player_state type checking before accessing encounteredNPCs
- Reset player_state to empty hash if not a Hash type
- Add comprehensive logging for type mismatches
- Change from concat to array addition (+) to avoid in-place mutation issues
- Wrap entire method in try-catch to prevent NPC tracking from breaking room loading
- Add detailed error logging with stack traces

Fixes:
- TypeError: no implicit conversion of Array into String
- Handles legacy data where player_state might be malformed
- Room loading continues even if NPC tracking fails
2025-11-22 00:46:55 +00:00