Fixed rare parsing

This commit is contained in:
Hash Borgir 2023-09-11 18:05:42 -06:00
parent c8d2d53bb2
commit 9d733d91df

View File

@ -7,7 +7,7 @@ require_once 'D2Functions.php';
require_once 'D2ItemData.php'; require_once 'D2ItemData.php';
class D2Item { class D2Item_OLD {
/** /**
* @var null * @var null
@ -352,7 +352,7 @@ class D2Item {
/** /**
* *
*/ */
class D2Item_NEW { class D2Item {
private $bits = null; // Item bitstring private $bits = null; // Item bitstring
private $oldbits = null; // Old Item bits for comparison private $oldbits = null; // Old Item bits for comparison
@ -589,14 +589,14 @@ class D2Item_NEW {
$suffixes = []; $suffixes = [];
for ($i = 0; $i < 3; $i++) { for ($i = 0; $i < 3; $i++) {
$this->prefixBit = $this->b->read(1); $this->prefixBit[$i] = $this->b->read(1);
if ($this->prefixBit) { if ($this->prefixBit[$i]) {
$this->_prefixes[$i] = $this->b->read(11); $this->_prefixes[$i] = $this->b->read(11);
$prefixes[$i] = bindec(strrev($this->_prefixes[$i])); $prefixes[$i] = bindec(strrev($this->_prefixes[$i]));
} }
$this->suffixBit = $this->b->read(1); $this->suffixBit[$i] = $this->b->read(1);
if ($this->suffixBit) { if ($this->suffixBit[$i]) {
$this->_suffixes[$i] = $this->b->read(11); $this->_suffixes[$i] = $this->b->read(11);
$suffixes[$i] = bindec(strrev($this->_sufffixes[$i])); $suffixes[$i] = bindec(strrev($this->_sufffixes[$i]));
} }
@ -824,9 +824,9 @@ class D2Item_NEW {
$oldbitsSplit = str_split($this->oldbits, 8); $oldbitsSplit = str_split($this->oldbits, 8);
$dumpValuesSplit = str_split($this->dumpValues(), 8); $dumpValuesSplit = str_split($this->dumpValues(), 8);
echo "<pre>{$this->txt['name']}</pre>"; echo "<pre>{$this->txt['name']}</pre>";
echo "<pre>" . implode(' ', $oldbitsSplit) . "</pre>"; echo "<pre style='color:green'>Old : " . implode(' ', $oldbitsSplit) . "</pre>";
echo "<pre>" . implode(' ', $dumpValuesSplit) . "</pre>"; echo "<pre>New : " . implode(' ', $dumpValuesSplit) . "</pre>";
echo "<pre>" . highlightStringDifferences(implode(' ', $oldbitsSplit), implode(' ', $dumpValuesSplit)) . "</pre>"; echo "<pre>Diff: " . highlightStringDifferences(implode(' ', $oldbitsSplit), implode(' ', $dumpValuesSplit)) . "</pre>";
echo "<hr>"; echo "<hr>";
} }
@ -874,17 +874,17 @@ class D2Item_NEW {
$values[] = $this->magic_suffix; $values[] = $this->magic_suffix;
$values[] = $this->rareID1; $values[] = $this->rareID1;
$values[] = $this->rareID2; $values[] = $this->rareID2;
$values[] = $this->prefixBit; $values[] = $this->prefixBit[0];
$values[] = $this->_prefixes[0]; $values[] = $this->_prefixes[0];
$values[] = $this->suffixBit; $values[] = $this->suffixBit[0];
$values[] = $this->_suffixes[0]; $values[] = $this->_suffixes[0];
$values[] = $this->prefixBit; $values[] = $this->prefixBit[1];
$values[] = $this->_prefixes[1]; $values[] = $this->_prefixes[1];
$values[] = $this->suffixBit; $values[] = $this->suffixBit[1];
$values[] = $this->_suffixes[1]; $values[] = $this->_suffixes[1];
$values[] = $this->prefixBit; $values[] = $this->prefixBit[2];
$values[] = $this->_prefixes[2]; $values[] = $this->_prefixes[2];
$values[] = $this->suffixBit; $values[] = $this->suffixBit[2];
$values[] = $this->_suffixes[2]; $values[] = $this->_suffixes[2];
$values[] = $this->setid; $values[] = $this->setid;
$values[] = $this->unique; $values[] = $this->unique;