mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2025-10-13 08:24:24 -05:00
properties with missing stat1 and multiple stats item description done for unique items
This commit is contained in:
139
processFiles.php
139
processFiles.php
@@ -48,95 +48,106 @@ session_start();
|
||||
include "./_pdo.php";
|
||||
include "./config.php";
|
||||
|
||||
function processCubeMain() {
|
||||
function processFilesManuallyInSqlite() {
|
||||
|
||||
$bin = getcwd() . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "sqlite3.exe ";
|
||||
$dbfile = getcwd() . DIRECTORY_SEPARATOR . DB_FILE;
|
||||
$cubemain = TXT_PATH . "cubemain.txt";
|
||||
|
||||
exec("$bin $dbfile \".separator \\\"\\t\\\"\" \".import \\\"$cubemain\\\" cubemain\"");
|
||||
$bin = getcwd() . DIRECTORY_SEPARATOR . "bin" . DIRECTORY_SEPARATOR . "sqlite3.exe ";
|
||||
$dbfile = getcwd() . DIRECTORY_SEPARATOR . DB_FILE;
|
||||
$cubemain = TXT_PATH . "cubemain.txt";
|
||||
$misc = TXT_PATH . "Misc.txt";
|
||||
exec("$bin $dbfile \".separator \\\"\\t\\\"\" \".import \\\"$cubemain\\\" cubemain\"");
|
||||
exec("$bin $dbfile \".separator \\\"\\t\\\"\" \".import \\\"$misc\\\" misc\"");
|
||||
}
|
||||
|
||||
function processCubeMainLinux() {
|
||||
function processFilesManuallyInSqliteLinux() {
|
||||
|
||||
$bin = "/usr/bin/sqlite3";
|
||||
$dbfile = getcwd() . DIRECTORY_SEPARATOR . DB_FILE;
|
||||
$cubemain = TXT_PATH . "CubeMain.txt";
|
||||
$bin = "/usr/bin/sqlite3";
|
||||
$dbfile = getcwd() . DIRECTORY_SEPARATOR . DB_FILE;
|
||||
$cubemain = TXT_PATH . "CubeMain.txt";
|
||||
$misc = TXT_PATH . "Misc.txt";
|
||||
|
||||
exec("$bin $dbfile \".separator \\\"\\t\\\"\" \".import \\\"$cubemain\\\" cubemain\"");
|
||||
exec("$bin $dbfile \".separator \\\"\\t\\\"\" \".import \\\"$cubemain\\\" cubemain\"");
|
||||
exec("$bin $dbfile \".separator \\\"\\t\\\"\" \".import \\\"$misc\\\" misc\"");
|
||||
}
|
||||
|
||||
// check to see if config db exists or if for some reason it doesn't exist
|
||||
if (file_exists(APP_DB)) {
|
||||
if (file_exists($_SESSION['modname'] . ".db")) {
|
||||
unlink($_SESSION['modname'] . ".db"); // delete old mod db file
|
||||
}
|
||||
// Set CONSTANTS (if D2Modder.db exists, D2Config set the session mod correctly)
|
||||
define('FILTER_PROPERTIES_FILE', 'filterProperties.txt');
|
||||
define('DB_FILE', $_SESSION['modname'] . ".db");
|
||||
define('TXT_PATH', $_SESSION['path']);
|
||||
if (file_exists($_SESSION['modname'] . ".db")) {
|
||||
unlink($_SESSION['modname'] . ".db"); // delete old mod db file
|
||||
}
|
||||
// Set CONSTANTS (if D2Modder.db exists, D2Config set the session mod correctly)
|
||||
define('FILTER_PROPERTIES_FILE', 'filterProperties.txt');
|
||||
define('DB_FILE', $_SESSION['modname'] . ".db");
|
||||
define('TXT_PATH', $_SESSION['path']);
|
||||
|
||||
// require src
|
||||
require_once "./src/D2Functions.php";
|
||||
require_once "./src/D2Database.php";
|
||||
require_once './src/D2Files.php';
|
||||
require_once './src/D2TxtParser.php';
|
||||
require_once './src/D2Tbl.php';
|
||||
// require src
|
||||
require_once "./src/D2Functions.php";
|
||||
require_once "./src/D2Database.php";
|
||||
require_once './src/D2Files.php';
|
||||
require_once './src/D2TxtParser.php';
|
||||
require_once './src/D2Tbl.php';
|
||||
|
||||
// Create objects
|
||||
$files = new D2Files();
|
||||
$parser = new D2TxtParser();
|
||||
$db = new D2Database();
|
||||
// Create objects
|
||||
$files = new D2Files();
|
||||
$parser = new D2TxtParser();
|
||||
$db = new D2Database();
|
||||
|
||||
// Parse all files
|
||||
foreach ($files->files as $k => $v) {
|
||||
$data[$v] = $parser->parseFile($v);
|
||||
}
|
||||
// Parse all files
|
||||
foreach ($files->files as $k => $v) {
|
||||
$data[$v] = $parser->parseFile($v);
|
||||
}
|
||||
|
||||
|
||||
// Write all parse data to mod db
|
||||
foreach ($data as $k => $v) {
|
||||
$db->createTables($k, $v);
|
||||
$db->fillsTables($k, $v);
|
||||
}
|
||||
// Write all parse data to mod db
|
||||
foreach ($data as $k => $v) {
|
||||
$db->createTables($k, $v);
|
||||
$db->fillsTables($k, $v);
|
||||
}
|
||||
|
||||
processCubeMain('cubemain.txt');
|
||||
processCubeMainLinux('cubemain.txt');
|
||||
// put in html redirect as backup, because
|
||||
// for some odd reason windows gives
|
||||
// an error on header() but linux does not.
|
||||
// Process Files Manually In Sqlite
|
||||
processFilesManuallyInSqlite();
|
||||
processFilesManuallyInSqliteLinux();
|
||||
|
||||
/*
|
||||
Process tbl files
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
Process tbl files
|
||||
*
|
||||
*
|
||||
*/
|
||||
$tbl = $_SESSION['tbl'];
|
||||
|
||||
$tbl = $_SESSION['tbl'];
|
||||
|
||||
// ddump($tbl);
|
||||
|
||||
// ddump($tbl);
|
||||
|
||||
$string = D2Tbl::getStrings($tbl."string.tbl");
|
||||
$stringExpansion = D2Tbl::getStrings($tbl."expansionstring.tbl");
|
||||
$stringPatch = D2Tbl::getStrings($tbl."patchstring.tbl");
|
||||
/*
|
||||
$string = D2Tbl::getStrings($tbl."string.tbl");
|
||||
$stringExpansion = D2Tbl::getStrings($tbl."expansionstring.tbl");
|
||||
$stringPatch = D2Tbl::getStrings($tbl."patchstring.tbl");
|
||||
|
||||
$strings = array_merge($stringPatch, $stringExpansion, $string);
|
||||
|
||||
$db->writeTbl($strings);
|
||||
$strings = array_merge($stringPatch, $stringExpansion, $string);
|
||||
*/
|
||||
|
||||
$strs = ["dummy" => "dummy"];
|
||||
foreach (glob($tbl . "*.tbl") as $filename) {
|
||||
$strings = D2Tbl::getStrings($filename);
|
||||
if (!empty($strings))
|
||||
$strs = array_merge($strs, $strings);
|
||||
}
|
||||
|
||||
$db->writeTbl($strs);
|
||||
} else {
|
||||
// if config db does not exist, go to configure page
|
||||
header("Location: /src/D2Config.php");
|
||||
// if config db does not exist, go to configure page
|
||||
header("Location: /src/D2Config.php");
|
||||
}
|
||||
|
||||
|
||||
// put in html redirect as backup, because
|
||||
// for some odd reason windows gives
|
||||
// an error on header() but linux does not.
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; URL=/" />
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
<head>
|
||||
<meta http-equiv="refresh" content="0; URL=/" />
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user