mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2024-11-30 04:26:03 +00:00
87 lines
2.1 KiB
PHP
87 lines
2.1 KiB
PHP
<?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/>.
|
|
*/
|
|
|
|
ini_set('display_errors', 1);
|
|
ini_set('log_errors', 1);
|
|
|
|
$filename = 'd2im.conf';
|
|
|
|
if (file_exists($filename)) {
|
|
|
|
$p = file_get_contents($filename);
|
|
if (is_dir($p)) {
|
|
$path = $p;
|
|
define('TXT_PATH', $p);
|
|
} else {
|
|
header('Location: /src/D2Config.php');
|
|
}
|
|
|
|
// Misc functions
|
|
require_once "./src/D2Functions.php";
|
|
|
|
// D2 Files Loader
|
|
require_once './src/D2Files.php';
|
|
|
|
// Txt Parser
|
|
require_once './src/D2TxtParser.php';
|
|
|
|
// parse txt data
|
|
$files = new D2Files();
|
|
|
|
$parser = new D2TxtParser();
|
|
|
|
$armor = $parser->parseFile($files->getFile('Armor'));
|
|
$weapon = $parser->parseFile($files->getFile('Weapons'));
|
|
$prop = $parser->parseFile($files->getFile('Properties'));
|
|
$uni = $parser->parseFile($files->getFile('UniqueItems'));
|
|
$sets = $parser->parseFile($files->getFile('Sets'));
|
|
$setitems = $parser->parseFile($files->getFile('SetItems'));
|
|
|
|
$u = $files->getFile("UniqueItems");
|
|
$s = $files->getFile("SetItems");
|
|
|
|
|
|
if (!empty($_POST)) {
|
|
require_once './src/D2SaveFile.php';
|
|
$saver = new D2SaveFile();
|
|
|
|
if ($_POST['formtype'] == "uniqueitems") {
|
|
$saver->save($u);
|
|
$saver->saveTblEnries("UniqueItems.tbl.txt");
|
|
}
|
|
if ($_POST['formtype'] == "setitems") {
|
|
|
|
|
|
|
|
|
|
$saver->save($s);
|
|
$saver->saveTblEnries("SetItems.tbl.txt");
|
|
}
|
|
}
|
|
|
|
|
|
// load app
|
|
require_once './src/index.php';
|
|
} else {
|
|
header('Location: ./src/D2Config.php');
|
|
}
|
|
?>
|