Added D2Strings class to get strings where needed from strings table

This commit is contained in:
Hash Borgir
2022-06-20 21:21:02 -06:00
parent ade44ff427
commit 5907c8c8d3
3 changed files with 149 additions and 142 deletions

View File

@@ -3,12 +3,14 @@
require_once 'D2CharStructureData.php';
require_once 'D2Files.php';
require_once 'D2BitReader.php';
require_once 'D2Strings.php';
class D2Char {
public $cData; // char data output
public $items; // char item data
private $sData; // char file structure data
private $bData; // char binary data from d2s
private $bData; // char binary data from d2s
private $filePath; // .d2s file path
private $fp; // file pointer
@@ -23,10 +25,15 @@ class D2Char {
fseek($this->fp, $k);
$this->bData[$k] = fread($this->fp, $v);
}
$this->strings = new D2Strings();
return $this->parseChar();
}
public function parseItems(){
}
public function parseChar() {
$cData = null;
$cData['Identifier'] = bin2hex($this->bData[0]);
@@ -69,6 +76,8 @@ class D2Char {
$cData['NPCIntroductions'] = $this->bData[714];
$cData['filePath'] = $this->filePath;
$this->cData = $cData;
$this->parseItems();
return $this->cData;
}

11
src/D2Strings.php Normal file
View File

@@ -0,0 +1,11 @@
<?php
class D2Strings {
public array $strings;
public function __construct(){
$sql = "SELECT * FROM strings";
$this->strings = PDO_FetchAssoc($sql);
return $this->strings;
}
}