In memory images/invfiles, general sql cleanup

This commit is contained in:
color.diff=auto
2021-05-12 22:31:41 -06:00
parent 5eced413cb
commit 016ea0e5d2
6 changed files with 3418 additions and 536 deletions

View File

@@ -119,15 +119,19 @@ $htmltop = <<<EOT
<style>
body{
background: black;
text-align: $align;
font-family: Lato;
background: white;
font-family: ExocetHeavy;
}
table, table th, table td, table tr {
background: #111;
color: #ccc;
}
.item {
text-align: left;
text-align: center;
position:relative;
right:0px;
margin: 0 auto;
}
.item_desc {
@@ -146,6 +150,8 @@ $htmltop = <<<EOT
.item_stats{
width: auto;
height: auto;
background: #111;
min-height: 260px;
}
.item_desc {
height: auto;
@@ -169,7 +175,35 @@ $htmltop = <<<EOT
.blue {
color: #4169E1;
}
td {
height: 240px;
text-align: center;
vertical-align: middle;
padding: 10px;
}
.uname {
background: #222;
}
.ulvl {
}
.ulvlreq {
}
.utype {
background: #111;
}
.ucode {
}
.uitem {
}
</style>
<script src="res/jquery-3.5.1.min.js"></script>
@@ -182,6 +216,7 @@ $htmltop = <<<EOT
$(document).ready(function() {
$('.cubetable').dataTable();
$('.utable').dataTable();
} );
@@ -223,6 +258,27 @@ mkdir($dir, 0777, true);
if ($cmd == "genDocUniqueItems") {
$tableTop = <<<EOT
<table border=1 class="utable">
<thead>
<tr>
<th class="gold uname">Name</th>
<th class="orange ulvl">Lvl</th>
<th class="orange ulvlreq">Lvl Req</th>
<th class="yellow utype">Type</th>
<th class="green ucode">Code</th>
<th class="uitem">Item</th>
</tr>
</thead>
<tbody>
EOT;
$tableBottom = <<<EOT
</tbody>
</table>
EOT;
// grab unique item index only (to save on memory)
$sql = "SELECT `index` FROM `uniqueitems` WHERE `enabled`='1'";
$uIndex = PDO_FetchAll($sql);
@@ -230,10 +286,14 @@ if ($cmd == "genDocUniqueItems") {
//ddump($uIndex);
$htmlFinal = '';
$htmlFinal .= $htmltop;
$htmlFinal .= $htmltop.$tableTop;
echo $htmltop;
echo $tableTop;
ob_flush();
/*
@@ -243,13 +303,26 @@ if ($cmd == "genDocUniqueItems") {
*
*/
foreach ($uIndex as $u) {
//var_dump($item);
//$items[] = $idata->uniqueItems($u['index'], true);
//var_dump($u['index']);
$item = $idata->uniqueItems($u['index'], true);
$itemBoxTop = <<<EOT
$itemBoxTop = "<tr>";
$itemBoxTop .= "<td class='gold uname' style=''>{$item['index']}</td>";
$itemBoxTop .= "<td class='orange ulvl' style=''>{$item['lvl']}</td>";
$itemBoxTop .= "<td class='orange ulvlreq' style=''>{$item["lvl req"]}</td>";
$itemBoxTop .= "<td class='utype' style=''>{$item["*type"]}</td>";
$itemBoxTop .= "<td class='ucode' style=''>{$item['code']}</td>";
$itemBoxTop .= <<<EOT
<td class='item' style=''>
<div class="center item_desc" style="">
<div style="height: 116px;background: url(img/items/bg.png) center top no-repeat;">
@@ -258,14 +331,15 @@ if ($cmd == "genDocUniqueItems") {
<div class="item_stats" style="">
<div style="width:auto; margin: 0 auto; background:#111; display:inline-block;">
<p>
EOT;
EOT;
$itemBoxBottom = <<<EOT
</p>
</div>
</div>
</div>
</td>
EOT;
$itemBoxBottom .= "</tr>";
echo $itemBoxTop;
ob_flush();
@@ -313,7 +387,7 @@ EOT;
echo $itemBoxBottom;
ob_flush();
$htmlFinal .= $props . $itemBoxBottom;
$htmlFinal .= $props . $itemBoxBottom . $tableBottom;
}// end loop
echo $htmlbottom;
@@ -400,7 +474,7 @@ if ($cmd == "genDocCube") {
.item_stats{
width: auto;
height: auto;
height: auto;
}
.item_desc {
height: auto;
@@ -1003,54 +1077,85 @@ EOT;
if ($cmd == "getIscStrings") {
//if ($cmd == "getIscStrings") {
//
//
//
// $sql = "
// SELECT p.`code` as prop,
// p.stat1,
// i.descstrpos,
// i.descstr2,
// i.descfunc,
// i.descval,
// i.dgrp,
// i.dgrpfunc,
// i.dgrpval,
// i.dgrpstrpos,
// i.dgrpstrneg,
// s1.String as string1,
// s2.String as string2,
// s3.String as gstring1,
// s4.String as gstring2
// FROM properties as p
//
// LEFT JOIN itemstatcost as i
// ON p.stat1 = i.Stat
//
// LEFT JOIN strings as s1
// ON i.descstrpos = s1.Key
// LEFT JOIN strings as s2
// ON i.descstr2 = s2.Key
//
// LEFT JOIN strings as s3
// ON i.dgrpstrpos = s3.Key
// LEFT JOIN strings as s4
// ON i.dgrpstr2= s4.Key
//";
//
// $res = PDO_FetchAll($sql);
//
// $isc = null;
// foreach ($res as $r) {
// $isc[$r['prop']] = $r;
// $isc[$r['prop']]['prop'] = $r['prop'];
// }
//
//
// var_dump($isc);
//}
if ($cmd == "getImages") {
$sql = "
SELECT p.`code` as prop,
p.stat1,
i.descstrpos,
i.descstr2,
i.descfunc,
i.descval,
i.dgrp,
i.dgrpfunc,
i.dgrpval,
i.dgrpstrpos,
i.dgrpstrneg,
s1.String as string1,
s2.String as string2,
s3.String as gstring1,
s4.String as gstring2
FROM properties as p
LEFT JOIN itemstatcost as i
ON p.stat1 = i.Stat
LEFT JOIN strings as s1
ON i.descstrpos = s1.Key
LEFT JOIN strings as s2
ON i.descstr2 = s2.Key
LEFT JOIN strings as s3
ON i.dgrpstrpos = s3.Key
LEFT JOIN strings as s4
ON i.dgrpstr2= s4.Key
SELECT code,invfile,type,type2 FROM armor
UNION ALL
SELECT code,invfile,type,type2 FROM misc
UNION ALL
SELECT code,invfile,type,type2 FROM weapons
";
$res = PDO_FetchAll($sql);
$isc = null;
foreach ($res as $r) {
$isc[$r['prop']] = $r;
$isc[$r['prop']]['prop'] = $r['prop'];
$isc1[$r['code']] = $r;
$isc1[$r['code']]['code'] = $r['prop'];
$isc2[$r['type']] = $r;
$isc2[$r['type']]['type'] = $r['prop'];
}
$isc = array_merge($isc1, $isc2);
unset($isc1);
unset($isc2);
var_dump($isc);
var_dump(($isc));
}