mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 14:41:28 +00:00
Implemented disjointed zone based time, this can be triggered via quest methods
Added parameter to LUA and Perl method settime(hour, minute, [update_world = true]) - If update_world is false, the zone will then unsubscribe itself from regular worldserver time synchronizations Added DB ver 9082 with update to add npc_types texture columns if table does not currently have them
This commit is contained in:
parent
b06e1c2041
commit
ee136881c8
@ -1,5 +1,12 @@
|
||||
EQEMu Changelog (Started on Sept 24, 2003 15:50)
|
||||
-------------------------------------------------------
|
||||
|
||||
== 05/25/2015 ==
|
||||
Akkadius: Implemented disjointed zone based time, this can be triggered via quest methods
|
||||
Akkadius: Added parameter to LUA and Perl method settime(hour, minute, [update_world = true])
|
||||
- If update_world is false, the zone will then unsubscribe itself from regular worldserver time synchronizations
|
||||
Akkadius: Added DB ver 9082 with update to add npc_types texture columns if table does not currently have them
|
||||
|
||||
== 05/22/2015 ==
|
||||
Uleat: Added null-term declaration for character names in ENCODE(OP_CharInfo) - where appropriate
|
||||
|
||||
|
||||
@ -55,7 +55,7 @@ EQTime::EQTime()
|
||||
//Set default time zone
|
||||
timezone=0;
|
||||
//Start EQTimer
|
||||
setEQTimeOfDay(start, time(0));
|
||||
SetCurrentEQTimeOfDay(start, time(0));
|
||||
}
|
||||
|
||||
EQTime::~EQTime()
|
||||
@ -67,7 +67,7 @@ EQTime::~EQTime()
|
||||
//Input: Current Time (as a time_t), a pointer to the TimeOfDay_Struct that will be written to.
|
||||
//Output: 0=Error, 1=Sucess
|
||||
|
||||
int EQTime::getEQTimeOfDay( time_t timeConvert, struct TimeOfDay_Struct *eqTimeOfDay )
|
||||
int EQTime::GetCurrentEQTimeOfDay( time_t timeConvert, struct TimeOfDay_Struct *eqTimeOfDay )
|
||||
{
|
||||
/* check to see if we have a reference time to go by. */
|
||||
if( eqTime.start_realtime == 0 )
|
||||
@ -124,7 +124,7 @@ int EQTime::getEQTimeOfDay( time_t timeConvert, struct TimeOfDay_Struct *eqTimeO
|
||||
}
|
||||
|
||||
//setEQTimeOfDay
|
||||
int EQTime::setEQTimeOfDay(TimeOfDay_Struct start_eq, time_t start_real)
|
||||
int EQTime::SetCurrentEQTimeOfDay(TimeOfDay_Struct start_eq, time_t start_real)
|
||||
{
|
||||
if(start_real==0)
|
||||
return 0;
|
||||
|
||||
@ -21,8 +21,8 @@ public:
|
||||
~EQTime();
|
||||
|
||||
//Get functions
|
||||
int getEQTimeOfDay( TimeOfDay_Struct *eqTimeOfDay ) { return(getEQTimeOfDay(time(nullptr), eqTimeOfDay)); }
|
||||
int getEQTimeOfDay( time_t timeConvert, TimeOfDay_Struct *eqTimeOfDay );
|
||||
int GetCurrentEQTimeOfDay( TimeOfDay_Struct *eqTimeOfDay ) { return(GetCurrentEQTimeOfDay(time(nullptr), eqTimeOfDay)); }
|
||||
int GetCurrentEQTimeOfDay( time_t timeConvert, TimeOfDay_Struct *eqTimeOfDay );
|
||||
TimeOfDay_Struct getStartEQTime() { return eqTime.start_eqtime; }
|
||||
time_t getStartRealTime() { return eqTime.start_realtime; }
|
||||
uint32 getEQTimeZone() { return timezone; }
|
||||
@ -30,7 +30,7 @@ public:
|
||||
uint32 getEQTimeZoneMin() { return timezone%60; }
|
||||
|
||||
//Set functions
|
||||
int setEQTimeOfDay(TimeOfDay_Struct start_eq, time_t start_real);
|
||||
int SetCurrentEQTimeOfDay(TimeOfDay_Struct start_eq, time_t start_real);
|
||||
void setEQTimeZone(int32 in_timezone) { timezone=in_timezone; }
|
||||
|
||||
//Time math/logic functions
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||
*/
|
||||
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9080
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9082
|
||||
#define COMPILE_DATE __DATE__
|
||||
#define COMPILE_TIME __TIME__
|
||||
#ifndef WIN32
|
||||
|
||||
@ -335,6 +335,7 @@
|
||||
9079|2015_05_23_BuffDurations.sql|SHOW COLUMNS FROM `character_buffs` LIKE 'ticsremaining'|contains|unsigned|
|
||||
9080|2015_05_23_PetBuffInstrumentMod.sql|SHOW COLUMNS FROM `character_pet_buffs` LIKE 'instrument_mod'|empty|
|
||||
9081|2015_05_23_dbstr_us.sql|SHOW TABLES LIKE 'db_str'|empty|
|
||||
9082|2015_05_25_npc_types_texture_fields.sql|SHOW COLUMNS FROM `npc_types` LIKE 'armtexture'|empty|
|
||||
|
||||
# Upgrade conditions:
|
||||
# This won't be needed after this system is implemented, but it is used database that are not
|
||||
|
||||
@ -964,7 +964,7 @@ bool ZoneServer::Process() {
|
||||
case ServerOP_SetWorldTime: {
|
||||
Log.Out(Logs::Detail, Logs::World_Server,"Received SetWorldTime");
|
||||
eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer;
|
||||
zoneserver_list.worldclock.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime);
|
||||
zoneserver_list.worldclock.SetCurrentEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime);
|
||||
Log.Out(Logs::Detail, Logs::World_Server,"New time = %d-%d-%d %d:%d (%d)\n", newtime->start_eqtime.year, newtime->start_eqtime.month, (int)newtime->start_eqtime.day, (int)newtime->start_eqtime.hour, (int)newtime->start_eqtime.minute, (int)newtime->start_realtime);
|
||||
zoneserver_list.worldclock.saveFile(WorldConfig::get()->EQTimeFile.c_str());
|
||||
zoneserver_list.SendTimeSync();
|
||||
|
||||
@ -1703,7 +1703,7 @@ void Client::Handle_Connect_OP_ZoneEntry(const EQApplicationPacket *app)
|
||||
/* Time of Day packet */
|
||||
outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct));
|
||||
TimeOfDay_Struct* tod = (TimeOfDay_Struct*)outapp->pBuffer;
|
||||
zone->zone_time.getEQTimeOfDay(time(0), tod);
|
||||
zone->zone_time.GetCurrentEQTimeOfDay(time(0), tod);
|
||||
outapp->priority = 6;
|
||||
FastQueuePacket(&outapp);
|
||||
|
||||
|
||||
@ -1369,7 +1369,7 @@ void command_date(Client *c, const Seperator *sep)
|
||||
else {
|
||||
int h=0, m=0;
|
||||
TimeOfDay_Struct eqTime;
|
||||
zone->zone_time.getEQTimeOfDay( time(0), &eqTime);
|
||||
zone->zone_time.GetCurrentEQTimeOfDay( time(0), &eqTime);
|
||||
if(!sep->IsNumber(4))
|
||||
h=eqTime.hour;
|
||||
else
|
||||
@ -1402,7 +1402,7 @@ void command_timezone(Client *c, const Seperator *sep)
|
||||
// Update all clients with new TZ.
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct));
|
||||
TimeOfDay_Struct* tod = (TimeOfDay_Struct*)outapp->pBuffer;
|
||||
zone->zone_time.getEQTimeOfDay(time(0), tod);
|
||||
zone->zone_time.GetCurrentEQTimeOfDay(time(0), tod);
|
||||
entity_list.QueueClients(c, outapp);
|
||||
safe_delete(outapp);
|
||||
}
|
||||
@ -4393,7 +4393,7 @@ void command_time(Client *c, const Seperator *sep)
|
||||
else {
|
||||
c->Message(13, "To set the Time: #time HH [MM]");
|
||||
TimeOfDay_Struct eqTime;
|
||||
zone->zone_time.getEQTimeOfDay( time(0), &eqTime);
|
||||
zone->zone_time.GetCurrentEQTimeOfDay( time(0), &eqTime);
|
||||
sprintf(timeMessage,"%02d:%s%d %s (Timezone: %ih %im)",
|
||||
((eqTime.hour - 1) % 12) == 0 ? 12 : ((eqTime.hour - 1) % 12),
|
||||
(eqTime.minute < 10) ? "0" : "",
|
||||
|
||||
@ -1072,7 +1072,7 @@ void PerlembParser::ExportZoneVariables(std::string &package_name) {
|
||||
ExportVar(package_name.c_str(), "instanceid", zone->GetInstanceID());
|
||||
ExportVar(package_name.c_str(), "instanceversion", zone->GetInstanceVersion());
|
||||
TimeOfDay_Struct eqTime;
|
||||
zone->zone_time.getEQTimeOfDay( time(0), &eqTime);
|
||||
zone->zone_time.GetCurrentEQTimeOfDay( time(0), &eqTime);
|
||||
ExportVar(package_name.c_str(), "zonehour", eqTime.hour - 1);
|
||||
ExportVar(package_name.c_str(), "zonemin", eqTime.minute);
|
||||
ExportVar(package_name.c_str(), "zonetime", (eqTime.hour - 1) * 100 + eqTime.minute);
|
||||
|
||||
@ -1182,13 +1182,26 @@ XS(XS__settime);
|
||||
XS(XS__settime)
|
||||
{
|
||||
dXSARGS;
|
||||
if (items != 2)
|
||||
Perl_croak(aTHX_ "Usage: settime(new_hour, new_min)");
|
||||
if (items < 2)
|
||||
Perl_croak(aTHX_ "Usage: settime(new_hour, new_min, [update_world = true])");
|
||||
|
||||
int new_hour = (int)SvIV(ST(0));
|
||||
int new_min = (int)SvIV(ST(1));
|
||||
if (items == 2){
|
||||
int new_hour = (int)SvIV(ST(0));
|
||||
int new_min = (int)SvIV(ST(1));
|
||||
quest_manager.settime(new_hour, new_min, true);
|
||||
}
|
||||
else if (items == 3){
|
||||
int new_hour = (int)SvIV(ST(0));
|
||||
int new_min = (int)SvIV(ST(1));
|
||||
|
||||
quest_manager.settime(new_hour, new_min);
|
||||
int update_world = (int)SvIV(ST(2));
|
||||
if (update_world == 1){
|
||||
quest_manager.settime(new_hour, new_min, true);
|
||||
}
|
||||
else{
|
||||
quest_manager.settime(new_hour, new_min, false);
|
||||
}
|
||||
}
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
}
|
||||
|
||||
@ -386,7 +386,11 @@ void lua_create_guild(const char *name, const char *leader) {
|
||||
}
|
||||
|
||||
void lua_set_time(int hour, int min) {
|
||||
quest_manager.settime(hour, min);
|
||||
quest_manager.settime(hour, min, true);
|
||||
}
|
||||
|
||||
void lua_set_time(int hour, int min, bool update_world) {
|
||||
quest_manager.settime(hour, min, update_world);
|
||||
}
|
||||
|
||||
void lua_signal(int npc_id, int signal_id) {
|
||||
@ -979,7 +983,7 @@ int lua_get_zone_weather() {
|
||||
|
||||
luabind::adl::object lua_get_zone_time(lua_State *L) {
|
||||
TimeOfDay_Struct eqTime;
|
||||
zone->zone_time.getEQTimeOfDay(time(0), &eqTime);
|
||||
zone->zone_time.GetCurrentEQTimeOfDay(time(0), &eqTime);
|
||||
|
||||
luabind::adl::object ret = luabind::newtable(L);
|
||||
ret["zone_hour"] = eqTime.hour - 1;
|
||||
@ -1467,7 +1471,8 @@ luabind::scope lua_register_general() {
|
||||
luabind::def("set_sky", &lua_set_sky),
|
||||
luabind::def("set_guild", &lua_set_guild),
|
||||
luabind::def("create_guild", &lua_create_guild),
|
||||
luabind::def("set_time", &lua_set_time),
|
||||
luabind::def("set_time", (void(*)(int, int))&lua_set_time),
|
||||
luabind::def("set_time", (void(*)(int, int, bool))&lua_set_time),
|
||||
luabind::def("signal", (void(*)(int,int))&lua_signal),
|
||||
luabind::def("signal", (void(*)(int,int,int))&lua_signal),
|
||||
luabind::def("set_global", &lua_set_global),
|
||||
|
||||
@ -1292,9 +1292,10 @@ void QuestManager::CreateGuild(const char *guild_name, const char *leader) {
|
||||
}
|
||||
}
|
||||
|
||||
void QuestManager::settime(uint8 new_hour, uint8 new_min) {
|
||||
void QuestManager::settime(uint8 new_hour, uint8 new_min, bool update_world /*= true*/)
|
||||
{
|
||||
if (zone)
|
||||
zone->SetTime(new_hour + 1, new_min);
|
||||
zone->SetTime(new_hour + 1, new_min, update_world);
|
||||
}
|
||||
|
||||
void QuestManager::itemlink(int item_id) {
|
||||
|
||||
@ -126,7 +126,7 @@ public:
|
||||
void setsky(uint8 new_sky);
|
||||
void setguild(uint32 new_guild_id, uint8 new_rank);
|
||||
void CreateGuild(const char *guild_name, const char *leader);
|
||||
void settime(uint8 new_hour, uint8 new_min);
|
||||
void settime(uint8 new_hour, uint8 new_min, bool update_world = true);
|
||||
void itemlink(int item_id);
|
||||
void signal(int npc_id, int wait_ms = 0);
|
||||
void signalwith(int npc_id, int signal_id, int wait_ms = 0);
|
||||
|
||||
@ -624,7 +624,7 @@ void SpawnConditionManager::Process() {
|
||||
|
||||
//get our current time
|
||||
TimeOfDay_Struct tod;
|
||||
zone->zone_time.getEQTimeOfDay(&tod);
|
||||
zone->zone_time.GetCurrentEQTimeOfDay(&tod);
|
||||
|
||||
//see if time is past our nearest event.
|
||||
if(EQTime::IsTimeBefore(&next_event, &tod))
|
||||
@ -673,7 +673,7 @@ void SpawnConditionManager::ExecEvent(SpawnEvent &event, bool send_update) {
|
||||
}
|
||||
|
||||
TimeOfDay_Struct tod;
|
||||
zone->zone_time.getEQTimeOfDay(&tod);
|
||||
zone->zone_time.GetCurrentEQTimeOfDay(&tod);
|
||||
if(event.strict && (event.next.hour != tod.hour || event.next.day != tod.day || event.next.month != tod.month || event.next.year != tod.year))
|
||||
{
|
||||
Log.Out(Logs::Detail, Logs::Spawns, "Event %d: Unable to execute. Condition is strict, and event time has already passed.", event.id);
|
||||
@ -871,7 +871,7 @@ bool SpawnConditionManager::LoadSpawnConditions(const char* zone_name, uint32 in
|
||||
//better solution, and I just dont care thats much.
|
||||
//get our current time
|
||||
TimeOfDay_Struct tod;
|
||||
zone->zone_time.getEQTimeOfDay(&tod);
|
||||
zone->zone_time.GetCurrentEQTimeOfDay(&tod);
|
||||
|
||||
for(auto cur = spawn_events.begin(); cur != spawn_events.end(); ++cur) {
|
||||
SpawnEvent &cevent = *cur;
|
||||
@ -1096,7 +1096,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri
|
||||
if(reset_base) {
|
||||
Log.Out(Logs::Detail, Logs::Spawns, "Spawn event %d located in this zone. State set. Trigger time reset (period %d).", event_id, cevent.period);
|
||||
//start with the time now
|
||||
zone->zone_time.getEQTimeOfDay(&cevent.next);
|
||||
zone->zone_time.GetCurrentEQTimeOfDay(&cevent.next);
|
||||
//advance the next time by our period
|
||||
EQTime::AddMinutes(cevent.period, &cevent.next);
|
||||
} else {
|
||||
@ -1141,7 +1141,7 @@ void SpawnConditionManager::ToggleEvent(uint32 event_id, bool enabled, bool stri
|
||||
if(reset_base) {
|
||||
Log.Out(Logs::Detail, Logs::Spawns, "Spawn event %d is in zone %s. State set. Trigger time reset (period %d). Notifying world.", event_id, zone_short_name.c_str(), e.period);
|
||||
//start with the time now
|
||||
zone->zone_time.getEQTimeOfDay(&e.next);
|
||||
zone->zone_time.GetCurrentEQTimeOfDay(&e.next);
|
||||
//advance the next time by our period
|
||||
EQTime::AddMinutes(e.period, &e.next);
|
||||
} else {
|
||||
|
||||
@ -742,32 +742,36 @@ void WorldServer::Process() {
|
||||
break;
|
||||
}
|
||||
case ServerOP_SyncWorldTime: {
|
||||
if(zone!=0) {
|
||||
if (zone != 0 && !zone->is_zone_time_localized) {
|
||||
Log.Out(Logs::Moderate, Logs::Zone_Server, "%s Received Message SyncWorldTime", __FUNCTION__);
|
||||
eqTimeOfDay* newtime = (eqTimeOfDay*) pack->pBuffer;
|
||||
zone->zone_time.setEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime);
|
||||
|
||||
eqTimeOfDay* newtime = (eqTimeOfDay*)pack->pBuffer;
|
||||
zone->zone_time.SetCurrentEQTimeOfDay(newtime->start_eqtime, newtime->start_realtime);
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct));
|
||||
TimeOfDay_Struct* tod = (TimeOfDay_Struct*)outapp->pBuffer;
|
||||
zone->zone_time.getEQTimeOfDay(time(0), tod);
|
||||
TimeOfDay_Struct* time_of_day = (TimeOfDay_Struct*)outapp->pBuffer;
|
||||
zone->zone_time.GetCurrentEQTimeOfDay(time(0), time_of_day);
|
||||
entity_list.QueueClients(0, outapp, false);
|
||||
safe_delete(outapp);
|
||||
//TEST
|
||||
char timeMessage[255];
|
||||
time_t timeCurrent = time(nullptr);
|
||||
TimeOfDay_Struct eqTime;
|
||||
zone->zone_time.getEQTimeOfDay( timeCurrent, &eqTime);
|
||||
//if ( eqTime.hour >= 0 && eqTime.minute >= 0 )
|
||||
//{
|
||||
sprintf(timeMessage,"EQTime [%02d:%s%d %s]",
|
||||
((eqTime.hour - 1) % 12) == 0 ? 12 : ((eqTime.hour - 1) % 12),
|
||||
(eqTime.minute < 10) ? "0" : "",
|
||||
eqTime.minute,
|
||||
(eqTime.hour >= 13) ? "pm" : "am"
|
||||
);
|
||||
Log.Out(Logs::General, Logs::Zone_Server, "Time Broadcast Packet: %s", timeMessage);
|
||||
zone->GotCurTime(true);
|
||||
//}
|
||||
//Test
|
||||
|
||||
/* Buffer garbage to generate debug message */
|
||||
char time_message[255];
|
||||
time_t current_time = time(nullptr);
|
||||
TimeOfDay_Struct eq_time;
|
||||
zone->zone_time.GetCurrentEQTimeOfDay(current_time, &eq_time);
|
||||
|
||||
sprintf(time_message, "EQTime [%02d:%s%d %s]",
|
||||
((eq_time.hour - 1) % 12) == 0 ? 12 : ((eq_time.hour - 1) % 12),
|
||||
(eq_time.minute < 10) ? "0" : "",
|
||||
eq_time.minute,
|
||||
(eq_time.hour >= 13) ? "pm" : "am"
|
||||
);
|
||||
|
||||
Log.Out(Logs::General, Logs::Zone_Server, "Time Broadcast Packet: %s", time_message);
|
||||
zone->SetZoneHasCurrentTime(true);
|
||||
|
||||
}
|
||||
if (zone->is_zone_time_localized){
|
||||
Log.Out(Logs::General, Logs::Zone_Server, "Received request to sync time from world, but our time is localized currently");
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -697,7 +697,7 @@ void Zone::Shutdown(bool quite)
|
||||
|
||||
Log.Out(Logs::General, Logs::Status, "Zone Shutdown: %s (%i)", zone->GetShortName(), zone->GetZoneID());
|
||||
petition_list.ClearPetitions();
|
||||
zone->GotCurTime(false);
|
||||
zone->SetZoneHasCurrentTime(false);
|
||||
if (!quite)
|
||||
Log.Out(Logs::General, Logs::Normal, "Zone shutdown: going to sleep");
|
||||
ZoneLoaded = false;
|
||||
@ -760,6 +760,8 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
|
||||
qGlobals = nullptr;
|
||||
default_ruleset = 0;
|
||||
|
||||
is_zone_time_localized = false;
|
||||
|
||||
loglevelvar = 0;
|
||||
merchantvar = 0;
|
||||
tradevar = 0;
|
||||
@ -805,7 +807,7 @@ Zone::Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name)
|
||||
totalBS = 0;
|
||||
aas = nullptr;
|
||||
totalAAs = 0;
|
||||
gottime = false;
|
||||
zone_has_current_time = false;
|
||||
|
||||
Instance_Shutdown_Timer = nullptr;
|
||||
bool is_perma = false;
|
||||
@ -1484,7 +1486,7 @@ void Zone::Repop(uint32 delay) {
|
||||
|
||||
void Zone::GetTimeSync()
|
||||
{
|
||||
if (worldserver.Connected() && !gottime) {
|
||||
if (worldserver.Connected() && !zone_has_current_time) {
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_GetWorldTime, 0);
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
@ -1508,17 +1510,42 @@ void Zone::SetDate(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute
|
||||
}
|
||||
}
|
||||
|
||||
void Zone::SetTime(uint8 hour, uint8 minute)
|
||||
void Zone::SetTime(uint8 hour, uint8 minute, bool update_world /*= true*/)
|
||||
{
|
||||
if (worldserver.Connected()) {
|
||||
ServerPacket* pack = new ServerPacket(ServerOP_SetWorldTime, sizeof(eqTimeOfDay));
|
||||
eqTimeOfDay* eqtod = (eqTimeOfDay*)pack->pBuffer;
|
||||
zone_time.getEQTimeOfDay(time(0), &eqtod->start_eqtime);
|
||||
eqtod->start_eqtime.minute=minute;
|
||||
eqtod->start_eqtime.hour=hour;
|
||||
eqtod->start_realtime=time(0);
|
||||
printf("Setting master time on world server to: %d:%d (%d)\n", hour, minute, (int)eqtod->start_realtime);
|
||||
worldserver.SendPacket(pack);
|
||||
eqTimeOfDay* eq_time_of_day = (eqTimeOfDay*)pack->pBuffer;
|
||||
|
||||
zone_time.GetCurrentEQTimeOfDay(time(0), &eq_time_of_day->start_eqtime);
|
||||
|
||||
eq_time_of_day->start_eqtime.minute = minute;
|
||||
eq_time_of_day->start_eqtime.hour = hour;
|
||||
eq_time_of_day->start_realtime = time(0);
|
||||
|
||||
/* By Default we update worlds time, but we can optionally no update world which updates the rest of the zone servers */
|
||||
if (update_world){
|
||||
Log.Out(Logs::General, Logs::Zone_Server, "Setting master time on world server to: %d:%d (%d)\n", hour, minute, (int)eq_time_of_day->start_realtime);
|
||||
worldserver.SendPacket(pack);
|
||||
|
||||
/* Set Time Localization Flag */
|
||||
zone->is_zone_time_localized = false;
|
||||
}
|
||||
/* When we don't update world, we are localizing ourselves, we become disjointed from normal syncs and set time locally */
|
||||
else{
|
||||
|
||||
Log.Out(Logs::General, Logs::Zone_Server, "Setting zone localized time...");
|
||||
|
||||
zone->zone_time.SetCurrentEQTimeOfDay(eq_time_of_day->start_eqtime, eq_time_of_day->start_realtime);
|
||||
EQApplicationPacket* outapp = new EQApplicationPacket(OP_TimeOfDay, sizeof(TimeOfDay_Struct));
|
||||
TimeOfDay_Struct* time_of_day = (TimeOfDay_Struct*)outapp->pBuffer;
|
||||
zone->zone_time.GetCurrentEQTimeOfDay(time(0), time_of_day);
|
||||
entity_list.QueueClients(0, outapp, false);
|
||||
safe_delete(outapp);
|
||||
|
||||
/* Set Time Localization Flag */
|
||||
zone->is_zone_time_localized = true;
|
||||
}
|
||||
|
||||
safe_delete(pack);
|
||||
}
|
||||
}
|
||||
|
||||
11
zone/zone.h
11
zone/zone.h
@ -43,6 +43,7 @@ struct ZonePoint
|
||||
int32 target_zone_instance;
|
||||
uint32 client_version_mask;
|
||||
};
|
||||
|
||||
struct ZoneClientAuth_Struct {
|
||||
uint32 ip; // client's IP address
|
||||
uint32 wid; // client's WorldID#
|
||||
@ -85,6 +86,10 @@ public:
|
||||
|
||||
Zone(uint32 in_zoneid, uint32 in_instanceid, const char* in_short_name);
|
||||
~Zone();
|
||||
|
||||
/* When zone has its own version of time */
|
||||
bool is_zone_time_localized;
|
||||
|
||||
bool Init(bool iStaticZone);
|
||||
bool LoadZoneCFG(const char* filename, uint16 instance_id, bool DontLoadDefault = false);
|
||||
bool SaveZoneCFG();
|
||||
@ -153,7 +158,7 @@ public:
|
||||
inline bool InstantGrids() { return(!initgrids_timer.Enabled()); }
|
||||
void SetStaticZone(bool sz) { staticzone = sz; }
|
||||
inline bool IsStaticZone() { return staticzone; }
|
||||
inline void GotCurTime(bool time) { gottime = time; }
|
||||
inline void SetZoneHasCurrentTime(bool time) { zone_has_current_time = time; }
|
||||
|
||||
void SpawnConditionChanged(const SpawnCondition &c, int16 old_value);
|
||||
|
||||
@ -206,7 +211,7 @@ public:
|
||||
EQTime zone_time;
|
||||
void GetTimeSync();
|
||||
void SetDate(uint16 year, uint8 month, uint8 day, uint8 hour, uint8 minute);
|
||||
void SetTime(uint8 hour, uint8 minute);
|
||||
void SetTime(uint8 hour, uint8 minute, bool update_world = true);
|
||||
|
||||
void weatherSend();
|
||||
bool CanBind() const { return(can_bind); }
|
||||
@ -319,7 +324,7 @@ private:
|
||||
|
||||
|
||||
bool staticzone;
|
||||
bool gottime;
|
||||
bool zone_has_current_time;
|
||||
|
||||
uint32 pQueuedMerchantsWorkID;
|
||||
uint32 pQueuedTempMerchantsWorkID;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user