diff --git a/d2im.conf b/d2im.conf index 3baf869..882a521 100644 --- a/d2im.conf +++ b/d2im.conf @@ -1 +1 @@ -/home/stoned/code/d2/txt/ \ No newline at end of file +a:2:{s:4:"path";s:25:"/home/stoned/code/d2/txt/";s:7:"modname";s:7:"Ironman";} \ No newline at end of file diff --git a/includes.php b/includes.php new file mode 100644 index 0000000..eca14ab --- /dev/null +++ b/includes.php @@ -0,0 +1,14 @@ +parseFile($files->getFile('Armor')); - $gems = $parser->parseFile($files->getFile('Gems')); - $itypes = $parser->parseFile($files->getFile('ItemTypes')); - $misc = $parser->parseFile($files->getFile('Misc')); - $prop = $parser->parseFile($files->getFile('Properties')); - $setitems = $parser->parseFile($files->getFile('SetItems')); - $sets = $parser->parseFile($files->getFile('Sets')); - $uni = $parser->parseFile($files->getFile('UniqueItems')); - $weapon = $parser->parseFile($files->getFile('Weapons')); - - $u = $files->getFile("UniqueItems"); - $s = $files->getFile("SetItems"); + $armor = PDO_FetchAll('SELECT * FROM armor WHERE `spawnable`=1'); + $weapon = PDO_FetchAll('SELECT * FROM weapons WHERE `spawnable`=1'); + $prop = $parser->parseFile('Properties.txt'); + // If there's data, process it and save if (!empty($_POST)) { + + // save db name from post info conf file + require_once './src/D2SaveFile.php'; $saver = new D2SaveFile(); @@ -86,6 +65,8 @@ if (file_exists($filename)) { if ($_POST['formtype'] == "uniqueitems") { + + // if ladder or carry1 is 0, set empty field. if (!$post['ladder']) { $post['ladder'] = ''; @@ -97,10 +78,6 @@ if (file_exists($filename)) { $saver->saveTblEnries("UniqueItems.tbl.txt"); } if ($_POST['formtype'] == "setitems") { - - - - $saver->save($s, $post); $saver->saveTblEnries("SetItems.tbl.txt"); } diff --git a/processFiles.php b/processFiles.php new file mode 100644 index 0000000..7a9582f --- /dev/null +++ b/processFiles.php @@ -0,0 +1,32 @@ +files as $k => $v){ + $data[$v] = $parser->parseFile($v); +} +foreach ($data as $k => $v) { + $db->createTables($k, $v); + $db->fillsTables($k, $v); +} + +?> + + + + + + + + \ No newline at end of file diff --git a/res/app.js b/res/app.js index 2c1906a..540503b 100644 --- a/res/app.js +++ b/res/app.js @@ -44,17 +44,15 @@ $(document).ready(function () { }); - $('.help').hover(function(){ + $('.help').hover(function () { $(".fa-help").remove(); $(this).next().fadeToggle("slow").css({ "position": "absolute", - "z-index":"1000", + "z-index": "1000", "background": "#eee", "color": "black !important", "border": "1px solid #aaa", - "width": "600px", - + "width": "300px", }); - }); - + }); }); \ No newline at end of file diff --git a/res/style.css b/res/style.css index 3d1ae67..90a1b3c 100644 --- a/res/style.css +++ b/res/style.css @@ -32,8 +32,6 @@ form input { padding: 5px; color: black; display:none; --webkit-box-shadow: #FFF 0 -1px 4px, #ff0 0 -2px 10px, #ff8000 0 -10px 20px, red 0 -18px 40px, 5px 5px 6px 5px rgba(0,0,0,0); -box-shadow: #FFF 0 -1px 4px, #ff0 0 -2px 10px, #ff8000 0 -10px 20px, red 0 -18px 40px, 5px 5px 6px 5px rgba(0,0,0,0); } select, @@ -60,7 +58,6 @@ option { } body { - background: url(/img/bg.jpg); background-size: cover; background-attachment: fixed; font-family:lato; @@ -74,6 +71,6 @@ h1,h2,h3,h4,h5,h6, div > p { font-family: lato !important; } -.help:hover { - +.fa-question-circle { + bottom: 0px; } \ No newline at end of file diff --git a/sqlite.cmd b/sqlite.cmd deleted file mode 100644 index b66f273..0000000 --- a/sqlite.cmd +++ /dev/null @@ -1,4 +0,0 @@ -.separator "\t" -.import txt/Armor.txt armor -select * from armors; -.output armor.db diff --git a/src/D2Config.php b/src/D2Config.php index 6959e3e..3aaec62 100644 --- a/src/D2Config.php +++ b/src/D2Config.php @@ -19,19 +19,30 @@ along with D2IM. If not, see . */ +require_once './D2Functions.php'; + if (!empty($_POST)) { + + $modname = str_replace(' ', '', $_POST['modname']); + // write the d2im.conf file and replace \ with \\ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $path = rtrim($_POST['path'], "\\"); - $path = str_replace("\\", "\\\\", $path); + $path = str_replace("\\", "\\\\", $path); $path .= '\\\\data\\\\global\\\\excel\\\\'; - file_put_contents("../d2im.conf", $path); + + $conf['path'] = $path; + $conf['modname'] = $modname; + + file_put_contents("../d2im.conf", serialize($path)); } else { - - file_put_contents("../d2im.conf", $_POST['path'] . DIRECTORY_SEPARATOR); + $conf['path'] = $_POST['path'].DIRECTORY_SEPARATOR; + $conf['modname'] = $modname; + + file_put_contents("../d2im.conf", serialize($conf)); } - header('Location: /wait.php'); + header("Location: /processFiles.php"); } ?> @@ -40,26 +51,36 @@ if (!empty($_POST)) { /* Require the section */ require_once "head.php"; ?> - -
+ +
+

