Item Struct
Ok. I have been searching and reading for the past 3 hours, but Either I cann't read between the lines or this has never been addressed.
i am trying to make a Searchable database Based on the EqEmu DB in items table ONLY (I don't want people seeing my other stuff on my Emu). however I get this: Database Query Returned: 24876 drixie remains*corpse of a drixie heraldIT63 |
Thats a blob... Have to play with it a bit... Here's how we did it in php with EqTreasures.. Dont know if the item format changed enough to screw this up, you basically need to look through the item struct in the code to figure out what is where in the packed field.
# Seperated Item Data fields to make code more readable and easy to made changes/additions to. $StrF = "ascii(mid(raw_data,173,1)) as 'STR'"; $StaF="ascii(mid(raw_data,174,1)) as 'STA'"; $ChaF="ascii(mid(raw_data,175,1)) as 'CHA'"; $DexF="ascii(mid(raw_data,176,1)) as 'DEX'"; $IntF="ascii(mid(raw_data,177,1)) as 'INT'"; $AgiF="ascii(mid(raw_data,178,1)) as 'AGI'"; $WisF="ascii(mid(raw_data,179,1)) as 'WIS'"; $MRF="ascii(mid(raw_data,180,1)) as 'MAGIC'"; $FRF="ascii(mid(raw_data,181,1)) as 'FIRE'"; $CRF="ascii(mid(raw_data,182,1)) as 'COLD'"; $DRF="ascii(mid(raw_data,183,1)) as 'DISEASE'"; $PRF="ascii(mid(raw_data,184,1)) as 'POISON'"; $HPF="ascii(mid(raw_data,185,1)) as 'HP'"; $MANAF="ascii(mid(raw_data,186,1)) as 'MANA'"; $ACF="ascii(mid(raw_data,187,1)) as 'AC'"; $DelayF="ascii(mid(raw_data,191,1)) as 'DELAY'"; $DamageF="ascii(mid(raw_data,192,1)) as 'DAMAGE'"; $RangeF="ascii(mid(raw_data,194,1)) as 'RANGE'"; $WeightF="ord(mid(raw_data,126,1)) as 'WEIGHT'"; $NoDropF="ascii(mid(raw_data,128,1)) as 'NODROP'"; $MagicF="ascii(mid(raw_data,196,1)) as 'MAGICF'"; $SkillF="ascii(mid(raw_data,195,1)) as 'SKILL'"; $EffectF="((ascii(mid(raw_data,221,1))*1)+(ascii(m id(raw_data,222,1))*256)) as 'EFFECT'"; $EffectTypeF="ascii(mid(raw_data,220,1)) as 'EFFECTTYPE'"; $sql='select id,'.$StrF.','.$StaF.','.$ChaF.','.$DexF.','.$IntF .','.$AgiF.','.$WisF.','.$MRF.','.$FRF.','.$CRF.', '.$DRF.','.$PRF.','.$HPF.','.$MANAF.','.$ACF.','.$ DelayF.','.$DamageF.','.$WeightF.','.$RangeF.','.$ NoDropF.', '.$MagicF.', '.$SkillF.', '.$EffectF.','.$EffectTypeF.' from items where id=\''.$id.'\''; $req = mysql_query($sql) or die('SQL Error !<br>'.$sql.'<br>'.mysql_error()); while($data = mysql_fetch_array($req)) { $sql2 = 'select substring(raw_data,1,35) as \'name\', substring(raw_data,36,96) as \'lorename\' from items where id=\''.$id.'\''; #$sql3 = 'select substring(raw_data,36,96) as \'lorename\' from items where id=\''.$id.'\''; $req2 = mysql_query($sql2) or die('SQL Error !<br>'.$sql2.'<br>'.mysql_error()); $test = mysql_num_rows($req2) ; while($data2 = mysql_fetch_array($req2)) { $pos = strpos($data2['name'],00); $name = substr($data2['name'],0,$pos); $pos = strpos($data2['lorename'],00); $lorename = substr($data2['lorename'],0,$pos); } |
I am using Php as well.
After all the Sql queries, just put an print (" "); statement into the results.php file? Sorry to be a bother. Been doing as Much research as I can on my own. |
Well depends on what you are doing with it.. If you want it to look decent, you need to format the output a little..
I just clipped a sample, heres the whole file... <? include ('db.php'); require('layout.php'); require('globalfunction.php'); printf("<body bgcolor=\"$BackgroundColor\" text=\"#FFFFFF\" link=\"#A7C4FF\" vlink=\"#A7C4FF\" alink=\"#A7C4FF\" topmargin=5 leftmargin=10>\n"); # Seperated Item Data fields to make code more readable and easy to made changes/additions to. $StrF = "ascii(mid(raw_data,173,1)) as 'STR'"; $StaF="ascii(mid(raw_data,174,1)) as 'STA'"; $ChaF="ascii(mid(raw_data,175,1)) as 'CHA'"; $DexF="ascii(mid(raw_data,176,1)) as 'DEX'"; $IntF="ascii(mid(raw_data,177,1)) as 'INT'"; $AgiF="ascii(mid(raw_data,178,1)) as 'AGI'"; $WisF="ascii(mid(raw_data,179,1)) as 'WIS'"; $MRF="ascii(mid(raw_data,180,1)) as 'MAGIC'"; $FRF="ascii(mid(raw_data,181,1)) as 'FIRE'"; $CRF="ascii(mid(raw_data,182,1)) as 'COLD'"; $DRF="ascii(mid(raw_data,183,1)) as 'DISEASE'"; $PRF="ascii(mid(raw_data,184,1)) as 'POISON'"; $HPF="ascii(mid(raw_data,185,1)) as 'HP'"; $MANAF="ascii(mid(raw_data,186,1)) as 'MANA'"; $ACF="ascii(mid(raw_data,187,1)) as 'AC'"; $DelayF="ascii(mid(raw_data,191,1)) as 'DELAY'"; $DamageF="ascii(mid(raw_data,192,1)) as 'DAMAGE'"; $RangeF="ascii(mid(raw_data,194,1)) as 'RANGE'"; $WeightF="ord(mid(raw_data,126,1)) as 'WEIGHT'"; $NoDropF="ascii(mid(raw_data,128,1)) as 'NODROP'"; $MagicF="ascii(mid(raw_data,196,1)) as 'MAGICF'"; $SkillF="ascii(mid(raw_data,195,1)) as 'SKILL'"; $EffectF="((ascii(mid(raw_data,221,1))*1)+(ascii(m id(raw_data,222,1))*256)) as 'EFFECT'"; $EffectTypeF="ascii(mid(raw_data,220,1)) as 'EFFECTTYPE'"; $sql='select id,'.$StrF.','.$StaF.','.$ChaF.','.$DexF.','.$IntF .','.$AgiF.','.$WisF.','.$MRF.','.$FRF.','.$CRF.', '.$DRF.','.$PRF.','.$HPF.','.$MANAF.','.$ACF.','.$ DelayF.','.$DamageF.','.$WeightF.','.$RangeF.','.$ NoDropF.', '.$MagicF.', '.$SkillF.', '.$EffectF.','.$EffectTypeF.' from items where id=\''.$id.'\''; $req = mysql_query($sql) or die('SQL Error !<br>'.$sql.'<br>'.mysql_error()); while($data = mysql_fetch_array($req)) { $sql2 = 'select substring(raw_data,1,35) as \'name\', substring(raw_data,36,96) as \'lorename\' from items where id=\''.$id.'\''; #$sql3 = 'select substring(raw_data,36,96) as \'lorename\' from items where id=\''.$id.'\''; $req2 = mysql_query($sql2) or die('SQL Error !<br>'.$sql2.'<br>'.mysql_error()); $test = mysql_num_rows($req2) ; while($data2 = mysql_fetch_array($req2)) { $pos = strpos($data2['name'],00); $name = substr($data2['name'],0,$pos); $pos = strpos($data2['lorename'],00); $lorename = substr($data2['lorename'],0,$pos); } if(isset($name) == FALSE ){ $name = "N/A"; } echo '<table width="400" height="168" border="0" cellspacing="0" cellpadding="0" style="background-image: url(images/itemlore2-400.jpg)" bgcolor="#A79879" align="center">'; echo '<tr>'; echo ' <td width="400" height="8" colspan="3"><img src="images/dot.gif"></td>'; echo '</tr>'; echo ' <tr><td width="10" height="132"><img src="images/dot.gif"></td><td width="400" valign="top" class="itemshot"><b>'; echo ''.$name.'<br>'; if ($data['MAGICF'] == "1" | !$data['NODROP']) { if ($data['MAGICF'] == "1") { echo 'MAGIC ITEM'; } if (!$data['NODROP']) { echo ' NO DROP'; } if ($name != $lorename) { echo ' LORE'; } echo '<br>'; } #echo 'Slot: PRIMARY SECONDARY<br>'; #echo 'Skill: '.$data['SKILL'].' '; if ($data['SKILL'] != '10') { echo 'Skill: '; switch ($data['SKILL']) { case '0': echo '1h slash&nbsp&nbsp&nbsp&nbsp&nbsp '; break; case '1': echo '2h slash&nbsp&nbsp&nbsp&nbsp&nbsp '; break; case '2': echo 'Piercing&nbsp&nbsp&nbsp&nbsp& nbsp'; break; case '3': echo '1h bash&nbsp&nbsp&nbsp&nbsp&nbsp' ; break; case '4': echo '2h blunt&nbsp&nbsp&nbsp&nbsp&nbsp '; case '5': echo 'Range&nbsp&nbsp&nbsp&nbsp&nbs p'; case '7': echo 'Thrown&nbsp&nbsp&nbsp&nbsp&nb sp'; case '23': echo 'Wind Instrument'; case '24': echo 'String Instrument'; case '25': echo 'Brass Instrument'; case '26': echo 'Percussion Instrument'; case '23': echo ''; case '23': echo ''; break; default: echo 'Unknown&nbsp&nbsp&nbsp&nbsp&n bsp'; } } if ($data['DAMAGE']) echo 'DMG: '.$data['DAMAGE'].'&nbsp&nbsp&nbsp'; if ($data['DELAY']) echo 'DELAY: '.$data['DELAY'].'<BR>'; if ($data['AC']) echo 'AC: '.$data['AC'].'<br>'; if ($data['STR']) echo 'STR: +'.$data['STR'].' '; if ($data['STA']) echo 'STA: +'.$data['STA'].' '; if ($data['CHA']) echo 'CHA: +'.$data['CHA'].' '; if ($data['DEX']) echo 'DEX: +'.$data['DEX'].' '; if ($data['INT']) echo 'INT: +'.$data['INT'].' '; if ($data['AGI']) echo 'AGI: +'.$data['AGI'].' '; if ($data['WIS']) echo 'WIS: +'.$data['WIS'].' '; if ($data['MAGIC']) echo 'SV MAGIC: +'.$data['MAGIC'].' '; if ($data['FIRE']) echo 'SV FIRE: +'.$data['FIRE'].' '; if ($data['COLD']) echo 'SV COLD: +'.$data['COLD'].' '; if ($data['DISEASE']) echo 'SV DISEASE: +'.$data['DISEASE'].' '; if ($data['POISON']) echo 'SV POISON: +'.$data['POISON'].' '; if ($data['HP']) echo 'HP: +'.$data['HP'].' '; $WT=$data['WEIGHT'] * .1; echo '<br>WT: '.$WT.' '; echo ' Class: Soon '; echo ' Race: Soon<br>'; if ($data['EFFECT'] != '65535') { echo ' Effect: '.$data['EFFECT'].' '; echo ' Type: '; switch ($data['EFFECTTYPE']) { case '0': echo "Proc"; break; case '1': echo "Clickable"; break; case '2': echo "Latent"; break; case '3': echo "Clickable(expendable)"; break; case '4': echo "Clickable(worn)"; break; case '5': echo "Clickable(Class Check)"; break; default: echo "Proc"; } } echo '</b></td><td width="10"><img src="images/dot.gif"></td></tr>'; echo '</table>'; } echo '</tr>'; echo '</table>'; mysql_close(); ?> |
Seems like the file that I got from the phplegends.zip.
Here's the problem: Parse error: parse error in /var/www/html/dbtest/test.php on line 36 With line 36 being: $sql = 'select id,'.$StrF.','.$StaF.','.$ChaF.','.$DexF.','.$IntF .','.$AgiF.','.$WisF.','.$MRF.','.$FRF.','.$CRF.', '.$DRF.','.$PRF.','.$HPF.','.$MANAF.','.$ACF.','.$ DelayF.','.$DamageF.','.$WeightF.','.$RangeF.','.$ NoDropF.', '.$MagicF.', '.$SkillF.', '.$EffectF.','.$EffectTypeF.' from items where id=''.$id.'''; I don't know why This isn't working for me. I had an SQL expert look at the Query tonight, and he said that seems to be a valid SQL query.. |
Yep.. It was originally legends till someone got peeved off at it being called that... (They wanted to call theirs legends to or some such nonsense)
Try to cut verbose debugging on.. Also, like in C/Java coding, I recommend putting echo's/printf's all over the place for testing purposes.. Try to echo out that line and look at it, then try to execute it directly against the database. Most likely, theres just a typo in there somewhere, as a parse error will come from the php intrepreter. Most likely theres a missing parathesis, or missing semicolon somewhere. |
I hate it when I misplace my colons...
I'll have a look at it. |
shouldn't where id=''.$id.'''; be where id='.$id.';';
single ' on both sides of .$id. followed by a ; for mysql then ' , then im guessing you need a ; for php |
I have tried putting ths Whole $sql= statement in doubles, but that changes it to a string, It'll execute the script, however the SQL query goes nutty. hahahah
Lurker, Tried the change, Still gettin a Parse error. |
Woo-Hoo!
It's working (sort of) getting real strange errors (like DEX+255) and the like. Is there a Working version that I might take a look at out there? |
I REALLY think we should have a table that contains metadata for things like player and item structures that can change with client version. When new versions of the emu come out, that way tools which rely on being able to properly read the structures won't break.
Thoughts? |
XML all the way.
Perfect for metadata. |
Trump,
Sorry I haven't gotten back sooner. I am a total noob at Xml, How would I implement this? With a .css to display the search results? Ideally, There would be a .php search page with input (and/or checkboxes) for my guild to search for items with. Based on class, race... blah blah.... Any assistance is greatly appreciated. |
actually thats a good idea.
The errors you have with the old legends source not displaying correct values is because the offsets are wrong and have changed over time. Easiest way is to calculate new offsets. The generic item struct last time had a lot more data such as bane and dietys then we had hardcoded. I was also unable to fully complete it :( Prehaps soon if no one already picked it up. |
All times are GMT -4. The time now is 02:27 AM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.