getSaveFiles(); foreach($charFiles as $charFile){ $charData[] = new D2Char($charFile); // $charData goes into chars.php tab } // dump($charData[0]->charData); // dump($charData[1]->charData); // die(); $idesc = new D2ItemDesc(); $db = new D2Database(); $parser = new D2TxtParser(); // $a = ["bighead1","fallen1","corruptrogue1","goatman1","fallenshaman1","fetish1","cr_archer1","cr_lancer1","vulture1","bloodraven","andariel","smith","vulture1","blunderbore1","duriel","fetishshaman1","councilmember1","mephisto","megademon1","regurgitator1","diablo","hephasto","vilemother1","vilechild1","overseer1","imp1","succubus1","succubuswitch1","putriddefiler1","painworm1","minion1","baalcrab"]; // //foreach ($a as $x){ // $z = (PDO_FetchRow("SELECT `hcIdx`,`NameStr` FROM monstats WHERE `Id`='$x'")); // echo "
".$z['hcIdx']."\t".$z['NameStr']."
"; //} // //die(); $armor = PDO_FetchAll('SELECT * FROM armor WHERE spawnable=1'); $misc = PDO_FetchAll('SELECT * FROM misc WHERE spawnable=1 AND type <> "stst" AND type <> "sum0" AND type <> "prtl" AND type <> "xfor" AND type <> "rext" AND type <> "gext" AND type <> "ques" AND type <> "key" AND type <> "body" '); $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)) { // save db name from post into conf file... why? require_once './src/D2Char.php'; $saver = new D2Char(); // process post // combine armor/weapon codes foreach ($_POST as $k => $v) { $x = str_replace("_", " ", $k); $post[$x] = $v; } if (!empty($post['code'])) { array_filter($post['code']); if (!empty($post['code'][0])) { $post['code'] = $post['code'][0]; } else { $post['code'] = $post['code'][1]; } } // last 3 items are not in d2 txt, rid of them // why did I set formtype? I can't rememer, need to comment code more /* * * * Unique Items Form was posted here * */ if ($_POST['formtype'] == "uniqueitems") { unset($post['formtype']); unset($post['submit']); unset($post['item']); // if ladder or carry1 is 0, set empty field. if (!$post['ladder']) { $post['ladder'] = ''; } if (!$post['carry1']) { $post['carry1'] = ''; } ddump($post); $sql = "SELECT rowid,`index` from `uniqueitems` WHERE `index`=\"{$post['index']}\""; $res = PDO_FetchRow($sql); if ($res['index'] == $post['index']) { $sql = "UPDATE `uniqueitems` SET "; foreach ($post as $k => $v) { $sql .= "`$k`=\"$v\","; } $sql = rtrim($sql, ","); $sql .= ' WHERE `index`="'.$post['index'].'"'; PDO_Execute($sql, [$post['index']]); //ddump($x); } /* * * * Set Items Form was posted here * */ else { $sql = "INSERT INTO `uniqueitems` ("; foreach ($post as $k => $v) { $sql .= "`$k`,"; } $sql = rtrim($sql, ","); $sql .= ") VALUES ("; foreach ($post as $k => $v) { $sql .= "'$v',"; } $sql = rtrim($sql, ","); $sql .= ")"; ddump($sql); // $saver->save($u, $post); // $saver->saveTblEnries("UniqueItems.tbl.txt"); } } if ($_POST['formtype'] == "setitems") { $saver->save($s, $post); $saver->saveTblEnries("SetItems.tbl.txt"); } } // load app require_once './src/index.php'; } ?>