When armo/weap/misc drop down are selected, item display is properly updated, and item is properly saved, so far

This commit is contained in:
Hash Borgir 2023-05-30 18:43:17 -06:00
parent 87a9ca1658
commit ec45a9c1b6
3 changed files with 16 additions and 22 deletions

View File

@ -190,11 +190,13 @@ if ($cmd == 'delete') {
if ($cmd == "save") { if ($cmd == "save") {
$_GET['code'] = array_filter($_GET['code']);
$_GET['code'] = $_GET['code'][0];
unset($_GET['formtype']); unset($_GET['formtype']);
unset($_GET['submit']); unset($_GET['submit']);
unset($_GET['item']); unset($_GET['item']);
unset($_GET['cmd']); unset($_GET['cmd']);
// if ladder or carry1 is 0, set empty field. // if ladder or carry1 is 0, set empty field.
$_GET['ladder'] = $_GET['ladder'] ?? ''; $_GET['ladder'] = $_GET['ladder'] ?? '';
$_GET['carry1'] = $_GET['carry1'] ?? ''; $_GET['carry1'] = $_GET['carry1'] ?? '';

View File

@ -89,15 +89,15 @@ $(document).ready(function () {
$('[data-toggle="tooltip"]').tooltip() $('[data-toggle="tooltip"]').tooltip()
}) })
// armor/misc/weapons select dropdown chagne function // armor/misc/weapons select dropdown change function
$('.w-select').change(function () { $('.w-select').change(function () {
$('.a-select,.m-select').each(function (i, v) { $('.a-select,.m-select').each(function (i, v) {
v.value = ''; v.value = '';
v.required = ''; v.required = '';
}); });
x = $(this).find(':selected').text(); x = $(this).find('option:selected').text();
y = document.getElementById('item'); $("*[name='*type']").val(x);
y.value = x; $('.itemtype').html("("+x+")");
}); });
$('.a-select').change(function () { $('.a-select').change(function () {
@ -105,18 +105,18 @@ $(document).ready(function () {
v.value = ''; v.value = '';
v.required = ''; v.required = '';
}); });
x = $(this).find(':selected').text(); x = $(this).find('option:selected').text();
y = document.getElementById('item'); $("*[name='*type']").val(x);
y.value = x; $('.itemtype').html("("+x+")");
}); });
$('.m-select').change(function () { $('.m-select').change(function () {
$('.w-select,.a-select').each(function (i, v) { $('.w-select,.a-select').each(function (i, v) {
v.value = ''; v.value = '';
v.required = ''; v.required = '';
}); });
x = $(this).find(':selected').text(); x = $(this).find('option:selected').text();
y = document.getElementById('item'); $("*[name='*type']").val(x);
y.value = x; $('.itemtype').html("("+x+")");
}); });
$(".btnconfig").click(function () { $(".btnconfig").click(function () {
@ -197,6 +197,7 @@ $(document).ready(function () {
}); });
// cmd = getUniqueItem // cmd = getUniqueItem
$('.uniqueitems-select').change(function () { $('.uniqueitems-select').change(function () {

View File

@ -118,16 +118,7 @@
</span> </span>
<span class="form-text">Index: the ID pointer that is referenced by the game in TreasureClassEx.txt and CubeMain.txt, this column also contains the string-key used in the TBL files.</span> <span class="form-text">Index: the ID pointer that is referenced by the game in TreasureClassEx.txt and CubeMain.txt, this column also contains the string-key used in the TBL files.</span>
</div> </div>
<div class="col-2" style="background: #fec;">
<p>Code</p>
<div class="input-group">
<input name="code" type="text" aria-describedby="codeHelpBlock" required="required" class="form-control input-ucode">
</div><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
</span>
<span class="form-text">Enter a 3 or 4 letter unique item code</span>
</div>
<div class="col-2" style="background: #eed;"> <div class="col-2" style="background: #eed;">
<p>Version:</p> <p>Version:</p>
<div class="custom-control custom-radio custom-control-inline"> <div class="custom-control custom-radio custom-control-inline">
@ -217,7 +208,7 @@
<div class="col-2" style="background: #bbb;"> <div class="col-2" style="background: #bbb;">
<p>Armor</p> <p>Armor</p>
<select class="a-select custom-select code" name="code" required="required"> <select class="a-select custom-select code" name="code[]" required="required">
<option value=""></option> <option value=""></option>
<?php <?php
foreach ($armor as $a) foreach ($armor as $a)