{$_SESSION['modname']} $type

Auto generated with D2Modder by Hash Casper

EOT; $htmlbottom = << 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; echo $htmltop; ob_flush(); $dir = getcwd() . "/docs/{$_SESSION['modname']}"; mkdir($dir, 0777, true); /* 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; $itemBoxBottom = <<

EOT; echo $itemBoxTop; ob_flush(); $htmlFinal .= $itemBoxTop; //index $props = ""; // $itemFull .= $itemBoxTop . $props . $itemBoxBottom; // echo $itemFull; echo $props; echo $itemBoxBottom; ob_flush(); $htmlFinal .= $props . $itemBoxBottom; }// end loop echo $htmlbottom; $htmlFinal .= $htmlbottom; file_put_contents("$dir/uniqueitems.html", $htmlFinal); header("Location: /docs/{$_SESSION['modname']}/uniqueitems.html"); } /* * * * * * @cmd = genDocCube * * * * * */ 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; } if ($cmd == "genDocCube") { echo $htmltop; echo << 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; } EOT; echo << Recipe Input 1 Input 2 Input 3 Input 4 Input 5 Input 6 Input 7 Output 1 Output 2 Output 3 EOT; $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 LIMIT 1500"; $res = PDO_FetchAll($sql); /* * * Process each cube row here for each cube row * */ foreach ($res as $r) { $desc = $r['description']; //var_dump($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 `String` FROM `strings` WHERE Key=\"{$oarray[0]}\""; $str = PDO_FetchOne($sql); // if empty str == 4-letter code, call getItemName() if (empty($str)) { $input_codes[$inputNum][0] = ($oarray[0]); } else { $input_codes[$inputNum][0] = $str; } // get image $input_codes[$inputNum]["img"] = getImage($oarray[0]); } else { $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 `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; } // 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; } } /* * 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; } $output_codes[$outputNum]["img"] = getImage($oarray[0]); } else { // else output code is three/four letter code $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; } $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]; } } } } //var_dump($output_codes); $output = array_merge($input_codes, $output_codes); // Set description $output['desc'] = $desc; //var_dump($output); //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); /* * Echo out each row as HTML with all the data it may have * */ // echo ""; // foreach ($output as $k => $v) { // // // if input 1, input 2 is an array // // if (is_array($v)){ // echo "{$v[0]}: {$v[1]}"; // echo "{$v[0]}: {$v[1]}"; // } else { // // $img = ""; // // if input 1, input 2 ... etc. are not arrays // echo ''; // } // } // echo ""; ?>
"; } ?>


"; } ?>


"; } ?>


"; } ?>


"; } ?>


"; } ?>


"; } ?>

"; } ?>
"; } if ($output["mods"][0]["mod $i chance"]) { echo "Chance:{$output["mods"][0]["mod $i chance"]}
"; } if ($output["mods"][0]["mod $i min"]) { echo "Min:{$output["mods"][0]["mod $i min"]}
"; } if ($output["mods"][0]["mod $i max"]) { echo "Max:{$output["mods"][0]["mod $i max"]}"; } } ?>

"; } ?>

"; } if ($output["mods"][1]["b mod $i chance"]) { echo "Chance:{$output["mods"][1]["b mod $i chance"]}
"; } if ($output["mods"][1]["b mod $i min"]) { echo "Min:{$output["mods"][1]["b mod $i min"]}
"; } if ($output["mods"][1]["b mod $i max"]) { echo "Max:{$output["mods"][1]["b mod $i max"]}"; } } ?>

"; } ?>

"; } if ($output["mods"][2]["c mod $i chance"]) { echo "Chance:{$output["mods"][2]["c mod $i chance"]}
"; } if ($output["mods"][2]["c mod $i min"]) { echo ">Min:{$output["mods"][2]["c mod $i min"]}
"; } if ($output["mods"][2]["c mod $i max"]) { echo "Max:{$output["mods"][2]["c mod $i max"]}"; } } ?> EOT; echo $htmlbottom; }