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
+3 -1
View File
@@ -2479,6 +2479,7 @@ INSERT INTO `rbac_linked_permissions` VALUES
(195,24),
(195,49),
(195,199),
(195,1000),
(196,10),
(196,202),
(196,203),
@@ -3789,7 +3790,8 @@ INSERT INTO `rbac_permissions` VALUES
(882,'Command: reload spell_script_names'),
(883,'Command: quest objective complete'),
(884,'Command: bg start'),
(885,'Command: bg stop');
(885,'Command: bg stop'),
(1000,'Command: time');
/*!40000 ALTER TABLE `rbac_permissions` ENABLE KEYS */;
UNLOCK TABLES;
+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`
--
@@ -0,0 +1,4 @@
-- .time / .time day / .time night / .time auto (cs_misc.cpp): every player may keep their own sky.
-- 1000 = Command: time (RBAC_PERM_COMMAND_TIME), 195 = Role: Player. Safe to run again.
INSERT IGNORE INTO `rbac_permissions` (`id`, `name`) VALUES (1000, 'Command: time');
INSERT IGNORE INTO `rbac_linked_permissions` (`id`, `linkedId`) VALUES (195, 1000);
@@ -0,0 +1,8 @@
-- .time day / .time night (DayCycle.h, Player::SetSkyMode): a character that keeps its own noon or midnight sky. No row is
-- .time auto, the realm's day and night (Forever.DayCycle.Speed). The row goes with the character (Player::DeleteFromDB).
-- Safe to run again.
CREATE TABLE IF NOT EXISTS `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)';
@@ -0,0 +1,7 @@
-- .time help (cs_misc.cpp, DayCycle.h). Safe to run again.
DELETE FROM `command` WHERE `name` IN ('time', 'time day', 'time night', 'time auto');
INSERT INTO `command` (`name`, `help`) VALUES
('time', 'Syntax: .time\r\n\r\nShow your sky: the realm''s day and night, or your own noon or midnight.'),
('time day', 'Syntax: .time day\r\n\r\nKeep noon for your character, wherever you go. Only you see it; it is kept across logins.'),
('time night', 'Syntax: .time night\r\n\r\nKeep midnight for your character, wherever you go. Only you see it; it is kept across logins.'),
('time auto', 'Syntax: .time auto\r\n\r\nYour sky follows the realm''s day and night again.');
@@ -844,6 +844,11 @@ void CharacterDatabaseConnection::DoPrepareStatements()
PrepareStatement(CHAR_SEL_CHARACTER_BANK_TAB_SETTINGS, "SELECT tabId, name, icon, description, depositFlags FROM character_bank_tab_settings WHERE characterGuid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_DEL_CHARACTER_BANK_TAB_SETTINGS, "DELETE FROM character_bank_tab_settings WHERE characterGuid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_INS_CHARACTER_BANK_TAB_SETTINGS, "INSERT INTO character_bank_tab_settings (characterGuid, tabId, name, icon, description, depositFlags) VALUES (?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC);
// .time day / night / auto (DayCycle.h): a row only for a character that keeps its own sky
PrepareStatement(CHAR_SEL_CHARACTER_DAY_CYCLE, "SELECT mode FROM character_day_cycle WHERE guid = ?", CONNECTION_ASYNC);
PrepareStatement(CHAR_REP_CHARACTER_DAY_CYCLE, "REPLACE INTO character_day_cycle (guid, mode) VALUES (?, ?)", CONNECTION_ASYNC);
PrepareStatement(CHAR_DEL_CHARACTER_DAY_CYCLE, "DELETE FROM character_day_cycle WHERE guid = ?", CONNECTION_ASYNC);
}
CharacterDatabaseConnection::CharacterDatabaseConnection(MySQLConnectionInfo& connInfo, ConnectionFlags connectionFlags) : MySQLConnection(connInfo, connectionFlags)
@@ -674,6 +674,10 @@ enum CharacterDatabaseStatements : uint32
CHAR_DEL_CHARACTER_BANK_TAB_SETTINGS,
CHAR_INS_CHARACTER_BANK_TAB_SETTINGS,
CHAR_SEL_CHARACTER_DAY_CYCLE,
CHAR_REP_CHARACTER_DAY_CYCLE,
CHAR_DEL_CHARACTER_DAY_CYCLE,
MAX_CHARACTERDATABASE_STATEMENTS
};
+1
View File
@@ -757,6 +757,7 @@ enum RBACPermissions
// IF YOU ADD NEW PERMISSIONS, ADD THEM IN 3.3.5 BRANCH AS WELL!
//
// custom permissions 1000+
RBAC_PERM_COMMAND_TIME = 1000, // .time day / night / auto (players too)
RBAC_PERM_MAX
};
+63 -8
View File
@@ -59,6 +59,7 @@
#include "CreatureAI.h"
#include "DB2Stores.h"
#include "DatabaseEnv.h"
#include "DayCycle.h"
#include "DisableMgr.h"
#include "DuelPackets.h"
#include "EquipmentSetPackets.h"
@@ -136,6 +137,7 @@
#include "StringConvert.h"
#include "TalentPackets.h"
#include "TerrainMgr.h"
#include "Timezone.h"
#include "ToyPackets.h"
#include "TradeData.h"
#include "TraitMgr.h"
@@ -249,6 +251,7 @@ Player::Player(WorldSession* session) : Unit(true), m_sceneMgr(this)
m_hostileReferenceCheckTimer = 0;
m_drunkTimer = 0;
m_skyMode = uint8(DayCycle::SkyMode::Auto);
m_deathTimer = 0;
m_deathExpireTime = 0;
@@ -4592,6 +4595,10 @@ void Player::DeleteFromDB(ObjectGuid playerguid, uint32 accountId, bool updateRe
stmt->setUInt64(0, guid);
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_DAY_CYCLE);
stmt->setUInt64(0, guid);
trans->Append(stmt);
sCharacterCache->DeleteCharacterCacheEntry(playerguid, name);
break;
}
@@ -19976,6 +19983,8 @@ bool Player::LoadFromDB(ObjectGuid guid, CharacterDatabaseQueryHolder const& hol
_LoadCharacterBankTabSettings(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_BANK_TAB_SETTINGS));
_LoadDayCycle(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_DAY_CYCLE));
_LoadInventory(holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_INVENTORY),
holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_ARTIFACTS),
holder.GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_AZERITE),
@@ -21707,6 +21716,11 @@ void Player::_LoadCharacterBankTabSettings(PreparedQueryResult result)
AddDynamicUpdateFieldValue(m_values.ModifyValue(&Player::m_activePlayerData).ModifyValue(&UF::ActivePlayerData::CharacterBankTabSettings));
}
void Player::_LoadDayCycle(PreparedQueryResult result)
{
m_skyMode = uint8(result ? DayCycle::SkyModeFromDb((*result)[0].GetUInt8()) : DayCycle::SkyMode::Auto);
}
/*********************************************************/
/*** SAVE SYSTEM ***/
/*********************************************************/
@@ -26418,14 +26432,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
m_questObjectiveCriteriaMgr->SendAllData(this);
/// SMSG_LOGIN_SETTIMESPEED
static float const TimeSpeed = 0.01666667f;
WorldPackets::Misc::LoginSetTimeSpeed loginSetTimeSpeed;
loginSetTimeSpeed.NewSpeed = TimeSpeed;
loginSetTimeSpeed.GameTime = *GameTime::GetWowTime();
loginSetTimeSpeed.ServerTime = *GameTime::GetWowTime();
loginSetTimeSpeed.GameTimeHolidayOffset = 0; /// @todo
loginSetTimeSpeed.ServerTimeHolidayOffset = 0; /// @todo
SendDirectMessage(loginSetTimeSpeed.Write());
SendDayCycle();
/// SMSG_WORLD_SERVER_INFO
WorldPackets::Misc::WorldServerInfo worldServerInfo;
@@ -26474,6 +26481,54 @@ void Player::SendInitialPacketsBeforeAddToMap()
SetMovedUnit(this);
}
// SMSG_LOGIN_SET_TIME_SPEED: sent at login and at every map change (SendInitialPacketsBeforeAddToMap), and by .time. The
// realm's date and clock go as they are (ServerTime, and the date of GameTime: the calendar and holidays); only the hour
// and minute of GameTime and the speed are the sky's.
void Player::SendDayCycle() const
{
WowTime const& now = *GameTime::GetWowTime();
// the realm's wall clock to the second (WowTime holds whole minutes, a minute that a fast sky would multiply)
int64 const localSeconds = int64(GameTime::GetGameTime())
+ std::chrono::duration_cast<Seconds>(Trinity::Timezone::GetSystemZoneOffsetAt(GameTime::GetSystemTime())).count();
DayCycle::SkyClock const sky = DayCycle::ShownClock(localSeconds, sWorld->getIntConfig(CONFIG_FOREVER_DAY_CYCLE_SPEED), GetSkyMode());
WorldPackets::Misc::LoginSetTimeSpeed loginSetTimeSpeed;
loginSetTimeSpeed.NewSpeed = sky.Speed;
loginSetTimeSpeed.GameTime = now;
loginSetTimeSpeed.GameTime.SetHour(sky.Hour);
loginSetTimeSpeed.GameTime.SetMinute(sky.Minute);
loginSetTimeSpeed.ServerTime = now;
loginSetTimeSpeed.GameTimeHolidayOffset = 0; /// @todo
loginSetTimeSpeed.ServerTimeHolidayOffset = 0; /// @todo
SendDirectMessage(loginSetTimeSpeed.Write());
}
DayCycle::SkyMode Player::GetSkyMode() const
{
return DayCycle::SkyModeFromDb(m_skyMode);
}
void Player::SetSkyMode(DayCycle::SkyMode mode)
{
m_skyMode = uint8(mode);
CharacterDatabasePreparedStatement* stmt;
if (mode == DayCycle::SkyMode::Auto)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_DAY_CYCLE);
stmt->setUInt64(0, GetGUID().GetCounter());
}
else
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CHARACTER_DAY_CYCLE);
stmt->setUInt64(0, GetGUID().GetCounter());
stmt->setUInt8(1, uint8(mode));
}
CharacterDatabase.Execute(stmt);
SendDayCycle();
}
void Player::SendInitialPacketsAfterAddToMap()
{
UpdateVisibilityForPlayer();
+12
View File
@@ -119,6 +119,11 @@ namespace BattlePets
struct BattlePet;
}
namespace DayCycle
{
enum class SkyMode : uint8;
}
namespace WorldPackets
{
namespace Character
@@ -1032,6 +1037,7 @@ enum PlayerLoginQueryIndex
PLAYER_LOGIN_QUERY_LOAD_DATA_ELEMENTS,
PLAYER_LOGIN_QUERY_LOAD_DATA_FLAGS,
PLAYER_LOGIN_QUERY_LOAD_BANK_TAB_SETTINGS,
PLAYER_LOGIN_QUERY_LOAD_DAY_CYCLE,
MAX_PLAYER_LOGIN_QUERY
};
@@ -1278,6 +1284,10 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
void SendInitialPacketsBeforeAddToMap();
void SendInitialPacketsAfterAddToMap();
// the sky's clock (DayCycle.h): the realm's sky at Forever.DayCycle.Speed, or this character's own noon or midnight
void SendDayCycle() const;
DayCycle::SkyMode GetSkyMode() const;
void SetSkyMode(DayCycle::SkyMode mode); // saved at once and sent
void SendSupercededSpell(uint32 oldSpell, uint32 newSpell) const;
void SendTransferAborted(uint32 mapid, TransferAbortReason reason, uint8 arg = 0, int32 mapDifficultyXConditionID = 0) const;
@@ -3282,6 +3292,7 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
void _LoadCUFProfiles(PreparedQueryResult result);
void _LoadPlayerData(PreparedQueryResult elementsResult, PreparedQueryResult flagsResult);
void _LoadCharacterBankTabSettings(PreparedQueryResult result);
void _LoadDayCycle(PreparedQueryResult result);
/*********************************************************/
/*** SAVE SYSTEM ***/
@@ -3419,6 +3430,7 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
uint32 m_hostileReferenceCheckTimer;
uint32 m_drunkTimer;
uint32 m_weaponChangeTimer;
uint8 m_skyMode; // DayCycle::SkyMode
uint32 m_zoneUpdateId;
uint32 m_areaUpdateId;
@@ -358,6 +358,10 @@ bool LoginQueryHolder::Initialize()
stmt->setUInt64(0, lowGuid);
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_BANK_TAB_SETTINGS, stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_DAY_CYCLE);
stmt->setUInt64(0, lowGuid);
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_DAY_CYCLE, stmt);
return res;
}
+77
View File
@@ -0,0 +1,77 @@
/*
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// The sky's clock a client is given (SMSG_LOGIN_SET_TIME_SPEED): the client lights the world from it and runs it on by itself.
// * Forever.DayCycle.Speed (worldserver.conf): the whole realm's sky runs 1x (the realm's own clock, as before), 2x or more.
// The shown time is worked out from the realm's local time alone, so every player sees the same sky, also after a restart.
// * .time day / .time night: one character keeps noon or midnight, wherever it goes; .time auto: the realm's sky again.
// Only the sky: events, resets, spawns and scripts keep the realm's own time. The pure part is here, so it can be unit tested;
// Player::SendDayCycle sends it.
#ifndef TRINITYCORE_DAY_CYCLE_H
#define TRINITYCORE_DAY_CYCLE_H
#include "Define.h"
namespace DayCycle
{
// saved per character (character_day_cycle.mode); a value the server does not know is read as Auto
enum class SkyMode : uint8
{
Auto = 0,
Day = 1,
Night = 2
};
inline SkyMode SkyModeFromDb(uint8 v)
{
return v == uint8(SkyMode::Day) ? SkyMode::Day : v == uint8(SkyMode::Night) ? SkyMode::Night : SkyMode::Auto;
}
// the client's speed for the realm clock: game minutes per real second
constexpr float NormalSpeed = 0.01666667f;
constexpr uint32 MinSpeed = 1;
constexpr uint32 MaxSpeed = 24; // a whole day and night in an hour
// Hour and minute the sky shows for a realm-local time (seconds since 1970 as read on the realm's wall clock) at a
// speed: the time of day runs speed times as fast, counted from 1970, so at 1 it is the realm's own time of day.
struct SkyClock
{
int8 Hour = 0;
int8 Minute = 0;
float Speed = NormalSpeed; // 0: the sky stands still (.time day / night)
};
constexpr SkyClock ShownClock(int64 localSeconds, uint32 speed, SkyMode mode)
{
if (mode == SkyMode::Day)
return { 12, 0, 0.0f };
if (mode == SkyMode::Night)
return { 0, 0, 0.0f };
if (speed < MinSpeed)
speed = MinSpeed;
if (speed > MaxSpeed)
speed = MaxSpeed;
int64 const ofDay = ((localSeconds % 86400) + 86400) % 86400;
int64 const shown = (ofDay * int64(speed)) % 86400;
return { int8(shown / 3600), int8(shown % 3600 / 60), NormalSpeed * float(speed) };
}
}
#endif // TRINITYCORE_DAY_CYCLE_H
+2
View File
@@ -49,6 +49,7 @@
#include "CreatureTextMgr.h"
#include "DB2Stores.h"
#include "DatabaseEnv.h"
#include "DayCycle.h"
#include "DetourMemoryFunctions.h"
#include "DisableMgr.h"
#include "GameEventMgr.h"
@@ -920,6 +921,7 @@ void World::LoadConfigSettings(bool reload)
{ .Name = "Classic.Respawn.Level31to60Pct"sv, .DefaultValue = 100, .Index = CONFIG_CLASSIC_RESPAWN_LEVEL_31_60_PCT, .Min = 10, .Max = 1000 },
{ .Name = "Classic.CreatureHealth.RaiseFromLevel"sv, .DefaultValue = 20, .Index = CONFIG_CLASSIC_CREATURE_HEALTH_RAISE_FROM_LEVEL, .Min = 1, .Max = 59 },
{ .Name = "Classic.CreatureHealth.RaiseAt60Pct"sv, .DefaultValue = 20, .Index = CONFIG_CLASSIC_CREATURE_HEALTH_RAISE_AT_60_PCT, .Max = 200 },
{ .Name = "Forever.DayCycle.Speed"sv, .DefaultValue = 1, .Index = CONFIG_FOREVER_DAY_CYCLE_SPEED, .Min = DayCycle::MinSpeed, .Max = DayCycle::MaxSpeed, .Reloadable = false },
} };
static constexpr ConfigOptionLoadDefinitionArray<uint64, INT64_CONFIG_VALUE_COUNT> int64s =
+1
View File
@@ -455,6 +455,7 @@ enum WorldIntConfigs : uint32
CONFIG_CLASSIC_RESPAWN_LEVEL_31_60_PCT,
CONFIG_CLASSIC_CREATURE_HEALTH_RAISE_FROM_LEVEL,
CONFIG_CLASSIC_CREATURE_HEALTH_RAISE_AT_60_PCT,
CONFIG_FOREVER_DAY_CYCLE_SPEED,
INT_CONFIG_VALUE_COUNT
};
+56
View File
@@ -25,6 +25,7 @@
#include "StringConvert.h"
#include "ChatCommand.h"
#include "DatabaseEnv.h"
#include "DayCycle.h"
#include "DB2Stores.h"
#include "DisableMgr.h"
#include "GridNotifiers.h"
@@ -67,6 +68,10 @@ public:
static ChatCommandTable commandTable =
{
{ "additem", HandleAddItemCommand, rbac::RBAC_PERM_COMMAND_ADDITEM, Console::No },
{ "time", HandleTimeCommand, rbac::RBAC_PERM_COMMAND_TIME, Console::No },
{ "time day", HandleTimeDayCommand, rbac::RBAC_PERM_COMMAND_TIME, Console::No },
{ "time night", HandleTimeNightCommand, rbac::RBAC_PERM_COMMAND_TIME, Console::No },
{ "time auto", HandleTimeAutoCommand, rbac::RBAC_PERM_COMMAND_TIME, Console::No },
{ "additem to", HandleAddItemToCommand, rbac::RBAC_PERM_COMMAND_ADDITEM, Console::No },
{ "additem set", HandleAddItemSetCommand, rbac::RBAC_PERM_COMMAND_ADDITEMSET, Console::No },
{ "appear", HandleAppearCommand, rbac::RBAC_PERM_COMMAND_APPEAR, Console::No },
@@ -1212,6 +1217,57 @@ public:
return true;
}
// .time: this character's own sky (DayCycle.h). Only the light and the sky change, for this player alone; the realm's
// events and clock stay as they are. Kept across logins (character_day_cycle).
static bool HandleTimeCommand(ChatHandler* handler)
{
Player* player = handler->GetSession()->GetPlayer();
bool const ru = handler->GetSession()->GetSessionDbLocaleIndex() == LOCALE_ruRU;
uint32 const speed = sWorld->getIntConfig(CONFIG_FOREVER_DAY_CYCLE_SPEED);
switch (player->GetSkyMode())
{
case DayCycle::SkyMode::Day:
handler->SendSysMessage(ru ? "Ваше небо: всегда полдень (.time day). .time night - полночь, .time auto - день и ночь мира."
: "Your sky: always noon (.time day). .time night for midnight, .time auto for the realm's day and night.");
break;
case DayCycle::SkyMode::Night:
handler->SendSysMessage(ru ? "Ваше небо: всегда полночь (.time night). .time day - полдень, .time auto - день и ночь мира."
: "Your sky: always midnight (.time night). .time day for noon, .time auto for the realm's day and night.");
break;
default:
handler->PSendSysMessage(ru ? "Ваше небо: день и ночь мира (скорость %ux). .time day - всегда полдень, .time night - всегда полночь."
: "Your sky: the realm's day and night (speed %ux). .time day keeps noon, .time night keeps midnight.", speed);
break;
}
return true;
}
static bool HandleTimeDayCommand(ChatHandler* handler) { return SetSkyMode(handler, DayCycle::SkyMode::Day); }
static bool HandleTimeNightCommand(ChatHandler* handler) { return SetSkyMode(handler, DayCycle::SkyMode::Night); }
static bool HandleTimeAutoCommand(ChatHandler* handler) { return SetSkyMode(handler, DayCycle::SkyMode::Auto); }
static bool SetSkyMode(ChatHandler* handler, DayCycle::SkyMode mode)
{
Player* player = handler->GetSession()->GetPlayer();
bool const ru = handler->GetSession()->GetSessionDbLocaleIndex() == LOCALE_ruRU;
player->SetSkyMode(mode);
switch (mode)
{
case DayCycle::SkyMode::Day:
handler->SendSysMessage(ru ? "Теперь у вас всегда полдень (это видите только вы). .time auto вернёт день и ночь мира."
: "It stays noon for you now (only you see it). .time auto brings back the realm's day and night.");
break;
case DayCycle::SkyMode::Night:
handler->SendSysMessage(ru ? "Теперь у вас всегда полночь (это видите только вы). .time auto вернёт день и ночь мира."
: "It stays midnight for you now (only you see it). .time auto brings back the realm's day and night.");
break;
default:
handler->SendSysMessage(ru ? "Ваше небо снова идёт по дню и ночи мира." : "Your sky follows the realm's day and night again.");
break;
}
return true;
}
static bool HandleAddItemCommandHelper(ChatHandler* handler, Player* player, Player* playerTarget,
Variant<Hyperlink<item>, uint32, std::string_view> const& itemArg, Optional<int32> countArg,
Optional<std::string_view> const& bonusListIdString, Optional<uint8> itemContextArg)
@@ -5224,3 +5224,18 @@ Discord.Channel.Enable = 0
# Default: "Discord"
Discord.Channel.Name = "Discord"
#
# Forever.DayCycle.Speed
# Description: How fast the sky runs from day to night for the whole realm. The time of day shown is worked out from
# the realm's clock, 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. Players can also keep their own
# character at noon or midnight with .time day / .time night (.time auto goes back to this).
# Read at server start (a restart is needed after a change).
# Default: 1 - (The realm's own clock: a day takes 24 hours)
# 2 - (Twice as fast: a day takes 12 hours)
# 3 - (Three times as fast: a day takes 8 hours)
# ...
# 24 - (A day takes an hour)
Forever.DayCycle.Speed = 1