diff --git a/ajax/config.php b/ajax/config.php new file mode 100644 index 0000000..eb55901 --- /dev/null +++ b/ajax/config.php @@ -0,0 +1,53 @@ +{$r['index']}"; + } else { + $html .= ""; + } + } + echo $html; +} + +if ($cmd == "viewOnly") { + + $table = 'misc'; + $sql = "SELECT uniqueitems.`index`, uniqueitems.`code`, misc.`type` +FROM uniqueitems +LEFT JOIN misc ON uniqueitems.`code` = misc.`code` +WHERE `type` IS NOT NULL AND uniqueitems.`code`='$view'"; + if ($view == 'armo') { + $table = 'armor'; + $sql = "SELECT uniqueitems.`index`, uniqueitems.`code`, $table.`code` +FROM uniqueitems +LEFT JOIN $table ON uniqueitems.`code` = $table.`code` +WHERE `type` IS NOT NULL AND uniqueitems.`code`= $table.`code` AND $table.`code` != '' ORDER BY `index`"; + } + if ($view == 'weap') { + $table = 'weapons'; + $sql = "SELECT uniqueitems.`index`, uniqueitems.`code`, $table.`code` +FROM uniqueitems +LEFT JOIN $table ON uniqueitems.`code` = $table.`code` +WHERE `type` IS NOT NULL AND uniqueitems.`code`= $table.`code` AND $table.`code` != '' ORDER BY `index`"; + } + + + if ($view == "char") { + $sql .= " OR uniqueitems.`code`='cm1' OR uniqueitems.`code`='cm2' OR uniqueitems.`code`='cm3'"; + } + + $res = PDO_FetchAll($sql); + + $html = ''; + foreach ($res as $r) { + if ($sort == 'index') { + $html .= ""; + } else { + $html .= ""; + } + } + echo $html; +} diff --git a/index.php b/index.php index 03c6317..67d14be 100644 --- a/index.php +++ b/index.php @@ -69,14 +69,22 @@ if (!isset($_SESSION['modname']) $db = new D2Database(); $parser = new D2TxtParser(); - $armor = PDO_FetchAll('SELECT * FROM armor WHERE `spawnable`=1'); - $weapon = PDO_FetchAll('SELECT * FROM weapons WHERE `spawnable`=1'); + $armor = PDO_FetchAll('SELECT * FROM armor WHERE spawnable=1'); + $misc = PDO_FetchAll('SELECT * FROM misc WHERE spawnable=1'); + $weapon = PDO_FetchAll('SELECT * FROM weapons WHERE spawnable=1'); + $uniqueitems = PDO_FetchAll("SELECT `index`,`code` FROM uniqueitems WHERE `enabled`='1' ORDER BY `index` ASC"); + + $prop = $parser->filterProps('Properties.txt'); + // If there's data, process it and save if (!empty($_POST)) { + ddump($_POST); + + // save db name from post into conf file require_once './src/D2SaveFile.php'; @@ -98,6 +106,7 @@ if (!isset($_SESSION['modname']) if ($_POST['formtype'] == "uniqueitems") { + ddump($_POST); // if ladder or carry1 is 0, set empty field. if (!$post['ladder']) { diff --git a/res/app.js b/res/app.js index 1f2aa2c..5f72d51 100644 --- a/res/app.js +++ b/res/app.js @@ -1,43 +1,43 @@ /* - - Copyright (C) 2021 Hash Borgir - - This file is part of D2Modder - - Redistribution and use in source and binary forms, with - or without modification, are permitted provided that the - following conditions are met: - - * Redistributions of source code must retain the above - copyright notice, this list of conditions and the - following disclaimer. - - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the - following disclaimer in the documentation and/or other - materials provided with the distribution. - - * This software must not be used for commercial purposes - * without my consent. Any sales or commercial use are prohibited - * without my express knowledge and consent. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY! - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - + + Copyright (C) 2021 Hash Borgir + + This file is part of D2Modder + + Redistribution and use in source and binary forms, with + or without modification, are permitted provided that the + following conditions are met: + + * Redistributions of source code must retain the above + copyright notice, this list of conditions and the + following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the + following disclaimer in the documentation and/or other + materials provided with the distribution. + + * This software must not be used for commercial purposes + * without my consent. Any sales or commercial use are prohibited + * without my express knowledge and consent. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY! + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ $(document).ready(function () { $('.form-text').hide(); @@ -53,13 +53,13 @@ $(document).ready(function () { $('option[disabled="disabled"]').show(); } }); - + $(function () { $('[data-toggle="tooltip"]').tooltip() }) $('.w-select').change(function () { - $('.a-select').each(function (i, v) { + $('.a-select,.m-select').each(function (i, v) { v.value = ''; v.required = ''; }); @@ -71,7 +71,18 @@ $(document).ready(function () { }); $('.a-select').change(function () { - $('.w-select').each(function (i, v) { + $('.w-select,.m-select').each(function (i, v) { + v.value = ''; + v.required = ''; + }); + + + x = $(this).find(':selected').text(); + y = document.getElementById('item'); + y.value = x; + }); + $('.m-select').change(function () { + $('.w-select,.a-select').each(function (i, v) { v.value = ''; v.required = ''; }); @@ -90,7 +101,7 @@ $(document).ready(function () { $('.help').click(function () { $(".fa-help").remove(); - $(this).next().fadeToggle("slow").focus().css({ + $(this).next().fadeToggle().focus().css({ "position": "absolute", "z-index": "1000", "background": "#eee", @@ -99,9 +110,52 @@ $(document).ready(function () { "width": "300px", }) }); - + +// $('.help').prev().hover(function () { +// $(".fa-help").remove(); +// $(this).next().next().fadeToggle().focus().css({ +// "position": "absolute", +// "z-index": "1000", +// "background": "#eee", +// "color": "black !important", +// "border": "1px solid #aaa", +// "width": "300px", +// }) +// }); + + + $('.form-text').click(function () { $(this).fadeOut("slow"); }); - + + // cmd = getUniqueItem + $('.uniqueitems-select').change(function () { + $.get("/ajax/uniqueitems.php?cmd=getUniqueItem&index=" + this.value, function (data) { + $.each(data, function (i, v) { + $('*[name="' + i.replace(/\s/g, '') + '"]').val(v); + if (i == 'code') { + $('select[name="code[]"]').val(v); + $('select[name="code[]"]').prop('required', ''); + } + }) + }); + }); + + + // cmd = sortBy + $('input[name="sort"]').change(function () { + $.get("/ajax/uniqueitems.php?cmd=sortBy&sort=" + this.value, function (data) { + $('.uniqueitems-select').html(data) + }); + }); + + // cmd = viewOnly + $('input[name="view"]').change(function () { + $.get("/ajax/uniqueitems.php?cmd=viewOnly&view=" + this.value, function (data) { + $('.uniqueitems-select').html(data) + }); + }); + + }); \ No newline at end of file diff --git a/res/style.css b/res/style.css index 1d8dc9f..407823d 100644 --- a/res/style.css +++ b/res/style.css @@ -112,6 +112,7 @@ body { h1,h2,h3,h4,h5,h6, div > p { font-family: Exocet; + color: #778; } #loading { margin-top: 40px; @@ -120,4 +121,15 @@ h1,h2,h3,h4,h5,h6, div > p { .fa-question-circle { bottom: 0px; +} + +.form-group > div { + margin: 5px 0; +} + +.help{ + position: absolute; + top:0px; + right: 0px; + color: #ccc; } \ No newline at end of file diff --git a/src/D2Database.php b/src/D2Database.php index 02e14ac..6da6084 100644 --- a/src/D2Database.php +++ b/src/D2Database.php @@ -60,7 +60,7 @@ class D2Database { } else { $dataType = "VARCHAR(255)"; } - $sql .= "`$k` $dataType NOT NULL,"; + $sql .= "`$k` $dataType DEFAULT '',"; } $sql = rtrim($sql, ","); $sql .= ")"; diff --git a/src/footer.php b/src/footer.php index 352631d..bae106d 100644 --- a/src/footer.php +++ b/src/footer.php @@ -1,6 +1,6 @@
Rarity
No Limit:
- + NoLimit: Boolean, 0 = can drop only once per game, 1 = can drop more then once per game.Lvl
+ + Lvl: the quality level of this unique item. Monsters, cube recipes, vendors, objects and the like most be at least this level or higher to be able to drop this item, otherwise they would drop a rare item with enhanced durability.LvlReq
+ + Lvl Req: the character level required to use this unique item.