Latest working copy. GUI cleanup. Need to do inputs, outputs, in cube, type codes and etc. need rendering

This commit is contained in:
Hash Borgir
2022-03-25 21:34:10 -06:00
parent 5ced1b7b18
commit d52b371b59
3129 changed files with 432901 additions and 54432 deletions

View File

@@ -113,6 +113,42 @@ foreach ($res as $r) {
$isc[$r['prop']]['prop'] = $r['prop'];
}
// load strings
$sql = 'SELECT * FROM strings';
$strings = array_filter(PDO_FetchAssoc($sql));
// load itemtypes table in memory
// then in side this foreach loop for each row, see if the item code appears in itemtypes
// if in item types, then it's a 4 letter code, done
// if not in itemtypes, then it's a three letter code and get the string for it from tbl
$sql = "SELECT ItemType,Code FROM itemtypes";
$itemtypesTbl = PDO_FetchAssoc($sql);
// $sql = "SELECT ItemType,Equiv1 FROM itemtypes";
// $itemtypesTblEquiv1 = PDO_FetchAssoc($sql);
//
// $sql = "SELECT ItemType,Equiv2 FROM itemtypes";
// $itemtypesTblEquiv2 = PDO_FetchAssoc($sql);
// $itemTypes = array_filter(array_merge($itemtypesTblCode, $itemtypesTblEquiv1, $itemtypesTblEquiv1));
// ddump($itemtypesTbl);
// load namestr from 3 files
$sql = "SELECT code,namestr FROM armor
UNION
SELECT code,namestr FROM misc
UNION
SELECT code,namestr FROM weapons
";
$namestr = PDO_FetchAssoc($sql);
$htmltop = <<<EOT
<!doctype html>
<html lang="en">
@@ -128,13 +164,13 @@ $htmltop = <<<EOT
<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" type="text/css" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.css">
<link rel="stylesheet" href="res/style.css">
<style>
body{
background: white;
font-family: ExocetHeavy;
font-family: ExocetLight;
}
table, table th, table td, table tr {
@@ -217,8 +253,10 @@ $htmltop = <<<EOT
.uitem {
}
.rprops {
font-family: ExocetHeavy;
.rprops {
background: #222 !important;
border: 1px solid #ccc;
padding: 30px 5px;
}
.rw {
@@ -227,38 +265,56 @@ $htmltop = <<<EOT
margin: 10px;
padding: 10px;
background: #111;
font-family: Serif;
}
.rw-name {}
.rw-type {}
.rw-rune { color: #ccc;}
.rw-name {font-size: 28px;text-align: center;}
.rw-type { font-family: ExocetLight; }
.rw-rune { color: #ccc; }
.rw-count {
background: #222;
border: 1px solid #ccc;
border-radius: 50;
display: block;
height: 60px;
width: 60px;
line-height: 60px;
-moz-border-radius: 30px; /* or 50% */
border-radius: 30px; /* or 50% */
margin: 0 auto;
color: white;
text-align: center;
font-size: 2em;
}
.rune-img {
padding: 1px;
margin:1px;
height: 42px;
width: 42px;
height: 48px;
width: 48px;
}
.numrunes {
color:
}
</style>
</style>
<script src="res/jquery-3.5.1.min.js"></script>
<script type="text/javascript" charset="utf8" src="https://cdn.datatables.net/1.10.24/js/jquery.dataTables.js"></script>
<script src="res/bootstrap.bundle.min.js"></script>
<script>
$(document).ready(function() {
$('.cubetable').dataTable();
$('.utable').dataTable();
$('.gemtable').dataTable();
$('.rtable').dataTable();
} );
</script>
<link rel="stylesheet" type="text/css" href="res/datatables.min.css"/>
<script type="text/javascript" src="res/datatables.min.js"></script>
<script>
$(document).ready(function() {
$('.cubetable').dataTable();
$('.utable').dataTable();
$('.gemtable').dataTable();
$('.rtable').dataTable();
} );
</script>
<title>D2Modder</title>
</head>
@@ -496,7 +552,7 @@ if ($cmd == "genDocCube") {
body{
background: white;
color: black;
font-family: ExocetHeavy;
font-family: ExocetLight;
text-transform: uppercase;
}
@@ -538,11 +594,9 @@ if ($cmd == "genDocCube") {
}
.desc {
width: 200px;
font-family: ExocetHeavy;
font-size: 1.25em;
text-transform: uppercase;
background: #111;
min-width: 320px;
font-family: Lato,Sans;
background: #222;
}
.input1,.input3,.input5,.input7{
@@ -638,7 +692,7 @@ EOT;
for each cube row
*
*/
foreach ($res as $r) {
$desc = str_replace('+', '<br>+<br>', $r['description']);
$desc = str_replace('->', '<br><span class="" style="color: gold;font-size:1.25em;">=<br>', $desc);
@@ -670,8 +724,10 @@ EOT;
// then get spelldesc/spelldescstr
$sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
$str = PDO_FetchOne($sql);
// $sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
// $str = PDO_FetchOne($sql);
$str = $strings[$oarray[0]];
// if empty str == 4-letter code, call getItemName()
if (empty($str)) {
@@ -693,8 +749,10 @@ EOT;
// then get spelldesc/spelldescstr
$sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
$str = PDO_FetchOne($sql);
// $sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
// $str = PDO_FetchOne($sql);
$str = $strings[$oarray[0]];
// if empty str == 4-letter code, so just display
if (empty($str)) {
@@ -723,7 +781,7 @@ EOT;
]
);
//var_dump($output_codes);
// dump($output_codes);
foreach ($output_codes as $outputNum => $value) {
if (str_contains($value, ',')) {
@@ -863,11 +921,11 @@ EOT;
];
$output['mods'][$k]["str"] = $idesc->getDesc($params);
//var_dump($output['mods'][$k]["isc"]);
//ddump($output['mods'][$k]["isc"]);
}
//ddump($idata->getIscStrings("energy"));
/*
* Echo out each row as HTML with all the data it may have
@@ -903,10 +961,22 @@ EOT;
if (str_contains($output["input $i"][0], "ÿc")) {
$p = "/ÿc[\d:;\/.]/i";
$output["input $i"][0] = preg_replace($p, "", $output["input $i"][0]);
}
$ostr = implode("<br>", (array_reverse(explode('\n', $output["input $i"][0]))));
}
// if the item is in itemtypes grab it, it's 4 letter code fron itemtypes
$key1 = array_search($output["input $i"][0], $itemtypesTbl);
// if the key's value is in itemtypes
if($itemtypesTbl[$key1] == $output["input $i"][0]){
$ostr = implode("<br>", (array_reverse(explode('\n', $key1))));
} else {
$ostr = implode("<br>", (array_reverse(explode('\n', $output["input $i"][0]))));
}
echo '<pre>';
$htmlRow .= $ostr . "<br>";
if (str_contains($output["input $i"][1], "=")) {
$htmlRow .= $output["input $i"][1] . "<br>";
@@ -925,6 +995,15 @@ EOT;
$p = "/ÿc[\d:;\/.]/i";
$output["output"][0] = preg_replace($p, "", $output["output"][0]);
}
$key1 = array_search($output["input $i"][0], $itemtypesTbl);
//var_dump($output);
// if the item is in itemtypes grab it, it's 4 letter code fron itemtypes
$key1 = array_search($output["input $i"][0], $itemtypesTbl);
if (str_contains($output["output"][1], "ÿc")) {
$p = "/ÿc[\d:;\/.]/i";
$output["output"][1] = preg_replace($p, "", $output["output"][1]);
@@ -961,8 +1040,8 @@ EOT;
$htmlRow .= "</td>";
$htmlRow .= "<td class='output2'>";
if (!empty($output["output 2"]["img"])) {
$htmlRow .= "<img src='img/items/{$output["output 2"]["img"]}'><br>";
if (!empty($output["output b"]["img"])) {
$htmlRow .= "<img src='img/items/{$output["output b"]["img"]}'><br>";
if (str_contains($output["output b"][0], "ÿc")) {
$p = "/ÿc[\d:;\/.]/i";
$output["output b"][0] = preg_replace($p, "", $output["output b"][0]);
@@ -992,10 +1071,10 @@ EOT;
}
}
$htmlRow .= "</td>";
$htmlRow .= "<td class='output3'>";
if (!empty($output["output 3"]["img"])) {
$htmlRow .= "<img src='img/items/{$output["output 3"]["img"]}'><br>";
if (!empty($output["output c"]["img"])) {
$htmlRow .= "<img src='img/items/{$output["output c"]["img"]}'><br>";
if (str_contains($output["output c"][0], "ÿc")) {
$p = "/ÿc[\d:;\/.]/i";
$output["output c"][0] = preg_replace($p, "", $output["output c"][0]);
@@ -1047,6 +1126,8 @@ EOT;
$htmlFinal .= $tableBottom . $htmlbottom;
file_put_contents("$dir/cubemain.html", $htmlFinal);
header("Location: docs/{$_SESSION['modname']}/cubemain.html");
}
@@ -1250,7 +1331,7 @@ ON g.code = s.Key
body{
background: white;
color: black;
font-family: ExocetHeavy;
font-family: ExocetLight;
text-transform: uppercase;
}
@@ -1293,7 +1374,7 @@ ON g.code = s.Key
.desc {
width: 200px;
font-family: ExocetHeavy;
font-family: ExocetLight;
font-size: 1.25em;
text-transform: uppercase;
background: #111;
@@ -1367,7 +1448,7 @@ EOT;
$htmlRow = "<tr>";
$htmlRow .= "<td class='name'>
<img style='height: 28px;width:28px;' src='img/items/{$g["invfile"]}.png'><br>
<img style='height: 64px;width:64px;' src='img/items/{$g["invfile"]}.png'><br>
{$g['String']}
</td>
";
@@ -1432,6 +1513,7 @@ EOT;
if ($cmd == 'genDocRunewords'){
// ddump($_SESSION);
//ddump($isc);
@@ -1455,8 +1537,7 @@ if ($cmd == 'genDocRunewords'){
<thead>
<tr>
<th>Name</th>
<th>Item Types</th>
<th>Runes</th>
<th>Runes</th>
<th>Properties</th>
</tr>
</thead>
@@ -1484,12 +1565,12 @@ if ($cmd == 'genDocRunewords'){
$rr_img[6] = $rune_inv_codes[$rune['Rune6']];
$rr[1] = str_replace(' Rune', '', $strings[$rune['Rune1']]);
$rr[2] = str_replace(' Rune', '', $strings[$rune['Rune2']]);
$rr[3] = str_replace(' Rune', '', $strings[$rune['Rune3']]);
$rr[4] = str_replace(' Rune', '', $strings[$rune['Rune4']]);
$rr[5] = str_replace(' Rune', '', $strings[$rune['Rune5']]);
$rr[6] = str_replace(' Rune', '', $strings[$rune['Rune6']]);
$rr[1] = str_replace('', '', $strings[$rune['Rune1']]);
$rr[2] = str_replace('', '', $strings[$rune['Rune2']]);
$rr[3] = str_replace('', '', $strings[$rune['Rune3']]);
$rr[4] = str_replace('', '', $strings[$rune['Rune4']]);
$rr[5] = str_replace('', '', $strings[$rune['Rune5']]);
$rr[6] = str_replace('', '', $strings[$rune['Rune6']]);
if (str_contains($rr[1], "ÿc")) {
$p = "/ÿc[\d:;\/.]/i";
@@ -1525,7 +1606,8 @@ if ($cmd == 'genDocRunewords'){
$rcd = null;
foreach ($rune_count_duplicates as $k => $v){
$rcd[] = "$k x $v";
// rune * count
$rcd[] = "$k <span class='numrunes blue'>x</span> <span style='font-size: 2em;'>$v</span>";
}
// echo "<pre>";
@@ -1577,9 +1659,10 @@ if ($cmd == 'genDocRunewords'){
<tr class="rw">
<td><p class="rw-name gold">$name</p></td>
<td><p class="rw-type">$itype1<br> $itype2<br> $itype3<br> $itype4<br> $itype5<br> $itype6</p></td>
<td>
<p class="rw-name gold">$name</p>
<p class="rw-type">$itype1<br> $itype2<br> $itype3<br> $itype4<br> $itype5<br> $itype6</p>
</td>
<td>
<p class="rw-rune">
<p>$img_s</p>
@@ -1589,7 +1672,7 @@ if ($cmd == 'genDocRunewords'){
$rcd[3] <br>
$rcd[4] <br>
$rcd[5] <br>
<!--<p class="rw-count">$rune_count</p>-->
</p></td>
@@ -1618,5 +1701,12 @@ echo $tableRowsRunes;
echo "</tbody></table>";
echo $htmlbottom;
$htmlFinal = $htmltop. $tableTop . $tableRowsRunes .$tableBottom ;
file_put_contents("$dir/runewords.html", $htmlFinal);
header("Location: docs/{$_SESSION['modname']}/runewords.html");
}