item parsing not yet working fully

This commit is contained in:
Hash Borgir 2023-06-07 01:09:02 -06:00
parent ff1be3692e
commit 9c8f50f1f7
3 changed files with 22 additions and 8 deletions

View File

@ -43,7 +43,7 @@ foreach ($ISCData as $k => $v) {
//$filePath = "D:\Diablo II\MODS\MedianXL2012\save\Test.d2s";
$filePath = "Pest.d2s";
$filePath = "Sorc.d2s";
$char = new D2Char($filePath);
//$char->setChar("CharacterStatus", "Died", 0);
@ -51,8 +51,8 @@ $char = new D2Char($filePath);
//$char->setChar("CharacterStatus", "Expansion", 1);
//$char->setChar("LeftmousebuttonskillID", 223);
//$char->setAllSkills(1);
$char->setSkill(4, 99);
$char->setAllSkills(1);
//$char->setSkill(3, 20);
//$char->setChar("CharacterClass", "Necromancer"); // 127
//$char->setChar("CharacterProgression", 1); // 0 in normal, 1 finished normal, 2 finished nm, 3 finished hell
@ -88,5 +88,5 @@ unset($char); // destroy $char so we can read it again after writing to it to ge
$char = new D2Char($filePath);
var_dump($char->cData);
var_dump($char->cData['items']);
//var_dump($char->cData['stats']);

BIN
img/items/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 228 B

View File

@ -135,6 +135,8 @@ class D2Item {
}
//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
@ -178,19 +180,29 @@ class D2Item {
case D2ItemQuality::MAGIC:
// read 11 bits, prefix.
// if no prefix, then next 11 bits will be suffix
$this->iData['$magic_prefix'] = bindec($b->readr(11));
$this->iData['magic_prefix'] = bindec($b->readr(11));
$this->iData['magic_suffix'] = bindec($b->readr(11));
break;
case D2ItemQuality::SET:
// Set items have a 12-bit field containing the ID of the set. (Not the set member, but the whole set.) The set member is identified by cross-referencing the item type with the set ID. Also note that set items have an extra field following the item-specific data.
// Set identifier; i.e., all items which are part of the set will have the same value in this field.
$set_item = bindec($b->readr(12));
//var_dump($b->getOffset());
$setid = bindec($b->readr(12));
//var_dump($setid);
$sql = "SELECT ROWID,* from sets WHERE ROWID=$setid";
$res = PDO_FetchRow($sql);
//ddump($res);
$this->iData["setname"] = $res;
break;
case D2ItemQuality::RARE:
$this->iData['iquality'] = "Rare";
break;
case D2ItemQuality::UNIQUE:
$this->iData['iquality'] = "Unique";
//Unique items have an additional 12 bit field, which in most cases is the unique item ID. The few exceptions are certain quest items (e.g., the Horadric Malus).
$uni_item = bindec($b->readr(12));
break;
case D2ItemQuality::CRAFTED:
$this->iData['iquality'] = "Crafted";
@ -304,7 +316,9 @@ class D2Item {
$sql = "SELECT * from weapons WHERE code = '{$this->iData['code']}'";
$res = PDO_FetchRow($sql);
}
//$this->iData['txt'] = ($res);
// set txt data array
$this->iData['txt'] = ($res);
$sql = "
SELECT code, namestr