Day and night: a realm-wide sky speed and a sky of your own

Forever.DayCycle.Speed (worldserver.conf, default 1) makes the sky run
1x (the realm's clock, as before) up to 24x for the whole realm. The time
of day shown is worked out from the realm's local time alone, so every
player sees the same sky, also after a restart. Only the sky changes:
events, resets, respawns and scripts keep the realm's own time.

.time day and .time night keep noon or midnight for one character,
wherever it goes, and .time auto brings the realm's sky back; .time says
which one is set. Every player may use it (permission 1000, Role:
Player). The choice is kept in character_day_cycle, loaded with the other
login queries and saved with prepared async statements, and goes when
the character is deleted.

The clock is sent at login and at every map change, as before, and right
away by .time. The pure part (DayCycle.h) has unit tests.
This commit is contained in:
Karrz1
2026-11-14 09:08:43 +00:00
parent 5b27c607b0
commit 82b30ef184
16 changed files with 285 additions and 9 deletions
+23
View File
@@ -788,6 +788,29 @@ LOCK TABLES `character_customizations` WRITE;
/*!40000 ALTER TABLE `character_customizations` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `character_day_cycle`
--
DROP TABLE IF EXISTS `character_day_cycle`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `character_day_cycle` (
`guid` bigint unsigned NOT NULL COMMENT 'characters.guid',
`mode` tinyint unsigned NOT NULL COMMENT '1 noon, 2 midnight',
PRIMARY KEY (`guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='own sky of a character (.time)';
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `character_day_cycle`
--
LOCK TABLES `character_day_cycle` WRITE;
/*!40000 ALTER TABLE `character_day_cycle` DISABLE KEYS */;
/*!40000 ALTER TABLE `character_day_cycle` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `character_declinedname`
--