[Bug Fix] Fixed the discrepacy with time using command #time and in quests. (#3767)

* [BUG] Fixed the discrepacy with time using command #time and in quests. https://github.com/EQEmu/Server/issues/3700

* removed comments and paratheses from previous commit.

* fixed typos.

* made some adjustment so #time, /time, scripting, and log all match.

* Update lua_general.cpp
This commit is contained in:
regneq
2023-12-16 20:40:40 -08:00
committed by GitHub
parent 9739c1c8ef
commit 7e651877c7
4 changed files with 12 additions and 19 deletions
+9 -16
View File
@@ -9,17 +9,11 @@ void SetTime(Client *c, const Seperator *sep)
TimeOfDay_Struct world_time{};
zone->zone_time.GetCurrentEQTimeOfDay(time(0), &world_time);
auto time_string = fmt::format(
"{} (Timezone: {})",
Strings::ZoneTime(world_time.hour, world_time.minute),
Strings::ZoneTime(zone->zone_time.getEQTimeZoneHr(), zone->zone_time.getEQTimeZoneHr())
);
c->Message(
Chat::White,
fmt::format(
"It is currently {}.",
time_string
Strings::ZoneTime(world_time.hour - 1, world_time.minute)
).c_str()
);
@@ -27,15 +21,15 @@ void SetTime(Client *c, const Seperator *sep)
}
uint8 minutes = 0;
uint8 hours = Strings::ToUnsignedInt(sep->arg[2]) + 1;
uint8 hours = Strings::ToUnsignedInt(sep->arg[2]);
if (hours > 24) {
hours = 24;
}
uint8 real_hours = (
(hours - 1) > 0 ?
(hours - 1) :
hours > 0 ?
hours :
0
);
@@ -47,21 +41,20 @@ void SetTime(Client *c, const Seperator *sep)
}
}
c->Message(
Chat::White,
fmt::format(
"Setting world time to {} (Timezone: {}).",
Strings::ZoneTime(hours, minutes),
Strings::ZoneTime(zone->zone_time.getEQTimeZoneHr(), zone->zone_time.getEQTimeZoneHr())
"Setting world time to {}.",
Strings::ZoneTime(hours, minutes)
).c_str()
);
zone->SetTime(real_hours, minutes);
LogInfo(
"{} :: Setting world time to {} (Timezone: {})",
"{} :: Setting world time to {}.",
c->GetCleanName(),
Strings::ZoneTime(hours, minutes),
Strings::ZoneTime(zone->zone_time.getEQTimeZoneHr(), zone->zone_time.getEQTimeZoneHr())
Strings::ZoneTime(hours, minutes)
);
}