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.

This commit is contained in:
Torsten Schulz (local)
2026-01-07 11:33:23 +01:00
parent 282f6542fe
commit 01d45d5f65
2 changed files with 114 additions and 32 deletions

View File

@@ -14,7 +14,12 @@ SELECT id FROM falukant_data.falukant_user ORDER BY RANDOM() LIMIT 1;
"#;
pub const QUERY_GET_RANDOM_INFANT: &str = r#"
SELECT c.id AS character_id, c.user_id, CURRENT_DATE - c.birthdate::date AS age_days
SELECT
c.id AS character_id,
c.user_id,
c.first_name,
c.last_name,
CURRENT_DATE - c.birthdate::date AS age_days
FROM falukant_data."character" c
WHERE c.user_id IS NOT NULL AND c.health > 0 AND CURRENT_DATE - c.birthdate::date <= 730
ORDER BY RANDOM() LIMIT 1;
@@ -693,7 +698,7 @@ WHERE region_id = $1;
"#;
pub const QUERY_GET_RANDOM_CHARACTER: &str = r#"
SELECT id, health
SELECT id, health, first_name, last_name
FROM falukant_data."character"
WHERE user_id = $1 AND health > 0
ORDER BY RANDOM() LIMIT 1;