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 'D2Functions.php';
|
||||||
require_once 'D2ItemData.php';
|
require_once 'D2ItemData.php';
|
||||||
|
|
||||||
|
|
||||||
class D2Item_OLD {
|
class D2Item_OLD {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -136,7 +135,6 @@ class D2Item_OLD {
|
|||||||
|
|
||||||
|
|
||||||
//var_dump($b->getOffset());
|
//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
|
// 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() {
|
public function parseItem() {
|
||||||
|
$sql = "SELECT * FROM itemstatcost";
|
||||||
|
$isc = PDO_FetchAll($sql);
|
||||||
|
|
||||||
// Read and store the actual bits for each class member
|
// Read and store the actual bits for each class member
|
||||||
$this->JM = $this->b->read(16);
|
$this->JM = $this->b->read(16);
|
||||||
$this->UN1 = $this->b->read(4);
|
$this->UN1 = $this->b->read(4);
|
||||||
@ -680,8 +677,8 @@ class D2Item {
|
|||||||
|
|
||||||
// if it is an Armor, then get defense
|
// if it is an Armor, then get defense
|
||||||
if (!empty($res)) {
|
if (!empty($res)) {
|
||||||
$this->defense = $this->b->read(11);
|
$this->defense = $this->b->read($isc[31]['Save Bits']);
|
||||||
$this->_defense = bindec(strrev($this->defense)) - 10;
|
$this->_defense = bindec(strrev($this->defense)) - $isc[31]['Save Add'];
|
||||||
|
|
||||||
var_dump("Def:" . $this->defense);
|
var_dump("Def:" . $this->defense);
|
||||||
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.
|
// 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 = "" . $this->b->read($isc[73]['Save Bits']);
|
||||||
$this->_maxdurability = bindec(strrev($this->maxdurability));
|
$this->_maxdurability = bindec(strrev($this->maxdurability)) - $isc[73]['Save Add'];
|
||||||
|
|
||||||
var_dump("MaxDur:" . $this->maxdurability);
|
var_dump("MaxDur:" . $this->maxdurability);
|
||||||
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
|
//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.
|
//The first 8 bits are the item's current durability. The last bit is unknown.
|
||||||
if ($this->maxdurability !== 0) {
|
if ($this->maxdurability !== 0) {
|
||||||
$this->currentdurability = $this->b->read(9);
|
$this->currentdurability = $this->b->read($isc[72]['Save Bits']);
|
||||||
$this->_currentdurability = bindec(strrev($this->currentdurability));
|
$this->_currentdurability = bindec(strrev($this->currentdurability)) - $isc[72]['Save Add'];
|
||||||
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);
|
//$this->currentdurability_unknown_bit = $this->b->read(1);
|
||||||
@ -715,8 +712,8 @@ class D2Item {
|
|||||||
$sql = "SELECT code FROM weapons WHERE code = ?";
|
$sql = "SELECT code FROM weapons WHERE code = ?";
|
||||||
$weap = PDO_FetchOne($sql, [$this->itemcode]);
|
$weap = PDO_FetchOne($sql, [$this->itemcode]);
|
||||||
if (!empty($weap)) {
|
if (!empty($weap)) {
|
||||||
$this->maxdurability = $this->b->read(8);
|
$this->maxdurability = $this->b->read($isc[73]['Save Bits']);
|
||||||
$this->_maxdurability = bindec(strrev($this->maxdurability));
|
$this->_maxdurability = bindec(strrev($this->maxdurability)) - $isc[73]['Save Add'];
|
||||||
|
|
||||||
var_dump("MaxDur:" . $this->maxdurability);
|
var_dump("MaxDur:" . $this->maxdurability);
|
||||||
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
|
//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.
|
//The first 8 bits are the item's current durability. The last bit is unknown.
|
||||||
if ($this->maxdurability !== 0) {
|
if ($this->maxdurability !== 0) {
|
||||||
$this->currentdurability = $this->b->read(9);
|
$this->currentdurability = $this->b->read($isc[72]['Save Bits']);
|
||||||
$this->_currentdurability = bindec(strrev($this->currentdurability));
|
$this->_currentdurability = bindec(strrev($this->currentdurability)) - $isc[72]['Save Add'];
|
||||||
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);
|
//$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
|
// read properties here
|
||||||
$property = $this->b->read(9);
|
// while (true) {
|
||||||
$_property = bindec(strrev($property));
|
// $property = $this->b->read(9);
|
||||||
|
// $_property = bindec(strrev($property));
|
||||||
$val1;
|
// if ($_property == 511) {
|
||||||
$_val1;
|
// echo 511;
|
||||||
$val2;
|
// break;
|
||||||
$_val2;
|
// }
|
||||||
|
// if (!empty($isc[$_property]['Save Bits'])) {
|
||||||
for ($i = 0; $i < 10; $i++) {
|
// switch ($_property) {
|
||||||
if ($isc[$_property]['Save Bits']) {
|
// case 17:
|
||||||
switch ($_property) {
|
// $props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
||||||
case 17:
|
// $props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
||||||
$props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
// break;
|
||||||
$props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
// case 48:
|
||||||
break;
|
// $props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
||||||
case 48:
|
// $props[$property][] = $this->b->read($isc[49]['Save Bits']);
|
||||||
$props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
// break;
|
||||||
$props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
// case 50:
|
||||||
break;
|
// $props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
||||||
default:
|
// $props[$property][] = $this->b->read($isc[51]['Save Bits']);
|
||||||
$props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
// break;
|
||||||
break;
|
// case 52:
|
||||||
}
|
// $props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
||||||
$property = $this->b->read(9);
|
// $props[$property][] = $this->b->read($isc[53]['Save Bits']);
|
||||||
$_property = bindec(strrev($property));
|
// break;
|
||||||
if ($_property == 511) {
|
// case 54:
|
||||||
echo 511;
|
// $props[$property][] = $this->b->read($isc[$_property]['Save Bits']);
|
||||||
break;
|
// $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;
|
$this->props = $props;
|
||||||
|
|
||||||
var_dump($this->props);
|
//var_dump($this->props);
|
||||||
|
|
||||||
if ($this->simple) {
|
if ($this->simple) {
|
||||||
echo "Simple";
|
echo "Simple";
|
||||||
@ -904,8 +924,6 @@ class D2Item {
|
|||||||
$values[] = $this->magicammo;
|
$values[] = $this->magicammo;
|
||||||
$values[] = $this->tpot;
|
$values[] = $this->tpot;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// foreach($this->props as $k => $v){
|
// foreach($this->props as $k => $v){
|
||||||
// $values[] = $k;
|
// $values[] = $k;
|
||||||
// $values[] = $v[0];
|
// $values[] = $v[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user