[PHP Class] ADT Editor I

I believe this has ever been made before, so that’s why is funny!
My idea it’s to make a PHP Class that can change some values from ADT files.
For example, i want to change all Z values from “MDX” and “WMO” and change it + 10 from the original value.
It’s like Snobaste’s Offsetz.cpp but made in PHP.

So first let’s see the documentation about ADT files in WoW.Dev. First thing we must to do it’s open the ADT that we want to edit in reading/binary mode.

$ADT_File = "Azeroth_32_43.adt";
if(($ADT_Handle = fopen($ADT_File, "rb")) === FALSE){ 
    die("CAN'T Openn the filez ._ ."); 
}

Seek the pointer to the header struct and get the pointer for each chunk, We need convert binary to hexadecimal, because PHP doesn’t works very well with datatypes

//===================================
//Navegacion a la cabecera y obtencion de offsets
//===================================
 
    fseek($ADT_Handle,0x1c,SEEK_SET); //Header Chunk
    //Convertir to little endian
    $STRUCT_INFO["0"] = "HEADER";
    $STRUCT_INFO["MTEX_Offset"] = bin2hex(fread($ADT_Handle,4));
    $STRUCT_INFO["MMDX_Offset"] = bin2hex(fread($ADT_Handle,4));
    $STRUCT_INFO["MMID_Offset"] = bin2hex(fread($ADT_Handle,4));
    $STRUCT_INFO["MWMO_Offset"] = bin2hex(fread($ADT_Handle,4));
    $STRUCT_INFO["MWID_Offset"] = bin2hex(fread($ADT_Handle,4));
    $STRUCT_INFO["MDDF_Offset"] = bin2hex(fread($ADT_Handle,4));
    $STRUCT_INFO["MODF_Offset"] = bin2hex(fread($ADT_Handle,4));

We have all offsets of the header, now we can see them with “print_r();” the info that we collected in the array $STRUCT_INFO:

Array
(
    [0] => HEADER
    [MTEX_Offset] => 48100000
    [MMDX_Offset] => 8f110000
    [MMID_Offset] => 03250000
    [MWMO_Offset] => 43260000
    [MWID_Offset] => 7e260000
    [MDDF_Offset] => 8a260000
    [MODF_Offset] => 425e0000
)

Use those offsets to seek every part of the ADT change the values.


Leave a Reply

Your email address will not be published. Required fields are marked *