mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2024-11-30 04:26:03 +00:00
first in this branch
This commit is contained in:
parent
e68dde2f23
commit
46a7bbd378
56
res/app.js
56
res/app.js
@ -340,7 +340,7 @@ $(document).ready(function () {
|
||||
|
||||
var parentFormId = $(this).closest("form").attr("id");
|
||||
var parentFormClass = $(this).closest("form").attr("class");
|
||||
|
||||
|
||||
var filePath = $(`#${parentFormId} input[name='filePath']`).val();
|
||||
|
||||
// Construct the URL for the GET request
|
||||
@ -367,7 +367,7 @@ $(document).ready(function () {
|
||||
|
||||
var parentFormId = $(this).closest("form").attr("id");
|
||||
var parentFormClass = $(this).closest("form").attr("class");
|
||||
|
||||
|
||||
var filePath = $(`#${parentFormId} input[name='filePath']`).val();
|
||||
|
||||
|
||||
@ -400,14 +400,14 @@ $(document).ready(function () {
|
||||
return "/saveCharacter.php?cmd=" + cmd + "&name=" + name + "&value=" + value + "&filePath=" + filePath;
|
||||
}
|
||||
|
||||
$(".charform input[name='Difficulty'], .charform .skill, #CharacterName, #CharacterClass, #CharacterLevel, #CharacterClass, .stats input, .form-check-input, #statsdiv input").change(function () {
|
||||
$(".charform input[name='Difficulty'], .charform .skill, #CharacterName, #CharacterClass, #CharacterLevel, #CharacterClass, .stats input, .form-check-input, #statsdiv input,#setallskills,.wp_all,.q_all").change(function () {
|
||||
var name = $(this).attr("name");
|
||||
var newValue = $(this).val();
|
||||
|
||||
var cmd = $(this).attr("cmd") || $(this).attr("id") || name;
|
||||
var parentFormId = $(this).closest("form").attr("id");
|
||||
var parentFormClass = $(this).closest("form").attr("class");
|
||||
|
||||
|
||||
var filePath = $(`#${parentFormId} input[name='filePath']`).val();
|
||||
|
||||
var url = constructURL(cmd, name, newValue, filePath);
|
||||
@ -423,13 +423,54 @@ $(document).ready(function () {
|
||||
});
|
||||
});
|
||||
|
||||
// colorize the acts
|
||||
var acts = ['Act 1', 'Act 2', 'Act 3', 'Act 4', 'Act 5'];
|
||||
$('.q_all, .wp_all').click(function () {
|
||||
var parentFormId = $(this).closest("form").attr("id");
|
||||
var targetClass = $(this).attr('class') === 'q_all' ? `#${parentFormId} .qcheck` : `#${parentFormId} .wpcheck`;
|
||||
var isChecked = $(this).prop('checked');
|
||||
|
||||
$(targetClass).prop('checked', isChecked);
|
||||
});
|
||||
|
||||
|
||||
$('.qcheck').change(function () {
|
||||
var parentFormId = $(this).closest("form").attr("id");
|
||||
var qallChecked = $(`#${parentFormId} .qcheck:checked`).length === $(`#${parentFormId} .qcheck`).length;
|
||||
if (qallChecked == true) {
|
||||
var qchecked = 'checked';
|
||||
var val = 1;
|
||||
} else {
|
||||
qchecked = '';
|
||||
var val = 0;
|
||||
}
|
||||
$(`#${parentFormId} .q_all`).prop('checked', qchecked).val(val);
|
||||
});
|
||||
|
||||
$('.wpcheck').change(function () {
|
||||
var parentFormId = $(this).closest("form").attr("id");
|
||||
var wpallChecked = $(`#${parentFormId} .wpcheck:checked`).length === $(`#${parentFormId} .wpcheck`).length;
|
||||
if (wpallChecked == true) {
|
||||
var wpchecked = 'checked';
|
||||
var val = 1;
|
||||
} else {
|
||||
wpchecked = '';
|
||||
var val = 0;
|
||||
}
|
||||
$(`#${parentFormId} .wp_all`).prop('checked', wpchecked).val(val);
|
||||
});
|
||||
|
||||
$('#setallskills').change(function () {
|
||||
var value = $(this).val();
|
||||
var parentFormId = $(this).closest("form").attr("id");
|
||||
$(`#${parentFormId} .skill`).attr('value', value);
|
||||
});
|
||||
|
||||
|
||||
|
||||
// colorize the acts
|
||||
var acts = ['Act 1', 'Act 2', 'Act 3', 'Act 4', 'Act 5'];
|
||||
for (var i = 0; i < acts.length; i++) {
|
||||
var act = acts[i];
|
||||
var className = 'act' + (i + 1);
|
||||
|
||||
// Find the checkbox with a label containing the act
|
||||
$('input[type="checkbox"] + label:contains("' + act + '")').each(function () {
|
||||
// Add a class to the parent div
|
||||
@ -437,5 +478,4 @@ $(document).ready(function () {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
});// end document.ready
|
@ -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
|
||||
|
@ -294,8 +294,9 @@ HTML;
|
||||
foreach ($sortedArray as $index => $container) {
|
||||
$containerId = "container_" . $index;
|
||||
|
||||
if (empty($index)) $index = "Socketed";
|
||||
|
||||
if (empty($index))
|
||||
$index = "Socketed";
|
||||
|
||||
// Create accordion card for the container
|
||||
$items .= "<div class='card'>";
|
||||
$items .= "<div class='card-header' id='{$containerId}-heading'>";
|
||||
@ -341,6 +342,34 @@ HTML;
|
||||
|
||||
$items .= "</div>";
|
||||
|
||||
$qarray = ($c->cData['Quests'][0]);
|
||||
$qallOnes = 1;
|
||||
foreach ($qarray as $acts) {
|
||||
$values = array_values($acts);
|
||||
$result = array_reduce($values, function ($carry, $value) {
|
||||
return $carry && ($value === '1');
|
||||
}, 1);
|
||||
if (!$result) {
|
||||
$qallOnes = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$qchecked = $qallOnes ? "checked" : "";
|
||||
|
||||
$wparray = ($c->cData['Waypoints']);
|
||||
$wpallOnes = 1;
|
||||
foreach ($wparray as $acts) {
|
||||
$values = array_values($acts);
|
||||
$result = array_reduce($values, function ($carry, $value) {
|
||||
return $carry && ($value === '1');
|
||||
}, 1);
|
||||
if (!$result) {
|
||||
$wpallOnes = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$wpchecked = $wpallOnes ? "checked" : "";
|
||||
|
||||
$tabContent .= <<<EOT
|
||||
<div style="background: white; margin-top: 10px;" class="tab-pane fade" id="{$c->cData['CharacterName']}" role="tabpanel" aria-labelledby="{$c->cData['CharacterName']}-tab">
|
||||
<form id='{$c->cData['CharacterName']}' class="charform {$c->cData['CharacterName']}" method="POST" action="/saveCharacter.php">
|
||||
@ -426,6 +455,11 @@ $checkboxes
|
||||
$stats
|
||||
<div style="background:;">
|
||||
<h3 style="text-align: center">Skills</h3>
|
||||
<div class="form-group">
|
||||
<label for="setallskills">Set all skills:</label>
|
||||
<input type="number" id="setallskills" class="form-control setallskills" max="99">
|
||||
</div>
|
||||
|
||||
<div class="accordion" id="accordionExample">
|
||||
$skillDivs
|
||||
</div>
|
||||
@ -433,10 +467,23 @@ $checkboxes
|
||||
</div>
|
||||
<div class="col">
|
||||
<h3 style="text-align: center">Quests</h3>
|
||||
<div class="form-group">
|
||||
<div class="form-check">
|
||||
<label for="q_all" class="form-check-label">Enable/Disable All Quests</label>
|
||||
<input $qchecked type="checkbox" id="q_all" name="q_all" value="$qallOnes" class="form-check-input q_all">
|
||||
</div>
|
||||
</div>
|
||||
$quests
|
||||
</div>
|
||||
<div class="col">
|
||||
<h3 style="text-align: center">Waypoints</h3>
|
||||
<div class="form-group">
|
||||
<div class="form-check">
|
||||
<label for="wp_all" class="form-check-label">Enable/Disable All Waypoints</label>
|
||||
<input $wpchecked type="checkbox" id="wp_all" name="wp_all" value="$wpallOnes" class="form-check-input wp_all">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
$wps
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user