Register for your free account! | Forgot your password?

You last visited: Today at 21:49

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Time packet

Discussion on Time packet within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2009
Posts: 259
Received Thanks: 159
Time packet

Does anyone know what's the problem with time packet on 5017?




Code:
public static Packet CreateServerTime(this Packet stream, DateTime Time)
       {
           stream.InitWriter();
           stream.Write(0);//type //int
           stream.Write(Time.Year - 1900);//int
           stream.Write(Time.Month - 1);//int
           stream.Write(Time.DayOfYear);//int
           stream.Write(Time.Day);//int
           stream.Write(Time.Hour);//int
           stream.Write(Time.Minute);//int
           stream.Write(Time.Second);//int
           stream.Finalize((ushort)NetPacketTypes._MSG_ServerTime);
           return stream;
       }
5017 don't accept time packet?
teroareboss1 is offline  
Old 07/23/2018, 19:42   #2
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,211
Received Thanks: 4,114
Can you provide a hex dump of the finalized packet? Also, what happens when you explicitly cast those time values to 32-bit integers?
Spirited is offline  
Thanks
1 User
Old 07/28/2018, 09:14   #3
 
elite*gold: 67
Join Date: Aug 2014
Posts: 1,321
Received Thanks: 927
Never got time working on 5017 either. Just posting here to get notified
Xio. is offline  
Thanks
1 User
Old 07/28/2018, 19:52   #4
 
elite*gold: 0
Join Date: Feb 2009
Posts: 259
Received Thanks: 159
Quote:
Originally Posted by Xio. View Post
Never got time working on 5017 either. Just posting here to get notified
I managed to fix time with a hook. I only posted here maybe someone knew a solution to save some time.
#Closed
teroareboss1 is offline  
Old 07/28/2018, 20:08   #5
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,211
Received Thanks: 4,114
Quote:
Originally Posted by teroareboss1 View Post
I managed to fix time with a hook. I only posted here maybe someone knew a solution to save some time.
#Closed
A hook? So you're saying that patch 5017 doesn't support the time packet? Also, that could be a helpful bit of code to post here rather than it dying off with the community. We've lost a lot of collected knowledge from developers just leaving and not documenting anything they've discovered. I could make a client hook snippets section of my wiki if you'd like to contribute.
Spirited is offline  
Old 07/28/2018, 20:38   #6
 
elite*gold: 0
Join Date: Feb 2009
Posts: 259
Received Thanks: 159
Quote:
Originally Posted by Spirited View Post
A hook? So you're saying that patch 5017 doesn't support the time packet? Also, that could be a helpful bit of code to post here rather than it dying off with the community. We've lost a lot of collected knowledge from developers just leaving and not documenting anything they've discovered. I could make a client hook snippets section of my wiki if you'd like to contribute.
I dont know if is working or not but i remembered that they use sprintf for this string.
teroareboss1 is offline  
Old 07/28/2018, 20:44   #7
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,211
Received Thanks: 4,114
Quote:
Originally Posted by teroareboss1 View Post
I dont know if is working or not but i remembered that they use sprintf for this string.
Oh, I see how you did that now. No worries then. If you'd like to share the code, then great, but that one seems simple enough with a hint. Are you sure it doesn't support the time packet though? Do any other 5017 sources implement it maybe?
Spirited is offline  
Old 07/28/2018, 21:39   #8
 
elite*gold: 0
Join Date: Feb 2009
Posts: 259
Received Thanks: 159
Quote:
Originally Posted by Spirited View Post
Oh, I see how you did that now. No worries then. If you'd like to share the code, then great, but that one seems simple enough with a hint. Are you sure it doesn't support the time packet though? Do any other 5017 sources implement it maybe?
I dont know if "Time packet" is working or not

Code:
char StrFormat[] = { "[%s] (%03d,%03d) Ping: %04d; Fps: %02d; Time: %02d:%02d, %s" };
Code:
int  my_sprintf(char *buffer, char *format, ...)
{
    va_list args;
    va_start(args, format);

    if(!strcmp(StrFormat,format))
    {

        /*char* ServerName = va_arg(args, PCHAR);
        int x = va_arg(args, int);
        int y = va_arg(args, int);

       //TO DO
       */
    }
    return vsprintf(buffer, format, args);
}
hook msvcrt.dll , function-> sprintf

well.... you can compare just first 10 bytes...
teroareboss1 is offline  
Old 07/28/2018, 22:22   #9
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,211
Received Thanks: 4,114
Hm. That seems to be a bit of a naive approach, looking for a value rather than a key, but if it works then it works. I looked into other 5017 sources just to be sure that time packet (packet 1033) really isn't implemented anywhere, but I found one that does implement it:

Code:
DateTime Now = DateTime.Now.ToLocalTime();
byte[] buffer = new byte[36];
fixed (byte* Packet = buffer)
{
	*((ushort*)(Packet)) = (ushort)(36);
	*((ushort*)(Packet + 2)) = 1033;
	*((uint*)(Packet + 8)) = (uint)(Now.Year - 1900);
	*((uint*)(Packet + 12)) = (uint)(Now.Month - 1);
	*((uint*)(Packet + 16)) = (uint)Now.DayOfYear;
	*((uint*)(Packet + 20)) = (uint)Now.Day;
	*((uint*)(Packet + 24)) = (uint)Now.Hour;
	*((uint*)(Packet + 28)) = (uint)Now.Minute;
	*((uint*)(Packet + 32)) = (uint)Now.Second;
}
return buffer;
Could be that the source incorrectly assumes the time packet exists on this patch.
Spirited is offline  
Old 07/28/2018, 22:48   #10


 
CptSky's Avatar
 
elite*gold: 0
Join Date: Jan 2008
Posts: 1,434
Received Thanks: 1,147
As far as I know, the client 5017 doesn't support the time packet.
CptSky is offline  
Thanks
1 User
Reply


Similar Threads Similar Threads
[Help] Weather Packet (My First Packet)
06/07/2014 - CO2 Private Server - 95 Replies
delete this thread.
Understanding the Packet System - Basics of a Packet explained
11/03/2012 - Cabal Online - 30 Replies
Read the advice first... *****************UPDATED 12/11/2011********************************* **** ADDED VB6 PROXY BOT SOURCE-CODE, WORKING EXAMPLE OF PROXY BOT****** ************************************************* ***************** The following CONSTANTS have been flagged, this means they appear in EVERY Packet exchange from client to server and server to client Red = Packet Id - Each packet has a unique ID number, in this case AA02, Each Packet id Relates to a specific...
[Request] Packet Structure for CharData Packet
05/16/2011 - Silkroad Online - 4 Replies
can someone tell me which structure the CharData packet has? i would really appreciate this, since im still noob in such things. its just too high for me/ too much information for my head. :handsdown: S->C(3013)...
[Question] Packet data , packet editing ??
10/13/2009 - 9Dragons - 2 Replies
I would like to know : What is packet data? How do i get the address for hacking a item in game? How to use it ??



All times are GMT +2. The time now is 21:49.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.