Thread: Packet 241

Results 1 to 9 of 9
  1. #1 Packet 241 
    Registered Member
    Join Date
    Oct 2012
    Posts
    205
    Thanks given
    10
    Thanks received
    17
    Rep Power
    30
    How can I use packet 241 (mouse clicking) to get the coordinates where I click on screen? Is this even possible or does it just get the position of the mouse etc.
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Oct 2008
    Posts
    369
    Thanks given
    15
    Thanks received
    18
    Rep Power
    81
    What are you trying to find, the mouse position coordinates or the coordinates in game.


    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Oct 2012
    Posts
    205
    Thanks given
    10
    Thanks received
    17
    Rep Power
    30
    Quote Originally Posted by F R 0 0 B View Post
    What are you trying to find, the mouse position coordinates or the coordinates in game.
    Coordinates in game.
    Reply With Quote  
     

  4. #4  
    q.q


    Join Date
    Dec 2010
    Posts
    6,519
    Thanks given
    1,072
    Thanks received
    3,535
    Rep Power
    4752
    Code:
    	out.putOpCode(241);
    			out.writeDWord((clickTime << 20) + (buttonPressed << 19) + clickPos);
    is the packet

    so you'd read an int server side then do something like

    int shiftedData = readInt();
    int clickTime = shiftedData >> 20;
    int buttonPressed = shiftedData >> 19;
    int clickPos = shiftedData & 0x12;

    then you gotta do some other stuff for click pos

    (i think my bit shifting is correct
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Oct 2012
    Posts
    205
    Thanks given
    10
    Thanks received
    17
    Rep Power
    30
    Quote Originally Posted by Harlan View Post
    Code:
    	out.putOpCode(241);
    			out.writeDWord((clickTime << 20) + (buttonPressed << 19) + clickPos);
    is the packet

    so you'd read an int server side then do something like

    int shiftedData = readInt();
    int clickTime = shiftedData >> 20;
    int buttonPressed = shiftedData >> 19;
    int clickPos = shiftedData & 0x12;

    then you gotta do some other stuff for click pos

    (i think my bit shifting is correct
    The position is all I'm after at the moment, and even using that, it's still not accurate
    Reply With Quote  
     

  6. #6  
    q.q


    Join Date
    Dec 2010
    Posts
    6,519
    Thanks given
    1,072
    Thanks received
    3,535
    Rep Power
    4752
    Quote Originally Posted by ohokay View Post
    The position is all I'm after at the moment, and even using that, it's still not accurate
    int clickPos = mouseX * 765 + mouseY;


    ye that's click pos, idk how you're meant to get anything from that...
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Oct 2012
    Posts
    205
    Thanks given
    10
    Thanks received
    17
    Rep Power
    30
    Hmm so is this packet purely for screen clicks and I'm not able to get the in game coordinates by using this?
    Reply With Quote  
     

  8. #8  
    q.q


    Join Date
    Dec 2010
    Posts
    6,519
    Thanks given
    1,072
    Thanks received
    3,535
    Rep Power
    4752
    packet 45 tells you about mouse movements that should be illegal

    Code:
    out.putOpCode(45);
    					out.write1Byte(0);
    					int prePos = out.pos;
    					int mousePositionsUsed = 0;
    					for(int mousePointPtr = 0; mousePointPtr < mouseDetection.coordsIndex; mousePointPtr++)
    					{
    						if(prePos - out.pos >= 240)
    							break;
    						mousePositionsUsed++;
    						int mouseY = mouseDetection.coordsY[mousePointPtr];
    						if(mouseY < 0)
    							mouseY = 0;
    						else
    							if(mouseY > 502)
    								mouseY = 502;
    						int mouseX = mouseDetection.coordsX[mousePointPtr];
    						if(mouseX < 0)
    							mouseX = 0;
    						else
    							if(mouseX > 764)
    								mouseX = 764;
    						int mousePos = mouseY * 765 + mouseX;
    						if(mouseDetection.coordsY[mousePointPtr] == -1 && mouseDetection.coordsX[mousePointPtr] == -1)
    						{
    							mouseX = -1;
    							mouseY = -1;
    							mousePos = 0x7ffff;
    						}
    						if(mouseX == lastMouseX && mouseY == lastMouseY)
    						{
    							if(mouseMovements < 2047)
    								mouseMovements++;
    						} else
    						{
    							int mouseXDifference = mouseX - lastMouseX;
    							lastMouseX = mouseX;
    							int mouseYDifference = mouseY - lastMouseY;
    							lastMouseY = mouseY;
    							if(mouseMovements < 8 && mouseXDifference >= -32 && mouseXDifference <= 31 && mouseYDifference >= -32 && mouseYDifference <= 31)
    							{
    								mouseXDifference += 32;
    								mouseYDifference += 32;
    								out.writeWord((mouseMovements << 12) + (mouseXDifference << 6) + mouseYDifference);
    								mouseMovements = 0;
    							} else
    								if(mouseMovements < 8)
    								{
    									out.writeDWordBigEndian(0x800000 + (mouseMovements << 19) + mousePos);
    									mouseMovements = 0;
    								} else
    								{
    									out.writeDWord(0xc0000000 + (mouseMovements << 19) + mousePos);
    									mouseMovements = 0;
    								}
    						}
    					}
    
    					out.writeBytes(out.pos - prePos);
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Oct 2012
    Posts
    205
    Thanks given
    10
    Thanks received
    17
    Rep Power
    30
    I've found a way of doing it now. Thanks for your help though.
    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

Similar Threads

  1. Duel Packet / Following Packet
    By RSX_ in forum Help
    Replies: 0
    Last Post: 06-02-2011, 03:11 PM
  2. Z508 - Packet 199, Packet Size.
    By Dexter Morgan in forum Help
    Replies: 4
    Last Post: 12-22-2009, 02:37 PM
  3. Packet Streams for Packet 33
    By Armo in forum Help
    Replies: 2
    Last Post: 08-30-2009, 01:22 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •