$v){ if (str_contains($v, "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $str_clean = preg_replace($p, "", $v); } $strings[$k] = $str_clean; } // load itemtypes table in memory // then in side this foreach loop for each row, see if the item code appears in itemtypes // if in item types, then it's a 4 letter code, done // if not in itemtypes, then it's a three letter code and get the string for it from tbl $sql = "SELECT ItemType,Code FROM itemtypes"; $itemtypesTbl = PDO_FetchAssoc($sql); // $sql = "SELECT ItemType,Equiv1 FROM itemtypes"; // $itemtypesTblEquiv1 = PDO_FetchAssoc($sql); // // $sql = "SELECT ItemType,Equiv2 FROM itemtypes"; // $itemtypesTblEquiv2 = PDO_FetchAssoc($sql); // $itemTypes = array_filter(array_merge($itemtypesTblCode, $itemtypesTblEquiv1, $itemtypesTblEquiv1)); // ddump($itemtypesTbl); // load namestr from 3 files $sql = "SELECT code,namestr FROM armor UNION SELECT code,namestr FROM misc UNION SELECT code,namestr FROM weapons "; $namestr = PDO_FetchAssoc($sql); $htmltop = << D2Modder

{$_SESSION['modname']} $type

Auto generated with D2Modder by Hash Casper

EOT; $htmlbottom = << EOT; /* * * * * * @cmd = genDocUniqueItems * * * * * */ $dir = getcwd() . "/docs/{$_SESSION['modname']}"; mkdir($dir, 0777, true); if ($cmd == "genDocUniqueItems") { $tableTop = << Name Lvl Lvl Req Type Code Item EOT; $tableBottom = << EOT; // grab unique item index only (to save on memory) $sql = "SELECT `index` FROM `uniqueitems` WHERE `enabled`='1'"; $uIndex = PDO_FetchAll($sql); //ddump($uIndex); $htmlFinal = ''; $htmlFinal .= $htmltop . $tableTop; echo $htmltop; echo $tableTop; ob_flush(); /* START MAIN LOOP HERE * * For each unique item index, now grab item data * */ foreach ($uIndex as $u) { //var_dump($item); //$items[] = $idata->uniqueItems($u['index'], true); //var_dump($u['index']); $item = $idata->uniqueItems($u['index'], true); $itemBoxTop = ""; $itemBoxTop .= "{$item['index']}"; $itemBoxTop .= "{$item['lvl']}"; $itemBoxTop .= "{$item["lvl req"]}"; $itemBoxTop .= "{$item["*type"]}"; $itemBoxTop .= "{$item['code']}"; $itemBoxTop .= <<

EOT; $itemBoxBottom = <<

EOT; $itemBoxBottom .= ""; echo $itemBoxTop; ob_flush(); $htmlFinal .= $itemBoxTop; //index $props = "
  • {$item['index']}
  • "; //type $props .= "
  • ({$item["*type"]})
  • "; //level $props .= "
  • Level: {$item["lvl"]}
  • "; //lvlreq $props .= "
  • Level Required: {$item["lvl req"]}
  • "; //code $props .= "
  • Item Code: {$item["code"]}
  • "; //reqstr if ($item["reqstr"]) { $props .= "
  • {$item["reqstr"]}
  • "; } //reqdex if ($item["reqdex"]) { $props .= "
  • {$item["reqdex"]}
  • "; } //sock $props .= "
  • {$item["gemsockets"]}
  • "; foreach ($item['props'] as $prop) { if ($prop['string'][0]) { $props .= "
  • {$prop['string'][0]}
  • "; } } $props .= "
"; // $itemFull .= $itemBoxTop . $props . $itemBoxBottom; // echo $itemFull; echo $props; echo $itemBoxBottom; ob_flush(); $htmlFinal .= $props . $itemBoxBottom; }// end loop $htmlFinal .= $tableBottom; echo $htmlbottom; $htmlFinal .= $htmlbottom; file_put_contents("$dir/uniqueitems.html", $htmlFinal); header("Location: /docs/{$_SESSION['modname']}/uniqueitems.html"); } /* * * * * * @cmd = genDocCube * * * * * */ function getImage($code) { $sql = "SELECT invfile FROM armor WHERE `code`=\"$code\" OR `type`=\"$code\" OR `type2`=\"$code\""; $img = PDO_FetchOne($sql); if (empty($img)) { $sql = "SELECT invfile FROM misc WHERE `code`=\"$code\" OR `type`=\"$code\" OR `type2`=\"$code\""; $img = PDO_FetchOne($sql); } if (empty($img)) { $sql = "SELECT invfile FROM weapons WHERE `code`=\"$code\" OR `type`=\"$code\" OR `type2`=\"$code\""; $img = PDO_FetchOne($sql); } if (!empty($img)) { return "$img.png"; } else { return "1.png"; } return "$img.png"; } function getItemName($code) { $sql = "SELECT name FROM armor WHERE `code`=\"$code\" OR `type`=\"$code\" OR `type2`=\"$code\""; $name = PDO_FetchOne($sql); if (empty($name)) { $sql = "SELECT name FROM misc WHERE `code`=\"$code\" OR `type`=\"$code\" OR `type2`=\"$code\""; $name = PDO_FetchOne($sql); } if (empty($name)) { $sql = "SELECT name FROM weapons WHERE `code`=\"$code\" OR `type`=\"$code\" OR `type2`=\"$code\""; $name = PDO_FetchOne($sql); } return $name; } if ($cmd == "genDocCube") { $htmlFinal = ''; $htmlFinal .= $htmltop; // echo $htmltop; // ob_flush(); $css = << body{ background: white; color: black; font-family: ExocetLight; text-transform: uppercase; } table, table th, table td, table tr { background: #111; color: #ccc; } .item_stats{ width: auto; height: auto; } .item_desc { height: auto; text-align: center; padding: 10px; text-transform: uppercase; } .green { color: #00FF00; /*Set items*/ } .gold{ color: #A59263; /*Set items*/ } .orange{ color: #FFA500; /*Set items*/ } .yellow { color: #FFFF00; /*Set items*/ } .blue { color: #4169E1; } table { } .desc { min-width: 320px; background: #111; } .input1,.input3,.input5,.input7{ background: #444; } .input2, .input4, .input6 { background: #333; } .output1{ background: #222; } .output2 { background: #222; } .output3 { background: #222; } td { height: 240px; text-align: center; vertical-align: middle; padding: 10px; } EOT; //echo $css; $htmlFinal .= $css; //ob_flush(); $table = << Recipe Input 1 Input 2 Input 3 Input 4 Input 5 Input 6 Input 7 Output 1 Output 2 Output 3 EOT; //echo $table; $htmlFinal .= $table; //ob_flush(); $i_params = [ "any" => "Any Item", "low" => "Low Quality", "hiq" => "Superior", "nor" => "Normal", "mag" => "Magic", "rar" => "Rare", "set" => "Set", "uni" => "Unique", "crf" => "Crafted", "tmp" => "Tempered", "eth" => "Ethereal", "noe" => "Not Ethereal", "nos" => "No Socket (for input)", "sock" => "Sockets", "pre" => "Prefix (ID from magicprefix.txt) - ID => (Row Number - 2)", "suf" => "Suffix (ID from magicsuffix.txt) - ID => (Row Number - 2)", "rep" => "Repair durability", "rch" => "Recharge Quantity", "qty" => 'Quantity', "upg" => "For inputs only, Item is upgraded.", "bas" => "Base item", "exc" => "Exceptional", "eli" => "Elite", "usetype" => "Uses base type of input1 for output", "useitem" => "Uses item from input 1", "uns" => "Unsocket Item(destroys gems)", "rem" => "Unsocket Item(removes gems)", "reg" => "Regenerate? Seems to reroll the item", "mod" => "Transfers properties from input1 to output item.", ]; // get all cube rows $sql = "SELECT * FROM cubemain WHERE enabled=1"; $res = PDO_FetchAll($sql); /* * * Process each cube row here for each cube row * */ foreach ($res as $r) { $desc = str_replace('+', '
+
', $r['description']); $desc = str_replace('->', '
=
', $desc); $desc .= "
"; //ddump($desc); //var_dump($r); // grab all inputs $input_codes = array_filter( [ "input 1" => $r["input 1"], "input 2" => $r["input 2"], "input 3" => $r["input 3"], "input 4" => $r["input 4"], "input 5" => $r["input 5"], "input 6" => $r["input 6"], "input 7" => $r["input 7"], ] ); foreach ($input_codes as $inputNum => $value) { if (str_contains($value, ',')) { $input_codes[$inputNum] = explode(",", $value); // hpot,qty=3 $oarray = explode(",", $value); // hpot,qty=3 // For each input code // hpot,qty=3 like mpot/hpot/magharv // if spelldescstr is set, use it. Else use item string tbl // first find the item code in either armor, misc, or weapons // then get spelldesc/spelldescstr // $sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\""; // $str = PDO_FetchOne($sql); $str = $strings[$oarray[0]]; // if empty str == 4-letter code, call getItemName() if (empty($str)) { $input_codes[$inputNum][0] = ($oarray[0]); } else { $input_codes[$inputNum][0] = $str; } // get image $input_codes[$inputNum]["img"] = getImage($oarray[0]); } else { $value .= ","; $input_codes[$inputNum] = explode(",", $value); // hpot,qty=3 $oarray = explode(",", $value); // hpot,qty=3 // For each input code // hpot,qty=3 like mpot/hpot/magharv // if spelldescstr is set, use it. Else use item string tbl // first find the item code in either armor, misc, or weapons // then get spelldesc/spelldescstr // $sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\""; // $str = PDO_FetchOne($sql); $str = $strings[$oarray[0]]; // if empty str == 4-letter code, so just display if (empty($str)) { $input_codes[$inputNum][0] = ($oarray[0]); } else { $input_codes[$inputNum][0] = $str; } // get image $input_codes[$inputNum]["img"] = getImage($oarray[0]); } } /* * processs output, output b, output c * * */ // grab all inputs $output_codes = array_filter( [ "output" => str_replace('"', "", $r["output"]), "output b" => str_replace('"', "", $r["output b"]), "output c" => str_replace('"', "", $r["output c"]) ] ); // dump($output_codes); foreach ($output_codes as $outputNum => $value) { if (str_contains($value, ',')) { $output_codes[$outputNum] = explode(",", $value); // hpot,qty=3 $oarray = explode(",", $value); // hpot,qty=3 $sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\""; // clean str $str = PDO_FetchOne($sql); if (str_contains($str, "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $str = preg_replace($p, "", $str); } // if empty str == 4-letter code, so just display if (empty($str)) { $output_codes[$outputNum][0] = ($oarray[0]); } else { $output_codes[$outputNum][0] = $str; } $output_codes[$outputNum]["img"] = getImage($oarray[0]); } else { // else output code is three/four letter code $value .= ","; $output_codes[$outputNum] = explode(",", $value); // hpot,qty=3 $oarray = explode(",", $value); // hpot,qty=3 $sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\""; // clean color codes $str = PDO_FetchOne($sql); if (str_contains($str, "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $str = preg_replace($p, "", $str); } // if empty str == 4-letter code, so just display if (empty($str)) { $output_codes[$outputNum][0] = ($oarray[0]); } else { $output_codes[$outputNum][0] = $str; } $output_codes[$outputNum]["img"] = getImage($oarray[0]); } // if output[1] or output[2], output[3], output[4] contains `=' sign // parse_str or explode at = to get modifer and value // if modifier = pre or suf, find ID in magic prefix/suffix line. // if output is array we know it contains modifers and values if (is_array($output_codes[$outputNum])) { // 0 will always be item code. // 1,2,3 can be mods, either can have = // if 1,2,3 have = sign, explode and get mod = value $itemcode = $output_codes[0]; $mod = array_filter([$output_codes[$outputNum][1], $output_codes[$outputNum][2], $output_codes[$outputNum][3]]); //var_dump($mod); foreach ($mod as $m) { if (str_contains($m, '=')) { $e = explode("=", $m); $output_codes[$outputNum]['code'] = $e[0]; $output_codes[$outputNum]['value'] = $e[1]; } } } } $output = array_merge($input_codes, $output_codes); // Set description $output['desc'] = $desc; /* * process mods for each output * * */ $m = null; for ($counter = 1; $counter <= 5; $counter++) { $mods = array_filter([ "mod $counter" => $r["mod $counter"], "mod $counter chance" => $r["mod $counter chance"], "mod $counter param" => $r["mod $counter param"], "mod $counter min" => $r["mod $counter min"], "mod $counter max" => $r["mod $counter max"], "b mod $counter" => $r["b mod $counter"], "b mod $counter chance" => $r["b mod $counter chance"], "b mod $counter param" => $r["b mod $counter param"], "b mod $counter min" => $r["b mod $counter min"], "b mod $counter max" => $r["b mod $counter max"], "c mod $counter" => $r["c mod $counter"], "c mod $counter chance" => $r["c mod $counter chance"], "c mod $counter param" => $r["c mod $counter param"], "c mod $counter min" => $r["c mod $counter min"], "c mod $counter max" => $r["c mod $counter max"], ]); $m[] = array_filter($mods); } $output['mods'] = array_filter($m); $result = []; //var_dump($output['mods']); foreach ($output['mods'] as $k => $v) { $prop = ($v["mod " . $k + 1]); $par = ($v["mod " . $k + 1 . " param"]) ?? ""; $min = ($v["mod " . $k + 1 . " min"]) ?? $max; $max = ($v["mod " . $k + 1 . " max"]) ?? $min; //var_dump($min); $output['mods'][$k]["isc"] = $isc[$prop]; $params = [ 'string1' => $output['mods'][$k]["isc"]['string1'], 'string2' => $output['mods'][$k]["isc"]['string2'], 'descfunc' => $output['mods'][$k]["isc"]['descfunc'], 'descval' => $output['mods'][$k]["isc"]['descval'], "prop" => $prop, "par" => $par, "min" => $min, "max" => $max, // "val1" => $funcval['val1'], // "func1" => $funcval['func1'] // 'item' => $return ]; $output['mods'][$k]["str"] = $idesc->getDesc($params); //ddump($output['mods'][$k]["isc"]); } //ddump($idata->getIscStrings("energy")); /* * Echo out each row as HTML with all the data it may have * */ // echo ""; // foreach ($output as $k => $v) { // // // if input 1, input 2 is an array // // if (is_array($v)){ // echo "{$v[0]}: {$v[1]}"; // echo "{$v[0]}: {$v[1]}"; // } else { // // $img = ""; // // if input 1, input 2 ... etc. are not arrays // echo ''; // } // } // echo ""; $htmlRow = ""; $htmlRow .= "" . $output['desc'] . ""; for ($i = 1; $i <= 7; $i++) { $htmlRow .= ""; if (!empty($output["input $i"]["img"])) { $htmlRow .= "
"; if (str_contains($output["input $i"][0], "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $output["input $i"][0] = preg_replace($p, "", $output["input $i"][0]); } echo "
";
                
                // if the item is in itemtypes grab it, it's 4 letter code fron itemtypes                
                $key1 = array_search($output["input $i"][0], $itemtypesTbl);                
                
                // ddump($strings);
                
                if ($namestr[$output["input $i"][0]]){
                    $a = $output["input $i"][0];
                    $namestrf = array_flip($namestr);
                    
                    // fuck what a goofy
                    $fn = ($strings[$namestr[$a]]);
                }
                
                

                
                // if the key's value is in itemtypes
                if($itemtypesTbl[$key1] == $output["input $i"][0]){
                    $ostr = implode("
", (array_reverse(explode('\n', $key1)))); } else { $ostr = implode("
", (array_reverse(explode('\n', $fn)))); } echo '
';    
                
				$htmlRow .= $ostr . "
"; if (str_contains($output["input $i"][1], "=")) { $htmlRow .= $output["input $i"][1] . "
"; } else { $htmlRow .= $i_params[$output["input $i"][1]] . "
"; } } $htmlRow .= ""; } $htmlRow .= ""; if (!empty($output["output"]["img"])) { $htmlRow .= "
"; if (str_contains($output["output"][0], "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $output["output"][0] = preg_replace($p, "", $output["output"][0]); } if ($namestr[$output["input $i"][0]]){ $a = $output["input $i"][0]; $namestrf = array_flip($namestr); // fuck what a goofy $fn = ($strings[$namestr[$a]]); } // if the item is in itemtypes grab it, it's 4 letter code fron itemtypes $key1 = array_search($output["input $i"][0], $itemtypesTbl); // if the key's value is in itemtypes if($itemtypesTbl[$key1] == $output["input $i"][0]){ $ostr = implode("
", (array_reverse(explode('\n', $key1)))); } else { $ostr = implode("
", (array_reverse(explode('\n', $fn)))); } // ddump($fn); if (str_contains($output["output"][1], "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $output["output"][1] = preg_replace($p, "", $output["output"][1]); } if ($i_params[$output["output"][0]]) { $htmlRow .= '' . $output["output"][0] . "
"; } else { $htmlRow .= $output["output"][0] . "
"; } if ($i_params[$output["output"][1]]) { $htmlRow .= $i_params[$output["output"][1]] . "
"; } else { $htmlRow .= $output["output"][1] . "
"; } for ($i = 1; $i <= 5; $i++) { if ($output["mods"][0]["mod $i"]) { if (str_contains($output["mods"][0]["str"], "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $output["mods"][0]["str"] = preg_replace($p, "", $output["mods"][0]["str"]); } $htmlRow .= str_replace("\n", "
", "{$output["mods"][0]["str"]}

"); } if ($output["mods"][0]["mod $i chance"]) { $htmlRow .= "Chance:{$output["mods"][0]["mod $i chance"]}
"; } } } $htmlRow .= ""; $htmlRow .= ""; if (!empty($output["output b"]["img"])) { $htmlRow .= "
"; if (str_contains($output["output b"][0], "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $output["output b"][0] = preg_replace($p, "", $output["output b"][0]); } if (str_contains($output["output b"][1], "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $output["output b"][1] = preg_replace($p, "", $output["output b"][1]); } $htmlRow .= $output["output b"][0] . "
"; $htmlRow .= $output["output b"][1] . "
"; for ($i = 1; $i <= 5; $i++) { if ($output["mods"][1]["mod $i"]) { $htmlRow .= "{$output["mods"][1]["mod $i"]}
"; } if ($output["mods"][1]["mod $i chance"]) { $htmlRow .= "Chance:{$output["mods"][1]["mod $i chance"]}
"; } if ($output["mods"][1]["mod $i min"]) { $htmlRow .= "Min:{$output["mods"][1]["mod $i min"]}
"; } if ($output["mods"][1]["mod $i max"]) { $htmlRow .= "Max:{$output["mods"][1]["mod $i max"]}"; } } } $htmlRow .= ""; $htmlRow .= ""; if (!empty($output["output c"]["img"])) { $htmlRow .= "
"; if (str_contains($output["output c"][0], "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $output["output c"][0] = preg_replace($p, "", $output["output c"][0]); } if (str_contains($output["output c"][1], "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $output["output c"][1] = preg_replace($p, "", $output["output c"][1]); } $htmlRow .= $output["output c"][0] . "
"; $htmlRow .= $output["output c"][1] . "
"; for ($i = 1; $i <= 5; $i++) { if ($output["mods"][2]["mod $i"]) { $htmlRow .= "{$output["mods"][2]["mod $i"]}
"; } if ($output["mods"][2]["mod $i chance"]) { $htmlRow .= "Chance:{$output["mods"][2]["mod $i chance"]}
"; } if ($output["mods"][2]["mod $i min"]) { $htmlRow .= "Min:{$output["mods"][2]["mod $i min"]}
"; } if ($output["mods"][2]["mod $i max"]) { $htmlRow .= "Max:{$output["mods"][2]["mod $i max"]}"; } } } $htmlRow .= ""; $htmlRow .= ""; // echo $htmlRow; // ob_flush(); $htmlFinal .= $htmlRow; //ddump($i_params['levelreq']); //var_dump($output); //ob_flush(); unset($output); }// end each row loop $tableBottom = << EOT; //echo $tableBottom; //echo $htmlbottom; //ob_flush(); $htmlFinal .= $tableBottom . $htmlbottom; file_put_contents("$dir/cubemain.html", $htmlFinal); header("Location: docs/{$_SESSION['modname']}/cubemain.html"); } //if ($cmd == "getIscStrings") { // // // // $sql = " // SELECT p.`code` as prop, // p.stat1, // i.descstrpos, // i.descstr2, // i.descfunc, // i.descval, // i.dgrp, // i.dgrpfunc, // i.dgrpval, // i.dgrpstrpos, // i.dgrpstrneg, // s1.String as string1, // s2.String as string2, // s3.String as gstring1, // s4.String as gstring2 // FROM properties as p // // LEFT JOIN itemstatcost as i // ON p.stat1 = i.Stat // // LEFT JOIN strings as s1 // ON i.descstrpos = s1.Key // LEFT JOIN strings as s2 // ON i.descstr2 = s2.Key // // LEFT JOIN strings as s3 // ON i.dgrpstrpos = s3.Key // LEFT JOIN strings as s4 // ON i.dgrpstr2= s4.Key //"; // // $res = PDO_FetchAll($sql); // // $isc = null; // foreach ($res as $r) { // $isc[$r['prop']] = $r; // $isc[$r['prop']]['prop'] = $r['prop']; // } // // // var_dump($isc); //} if ($cmd == "getImages") { $sql = " SELECT code,invfile,type,type2 FROM armor UNION ALL SELECT code,invfile,type,type2 FROM misc UNION ALL SELECT code,invfile,type,type2 FROM weapons "; $res = PDO_FetchAll($sql); $isc = null; foreach ($res as $r) { $isc1[$r['code']] = $r; $isc1[$r['code']]['code'] = $r['prop']; $isc2[$r['type']] = $r; $isc2[$r['type']]['type'] = $r['prop']; } $isc = array_merge($isc1, $isc2); unset($isc1); unset($isc2); var_dump(($isc)); } /* * Gem Doc Generator * * * */ if ($cmd == "genDocGems") { $sql = " SELECT g.*,m.invfile,m.type,m.type2,s.String FROM gems as g LEFT JOIN misc as m ON g.code = m.code LEFT JOIN strings as s ON g.code = s.Key "; $res = array_filter(PDO_FetchAll($sql)); //ddump($res); foreach ($res as $r) { for ($i = 1; $i <= 3; $i++) { $params = [ 'string1' => $isc[$r["weaponMod{$i}Code"]]['string1'], 'string2' => $isc[$r["weaponMod{$i}Code"]]['string2'], 'gstring1' => $isc[$r["weaponMod{$i}Code"]]['gstring'], 'gstring2' => $isc[$r["weaponMod{$i}Code"]]['gstring2'], 'descfunc' => $isc[$r["weaponMod{$i}Code"]]['descfunc'], 'descval' => $isc[$r["weaponMod{$i}Code"]]['descval'], 'dgrp' => $isc[$r["weaponMod{$i}Code"]]['dgrp'], 'dgrpfunc' => $isc[$r["weaponMod{$i}Code"]]['dgrpfunc'], 'dgrpval' => $isc[$r["weaponMod{$i}Code"]]['dgrpval'], "prop" => $isc[$r["weaponMod{$i}Code"]]['prop'] ]; // weapons $params["par"] = $r["weaponMod{$i}Param"]; $params["min"] = $r["weaponMod{$i}Min"]; $params["max"] = $r["weaponMod{$i}Max"]; if ($r["weaponMod{$i}Code"]) { $r["weaponMod{$i}Code"] = $idesc->getDesc($params); } //var_dump($params); $params = [ 'string1' => $isc[$r["helmMod{$i}Code"]]['string1'], 'string2' => $isc[$r["helmMod{$i}Code"]]['string2'], 'gstring1' => $isc[$r["helmMod{$i}Code"]]['gstring'], 'gstring2' => $isc[$r["helmMod{$i}Code"]]['gstring2'], 'descfunc' => $isc[$r["helmMod{$i}Code"]]['descfunc'], 'descval' => $isc[$r["helmMod{$i}Code"]]['descval'], 'dgrp' => $isc[$r["helmMod{$i}Code"]]['dgrp'], 'dgrpfunc' => $isc[$r["helmMod{$i}Code"]]['dgrpfunc'], 'dgrpval' => $isc[$r["helmMod{$i}Code"]]['dgrpval'], "prop" => $isc[$r["helmMod{$i}Code"]]['prop'] ]; // helms $params["par"] = $r["helmMod{$i}Param"]; $params["min"] = $r["helmMod{$i}Min"]; $params["max"] = $r["helmMod{$i}Max"]; if ($r["helmMod{$i}Code"]) { $r["helmMod{$i}Code"] = $idesc->getDesc($params); } //var_dump($params); $params = [ 'string1' => $isc[$r["helmMod{$i}Code"]]['string1'], 'string2' => $isc[$r["helmMod{$i}Code"]]['string2'], 'gstring1' => $isc[$r["helmMod{$i}Code"]]['gstring'], 'gstring2' => $isc[$r["helmMod{$i}Code"]]['gstring2'], 'descfunc' => $isc[$r["helmMod{$i}Code"]]['descfunc'], 'descval' => $isc[$r["helmMod{$i}Code"]]['descval'], 'dgrp' => $isc[$r["helmMod{$i}Code"]]['dgrp'], 'dgrpfunc' => $isc[$r["helmMod{$i}Code"]]['dgrpfunc'], 'dgrpval' => $isc[$r["helmMod{$i}Code"]]['dgrpval'], "prop" => $isc[$r["helmMod{$i}Code"]]['prop'] ]; //shields $params["par"] = $r["shieldMod{$i}Param"]; $params["min"] = $r["shieldMod{$i}Min"]; $params["max"] = $r["shieldMod{$i}Max"]; if ($r["shieldMod{$i}Code"]) { $r["shieldMod{$i}Code"] = $idesc->getDesc($params); } //var_dump($params); if (str_contains($r['String'], "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $r['String'] = preg_replace($p, "", $r['String']); } } $gems[] = array_filter($r); } $htmlFinal = ''; $htmlFinal .= $htmltop; //echo $htmltop; //ob_flush(); $css = << body{ background: white; color: black; font-family: ExocetLight; text-transform: uppercase; } table, table th, table td, table tr { background: #111; color: #ccc; } .item_stats{ width: auto; height: auto; } .item_desc { height: auto; text-align: center; padding: 10px; text-transform: uppercase; } .green { color: #00FF00; /*Set items*/ } .gold{ color: #A59263; /*Set items*/ } .orange{ color: #FFA500; /*Set items*/ } .yellow { color: #FFFF00; /*Set items*/ } .blue { color: #4169E1; } table { } .desc { width: 200px; font-family: ExocetLight; font-size: 1.25em; text-transform: uppercase; background: #111; } .input1,.input3,.input5,.input7{ background: #444; } .input2, .input4, .input6 { background: #333; } .output1{ background: #222; } .output2 { background: #222; } .output3 { background: #222; } td { height: 240px; text-align: center; vertical-align: middle; padding: 10px; white-space: nowrap; } img { height: 56px; width: auto; } EOT; //echo $css; $htmlFinal .= $css; //ob_flush(); $table = << EOT; //echo $table; $htmlFinal .= $table; //ob_flush(); //ddump($isc); //ddump($idesc->getDesc($isc['cold-len'])); //ddump($gems); //$x = array_shift($gems); foreach ($gems as $g) { if ($g['name'] == "Expansion") { continue; } $htmlRow = ""; $htmlRow .= " "; $htmlRow .= " "; $htmlRow .= " "; $htmlRow .= " "; $htmlRow .= " "; $htmlRow .= " "; $htmlRow .= " "; $htmlRow .= ""; $htmlFinal .= $htmlRow; // echo $htmlRow; // ob_flush(); } $htmlFinal .= $tableBottom . $htmlbottom; // echo $tableBottom . $htmlbottom; // ob_flush(); // // ob_start(); file_put_contents("$dir/gems.html", $htmlFinal); header("Location: /docs/{$_SESSION['modname']}/gems.html"); } /* * * * @cmd = genDocRunewords * */ if ($cmd == 'genDocRunewords'){ // ddump($_SESSION); //ddump($isc); $sql = 'SELECT * FROM runes'; $runes = array_filter(PDO_FetchAll($sql)); $sql = 'SELECT code,invfile from misc'; $rune_inv_codes = array_filter(PDO_FetchAssoc($sql)); // ddump($rune_inv_codes); $sql = 'SELECT * FROM strings'; $strings = array_filter(PDO_FetchAssoc($sql)); $sql = 'SELECT Itemtype,Code,Equiv1 FROM itemtypes'; $itypes = array_flip(array_filter(PDO_FetchAssoc($sql))); $tableTop = << EOT; foreach ($runes as $rune){ // Grab Rune Names $name = $strings[$rune['Name']]; $itype1 = $itypes[$rune['itype1']]; $itype2 = $itypes[$rune['itype2']]; $itype3 = $itypes[$rune['itype3']]; $itype4 = $itypes[$rune['itype4']]; $itype5 = $itypes[$rune['itype5']]; $itype6 = $itypes[$rune['itype6']]; $rr_img[1] = $rune_inv_codes[$rune['Rune1']]; $rr_img[2] = $rune_inv_codes[$rune['Rune2']]; $rr_img[3] = $rune_inv_codes[$rune['Rune3']]; $rr_img[4] = $rune_inv_codes[$rune['Rune4']]; $rr_img[5] = $rune_inv_codes[$rune['Rune5']]; $rr_img[6] = $rune_inv_codes[$rune['Rune6']]; $rr[1] = str_replace('', '', $strings[$rune['Rune1']]); $rr[2] = str_replace('', '', $strings[$rune['Rune2']]); $rr[3] = str_replace('', '', $strings[$rune['Rune3']]); $rr[4] = str_replace('', '', $strings[$rune['Rune4']]); $rr[5] = str_replace('', '', $strings[$rune['Rune5']]); $rr[6] = str_replace('', '', $strings[$rune['Rune6']]); if (str_contains($rr[1], "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $rr[1] = preg_replace($p, "", $rr[1]); } if (str_contains($rr[2], "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $rr[2] = preg_replace($p, "", $rr[2]); } if (str_contains($rr[3], "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $rr[3] = preg_replace($p, "", $rr[3]); } if (str_contains($rr[4], "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $rr[4] = preg_replace($p, "", $rr[4]); } if (str_contains($rr[5], "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $rr[5] = preg_replace($p, "", $rr[5]); } if (str_contains($rr[6], "ÿc")) { $p = "/ÿc[\d:;\/.]/i"; $rr[6] = preg_replace($p, "", $rr[6]); } $rr = array_filter($rr); $rune_count = count($rr); $rune_count_duplicates = array_count_values($rr); // echo "
";
//                    var_dump($rune_count_duplicates);
                    
                    $rcd = null;
                    foreach ($rune_count_duplicates as $k => $v){
                        // rune * count
                        $rcd[] = "$k x $v"; 
                    }
		
//                   echo "
";
//                   var_dump($rcd);
                
          
                
                for ($i = 1; $i <= 7; $i++){

                    if($rune["T1Code{$i}"] != ''){

                    $params = [
                            "string1" => $isc[$rune["T1Code{$i}"]]["string1"],
                            "string2" => $isc[$rune["T1Code{$i}"]]["string2"],
                            "gstring1" => $isc[$rune["T1Code{$i}"]]["gstring"],
                            "gstring2" => $isc[$rune["T1Code{$i}"]]["gstring2"],
                            "descfunc" => $isc[$rune["T1Code{$i}"]]["descfunc"],
                            "descval" => $isc[$rune["T1Code{$i}"]]["descval"],
                            "dgrp" => $isc[$rune["T1Code{$i}"]]["dgrp"],
                            "dgrpfunc" => $isc[$rune["T1Code{$i}"]]["dgrpfunc"],
                            "dgrpval" => $isc[$rune["T1Code{$i}"]]["dgrpval"],
                            "prop" => $isc[$rune["T1Code{$i}"]]["prop"]
                    ];
                    $params["par"] = $rune["T1Param{$i}"];
                    $params["min"] = $rune["T1Min{$i}"];
                    $params["max"] = $rune["T1Max{$i}"];

                    $props[$i] = $idesc->getDesc($params);               
                    } 
                }

                $props = array_unique($props);
                
                // for each $rune, echo props
//                echo "
";
//                var_dump($props);
                
                
                $rr_img = array_filter($rr_img);

                $img_s = '';
                foreach ($rr_img as $k){
                    $img_s .= "";                    
                }
                
                //ddump($img_s);
                
                $tableRowsRunes .= <<
      
EOT; } echo $htmltop; echo $tableTop; echo $tableRowsRunes; echo "
Name Code Type Mods Weapons Helms Shields

{$g['String']}
{$g['code']} {$g['type']} Mods: {$g['nummods']}
{$g['weaponMod1Code']}
{$g['weaponMod2Code']}
{$g['weaponMod3Code']}

{$g['helmMod1Code']}
{$g['helmMod2Code']}
{$g['helmMod3Code']}

{$g['shieldMod1Code']}
{$g['shieldMod2Code']}
{$g['shieldMod3Code']}
Name Runes Properties

$name

$itype1
$itype2
$itype3
$itype4
$itype5
$itype6

$img_s

$rcd[0]
$rcd[1]
$rcd[2]
$rcd[3]
$rcd[4]
$rcd[5]

  • $name
  • $props[1]
  • $props[2]
  • $props[3]
  • $props[4]
  • $props[5]
  • $props[6]
  • $props[7]
"; echo $htmlbottom; $htmlFinal = $htmltop. $tableTop . $tableRowsRunes .$tableBottom ; file_put_contents("$dir/runewords.html", $htmlFinal); header("Location: docs/{$_SESSION['modname']}/runewords.html"); }