Warrock - Code Snippets

03/18/2013 21:03 Raz9r#826
[Only registered and activated users can see links. Click Here To Register...] Basic tutorial. Getting to know pointer arithmetics well is like the alpha and omega of gamehacking...
03/22/2013 09:20 st3adcaptain#827
#Request MEM_Artillery Source Non ASM and For NoMenu Advance thanks :)
03/27/2013 19:07 ArtaXXerXes#828
schönen guten tag, ich wollte hier mal einiges kleine fragen stellen, ich bin neu hier und wollte mal einfach so run um die standart codes was fragen
also die anz normale quickplant funktion ist ja diese hier ... mal einige fragen wie die source funktionierz,
*(float*)MEM_QUICKPLANT = 200.0F

wenn irgentwas nicht stimmt bitte berichtigen, ich will es nur so für mich wissen :D

* = öffnet die Adresse QUICKPLANT als Zeiger bzw verweist darauf
(float*) = als float typ öffnen ?!?
QUICKPLANT (0xXXXXX)= Die Adresse von der Variable die die plant zeit speichert
(bzw warum ist wr so blöd und speichert das in einer Variable ?!)
= 200.0F = verändert den Wert auf 200 , aber was hat 200 mit der geschwindigkeit zu tun ? 200 ms ?

so und dann noch die frage zur addresse, bei jedem start ändert sich doch die adresse jeder einzellnen variable ? aber hier scheinen sie alle gleich zu bleiben wieso und warum?
oder denk ich hier komplett in eine flasche richtig ? :D

und dann gibt es noch solche sourcen
*(float*)(PlayerPointer+ OFS_Z)=1000;

da wird ja die playerpounter adresse (angenommen 0x01) und ofs_z (angenommen 0x03) addiert zu 0x04 ... also wird die höhe bei 0x04 bestimmt nicht 0x03 oder ? :D also warum nciht gleich 0x04? :DDD
bitte helft mir ich check da nicht durch :DDD
03/27/2013 22:55 xRoute66x#829
Quote:
Originally Posted by ArtaXXerXes View Post
so und dann noch die frage zur addresse, bei jedem start ändert sich doch die adresse jeder einzellnen variable ? aber hier scheinen sie alle gleich zu bleiben wieso und warum?
Die Adressen der lokalen Variablen veränern sich und die Adressen den globalen bleiben gleich, so war des glaub ich :)
03/27/2013 23:34 Tibolus_#830
Quote:
Originally Posted by xroute66x™ :) View Post
Die Adressen der lokalen Variablen veränern sich und die Adressen den globalen bleiben gleich, so war des glaub ich :)
habs grade getestet :) also bei bei meinem programm hat sich die addy von ner globalen variable auch geändert :D muss sie ja auch weil man nciht sicher gehen kann das auf jedem pc auf der gleichen stelle nur was für wr reserviert ist :D

hier teste es selbst ;)

Code:
int itr=2000;
int main()
{	
	int *ptr;
	ptr=&itr;
	cout<<ptr<<endl;
	system("PAUSE");
}
03/27/2013 23:51 theitfan1337#831
Quote:
Originally Posted by ArtaXXerXes View Post
(bzw warum ist wr so blöd und speichert das in einer Variable ?!)
Sind das Hängos, wer speichert schon Werte in Variablen :rolleyes:

