first in this branch

This commit is contained in:
Hash Borgir
2023-06-12 01:07:57 -06:00
parent e68dde2f23
commit 46a7bbd378
3 changed files with 147 additions and 13 deletions

View File

@@ -115,7 +115,6 @@ switch ($cmd) {
echo "Handling skills command - Skill: $name, Value: $value, File Path: $filePath";
break;
case "Died":
$char->setChar("CharacterStatus", "Died", $value); // Set the "CharacterStatusDied" value to the provided value
echo "Handling Died command - Value: $value, File Path: $filePath"; // Display a message indicating the handling of the Died command
@@ -258,12 +257,60 @@ switch ($cmd) {
fclose($fp);
break;
// stats commands
// stats commands
case "stats":
echo "Handling $name command. New value: $value";
$char->setStat($name, $value);
break;
// setallskills
case "setallskills":
echo "Handling $name command. New value: $value";
$char->setAllSkills($value);
break;
// q_all
case "q_all":
echo "Handling $name command. New value: $value";
$fp = fopen($filePath, "rb+");
$offsets = array_merge(array_keys($csData->qNorm), array_keys($csData->qNM), array_keys($csData->qHell));
$packValue1 = ($value == 1) ? 0xFE : 0x00;
$packValue2 = ($value == 1) ? 0xFF : 0x00;
foreach ($offsets as $k => $v) {
fseek($fp, $v);
fwrite($fp, pack('C', $packValue1));
fseek($fp, $v + 1);
fwrite($fp, pack('C', $packValue2));
}
$checksum = (shell_exec("bin\d2scs.exe \"$filePath\""));
break;
// wp_all
case "wp_all":
echo "Handling $name command. New value: $value";
$fp = fopen($filePath, "rb+");
// Determine the pack value based on the $value variable
$packValue = ($value == 1) ? 0xFF : 0x00;
// Define the WP offsets
$wp_offsets = [
643, 644, 645, 646, 647, // Norm
667, 668, 669, 670, 671, // NM
691, 692, 693, 694, 695 // Hell
];
// Iterate over the WP offsets
foreach ($wp_offsets as $offset) {
fseek($fp, $offset);
fwrite($fp, pack('C', $packValue));
}
$checksum = (shell_exec("bin\d2scs.exe \"$filePath\""));
break;
// default command
default:
// Handle unknown command