D2 Item Maker, v3. By HashCasper

X
+

Select Mod folder

Example: D:\Diablo II\MODS\you-mod-name\

Input path to D2 Mod Directory.

-
- - - - + +

+
+ +

+

+ (D:\Diablo II\MODS\your-mod-name)
+ + +

-
+
+

After saving path, app will convert txt files to SQL database.

-

This may take a few minutes depending on the size of your txt files.
Please be patient. Once done, app will load.
Each time you set a new mod path, txt files will be processed.

+

This may take a few minutes depending on the size of your txt files.
Please be patient. Once done, app will load.
Each time you set a new mod path, txt files will be processed. +
Every mod will be saved to ModName.db. +

diff --git a/src/D2Database.php b/src/D2Database.php index ef5b72e..24d4113 100644 --- a/src/D2Database.php +++ b/src/D2Database.php @@ -22,7 +22,7 @@ class D2Database { public function __construct() { - PDO_Connect("sqlite:" . DB_FILE); + PDO_Connect("sqlite:" . DB_FILE); } public function createTables($file, $data) { @@ -54,20 +54,23 @@ class D2Database { } } $sql = rtrim($sql, ","); - $sql .= ") "; - - $sql .= "VALUES ("; - + $sql .= ") "; + } + + $sql .= "VALUES "; + + foreach ($data as $d) { + $sql .= "("; + if (!empty($d)) { foreach ($d as $k => $v) { $sql .= '"' . $v . '"' . ","; } } $sql = rtrim($sql, ","); - $sql .= ");"; - - PDO_Execute($sql); + $sql .= "), "; } - } - + $sql = rtrim($sql, ", "); + PDO_Execute($sql); + } } \ No newline at end of file diff --git a/src/D2Files.php b/src/D2Files.php index 0d25fbb..ad3d320 100644 --- a/src/D2Files.php +++ b/src/D2Files.php @@ -21,112 +21,16 @@ class D2Files { - public $files = [ - "Aiparms" => "Aiparms.txt", - "Arena" => "Arena.txt", - "Armor" => "Armor.txt", - "ArmType" => "ArmType.txt", - "automagic" => "automagic.txt", - "AutoMap" => "AutoMap.txt", - "belts" => "belts.txt", - "bodylocs" => "bodylocs.txt", - "Books" => "Books.txt", - "CharStats" => "CharStats.txt", - "CharTemplate" => "CharTemplate.txt", - "colors" => "colors.txt", - "CompCode" => "CompCode.txt", - "Composit" => "Composit.txt", - "CubeMain" => "CubeMain.txt", - "CubeMod" => "CubeMod.txt", - "cubetype" => "cubetype.txt", - "DifficultyLevels" => "DifficultyLevels.txt", - "ElemTypes" => "ElemTypes.txt", - "Events" => "Events.txt", - "Experience" => "Experience.txt", - "gamble" => "gamble.txt", - "Gems" => "Gems.txt", - "hiredesc" => "hiredesc.txt", - "Hireling" => "Hireling.txt", - "HitClass" => "HitClass.txt", - "Inventory" => "Inventory.txt", - "ItemRatio" => "ItemRatio.txt", - "ItemStatCost" => "ItemStatCost.txt", - "ItemTypes" => "ItemTypes.txt", - "Levels" => "Levels.txt", - "lowqualityitems" => "lowqualityitems.txt", - "LvlMaze" => "LvlMaze.txt", - "LvlPrest" => "LvlPrest.txt", - "LvlSub" => "LvlSub.txt", - "LvlTypes" => "LvlTypes.txt", - "LvlWarp" => "LvlWarp.txt", - "MagicPrefix" => "MagicPrefix.txt", - "MagicSuffix" => "MagicSuffix.txt", - "Misc" => "Misc.txt", - "MissCalc" => "MissCalc.txt", - "Missiles" => "Missiles.txt", - "MonAi" => "MonAi.txt", - "MonEquip" => "MonEquip.txt", - "MonItemPercent" => "MonItemPercent.txt", - "MonLvl" => "MonLvl.txt", - "MonMode" => "MonMode.txt", - "MonName" => "MonName.txt", - "MonPlace" => "MonPlace.txt", - "MonPreset" => "MonPreset.txt", - "MonProp" => "MonProp.txt", - "MonSeq" => "MonSeq.txt", - "MonSounds" => "MonSounds.txt", - "MonStats2" => "MonStats2.txt", - "MonStats" => "MonStats.txt", - "MonType" => "MonType.txt", - "MonUMod" => "MonUMod.txt", - "Npc" => "Npc.txt", - "Objects" => "Objects.txt", - "objgroup" => "objgroup.txt", - "ObjMode" => "ObjMode.txt", - "ObjType" => "ObjType.txt", - "Overlay" => "Overlay.txt", - "PetType" => "PetType.txt", - "PlayerClass" => "PlayerClass.txt", - "PlrMode" => "PlrMode.txt", - "PlrType" => "PlrType.txt", - "Properties" => "Properties.txt", - "qualityitems" => "qualityitems.txt", - "RarePrefix" => "RarePrefix.txt", - "RareSuffix" => "RareSuffix.txt", - "Runes" => "Runes.txt", - "SetItems" => "SetItems.txt", - "Sets" => "Sets.txt", - "Shrines" => "Shrines.txt", - "SkillCalc" => "SkillCalc.txt", - "SkillDesc" => "SkillDesc.txt", - "Skills" => "Skills.txt", - "SoundEnviron" => "SoundEnviron.txt", - "Sounds" => "Sounds.txt", - "States" => "States.txt", - "StorePage" => "StorePage.txt", - "SuperUniques" => "SuperUniques.txt", - "TreasureClassEx" => "TreasureClassEx.txt", - "TreasureClass" => "TreasureClass.txt", - "UniqueAppellation" => "UniqueAppellation.txt", - "UniqueItems" => "UniqueItems.txt", - "UniquePrefix" => "UniquePrefix.txt", - "UniqueSuffix" => "UniqueSuffix.txt", - "UniqueTitle" => "UniqueTitle.txt", - "WeaponClass" => "WeaponClass.txt", - "Weapons" => "Weapons.txt" - ]; + public $files = []; - public function __construct() { - - } + $this->files = array_diff(scandir(TXT_PATH), array('..', '.')); - public function getFiles(){ return $this->files; } - - public function getFile($name){ + + public function getFile($name) { return $this->files[$name]; } - -} \ No newline at end of file + +} diff --git a/src/D2Functions.php b/src/D2Functions.php index 6312739..2f8492d 100644 --- a/src/D2Functions.php +++ b/src/D2Functions.php @@ -7,6 +7,3 @@ function ddump($var) { die(); } -function filterFunc($arg1, $arg2) { - return !($arg1 == $arg2); -} \ No newline at end of file diff --git a/src/D2SM.php b/src/D2SM.php index 8a7ab4e..52c3236 100644 --- a/src/D2SM.php +++ b/src/D2SM.php @@ -138,24 +138,25 @@
- +
- +
- + -

- Add Func +
+
+ AddFunc add func: a property mode field that controls how the variable attributes will appear and be functional on a set item. See the appendix for further details about this field's effects.
-

Blue Attributes

+

Blue Attributes

+
    diff --git a/src/head.php b/src/head.php index 8c83693..152f6d7 100644 --- a/src/head.php +++ b/src/head.php @@ -27,7 +27,6 @@ along with D2UM. If not, see . - diff --git a/wait.php b/wait.php deleted file mode 100644 index 4c13c70..0000000 --- a/wait.php +++ /dev/null @@ -1,59 +0,0 @@ -parseFile($files->getFile('Armor')); -$data['Gems'] = $parser->parseFile($files->getFile('Gems')); -$data['ItemTypes'] = $parser->parseFile($files->getFile('ItemTypes')); -$data['Misc'] = $parser->parseFile($files->getFile('Misc')); -$prop = $parser->parseFile($files->getFile('Properties')); -$data['SetItems'] = $parser->parseFile($files->getFile('SetItems')); -$data['Sets'] = $parser->parseFile($files->getFile('Sets')); -$data['UniqueItems'] = $parser->parseFile($files->getFile('UniqueItems')); -$data['Weapons'] = $parser->parseFile($files->getFile('Weapons')); - -foreach ($data as $k => $v) { - - $db->createTables($files->getFile($k), $v); - $db->fillsTables($files->getFile($k), $v); -} -?> - - - section */ - require_once "./src/head.php"; - ?> -
    -

    Files Processed

    - X -
    - -

    Click here to go to the main application.

    -
    - - \ No newline at end of file