Gendocs cube generator fixes. More needed. Removed Exocet font. Need to fix image paths.

This commit is contained in:
Hash Borgir 2023-05-30 12:38:50 -06:00
parent dd662e26f6
commit 961a061662
2 changed files with 162 additions and 217 deletions

View File

@ -85,23 +85,22 @@ $htmlbottom = "</div></body></html>";
// genDocUniqueItems // genDocUniqueItems
if ($cmd == "genDocUniqueItems") { if ($cmd == "genDocUniqueItems") {
$tableTop = '<table border="1" class="utable">
$tableTop = '
<table border=1 class="utable">
<thead> <thead>
<tr> <tr>
<th class="gold uname">Name</th> <th class="gold uname">Name</th>
<th class="orange ulvl">Lvl</th> <th class="orange ulvl">Lvl</th>
<th class="orange ulvlreq">Lvl Req</th> <th class="orange ulvlreq">Lvl Req</th>
<th class="yellow utype">Type</th> <th class="yellow utype">Type</th>
<th class="green ucode">Code</th> <th class="green ucode">Code</th>
<th class="uitem">Item</th> <th class="uitem">Item</th>
</tr> </tr>
</thead> </thead>
<tbody>'; <tbody>';
$tableBottom = '</tbody> </table>';
// grab unique item index only (to save on memory) $tableBottom = '</tbody></table>';
// Grab unique item index only (to save on memory)
$sql = "SELECT `index` FROM `uniqueitems` WHERE `enabled`='1'"; $sql = "SELECT `index` FROM `uniqueitems` WHERE `enabled`='1'";
$uIndex = PDO_FetchAll($sql); $uIndex = PDO_FetchAll($sql);
@ -112,85 +111,83 @@ if ($cmd == "genDocUniqueItems") {
echo $tableTop; echo $tableTop;
ob_flush(); ob_flush();
// main loop: grab the data for each uIndex (index from uniqueitems.txt) // Main loop: grab the data for each uIndex (index from uniqueitems.txt)
foreach ($uIndex as $u) { foreach ($uIndex as $u) {
$item = $idata->uniqueItems($u['index'], true); $item = $idata->uniqueItems($u['index'], true);
$itemBoxTop = "<tr>"; $itemBoxTop = '<tr>';
$itemBoxTop .= "<td class='gold uname' style=''>{$item['index']}</td>"; $itemBoxTop .= '<td class="gold uname">' . $item['index'] . '</td>';
$itemBoxTop .= "<td class='orange ulvl' style=''>{$item['lvl']}</td>"; $itemBoxTop .= '<td class="orange ulvl">' . $item['lvl'] . '</td>';
$itemBoxTop .= "<td class='orange ulvlreq' style=''>{$item["lvl req"]}</td>"; $itemBoxTop .= '<td class="orange ulvlreq">' . $item["lvl req"] . '</td>';
$itemBoxTop .= "<td class='utype' style=''>{$item["*type"]}</td>"; $itemBoxTop .= '<td class="utype">' . $item["*type"] . '</td>';
$itemBoxTop .= "<td class='ucode' style=''>{$item['code']}</td>"; $itemBoxTop .= '<td class="ucode">' . $item['code'] . '</td>';
$itemBoxTop .= <<<HTML
<td class="item">
<div class="center item_desc">
<div class="itemimage" style="height: 116px; background: url(img/items/bg.png) center top no-repeat;">
<img class="item img-fluid" src="img/items/{$item["invfile"]}.png">
</div>
<div class="item_stats">
<div style="width:auto; margin: 0 auto; background:#111; display:inline-block;">
<p>
HTML;
$itemBoxTop .= <<<EOT $itemBoxBottom = <<<HTML
<td class='item' style=''> </p>
<div class="center item_desc" style=""> </div>
</div>
<div class="itemimage" style="height: 116px;background: url(img/items/bg.png) center top no-repeat;"> </div>
<img style="" class="item img-fluid" src="img/items/{$item["invfile"]}.png"> </td>
</div> </tr>
<div class="item_stats" style=""> HTML;
<div style="width:auto; margin: 0 auto; background:#111; display:inline-block;">
<p>
EOT;
$itemBoxBottom = <<<EOT
</p>
</div>
</div>
</div>
</td>
EOT;
$itemBoxBottom .= "</tr>";
echo $itemBoxTop; echo $itemBoxTop;
ob_flush(); ob_flush();
$htmlFinal .= $itemBoxTop; $htmlFinal .= $itemBoxTop;
//index // Index
$props = "<ul><li class='statindex gold'>{$item['index']}</li>"; $props = '<ul><li class="statindex gold">' . $item['index'] . '</li>';
//type // Type
$props .= "<li class='stattype gold'>({$item["*type"]})</li>"; $props .= '<li class="stattype gold">(' . $item["*type"] . ')</li>';
//level // Level
$props .= "<li style='color: white;' class=''>Level: {$item["lvl"]}</li>"; $props .= '<li style="color: white;">Level: ' . $item["lvl"] . '</li>';
//lvlreq // Level Required
$props .= "<li style='color: white;' class=''>Level Required: {$item["lvl req"]}</li>"; $props .= '<li style="color: white;">Level Required: ' . $item["lvl req"] . '</li>';
//code // Item Code
$props .= "<li style='color: #aaa;' class=''>Item Code: {$item["code"]}</li>"; $props .= '<li style="color: #aaa;">Item Code: ' . $item["code"] . '</li>';
//reqstr // Required Strength
if ($item["reqstr"]) { if ($item["reqstr"]) {
$props .= "<li style='color: white;' class=''>{$item["reqstr"]}</li>"; $props .= '<li style="color: white;">' . $item["reqstr"] . '</li>';
} }
//reqdex
// Required Dexterity
if ($item["reqdex"]) { if ($item["reqdex"]) {
$props .= "<li style='color: white;' class=''>{$item["reqdex"]}</li>"; $props .= '<li style="color: white;">' . $item["reqdex"] . '</li>';
} }
//sock
$props .= "<li style='color: white;' class=''>{$item["gemsockets"]}</li>"; // Sockets
$props .= '<li style="color: white;">' . $item["gemsockets"] . '</li>';
foreach ($item['props'] as $prop) { foreach ($item['props'] as $prop) {
if ($prop['string'][0]) { if ($prop['string'][0]) {
$props .= "<li class='blue'>{$prop['string'][0]}</li>"; $props .= '<li class="blue">' . $prop['string'][0] . '</li>';
} }
} }
$props .= "</ul>"; $props .= '</ul>';
// $itemFull .= $itemBoxTop . $props . $itemBoxBottom;
// echo $itemFull;
echo $props; echo $props;
echo $itemBoxBottom; echo $itemBoxBottom;
ob_flush(); ob_flush();
$htmlFinal .= $props . $itemBoxBottom; $htmlFinal .= $props . $itemBoxBottom;
}// end loop }
$htmlFinal .= $tableBottom; $htmlFinal .= $tableBottom;
@ -206,13 +203,11 @@ if ($cmd == "genDocUniqueItems") {
if ($cmd == "genDocCube") { if ($cmd == "genDocCube") {
$htmlFinal = ''; $htmlFinal = '';
$htmlFinal .= $htmltop; $htmlFinal .= $htmltop;
echo $htmltop;
echo $htmltop; ob_flush();
ob_flush();
$table = <<<EOT $table = <<<EOT
<table border=1 class="cubetable"> <table border=1 class="cubetable">
<thead> <thead>
<tr> <tr>
<th>Recipe</th> <th>Recipe</th>
<th>Input 1</th> <th>Input 1</th>
@ -226,7 +221,7 @@ if ($cmd == "genDocCube") {
<th> 2</th> <th> 2</th>
<th> 3</th> <th> 3</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
EOT; EOT;
echo $table; echo $table;
@ -266,42 +261,33 @@ EOT;
// get all cube rows // get all cube rows
// changed enabled=1 to enabled > 0 for CubeOps.dll users // changed enabled=1 to enabled > 0 for CubeOps.dll users
$sql = " $sql = "SELECT *
SELECT * FROM cubemain
FROM cubemain WHERE enabled > 0
WHERE enabled > 0 AND `input 1` <> 'ib3'
AND `input 1` <> 'ib3' AND `description` NOT LIKE '%Stone x%'
AND `description` NOT LIKE '%Stone x%' AND `description` NOT LIKE '%Unstacker%' ";
AND `description` NOT LIKE '%Unstacker%'
";
$res = PDO_FetchAll($sql); $res = PDO_FetchAll($sql);
// ddump($res);
// process each cube row here // process each cube row here
foreach ($res as $r) { foreach ($res as $r) {
$desc = str_replace('+', '<br>+<br>', $r['description']); $desc = str_replace('+', '<br>+<br>', $r['description']);
$desc = str_replace('->', '<br><span class="" style="color: gold;font-size:1.25em;">=<br>', $desc); $desc = str_replace('->', '<br><span class="" style="color: gold;">=<br>', $desc);
$desc .= "</span>"; $desc .= "</span>";
// grab all inputs // grab all inputs
$input_codes = array_filter( $input_codes = array_filter([
[ "input 1" => $r["input 1"],
"input 1" => $r["input 1"], "input 2" => $r["input 2"],
"input 2" => $r["input 2"], "input 3" => $r["input 3"],
"input 3" => $r["input 3"], "input 4" => $r["input 4"],
"input 4" => $r["input 4"], "input 5" => $r["input 5"],
"input 5" => $r["input 5"], "input 6" => $r["input 6"],
"input 6" => $r["input 6"], "input 7" => $r["input 7"],
"input 7" => $r["input 7"], ]);
]
);
foreach ($input_codes as $inputNum => $value) { foreach ($input_codes as $inputNum => $value) {
if (str_contains($value, ',')) { if (str_contains($value, ',')) {
$input_codes[$inputNum] = explode(",", $value); // hpot,qty=3 $input_codes[$inputNum] = explode(",", $value); // hpot,qty=3
@ -310,14 +296,12 @@ EOT;
// if spelldescstr is set, use it. Else use item string tbl // if spelldescstr is set, use it. Else use item string tbl
// first find the item code in either armor, misc, or weapons // first find the item code in either armor, misc, or weapons
// then get spelldesc/spelldescstr // then get spelldesc/spelldescstr
// $sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\""; // $sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
// $str = PDO_FetchOne($sql); // $str = PDO_FetchOne($sql);
$str = $strings[$oarray[0]]; // Assuming $strings array is defined
$str = $strings[$oarray[0]];
// if empty str == 4-letter code, call $idoc->getItemName() // if empty str == 4-letter code, call $idoc->getItemName()
if (empty($str)) { if (empty($str)) {
$input_codes[$inputNum][0] = ($oarray[0]); $input_codes[$inputNum][0] = $oarray[0];
} else { } else {
$input_codes[$inputNum][0] = $str; $input_codes[$inputNum][0] = $str;
} }
@ -333,14 +317,12 @@ EOT;
// if spelldescstr is set, use it. Else use item string tbl // if spelldescstr is set, use it. Else use item string tbl
// first find the item code in either armor, misc, or weapons // first find the item code in either armor, misc, or weapons
// then get spelldesc/spelldescstr // then get spelldesc/spelldescstr
// $sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\""; // $sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
// $str = PDO_FetchOne($sql); // $str = PDO_FetchOne($sql);
$str = $strings[$oarray[0]]; // Assuming $strings array is defined
$str = $strings[$oarray[0]];
// if empty str == 4-letter code, so just display // if empty str == 4-letter code, so just display
if (empty($str)) { if (empty($str)) {
$input_codes[$inputNum][0] = ($oarray[0]); $input_codes[$inputNum][0] = $oarray[0];
} else { } else {
$input_codes[$inputNum][0] = $str; $input_codes[$inputNum][0] = $str;
} }
@ -353,24 +335,32 @@ EOT;
// processs output, output b, output c // processs output, output b, output c
// grab all inputs // grab all inputs
$output_codes = array_filter( $output_codes = array_filter(
[ [
"output" => str_replace('"', "", $r["output"]), "output" => str_replace('"', "", $r["output"]),
"output b" => str_replace('"', "", $r["output b"]), "output b" => str_replace('"', "", $r["output b"]),
"output c" => str_replace('"', "", $r["output c"]) "output c" => str_replace('"', "", $r["output c"])
] ]
); );
// var_dump($output_codes);
// ddump($output_codes); // output_codes is an array
// output codes of outputs, like output, output b, output c.
// each output can have 3 or 4 level item code or a amu,mag,pre=331 code
// outputNum is output a, or output b, or output c, should have been called outputLetter whatever
foreach ($output_codes as $outputNum => $value) { foreach ($output_codes as $outputNum => $value) {
//outputNum will be output, or output b, or c
// value will be 3/4 letter code or sometimes 'Cow Portal' or words
// or rin,mag,pre=353
// if value contains a comma, e.g., rin,mag,pre=353
// then explode it at the comma
if (str_contains($value, ',')) { if (str_contains($value, ',')) {
$output_codes[$outputNum] = explode(",", $value); // hpot,qty=3 $output_codes[$outputNum] = explode(",", $value); // hpot,qty=3
$oarray = explode(",", $value); // hpot,qty=3 $oarray = explode(",", $value); // hpot,qty=3
$sql = $strings[$oarray[0]]; // "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
$str = $strings[$oarray[0]]; // "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
// clean str // clean str
// $str = PDO_FetchOne($sql); // $str = PDO_FetchOne($sql);
if (str_contains($str, "ÿc")) { if (str_contains($str, "ÿc")) {
$p = "/ÿc[\d:;\/.]/i"; $p = "/ÿc[\d:;\/.]/i";
$str = preg_replace($p, "", $str); $str = preg_replace($p, "", $str);
@ -389,7 +379,7 @@ EOT;
$output_codes[$outputNum] = explode(",", $value); // hpot,qty=3 $output_codes[$outputNum] = explode(",", $value); // hpot,qty=3
$oarray = explode(",", $value); // hpot,qty=3 $oarray = explode(",", $value); // hpot,qty=3
$sql = $strings[$oarray[0]]; //"SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\""; $str = $strings[$oarray[0]]; //"SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
// clean color codes // clean color codes
// $str = PDO_FetchOne($sql); // $str = PDO_FetchOne($sql);
@ -409,7 +399,7 @@ EOT;
$output_codes[$outputNum]["img"] = $idoc->getImage($oarray[0]); $output_codes[$outputNum]["img"] = $idoc->getImage($oarray[0]);
} }
//var_dump($output_codes);
// if output[1] or output[2], output[3], output[4] contains `=' sign // if output[1] or output[2], output[3], output[4] contains `=' sign
// parse_str or explode at = to get modifer and value // parse_str or explode at = to get modifer and value
// if modifier = pre or suf, find ID in magic prefix/suffix line. // if modifier = pre or suf, find ID in magic prefix/suffix line.
@ -487,17 +477,16 @@ EOT;
"par" => $par, "par" => $par,
"min" => $min, "min" => $min,
"max" => $max, "max" => $max,
// "val1" => $funcval['val1'], // "val1" => $funcval['val1'],
// "func1" => $funcval['func1'] // "func1" => $funcval['func1']
// 'item' => $return // 'item' => $return
]; ];
$output['mods'][$k]["str"] = $idesc->getDesc($params); $output['mods'][$k]["str"] = $idesc->getDesc($params);
} }
// dump($output);
//var_dump($output);
// var_dump($output);
// At this point, $output contains raw accurte data // At this point, $output contains raw accurte data
// TODO: build output correctly // TODO: build output correctly
// input1-input7,output a,b,c item codes can be found in $strings // input1-input7,output a,b,c item codes can be found in $strings
@ -551,11 +540,7 @@ EOT;
$output["output"][0] = preg_replace($p, "", $output["output"][0]); $output["output"][0] = preg_replace($p, "", $output["output"][0]);
} }
$key1 = array_search($output["input $i"][0], $itemtypesTbl); $htmlRow .= '<span style="color: #AF833B;">' . $output["output"][0] . "</span><br>";
//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); $key1 = array_search($output["input $i"][0], $itemtypesTbl);
if (str_contains($output["output"][1], "ÿc")) { if (str_contains($output["output"][1], "ÿc")) {
@ -563,9 +548,9 @@ EOT;
$output["output"][1] = preg_replace($p, "", $output["output"][1]); $output["output"][1] = preg_replace($p, "", $output["output"][1]);
} }
if ($i_params[$output["output"][0]]) { if ($i_params[$output["output"][0]]) {
$htmlRow .= '<span style="color: #AF833B;">' . $output["output"][0] . "</span><br>"; $htmlRow .= '<span style="color: #AF833B;">' . $i_params[$output["output"][0]] . "</span><br>";
} else { } else {
$htmlRow .= $output["output"][0] . "<br>"; $htmlRow .= $i_params[$output["output"][0]] . "<br>";
} }
if ($i_params[$output["output"][1]]) { if ($i_params[$output["output"][1]]) {
$htmlRow .= $i_params[$output["output"][1]] . "<br>"; $htmlRow .= $i_params[$output["output"][1]] . "<br>";
@ -626,7 +611,7 @@ EOT;
} }
$htmlRow .= "</td>"; $htmlRow .= "</td>";
$htmlRow .= "<td class='_output3'>"; // change _output3 to normal $htmlRow .= "<td class='_output3'>"; // change _output3 to normal
if (!empty($output["output c"]["img"])) { if (!empty($output["output c"]["img"])) {
$htmlRow .= "<img src='img/items/{$output["output c"]["img"]}'><br>"; $htmlRow .= "<img src='img/items/{$output["output c"]["img"]}'><br>";
if (str_contains($output["output c"][0], "ÿc")) { if (str_contains($output["output c"][0], "ÿc")) {
@ -673,21 +658,19 @@ EOT;
echo $htmlbottom; echo $htmlbottom;
ob_flush(); ob_flush();
$htmlFinal .= $tableBottom . $htmlbottom; $htmlFinal .= $tableBottom . $htmlbottom;
// echo $htmlFinal;
// echo $htmlFinal;
// save file and redirect to it // save file and redirect to it
file_put_contents("$dir/cubemain.html", $htmlFinal); file_put_contents("$dir/cubemain.html", $htmlFinal);
header("Location: docs/{$_SESSION['modname']}/cubemain.html"); header("Location: docs/{$_SESSION['modname']}/cubemain.html");
} }
if ($cmd == "getImages") { if ($cmd == "getImages") {
$sql = " $sql = "SELECT code,invfile,type,type2 FROM armor
SELECT code,invfile,type,type2 FROM armor UNION ALL
UNION ALL SELECT code,invfile,type,type2 FROM misc
SELECT code,invfile,type,type2 FROM misc UNION ALL
UNION ALL SELECT code,invfile,type,type2 FROM weapons";
SELECT code,invfile,type,type2 FROM weapons";
$res = PDO_FetchAll($sql); $res = PDO_FetchAll($sql);
$isc = null; $isc = null;
foreach ($res as $r) { foreach ($res as $r) {
@ -807,7 +790,6 @@ if ($cmd == "genDocGems") {
//echo $table; //echo $table;
$htmlFinal .= $table; $htmlFinal .= $table;
//ob_flush(); //ob_flush();
// $gems are all the gems, processed, now display them // $gems are all the gems, processed, now display them
foreach ($gems as $g) { foreach ($gems as $g) {
@ -859,16 +841,15 @@ if ($cmd == "genDocGems") {
$htmlFinal .= $htmlRow; $htmlFinal .= $htmlRow;
//echo $htmlRow; //echo $htmlRow;
// ob_flush(); // ob_flush();
} }
$htmlFinal .= $tableBottom . $htmlbottom; $htmlFinal .= $tableBottom . $htmlbottom;
//echo $tableBottom . $htmlbottom; //echo $tableBottom . $htmlbottom;
//ob_flush(); //ob_flush();
//ob_start(); //ob_start();
file_put_contents("$dir/gems.html", $htmlFinal); file_put_contents("$dir/gems.html", $htmlFinal);
header("Location: /docs/{$_SESSION['modname']}/gems.html",TRUE,301); header("Location: /docs/{$_SESSION['modname']}/gems.html", TRUE, 301);
} }
@ -925,31 +906,14 @@ if ($cmd == 'genDocRunewords') {
$rr[5] = str_replace('', '', $strings[$rune['Rune5']]); $rr[5] = str_replace('', '', $strings[$rune['Rune5']]);
$rr[6] = str_replace('', '', $strings[$rune['Rune6']]); $rr[6] = str_replace('', '', $strings[$rune['Rune6']]);
if (str_contains($rr[1], "ÿc")) { for ($i = 1; $i <= 6; $i++) {
$p = "/ÿc[\d:;\/.]/i"; if (str_contains($rr[$i], "ÿc")) {
$rr[1] = preg_replace($p, "", $rr[1]); $p = "/ÿc[\d:;\/.]/i";
} $rr[$i] = preg_replace($p, "", $rr[$i]);
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); $rr = array_filter($rr);
$rune_count = count($rr); $rune_count = count($rr);
$rune_count_duplicates = array_count_values($rr); $rune_count_duplicates = array_count_values($rr);
@ -1176,27 +1140,23 @@ EOT;
$data['nameable'] = "<span class=''>Can be personalized by Anya</span>"; $data['nameable'] = "<span class=''>Can be personalized by Anya</span>";
} }
if ($r['stat1']) { $statFields = ['stat1', 'stat2', 'stat3'];
$stats['stat1'] = "{$r['stat1']}"; $calcFields = ['calc1', 'calc2', 'calc3'];
}
if ($r['stat2']) { foreach ($statFields as $field) {
$stats['stat2'] = "{$r['stat2']}"; if (isset($r[$field])) {
} $stats[$field] = "{$r[$field]}";
if ($r['stat3']) { }
$stats['stat3'] = "{$r['stat3']}";
} }
if ($r['calc1']) { foreach ($calcFields as $field) {
$stats['calc1'] = "{$r['calc1']}"; if (isset($r[$field])) {
} $stats[$field] = "{$r[$field]}";
if ($r['calc2']) { }
$stats['calc2'] = "{$r['calc2']}";
}
if ($r['calc3']) {
$stats['calc3'] = "{$r['calc3']}";
} }
$data = array_filter($data); $data = array_filter($data);
if ($stats) if ($stats)
$stat = array_filter($stats); $stat = array_filter($stats);
@ -1246,6 +1206,7 @@ EOT;
// Armor.txt docs generator
if ($cmd == 'genDocArmor') { if ($cmd == 'genDocArmor') {
$tableTop = <<<EOT $tableTop = <<<EOT
@ -1281,15 +1242,10 @@ EOT;
} else { } else {
$indestructable = "No"; $indestructable = "No";
} }
$imgUnique = (!empty($r['uniqueinvfile'])) ? "<br><img src='img/items/{$r['uniqueinvfile']}.png'>" : "";
$imgSet = (!empty($r['setinvfile'])) ? "<br><img src='img/items/{$r['setinvfile']}.png'>" : "";
$imgUnique = (!empty($r['uniqueinvfile'])) ? "<br><img src='img/items/{$r['uniqueinvfile']}.png'>" : "";
$imgSet = (!empty($r['setinvfile'])) ? "<br><img src='img/items/{$r['setinvfile']}.png'>" : "";
if (!empty($r['auto prefix'])) { if (!empty($r['auto prefix'])) {
$sql = "SELECT * FROM automagic WHERE `group` = ?"; $sql = "SELECT * FROM automagic WHERE `group` = ?";
$ret = PDO_FetchRow($sql, [$r['auto prefix']]); $ret = PDO_FetchRow($sql, [$r['auto prefix']]);
@ -1327,7 +1283,7 @@ EOT;
$strbonus = (!empty($r['StrBonus'])) ? "Strength Bonus: <span class='white'>{$r['StrBonus']}" : ""; $strbonus = (!empty($r['StrBonus'])) ? "Strength Bonus: <span class='white'>{$r['StrBonus']}" : "";
$block = (!empty($r['block'])) ? "Block: <span class='white'>{$r['block']}</span>" : ""; $block = (!empty($r['block'])) ? "Block: <span class='white'>{$r['block']}</span>" : "";
$tr .= <<<EOT $tr .= <<<EOT
<tr> <tr>
<td style="text-align: left;"> <td style="text-align: left;">
@ -1360,35 +1316,30 @@ EOT;
<li class="blue" style="margin-bottom: 30px;"><span class="white">{$props[2]}</span></li> <li class="blue" style="margin-bottom: 30px;"><span class="white">{$props[2]}</span></li>
<li class="blue">$strbonus</li> <li class="blue">$strbonus</li>
<li class="blue">$block</li> <li class="blue">$block</li>
</ul> </ul>
</td> </td>
<td>Level: <br> {$r['level']}</td> <td>Level: <br> {$r['level']}</td>
<td>Level Required: <br> {$r['levelreq']}</td> <td>Level Required: <br> {$r['levelreq']}</td>
<td>Requird Strength: <br> {$r['reqstr']}</td> <td>Requird Strength: <br> {$r['reqstr']}</td>
<td>Min AC: <br> {$r['minac']}</td> <td>Min AC: <br> {$r['minac']}</td>
<td>Max AC: <br> {$r['maxac']}</td> <td>Max AC: <br> {$r['maxac']}</td>
<td>Block: <br> {$r['block']}</td> <td>Block: <br> {$r['block']}</td>
</tr> </tr>
EOT; EOT;
} }
$htmlFinal = $htmltop . $tableTop . $tr . $tableBottom . $htmlbottom; $htmlFinal = $htmltop . $tableTop . $tr . $tableBottom . $htmlbottom;
ob_flush(); ob_flush();
echo $htmlFinal; echo $htmlFinal;
//file_put_contents("$dir/armor.html", $htmlFinal); file_put_contents("$dir/armor.html", $htmlFinal);
//header("Location: docs/{$_SESSION['modname']}/armor.html"); header("Location: docs/{$_SESSION['modname']}/armor.html");
} }
if ($cmd == 'genDocWeapons') {
// Generate weapons.txt docs
if ($cmd == 'genDocWeapons') {
$tableTop = <<<EOT $tableTop = <<<EOT
<style> <style>
body { font-family: Tahoma,Arial,Sans-Serif} body { font-family: Tahoma,Arial,Sans-Serif}
@ -1413,7 +1364,6 @@ EOT;
$res = PDO_FetchAll($sql); $res = PDO_FetchAll($sql);
foreach ($res as $r) { foreach ($res as $r) {
$name = (!empty($strings[$r['namestr']])) ? $strings[$r['namestr']] : $r['name']; $name = (!empty($strings[$r['namestr']])) ? $strings[$r['namestr']] : $r['name'];
if ($r['indestructible'] == '1') { if ($r['indestructible'] == '1') {
@ -1422,9 +1372,8 @@ EOT;
$indestructable = "No"; $indestructable = "No";
} }
$imgUnique = (!empty($r['uniqueinvfile'])) ? "<br><img src='img/items/{$r['uniqueinvfile']}.png'>" : "";
$imgUnique = (!empty($r['uniqueinvfile'])) ? "<br><img src='img/items/{$r['uniqueinvfile']}.png'>" : ""; $imgSet = (!empty($r['setinvfile'])) ? "<br><img src='img/items/{$r['setinvfile']}.png'>" : "";
$imgSet = (!empty($r['setinvfile'])) ? "<br><img src='img/items/{$r['setinvfile']}.png'>" : "";
if (!empty($r['auto prefix'])) { if (!empty($r['auto prefix'])) {
$sql = "SELECT * FROM automagic WHERE `group` = ?"; $sql = "SELECT * FROM automagic WHERE `group` = ?";
@ -1461,15 +1410,15 @@ EOT;
} }
$strbonus = (!empty($r['StrBonus'])) ? "Strength Bonus: <span class='white'>{$r['StrBonus']}" : ""; $strbonus = (!empty($r['StrBonus'])) ? "Strength Bonus: <span class='white'>{$r['StrBonus']}" : "";
if (empty($r['mindmg']) OR empty($r['maxdmg'])){ if (empty($r['mindmg']) OR empty($r['maxdmg'])) {
$mindmg = $r['2handmindam']; $mindmg = $r['2handmindam'];
$maxdmg = $r['2handmaxdam']; $maxdmg = $r['2handmaxdam'];
} else { } else {
$mindmg = $r['mindmg']; $mindmg = $r['mindmg'];
$maxdmg = $r['maxdmg']; $maxdmg = $r['maxdmg'];
} }
$tr .= <<<EOT $tr .= <<<EOT
<tr> <tr>
<td style="text-align: left"> <td style="text-align: left">
@ -1502,18 +1451,14 @@ EOT;
<li class="blue" style="margin-bottom: 30px;"><span class="white">{$props[2]}</span></li> <li class="blue" style="margin-bottom: 30px;"><span class="white">{$props[2]}</span></li>
<li class="blue">$strbonus</li> <li class="blue">$strbonus</li>
<li class="blue">$block</li> <li class="blue">$block</li>
</ul> </ul>
</td> </td>
<td>Level: <br> {$r['level']}</td> <td>Level: <br> {$r['level']}</td>
<td>Level Required: <br> {$r['levelreq']}</td> <td>Level Required: <br> {$r['levelreq']}</td>
<td>Requird Strength: <br> {$r['reqstr']}</td> <td>Requird Strength: <br> {$r['reqstr']}</td>
<td>Min Dmg: <br> {$mindmg}</td> <td>Min Dmg: <br> {$mindmg}</td>
<td>Max Dmg: <br> {$maxdmg}</td> <td>Max Dmg: <br> {$maxdmg}</td>
</tr> </tr>
EOT; EOT;
} }

View File

@ -28,7 +28,7 @@ $htmltop = <<<EOT
body{ body{
background: white; background: white;
font-family: ExocetHeavy; font-family: ;
} }
table, table th, table td, table tr { table, table th, table td, table tr {
background: #000; background: #000;