mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2024-11-30 04:26:03 +00:00
244 lines
6.1 KiB
PHP
Executable File
244 lines
6.1 KiB
PHP
Executable File
<?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.
|
|
|
|
* 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.
|
|
|
|
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'];
|
|
|
|
|
|
/*
|
|
@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
|
|
//<!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">
|
|
// <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>
|
|
//
|
|
// .item_desc {
|
|
// height: 600px;
|
|
// width: 620px;
|
|
// position: relative;
|
|
// left: 0;
|
|
// top: 0;
|
|
//
|
|
// /* background: black url(/img/items/bg.png) center top no-repeat;*/
|
|
//
|
|
// 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;
|
|
// }
|
|
//
|
|
// </style>
|
|
// <script src="res/jquery-3.6.0.min.js"></script>
|
|
// <script src="res/bootstrap.bundle.min.js"></script>
|
|
// <script src="res/app.js"></script>
|
|
//
|
|
//</script>
|
|
//<title>D2Modder</title>
|
|
//</head>
|
|
//
|
|
//<body>
|
|
// <div class="container container-top">
|
|
//<h1>{$_SESSION['modname']} Unique Items</h1>
|
|
//<p>Auto generated with D2Modder by Hash Casper</p>
|
|
//
|
|
//EOT;
|
|
//
|
|
// $htmlbottom = <<<EOT
|
|
// </div>
|
|
//</body>
|
|
//</html>
|
|
//EOT;
|
|
|
|
// $htmlFinal = $htmltop;
|
|
//
|
|
// //echo $htmltop;
|
|
//
|
|
// $dir = getcwd()."/docs/{$_SESSION['modname']}";
|
|
//
|
|
// mkdir($dir, 0777, true);
|
|
|
|
// for each unique item index, now grab the whole row
|
|
foreach ($uIndex as $u) {
|
|
|
|
|
|
//$items[] = $idata->uniqueItems($u['index'], true);
|
|
|
|
//var_dump($u['index']);
|
|
|
|
|
|
$item = $idata->uniqueItems($u['index'], true);
|
|
//
|
|
//
|
|
//
|
|
echo ($item['index']) . "\n";
|
|
ob_flush();
|
|
//
|
|
// //index
|
|
// $props = "<li class='gold'>{$item['index']}</li>";
|
|
//
|
|
// //type
|
|
// $props .= "<li class='gold'>{$item["*type"]}</li>";
|
|
//
|
|
// //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
|
|
// if ($item["gemsockets"] && $item["gemsockets"] > 6) {
|
|
// $item["gemsockets"] = 6;
|
|
// $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>";
|
|
// }
|
|
// }
|
|
//
|
|
// $itemBoxTop = <<<EOT
|
|
//<div class="center item_desc" style="">
|
|
//
|
|
// <div style="height: 116px;background: url(img/items/bg.png) center top no-repeat;">
|
|
// <a href="" target="_blank" class="item_debug_link">
|
|
// <img style="" class="item img-fluid" src="img/items/{$item["invfile"]}.png">
|
|
// </a>
|
|
//
|
|
// </div>
|
|
// <div class="item_stats" style="">
|
|
// <div class="">
|
|
// <p>
|
|
//EOT;
|
|
//
|
|
// $itemBoxBottom = <<<EOT
|
|
// </p>
|
|
// </div>
|
|
// </div>
|
|
//</div>
|
|
//
|
|
//EOT;
|
|
// $itemFull .= $itemBoxTop . $props . $itemBoxBottom;
|
|
//// echo $itemFull;
|
|
//// ob_flush();
|
|
//
|
|
// $htmlFinal .= $itemFull;
|
|
|
|
|
|
}// end loop
|
|
|
|
|
|
|
|
// $htmlFinal .= $htmlbottom;
|
|
|
|
//file_put_contents("$dir/uniqueitems.html", $htmlFinal);
|
|
//header("Location: /docs/{$_SESSION['modname']}/uniqueitems.html");
|
|
|
|
}
|