Commit Graph

31 Commits

Author SHA1 Message Date
Torsten Schulz (local)
c8668c59eb Refactor relationship type retrieval in character workers: Simplify the extraction of relationship types in CharacterCreationWorker, EventsWorker, and UserCharacterWorker by streamlining the use of and_then for better readability and maintainability. 2026-01-23 10:48:15 +01:00
Torsten Schulz (local)
0399333163 Enhance relationship deletion logging across workers: Implement detailed logging for the number of deleted relationships in CharacterCreationWorker, EventsWorker, and UserCharacterWorker, improving traceability and user awareness during character interactions. 2026-01-23 10:46:32 +01:00
Torsten Schulz (local)
7305a71438 Enhance relationship deletion process in character management: Implement detailed logging for deleted relationships, including related user and character IDs, and relationship types. Introduce special notifications for engaged relationships to improve user awareness during character events. 2026-01-22 09:35:21 +01:00
Torsten Schulz (local)
70d8e53216 Add new random events in EventsWorker: Introduce 'character_rest' and 'character_healer' events to enhance gameplay dynamics. Each event includes unique probabilities, descriptions, and health effects, enriching the personal event experience for characters. 2026-01-21 11:26:23 +01:00
Torsten Schulz (local)
0083d7be23 Add daily cleanup of old notifications in EventsWorker: Implement a new method to delete notifications older than 30 days, enhancing database management and reducing clutter. Update run loop to trigger this cleanup daily, ensuring timely maintenance of notification records. 2026-01-15 13:45:31 +01:00
Torsten Schulz (local)
fc1b0c2259 Refactor personal event handling in EventsWorker: Introduce a new CharacterInfo struct to encapsulate character details extracted from event effects. Streamline the application of personal effects by consolidating logic into a single method, improving clarity and maintainability. Enhance notification creation by directly incorporating character information, ensuring accurate event communication. 2026-01-15 13:33:39 +01:00
Torsten Schulz (local)
63a89588ac Refactor event notification handling in EventsWorker: Simplify notification creation by removing unnecessary value object and directly incorporating character information into the notification JSON. Add early exit for events with no effects, improving clarity and efficiency in event processing. 2026-01-15 13:27:30 +01:00
Torsten Schulz (local)
5f55aeea99 Refactor money change action string in EventsWorker: Simplify the action string for money history by differentiating between positive and negative changes. Remove unnecessary parameters from the function signature to enhance clarity and maintainability. 2026-01-12 16:38:38 +01:00
Torsten Schulz (local)
408221ffb4 Refactor notification structure in EventsWorker: Simplify the JSON notification format by separating the value object and ensuring it only contains relevant data without translations. Update action string for money changes to include specific event titles, enhancing clarity for frontend access. 2026-01-12 16:35:47 +01:00
Torsten Schulz (local)
b858f5c385 Adjust event probabilities in EventsWorker: Reduce the occurrence rates of various random events to 25% of their original values for better game balance. Update character health change effects to limit maximum health reduction based on user feedback. Enhance notification structure to include money change details for improved frontend access. 2026-01-09 09:30:59 +01:00
Torsten Schulz (local)
01d45d5f65 Enhance character event notifications in EventsWorker: Update character health change and death handling to include first and last names in notifications. Modify SQL queries to retrieve character names, ensuring accurate user feedback. Refactor notification structure for better organization and clarity. 2026-01-07 11:33:23 +01:00
Torsten Schulz (local)
282f6542fe event adjusted for epidemic 2026-01-07 11:15:20 +01:00
Torsten Schulz (local)
f96e474f32 Add random heir fallback logic in EventsWorker: Implement a new SQL query to select a random NPC heir from the same region when no children are available. Enhance error handling to log cases where no heir is found, ensuring better user feedback and maintaining character associations. Update UserCharacterWorker to utilize this new logic for heir assignment. 2026-01-07 10:14:24 +01:00
Torsten Schulz (local)
604c8ba300 Add character user clearing logic in EventsWorker: Implement a new SQL query to clear the user association from a deceased character before assigning a new heir. This ensures compliance with unique constraints and prevents errors during user reassignment. Enhance error handling and logging for better debugging. 2026-01-05 15:46:54 +01:00
Torsten Schulz (local)
da30ab0b15 Enhance character health change handling in EventsWorker: Update health change functions to return character death status, allowing for better tracking of character deaths. Implement logging of character deaths in both individual and regional health change scenarios, improving event processing and state management. 2025-12-23 14:20:41 +01:00
Torsten Schulz (local)
431a6aff08 Implement heartbeat logging in EventsWorker: Add periodic logging to monitor the worker's activity and event triggering status. Introduce Mutex for thread-safe access to heartbeat timestamps, enhancing visibility into the worker's operational state. 2025-12-23 10:56:14 +01:00
Torsten Schulz (local)
fce7400303 Refactor notification handling in Workers: Centralize notification insertion and frontend updates by replacing direct SQL queries with dedicated functions. This improves code maintainability and reduces redundancy across character creation, events, and transport processing. 2025-12-22 13:58:17 +01:00
Torsten Schulz (local)
833202344b Refactor SQL query in Worker to improve distance calculations: Replace the existing LEFT JOIN with a LATERAL join to enhance the selection of region distances based on transport mode, ensuring more accurate results. Update polling frequency in TransportWorker from once per second to once per minute for better resource management. 2025-12-20 22:20:29 +01:00
Torsten Schulz (local)
10bc1e5a52 Refactor SQL queries into a dedicated module
- Moved SQL queries from multiple worker files into `src/worker/sql.rs` for better organization and maintainability.
- Updated references in `stockage_manager.rs`, `transport.rs`, `underground.rs`, `user_character.rs`, and `value_recalculation.rs` to use the new centralized SQL queries.
- Improved code readability by replacing `.get(0)` with `.first()` for better clarity when retrieving the first row from query results.
- Cleaned up unnecessary comments and consolidated related SQL queries.
2025-12-13 11:57:28 +01:00
Torsten Schulz (local)
a9d490ce38 Refactor SQL queries into centralized module
- Moved various SQL query strings from individual worker files into a new `sql.rs` module for better organization and reusability.
- Updated `events.rs`, `underground.rs`, and `weather.rs` to use the centralized SQL queries.
- Removed redundant query definitions from `events.rs`, `underground.rs`, and `weather.rs`.
2025-12-12 15:18:30 +01:00
Torsten Schulz (local)
c801e50def Enhance money history tracking: Implement best-effort creation of money_history table in BaseWorker, EventsWorker, and UndergroundWorker to ensure logging of monetary changes without operation failure. 2025-12-09 08:53:39 +01:00
Torsten Schulz (local)
d740dbbf73 Enhance money history logging: Implement best-effort insert into money_history for UI visibility across BaseWorker, EventsWorker, and UndergroundWorker, improving tracking of monetary changes. 2025-12-09 08:19:42 +01:00
Torsten Schulz (local)
e8c8c5edb1 Refactor EventsWorker: Move EVENT_RATE_SCALE constant to the struct for better encapsulation and clarity in event probability calculations. 2025-12-09 00:09:12 +01:00
Torsten Schulz (local)
a4d1d79e6e Enhance EventsWorker: Introduce EVENT_RATE_SCALE constant to adjust event frequency, improving control over event triggering rates. 2025-12-09 00:07:55 +01:00
Torsten Schulz (local)
b4b3b1adcc Enhance user notification structure in EventsWorker: Updated the notification process to include detailed event information in the database entries. Notifications now contain event ID, type, and effects, improving clarity and data integrity for user alerts. 2025-12-08 13:29:18 +01:00
Torsten Schulz (local)
9b6883ea84 Implement inheritance logic for player characters in EventsWorker: Added functionality to handle character inheritance before deleting child relations. This includes querying for the user ID, determining the heir, and updating the heir's assets accordingly. Enhanced logging for inheritance events to improve traceability. 2025-12-08 13:22:20 +01:00
Torsten Schulz (local)
d078b6b19a Refactor WebSocket user ID filtering and enhance SQL query security: Updated user ID handling in the WebSocket server to improve filtering logic for numeric user IDs. Implemented parameterized queries in the database operations across multiple worker files to prevent SQL injection vulnerabilities, ensuring safer data handling. 2025-12-08 11:56:04 +01:00
Torsten Schulz (local)
2948586041 Enhance event effect handling in EventsWorker: Updated money change, storage capacity change, and house quality change methods to return absolute values and percentages. Improved JSON response structure for event effects, enhancing clarity and data accuracy in event processing. 2025-12-08 11:51:10 +01:00
Torsten Schulz (local)
0198bcd603 Enhance user notification handling in EventsWorker: Updated the notification process to write user notifications to the database and send WebSocket alerts for each affected user in a region. Improved logging to reflect the number of users notified during regional event processing. 2025-12-08 11:34:20 +01:00
Torsten Schulz (local)
37b2c08555 Add new event effects and implement regional changes: Introduced HouseQualityChange and updated StorageCapacityChange effects in EventsWorker. Implemented regional handling for storage capacity and house quality changes during events, enhancing gameplay dynamics and event impact. Improved logging for affected stocks and houses during changes. 2025-12-08 11:23:34 +01:00
Torsten Schulz (local)
5a3a818d84 Add EventsWorker to worker module: Introduced EventsWorker for handling event-related tasks. Updated main.rs to include EventsWorker in the worker creation process. Adjusted WeatherWorker instantiation to use cloned pool and broker for consistency. 2025-12-08 11:17:16 +01:00