Items load from mod, else d2modder. broken res/ folder fixed

This commit is contained in:
Hash Borgir
2022-06-26 01:34:18 -06:00
parent c4229d4336
commit eb3bc1cb7d
35 changed files with 25 additions and 45 deletions

View File

@@ -6,54 +6,43 @@ class D2ItemData {
public $images;
public function getImages() {
$sql = "
SELECT code,invfile,type,type2 FROM armor
$sql = "SELECT code,uniqueinvfile,invfile,type,type2 FROM armor
UNION ALL
SELECT code,invfile,type,type2 FROM misc
SELECT code,uniqueinvfile,invfile,type,type2 FROM misc
UNION ALL
SELECT code,invfile,type,type2 FROM weapons
";
$res = PDO_FetchAll($sql);
SELECT code,uniqueinvfile,invfile,type,type2 FROM weapons";
$res = PDO_FetchAll($sql);
$isc = null;
foreach ($res as $r) {
$isc1[$r['code']] = $r;
$isc1[$r['code']]['code'] = $r['prop'];
$isc1[$r['code']]['code'] = $r['code'];
$isc2[$r['type']] = $r;
$isc2[$r['type']]['type'] = $r['prop'];
$isc2[$r['type']]['type'] = $r['type'];
}
$this->images = array_merge($isc1, $isc2);
unset($isc1);
unset($isc2);
}
public function uniqueItems($index, $doc = FALSE) {
// This is where we get props for each item
$sql = "SELECT * FROM uniqueitems WHERE enabled='1' AND `index`=?";
$res = (PDO_FetchRow($sql, [$index]));
/*
* Get invfile code all 3 item tables wherever it is
*
*/
if (empty($this->images)) {
$this->getImages();
}
// This is where we get props for each item
$sql = "SELECT * FROM uniqueitems WHERE enabled='1' AND `index`=?";
$res = (PDO_FetchRow($sql, [$index]));
if (empty($res['uniqueinvfile'])){
$sql = "SELECT InvGfx1 FROM itemtypes WHERE Code = '{$this->images[$res['code']]['type']}'";
$invfile = PDO_FetchOne($sql);
}
if (empty($invfile)){
$invfile = $this->images[$res['code']]['invfile'];
}
$res['invfile'] = $this->images[$res['code']]['invfile'];
$res['invfile'] = $invfile;
$return = $res;
/*
* for all props for this unique item, get ISC strings
*/
// for all props for this unique item, get ISC strings
$props = array_filter([
"Prop1" => array_filter(
["prop1" => $return['prop1'], "par1" => $return['par1'], "min1" => $return['min1'], "max1" => $return['max1']]

View File

@@ -47,7 +47,7 @@
<div class="" style="text-align: center; margin: 0 auto;">
<a style="margin-top: 60px; text-align: center;" target="_blank" href="/genDocs.php?cmd=genDocMisc" class="">
<div style="height: 100px;">
<img style="height: 56px;" class="img-fluid" src="/img/items/invbok.png">
<img style="height: 56px;" class="img-fluid" src="/img/items/invtbk.png">
<img style="height: 28px;" class="img-fluid" src="/img/items/invkey.png">
</div>
</a>