|
|
 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
|
Archive::Development Archive area for Development's posts that were moved here after an inactivity period of 90 days. |

03-05-2002, 01:23 AM
|
Demi-God
|
|
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
|
|
Raw_data question
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!
|
 |
|
 |

03-05-2002, 01:15 PM
|
Fire Beetle
|
|
Join Date: Sep 2002
Posts: 0
|
|
Re: Raw_data question
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
|
 |
|
 |
 |
|
 |

03-06-2002, 01:19 AM
|
Demi-God
|
|
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
|
|
Very cool ! Thats exactly what I need...
I had tried using unpack before (just too display the blob into column seperated field), but I have a feeling I was screwing something up in the usage.
Since you did it with the character table, I shouldnt have too much trouble doing it for the items/character table. Just need to do my pack()/unpack() homework a bit.
Thanks a ton Hogie!
If you get the chance, mind sending me a snippet of the code you use too display the data once you nab it from the database, that way I will have a practical example of how unpack's used?
I wrote a few general pages/scripts that will display all tables, and allow you too edit them all. . It's general enough that it will pick up any new tables that are added from release to release, without having to add componets or change anything in the configuration.. It basically grabs all the tables out of the database, gives you a view/add/search option for all of them, then formats those operations based on the indivudual table structure. The only ones it doesnt work for are tables that contain blob structs (char. and items only I think).
I was trying to make a framework that was close to myPhpAdmin , but tailored for the eq database, but general and customizable enough I could use for any database. I have quite a few databases that I run, so wanted to make something I could port over to be a tool for any of the others ones without having to rewrite anything.
|
 |
|
 |

03-06-2002, 07:58 AM
|
Fire Beetle
|
|
Join Date: Sep 2002
Posts: 0
|
|
Here's basically what I did:
Code:
$query = "SELECT profile FROM character_ WHERE name='$pp'";
$result = mysql_query($query);
$row = mysql_fetch_row($result);
$lastname = GetNulLTermString(substr($row[0],34,20));
That gets the lastname
For inventory slots where I used unpack...
Code:
array($inventory);
$inventory = unpack("v30slot",substr($row[0],168,60));
That made:
Code:
$inventory["slot1"];
$inventory["slot2"];
$inventory["slot3"];
...
$inventory["slot30"];
Hope this helps
|

03-06-2002, 08:26 AM
|
Demi-God
|
|
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
|
|
Ahh.. I see... I got it working when unpacking the item names.. My problem is because its null terminated, my loop is bombing out... I see now Im not going to be able to do it gracefully, Im going to have to specify every column by its array position, and build each one of the strings uniquely..
I was hoping I could unpack the entire string, parse through it by null terminators, then seperate each of those values into a parm list, but I think i will probably have to hand wrap it.
Thanks Hogie! I'll give it a shot when i get home and see what I can yank out..
|

03-08-2002, 02:29 AM
|
Demi-God
|
|
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
|
|
Hogie,
Do you mind posting the unpack where you nab an attribute value (like Str or Dex or something)
I am having the hardest time yanking out those int8 values...
Thanks
|

03-08-2002, 05:46 AM
|
Fire Beetle
|
|
Join Date: Sep 2002
Posts: 0
|
|
Actually, I dont think I used unpack for the stats... :P
Code:
array($stats);
$stats['str'] = hexdec(bin2hex(substr($row[0],123,1)));
$stats['sta'] = hexdec(bin2hex(substr($row[0],124,1)));
$stats['cha'] = hexdec(bin2hex(substr($row[0],125,1)));
...
Hope that helps (that was before I found out about pack/unpack)
|

03-08-2002, 06:49 AM
|
Demi-God
|
|
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
|
|
Another dumb question... The 'str' values inside the array pointer, is that just an enumeration for the location in the array? Just wondering, get T_PARSE errors using it this way, and cant seem to be able to just set
array($stats);
$stats[0]= bin2hex......
|

03-08-2002, 07:14 AM
|
Fire Beetle
|
|
Join Date: Sep 2002
Posts: 0
|
|
Yeah, they are just enumations for me. Since $stats is an array made by me, I can do whatever I want
Are you sure you did ['str'] ? T_Parse is usually due to mismatched "/' or missing ones...
|

03-10-2002, 06:07 PM
|
Demi-God
|
|
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
|
|
Duh, Im an idiot... got it working, my syntax was good, but my logic was bad... Thanks for all the help Hogie!
|

04-13-2002, 06:36 AM
|
Fire Beetle
|
|
Join Date: Apr 2002
Posts: 5
|
|
sorry guys, but can anyone tell me why this php code , doesn't return anyhting ?
<?
$host = "localhost";
$user = "root";
$pass = "";
$bdd = "EQDB";
mysql_connect($host,$user,$pass)
or die("Impossible de se connecter
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 04:01 AM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |