mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2024-11-30 04:26:03 +00:00
latest
This commit is contained in:
parent
d794031fd8
commit
5ae4788ed1
122
src/D2Item.php
122
src/D2Item.php
@ -6,7 +6,6 @@ require_once 'D2Strings.php';
|
||||
require_once 'D2Functions.php';
|
||||
require_once 'D2ItemData.php';
|
||||
|
||||
|
||||
class D2Item_OLD {
|
||||
|
||||
/**
|
||||
@ -136,7 +135,6 @@ class D2Item_OLD {
|
||||
|
||||
|
||||
//var_dump($b->getOffset());
|
||||
|
||||
//
|
||||
{
|
||||
// if 151 is 1, but 152 is 0, then we have read 152/153/154 already, so we should be at 155
|
||||
@ -345,10 +343,6 @@ class D2Item_OLD {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ -406,6 +400,9 @@ class D2Item {
|
||||
}
|
||||
|
||||
public function parseItem() {
|
||||
$sql = "SELECT * FROM itemstatcost";
|
||||
$isc = PDO_FetchAll($sql);
|
||||
|
||||
// Read and store the actual bits for each class member
|
||||
$this->JM = $this->b->read(16);
|
||||
$this->UN1 = $this->b->read(4);
|
||||
@ -680,8 +677,8 @@ class D2Item {
|
||||
|
||||
// if it is an Armor, then get defense
|
||||
if (!empty($res)) {
|
||||
$this->defense = $this->b->read(11);
|
||||
$this->_defense = bindec(strrev($this->defense)) - 10;
|
||||
$this->defense = $this->b->read($isc[31]['Save Bits']);
|
||||
$this->_defense = bindec(strrev($this->defense)) - $isc[31]['Save Add'];
|
||||
|
||||
var_dump("Def:" . $this->defense);
|
||||
var_dump("Def:" . $this->_defense);
|
||||
@ -694,8 +691,8 @@ class D2Item {
|
||||
// I found it. It's current durability. If we read it, we end up missing the 8 bits.
|
||||
|
||||
|
||||
$this->maxdurability = "" . $this->b->read(8);
|
||||
$this->_maxdurability = bindec(strrev($this->maxdurability));
|
||||
$this->maxdurability = "" . $this->b->read($isc[73]['Save Bits']);
|
||||
$this->_maxdurability = bindec(strrev($this->maxdurability)) - $isc[73]['Save Add'];
|
||||
|
||||
var_dump("MaxDur:" . $this->maxdurability);
|
||||
var_dump("MaxDur:" . $this->_maxdurability);
|
||||
@ -703,8 +700,8 @@ class D2Item {
|
||||
//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));
|
||||
$this->currentdurability = $this->b->read($isc[72]['Save Bits']);
|
||||
$this->_currentdurability = bindec(strrev($this->currentdurability)) - $isc[72]['Save Add'];
|
||||
var_dump("CurDur:" . $this->currentdurability);
|
||||
var_dump("CurDur:" . $this->_currentdurability);
|
||||
//$this->currentdurability_unknown_bit = $this->b->read(1);
|
||||
@ -715,8 +712,8 @@ class D2Item {
|
||||
$sql = "SELECT code FROM weapons WHERE code = ?";
|
||||
$weap = PDO_FetchOne($sql, [$this->itemcode]);
|
||||
if (!empty($weap)) {
|
||||
$this->maxdurability = $this->b->read(8);
|
||||
$this->_maxdurability = bindec(strrev($this->maxdurability));
|
||||
$this->maxdurability = $this->b->read($isc[73]['Save Bits']);
|
||||
$this->_maxdurability = bindec(strrev($this->maxdurability)) - $isc[73]['Save Add'];
|
||||
|
||||
var_dump("MaxDur:" . $this->maxdurability);
|
||||
var_dump("MaxDur:" . $this->_maxdurability);
|
||||
@ -724,8 +721,8 @@ class D2Item {
|
||||
//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));
|
||||
$this->currentdurability = $this->b->read($isc[72]['Save Bits']);
|
||||
$this->_currentdurability = bindec(strrev($this->currentdurability)) - $isc[72]['Save Add'];
|
||||
var_dump("CurDur:" . $this->currentdurability);
|
||||
var_dump("CurDur:" . $this->_currentdurability);
|
||||
//$this->currentdurability_unknown_bit = $this->b->read(1);
|
||||
@ -774,46 +771,69 @@ class D2Item {
|
||||
}
|
||||
|
||||
|
||||
$sql = "SELECT * FROM itemstatcost";
|
||||
$isc = PDO_FetchAll($sql);
|
||||
|
||||
|
||||
// read properties here
|
||||
$property = $this->b->read(9);
|
||||
$_property = bindec(strrev($property));
|
||||
|
||||
$val1;
|
||||
$_val1;
|
||||
$val2;
|
||||
$_val2;
|
||||
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
if ($isc[$_property]['Save Bits']) {
|
||||
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));
|
||||
if ($_property == 511) {
|
||||
echo 511;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// while (true) {
|
||||
// $property = $this->b->read(9);
|
||||
// $_property = bindec(strrev($property));
|
||||
// if ($_property == 511) {
|
||||
// echo 511;
|
||||
// break;
|
||||
// }
|
||||
// if (!empty($isc[$_property]['Save Bits'])) {
|
||||
// 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[49]['Save Bits']);
|
||||
// break;
|
||||
// case 50:
|
||||
// $props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
||||
// $props[$property][] = $this->b->read($isc[51]['Save Bits']);
|
||||
// break;
|
||||
// case 52:
|
||||
// $props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
||||
// $props[$property][] = $this->b->read($isc[53]['Save Bits']);
|
||||
// break;
|
||||
// case 54:
|
||||
// $props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
||||
// $props[$property][] = $this->b->read($isc[55]['Save Bits']);
|
||||
// $props[$property][] = $this->b->read($isc[56]['Save Bits']);
|
||||
// break;
|
||||
// case 57:
|
||||
// $props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
||||
// $props[$property][] = $this->b->read($isc[58]['Save Bits']);
|
||||
// $props[$property][] = $this->b->read($isc[59]['Save Bits']);
|
||||
// break;
|
||||
// case 83:
|
||||
// case 107:
|
||||
// case 108:
|
||||
// $props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
||||
// $props[$property][] = $this->b->read($isc[$_property]['Save Param Bits']);
|
||||
// case 188:
|
||||
// $props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
||||
// $props[$property][] = $this->b->read(13);
|
||||
// $props[$property][] = $this->b->read(3);
|
||||
// case 204:
|
||||
// $props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
||||
// $props[$property][] = $this->b->read(5);
|
||||
// $props[$property][] = $this->b->read(8);
|
||||
// $props[$property][] = $this->b->read(8);
|
||||
// default:
|
||||
// $props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
$this->props = $props;
|
||||
|
||||
var_dump($this->props);
|
||||
//var_dump($this->props);
|
||||
|
||||
if ($this->simple) {
|
||||
echo "Simple";
|
||||
@ -904,8 +924,6 @@ class D2Item {
|
||||
$values[] = $this->magicammo;
|
||||
$values[] = $this->tpot;
|
||||
|
||||
|
||||
|
||||
// foreach($this->props as $k => $v){
|
||||
// $values[] = $k;
|
||||
// $values[] = $v[0];
|
||||
|
Loading…
Reference in New Issue
Block a user