More item parsing, still not done

This commit is contained in:
Hash Borgir 2023-06-23 11:43:15 -06:00
parent 7b0f6e152c
commit caa8377131

View File

@ -340,8 +340,8 @@ class D2Item {
$this->defense = $this->b->read(11);
$this->_defense = bindec(strrev($this->defense)) - 10;
//var_dump("Def:" . $this->defense);
//var_dump("Def:" . $this->_defense);
var_dump("Def:" . $this->defense);
var_dump("Def:" . $this->_defense);
// armors are missing a full byte here
// if we insert all 0s, it evens out, but is wrong
@ -354,16 +354,16 @@ class D2Item {
$this->maxdurability = "" . $this->b->read(8);
$this->_maxdurability = bindec(strrev($this->maxdurability));
//var_dump("MaxDur:" . $this->maxdurability);
//var_dump("MaxDur:" . $this->_maxdurability);
var_dump("MaxDur:" . $this->maxdurability);
var_dump("MaxDur:" . $this->_maxdurability);
//Only exists if the item's max durability is greater than zero
//The first 8 bits are the item's current durability. The last bit is unknown.
if ($this->maxdurability !== 0) {
$this->currentdurability = $this->b->read(9);
$this->_currentdurability = bindec(strrev($this->currentdurability));
//var_dump("CurDur:" . $this->currentdurability);
//var_dump("CurDur:" . $this->_currentdurability);
var_dump("CurDur:" . $this->currentdurability);
var_dump("CurDur:" . $this->_currentdurability);
//$this->currentdurability_unknown_bit = $this->b->read(1);
}
}
@ -375,16 +375,16 @@ class D2Item {
$this->maxdurability = $this->b->read(8);
$this->_maxdurability = bindec(strrev($this->maxdurability));
//var_dump("MaxDur:" . $this->maxdurability);
//var_dump("MaxDur:" . $this->_maxdurability);
var_dump("MaxDur:" . $this->maxdurability);
var_dump("MaxDur:" . $this->_maxdurability);
//Only exists if the item's max durability is greater than zero
//The first 8 bits are the item's current durability. The last bit is unknown.
if ($this->maxdurability !== 0) {
$this->currentdurability = $this->b->read(9);
$this->_currentdurability = bindec(strrev($this->currentdurability));
//var_dump("CurDur:" . $this->currentdurability);
//var_dump("CurDur:" . $this->_currentdurability);
var_dump("CurDur:" . $this->currentdurability);
var_dump("CurDur:" . $this->_currentdurability);
//$this->currentdurability_unknown_bit = $this->b->read(1);
}
}
@ -393,7 +393,7 @@ class D2Item {
if ($this->txt['stackable'] == 1) {
$this->stackable = $this->b->read(9);
//var_dump("stackable: " . bindec(strrev($this->stackable)));
var_dump("stackable: " . bindec(strrev($this->stackable)));
}
@ -402,8 +402,8 @@ class D2Item {
$this->numsockets = $this->b->read(4);
$this->_numsockets = bindec(strrev($this->numsockets));
//$this->numsockets_extra_bit = $this->b->read(1);
//var_dump("numsock: " . $this->numsockets);
//var_dump("numsock: " . $this->_numsockets);
var_dump("numsock: " . $this->numsockets);
var_dump("numsock: " . $this->_numsockets);
}
// Set properties bit field, used later for reading the set property lists of the item
@ -438,22 +438,39 @@ class D2Item {
$property = $this->b->read(9);
$_property = bindec(strrev($property));
$val1;
$_val1;
$val2;
$_val2;
for ($i = 0; $i < 10; $i++) {
if ($isc[$_property]['Save Bits']) {
$val = $this->b->read($isc[$_property]['Save Bits']);
$_val = bindec(strrev($val));
switch ($_property) {
case 17:
$props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
$props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
break;
case 48:
$props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
$props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
break;
default:
$props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
break;
}
$property = $this->b->read(9);
$_property = bindec(strrev($property));
//var_dump($isc[$_property]['Stat']);
//var_dump($property);
//var_dump($_property);
//var_dump($val);
//var_dump($_val);
if ($_property == 511) {
echo 511;
break;
}
}
}
////var_dump($isc[$_property]);
$this->props = $props;
var_dump($this->props);
if ($this->simple) {
echo "Simple";
@ -543,6 +560,16 @@ class D2Item {
$values[] = $this->setfield;
$values[] = $this->magicammo;
$values[] = $this->tpot;
// foreach($this->props as $k => $v){
// $values[] = $k;
// $values[] = $v[0];
// $values[] = $v[1] ?? '';
//
// }
$values[] = "";
$values[] = "";
$values[] = "";