Quote:
Originally Posted by xroute66x™ :) View Post
Die Adressen der lokalen Variablen veränern sich und die Adressen den globalen bleiben gleich, so war des glaub ich :)
Variable (Programmierung) ? Wikipedia
03/28/2013 00:16 +Yazzn#832
Gültigkeitsbereiche sind pöse Purchen! :-(
03/30/2013 22:52 [N]oSoul#833
#request Stamina for 32bit users.
03/30/2013 23:48 Cyno™#834
Open your Debugger and find a Way to Manipulate the Values otherwise.
Take a Look at the References of the Public Stamina addreses
WarRock is so retarded !
03/31/2013 16:18 Raz9r#835
Quote:
Originally Posted by xroute66x™ :) View Post
Die Adressen der lokalen Variablen veränern sich und die Adressen den globalen bleiben gleich, so war des glaub ich :)
Nichtstatische lokale Variablen werden auf dem Stack alloziert, wenn sie nicht explizit mit new oder new[] auf dem Heap alloziert werden und damit auf dem Heap landen. In beiden Fällen sind die Adressen nur innerhalb des Gültigkeitsbereiches konstant, wobei Variablen auf dem Stack immer mit einem Offset zu ESP (Extended Stack Pointer) dargestellt werden können.

Globale Variablen und lokale statische Variablen haben eine konstante Adresse.

