Item Preview Done. Todo: Stat Rendering

This commit is contained in:
color.diff=auto
2021-05-02 05:35:38 -06:00
parent 65b3980c44
commit efa7f8f28e
987 changed files with 816 additions and 122 deletions

View File

@@ -49,18 +49,52 @@ if (!empty($_GET['sort']))
$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 ($cmd == "getUniqueItem") {
$sql = "SELECT * FROM `uniqueitems` WHERE `enabled`='1' AND `index`=\"{$_GET['index']}\"";
$res = PDO_FetchRow($sql);
if (empty($res['invfile'])) {
// if no invfile, get from other tables
// try to get from armor, weapons, misc
$sql = "SELECT invfile FROM armor WHERE code='{$res['code']}'";
$invfile[] = PDO_FetchRow($sql);
$sql = "SELECT invfile FROM weapons WHERE code='{$res['code']}'";
$invfile[] = PDO_FetchRow($sql);
$sql = "SELECT invfile FROM misc WHERE code='{$res['code']}'";
$invfile[] = PDO_FetchRow($sql);
$invfile = array_filter($invfile);
foreach ($invfile as $i){
$x[] = $i;
}
$invClean = array_filter($x[0]);
$return = array_merge($res,$invClean);
} else {
$return = $res;
}
header('Content-Type: application/json');
echo json_encode($res, JSON_INVALID_UTF8_IGNORE);
echo json_encode($return, JSON_INVALID_UTF8_IGNORE);
}
/*
/*
* @cmd = sortBy
*
*
@@ -79,7 +113,7 @@ if ($cmd == "sortBy") {
}
echo $html;
}
/*
/*
* @cmd = viewOnly
*
*
@@ -120,14 +154,14 @@ WHERE `type` IS NOT NULL AND uniqueitems.`code`= $table.`code` AND $table.`code`
echo $html;
}
/*
/*
* @cmd = search
*
*
*
*
*/
if ($cmd == 'search'){
if ($cmd == 'search') {
$search = $_GET['search'];
$sql = "SELECT * FROM uniqueitems WHERE `index` LIKE '%$search%' OR `code` LIKE '%$search%' AND `enabled`=1 ORDER BY `index`";
$res = PDO_FetchAll($sql);
@@ -139,8 +173,5 @@ if ($cmd == 'search'){
$html .= "<option value=\"{$r['index']}\">{$r['index']}</option>";
}
}
echo $html;
echo $html;
}