Page 1 of 1
worldtime
Posted: Wed Oct 04, 2017 8:09 am
by Ememjr
one one those moments again, who do i get world time into zoneserver.cpp (yes i found what unknown5 and and unknown 6 in the zoneinfo struct are
its worldtime.
below is what i tried but it says worldtime is not defined
Code: Select all
packet->setDataByName("year",world_time.year);
packet->setDataByName("month", world_time.month);
packet->setDataByName("day", world_time.day);
packet->setDataByName("hour", world_time.hour);
packet->setDataByName("minute", world_time.minute);
also i was curious on why seconds was not used in game, not importanet intimworld timing i assume was just curious, we can set it to be 0 throughout
it appears based on timeing of the packets gameworldtime and zoneinfo that both have an unknown in the position right after where minute is, that it would be seconds.
i just need the coorect world tiem for the packet
Re: worldtime
Posted: Wed Oct 04, 2017 1:59 pm
by Zcoretri
Did you try and define a variable for world time in zoneserver.cpp?
There is also a function in World that returns a packetstruct for WS_GameWorldTime
Code: Select all
PacketStruct* World::GetWorldTime(int16 version){
PacketStruct* packet = configReader.getStruct("WS_GameWorldTime", version);
if(packet){
packet->setDataByName("year", world_time.year);
packet->setDataByName("month", world_time.month);
packet->setDataByName("day", world_time.day);
packet->setDataByName("hour", world_time.hour);
packet->setDataByName("minute", world_time.minute);
packet->setDataByName("unknown", 250);
packet->setDataByName("unix_time", Timer::GetUnixTimeStamp());
packet->setDataByName("unknown2", 1);
}
return packet;
}
Re: worldtime
Posted: Wed Oct 04, 2017 4:48 pm
by Ememjr
ill try the first, but is that going to create a new variable for world_time, or a ref to the orginal worldtime i need to make sure i am getting the real world time
i saw the Getworldtime, but that sends the packet,
Re: worldtime
Posted: Wed Oct 04, 2017 6:07 pm
by Jabantiz
extern means the variable is already defined elsewhere and to use that. It would basically be the same as including the .h that defines the variable but this way we get just the single variable w want and not every thing else in the .h
Re: worldtime
Posted: Thu Oct 05, 2017 2:02 pm
by Ememjr
i added the extern as zcoreti suggested
but i get the following compile error
worldtime.JPG
Re: worldtime
Posted: Thu Oct 05, 2017 2:43 pm
by Ememjr
hmm apparently worldtime is a struct and not a class, but still dont know how to resolve it
Re: worldtime
Posted: Thu Oct 05, 2017 6:14 pm
by Ememjr
figured it out thanks
Code: Select all
packet->setDataByName("year", world.GetWorldTimeStruct()->year);
packet->setDataByName("month", world.GetWorldTimeStruct()->month);
packet->setDataByName("day", world.GetWorldTimeStruct()->day);
packet->setDataByName("hour", world.GetWorldTimeStruct()->hour);
packet->setDataByName("minute", world.GetWorldTimeStruct()->minute);