Globale statische Variablen werden vom Linker in jeder "Translation Unit" in der sie vorkommen neu instanziert und erhalten damit für jede *.c/*.cc/*.cpp/*.cxx Datei, in der sie vorkommen, eine neue Adresse.
04/01/2013 17:13 Sleutel#836
Here is my effort for this thread.

I have written a Java WarRock private server packet handler and now I'm going to release it here. This are functions to decode incoming packets from the log-in server.

Everything is explained inside the code, I want to encourage you guys to start learning to understand servers instead of requesting help with old and bugged server files. It isn't hard once you understand it. However, don't ask me help if you don't know a program language or how to use sockets because I amuse you do.

If you want to make your own server and you don't have any knowledge, well start by learning a program language, focus then on socket programming an networking. (I started by a simple chat program in Visual Basic 6).

Now let us get back on topic, here are the classes and functions I used.
I used 2 functions to decode and handle the packet, the packet parsing is done by a different class.

void processPackets():
Code:
    public boolean processPackets() {
        try {
            // Check if the player is disconnected.
            if (disconnected) { return false; }
            // Checking if the inputstream is valid.
            if (inStream == null) { return false; }
            // Reading input stream and checking if its available.
            if (inStream.available() == 0) { return false; }
            // Reading packet buffers from the network stream.
            int byteLen = inStream.read(this.packetBuffer);
            if (byteLen > 1) {
                // Seting-up a new temporary buffer for parsing the packet string later.
                byte[] packetData = new byte[byteLen];
                // Start of the packet decoding with the xOr keys of the client.
                // the xOr keys can change, this is made for the login server (Nexon).
                // Client -> Server (0xC3)
                for (int i = 0; i < byteLen; i++) {
                    packetData[i] = (byte)(packetBuffer[i] ^ 0xC3);
                }
                // Convert the bytes array into a string with UTF8 encoding for processing it.
                // TODO: Split the packets for stacked packets due the delay of it.
                String packet = new String(packetData, "UTF8");
                System.out.println("[BYTES RECV] >>" + packet); // Debug print.
                // Parse the packet with the decoder.
                PacketDecoder decoder = new PacketDecoder(packet);
                // Handle the packet and check if it was a valid one.
                return handlePacket(decoder);
            }else{
                // Packet bytes are way to short, disconnecting!
                disconnect();
                return false;
            }
        }catch (Exception e) {
            // An exception occured, print print an error message and disconnect.
            System.out.println("Failed to process the packet(s).");
            disconnect();
            return false;
        }
    }
boolean handlePacket():
Code:
    private boolean handlePacket(PacketDecoder d) {
        try {
            // Validate the packet decoder class, if its null just return false, 
            // we let the loop know there was no packet handeld.
            if (d == null) { return false; }
            // Check the packet Id we are going to process.
            switch (d.getId()) {
                case 4352: { // Login request packet
                    //TODO: Write this function by yourself and handle it :)
                    break;
                }
                default: {
                    // We received a unknown packet.
                    System.out.println("Received a unknown packet id:" + d.getId());
                    System.out.println("Packet: " + d.getOriginalPacket());
                    break;
                }
            }
            return true;
        }catch (Exception e) {
            // An exception occured while processing a packet, nothing bad happend so just display a message.
            System.out.println("An exception occured while processing a packet!");
            return false;
        }
    }
PacketDecoder.java:
Code:
public class PacketDecoder {
    private long timeStamp;
    private int packetId;
    private String[] packetBlocks;
    private String packetString;
    
    public PacketDecoder(String packet) {
        // We need to remember the original packet.
        packetString = packet;
        // Split the packet into blocks with their seperator (the space character).
        String[] packetArgs = packet.split(" ");
        // The first block(0) is the timestamp of the packet, we convert it into a long variable.
        timeStamp = Long.parseLong(packetArgs[0]);
        // The second block(1) is the packetid, it is a heximal value but for now we are going to use an int.
        packetId = Integer.parseInt(packetArgs[1]);
        // The rest of the blocks are the packet data.
        // We are going to store the blocks in order, we move the blocks from 2 to the first place in the new block array.
        // We continue this step until we reach the end of the splitted packet arguments.
        packetBlocks = new String[packet.length() - 2];
        for (int i = 2; i < packet.length(); i ++) {
            packetBlocks[i-2] = packetArgs[i];
        }
        // The packet has been parsed into the class :)
    }
    
    // Return the timestamp.
    public long getTimestamp() {
        return this.timeStamp;
    }
    
    // Return the ID.
    public int getId() {
        return this.packetId;
    }
    
    // Return all datablocks as an array.
    public String[] getAllBlocks() {
        return this.packetBlocks;
    }
    
    // Return the original packet.
    public String getOriginalPacket() {
        return this.packetString;
    }
}
Have fun with this code! I hope to see less people asking for help.
04/02/2013 00:46 Nullpointer1337#837
Sleutel, please... Post real code and not this crap. You commented everything: fine. But thats not the only aspect of good programming... :o

Lets set some rules for handling WarRock Packets (as Server)
- Use events (as example: receive warrock packet)
- Distinguish Incomming and Outgoing packets (Incomming for getting blocks, Outgoing for adding more)
- Use Packet Reader and PacketWriter (you can also send multiple packets at same time)
- Packet Reader should have an internal "overlapping" buffer, because some packets are too big (multiple TCP packets). so you have to wait until next \n (means that a warrock packet ends)
- Replace 0x20 characters with 0x1D (0x20 is a space, common character used in room names as example). But 0x20 is a delimiter for blocks.

Here is a whole example (i've been using these classes for a long time):
[Only registered and activated users can see links. Click Here To Register...]

Btw
Quote:
Originally Posted by __underScore View Post
ESP (Extended Stack Pointer)
Wusste gar nicht dass das E für Extended steht, hast echt ahnung (find bei google nix)
Kannst ja mal so ne Register übersicht machen, das wäre echt nice und würde mir helfen :)
Ich find dazu wie gesagt nicht wirklich was bei Google... :/
04/02/2013 00:57 Sleutel#838
Thanks for posting nullpointer :)

Edit: Well, this is just an easy way to explain everything. You can also do it the hard way like you :)
04/02/2013 20:08 Spe@ker#839
Search: GlassWalls
04/02/2013 21:11 Raz9r#840
Quote:
Originally Posted by Nullpointer1337 View Post
Kannst ja mal so ne Register übersicht machen, das wäre echt nice und würde mir helfen :)
Ich find dazu wie gesagt nicht wirklich was bei Google... :/
Zwei Minuten googlen bringen das hier zutage:
Code:
EAX - Accumulator Register
EBX - Base Register
ECX - Counter Register
EDX - Data Register
ESI - Source Index
EDI - Destination Index
EBP - Base Pointer
ESP - Stack Pointer
Und außerdem: [Only registered and activated users can see links. Click Here To Register...] ;-)