Thread: Item Struct
View Single Post
  #2  
Old 09-19-2002, 09:49 AM
Trumpcard
Demi-God
 
Join Date: Jan 2002
Location: Charlotte, NC
Posts: 2,614
Default

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);
}
Reply With Quote