2021-05-06 08:36:04 +00:00
|
|
|
<?php
|
|
|
|
error_reporting(E_ERROR | E_PARSE);
|
|
|
|
set_time_limit(-1);
|
|
|
|
ini_set('max_input_time', '-1');
|
|
|
|
ini_set('max_execution_time', '0');
|
|
|
|
session_start();
|
|
|
|
ob_start();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Copyright (C) 2021 Hash Borgir
|
|
|
|
|
|
|
|
This file is part of D2Modder
|
|
|
|
|
|
|
|
Redistribution and use in source and binary forms, with
|
|
|
|
or without modification, are permitted provided that the
|
|
|
|
following conditions are met:
|
|
|
|
|
|
|
|
* Redistributions of source code must retain the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer.
|
|
|
|
|
|
|
|
* Redistributions in binary form must reproduce the above
|
|
|
|
copyright notice, this list of conditions and the
|
|
|
|
following disclaimer in the documentation and/or other
|
|
|
|
materials provided with the distribution.
|
|
|
|
|
2021-05-10 07:15:44 +00:00
|
|
|
* This software must not be used for commercial purposes
|
2021-05-06 08:36:04 +00:00
|
|
|
* without my consent. Any sales or commercial use are prohibited
|
|
|
|
* without my express knowledge and consent.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY!
|
|
|
|
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
|
|
|
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
|
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
|
|
|
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
|
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
|
|
|
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
|
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
|
|
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
|
|
|
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
*/
|
|
|
|
require_once './config.php';
|
|
|
|
require_once './_pdo.php';
|
|
|
|
define('DB_FILE', $_SESSION['modname'] . ".db");
|
|
|
|
PDO_Connect("sqlite:" . DB_FILE);
|
|
|
|
|
|
|
|
require_once "./src/D2Functions.php";
|
|
|
|
require_once './src/D2ItemData.php';
|
|
|
|
|
|
|
|
$idata = new D2ItemData();
|
|
|
|
|
|
|
|
if (!empty($_GET['cmd']))
|
|
|
|
$cmd = $_GET['cmd'];
|
|
|
|
|
|
|
|
|
2021-05-10 16:41:26 +00:00
|
|
|
if ($cmd == 'genDocCube') {
|
|
|
|
$type = "Cube Recipes";
|
|
|
|
$align = 'left';
|
|
|
|
}
|
|
|
|
if ($cmd == 'genDocUniqueItems') {
|
|
|
|
$type = "Unique Items";
|
|
|
|
$align = 'center';
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-05-10 07:15:44 +00:00
|
|
|
$htmltop = <<<EOT
|
2021-05-06 10:12:03 +00:00
|
|
|
<!doctype html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<!-- Required meta tags -->
|
|
|
|
<meta charset="utf-8">
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
|
|
|
|
|
|
<!-- Bootstrap CSS -->
|
|
|
|
<link rel="stylesheet" href="res/bootstrap.min.css">
|
2021-05-10 07:15:44 +00:00
|
|
|
<link rel="stylesheet" href="res/font-awesome.min.css">
|
2021-05-06 10:12:03 +00:00
|
|
|
<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">
|
2021-05-10 16:41:26 +00:00
|
|
|
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.24/css/jquery.dataTables.css">
|
2021-05-06 10:12:03 +00:00
|
|
|
<link rel="stylesheet" href="res/style.css">
|
|
|
|
<style>
|
2021-05-10 07:15:44 +00:00
|
|
|
|
2021-05-07 09:18:29 +00:00
|
|
|
body{
|
|
|
|
background: black;
|
2021-05-10 16:41:26 +00:00
|
|
|
text-align: $align;
|
|
|
|
font-family: Lato;
|
2021-05-07 09:18:29 +00:00
|
|
|
}
|
2021-05-06 10:12:03 +00:00
|
|
|
|
|
|
|
|
2021-05-07 09:18:29 +00:00
|
|
|
.item_stats{
|
|
|
|
width: auto;
|
|
|
|
height: auto;
|
|
|
|
}
|
|
|
|
.item_desc {
|
|
|
|
height: auto;
|
|
|
|
text-align: center;
|
|
|
|
padding: 10px;
|
2021-05-06 10:12:03 +00:00
|
|
|
text-transform: uppercase;
|
|
|
|
}
|
|
|
|
.green {
|
|
|
|
color: #00FF00; /*Set items*/
|
|
|
|
}
|
|
|
|
.gold{
|
|
|
|
color: #A59263; /*Set items*/
|
|
|
|
}
|
|
|
|
.orange{
|
|
|
|
color: #FFA500; /*Set items*/
|
|
|
|
}
|
|
|
|
.yellow {
|
|
|
|
color: #FFFF00; /*Set items*/
|
|
|
|
}
|
2021-05-07 09:18:29 +00:00
|
|
|
|
2021-05-06 10:12:03 +00:00
|
|
|
.blue {
|
|
|
|
color: #4169E1;
|
|
|
|
}
|
2021-05-10 07:15:44 +00:00
|
|
|
|
2021-05-06 10:12:03 +00:00
|
|
|
</style>
|
2021-05-10 16:41:26 +00:00
|
|
|
|
|
|
|
<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>
|
2021-05-06 10:12:03 +00:00
|
|
|
<script src="res/bootstrap.bundle.min.js"></script>
|
|
|
|
<script src="res/app.js"></script>
|
|
|
|
|
2021-05-10 16:41:26 +00:00
|
|
|
<script>
|
|
|
|
|
|
|
|
|
|
|
|
$(document).ready(function() {
|
|
|
|
$('.cubetable').dataTable();
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
|
2021-05-06 10:12:03 +00:00
|
|
|
<title>D2Modder</title>
|
|
|
|
</head>
|
2021-05-10 07:15:44 +00:00
|
|
|
|
|
|
|
<body>
|
|
|
|
<div class="container container-top">
|
2021-05-10 16:41:26 +00:00
|
|
|
<h1>{$_SESSION['modname']} $type</h1>
|
2021-05-06 10:12:03 +00:00
|
|
|
<p>Auto generated with D2Modder by Hash Casper</p>
|
2021-05-10 07:15:44 +00:00
|
|
|
|
2021-05-06 10:12:03 +00:00
|
|
|
EOT;
|
|
|
|
|
2021-05-10 07:15:44 +00:00
|
|
|
$htmlbottom = <<<EOT
|
2021-05-06 10:12:03 +00:00
|
|
|
</div>
|
2021-05-10 16:41:26 +00:00
|
|
|
|
2021-05-06 10:12:03 +00:00
|
|
|
</body>
|
2021-05-10 07:15:44 +00:00
|
|
|
</html>
|
2021-05-06 10:12:03 +00:00
|
|
|
EOT;
|
2021-05-10 07:15:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
@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);
|
|
|
|
|
|
|
|
|
2021-05-06 10:12:03 +00:00
|
|
|
$htmlFinal = '';
|
|
|
|
$htmlFinal .= $htmltop;
|
|
|
|
|
|
|
|
echo $htmltop;
|
|
|
|
ob_flush();
|
|
|
|
|
|
|
|
$dir = getcwd() . "/docs/{$_SESSION['modname']}";
|
2021-05-06 08:36:04 +00:00
|
|
|
|
2021-05-06 10:12:03 +00:00
|
|
|
mkdir($dir, 0777, true);
|
|
|
|
|
|
|
|
/*
|
2021-05-10 07:15:44 +00:00
|
|
|
START MAIN LOOP HERE
|
|
|
|
*
|
|
|
|
* For each unique item index, now grab item data
|
|
|
|
*
|
2021-05-06 10:12:03 +00:00
|
|
|
*/
|
2021-05-10 07:15:44 +00:00
|
|
|
|
2021-05-06 10:12:03 +00:00
|
|
|
foreach ($uIndex as $u) {
|
2021-05-06 08:36:04 +00:00
|
|
|
//$items[] = $idata->uniqueItems($u['index'], true);
|
|
|
|
//var_dump($u['index']);
|
|
|
|
|
|
|
|
$item = $idata->uniqueItems($u['index'], true);
|
2021-05-10 07:15:44 +00:00
|
|
|
|
2021-05-06 10:12:03 +00:00
|
|
|
$itemBoxTop = <<<EOT
|
|
|
|
<div class="center item_desc" style="">
|
|
|
|
|
|
|
|
<div style="height: 116px;background: url(img/items/bg.png) center top no-repeat;">
|
|
|
|
<img style="" class="item img-fluid" src="img/items/{$item["invfile"]}.png">
|
|
|
|
</div>
|
|
|
|
<div class="item_stats" style="">
|
2021-05-07 09:18:29 +00:00
|
|
|
<div style="width:auto; margin: 0 auto; background:#111; display:inline-block;">
|
2021-05-06 10:12:03 +00:00
|
|
|
<p>
|
|
|
|
EOT;
|
|
|
|
$itemBoxBottom = <<<EOT
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2021-05-10 07:15:44 +00:00
|
|
|
|
|
|
|
EOT;
|
|
|
|
|
2021-05-06 10:12:03 +00:00
|
|
|
echo $itemBoxTop;
|
2021-05-06 08:36:04 +00:00
|
|
|
ob_flush();
|
2021-05-10 07:15:44 +00:00
|
|
|
|
2021-05-06 10:12:03 +00:00
|
|
|
$htmlFinal .= $itemBoxTop;
|
2021-05-10 07:15:44 +00:00
|
|
|
|
2021-05-06 10:12:03 +00:00
|
|
|
//index
|
2021-05-07 09:18:29 +00:00
|
|
|
$props = "<ul><li class='statindex gold'>{$item['index']}</li>";
|
2021-05-06 10:12:03 +00:00
|
|
|
|
|
|
|
//type
|
2021-05-07 09:18:29 +00:00
|
|
|
$props .= "<li class='stattype gold'>({$item["*type"]})</li>";
|
2021-05-06 10:12:03 +00:00
|
|
|
|
|
|
|
//level
|
|
|
|
$props .= "<li style='color: white;' class=''>Level: {$item["lvl"]}</li>";
|
|
|
|
|
|
|
|
//lvlreq
|
|
|
|
$props .= "<li style='color: white;' class=''>Level Required: {$item["lvl req"]}</li>";
|
|
|
|
|
|
|
|
//code
|
|
|
|
$props .= "<li style='color: #aaa;' class=''>Item Code: {$item["code"]}</li>";
|
|
|
|
|
|
|
|
//reqstr
|
|
|
|
if ($item["reqstr"]) {
|
|
|
|
$props .= "<li style='color: white;' class=''>{$item["reqstr"]}</li>";
|
|
|
|
}
|
|
|
|
//reqdex
|
|
|
|
if ($item["reqdex"]) {
|
|
|
|
$props .= "<li style='color: white;' class=''>{$item["reqdex"]}</li>";
|
|
|
|
}
|
|
|
|
//sock
|
2021-05-07 09:18:29 +00:00
|
|
|
$props .= "<li style='color: white;' class=''>{$item["gemsockets"]}</li>";
|
|
|
|
|
2021-05-06 10:12:03 +00:00
|
|
|
foreach ($item['props'] as $prop) {
|
|
|
|
if ($prop['string'][0]) {
|
|
|
|
$props .= "<li class='blue'>{$prop['string'][0]}</li>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$props .= "</ul>";
|
|
|
|
|
|
|
|
// $itemFull .= $itemBoxTop . $props . $itemBoxBottom;
|
|
|
|
// echo $itemFull;
|
|
|
|
|
|
|
|
echo $props;
|
|
|
|
echo $itemBoxBottom;
|
|
|
|
ob_flush();
|
|
|
|
|
2021-05-10 07:15:44 +00:00
|
|
|
$htmlFinal .= $props . $itemBoxBottom;
|
2021-05-06 08:36:04 +00:00
|
|
|
}// end loop
|
|
|
|
|
2021-05-06 10:12:03 +00:00
|
|
|
echo $htmlbottom;
|
|
|
|
|
|
|
|
$htmlFinal .= $htmlbottom;
|
|
|
|
file_put_contents("$dir/uniqueitems.html", $htmlFinal);
|
|
|
|
header("Location: /docs/{$_SESSION['modname']}/uniqueitems.html");
|
2021-05-06 08:36:04 +00:00
|
|
|
}
|
2021-05-10 07:15:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
@cmd = genDocCube
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2021-05-10 16:41:26 +00:00
|
|
|
function getImage($code) {
|
|
|
|
$sql = "SELECT invfile FROM armor WHERE `code`=\"$code\" OR `type`=\"$code\" OR `type2`=\"$code\"";
|
|
|
|
$img = PDO_FetchOne($sql);
|
|
|
|
|
|
|
|
if (empty($img)) {
|
|
|
|
$sql = "SELECT invfile FROM misc WHERE `code`=\"$code\" OR `type`=\"$code\" OR `type2`=\"$code\"";
|
|
|
|
$img = PDO_FetchOne($sql);
|
|
|
|
}
|
|
|
|
if (empty($img)) {
|
|
|
|
$sql = "SELECT invfile FROM weapons WHERE `code`=\"$code\" OR `type`=\"$code\" OR `type2`=\"$code\"";
|
|
|
|
$img = PDO_FetchOne($sql);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($img)) {
|
|
|
|
return "$img.png";
|
|
|
|
} else {
|
|
|
|
return "1.png";
|
|
|
|
}
|
|
|
|
|
|
|
|
return "$img.png";
|
|
|
|
}
|
|
|
|
|
|
|
|
function getItemName($code) {
|
|
|
|
$sql = "SELECT name FROM armor WHERE `code`=\"$code\" OR `type`=\"$code\" OR `type2`=\"$code\"";
|
|
|
|
$name = PDO_FetchOne($sql);
|
|
|
|
|
|
|
|
if (empty($name)) {
|
|
|
|
$sql = "SELECT name FROM misc WHERE `code`=\"$code\" OR `type`=\"$code\" OR `type2`=\"$code\"";
|
|
|
|
$name = PDO_FetchOne($sql);
|
|
|
|
}
|
|
|
|
if (empty($name)) {
|
|
|
|
$sql = "SELECT name FROM weapons WHERE `code`=\"$code\" OR `type`=\"$code\" OR `type2`=\"$code\"";
|
|
|
|
$name = PDO_FetchOne($sql);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $name;
|
|
|
|
}
|
|
|
|
|
2021-05-10 07:15:44 +00:00
|
|
|
if ($cmd == "genDocCube") {
|
|
|
|
|
2021-05-10 16:41:26 +00:00
|
|
|
echo $htmltop;
|
|
|
|
echo <<<EOT
|
|
|
|
<style>
|
|
|
|
|
|
|
|
body{
|
|
|
|
background: white;
|
|
|
|
color: black;
|
|
|
|
font-family: ExocetLight;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
table, table th, table td, table tr {
|
|
|
|
background: #000;
|
|
|
|
color: #ccc;
|
|
|
|
}
|
|
|
|
|
|
|
|
.item_stats{
|
|
|
|
width: auto;
|
|
|
|
height: auto;
|
|
|
|
}
|
|
|
|
.item_desc {
|
|
|
|
height: auto;
|
|
|
|
text-align: center;
|
|
|
|
padding: 10px;
|
|
|
|
text-transform: uppercase;
|
|
|
|
}
|
|
|
|
.green {
|
|
|
|
color: #00FF00; /*Set items*/
|
|
|
|
}
|
|
|
|
.gold{
|
|
|
|
color: #A59263; /*Set items*/
|
|
|
|
}
|
|
|
|
.orange{
|
|
|
|
color: #FFA500; /*Set items*/
|
|
|
|
}
|
|
|
|
.yellow {
|
|
|
|
color: #FFFF00; /*Set items*/
|
|
|
|
}
|
|
|
|
|
|
|
|
.blue {
|
|
|
|
color: #4169E1;
|
|
|
|
}
|
|
|
|
|
|
|
|
table {
|
|
|
|
font-family: Lato;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
td {
|
|
|
|
width: 200px;
|
|
|
|
|
|
|
|
text-align: center;
|
|
|
|
vertical-align: top;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
EOT;
|
|
|
|
|
|
|
|
echo <<<EOT
|
|
|
|
<table border=1 class="cubetable">
|
|
|
|
<thead>
|
|
|
|
<tr>
|
|
|
|
<th>Recipe</th>
|
|
|
|
<th>Input 1</th>
|
|
|
|
<th>Input 2</th>
|
|
|
|
<th>Input 3</th>
|
|
|
|
<th>Input 4</th>
|
|
|
|
<th>Input 5</th>
|
|
|
|
<th>Input 6</th>
|
|
|
|
<th>Input 7</th>
|
|
|
|
<th>Output 1</th>
|
|
|
|
<th>Output 2</th>
|
|
|
|
<th>Output 3</th>
|
|
|
|
</tr>
|
|
|
|
</thead>
|
|
|
|
<tbody>
|
|
|
|
|
|
|
|
EOT;
|
2021-05-10 07:15:44 +00:00
|
|
|
|
|
|
|
$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
|
2021-05-10 16:41:26 +00:00
|
|
|
$sql = "SELECT * FROM cubemain WHERE enabled=1 LIMIT 1500";
|
2021-05-10 07:15:44 +00:00
|
|
|
$res = PDO_FetchAll($sql);
|
|
|
|
|
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Process each cube row here
|
|
|
|
for each cube row
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($res as $r) {
|
2021-05-10 16:41:26 +00:00
|
|
|
$desc = $r['description'];
|
|
|
|
//var_dump($r);
|
2021-05-10 07:15:44 +00:00
|
|
|
// 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"],
|
|
|
|
]
|
|
|
|
);
|
|
|
|
|
2021-05-10 16:41:26 +00:00
|
|
|
foreach ($input_codes as $inputNum => $value) {
|
2021-05-10 07:15:44 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
2021-05-10 16:41:26 +00:00
|
|
|
$sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
|
|
|
|
$str = PDO_FetchOne($sql);
|
2021-05-10 07:15:44 +00:00
|
|
|
|
2021-05-10 16:41:26 +00:00
|
|
|
// if empty str == 4-letter code, call getItemName()
|
2021-05-10 07:15:44 +00:00
|
|
|
if (empty($str)) {
|
2021-05-10 16:41:26 +00:00
|
|
|
$input_codes[$inputNum][0] = ($oarray[0]);
|
2021-05-10 07:15:44 +00:00
|
|
|
} else {
|
|
|
|
$input_codes[$inputNum][0] = $str;
|
|
|
|
}
|
2021-05-10 16:41:26 +00:00
|
|
|
|
|
|
|
// get image
|
|
|
|
$input_codes[$inputNum]["img"] = getImage($oarray[0]);
|
2021-05-10 07:15:44 +00:00
|
|
|
} else {
|
2021-05-10 16:41:26 +00:00
|
|
|
$value .= ",";
|
|
|
|
$input_codes[$inputNum] = explode(",", $value); // hpot,qty=3
|
2021-05-10 07:15:44 +00:00
|
|
|
|
2021-05-10 16:41:26 +00:00
|
|
|
$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
|
2021-05-10 07:15:44 +00:00
|
|
|
|
2021-05-10 16:41:26 +00:00
|
|
|
|
|
|
|
$sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
|
|
|
|
$str = PDO_FetchOne($sql);
|
2021-05-10 07:15:44 +00:00
|
|
|
|
|
|
|
// if empty str == 4-letter code, so just display
|
|
|
|
if (empty($str)) {
|
2021-05-10 16:41:26 +00:00
|
|
|
$input_codes[$inputNum][0] = ($oarray[0]);
|
2021-05-10 07:15:44 +00:00
|
|
|
} else {
|
2021-05-10 16:41:26 +00:00
|
|
|
$input_codes[$inputNum][0] = $str;
|
2021-05-10 07:15:44 +00:00
|
|
|
}
|
2021-05-10 16:41:26 +00:00
|
|
|
|
|
|
|
// get image
|
|
|
|
$input_codes[$inputNum]["img"] = getImage($oarray[0]);
|
|
|
|
|
|
|
|
// $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][0] = $value;
|
|
|
|
// } else {
|
|
|
|
// $input_codes[$inputNum][0] = $str;
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// // get image
|
|
|
|
// $img = getImage($value);
|
|
|
|
// $input_codes[$inputNum . "_img"] = $img;
|
2021-05-10 07:15:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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)) {
|
2021-05-10 16:41:26 +00:00
|
|
|
$output_codes[$outputNum][0] = ($oarray[0]);
|
2021-05-10 07:15:44 +00:00
|
|
|
} else {
|
|
|
|
$output_codes[$outputNum][0] = $str;
|
|
|
|
}
|
2021-05-10 16:41:26 +00:00
|
|
|
|
|
|
|
$output_codes[$outputNum]["img"] = getImage($oarray[0]);
|
2021-05-10 07:15:44 +00:00
|
|
|
} else { // else output code is three/four letter code
|
2021-05-10 16:41:26 +00:00
|
|
|
$value .= ",";
|
|
|
|
|
|
|
|
$output_codes[$outputNum] = explode(",", $value); // hpot,qty=3
|
|
|
|
$oarray = explode(",", $value); // hpot,qty=3
|
|
|
|
$sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
|
2021-05-10 07:15:44 +00:00
|
|
|
$str = PDO_FetchOne($sql);
|
|
|
|
|
|
|
|
// if empty str == 4-letter code, so just display
|
|
|
|
if (empty($str)) {
|
2021-05-10 16:41:26 +00:00
|
|
|
$output_codes[$outputNum][0] = ($oarray[0]);
|
2021-05-10 07:15:44 +00:00
|
|
|
} else {
|
2021-05-10 16:41:26 +00:00
|
|
|
$output_codes[$outputNum][0] = $str;
|
|
|
|
}
|
|
|
|
|
|
|
|
$output_codes[$outputNum]["img"] = getImage($oarray[0]);
|
|
|
|
|
|
|
|
// $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;
|
|
|
|
// }
|
|
|
|
// // get image
|
|
|
|
// $img = getImage($value);
|
|
|
|
// $output_codes[$outputNum . "_img"] = $img;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// if output[1] or output[2], output[3], output[4] contains `=' sign
|
|
|
|
// parse_str or explode at = to get modifer and value
|
|
|
|
// if modifier = pre or suf, find ID in magic prefix/suffix line.
|
|
|
|
// if output is array we know it contains modifers and values
|
|
|
|
|
|
|
|
if (is_array($output_codes[$outputNum])) {
|
|
|
|
// 0 will always be item code.
|
|
|
|
// 1,2,3 can be mods, either can have =
|
|
|
|
// if 1,2,3 have = sign, explode and get mod = value
|
|
|
|
|
|
|
|
$itemcode = $output_codes[0];
|
|
|
|
|
|
|
|
$mod = array_filter([$output_codes[$outputNum][1], $output_codes[$outputNum][2], $output_codes[$outputNum][3]]);
|
|
|
|
|
|
|
|
//var_dump($mod);
|
|
|
|
|
|
|
|
foreach ($mod as $m) {
|
|
|
|
if (str_contains($m, '=')) {
|
|
|
|
$e = explode("=", $m);
|
|
|
|
$output_codes[$outputNum]['code'] = $e[0];
|
|
|
|
$output_codes[$outputNum]['value'] = $e[1];
|
|
|
|
}
|
2021-05-10 07:15:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-05-10 16:41:26 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//var_dump($output_codes);
|
|
|
|
|
2021-05-10 07:15:44 +00:00
|
|
|
$output = array_merge($input_codes, $output_codes);
|
2021-05-10 16:41:26 +00:00
|
|
|
|
|
|
|
// Set description
|
|
|
|
$output['desc'] = $desc;
|
|
|
|
|
2021-05-10 07:15:44 +00:00
|
|
|
//var_dump($output);
|
2021-05-10 16:41:26 +00:00
|
|
|
//var_dump($output);
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-05-10 07:15:44 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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);
|
|
|
|
|
2021-05-10 16:41:26 +00:00
|
|
|
/*
|
|
|
|
* Echo out each row as HTML with all the data it may have
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// echo "<tr>";
|
|
|
|
// foreach ($output as $k => $v) {
|
|
|
|
//
|
|
|
|
// // if input 1, input 2 is an array
|
|
|
|
//
|
|
|
|
// if (is_array($v)){
|
|
|
|
// echo "<td><img src=\"/img/items/{$v['img']}\">{$v[0]}: {$v[1]}</td>";
|
|
|
|
// echo "<td><img src=\"/img/items/{$v['img']}\">{$v[0]}: {$v[1]}</td>";
|
|
|
|
// } else {
|
|
|
|
//
|
|
|
|
// $img = "";
|
|
|
|
// // if input 1, input 2 ... etc. are not arrays
|
|
|
|
// echo '<td><img src="'.$o.'"></td>';
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
// echo "</tr>";
|
|
|
|
?>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td class="desc">
|
|
|
|
<?php echo $output['desc'] ?>
|
|
|
|
</td>
|
|
|
|
<td class="input1">
|
|
|
|
<?php
|
|
|
|
if (!empty($output["input 1"]["img"])) {
|
|
|
|
echo "<img src='/img/items/{$output["input 1"]["img"]}'><br>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<?php echo $output["input 1"][0] ?><br>
|
|
|
|
<?php echo $output["input 1"][1] ?><br>
|
|
|
|
</td>
|
|
|
|
<td class="input2">
|
|
|
|
<?php
|
|
|
|
if (!empty($output["input 2"]["img"])) {
|
|
|
|
echo "<img src='/img/items/{$output["input 2"]["img"]}'><br>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<?php echo $output["input 2"][0] ?><br>
|
|
|
|
<?php echo $output["input 2"][1] ?><br>
|
|
|
|
</td>
|
|
|
|
<td class="input3">
|
|
|
|
<?php
|
|
|
|
if (!empty($output["input 3"]["img"])) {
|
|
|
|
echo "<img src='/img/items/{$output["input 3"]["img"]}'><br>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<?php echo $output["input 3"][0] ?><br>
|
|
|
|
<?php echo $output["input 3"][1] ?><br>
|
|
|
|
</td>
|
|
|
|
<td class="input4">
|
|
|
|
<?php
|
|
|
|
if (!empty($output["input 4"]["img"])) {
|
|
|
|
echo "<img src='/img/items/{$output["input 4"]["img"]}'><br>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<?php echo $output["input 4"][0] ?><br>
|
|
|
|
<?php echo $output["input 4"][1] ?><br>
|
|
|
|
</td>
|
|
|
|
<td class="input5">
|
|
|
|
<?php
|
|
|
|
if (!empty($output["input 5"]["img"])) {
|
|
|
|
echo "<img src='/img/items/{$output["input 5"]["img"]}'><br>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<?php echo $output["input 5"][0] ?><br>
|
|
|
|
<?php echo $output["input 5"][1] ?><br>
|
|
|
|
</td>
|
|
|
|
<td class="input6">
|
|
|
|
<?php
|
|
|
|
if (!empty($output["input 6"]["img"])) {
|
|
|
|
echo "<img src='/img/items/{$output["input 6"]["img"]}'><br>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<?php echo $output["input 6"][0] ?><br>
|
|
|
|
<?php echo $output["input 6"][1] ?><br>
|
|
|
|
</td>
|
|
|
|
<td class="input7">
|
|
|
|
<?php
|
|
|
|
if (!empty($output["input 7"]["img"])) {
|
|
|
|
echo "<img src='/img/items/{$output["input 7"]["img"]}'><br>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<?php echo $output["input 7"][0] ?><br>
|
|
|
|
<?php echo $output["input 7"][1] ?><br>
|
|
|
|
</td>
|
|
|
|
<td class="output1">
|
|
|
|
<?php
|
|
|
|
if (!empty($output["output"]["img"])) {
|
|
|
|
echo "<img src='/img/items/{$output["output"]["img"]}'>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<?php echo $output["output"][0] ?>
|
|
|
|
<?php echo $output["output"][1] ?><br>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
for ($i = 1; $i <= 5; $i++) {
|
|
|
|
|
|
|
|
if ($output["mods"][0]["mod $i"]) {
|
|
|
|
echo "{$output["mods"][0]["mod $i"]}<br>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($output["mods"][0]["mod $i chance"]) {
|
|
|
|
echo "Chance:{$output["mods"][0]["mod $i chance"]}<br>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($output["mods"][0]["mod $i min"]) {
|
|
|
|
echo "Min:{$output["mods"][0]["mod $i min"]}<br>";
|
|
|
|
}
|
|
|
|
if ($output["mods"][0]["mod $i max"]) {
|
|
|
|
echo "Max:{$output["mods"][0]["mod $i max"]}";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</td>
|
|
|
|
<td class="output2">
|
|
|
|
<?php
|
|
|
|
if (!empty($output["output 2"]["img"])) {
|
|
|
|
echo "<p><img src='/img/items/{$output["output 2"]["img"]}'></p>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<p><?php echo $output["output b"][0] ?></p>
|
|
|
|
<p><?php echo $output["output b"][1] ?></p>
|
|
|
|
<?php
|
|
|
|
for ($i = 1; $i <= 5; $i++) {
|
|
|
|
|
|
|
|
if ($output["mods"][1]["b mod $i"]) {
|
|
|
|
echo "{$output["mods"][1]["b mod $i"]}<br>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($output["mods"][1]["b mod $i chance"]) {
|
|
|
|
echo "Chance:{$output["mods"][1]["b mod $i chance"]}<br>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($output["mods"][1]["b mod $i min"]) {
|
|
|
|
echo "Min:{$output["mods"][1]["b mod $i min"]}<br>";
|
|
|
|
}
|
|
|
|
if ($output["mods"][1]["b mod $i max"]) {
|
|
|
|
echo "Max:{$output["mods"][1]["b mod $i max"]}";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</td>
|
|
|
|
<td class="output3">
|
|
|
|
<?php
|
|
|
|
if (!empty($output["output 3"]["img"])) {
|
|
|
|
echo "<p><img src='/img/items/{$output["output 3"]["img"]}'></p>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<p><?php echo $output["output c"][2] ?></p>
|
|
|
|
<p><?php echo $output["output c"][1] ?></p>
|
|
|
|
<?php
|
|
|
|
for ($i = 1; $i <= 5; $i++) {
|
|
|
|
|
|
|
|
if ($output["mods"][2]["c mod $i"]) {
|
|
|
|
echo "{$output["mods"][2]["c mod $i"]}<br>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($output["mods"][2]["c mod $i chance"]) {
|
|
|
|
echo "Chance:{$output["mods"][2]["c mod $i chance"]}<br>";
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($output["mods"][2]["c mod $i min"]) {
|
|
|
|
echo ">Min:{$output["mods"][2]["c mod $i min"]}<br>";
|
|
|
|
}
|
|
|
|
if ($output["mods"][2]["c mod $i max"]) {
|
|
|
|
echo "Max:{$output["mods"][2]["c mod $i max"]}";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
//var_dump($output);
|
|
|
|
unset($output);
|
|
|
|
}// end each row loop
|
|
|
|
|
|
|
|
echo <<<EOT
|
|
|
|
</tbody>
|
|
|
|
<table>
|
|
|
|
EOT;
|
|
|
|
echo $htmlbottom;
|
|
|
|
}
|