Thread: Change how long it takes to send logout-packet.

Results 1 to 9 of 9
  1. #1 Change how long it takes to send logout-packet. 
    Registered Member
    PSNB's Avatar
    Join Date
    Aug 2009
    Posts
    886
    Thanks given
    8
    Thanks received
    103
    Rep Power
    590
    [I posted this on another forum a few minutes ago]

    I'm still new to clients, so excuse me if this is well known.

    In private servers, packets are sent from the Client, and received by the Server. Each packet is sent if an event occurred to trigger it. [Clicking an object, Clicking an item, Pressing a button, etc.]

    The logout packet [Number 202] is triggered after the client is idle for a certain time period.

    The Integer that controls if the Client should or shouldn't send the packet can be located at [Applet_Sub1 : anInt18]

    Whenever the player clicks on the screen, or presses any keys, this value is reset back to 0. If nothing is happening, this number will constantly increment by a value of 1.

    Once this number reaches the limit, the packet is triggered, and the server disconnects the player.

    Now, editing the timer is an extremely simple process and only requires you to edit a single value.

    Open your Client class and search for

    Code:
    super.anInt18++;
    This simply states that when this line is read, the value of 'anInt18' is incremented by 1.

    Below that, you should see an if statement.

    Code:
    if(super.anInt18 > 4500) {
    	anInt1011 = 250;
    	super.anInt18 -= 500;
    	aClass30_Sub2_Sub2_1192.method397((byte)6, 202);
    }
    I'm not sure what the integer in the first line is supposed to represent, but I'll explain the other two.

    The second line simply creates a 'buffer-zone'' in a sense. It decreases the value of anInt18 by 500 so the Client has
    time to process the packet, send it, and receive the response from the server.

    The third line actually sends the information. The first variable is the size of the packet, while the second is the packet's ID. This is the information that's passed onto the server to process.

    As it should be pretty obvious what you do to change how long it takes to send this packet by now, but I'll explain anyway.

    The code will only be executed if the conditions (In this case: super.anInt18 having a value of over 4500) are met. We need to edit the value '4500' to a different value. I'm not sure if there's really an 'exact' time period that this value represents, because anInt18 increments using a loop, rather than a given time period.

    I believe that the loop time is about one-hundredth of a second [0.01 seconds]. Put simply, change the value to the amount of seconds you wish to be idle before the packet sends, and place two 0's after it.
    Reply With Quote  
     

  2. #2  
     

    Vastiko's Avatar
    Join Date
    Dec 2006
    Posts
    5,700
    Thanks given
    300
    Thanks received
    660
    Discord
    View profile
    Rep Power
    5000
    Goodjob on your first tutorial!

    You explained it very well and I look forward to more
    Reply With Quote  
     

  3. #3  
    Respected Member


    Luke132's Avatar
    Join Date
    Dec 2007
    Age
    32
    Posts
    12,549
    Thanks given
    177
    Thanks received
    5,784
    Discord
    View profile
    Rep Power
    5000
    anInt18 is obviously a variable representing something such as 'lastGameAction' or something along those lines, since it resets whenever you do anything ingame.

    Reply With Quote  
     

  4. #4  
    Registered Member
    PSNB's Avatar
    Join Date
    Aug 2009
    Posts
    886
    Thanks given
    8
    Thanks received
    103
    Rep Power
    590
    Quote Originally Posted by Luke132 View Post
    anInt18 is obviously a variable representing something such as 'lastGameAction' or something along those lines, since it resets whenever you do anything ingame.
    Yes, but for people with 'normal' clients, if I just started saying that, it'd be confusing to them. I personally renamed it to 'idleTimer'.
    Reply With Quote  
     

  5. #5  
    Member Market Banned Market Banned

    Zee Best's Avatar
    Join Date
    Feb 2007
    Age
    29
    Posts
    3,036
    Thanks given
    24
    Thanks received
    210
    Rep Power
    1171
    In private servers, packets are sent from the Client, and received by the Server. Each packet is sent if an event occurred to trigger it. [Clicking an object, Clicking an item, Pressing a button, etc.]
    The server also sends packets to the client.


    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    May 2009
    Posts
    55
    Thanks given
    0
    Thanks received
    0
    Rep Power
    13
    This is...sexy. Thank you for actually explaining us how to do, and not only explaining what to do. rep++
    Reply With Quote  
     

  7. #7  
    Registered Member
    PSNB's Avatar
    Join Date
    Aug 2009
    Posts
    886
    Thanks given
    8
    Thanks received
    103
    Rep Power
    590
    Quote Originally Posted by Zee best View Post
    The server also sends packets to the client.
    Well, yes, in a sense. It sends frames and writes information back to the client, if that's your meaning. However, this tutorial was simply meant to discuss when and how packet 202 is sent, and getting into the rest of that would simply be too much, and irrelevant to the tutorial at hand.
    Reply With Quote  
     

  8. #8  
    Registered Member
    Shamcooly's Avatar
    Join Date
    Apr 2008
    Age
    27
    Posts
    1,222
    Thanks given
    36
    Thanks received
    8
    Rep Power
    620
    Wow great tutorial, you seem to know a lot about java. I never knew about this, repped.
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  9. #9  
    Registered Member
    PSNB's Avatar
    Join Date
    Aug 2009
    Posts
    886
    Thanks given
    8
    Thanks received
    103
    Rep Power
    590
    Quote Originally Posted by shamcooly View Post
    Wow great tutorial, you seem to know a lot about java. I never knew about this, repped.
    You don't really need to know 'much' about java in order to do this, I just started doing client programming and started snooping around. I noticed the value always got reset to 0 when something happened so I only assumed it had to do with how long you've been idle. So I looked through a few files until I found a call to it, and saw it was packet 202, which I recognized immediately as the logout packet. Thank you for the compliment though , hehe.
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •