Sending Packets

04/15/2011 12:38 dumbfck#196
Quote:
Originally Posted by Smurfin View Post
lol I was asking about resources for ingame chat system like its pointers/offsets/structures not material resources, but thanks anyway.

guess he's busy or not monitoring this thread anymore.
Hope this helps :) [Only registered and activated users can see links. Click Here To Register...]

*Edit: Sorry for spamming the link everywhere btw, but there have been several threads with requests for it, so it kinda keeps the flow going ;)
04/15/2011 15:56 Interest07#197
Quote:
Originally Posted by dumbfck View Post
Hope this helps :) [Only registered and activated users can see links. Click Here To Register...]

*Edit: Sorry for spamming the link everywhere btw, but there have been several threads with requests for it, so it kinda keeps the flow going ;)
I wouldn't worry about it, as long as they're not trojan infested 'dmg hacks' and contain useful info feel free to spam it lol :D

:o I see i promised to dig them up lol, oops :o
04/15/2011 19:52 Smurfin#198
hehe it's ok :D , I was about to resurface the question again though, for auto escaping a boss if he shouts a certain line before it deals crazy dmg.
04/18/2011 20:52 dumbfck#199
Just linking the [Only registered and activated users can see links. Click Here To Register...] here for continuity ^^
05/26/2011 04:59 maniack88#200
how do u record the action actually?

i'm in the making auto follow char.. manually need to double click on name while in pt and it will follow that person..
05/27/2011 11:33 dumbfck#201
If I understand correctly, are you asking how to actually find out what packet data is required for an action? If so, here goes....

Firstly, you need the sendPackets offset... Can find that on [Only registered and activated users can see links. Click Here To Register...], which is currently: 0x653380
So, open up OllyDbg and set a breakpoint at this address. You will find it breaks here at random occasionally - The client sends packets requesting updates for things sometimes, so you have to be ready to hit run in Olly (F9) then very quickly perform the required action in game before you get another false trigger.
So, with that in mind, make sure Olly is running, then do something in game... For this example, I hit the meditate shortkey.
Olly should break, as per picture 1:
[Only registered and activated users can see links. Click Here To Register...]

Assuming all has gone well so far, if you now look in the stack window in Olly, the 2nd and 3rd values from the top are the ones you're interested, as outlined in the above pic.
The 2nd stack value (the top one in my red box) is the address of the packet data that is being sent (address 0x29B60A58). Note that this address changes every time a packet is sent.
Now, right click on this address in the stack and choose 'Follow in dump'.
[Only registered and activated users can see links. Click Here To Register...]

The memory window should now set it's origin at the address we want.
Now, note the 3rd value in the stack (the lower number in the red box on the first picture). This is the size of the packet, i.e., 2 bytes in this case.
So, looking at the memory window:
[Only registered and activated users can see links. Click Here To Register...]

We see the first two bytes are 0x2E, 0x00
If you take a look at the [Only registered and activated users can see links. Click Here To Register...], you can see that this matches with the data packet Interest07 has specified there.

Note that some packets have parametric information too, such as playerId, or NPC / mob / resource IDs, etc. It's up to you to figure that stuff out ;)

Sorted =]

I have a feeling I may have misinterpreted the above question, but hopefully this is useful nonetheless :P
05/27/2011 13:39 mastaro#202
guys what i can do with that codes? please explain me
05/27/2011 13:51 dumbfck#203
Lots of stuff... Read the first post ;)
In a nutshell, most things you do in game result in packets of data being sent to the server, e.g., attacking a mob, initiating a conversation with an NPC, moving items around in your inventory, using items, the list goes on.
Interest's first thread shows the vast majority of these packet 'codes' - I have just added this information to help you find any that are not listed in his original post.
05/27/2011 14:15 Interest07#204
Please note, they're not for 'hacking', but for automating actions such as autopotting or botting.
06/07/2011 07:52 maniack88#205
i tried to make auto follow but it keep on failing.. guess i dont have the skills
06/16/2011 11:21 unfaceguy#206
hi everyone , how to make char fly by using packet ?
thanks
06/16/2011 17:41 burple6#207
To make a character fly using packet, you need the following:
an equipped aerocraft
itemType ID for the currently equipped aerocraft (can be gotten by scanning the equipment inventory, or from [Only registered and activated users can see links. Click Here To Register...] if you know the name of the item, look it up and the itemTypeID will be the number at the end of the resulting URL in your browser e.g. when searching for "Wings of Winged Elves", I got the URL http://www.pwdatabase.com/items/2096, so 2096 is the itemTypeID.
the "equipment inventory index" for the aerocraft (I think it might always be 12)

Then you just send a "useItem" packet with the itemTypeId and the index value, telling it to look in the equipment inventory list (instead of your character's bag).
06/16/2011 21:35 Interest07#208
And to actually move with packets you can do something like this for example:

Code:
        private void moveByPackets(Coordinates destination, PacketMoveType moveType)
        {
            float speed;
            short moveCounter = 0;

            Coordinates currentCoords = new Coordinates(player.coordinates);

            switch (moveType)
            {
                case PacketMoveType.Flying:
                    //Flying
                    speed = player.flySpeed;
                    break;

                case PacketMoveType.Jumping:
                    //Jumping
                    speed = player.runSpeed;
                    break;

                case PacketMoveType.Running:
                    //Running
                    speed = player.runSpeed;
                    break;

                case PacketMoveType.Walking:
                    //Walking
                    speed = player.walkSpeed;
                    break;

                case PacketMoveType.Swimming:
                    //Swimming
                    speed = player.swimSpeed;
                    break;

                default:
                    //Something else
                    Debug.WriteLine("Invalid moveType");
                    speed = player.runSpeed;
                    break;
            }

            short timeInterval = 1000; // in ms

            float timeNeeded = destination.distance(currentCoords) / speed; //time in seconds

            float dX = ((destination.x - currentCoords.x) / timeNeeded) * timeInterval / 1000; //distance in xDirection in 1 second * time traveled
            float dY = ((destination.y - currentCoords.y) / timeNeeded) * timeInterval / 1000; //distance in yDirection in 1 second * time traveled
            float dZ = ((destination.z - currentCoords.z) / timeNeeded) * timeInterval / 1000; //distance in zDirection in 1 second * time traveled

            if (speed > 0)
            {
                while (timeNeeded > (float)timeInterval / 1000)
                {
                    moveCounter = player.moveCounter;
                    currentCoords.x += dX;
                    currentCoords.y += dY;
                    currentCoords.z += dZ;

                    sendPacket.move(currentCoords.x, currentCoords.y, currentCoords.z, timeInterval, speed, (byte)moveType, moveCounter);

                    player.coordinates = currentCoords;
                    player.coordinates2 = currentCoords;
                    player.coordinates3 = currentCoords;
                    player.coordinates4 = currentCoords;

                    moveCounter++;
                    player.moveCounter = moveCounter;

                    timeNeeded -= (float)timeInterval / 1000;
                    Thread.Sleep(timeInterval);
                }

                if (timeNeeded > 0)
                {
                    moveCounter = player.moveCounter;
                    currentCoords.x += dX * timeNeeded;
                    currentCoords.y += dY * timeNeeded;
                    currentCoords.z += dZ * timeNeeded;

                    sendPacket.moveStop(currentCoords.x, currentCoords.y, currentCoords.z, (short)(timeNeeded * 1000), speed, (byte)moveType, moveCounter, 0);

                    player.coordinates = currentCoords;
                    player.coordinates2 = currentCoords;
                    player.coordinates3 = currentCoords;
                    player.coordinates4 = currentCoords;

                    moveCounter++;
                    player.moveCounter = moveCounter;
                }
            }
        }

Code:
        private int moveAddress;
        private byte[] moveAddressRev;

        private byte[] movePkt = new byte[] 
        { 
            0x00, 0x00,                 //Header
            0x00, 0x00, 0x00, 0x00,      //x coord
            0x00, 0x00, 0x00, 0x00,      //y coord
            0x00, 0x00, 0x00, 0x00,      //z coord
            0x00, 0x00, 0x00, 0x00,      //x coord
            0x00, 0x00, 0x00, 0x00,      //y coord
            0x00, 0x00, 0x00, 0x00,       //z coord
            0x00, 0x00,                 //interval
            0x00, 0x00,                 //speed
            0x00,                       //moveType
            0x00, 0x00                  //counter

        };

        public void move(float xCoord, float yCoord, float zCoord, short interval, float speed, byte moveType, short moveCounter)
        {
            //Get size of the packet
            int packetSize = movePkt.Length;

            if (moveAddress == 0)
            {
                //load packet in memory
                loadPacket(movePkt, ref moveAddress, ref moveAddressRev);
            }

            byte[] xCoordRev = BitConverter.GetBytes(xCoord);
            xCoordRev.Reverse();
            MemFunctions.MemWriteBytes(pr_processHandle, moveAddress + 2, xCoordRev);
            MemFunctions.MemWriteBytes(pr_processHandle, moveAddress + 14, xCoordRev);

            byte[] yCoordRev = BitConverter.GetBytes(yCoord);
            yCoordRev.Reverse();
            MemFunctions.MemWriteBytes(pr_processHandle, moveAddress + 6, yCoordRev);
            MemFunctions.MemWriteBytes(pr_processHandle, moveAddress + 18, yCoordRev);

            byte[] zCoordRev = BitConverter.GetBytes(zCoord);
            zCoordRev.Reverse();
            MemFunctions.MemWriteBytes(pr_processHandle, moveAddress + 10, zCoordRev);
            MemFunctions.MemWriteBytes(pr_processHandle, moveAddress + 22, zCoordRev);

            byte[] intervalRev = BitConverter.GetBytes(interval);
            intervalRev.Reverse();
            MemFunctions.MemWriteBytes(pr_processHandle, moveAddress + 26, intervalRev);

            short shortSpeed = (short)(speed * 256 + 0.5);
            byte[] shortSpeedRev = BitConverter.GetBytes(shortSpeed);
            shortSpeedRev.Reverse();
            MemFunctions.MemWriteBytes(pr_processHandle, moveAddress + 28, shortSpeedRev);

            MemFunctions.MemWriteByte(pr_processHandle, moveAddress + 30, moveType);

            byte[] moveCounterRev = BitConverter.GetBytes(moveCounter);
            moveCounterRev.Reverse();
            MemFunctions.MemWriteBytes(pr_processHandle, moveAddress + 31, moveCounterRev);

            sendPacket(moveAddressRev, packetSize);
        }
You don't actually need to reverse the bytes etcetera, but I had already written the code before I realised that and couldnt be bothered to fix it :p
06/18/2011 16:53 roflmfaoo#209
How do you find the move address ?
06/18/2011 18:35 Interest07#210
Quote:
Originally Posted by roflmfaoo View Post
How do you find the move address ?
Check the post in this thread where I explained how to send packets with C#. The moveAddress is just an address with enough memory allocated in the client to store your packet. You don't need to find this address as it is returned by the MemFunctions.AllocateMemory function.