worldtime

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

worldtime

Post by Ememjr » Wed Oct 04, 2017 8:09 am

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

User avatar
Zcoretri
Team Member
Posts: 1642
Joined: Fri Jul 27, 2007 12:55 pm
Location: SoCal

Re: worldtime

Post by Zcoretri » Wed Oct 04, 2017 1:59 pm

Did you try and define a variable for world time in zoneserver.cpp?

Code: Select all

extern WorldTime world_time;
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;
}

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: worldtime

Post by Ememjr » Wed Oct 04, 2017 4:48 pm

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,

Jabantiz
Lead Developer
Posts: 2912
Joined: Wed Jul 25, 2007 2:52 pm
Location: California

Re: worldtime

Post by Jabantiz » Wed Oct 04, 2017 6:07 pm

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

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: worldtime

Post by Ememjr » Thu Oct 05, 2017 2:02 pm

i added the extern as zcoreti suggested

Code: Select all

extern WorldTime world_time;
but i get the following compile error
worldtime.JPG
You do not have the required permissions to view the files attached to this post.

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: worldtime

Post by Ememjr » Thu Oct 05, 2017 2:43 pm

hmm apparently worldtime is a struct and not a class, but still dont know how to resolve it

User avatar
Ememjr
Team Member
Posts: 975
Joined: Wed Mar 15, 2017 9:41 am
EQ2Emu Server: Perseverance

Re: worldtime

Post by Ememjr » Thu Oct 05, 2017 6:14 pm

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);

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest