mirror of
https://gitlab.com/hashborgir/d2tools.git
synced 2024-11-30 12:36:03 +00:00
fixed cubemain big problems, some remain. tcex saves now
This commit is contained in:
parent
a60492e230
commit
ab78848845
@ -41,7 +41,7 @@ if ($result) {
|
|||||||
echo "Failed to update! Error: " . $db->lastErrorMsg();
|
echo "Failed to update! Error: " . $db->lastErrorMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$tsvFilePath = $_SESSION['path'] . "/TreasureClassEx.txt";
|
||||||
|
|
||||||
// Open the file for writing
|
// Open the file for writing
|
||||||
$fileHandle = fopen($tsvFilePath, 'w');
|
$fileHandle = fopen($tsvFilePath, 'w');
|
||||||
|
93
genDocs.php
93
genDocs.php
@ -270,6 +270,7 @@ EOT;
|
|||||||
AND `input 1` <> 'ib1'
|
AND `input 1` <> 'ib1'
|
||||||
AND `input 2` <> 'ooc'
|
AND `input 2` <> 'ooc'
|
||||||
AND `description` NOT LIKE '%Stone x%'
|
AND `description` NOT LIKE '%Stone x%'
|
||||||
|
AND `description` NOT LIKE 'Rune%'
|
||||||
AND `description` NOT LIKE '%Unstacker%' ";
|
AND `description` NOT LIKE '%Unstacker%' ";
|
||||||
$res = PDO_FetchAll($sql);
|
$res = PDO_FetchAll($sql);
|
||||||
|
|
||||||
@ -290,48 +291,52 @@ EOT;
|
|||||||
"input 7" => $r["input 7"],
|
"input 7" => $r["input 7"],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
$input1_code = explode(',',$r['input 1'])[0];
|
||||||
|
|
||||||
foreach ($input_codes as $inputNum => $value) {
|
foreach ($input_codes as $inputNum => $value) {
|
||||||
if (str_contains($value, ',')) {
|
if (str_contains($value, ',')) {
|
||||||
$input_codes[$inputNum] = explode(",", $value); // hpot,qty=3
|
$input_codes[$inputNum] = explode(",", $value); // hpot,qty=3
|
||||||
|
|
||||||
$oarray = explode(",", $value); // hpot,qty=3
|
$iarray = explode(",", $value); // hpot,qty=3
|
||||||
// For each input code // hpot,qty=3 like mpot/hpot/magharv
|
// For each input code // hpot,qty=3 like mpot/hpot/magharv
|
||||||
// if spelldescstr is set, use it. Else use item string tbl
|
// if spelldescstr is set, use it. Else use item string tbl
|
||||||
// first find the item code in either armor, misc, or weapons
|
// first find the item code in either armor, misc, or weapons
|
||||||
// then get spelldesc/spelldescstr
|
// then get spelldesc/spelldescstr
|
||||||
// $sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
|
// $sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
|
||||||
// $str = PDO_FetchOne($sql);
|
// $str = PDO_FetchOne($sql);
|
||||||
$str = $strings[$oarray[0]]; // Assuming $strings array is defined
|
$str = $strings[$iarray[0]]; // Assuming $strings array is defined
|
||||||
// if empty str == 4-letter code, call $idoc->getItemName()
|
// if empty str == 4-letter code, call $idoc->getItemName()
|
||||||
if (empty($str)) {
|
if (empty($str)) {
|
||||||
$input_codes[$inputNum][0] = $oarray[0];
|
$input_codes[$inputNum][0] = $iarray[0];
|
||||||
} else {
|
} else {
|
||||||
$input_codes[$inputNum][0] = $str;
|
$input_codes[$inputNum][0] = $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get image
|
// get image
|
||||||
$input_codes[$inputNum]["img"] = $idoc->getImage($oarray[0]);
|
$input_codes[$inputNum]["img"] = $idoc->getImage($iarray[0]);
|
||||||
|
$input_codes[$inputNum]['code'] = $iarray[0];
|
||||||
} else {
|
} else {
|
||||||
$value .= ",";
|
$value .= ",";
|
||||||
$input_codes[$inputNum] = explode(",", $value); // hpot,qty=3
|
$input_codes[$inputNum] = explode(",", $value); // hpot,qty=3
|
||||||
|
|
||||||
$oarray = explode(",", $value); // hpot,qty=3
|
$iarray = explode(",", $value); // hpot,qty=3
|
||||||
// For each input code // hpot,qty=3 like mpot/hpot/magharv
|
// For each input code // hpot,qty=3 like mpot/hpot/magharv
|
||||||
// if spelldescstr is set, use it. Else use item string tbl
|
// if spelldescstr is set, use it. Else use item string tbl
|
||||||
// first find the item code in either armor, misc, or weapons
|
// first find the item code in either armor, misc, or weapons
|
||||||
// then get spelldesc/spelldescstr
|
// then get spelldesc/spelldescstr
|
||||||
// $sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
|
// $sql = "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
|
||||||
// $str = PDO_FetchOne($sql);
|
// $str = PDO_FetchOne($sql);
|
||||||
$str = $strings[$oarray[0]]; // Assuming $strings array is defined
|
$str = $strings[$iarray[0]]; // Assuming $strings array is defined
|
||||||
// if empty str == 4-letter code, so just display
|
// if empty str == 4-letter code, so just display
|
||||||
if (empty($str)) {
|
if (empty($str)) {
|
||||||
$input_codes[$inputNum][0] = $oarray[0];
|
$input_codes[$inputNum][0] = $iarray[0];
|
||||||
|
$input_codes[$inputNum]['code'] = $iarray[0];
|
||||||
} else {
|
} else {
|
||||||
$input_codes[$inputNum][0] = $str;
|
$input_codes[$inputNum][0] = $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get image
|
// get image
|
||||||
$input_codes[$inputNum]["img"] = $idoc->getImage($oarray[0]);
|
$input_codes[$inputNum]["img"] = $idoc->getImage($iarray[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,11 +350,15 @@ EOT;
|
|||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//var_dump(array_filter($r));
|
||||||
|
//var_dump($r['input 1']);
|
||||||
|
//var_dump($input1_code);
|
||||||
//var_dump($output_codes);
|
//var_dump($output_codes);
|
||||||
// output_codes is an array
|
// output_codes is an array
|
||||||
// output codes of outputs, like output, output b, output c.
|
// output codes of outputs, like output, output b, output c.
|
||||||
// each output can have 3 or 4 level item code or a amu,mag,pre=331 code
|
// each output can have 3 or 4 level item code or a amu,mag,pre=331 code
|
||||||
// outputNum is output a, or output b, or output c, should have been called outputLetter whatever
|
// outputNum is output a, or output b, or output c, should have been called outputLetter whatever
|
||||||
|
$oarray = [];
|
||||||
foreach ($output_codes as $outputNum => $value) {
|
foreach ($output_codes as $outputNum => $value) {
|
||||||
|
|
||||||
//outputNum will be output, or output b, or c
|
//outputNum will be output, or output b, or c
|
||||||
@ -357,11 +366,16 @@ EOT;
|
|||||||
// or rin,mag,pre=353
|
// or rin,mag,pre=353
|
||||||
// if value contains a comma, e.g., rin,mag,pre=353
|
// if value contains a comma, e.g., rin,mag,pre=353
|
||||||
// then explode it at the comma
|
// then explode it at the comma
|
||||||
if (str_contains($value, ',')) {
|
|
||||||
$output_codes[$outputNum] = explode(",", $value); // hpot,qty=3
|
$output_codes[$outputNum] = explode(",", $value); // hpot,qty=3
|
||||||
$oarray = explode(",", $value); // hpot,qty=3
|
$oarray = explode(",", $value); // hpot,qty=3
|
||||||
|
if ($oarray[0] == 'usetype' || $oarray[0] == 'useitem') {
|
||||||
$str = $strings[$oarray[0]]; // "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
|
$oarray[0] = $input1_code;
|
||||||
|
}
|
||||||
|
//if (in_array($oarray[0], $strings)) {
|
||||||
|
$str = $strings[$oarray[0]];
|
||||||
|
//}
|
||||||
|
// "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\"";
|
||||||
// clean str
|
// clean str
|
||||||
// $str = PDO_FetchOne($sql);
|
// $str = PDO_FetchOne($sql);
|
||||||
if (str_contains($str, "ÿc")) {
|
if (str_contains($str, "ÿc")) {
|
||||||
@ -369,9 +383,11 @@ EOT;
|
|||||||
$str = preg_replace($p, "", $str);
|
$str = preg_replace($p, "", $str);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($output_codes[$outputNum] == 'usetype' || $output_codes[$outputNum] == 'useitem') {
|
|
||||||
$output_codes[$outputNum][0] = $input_codes[1];
|
// what if we set it to input codes 1 code
|
||||||
}
|
//var_dump($strings[$oarray[0]]);
|
||||||
|
// var_dump($oarray[0]);
|
||||||
|
// var_dump($str);
|
||||||
|
|
||||||
// if empty, str == 4-letter code, so just display
|
// if empty, str == 4-letter code, so just display
|
||||||
if (empty($str)) {
|
if (empty($str)) {
|
||||||
@ -379,36 +395,11 @@ EOT;
|
|||||||
} else {
|
} else {
|
||||||
$output_codes[$outputNum][0] = $str;
|
$output_codes[$outputNum][0] = $str;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output_codes[$outputNum]["img"] = $idoc->getImage($oarray[0]);
|
$output_codes[$outputNum]["img"] = $idoc->getImage($oarray[0]);
|
||||||
} else { // else output code is three/four letter code
|
|
||||||
$value .= ",";
|
|
||||||
|
|
||||||
|
|
||||||
//var_dump($output_codes[$outputNum]);
|
|
||||||
|
|
||||||
$output_codes[$outputNum] = explode(",", $value); // hpot,qty=3
|
|
||||||
$oarray = explode(",", $value); // hpot,qty=3
|
|
||||||
$str = $strings[$oarray[0]]; //"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"] = $idoc->getImage($oarray[0]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//var_dump($oarray);
|
||||||
|
//echo "Generated Output Codes Array";
|
||||||
|
//echo "input code: ". $input_codes['intput 1'][0];
|
||||||
//var_dump($output_codes);
|
//var_dump($output_codes);
|
||||||
// if output[1] or output[2], output[3], output[4] contains `=' sign
|
// if output[1] or output[2], output[3], output[4] contains `=' sign
|
||||||
// parse_str or explode at = to get modifer and value
|
// parse_str or explode at = to get modifer and value
|
||||||
@ -426,13 +417,12 @@ EOT;
|
|||||||
|
|
||||||
//var_dump($mod);
|
//var_dump($mod);
|
||||||
|
|
||||||
foreach ($mod as $m) {
|
|
||||||
if (str_contains($m, '=')) {
|
$e = explode("=", $mod[1]);
|
||||||
$e = explode("=", $m);
|
|
||||||
$output_codes[$outputNum]['code'] = $e[0];
|
$output_codes[$outputNum]['code'] = $e[0];
|
||||||
$output_codes[$outputNum]['value'] = $e[1];
|
$output_codes[$outputNum]['value'] = $e[1];
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -466,6 +456,8 @@ EOT;
|
|||||||
}
|
}
|
||||||
$output['mods'] = array_filter($m);
|
$output['mods'] = array_filter($m);
|
||||||
|
|
||||||
|
//var_dump($output['mods']);
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
// var_dump($output['mods']);
|
// var_dump($output['mods']);
|
||||||
@ -475,7 +467,7 @@ EOT;
|
|||||||
$min = ($v["mod " . $k + 1 . " min"]) ?? $max;
|
$min = ($v["mod " . $k + 1 . " min"]) ?? $max;
|
||||||
$max = ($v["mod " . $k + 1 . " max"]) ?? $min;
|
$max = ($v["mod " . $k + 1 . " max"]) ?? $min;
|
||||||
|
|
||||||
//var_dump($min);
|
//var_dump($isc[$prop]);
|
||||||
|
|
||||||
$output['mods'][$k]["isc"] = $isc[$prop];
|
$output['mods'][$k]["isc"] = $isc[$prop];
|
||||||
$params = [
|
$params = [
|
||||||
@ -492,7 +484,12 @@ EOT;
|
|||||||
// 'item' => $return
|
// 'item' => $return
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
|
//var_dump($idesc->getDesc($params));
|
||||||
|
|
||||||
|
|
||||||
$output['mods'][$k]["str"] = $idesc->getDesc($params);
|
$output['mods'][$k]["str"] = $idesc->getDesc($params);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -325,6 +325,10 @@ class D2ItemDesc {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
|
if (empty($s1)) {
|
||||||
|
$this->str = $prop;
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($par)) {
|
if (empty($par)) {
|
||||||
$v = $min;
|
$v = $min;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user