mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2024-11-30 04:26:03 +00:00
Set active tab to Uniqueitems. header.php, set uniqueitems to first tab active.
ajax/uniqueitems.php, add save/delete functionality app.js, handle save/delete calls src/tabs/optionsubmit.php, add delete button tabs/UniqueItems.php remove form action Ajax save, and delete working.
This commit is contained in:
parent
961a061662
commit
1f7ac14963
@ -48,150 +48,197 @@ $idesc = new D2ItemDesc();
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!empty($_GET['cmd']))
|
$cmd = $_GET['cmd'] ?? '';
|
||||||
$cmd = $_GET['cmd'];
|
$sort = $_GET['sort'] ?? '';
|
||||||
if (!empty($_GET['sort']))
|
$view = $_GET['view'] ?? '';
|
||||||
$sort = $_GET['sort'];
|
|
||||||
if (!empty($_GET['view']))
|
|
||||||
$view = $_GET['view'];
|
|
||||||
/*
|
|
||||||
* @cmd = getUniqueItem
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* */
|
|
||||||
|
|
||||||
// first search code in all 3 tables. Grab from where it exists.
|
if ($_GET['cmd'] === "getUniqueItem") {
|
||||||
|
$index = $_GET['index'];
|
||||||
if ($cmd == "getUniqueItem") {
|
echo $idata->uniqueItems($index);
|
||||||
echo $idata->uniqueItems($_GET['index']);
|
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* @cmd = sortBy
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* */
|
|
||||||
if ($cmd == "sortBy") {
|
|
||||||
$sql = "SELECT `index`, `$sort` FROM uniqueitems WHERE enabled='1' ORDER BY ?";
|
|
||||||
$res = PDO_FetchAll($sql, [$sort]);
|
|
||||||
|
|
||||||
//ddump($res);
|
if ($cmd === "sortBy") {
|
||||||
|
$sql = "SELECT `index`, `$sort` FROM uniqueitems WHERE enabled='1' ORDER BY ? ASC";
|
||||||
$html = '';
|
$res = PDO_FetchAll($sql, [$sort]);
|
||||||
foreach ($res as $r) {
|
|
||||||
if ($sort == 'index') {
|
// Sort the results if the sorting is based on 'index'
|
||||||
$html .= "<option value=\"{$r['index']}\">{$r['index']}</option>";
|
if ($sort === 'index') {
|
||||||
} else {
|
sort($res);
|
||||||
$html .= "<option value=\"{$r['index']}\">$r[$sort] - {$r['index']}</option>";
|
}
|
||||||
}
|
|
||||||
}
|
// Generate HTML options based on the sorted results
|
||||||
echo $html;
|
$html = '';
|
||||||
|
foreach ($res as $r) {
|
||||||
|
if ($sort === 'index') {
|
||||||
|
$html .= "<option value=\"{$r['index']}\">{$r['index']}</option>";
|
||||||
|
} else {
|
||||||
|
$html .= "<option value=\"{$r['index']}\">$r[$sort] - {$r['index']}</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Output the generated HTML
|
||||||
|
echo $html;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* @cmd = viewOnly
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* */
|
//@cmd = viewOnly
|
||||||
|
|
||||||
if ($cmd == "viewOnly") {
|
if ($cmd == "viewOnly") {
|
||||||
|
|
||||||
$table = 'misc';
|
$table = 'misc';
|
||||||
$sql = "SELECT uniqueitems.`index`, uniqueitems.`code`, misc.`type`
|
$sql = "SELECT uniqueitems.`index`, uniqueitems.`code`, misc.`type`
|
||||||
FROM uniqueitems
|
FROM uniqueitems
|
||||||
LEFT JOIN misc ON uniqueitems.`code` = misc.`code`
|
LEFT JOIN misc ON uniqueitems.`code` = misc.`code`
|
||||||
WHERE `type` IS NOT NULL AND uniqueitems.`code`='$view'";
|
WHERE `type` IS NOT NULL AND uniqueitems.`code`='$view'";
|
||||||
if ($view == 'armo') {
|
if ($view == 'armo') {
|
||||||
$table = 'armor';
|
$table = 'armor';
|
||||||
$sql = "SELECT uniqueitems.`index`, uniqueitems.`code`, $table.`code`
|
$sql = "SELECT uniqueitems.`index`, uniqueitems.`code`, $table.`code`
|
||||||
FROM uniqueitems
|
FROM uniqueitems
|
||||||
LEFT JOIN $table ON uniqueitems.`code` = $table.`code`
|
LEFT JOIN $table ON uniqueitems.`code` = $table.`code`
|
||||||
WHERE `type` IS NOT NULL AND uniqueitems.`code`= $table.`code` AND $table.`code` != '' ORDER BY `index`";
|
WHERE `type` IS NOT NULL AND uniqueitems.`code`= $table.`code` AND $table.`code` != '' ORDER BY `index`";
|
||||||
}
|
}
|
||||||
if ($view == 'weap') {
|
if ($view == 'weap') {
|
||||||
$table = 'weapons';
|
$table = 'weapons';
|
||||||
$sql = "SELECT uniqueitems.`index`, uniqueitems.`code`, $table.`code`
|
$sql = "SELECT uniqueitems.`index`, uniqueitems.`code`, $table.`code`
|
||||||
FROM uniqueitems
|
FROM uniqueitems
|
||||||
LEFT JOIN $table ON uniqueitems.`code` = $table.`code`
|
LEFT JOIN $table ON uniqueitems.`code` = $table.`code`
|
||||||
WHERE `type` IS NOT NULL AND uniqueitems.`code`= $table.`code` AND $table.`code` != '' ORDER BY `index`";
|
WHERE `type` IS NOT NULL AND uniqueitems.`code`= $table.`code` AND $table.`code` != '' ORDER BY `index`";
|
||||||
}
|
}
|
||||||
if ($view == "char") { // charm
|
if ($view == "char") { // charm
|
||||||
$sql .= " OR uniqueitems.`code`='cm1' OR uniqueitems.`code`='cm2' OR uniqueitems.`code`='cm3'";
|
$sql .= " OR uniqueitems.`code`='cm1' OR uniqueitems.`code`='cm2' OR uniqueitems.`code`='cm3'";
|
||||||
}
|
}
|
||||||
$res = PDO_FetchAll($sql);
|
$res = PDO_FetchAll($sql);
|
||||||
$html = '';
|
$html = '';
|
||||||
foreach ($res as $r) {
|
foreach ($res as $r) {
|
||||||
if ($sort == 'index') {
|
if ($sort == 'index') {
|
||||||
$html .= "<option value=\"{$r['index']}\">{$r['index']}</option>";
|
$html .= "<option value=\"{$r['index']}\">{$r['index']}</option>";
|
||||||
} else {
|
} else {
|
||||||
$html .= "<option value=\"{$r['index']}\">{$r['index']}</option>";
|
$html .= "<option value=\"{$r['index']}\">{$r['index']}</option>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo $html;
|
echo $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// @cmd = search
|
||||||
* @cmd = search
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if ($cmd == 'search') {
|
if ($cmd == 'search') {
|
||||||
$search = $_GET['search'];
|
$search = $_GET['search'];
|
||||||
$sql = "SELECT * FROM uniqueitems WHERE `index` LIKE '%$search%' OR code LIKE '%$search%' AND enabled=1 ORDER BY `index`";
|
$sql = "SELECT * FROM uniqueitems WHERE `index` LIKE '%$search%' OR code LIKE '%$search%' AND enabled=1 ORDER BY `index`";
|
||||||
$res = PDO_FetchAll($sql);
|
$res = PDO_FetchAll($sql);
|
||||||
|
|
||||||
$html = '';
|
$html = '';
|
||||||
foreach ($res as $r) {
|
foreach ($res as $r) {
|
||||||
if ($sort == 'index') {
|
if ($sort == 'index') {
|
||||||
$html .= "<option value=\"{$r['index']}\">{$r['index']}</option>";
|
$html .= "<option value=\"{$r['index']}\">{$r['index']}</option>";
|
||||||
} else {
|
} else {
|
||||||
$html .= "<option value=\"{$r['index']}\">{$r['index']}</option>";
|
$html .= "<option value=\"{$r['index']}\">{$r['index']}</option>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo $html;
|
echo $html;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
// @cmd = getString
|
||||||
* @cmd = getString
|
// @arg = property, par, min, max
|
||||||
*
|
|
||||||
* @arg = property, par, min, max
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
if ($cmd == 'getString') {
|
if ($cmd == 'getString') {
|
||||||
|
$prop = $_GET['prop'];
|
||||||
|
|
||||||
$prop = $_GET['prop'];
|
|
||||||
|
|
||||||
// stat2,stat3,stat4,stat5,stat6,stat7
|
// stat2,stat3,stat4,stat5,stat6,stat7
|
||||||
|
if (!empty($prop)) {
|
||||||
$sql = "SELECT stat1 FROM properties WHERE code = ?";
|
$sql = "SELECT stat1 FROM properties WHERE code = ?";
|
||||||
$stat = array_filter(PDO_FetchRow($sql, [$prop]));
|
$stat = array_filter(PDO_FetchRow($sql, [$prop]));
|
||||||
|
$s = array_filter($idata->getIscStrings($prop));
|
||||||
|
|
||||||
$s = array_filter($idata->getIscStrings($prop));
|
// now combine isc strings with par, min, max
|
||||||
|
$params = array_merge($_GET, $s);
|
||||||
// now combine isc strings with par, min, max
|
$return = $idesc->getDesc($params);
|
||||||
|
}
|
||||||
$params = array_merge($_GET, $s);
|
/* This goes into D2ItemDesc->getDesc();
|
||||||
|
$s1 = $params['string1'];
|
||||||
|
$s2 = $params['string2'];
|
||||||
|
$prop = $params['prop'];
|
||||||
|
$par = $params['par'];
|
||||||
|
$min = (int) $params['min'];
|
||||||
|
@return string
|
||||||
|
*/
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
$return = $idesc->getDesc($params);
|
echo json_encode($return, JSON_INVALID_UTF8_IGNORE);
|
||||||
|
|
||||||
/*
|
|
||||||
* This goes into D2ItemDesc->getDesc();
|
|
||||||
*
|
|
||||||
$s1 = $params['string1'];
|
|
||||||
$s2 = $params['string2'];
|
|
||||||
$prop = $params['prop'];
|
|
||||||
$par = $params['par'];
|
|
||||||
$min = (int) $params['min'];
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
|
||||||
echo json_encode($return, JSON_INVALID_UTF8_IGNORE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function saveFile() {
|
||||||
|
$bin = '..\bin\sqlite3.exe ';
|
||||||
|
$dbfile = '../' . $_SESSION['modname'] . ".db";
|
||||||
|
$outputFile = TXT_PATH . 'uniqueitems.txt';
|
||||||
|
|
||||||
|
// Prepare the command
|
||||||
|
$command = escapeshellarg($bin) . " " . escapeshellarg($dbfile) . ' ".mode tabs" ".header on" "SELECT * FROM uniqueitems;" > ' . escapeshellarg($outputFile);
|
||||||
|
$output = exec($command);
|
||||||
|
var_dump($command);
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($cmd == 'delete') {
|
||||||
|
|
||||||
|
$sql = "DELETE FROM uniqueitems WHERE `index` = \"{$_GET['index']}\";";
|
||||||
|
$res = PDO_Execute($sql);
|
||||||
|
saveFile();
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode($res, JSON_INVALID_UTF8_IGNORE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ($cmd == "save") {
|
||||||
|
unset($_GET['formtype']);
|
||||||
|
unset($_GET['submit']);
|
||||||
|
unset($_GET['item']);
|
||||||
|
unset($_GET['cmd']);
|
||||||
|
|
||||||
|
// if ladder or carry1 is 0, set empty field.
|
||||||
|
$_GET['ladder'] = $_GET['ladder'] ?? '';
|
||||||
|
$_GET['carry1'] = $_GET['carry1'] ?? '';
|
||||||
|
|
||||||
|
$index = $_GET['index'];
|
||||||
|
$sql = "SELECT COUNT(*) FROM uniqueitems WHERE `index` = ?";
|
||||||
|
|
||||||
|
$indexExists = PDO_FetchOne($sql, [$index]);
|
||||||
|
$columns = array_keys($_GET);
|
||||||
|
|
||||||
|
// Build the INSERT query
|
||||||
|
$insertQuery = 'INSERT INTO uniqueitems (';
|
||||||
|
foreach ($_GET as $k => $v) {
|
||||||
|
$column = str_replace("_", " ", $k);
|
||||||
|
$insertQuery .= "`$column`, ";
|
||||||
|
}
|
||||||
|
$insertQuery = rtrim($insertQuery, ", ");
|
||||||
|
$insertQuery .= ") VALUES (";
|
||||||
|
foreach ($_GET as $k => $v) {
|
||||||
|
$insertQuery .= "\"$v\", ";
|
||||||
|
}
|
||||||
|
$insertQuery = rtrim($insertQuery, ", ");
|
||||||
|
$insertQuery .= ")";
|
||||||
|
|
||||||
|
// Build the UPDATE query
|
||||||
|
$updateQuery = 'UPDATE uniqueitems SET ';
|
||||||
|
|
||||||
|
foreach ($_GET as $k => $v) {
|
||||||
|
$column = str_replace("_", " ", $k);
|
||||||
|
$updateQuery .= "`$column` = \"$v\", ";
|
||||||
|
}
|
||||||
|
$updateQuery = rtrim($updateQuery, ", ");
|
||||||
|
|
||||||
|
$updateQuery .= " WHERE `index`=\"$index\"";
|
||||||
|
|
||||||
|
if ($indexExists) {
|
||||||
|
$res = PDO_Execute($updateQuery);
|
||||||
|
} else {
|
||||||
|
$res = PDO_Execute($insertQuery);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$output = saveFile();
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
echo json_encode($output, JSON_INVALID_UTF8_IGNORE);
|
||||||
|
}
|
855
res/app.js
855
res/app.js
@ -1,29 +1,29 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
Copyright (C) 2021 Hash Borgir
|
Copyright (C) 2021 Hash Borgir
|
||||||
|
|
||||||
This file is part of D2Modder
|
This file is part of D2Modder
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with
|
Redistribution and use in source and binary forms, with
|
||||||
or without modification, are permitted provided that the
|
or without modification, are permitted provided that the
|
||||||
following conditions are met:
|
following conditions are met:
|
||||||
|
|
||||||
* Redistributions of source code must retain the above
|
* Redistributions of source code must retain the above
|
||||||
copyright notice, this list of conditions and the
|
copyright notice, this list of conditions and the
|
||||||
following disclaimer.
|
following disclaimer.
|
||||||
|
|
||||||
* Redistributions in binary form must reproduce the above
|
* Redistributions in binary form must reproduce the above
|
||||||
copyright notice, this list of conditions and the
|
copyright notice, this list of conditions and the
|
||||||
following disclaimer in the documentation and/or other
|
following disclaimer in the documentation and/or other
|
||||||
materials provided with the distribution.
|
materials provided with the distribution.
|
||||||
|
|
||||||
* This software must not be used for commercial purposes
|
* This software must not be used for commercial purposes
|
||||||
* without my consent. Any sales or commercial use are prohibited
|
* without my consent. Any sales or commercial use are prohibited
|
||||||
* without my express knowledge and consent.
|
* without my express knowledge and consent.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY!
|
but WITHOUT ANY WARRANTY!
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||||
@ -37,110 +37,110 @@
|
|||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||||
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
*/
|
||||||
|
// highlight json dump for item debugger
|
||||||
function syntaxHighlight(json) {
|
function syntaxHighlight(json) {
|
||||||
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
||||||
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
|
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) {
|
||||||
var cls = 'number';
|
var cls = 'number';
|
||||||
if (/^"/.test(match)) {
|
if (/^"/.test(match)) {
|
||||||
if (/:$/.test(match)) {
|
if (/:$/.test(match)) {
|
||||||
cls = 'key';
|
cls = 'key';
|
||||||
} else {
|
} else {
|
||||||
cls = 'string';
|
cls = 'string';
|
||||||
}
|
}
|
||||||
} else if (/true|false/.test(match)) {
|
} else if (/true|false/.test(match)) {
|
||||||
cls = 'boolean';
|
cls = 'boolean';
|
||||||
} else if (/null/.test(match)) {
|
} else if (/null/.test(match)) {
|
||||||
cls = 'null';
|
cls = 'null';
|
||||||
}
|
}
|
||||||
return '<span class="' + cls + '">' + match + '</span>';
|
return '<span class="' + cls + '">' + match + '</span>';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function search() {
|
function search() {
|
||||||
$.get("/ajax/uniqueitems.php?cmd=search&search=" + searchbox.value, function (data) {
|
$.get("/ajax/uniqueitems.php?cmd=search&search=" + searchbox.value, function (data) {
|
||||||
$('.uniqueitems-select').html(data)
|
$('.uniqueitems-select').html(data)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function capitalizeFirstLetter(string) {
|
function capitalizeFirstLetter(string) {
|
||||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$('.form-text').hide();
|
$('.form-text').hide();
|
||||||
$('.help').click(function () {
|
$('.help').click(function () {
|
||||||
// $('.form-text').slideToggle();
|
// $('.form-text').slideToggle();
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.op1').val(this.checked);
|
$('.op1').val(this.checked);
|
||||||
$('.op1').change(function () {
|
$('.op1').change(function () {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
$('option[disabled="disabled"]').hide();
|
$('option[disabled="disabled"]').hide();
|
||||||
} else {
|
} else {
|
||||||
$('option[disabled="disabled"]').show();
|
$('option[disabled="disabled"]').show();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
$('[data-toggle="tooltip"]').tooltip()
|
$('[data-toggle="tooltip"]').tooltip()
|
||||||
})
|
})
|
||||||
|
|
||||||
$('.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(':selected').text();
|
||||||
y = document.getElementById('item');
|
y = document.getElementById('item');
|
||||||
y.value = x;
|
y.value = x;
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.a-select').change(function () {
|
$('.a-select').change(function () {
|
||||||
$('.w-select,.m-select').each(function (i, v) {
|
$('.w-select,.m-select').each(function (i, v) {
|
||||||
v.value = '';
|
v.value = '';
|
||||||
v.required = '';
|
v.required = '';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
x = $(this).find(':selected').text();
|
x = $(this).find(':selected').text();
|
||||||
y = document.getElementById('item');
|
y = document.getElementById('item');
|
||||||
y.value = x;
|
y.value = 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(':selected').text();
|
||||||
y = document.getElementById('item');
|
y = document.getElementById('item');
|
||||||
y.value = x;
|
y.value = x;
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".btnconfig").click(function () {
|
$(".btnconfig").click(function () {
|
||||||
$(".ctrl-config").hide();
|
$(".ctrl-config").hide();
|
||||||
$("#loading").show();
|
$("#loading").show();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.help').click(function () {
|
$('.help').click(function () {
|
||||||
$(".fa-help").remove();
|
$(".fa-help").remove();
|
||||||
$(this).next().fadeToggle().focus().css({
|
$(this).next().fadeToggle().focus().css({
|
||||||
"position": "absolute",
|
"position": "absolute",
|
||||||
"z-index": "1000",
|
"z-index": "1000",
|
||||||
"background": "#eee",
|
"background": "#eee",
|
||||||
"color": "black !important",
|
"color": "black !important",
|
||||||
"border": "1px solid #aaa",
|
"border": "1px solid #aaa",
|
||||||
"width": "300px",
|
"width": "300px",
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
||||||
// $('.help').prev().hover(function () {
|
// $('.help').prev().hover(function () {
|
||||||
// $(".fa-help").remove();
|
// $(".fa-help").remove();
|
||||||
@ -152,348 +152,356 @@ $(document).ready(function () {
|
|||||||
// "border": "1px solid #aaa",
|
// "border": "1px solid #aaa",
|
||||||
// "width": "300px",
|
// "width": "300px",
|
||||||
// })
|
// })
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('.form-text').click(function () {
|
$('.form-text').click(function () {
|
||||||
$(this).fadeOut("slow");
|
$(this).fadeOut("slow");
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('').change(function () {
|
|
||||||
if (this.checked) {
|
|
||||||
$('option[disabled="disabled"]').hide();
|
|
||||||
} else {
|
|
||||||
$('option[disabled="disabled"]').show();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('input[name="invfile"]').keyup(function(){
|
|
||||||
invImg = docpath + '/img/items/' + this.value + ".png";
|
|
||||||
$(".item").attr("src", invImg);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// every time we change a prop dropdown,
|
|
||||||
//
|
|
||||||
// 1 send to server,
|
|
||||||
// 2 grab string,
|
|
||||||
// 3 update item display
|
|
||||||
$('select[name^="prop"]').change(function () {
|
|
||||||
prop = capitalizeFirstLetter($(this).attr("name"));
|
|
||||||
propNum = prop.substring(4);
|
|
||||||
par = $(this).next().val();
|
|
||||||
min = $(this).next().next().val();
|
|
||||||
max = $(this).next().next().next().val();
|
|
||||||
|
|
||||||
val = escape(this.value);
|
$('').change(function () {
|
||||||
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
if (this.checked) {
|
||||||
console.log(data);
|
$('option[disabled="disabled"]').hide();
|
||||||
$(`.item_stats ul .${prop}`).html(data);
|
} else {
|
||||||
});
|
$('option[disabled="disabled"]').show();
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/*
|
$('input[name="invfile"]').keyup(function () {
|
||||||
* Properties/par/min/max onchange function, updated item string stats
|
invImg = docpath + '/img/items/' + this.value + ".png";
|
||||||
*
|
$(".item").attr("src", invImg);
|
||||||
*
|
});
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
|
|
||||||
$('.par1, .min1, .max1').change(function () {
|
|
||||||
prop = "Prop1";
|
|
||||||
|
|
||||||
par = $('.par1').val();
|
|
||||||
if (par == '')
|
|
||||||
par = 0;
|
|
||||||
min = $('.min1').val();
|
|
||||||
max = $('.max1').val();
|
|
||||||
|
|
||||||
val = escape($("*[name='prop1'").val());
|
|
||||||
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
|
||||||
console.log(data);
|
|
||||||
$(`.item_stats ul .${prop}`).html(data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.par2, .min2, .max2').change(function () {
|
|
||||||
prop = "Prop2";
|
|
||||||
|
|
||||||
par = $('.par2').val();
|
|
||||||
if (par == '')
|
|
||||||
par = 0;
|
|
||||||
min = $('.min2').val();
|
|
||||||
max = $('.max2').val();
|
|
||||||
|
|
||||||
val = escape($("*[name='prop2'").val());
|
|
||||||
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
|
||||||
console.log(data);
|
|
||||||
$(`.item_stats ul .${prop}`).html(data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.par3, .min3, .max3').change(function () {
|
|
||||||
prop = "Prop3";
|
|
||||||
|
|
||||||
par = $('.par3').val();
|
|
||||||
if (par == '')
|
|
||||||
par = 0;
|
|
||||||
min = $('.min3').val();
|
|
||||||
max = $('.max3').val();
|
|
||||||
|
|
||||||
val = escape($("*[name='prop3'").val());
|
|
||||||
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
|
||||||
console.log(data);
|
|
||||||
$(`.item_stats ul .${prop}`).html(data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.par4, .min4, .max4').change(function () {
|
|
||||||
prop = "Prop4";
|
|
||||||
|
|
||||||
par = $('.par4').val();
|
|
||||||
if (par == '')
|
|
||||||
par = 0;
|
|
||||||
min = $('.min4').val();
|
|
||||||
max = $('.max4').val();
|
|
||||||
|
|
||||||
val = escape($("*[name='prop4'").val());
|
|
||||||
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
|
||||||
console.log(data);
|
|
||||||
$(`.item_stats ul .${prop}`).html(data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('.par5, .min5, .max5').change(function () {
|
// every time we change a prop dropdown,
|
||||||
prop = "Prop5";
|
//
|
||||||
|
// 1 send to server,
|
||||||
par = $('.par5').val();
|
// 2 grab string,
|
||||||
if (par == '') par = 0;
|
// 3 update item display
|
||||||
min = $('.min5').val();
|
$('select[name^="prop"]').change(function () {
|
||||||
max = $('.max5').val();
|
prop = capitalizeFirstLetter($(this).attr("name"));
|
||||||
|
propNum = prop.substring(4);
|
||||||
|
par = $(this).next().val();
|
||||||
|
min = $(this).next().next().val();
|
||||||
|
max = $(this).next().next().next().val();
|
||||||
|
|
||||||
val = escape($("*[name='prop5'").val());
|
val = escape(this.value);
|
||||||
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
||||||
console.log(data);
|
console.log(data);
|
||||||
$(`.item_stats ul .${prop}`).html(data);
|
$(`.item_stats ul .${prop}`).html(data);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.par6, .min6, .max6').change(function () {
|
|
||||||
prop = "Prop6";
|
|
||||||
|
|
||||||
par = $('.par6').val();
|
|
||||||
if (par == '') par = 0;
|
|
||||||
min = $('.min6').val();
|
|
||||||
max = $('.max6').val();
|
|
||||||
|
|
||||||
val = escape($("*[name='prop6'").val());
|
|
||||||
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
|
||||||
console.log(data);
|
|
||||||
$(`.item_stats ul .${prop}`).html(data);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
$('.par7, .min7, .max7').change(function () {
|
/*
|
||||||
prop = "Prop7";
|
* Properties/par/min/max onchange function, updated item string stats
|
||||||
|
*
|
||||||
par = $('.par7').val();
|
*
|
||||||
if (par == '') par = 0;
|
*
|
||||||
min = $('.min7').val();
|
*
|
||||||
max = $('.max7').val();
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
|
||||||
val = escape($("*[name='prop7'").val());
|
**/
|
||||||
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
|
||||||
console.log(data);
|
|
||||||
$(`.item_stats ul .${prop}`).html(data);
|
$('.par1, .min1, .max1').change(function () {
|
||||||
});
|
prop = "Prop1";
|
||||||
});
|
|
||||||
|
par = $('.par1').val();
|
||||||
|
if (par == '')
|
||||||
|
par = 0;
|
||||||
|
min = $('.min1').val();
|
||||||
|
max = $('.max1').val();
|
||||||
|
|
||||||
|
val = escape($("*[name='prop1'").val());
|
||||||
|
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
||||||
|
console.log(data);
|
||||||
|
$(`.item_stats ul .${prop}`).html(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.par2, .min2, .max2').change(function () {
|
||||||
|
prop = "Prop2";
|
||||||
|
|
||||||
|
par = $('.par2').val();
|
||||||
|
if (par == '')
|
||||||
|
par = 0;
|
||||||
|
min = $('.min2').val();
|
||||||
|
max = $('.max2').val();
|
||||||
|
|
||||||
|
val = escape($("*[name='prop2'").val());
|
||||||
|
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
||||||
|
console.log(data);
|
||||||
|
$(`.item_stats ul .${prop}`).html(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.par3, .min3, .max3').change(function () {
|
||||||
|
prop = "Prop3";
|
||||||
|
|
||||||
|
par = $('.par3').val();
|
||||||
|
if (par == '')
|
||||||
|
par = 0;
|
||||||
|
min = $('.min3').val();
|
||||||
|
max = $('.max3').val();
|
||||||
|
|
||||||
|
val = escape($("*[name='prop3'").val());
|
||||||
|
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
||||||
|
console.log(data);
|
||||||
|
$(`.item_stats ul .${prop}`).html(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.par4, .min4, .max4').change(function () {
|
||||||
|
prop = "Prop4";
|
||||||
|
|
||||||
|
par = $('.par4').val();
|
||||||
|
if (par == '')
|
||||||
|
par = 0;
|
||||||
|
min = $('.min4').val();
|
||||||
|
max = $('.max4').val();
|
||||||
|
|
||||||
|
val = escape($("*[name='prop4'").val());
|
||||||
|
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
||||||
|
console.log(data);
|
||||||
|
$(`.item_stats ul .${prop}`).html(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('.par5, .min5, .max5').change(function () {
|
||||||
|
prop = "Prop5";
|
||||||
|
|
||||||
|
par = $('.par5').val();
|
||||||
|
if (par == '')
|
||||||
|
par = 0;
|
||||||
|
min = $('.min5').val();
|
||||||
|
max = $('.max5').val();
|
||||||
|
|
||||||
|
val = escape($("*[name='prop5'").val());
|
||||||
|
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
||||||
|
console.log(data);
|
||||||
|
$(`.item_stats ul .${prop}`).html(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$('.par6, .min6, .max6').change(function () {
|
||||||
|
prop = "Prop6";
|
||||||
|
|
||||||
|
par = $('.par6').val();
|
||||||
|
if (par == '')
|
||||||
|
par = 0;
|
||||||
|
min = $('.min6').val();
|
||||||
|
max = $('.max6').val();
|
||||||
|
|
||||||
|
val = escape($("*[name='prop6'").val());
|
||||||
|
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
||||||
|
console.log(data);
|
||||||
|
$(`.item_stats ul .${prop}`).html(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('.par7, .min7, .max7').change(function () {
|
||||||
|
prop = "Prop7";
|
||||||
|
|
||||||
|
par = $('.par7').val();
|
||||||
|
if (par == '')
|
||||||
|
par = 0;
|
||||||
|
min = $('.min7').val();
|
||||||
|
max = $('.max7').val();
|
||||||
|
|
||||||
|
val = escape($("*[name='prop7'").val());
|
||||||
|
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
||||||
|
console.log(data);
|
||||||
|
$(`.item_stats ul .${prop}`).html(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('.par8, .min8, .max8').change(function () {
|
$('.par8, .min8, .max8').change(function () {
|
||||||
prop = "Prop8";
|
prop = "Prop8";
|
||||||
|
|
||||||
par = $('.par8').val();
|
|
||||||
if (par == '') par = 0;
|
|
||||||
min = $('.min8').val();
|
|
||||||
max = $('.max8').val();
|
|
||||||
|
|
||||||
val = escape($("*[name='prop8'").val());
|
par = $('.par8').val();
|
||||||
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
if (par == '')
|
||||||
console.log(data);
|
par = 0;
|
||||||
$(`.item_stats ul .${prop}`).html(data);
|
min = $('.min8').val();
|
||||||
});
|
max = $('.max8').val();
|
||||||
});
|
|
||||||
|
val = escape($("*[name='prop8'").val());
|
||||||
|
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
||||||
|
console.log(data);
|
||||||
|
$(`.item_stats ul .${prop}`).html(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$('.par9, .min9, .max9').change(function () {
|
$('.par9, .min9, .max9').change(function () {
|
||||||
prop = "Prop9";
|
prop = "Prop9";
|
||||||
|
|
||||||
par = $('.par9').val();
|
|
||||||
if (par == '') par = 0;
|
|
||||||
min = $('.min9').val();
|
|
||||||
max = $('.max9').val();
|
|
||||||
|
|
||||||
val = escape($("*[name='prop9'").val());
|
par = $('.par9').val();
|
||||||
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
if (par == '')
|
||||||
console.log(data);
|
par = 0;
|
||||||
$(`.item_stats ul .${prop}`).html(data);
|
min = $('.min9').val();
|
||||||
});
|
max = $('.max9').val();
|
||||||
});
|
|
||||||
|
val = escape($("*[name='prop9'").val());
|
||||||
|
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
||||||
|
console.log(data);
|
||||||
|
$(`.item_stats ul .${prop}`).html(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$('.par10, .min10, .max10').change(function () {
|
$('.par10, .min10, .max10').change(function () {
|
||||||
prop = "Prop10";
|
prop = "Prop10";
|
||||||
|
|
||||||
par = $('.par10').val();
|
|
||||||
if (par == '') par = 0;
|
|
||||||
min = $('.min10').val();
|
|
||||||
max = $('.max10').val();
|
|
||||||
|
|
||||||
val = escape($("*[name='prop10'").val());
|
par = $('.par10').val();
|
||||||
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
if (par == '')
|
||||||
console.log(data);
|
par = 0;
|
||||||
$(`.item_stats ul .${prop}`).html(data);
|
min = $('.min10').val();
|
||||||
});
|
max = $('.max10').val();
|
||||||
});
|
|
||||||
|
val = escape($("*[name='prop10'").val());
|
||||||
|
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
||||||
|
console.log(data);
|
||||||
|
$(`.item_stats ul .${prop}`).html(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
$('.par11, .min11, .max11').change(function () {
|
$('.par11, .min11, .max11').change(function () {
|
||||||
prop = "Prop11";
|
prop = "Prop11";
|
||||||
|
|
||||||
par = $('.par11').val();
|
|
||||||
if (par == '') par = 0;
|
|
||||||
min = $('.min11').val();
|
|
||||||
max = $('.max11').val();
|
|
||||||
|
|
||||||
val = escape($("*[name='prop11'").val());
|
par = $('.par11').val();
|
||||||
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
if (par == '')
|
||||||
console.log(data);
|
par = 0;
|
||||||
$(`.item_stats ul .${prop}`).html(data);
|
min = $('.min11').val();
|
||||||
});
|
max = $('.max11').val();
|
||||||
});
|
|
||||||
|
|
||||||
$('.par12, .min12, .max12').change(function () {
|
val = escape($("*[name='prop11'").val());
|
||||||
prop = "Prop12";
|
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
||||||
|
console.log(data);
|
||||||
par = $('.par12').val();
|
$(`.item_stats ul .${prop}`).html(data);
|
||||||
if (par == '') par = 0;
|
});
|
||||||
min = $('.min12').val();
|
});
|
||||||
max = $('.max12').val();
|
|
||||||
|
|
||||||
val = escape($("*[name='prop12'").val());
|
$('.par12, .min12, .max12').change(function () {
|
||||||
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
prop = "Prop12";
|
||||||
console.log(data);
|
|
||||||
$(`.item_stats ul .${prop}`).html(data);
|
par = $('.par12').val();
|
||||||
});
|
if (par == '')
|
||||||
});
|
par = 0;
|
||||||
|
min = $('.min12').val();
|
||||||
|
max = $('.max12').val();
|
||||||
|
|
||||||
|
val = escape($("*[name='prop12'").val());
|
||||||
|
$.get(`/ajax/uniqueitems.php?cmd=getString&prop=${val}&par=${par}&min=${min}&max=${max}`, function (data) {
|
||||||
|
console.log(data);
|
||||||
|
$(`.item_stats ul .${prop}`).html(data);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
* END on change for inputs
|
* END on change for inputs
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* update item index, lvl, lvl req
|
* update item index, lvl, lvl req
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
$("input[name='index']").keyup(function(){
|
$("input[name='index']").keyup(function () {
|
||||||
$(".itemindex").html($(this).val());
|
$(".itemindex").html($(this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
$('input[name="lvl"]').keyup(function(){
|
$('input[name="lvl"]').keyup(function () {
|
||||||
$(".itemlvl").html("Level: "+$(this).val());
|
$(".itemlvl").html("Level: " + $(this).val());
|
||||||
});
|
});
|
||||||
$('input[name="lvl req"]').keyup(function(){
|
$('input[name="lvl req"]').keyup(function () {
|
||||||
$(".itemlvlreq").html("Level Required: "+$(this).val());
|
$(".itemlvlreq").html("Level Required: " + $(this).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// cmd = getUniqueItem
|
// cmd = getUniqueItem
|
||||||
$('.uniqueitems-select').change(function () {
|
$('.uniqueitems-select').change(function () {
|
||||||
|
|
||||||
$(".item").attr("src", "/img/items/1.png");
|
$(".item").attr("src", "/img/items/1.png");
|
||||||
$(".item_debug_link").attr('href', "/ajax/uniqueitems.php?cmd=getUniqueItem&index=" + this.value)
|
$(".item_debug_link").attr('href', "/ajax/uniqueitems.php?cmd=getUniqueItem&index=" + this.value)
|
||||||
$.get("/ajax/uniqueitems.php?cmd=getUniqueItem&index=" + this.value, function (data) {
|
$.get("/ajax/uniqueitems.php?cmd=getUniqueItem&index=" + this.value, function (data) {
|
||||||
|
|
||||||
|
|
||||||
debugData = (JSON.stringify(data, null, 4));
|
debugData = (JSON.stringify(data, null, 4));
|
||||||
$('.debug, .debug_preview').html(syntaxHighlight(debugData));
|
$('.debug, .debug_preview').html(syntaxHighlight(debugData));
|
||||||
props = data.props;
|
props = data.props;
|
||||||
|
|
||||||
// update preview
|
// update preview
|
||||||
//$('.item_stats div').hide().html("<p></p>");
|
//$('.item_stats div').hide().html("<p></p>");
|
||||||
|
|
||||||
invImg = docpath + '/img/items/' + data.invfile + ".png";
|
invImg = docpath + '/img/items/' + data.invfile + ".png";
|
||||||
$(".item").attr("src", invImg);
|
$(".item").attr("src", invImg);
|
||||||
$(".item").onerror = function () {
|
$(".item").onerror = function () {
|
||||||
invImg = "/img/items/" + data.invfile + ".png";
|
invImg = "/img/items/" + data.invfile + ".png";
|
||||||
this.src = invImg;
|
this.src = invImg;
|
||||||
};
|
};
|
||||||
|
|
||||||
type = data["*type"];
|
type = data["*type"];
|
||||||
lvlreq = data["lvl req"];
|
lvlreq = data["lvl req"];
|
||||||
|
|
||||||
base = data.baseItemInfo;
|
base = data.baseItemInfo;
|
||||||
|
|
||||||
$('.item_stats ul .itemindex').html(data.index);
|
$('.item_stats ul .itemindex').html(data.index);
|
||||||
$('.item_stats ul .itemtype').html(`(${type})`);
|
$('.item_stats ul .itemtype').html(`(${type})`);
|
||||||
$('.item_stats ul .itemlvl').html(`Level: ${base.level}`);
|
$('.item_stats ul .itemlvl').html(`Level: ${base.level}`);
|
||||||
$('.item_stats ul .itemlvlreq').html(`Level Required: ${lvlreq}`);
|
$('.item_stats ul .itemlvlreq').html(`Level Required: ${lvlreq}`);
|
||||||
|
|
||||||
$('.item_stats ul .itemcode').html(`Item Code: (${base.code})`);
|
$('.item_stats ul .itemcode').html(`Item Code: (${base.code})`);
|
||||||
|
|
||||||
if (base.reqstr) {
|
if (base.reqstr) {
|
||||||
$('.item_stats ul .itemstreq').html(`Required Strength: ${base.reqstr}`);
|
$('.item_stats ul .itemstreq').html(`Required Strength: ${base.reqstr}`);
|
||||||
}
|
}
|
||||||
if (base.reqdex) {
|
if (base.reqdex) {
|
||||||
$('.item_stats ul .itemdexreq').html(`Required Dexterity: ${base.reqdex}`);
|
$('.item_stats ul .itemdexreq').html(`Required Dexterity: ${base.reqdex}`);
|
||||||
}
|
}
|
||||||
if (base['gemsockets']) {
|
if (base['gemsockets']) {
|
||||||
$('.item_stats ul .itemgemsockets').html(`Max Sockets: (${base.gemsockets})`);
|
$('.item_stats ul .itemgemsockets').html(`Max Sockets: (${base.gemsockets})`);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* THIS LINE BREAKS hidden fields and set them to blank.
|
* THIS LINE BREAKS hidden fields and set them to blank.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$('.props-container select, .props-container input').val('');
|
$('.props-container select, .props-container input').val('');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$('.item_stats ul .blue').each(function (i, v) {
|
$('.item_stats ul .blue').each(function (i, v) {
|
||||||
$(v).html("");
|
$(v).html("");
|
||||||
});
|
});
|
||||||
|
|
||||||
// add the rest of the prop li's here
|
// add the rest of the prop li's here
|
||||||
$.each(props, function (i, v) {
|
$.each(props, function (i, v) {
|
||||||
if (v.string) {
|
if (v.string) {
|
||||||
$(`.item_stats ul .${i}`).html(v.string[0]);
|
$(`.item_stats ul .${i}`).html(v.string[0]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// add the rest of the prop li's here
|
// add the rest of the prop li's here
|
||||||
|
|
||||||
// var i;
|
// var i;
|
||||||
// for (i = 1; i <= 12; i++) {
|
// for (i = 1; i <= 12; i++) {
|
||||||
@ -503,48 +511,48 @@ $(document).ready(function () {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
//$('.item_stats div').show();
|
//$('.item_stats div').show();
|
||||||
|
|
||||||
//console.log(data['lvl req']);
|
//console.log(data['lvl req']);
|
||||||
|
|
||||||
$.each(data, function (i, v) {
|
$.each(data, function (i, v) {
|
||||||
$('*[name="' + i + '"]').val(v);
|
$('*[name="' + i + '"]').val(v);
|
||||||
if (i == 'code') {
|
if (i == 'code') {
|
||||||
$('select[name="code[]"]').val(v);
|
$('select[name="code[]"]').val(v);
|
||||||
$('select[name="code[]"]').prop('required', '');
|
$('select[name="code[]"]').prop('required', '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".btnDebug").click(function () {
|
$(".btnDebug").click(function () {
|
||||||
$(".debug_preview").slideToggle();
|
$(".debug_preview").slideToggle();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// cmd = sortBy
|
// cmd = sortBy
|
||||||
$('input[name="sort"]').change(function () {
|
$('input[name="sort"]').change(function () {
|
||||||
$.get("/ajax/uniqueitems.php?cmd=sortBy&sort=" + this.value, function (data) {
|
$.get("/ajax/uniqueitems.php?cmd=sortBy&sort=" + this.value, function (data) {
|
||||||
$('.uniqueitems-select').html(data)
|
$('.uniqueitems-select').html(data)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// cmd = viewOnly
|
// cmd = viewOnly
|
||||||
$('input[name="view"]').change(function () {
|
$('input[name="view"]').change(function () {
|
||||||
$.get("/ajax/uniqueitems.php?cmd=viewOnly&view=" + this.value, function (data) {
|
$.get("/ajax/uniqueitems.php?cmd=viewOnly&view=" + this.value, function (data) {
|
||||||
$('.uniqueitems-select').html(data)
|
$('.uniqueitems-select').html(data)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
searchbox = document.getElementById('search');
|
searchbox = document.getElementById('search');
|
||||||
searchbox.addEventListener('input', search);
|
searchbox.addEventListener('input', search);
|
||||||
|
|
||||||
|
|
||||||
$('input[name="theme"]').change(function () {
|
$('input[name="theme"]').change(function () {
|
||||||
modname = $('input[name="modname"]').val();
|
modname = $('input[name="modname"]').val();
|
||||||
$.get("/res/css.php?theme=" + this.value + "&modname=" + modname, function (data) {
|
$.get("/res/css.php?theme=" + this.value + "&modname=" + modname, function (data) {
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
// $('body').toggleClass("body-dark");
|
// $('body').toggleClass("body-dark");
|
||||||
@ -553,16 +561,43 @@ $(document).ready(function () {
|
|||||||
// $('select').toggleClass("select-dark");
|
// $('select').toggleClass("select-dark");
|
||||||
// $('option').toggleClass("option-dark");
|
// $('option').toggleClass("option-dark");
|
||||||
// $('.col-2,.col-3,.col-4').attr({"style":""});
|
// $('.col-2,.col-3,.col-4').attr({"style":""});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//genDocUniqueItems
|
//genDocUniqueItems
|
||||||
$("#Unique .btnDocs").click(function () {
|
$("#Unique .btnDocs").click(function () {
|
||||||
window.open('/genDocs.php?cmd=genDocUniqueItems', '_blank');
|
window.open('/genDocs.php?cmd=genDocUniqueItems', '_blank');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('.btn-delete').click(function (event) {
|
||||||
|
event.preventDefault(); // Prevent default button click behavior
|
||||||
|
|
||||||
|
// delete item index
|
||||||
|
$.get('/ajax/uniqueitems.php?cmd=delete&index=' + $(".uniqueform input[name='index']").val(), function (response) {
|
||||||
|
// Handle the response from the server
|
||||||
|
// remove option from list
|
||||||
|
$('.uniqueitems-select option[value="' + $(".uniqueform input[name='index']").val() + '"]').remove();
|
||||||
|
console.log(response);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$('.btn-save').click(function (event) {
|
||||||
|
event.preventDefault(); // Prevent default button click behavior
|
||||||
|
|
||||||
|
|
||||||
|
// Get form data
|
||||||
|
var formData = $(".uniqueform").serialize();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// delete item index
|
||||||
|
$.get('/ajax/uniqueitems.php?cmd=save&' + formData, function (response) {
|
||||||
|
// Handle the response from the server
|
||||||
|
console.log(response);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<ul class="nav nav-tabs" id="Tabs" role="tablist">
|
<ul class="nav nav-tabs" id="Tabs" role="tablist">
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<a class="nav-link" id="Unique-tab" data-toggle="tab" href="#Unique" role="tab" aria-controls="Unique" aria-selected="true">Unique Items</a>
|
<a class="nav-link active" id="Unique-tab" data-toggle="tab" href="#Unique" role="tab" aria-controls="Unique" aria-selected="true">Unique Items</a>
|
||||||
</li>
|
</li>
|
||||||
<!-- <li class="nav-item" role="presentation">
|
<!-- <li class="nav-item" role="presentation">
|
||||||
<a class="nav-link" id="Set-tab" data-toggle="tab" href="#Set" role="tab" aria-controls="Set" aria-selected="false">Set Items</a>
|
<a class="nav-link" id="Set-tab" data-toggle="tab" href="#Set" role="tab" aria-controls="Set" aria-selected="false">Set Items</a>
|
||||||
@ -77,7 +77,7 @@
|
|||||||
</li>
|
</li>
|
||||||
-->
|
-->
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
<a class="nav-link active" id="Chars-tab" data-toggle="tab" href="#Chars" role="tab" aria-controls="Chars" aria-selected="false">Character Editor</a>
|
<a class="nav-link" id="Chars-tab" data-toggle="tab" href="#Chars" role="tab" aria-controls="Chars" aria-selected="false">Character Editor</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item" role="presentation">
|
<li class="nav-item" role="presentation">
|
||||||
@ -94,7 +94,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-content" id="TabContent">
|
<div class="tab-content" id="TabContent">
|
||||||
<div class="tab-pane fade" id="Unique" role="tabpanel" aria-labelledby="Unique-tab">
|
<div class="tab-pane fade show active" id="Unique" role="tabpanel" aria-labelledby="Unique-tab">
|
||||||
<?php require_once 'tabs/UniqueItems.php'; ?>
|
<?php require_once 'tabs/UniqueItems.php'; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="Set" role="tabpanel" aria-labelledby="Set-tab">
|
<div class="tab-pane fade" id="Set" role="tabpanel" aria-labelledby="Set-tab">
|
||||||
@ -113,7 +113,7 @@
|
|||||||
<div class="tab-pane fade" id="Doc" role="tabpanel" aria-labelledby="Doc-tab">
|
<div class="tab-pane fade" id="Doc" role="tabpanel" aria-labelledby="Doc-tab">
|
||||||
<?php require_once 'tabs/Doc.php'; ?>
|
<?php require_once 'tabs/Doc.php'; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade show active" id="Chars" role="tabpanel" aria-labelledby="Chars-tab">
|
<div class="tab-pane fade" id="Chars" role="tabpanel" aria-labelledby="Chars-tab">
|
||||||
<?php require_once 'tabs/Chars.php'; ?>
|
<?php require_once 'tabs/Chars.php'; ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane fade" id="Debug" role="tabpanel" aria-labelledby="Debug-tab">
|
<div class="tab-pane fade" id="Debug" role="tabpanel" aria-labelledby="Debug-tab">
|
||||||
|
@ -107,13 +107,13 @@
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form action="/saveD2ModderEditorData.php" method="post">
|
<form class="uniqueform" action="" method="post">
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
|
|
||||||
<div class="col-2" style="background: #fec;">
|
<div class="col-2" style="background: #fec;">
|
||||||
<p>Index</p>
|
<p>Index</p>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<input name="index" type="text" aria-describedby="indexHelpBlock" required="required" class="form-control">
|
<input name="index" type="text" aria-describedby="indexHelpBlock" required="required" class="form-control input-uindex">
|
||||||
</div><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
|
</div><span class="help"><i class="fa fa-question-circle" aria-hidden="true"></i>
|
||||||
</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>
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
<div class="row options" style="background: none;">
|
<div class="row options" style="background: none;">
|
||||||
<div class="offset-10 col-2" style="background: none;">
|
<div class="offset-10 col-2" style="background: none;">
|
||||||
<button style="" name="submit" type="submit" class="btn btn-success">SAVE</button>
|
<button name="submit" type="submit" class="btn btn-success btn-save">SAVE</button>
|
||||||
<button name="submit" type="reset" class="btn btn-danger">CLEAR</button>
|
<button name="submit" type="reset" class="btn btn-warning btn-clear">CLEAR</button>
|
||||||
|
<button name="submit" type="submit" class="btn btn-danger btn-delete">DELETE</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!--<div class="row options" style="background: none;">
|
||||||
|
<div class="offset-10 col-2" style="background: none;">
|
||||||
|
<a href="" name="submit" type="submit" class="btn btn-success btn-save">SAVE</a>
|
||||||
|
<button name="submit" type="reset" class="btn btn-warning btn-clear">CLEAR</button>
|
||||||
|
<a href="" name="submit" class="btn btn-danger btn-delete">DELETE</a>
|
||||||
|
</div>
|
||||||
|
</div>-->
|
Loading…
Reference in New Issue
Block a user