Quote:
Originally Posted by Trumpcard
Hey,
Im building a php tool for admin'ing the database so a remote GM can make db changes on the fly.
One question though about the items data. Ive mapped out the item structs from the code, so when I retrieve the data via a SQL query, I know where in the array the data is at, so I know where and how to mess with the BLOB.
Now, the value that comes through the query looks is an ACSII character.. Do I just convert that ASCII character back to it's numeric representation, and vice versa to insert it back in, or is there anything special that needs to be done with it?
Any help would be appreciated!
|
I can tell you from making a Player profile editor in php for image (checkout
http://www.cyberjunky.net/~hogie/), it is possible to read the binary data. Use the unpack() command to do it since all the data is that way. You will also need a function to give you "clean" strings from the string fields (since they are null terminated).... Here is the one I use
Code:
function GetNullTermString($string) {
$string2 = "";
for ($i=0;$i<=strlen($string);$i++) {
if (ord(substr($string,$i,1)) == 0)
return $string2;
else
$string2 = $string2.substr($string,$i,1);
}
return $string2;
}
That function will do wonders for your string names.
To insert back in, you would have to pack() each part of the raw_data back and then insert it as 1 long one.
BTW, so you know, item changes will NOT show up until the zone is reloaded (as in, stopped and started again from command line). The same is true with npc_type and such, those are only read once during bootup.
-Hogie