mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 13:16:39 +00:00
[Zones] Convert Get/Set of Zone Timezone to Repositories (#3946)
* [Zones] Convert Get/Set of Zone Timezone to Repositories - Convert `GetZoneTimezone()` and `SetZoneTimeZone()` to repositories. * Update time_zone.cpp
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
void SetTimeZone(Client *c, const Seperator *sep)
|
||||
{
|
||||
const auto arguments = sep->argnum;
|
||||
if (arguments < 2 || sep->IsNumber(2)) {
|
||||
if (arguments < 2 || !sep->IsNumber(2)) {
|
||||
c->Message(Chat::White, "Usage: #set time_zone [Hour] [Minute]");
|
||||
c->Message(
|
||||
Chat::White,
|
||||
@@ -15,12 +15,13 @@ void SetTimeZone(Client *c, const Seperator *sep)
|
||||
return;
|
||||
}
|
||||
|
||||
uint8 minutes = 0;
|
||||
uint8 hours = Strings::ToUnsignedInt(sep->arg[2]);
|
||||
|
||||
if (hours > 24) {
|
||||
hours = 24;
|
||||
}
|
||||
EQ::Clamp(hours, static_cast<uint8>(0), static_cast<uint8>(24));
|
||||
|
||||
uint8 minutes = sep->IsNumber(3) ? Strings::ToUnsignedInt(sep->arg[3]) : 0;
|
||||
|
||||
EQ::Clamp(minutes, static_cast<uint8>(0), static_cast<uint8>(59));
|
||||
|
||||
uint8 real_hours = (
|
||||
(hours - 1) > 0 ?
|
||||
@@ -28,14 +29,6 @@ void SetTimeZone(Client *c, const Seperator *sep)
|
||||
0
|
||||
);
|
||||
|
||||
if (sep->IsNumber(3)) {
|
||||
minutes = Strings::ToUnsignedInt(sep->arg[3]);
|
||||
|
||||
if (minutes > 59) {
|
||||
minutes = 59;
|
||||
}
|
||||
}
|
||||
|
||||
c->Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
@@ -46,7 +39,7 @@ void SetTimeZone(Client *c, const Seperator *sep)
|
||||
|
||||
const int new_timezone = ((hours * 60) + minutes);
|
||||
zone->zone_time.setEQTimeZone(new_timezone);
|
||||
content_db.SetZoneTZ(zone->GetZoneID(), zone->GetInstanceVersion(), new_timezone);
|
||||
content_db.SetZoneTimezone(zone->GetZoneID(), zone->GetInstanceVersion(), new_timezone);
|
||||
|
||||
auto outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user