uniqueItems($_GET['index']); } /* * @cmd = sortBy * * * */ if ($cmd == "sortBy") { $sql = "SELECT `index`,`$sort` FROM `uniqueitems` WHERE `enabled`='1' ORDER BY `$sort`"; $res = PDO_FetchAll($sql); $html = ''; foreach ($res as $r) { if ($sort == 'index') { $html .= ""; } else { $html .= ""; } } echo $html; } /* * @cmd = viewOnly * * * */ if ($cmd == "viewOnly") { $table = 'misc'; $sql = "SELECT uniqueitems.`index`, uniqueitems.`code`, misc.`type` FROM uniqueitems LEFT JOIN misc ON uniqueitems.`code` = misc.`code` WHERE `type` IS NOT NULL AND uniqueitems.`code`='$view'"; if ($view == 'armo') { $table = 'armor'; $sql = "SELECT uniqueitems.`index`, uniqueitems.`code`, $table.`code` FROM uniqueitems LEFT JOIN $table ON uniqueitems.`code` = $table.`code` WHERE `type` IS NOT NULL AND uniqueitems.`code`= $table.`code` AND $table.`code` != '' ORDER BY `index`"; } if ($view == 'weap') { $table = 'weapons'; $sql = "SELECT uniqueitems.`index`, uniqueitems.`code`, $table.`code` FROM uniqueitems LEFT JOIN $table ON uniqueitems.`code` = $table.`code` WHERE `type` IS NOT NULL AND uniqueitems.`code`= $table.`code` AND $table.`code` != '' ORDER BY `index`"; } if ($view == "char") { $sql .= " OR uniqueitems.`code`='cm1' OR uniqueitems.`code`='cm2' OR uniqueitems.`code`='cm3'"; } $res = PDO_FetchAll($sql); $html = ''; foreach ($res as $r) { if ($sort == 'index') { $html .= ""; } else { $html .= ""; } } echo $html; } /* * @cmd = search * * * * */ if ($cmd == 'search') { $search = $_GET['search']; $sql = "SELECT * FROM uniqueitems WHERE `index` LIKE '%?%' OR code LIKE '%?%' AND enabled=1 ORDER BY `index`"; $res = PDO_FetchAll($sql,[$search, $search]); $html = ''; foreach ($res as $r) { if ($sort == 'index') { $html .= ""; } else { $html .= ""; } } echo $html; } /* * @cmd = getString * * @arg = property, par, min, max * * */ if ($cmd == 'getString') { $prop = $_GET['prop']; $sql = "SELECT stat1,stat2,stat3,stat4,stat5,stat6,stat7 FROM properties WHERE code = ?"; $stat = array_filter(PDO_FetchRow($sql, [$prop])); $s = array_filter($idata->getIscStrings($prop)); // now combine isc strings with par, min, max $params = array_merge($_GET, $s); $return = $idesc->getDesc($params); /* * 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); }