2021-03-23 08:13:54 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
|
|
|
D2UniqueMaker
|
|
|
|
GPLv2 (C) <2021> <HashCasper>
|
|
|
|
|
|
|
|
This file is part of D2UM.
|
|
|
|
|
|
|
|
D2UM is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
D2UM is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with D2UM. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2021-03-24 15:37:21 +00:00
|
|
|
ini_set('display_errors', 1);
|
|
|
|
error_reporting(1);
|
2021-03-23 08:13:54 +00:00
|
|
|
ini_set('log_errors', 1);
|
|
|
|
|
2021-03-26 14:37:56 +00:00
|
|
|
include "includes.php";
|
2021-03-24 10:26:51 +00:00
|
|
|
|
2021-03-26 18:31:13 +00:00
|
|
|
if (file_exists("d2im.db") && (file_exists($_SESSION['modname'].".db"))){
|
2021-03-24 15:47:27 +00:00
|
|
|
|
2021-03-26 18:31:13 +00:00
|
|
|
if (is_dir($_SESSION['path'])) {
|
|
|
|
define('TXT_PATH', $_SESSION['path']);
|
2021-03-23 08:13:54 +00:00
|
|
|
} else {
|
2021-03-23 08:55:21 +00:00
|
|
|
header('Location: /src/D2Config.php');
|
2021-03-23 08:13:54 +00:00
|
|
|
}
|
2021-03-24 10:26:51 +00:00
|
|
|
|
2021-03-26 14:37:56 +00:00
|
|
|
$db = new D2Database();
|
|
|
|
$parser = new D2TxtParser();
|
2021-03-24 10:26:51 +00:00
|
|
|
|
2021-03-26 14:37:56 +00:00
|
|
|
$armor = PDO_FetchAll('SELECT * FROM armor WHERE `spawnable`=1');
|
|
|
|
$weapon = PDO_FetchAll('SELECT * FROM weapons WHERE `spawnable`=1');
|
2021-03-23 18:35:28 +00:00
|
|
|
|
2021-03-26 14:37:56 +00:00
|
|
|
$prop = $parser->parseFile('Properties.txt');
|
|
|
|
|
2021-03-23 18:35:28 +00:00
|
|
|
// If there's data, process it and save
|
2021-03-23 08:13:54 +00:00
|
|
|
if (!empty($_POST)) {
|
2021-03-26 14:37:56 +00:00
|
|
|
|
2021-03-26 19:09:05 +00:00
|
|
|
// save db name from post into conf file
|
2021-03-26 14:37:56 +00:00
|
|
|
|
2021-03-23 08:13:54 +00:00
|
|
|
require_once './src/D2SaveFile.php';
|
|
|
|
$saver = new D2SaveFile();
|
|
|
|
|
2021-03-23 18:35:28 +00:00
|
|
|
// process post
|
|
|
|
// combine armor/weapon codes
|
|
|
|
$post = $_POST;
|
|
|
|
if (!empty($post['code'])) {
|
|
|
|
array_filter($post['code']);
|
|
|
|
|
|
|
|
if (!empty($post['code'][0])) {
|
|
|
|
$post['code'] = $post['code'][0];
|
|
|
|
} else {
|
|
|
|
$post['code'] = $post['code'][1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-24 10:26:51 +00:00
|
|
|
|
2021-03-23 08:13:54 +00:00
|
|
|
if ($_POST['formtype'] == "uniqueitems") {
|
2021-03-26 14:37:56 +00:00
|
|
|
|
|
|
|
|
2021-03-24 10:26:51 +00:00
|
|
|
// if ladder or carry1 is 0, set empty field.
|
|
|
|
if (!$post['ladder']) {
|
|
|
|
$post['ladder'] = '';
|
|
|
|
}
|
|
|
|
if (!$post['carry1']) {
|
|
|
|
$post['carry1'] = '';
|
|
|
|
}
|
|
|
|
$saver->save($u, $post);
|
2021-03-23 08:13:54 +00:00
|
|
|
$saver->saveTblEnries("UniqueItems.tbl.txt");
|
|
|
|
}
|
|
|
|
if ($_POST['formtype'] == "setitems") {
|
2021-03-24 10:26:51 +00:00
|
|
|
$saver->save($s, $post);
|
2021-03-23 08:13:54 +00:00
|
|
|
$saver->saveTblEnries("SetItems.tbl.txt");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-03-24 10:26:51 +00:00
|
|
|
// load app
|
2021-03-23 08:13:54 +00:00
|
|
|
require_once './src/index.php';
|
|
|
|
} else {
|
2021-03-23 08:55:21 +00:00
|
|
|
header('Location: ./src/D2Config.php');
|
2021-03-23 08:13:54 +00:00
|
|
|
}
|
2021-03-22 09:23:04 +00:00
|
|
|
?>
|