mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-12-21 06:43:58 -06:00
D2S Editor Pretty much finished, seems to be working 100%
This commit is contained in:
@@ -177,13 +177,19 @@ WHERE sk.charclass = '$class'";
|
||||
if ($cData['CharacterStatus'] == 'Hardcore Expansion') {
|
||||
$cData['CharacterProgression'] = $this->sData->characterProgressionExpHC[$progression];
|
||||
}
|
||||
if ($cData['CharacterStatus'] == "Expansion") {
|
||||
if (str_contains($cData['CharacterStatus'], "Expansion")) {
|
||||
$cData['CharacterProgression'] = $this->sData->characterProgressionExp[$progression];
|
||||
$cData['CharacterStatusExpansion'] = 1;
|
||||
}
|
||||
if ($cData['CharacterStatus'] == "Hardcore") {
|
||||
if (str_contains($cData['CharacterStatus'], "Hardcore")) {
|
||||
$cData['CharacterProgression'] = $this->sData->characterProgressionClassicHC[$progression];
|
||||
$cData['CharacterStatusHardcore'] = 1;
|
||||
}
|
||||
|
||||
if (str_contains($cData['CharacterStatus'], "Died")) {
|
||||
$cData['CharacterProgression'] = $this->sData->characterProgressionClassicHC[$progression];
|
||||
$cData['CharacterStatusDied'] = 1;
|
||||
}
|
||||
|
||||
$cData['CharacterClass'] = $this->sData->class[unpack('C', $this->bData[40])[1]];
|
||||
$cData['CharacterLevel'] = unpack('C', $this->bData[43])[1];
|
||||
$cData['Lastplayed'] = gmdate("Y-m-d\TH:i:s\Z", unpack('L', $this->bData[48])[0]);
|
||||
@@ -319,24 +325,53 @@ WHERE sk.charclass = '$class'";
|
||||
$len = $if - $gf;
|
||||
$stats = new D2BitReader($this->ByteReader->toBits($this->ByteReader->readh($gf, $len)));
|
||||
|
||||
$bits = $stats->getBits();
|
||||
$bits = $stats->getBits();
|
||||
$bytes = $this->ByteReader->toBytes($bits);
|
||||
|
||||
|
||||
|
||||
// var_dump($bits);
|
||||
// // Split the bits into 8-bit pieces
|
||||
// var_dump(str_split($bits, 8));
|
||||
|
||||
|
||||
/*
|
||||
* CSvBits for Example, how many bits they store
|
||||
Stat ID CSvBits
|
||||
strength 0 10
|
||||
energy 1 10
|
||||
dexterity 2 10
|
||||
vitality 3 10
|
||||
statpts 4 10
|
||||
newskills 5 8
|
||||
hitpoints 6 21
|
||||
maxhp 7 21
|
||||
mana 8 21
|
||||
maxmana 9 21
|
||||
stamina 10 21
|
||||
maxstamina 11 21
|
||||
level 12 7
|
||||
experience 13 32
|
||||
gold 14 25
|
||||
goldbank 15 25
|
||||
*/
|
||||
$stats->rewind();
|
||||
|
||||
$ids = []; // Array to store the encountered stat IDs
|
||||
// Iterate over the stats and collect their IDs
|
||||
for ($i = 0; $i <= count($this->ISC); $i++) {
|
||||
$id = hexdec($this->ByteReader->toBytesR($stats->readb(9)));
|
||||
|
||||
// Skip the bits corresponding to the stat if needed
|
||||
//var_dump("Offset Before Starting: " . $stats->getOffset());
|
||||
$id = hexdec($this->ByteReader->toBytesR($stats->readb(9))); // read 9 bits for stat id
|
||||
//var_dump("$id Stat Done: ". $stats->getOffset());
|
||||
// if ISC saves the stat, meaning CSVBits is set, it means it saves that my bits for this stat
|
||||
// then we can skip that many number of bits, so we can get the next stat id
|
||||
if ($this->ISC[$id]['CSvBits'] !== NULL && $this->ISC[$id]['CSvBits'] !== '') {
|
||||
$stats->skip($this->ISC[$id]['CSvBits']);
|
||||
$stats->skip($this->ISC[$id]['CSvBits']);
|
||||
//var_dump("Offset After Skipping Bits for $id: ". $stats->getOffset());
|
||||
|
||||
}
|
||||
|
||||
$ids[$id] = $id; // Store the ID in the array
|
||||
}
|
||||
|
||||
//ddump($ids);
|
||||
$stats->rewind();
|
||||
|
||||
$values = []; // Array to store the parsed stat values
|
||||
@@ -351,6 +386,9 @@ WHERE sk.charclass = '$class'";
|
||||
$values[$stat] = hexdec($this->ByteReader->toBytesR($val));
|
||||
}
|
||||
}
|
||||
|
||||
//ddump($values);
|
||||
|
||||
|
||||
// Perform additional calculations or conversions on specific stats
|
||||
$values['hitpoints'] = (int) round($values['hitpoints'] >> 11);
|
||||
|
||||
Reference in New Issue
Block a user