mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-09-18 09:32:08 +00:00
latest working copy, file backup, tbl entry done
This commit is contained in:
76
index.php
76
index.php
@@ -1,44 +1,66 @@
|
||||
<?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);
|
||||
|
||||
// Misc functions
|
||||
require_once "./src/functions.php";
|
||||
|
||||
// Configuration Options & Constants
|
||||
require_once "./config.php";
|
||||
|
||||
//$path = $d2_dir."data\\global\\excel\\";
|
||||
$path = $d2_dir;
|
||||
// $path is a shorter alias to writing TXT_DIR a lot.
|
||||
$path = TXT_DIR;
|
||||
|
||||
$post = $_POST;
|
||||
if (!empty($post['code'])) {
|
||||
array_filter($post['code']);
|
||||
// Txt Parser
|
||||
require_once './src/txtParser.php';
|
||||
|
||||
if(!empty($post['code'][0])) {
|
||||
$post['code'] = $post['code'][0];
|
||||
} else {
|
||||
$post['code'] = $post['code'][1];
|
||||
}
|
||||
}
|
||||
require_once 'uniqueitems.php';
|
||||
$fp = fopen($u, 'a+');
|
||||
// parse txt data
|
||||
$txtParser = new txtParser();
|
||||
$parser = $txtParser->getData();
|
||||
$armor = $parser['a'];
|
||||
$weapon = $parser['w'];
|
||||
$prop = $parser['p'];
|
||||
$uni = $parser['u'];
|
||||
|
||||
echo "<pre>";
|
||||
print_r($post);
|
||||
|
||||
foreach ($post as $p){
|
||||
echo "$p\t";
|
||||
}
|
||||
|
||||
echo "</pre>";
|
||||
$files = $txtParser->getFiles();
|
||||
$u = $files['u'];
|
||||
|
||||
if (!empty($_POST)) {
|
||||
fputcsv($fp, $post, "\t");
|
||||
|
||||
// write for .tbl
|
||||
$str = '"'.$post["index"].'" "'. $post["index"] .'"';
|
||||
|
||||
file_put_contents("UniqueItemsTblEntries.txt", $str, FILE_APPEND | LOCK_EX);
|
||||
// Saver Object
|
||||
require_once './src/saveFile.php';
|
||||
$saver = new saveFile();
|
||||
|
||||
// save files
|
||||
$saver->saveTxt($u);
|
||||
$saver->saveTblEnries($path);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// header stuff
|
||||
require_once './src/D2UM.php';
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user