Runeword Browser Beta Version

This commit is contained in:
Hash Borgir 2022-03-22 04:54:42 -06:00
parent e19b3ef034
commit 171cdf5197

View File

@ -59,7 +59,6 @@ define('DB_FILE', $_SESSION['modname'] . ".db");
PDO_Connect("sqlite:" . DB_FILE); PDO_Connect("sqlite:" . DB_FILE);
require_once "./src/D2Functions.php"; require_once "./src/D2Functions.php";
require_once './src/D2ItemData.php';
$idata = new D2ItemData(); $idata = new D2ItemData();
@ -219,6 +218,19 @@ $htmltop = <<<EOT
} }
.rw {
text-align: center;
border: 1px solid #ccc;
margin: 10px;
padding: 10px;
background: #111;
font-family: Serif;
}
.rw-name {}
.rw-type {}
.rw-rune { color: #ccc;}
</style> </style>
<script src="res/jquery-3.5.1.min.js"></script> <script src="res/jquery-3.5.1.min.js"></script>
@ -229,9 +241,10 @@ $htmltop = <<<EOT
$(document).ready(function() { $(document).ready(function() {
$('.cubetable').dataTable(); $('.cubetable').dataTable();
$('.utable').dataTable(); $('.utable').dataTable();
$('.gemtable').dataTable(); $('.gemtable').dataTable();
$('.rtable').dataTable();
} ); } );
@ -1398,3 +1411,175 @@ EOT;
file_put_contents("$dir/gems.html", $htmlFinal); file_put_contents("$dir/gems.html", $htmlFinal);
header("Location: /docs/{$_SESSION['modname']}/gems.html"); header("Location: /docs/{$_SESSION['modname']}/gems.html");
} }
/*
*
*
* @cmd = genDocRunewords
*
*/
if ($cmd == 'genDocRunewords'){
//ddump($isc);
$sql = 'SELECT * FROM runes';
$runes = array_filter(PDO_FetchAll($sql));
$sql = 'SELECT * FROM strings';
$strings = array_filter(PDO_FetchAssoc($sql));
$sql = 'SELECT Itemtype,Code,Equiv1 FROM itemtypes';
$itypes = array_flip(array_filter(PDO_FetchAssoc($sql)));
$tableTop = <<<EOT
<table class="rtable rw">
<thead>
<tr>
<th>Name</th>
<th>Item Types</th>
<th>Runes</th>
<th>Properties</th>
</tr>
</thead>
<tbody>
EOT;
foreach ($runes as $rune){
// Grab Rune Names
$name = $strings[$rune['Name']];
$itype1 = $itypes[$rune['itype1']];
$itype2 = $itypes[$rune['itype2']];
$itype3 = $itypes[$rune['itype3']];
$itype4 = $itypes[$rune['itype4']];
$itype5 = $itypes[$rune['itype5']];
$itype6 = $itypes[$rune['itype6']];
$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']]);
if (str_contains($rr[1], "ÿc")) {
$p = "/ÿc[\d:;\/.]/i";
$rr[1] = preg_replace($p, "", $rr[1]);
}
if (str_contains($rr[2], "ÿc")) {
$p = "/ÿc[\d:;\/.]/i";
$rr[2] = preg_replace($p, "", $rr[2]);
}
if (str_contains($rr[3], "ÿc")) {
$p = "/ÿc[\d:;\/.]/i";
$rr[3] = preg_replace($p, "", $rr[3]);
}
if (str_contains($rr[4], "ÿc")) {
$p = "/ÿc[\d:;\/.]/i";
$rr[4] = preg_replace($p, "", $rr[4]);
}
if (str_contains($rr[5], "ÿc")) {
$p = "/ÿc[\d:;\/.]/i";
$rr[5] = preg_replace($p, "", $rr[5]);
}
if (str_contains($rr[6], "ÿc")) {
$p = "/ÿc[\d:;\/.]/i";
$rr[6] = preg_replace($p, "", $rr[6]);
}
$rr = array_filter($rr);
$rune_count = count($rr);
$rune_count_duplicates = array_count_values($rr);
// echo "<pre>";
// var_dump($rune_count_duplicates);
$rcd = null;
foreach ($rune_count_duplicates as $k => $v){
$rcd[] = "$k x $v";
}
// echo "<pre>";
// var_dump($rcd);
for ($i = 1; $i <= 7; $i++){
if($rune["T1Code{$i}"] != ''){
$params = [
"string1" => $isc[$rune["T1Code{$i}"]]["string1"],
"string2" => $isc[$rune["T1Code{$i}"]]["string2"],
"gstring1" => $isc[$rune["T1Code{$i}"]]["gstring"],
"gstring2" => $isc[$rune["T1Code{$i}"]]["gstring2"],
"descfunc" => $isc[$rune["T1Code{$i}"]]["descfunc"],
"descval" => $isc[$rune["T1Code{$i}"]]["descval"],
"dgrp" => $isc[$rune["T1Code{$i}"]]["dgrp"],
"dgrpfunc" => $isc[$rune["T1Code{$i}"]]["dgrpfunc"],
"dgrpval" => $isc[$rune["T1Code{$i}"]]["dgrpval"],
"prop" => $isc[$rune["T1Code{$i}"]]["prop"]
];
$params["par"] = $rune["T1Param{$i}"];
$params["min"] = $rune["T1Min{$i}"];
$params["max"] = $rune["T1Max{$i}"];
$props[$i] = $idesc->getDesc($params);
}
}
$props = array_unique($props);
// for each $rune, echo props
// echo "<pre>";
// var_dump($props);
$tableRowsRunes .= <<<EOT
<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-rune">
$rcd[0] <br>
$rcd[1] <br>
$rcd[2] <br>
$rcd[3] <br>
$rcd[4] <br>
$rcd[5] <br>
</p></td>
<td>
<ul>
<li> $props[1] </li>
<li> $props[2] </li>
<li> $props[3] </li>
<li> $props[4] </li>
<li> $props[5] </li>
<li> $props[6] </li>
<li> $props[7] </li>
</ul>
</td>
</tr>
EOT;
}
echo $htmltop;
echo $tableTop;
echo $tableRowsRunes;
echo "</tbody></table>";
echo $htmlbottom;
}