Item preview upgrade

This commit is contained in:
color.diff=auto 2021-05-04 10:21:16 -06:00
parent 21546a57db
commit f92a59dcc5
5 changed files with 56 additions and 11 deletions

View File

@ -61,7 +61,7 @@ if (!empty($_GET['view']))
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
@ -175,8 +175,21 @@ if ($cmd == "getUniqueItem") {
$return['props'] = $props;
//ddump($return);
$sqlArmor = "SELECT * FROM armor WHERE code='{$res['code']}'";
$sqlMisc = "SELECT * FROM misc WHERE code='{$res['code']}'";
$sqlWeapons = "SELECT * FROM weapons WHERE code='{$res['code']}'";
$baseItemInfo = PDO_FetchRow($sqlArmor);
if (empty($baseItemInfo)) {
$baseItemInfo = PDO_FetchRow($sqlMisc);
}
if (empty($baseItemInfo)) {
$baseItemInfo = PDO_FetchRow($sqlWeapons);
}
$return['baseItemInfo'] = array_filter($baseItemInfo);
header('Content-Type: application/json');
echo json_encode($return, JSON_INVALID_UTF8_IGNORE|JSON_PRETTY_PRINT);

View File

@ -201,16 +201,19 @@ $(document).ready(function () {
type = data["*type"];
lvlreq = data["lvl req"];
base = data.baseItemInfo;
$('.item_stats p').append(`<li class="statindex">${data.index}</li>`);
$('.item_stats p').append(`<li class="stattype">${type}</li>`);
$('.item_stats p').append(`<li class="statlvlreq">Level: ${base.level}</li>`);
$('.item_stats p').append(`<li class="statlvlreq">Level Required: ${lvlreq}</li>`);
// $('.item_stats p').append(`<li class="index">${data.index}</li>`);
// $('.item_stats p').append(`<li class="index">${data.index}</li>`);
// $('.item_stats p').append(`<li class="index">${data.index}</li>`);
// $('.item_stats p').append(`<li class="index">${data.index}</li>`);
$('.item_stats p').append(`<li class="code" style="color:grey;">Item Code: ${base.code}</li>`);
$('.item_stats p').append(`<li class="statlvlreq">Durability: ${base.durability}</li>`);
$.each(props, function (i, v) {

View File

@ -231,4 +231,30 @@ pre {outline: 1px solid #ccc; padding: 5px; margin: 5px; }
.statlvlreq {
color: white;
}
}
/*
COLOR classes
Text Colors
#FFA500 Crafted items
#4169E1 Magic items
#FFFF00 Rare items
#A59263 Unique items
*/
.green {
color: #00FF00; /*Set items*/
}
.gold{
color: #A59263; /*Set items*/
}
.orange{
color: #FFA500; /*Set items*/
}
.yellow {
color: #FFFF00; /*Set items*/
}

View File

@ -192,7 +192,7 @@ class D2ItemDesc {
$par = $params['par'];
$min = (int) $params['min'];
$v = $min;
$max = (int) $params['max'];
if ($min == $max) {
@ -290,7 +290,7 @@ class D2ItemDesc {
if ($params['descfunc'] == 15) {
$sql = "SELECT skill FROM `skills` WHERE `Id`='$par'";
$skill = PDO_FetchOne($sql);
$this->str = sprintf($s1, $min, $max, $skill);
$this->str = sprintf($s1, $min, $params['max'], $skill);
}
if ($params['descfunc'] == 16) {
@ -329,7 +329,7 @@ class D2ItemDesc {
$sql = "SELECT skill FROM `skills` WHERE `Id`='$par'";
$skill = PDO_FetchOne($sql);
$this->str = "+$min to Skill Charges Or Something";
$this->str = sprintf("Level $max $skill ".$string,$min,$min);
$this->str = sprintf("Level $max $skill " . $string, $min, $min);
}
if ($params['descfunc'] == 25) {

View File

@ -52,10 +52,13 @@
<link rel="stylesheet" href="/res/font-awesome.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Lato:wght@300&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://bootswatch.com/4/sketchy/bootstrap.min.css">
<link rel="stylesheet" href="/res/style.css">
<link rel="stylesheet" href="/res/<?php echo $css ?>">
<style>
a {
color: #007bff;
}
</style>
<script src="/res/jquery-3.6.0.min.js"></script>
<script src="/res/bootstrap.bundle.min.js"></script>