Cube documenter working half way

This commit is contained in:
color.diff=auto
2021-05-10 01:15:44 -06:00
parent e3365ed343
commit 2d504c947f
1043 changed files with 27077 additions and 126 deletions

View File

@@ -25,7 +25,7 @@ ob_start();
following disclaimer in the documentation and/or other
materials provided with the distribution.
* This software must not be used for commercial purposes
* This software must not be used for commercial purposes
* without my consent. Any sales or commercial use are prohibited
* without my express knowledge and consent.
@@ -61,19 +61,7 @@ if (!empty($_GET['cmd']))
$cmd = $_GET['cmd'];
/*
@cmd = genDocUniqueItems
*/
if ($cmd == "genDocUniqueItems") {
// grab unique item index only (to save on memory)
$sql = "SELECT `index` FROM `uniqueitems` WHERE `enabled`='1'";
$uIndex = PDO_FetchAll($sql);
//ddump($uIndex);
$htmltop = <<<EOT
$htmltop = <<<EOT
<!doctype html>
<html lang="en">
<head>
@@ -84,13 +72,13 @@ if ($cmd == "genDocUniqueItems") {
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="res/bootstrap.min.css">
<link rel="stylesheet" href="res/font-awesome.min.css">
<link rel="stylesheet" href="res/font-awesome.min.css">
<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" href="res/style.css">
<style>
body{
background: black;
text-align: center;
@@ -124,7 +112,7 @@ if ($cmd == "genDocUniqueItems") {
.blue {
color: #4169E1;
}
</style>
<script src="res/jquery-3.6.0.min.js"></script>
<script src="res/bootstrap.bundle.min.js"></script>
@@ -133,19 +121,43 @@ if ($cmd == "genDocUniqueItems") {
</script>
<title>D2Modder</title>
</head>
<body>
<div class="container container-top">
<body>
<div class="container container-top">
<h1>{$_SESSION['modname']} Unique Items</h1>
<p>Auto generated with D2Modder by Hash Casper</p>
EOT;
$htmlbottom = <<<EOT
$htmlbottom = <<<EOT
</div>
</body>
</html>
</html>
EOT;
/*
*
*
*
*
*
@cmd = genDocUniqueItems
*
*
*
*
*
*/
if ($cmd == "genDocUniqueItems") {
// grab unique item index only (to save on memory)
$sql = "SELECT `index` FROM `uniqueitems` WHERE `enabled`='1'";
$uIndex = PDO_FetchAll($sql);
//ddump($uIndex);
$htmlFinal = '';
$htmlFinal .= $htmltop;
@@ -157,18 +169,18 @@ EOT;
mkdir($dir, 0777, true);
/*
START MAIN LOOP HERE
*
* For each unique item index, now grab item data
*
START MAIN LOOP HERE
*
* For each unique item index, now grab item data
*
*/
foreach ($uIndex as $u) {
//$items[] = $idata->uniqueItems($u['index'], true);
//var_dump($u['index']);
$item = $idata->uniqueItems($u['index'], true);
$itemBoxTop = <<<EOT
<div class="center item_desc" style="">
@@ -184,14 +196,14 @@ EOT;
</div>
</div>
</div>
EOT;
EOT;
echo $itemBoxTop;
ob_flush();
$htmlFinal .= $itemBoxTop;
//index
$props = "<ul><li class='statindex gold'>{$item['index']}</li>";
@@ -218,8 +230,6 @@ EOT;
//sock
$props .= "<li style='color: white;' class=''>{$item["gemsockets"]}</li>";
foreach ($item['props'] as $prop) {
if ($prop['string'][0]) {
$props .= "<li class='blue'>{$prop['string'][0]}</li>";
@@ -235,7 +245,7 @@ EOT;
echo $itemBoxBottom;
ob_flush();
$htmlFinal .= $props.$itemBoxBottom;
$htmlFinal .= $props . $itemBoxBottom;
}// end loop
echo $htmlbottom;
@@ -244,3 +254,214 @@ EOT;
file_put_contents("$dir/uniqueitems.html", $htmlFinal);
header("Location: /docs/{$_SESSION['modname']}/uniqueitems.html");
}
/*
*
*
*
*
*
@cmd = genDocCube
*
*
*
*
*
*/
if ($cmd == "genDocCube") {
$item_quality_params = [
"any" => "Any item (*Not Advised)",
"low" => "low quality",
"hiq" => "superior",
"nor" => "Normal",
"mag" => "Magic",
"rar" => "Rare",
"set" => "Set",
"uni" => "Unique",
"crf" => "Crafted",
"tmp" => "Tempered",
"eth" => "Ethereal",
"noe" => "Not Ethereal",
"nos" => "No Socket (for input)",
"sock" => "# sockets (eg: sock=>4)",
"pre" => "Prefix (ID from magicprefix.txt) - ID => (Row Number - 2)",
"suf" => "Suffix (ID from magicsuffix.txt) - ID => (Row Number - 2)",
"rep" => "Repair durability",
"rch" => "Recharge Quantity",
"qty" => 'amount of same item(eg: "hpot, qty => 3" means 3 hp potions)',
"upg" => "For inputs only, Item is upgraded.",
"bas" => "Base item",
"exc" => "Exceptional",
"eli" => "Elite",
"usetype" => "Uses base type of input1 for output",
"useitem" => "Uses item from input 1",
"uns" => "Unsocket Item(destroys gems)",
"rem" => "Unsocket Item(removes gems)",
"reg" => "Regenerate? Seems to reroll the item",
"mod" => "Transfers properties from input1 to output item.",
];
// get all cube rows
$sql = "SELECT * FROM cubemain WHERE enabled=1";
$res = PDO_FetchAll($sql);
$desc = $res['description'];
/*
*
* Process each cube row here
for each cube row
*
*/
foreach ($res as $r) {
//ddump($r);
// grab all inputs
$input_codes = array_filter(
[
"input 1" => $r["input 1"],
"input 2" => $r["input 2"],
"input 3" => $r["input 3"],
"input 4" => $r["input 4"],
"input 5" => $r["input 5"],
"input 6" => $r["input 6"],
"input 7" => $r["input 7"],
]
);
foreach ($input_codes as $inputNum => $value) {
if (str_contains($value, ',')) {
$input_codes[$inputNum] = explode(",", $value); // hpot,qty=3
$oarray = explode(",", $value); // hpot,qty=3
// For each input code // hpot,qty=3 like mpot/hpot/magharv
// if spelldescstr is set, use it. Else use item string tbl
// first find the item code in either armor, misc, or weapons
// then get spelldesc/spelldescstr
$sql = "SELECT spelldescstr FROM `misc` WHERE `code`=\"{$oarray[0]}\"";
$spelldescstr = PDO_FetchOne($sql);
if (!empty($spelldescstr)) { // spelldescstr has value then grab it from tbl
$sql = "SELECT `String` FROM `strings` WHERE Key=\"$spelldescstr\"";
$str = PDO_FetchOne($sql);
} else { // grab item code's tbl string
$sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
$str = PDO_FetchOne($sql);
}
// if empty str == 4-letter code, so just display
if (empty($str)) {
$input_codes[$inputNum][0] = $oarray[0];
} else {
$input_codes[$inputNum][0] = $str;
}
} else {
$sql = "SELECT spelldescstr FROM `misc` WHERE `code`=\"$value\"";
$spelldescstr = PDO_FetchOne($sql);
if (!empty($spelldescstr)) { // spelldescstr has value then grab it from tbl
$sql = "SELECT `String` FROM `strings` WHERE Key=\"$spelldescstr\"";
$str = PDO_FetchOne($sql);
} else { // grab item code's tbl string
$sql = "SELECT `String` FROM `strings` WHERE Key=\"$value\"";
$str = PDO_FetchOne($sql);
}
// if empty str == 4-letter code, so just display
if (empty($str)) {
$input_codes[$inputNum] = $value;
} else {
$input_codes[$inputNum] = $str;
}
}
}
/*
* TODO: processs output, output b, output c
*
*
*/
// grab all inputs
$output_codes = array_filter(
[
"output" => str_replace('"', "", $r["output"]),
"output b" => str_replace('"', "", $r["output b"]),
"output c" => str_replace('"', "", $r["output c"])
]
);
//var_dump($output_codes);
foreach ($output_codes as $outputNum => $value) {
if (str_contains($value, ',')) {
$output_codes[$outputNum] = explode(",", $value); // hpot,qty=3
$oarray = explode(",", $value); // hpot,qty=3
$sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
$str = PDO_FetchOne($sql);
// if empty str == 4-letter code, so just display
if (empty($str)) {
$output_codes[$outputNum][0] = $oarray[0];
} else {
$output_codes[$outputNum][0] = $str;
}
} else { // else output code is three/four letter code
$sql = "SELECT `String` FROM `strings` WHERE Key=\"$value\"";
$str = PDO_FetchOne($sql);
// if empty str == 4-letter code, so just display
if (empty($str)) {
$output_codes[$outputNum] = $value;
} else {
$output_codes[$outputNum] = $str;
}
}
}
$output = array_merge($input_codes, $output_codes);
//var_dump($output);
/*
* TODO: process mods for each output
*
*
*/
$m = null;
for ($counter = 1; $counter <= 5; $counter++) {
$mods = array_filter([
"mod $counter" => $r["mod $counter"],
"mod $counter chance" => $r["mod $counter chance"],
"mod $counter param" => $r["mod $counter param"],
"mod $counter min" => $r["mod $counter min"],
"mod $counter max" => $r["mod $counter max"],
"b mod $counter" => $r["b mod $counter"],
"b mod $counter chance" => $r["b mod $counter chance"],
"b mod $counter param" => $r["b mod $counter param"],
"b mod $counter min" => $r["b mod $counter min"],
"b mod $counter max" => $r["b mod $counter max"],
"c mod $counter" => $r["c mod $counter"],
"c mod $counter chance" => $r["c mod $counter chance"],
"c mod $counter param" => $r["c mod $counter param"],
"c mod $counter min" => $r["c mod $counter min"],
"c mod $counter max" => $r["c mod $counter max"],
]);
$m[] = array_filter($mods);
}
$output['mods'] = array_filter($m);
var_dump($output);
unset($output);
}// end each row loop
}