From caf675cff5f80a9624c6054eda89dfdfe43c2df3 Mon Sep 17 00:00:00 2001 From: Hash Borgir Date: Sat, 19 Aug 2023 17:32:13 -0600 Subject: [PATCH] latest. --- genDocs.php | 109 ++++- src/D2ItemDesc.php | 1164 +++++++++++++++++++++++--------------------- 2 files changed, 685 insertions(+), 588 deletions(-) diff --git a/genDocs.php b/genDocs.php index 90f5d23..9f80fcf 100755 --- a/genDocs.php +++ b/genDocs.php @@ -79,6 +79,12 @@ $strings = $idoc->getStrings(); $itemtypesTbl = $idoc->getItemTypesTbl(); $namestr = $idoc->getNameStr(); +$query = "SELECT ROWID,* FROM magicprefix"; +$mpre = PDO_FetchAll($query); + +$query = "SELECT ROWID,* FROM magicsuffix"; +$spre = PDO_FetchAll($query); + // htmlTop was huge, so put it into another file and just include it require_once 'templates/htmlTop.php'; $htmlbottom = ""; @@ -230,32 +236,32 @@ EOT; $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", + "hiq" => "Superior Quality", + "nor" => "Normal Quality", + "mag" => "Magic item", + "rar" => "Rare item", + "set" => "Set item", + "uni" => "Unique item", + "crf" => "Crafted item", + "tmp" => "Tempered item", + "eth" => "Etherealitem ", "noe" => "Not Ethereal", - "nos" => "No Socket (for input)", + "nos" => "No Socket (for input1)", "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", + "rep" => "Repair item durability", + "rch" => "Recharge all of the skill charges on the Item", "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", + "useitem" => "Uses item from input1", "uns" => "Unsocket Item(destroys gems)", "rem" => "Unsocket Item(removes gems)", - "reg" => "Regenerate? Seems to reroll the item", + "reg" => "Reroll the item", "mod" => "Transfers properties from input1 to output item.", ]; @@ -291,8 +297,8 @@ EOT; "input 7" => $r["input 7"], ]); - $input1_code = explode(',',$r['input 1'])[0]; - + $input1_code = explode(',', $r['input 1'])[0]; + foreach ($input_codes as $inputNum => $value) { if (str_contains($value, ',')) { $input_codes[$inputNum] = explode(",", $value); // hpot,qty=3 @@ -371,9 +377,12 @@ EOT; $oarray = explode(",", $value); // hpot,qty=3 if ($oarray[0] == 'usetype' || $oarray[0] == 'useitem') { $oarray[0] = $input1_code; + $oarray[2] = $i_params[$oarray[2]]; } + + //var_dump($oarray); //if (in_array($oarray[0], $strings)) { - $str = $strings[$oarray[0]]; + $str = $strings[$oarray[0]]; //} // "SELECT `String` FROM `strings` WHERE Key=\"{$oarray[0]}\""; // clean str @@ -383,12 +392,11 @@ EOT; $str = preg_replace($p, "", $str); } - + // 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)) { $output_codes[$outputNum][0] = ($oarray[0]); @@ -421,7 +429,58 @@ EOT; $e = explode("=", $mod[1]); $output_codes[$outputNum]['code'] = $e[0]; $output_codes[$outputNum]['value'] = $e[1]; - + +// if ($e[0] == 'pre') { +// $e[1]++; +// +// $pre = $mpre[$e[1]]; +// +// for ($i = 1; $i <= 3; $i++) { +// +// $mods = array_filter([ +// "mod{$i}code" => $pre["mod{$i}code"], +// "mod{$i}param" => $pre["mod{$i}param"], +// "mod{$i}min" => $pre["mod{$i}min"], +// "mod{$i}max" => $pre["mod{$i}max"], +// ]); +// } +// +// // var_dump($output['mods']); +// foreach ($mods as $k => $v) { +// $prop = ($v["mod " . $k + 1]); +// $par = ($v["mod{$k}param"]) ?? ""; +// $min = ($v["mod{$k}min"]) ?? $max; +// $max = ($v["mod{$k}max"]) ?? $min; +// +// //var_dump($isc[$prop]); +// +// $pre['mods'][$k]["isc"] = $isc[$prop]; +// +// +// +// $params = [ +// 'string1' => $pre['mods'][$k]["isc"]['string1'], +// 'string2' => $pre['mods'][$k]["isc"]['string2'], +// 'descfunc' => $pre['mods'][$k]["isc"]['descfunc'], +// 'descval' => $pre['mods'][$k]["isc"]['descval'], +// "prop" => $prop, +// "par" => $par, +// "min" => $min, +// "max" => $max, +// // "val1" => $funcval['val1'], +// // "func1" => $funcval['func1'] +// // 'item' => $return +// ]; +// +// //var_dump($idesc->getDesc($params)); +// +// $output['pre']['mods'][$k]["str"] = $idesc->getDesc($params); +// } +// } + + + + } } @@ -455,7 +514,7 @@ EOT; $m[] = array_filter($mods); } $output['mods'] = array_filter($m); - + //var_dump($output['mods']); $result = []; @@ -484,12 +543,10 @@ EOT; // 'item' => $return ]; - //var_dump($idesc->getDesc($params)); - - + + $output['mods'][$k]["str"] = $idesc->getDesc($params); - } @@ -567,6 +624,8 @@ EOT; $htmlRow .= $output["output"][1] . "
"; } + $htmlRow .= $i_params[$output["output"][2]] . "
"; + for ($i = 1; $i <= 5; $i++) { if ($output["mods"][0]["mod $i"]) { diff --git a/src/D2ItemDesc.php b/src/D2ItemDesc.php index 9ab050a..6d77906 100755 --- a/src/D2ItemDesc.php +++ b/src/D2ItemDesc.php @@ -46,97 +46,97 @@ * */ class D2ItemDesc { - /* + /* - DescFunc: the function used for generating the description for this stat, this works like the descfuncs in SkillDesc.txt pretty much. See below for an explanation of individual functions, these are listed the way they would show up if DescVal is set to 1. This follows the syntax Char used in the old fileguide, but includes the functions he didn't cover. + DescFunc: the function used for generating the description for this stat, this works like the descfuncs in SkillDesc.txt pretty much. See below for an explanation of individual functions, these are listed the way they would show up if DescVal is set to 1. This follows the syntax Char used in the old fileguide, but includes the functions he didn't cover. - 1 - +[value] [string1] - 2 - [value]% [string1] - 3 - [value] [string1] - 4 - +[value]% [string1] - 5 - [value*100/128]% [string1] - 6 - +[value] [string1] [string2] - 7 - [value]% [string1] [string2] - 8 - +[value]% [string1] [string2] - 9 - [value] [string1] [string2] - 10 - [value*100/128]% [string1] [string2] - 11 - Repairs 1 Durability In [100 / value] Seconds - 12 - +[value] [string1] - 13 - +[value] to [class] Skill Levels - 14 - +[value] to [skilltab] Skill Levels ([class] Only) - 15 - [chance]% to case [slvl] [skill] on [event] - 16 - Level [sLvl] [skill] Aura When Equipped - 17 - [value] [string1] (Increases near [time]) - 18 - [value]% [string1] (Increases near [time]) - 19 - this is used by stats that use Blizzard's sprintf implementation (if you don't know what that is, it won't be of interest to you eitherway I guess), look at how prismatic is setup, the string is the format that gets passed to their sprintf spinoff. - 20 - [value * -1]% [string1] - 21 - [value * -1] [string1] - 22 - [value]% [string1] [montype] (warning: this is bugged in vanilla and doesn't work properly, see CE forum) - 23 - [value]% [string1] [monster] - 24 - used for charges, we all know how that desc looks - 25 - not used by vanilla, present in the code but I didn't test it yet - 26 - not used by vanilla, present in the code but I didn't test it yet - 27 - +[value] to [skill] ([class] Only) - 28 - +[value] to [skill] + 1 - +[value] [string1] + 2 - [value]% [string1] + 3 - [value] [string1] + 4 - +[value]% [string1] + 5 - [value*100/128]% [string1] + 6 - +[value] [string1] [string2] + 7 - [value]% [string1] [string2] + 8 - +[value]% [string1] [string2] + 9 - [value] [string1] [string2] + 10 - [value*100/128]% [string1] [string2] + 11 - Repairs 1 Durability In [100 / value] Seconds + 12 - +[value] [string1] + 13 - +[value] to [class] Skill Levels + 14 - +[value] to [skilltab] Skill Levels ([class] Only) + 15 - [chance]% to case [slvl] [skill] on [event] + 16 - Level [sLvl] [skill] Aura When Equipped + 17 - [value] [string1] (Increases near [time]) + 18 - [value]% [string1] (Increases near [time]) + 19 - this is used by stats that use Blizzard's sprintf implementation (if you don't know what that is, it won't be of interest to you eitherway I guess), look at how prismatic is setup, the string is the format that gets passed to their sprintf spinoff. + 20 - [value * -1]% [string1] + 21 - [value * -1] [string1] + 22 - [value]% [string1] [montype] (warning: this is bugged in vanilla and doesn't work properly, see CE forum) + 23 - [value]% [string1] [monster] + 24 - used for charges, we all know how that desc looks + 25 - not used by vanilla, present in the code but I didn't test it yet + 26 - not used by vanilla, present in the code but I didn't test it yet + 27 - +[value] to [skill] ([class] Only) + 28 - +[value] to [skill] - DescVal: Controls whenever and if so in what way the stat value is shown, + DescVal: Controls whenever and if so in what way the stat value is shown, - * 0 = doesn't show the value of the stat, - * 1 = shows the value of the stat infront of the description, - * 2 = shows the value of the stat after the description. + * 0 = doesn't show the value of the stat, + * 1 = shows the value of the stat infront of the description, + * 2 = shows the value of the stat after the description. - DescStrPos: The string used for the description when the stat value is positive. + DescStrPos: The string used for the description when the stat value is positive. - DescStrNeg: The string used for the description when the stat value is negative. + DescStrNeg: The string used for the description when the stat value is negative. - DescStr2: An additional string used by some DescFuncs, usually used as a suffix or for aditional info (such as per character level etc). - * - * - * - * DATA SAMPLE - * - * - * - array (size=174) - 'item_absorbcold' => - array (size=6) - 'Stat' => string 'item_absorbcold' (length=15) - 'ID' => string '149' (length=3) - 'descfunc' => string '1' (length=1) - 'descval' => string '1' (length=1) - 'descstrpos' => string 'ModStr5n' (length=8) - 'String' => string 'Cold Absorb' (length=11) - 'item_absorbcold_percent' => - array (size=6) - 'Stat' => string 'item_absorbcold_percent' (length=23) - 'ID' => string '148' (length=3) - 'descfunc' => string '2' (length=1) - 'descval' => string '2' (length=1) - 'descstrpos' => string 'ModStr5m' (length=8) - 'String' => string 'Cold Absorb' (length=11) - 'item_absorb_cold_perlevel' => - array (size=6) - 'Stat' => string 'item_absorb_cold_perlevel' (length=25) - 'ID' => string '234' (length=3) - 'descfunc' => string '6' (length=1) - 'descval' => string '1' (length=1) - 'descstrpos' => string 'ModStre9p' (length=9) - 'String' => string 'Absorbs Cold Damage' (length=19) - 'item_absorbfire' => - array (size=6) - 'Stat' => string 'item_absorbfire' (length=15) - 'ID' => string '143' (length=3) - 'descfunc' => string '1' (length=1) - 'descval' => string '1' (length=1) - 'descstrpos' => string 'ModStr5h' (length=8) - 'String' => string 'Fire Absorb' (length=11) - * - * + DescStr2: An additional string used by some DescFuncs, usually used as a suffix or for aditional info (such as per character level etc). + * + * + * + * DATA SAMPLE + * + * + * + array (size=174) + 'item_absorbcold' => + array (size=6) + 'Stat' => string 'item_absorbcold' (length=15) + 'ID' => string '149' (length=3) + 'descfunc' => string '1' (length=1) + 'descval' => string '1' (length=1) + 'descstrpos' => string 'ModStr5n' (length=8) + 'String' => string 'Cold Absorb' (length=11) + 'item_absorbcold_percent' => + array (size=6) + 'Stat' => string 'item_absorbcold_percent' (length=23) + 'ID' => string '148' (length=3) + 'descfunc' => string '2' (length=1) + 'descval' => string '2' (length=1) + 'descstrpos' => string 'ModStr5m' (length=8) + 'String' => string 'Cold Absorb' (length=11) + 'item_absorb_cold_perlevel' => + array (size=6) + 'Stat' => string 'item_absorb_cold_perlevel' (length=25) + 'ID' => string '234' (length=3) + 'descfunc' => string '6' (length=1) + 'descval' => string '1' (length=1) + 'descstrpos' => string 'ModStre9p' (length=9) + 'String' => string 'Absorbs Cold Damage' (length=19) + 'item_absorbfire' => + array (size=6) + 'Stat' => string 'item_absorbfire' (length=15) + 'ID' => string '143' (length=3) + 'descfunc' => string '1' (length=1) + 'descval' => string '1' (length=1) + 'descstrpos' => string 'ModStr5h' (length=8) + 'String' => string 'Fire Absorb' (length=11) + * + * - */ + */ /** * @var string @@ -150,118 +150,121 @@ class D2ItemDesc { * @var */ public $skilltabsDesc; + /** * @var */ public $skilltabsDescClean; + /** * @var string[] */ public $skilltabs = [ - //ama - '0' => 'StrSklTabItem3', - '1' => 'StrSklTabItem2', - '2' => 'StrSklTabItem1', - // sor - '3' => 'StrSklTabItem15', - '4' => 'StrSklTabItem14', - '5' => 'StrSklTabItem13', - //nec - '6' => 'StrSklTabItem8', - '7' => 'StrSklTabItem7', - '8' => 'StrSklTabItem9', - //pal - '9' => 'StrSklTabItem6', - '10' => 'StrSklTabItem5', - '11' => 'StrSklTabItem4', - //bar - '12' => 'StrSklTabItem11', - '13' => 'StrSklTabItem12', - '14' => 'StrSklTabItem10', - //dru - '15' => 'StrSklTabItem16', - '16' => 'StrSklTabItem17', - '17' => 'StrSklTabItem18', - // ass - '18' => 'StrSklTabItem19', - '19' => 'StrSklTabItem20', - '20' => 'StrSklTabItem21' - ]; + //ama + '0' => 'StrSklTabItem3', + '1' => 'StrSklTabItem2', + '2' => 'StrSklTabItem1', + // sor + '3' => 'StrSklTabItem15', + '4' => 'StrSklTabItem14', + '5' => 'StrSklTabItem13', + //nec + '6' => 'StrSklTabItem8', + '7' => 'StrSklTabItem7', + '8' => 'StrSklTabItem9', + //pal + '9' => 'StrSklTabItem6', + '10' => 'StrSklTabItem5', + '11' => 'StrSklTabItem4', + //bar + '12' => 'StrSklTabItem11', + '13' => 'StrSklTabItem12', + '14' => 'StrSklTabItem10', + //dru + '15' => 'StrSklTabItem16', + '16' => 'StrSklTabItem17', + '17' => 'StrSklTabItem18', + // ass + '18' => 'StrSklTabItem19', + '19' => 'StrSklTabItem20', + '20' => 'StrSklTabItem21' + ]; + /** * @var string[] */ public $charClass = [ - "ama" => "Amazon", - "sor" => "Sorceress", - "nec" => "Necromancer", - "pal" => "Paladin", - "bar" => "Barbarian", - "dru" => "Druid", - "ass" => "Assassin" - ]; + "ama" => "Amazon", + "sor" => "Sorceress", + "nec" => "Necromancer", + "pal" => "Paladin", + "bar" => "Barbarian", + "dru" => "Druid", + "ass" => "Assassin" + ]; - /* - * - * Prepare values for descfunc - These are prop funcs from properties.txt + /* + * + * Prepare values for descfunc + These are prop funcs from properties.txt - val1 to val7: Parameter to the property function, if the function can - use it (see class skills properties). + val1 to val7: Parameter to the property function, if the function can + use it (see class skills properties). - func1 to func7: Function used to assign a value to a property + func1 to func7: Function used to assign a value to a property - * min: Description of the min value + * min: Description of the min value - * max: Description of the max value + * max: Description of the max value - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - * - * - APPENDIX: Functions of Properties.txt + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + * + * + APPENDIX: Functions of Properties.txt - Here are some functions used by the properties.txt to link - param/min/max value to the actual bonus of the properties. - * - * - @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + Here are some functions used by the properties.txt to link + param/min/max value to the actual bonus of the properties. + * + * + @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ - 1 - Applies a value to a stat, can use SetX parameter. - 2 - defensive function only, similar to 1 ??? - 3 - Apply the same min-max range as used in the previous function block - (see res-all). + 1 - Applies a value to a stat, can use SetX parameter. + 2 - defensive function only, similar to 1 ??? + 3 - Apply the same min-max range as used in the previous function block + (see res-all). - 4 - not used ??? - 5 - Dmg-min related ??? - 6 - Dmg-max related ??? - 7 - Dmg% related ??? - 8 - ??? use for speed properties (ias, fcr, etc ...) - 9 - Apply the same param and value in min-max range, as used in the - previous function block. + 4 - not used ??? + 5 - Dmg-min related ??? + 6 - Dmg-max related ??? + 7 - Dmg% related ??? + 8 - ??? use for speed properties (ias, fcr, etc ...) + 9 - Apply the same param and value in min-max range, as used in the + previous function block. - 10 - skilltab skill group ??? - 11 - event-based skills ??? - 12 - random selection of parameters for parameter-based stat ??? - 13 - durability-related ??? - 14 - inventory positions on item ??? (related to socket) - 15 - use min field only - 16 - use max field only - 17 - use param field only - 18 - Related to /time properties. - 19 - Related to charged item. - 20 - Simple boolean stuff. Use by indestruct. - 21 - Add to group of skills, group determined by stat ID, uses ValX parameter. - 22 - Individual skill, using param for skill ID, random between min-max. - 23 - ethereal - 24 - property applied to character or target monster ??? - 25--32 can be used in custom code. Check plugin documentation for syntax. + 10 - skilltab skill group ??? + 11 - event-based skills ??? + 12 - random selection of parameters for parameter-based stat ??? + 13 - durability-related ??? + 14 - inventory positions on item ??? (related to socket) + 15 - use min field only + 16 - use max field only + 17 - use param field only + 18 - Related to /time properties. + 19 - Related to charged item. + 20 - Simple boolean stuff. Use by indestruct. + 21 - Add to group of skills, group determined by stat ID, uses ValX parameter. + 22 - Individual skill, using param for skill ID, random between min-max. + 23 - ethereal + 24 - property applied to character or target monster ??? + 25--32 can be used in custom code. Check plugin documentation for syntax. - * - * @prep - * - * - */ + * + * @prep + * + * + */ /** * @param $par @@ -270,530 +273,565 @@ class D2ItemDesc { * @return void */ public function prep($par, $min, $max) { + + } - } + /* + * @getDesc + * + @return string + * + * + * probably non real need to code this function. + Just put this in getDesc() - /* - * @getDesc - * - @return string - * - * - * probably non real need to code this function. - Just put this in getDesc() - - if par - * use par - * else - * use min + if par + * use par + * else + * use min - * + * - */ + */ /** * */ public function __construct() { - - } - + + } /** * @param $params * @return false|string */ public function getDesc($params = []) { - if (empty($params)) - return false; + if (empty($params)) + return false; - //ddump($params); + //var_dump($params); + + $s1 = $params['string1']; + $s2 = $params['string2']; + $prop = $params['prop']; + $par = $params['par']; + $min = (int) $params['min']; + $v = $par; - $s1 = $params['string1']; - $s2 = $params['string2']; - $prop = $params['prop']; - $par = $params['par']; - $min = (int) $params['min']; - $v = $par; - // if ($params['dgrp']){ // $s1 = $params['gstring1']; // $s2 = $params['gstring2']; // $params['descfunc'] = $params['dgrpfunc']; // $params['descval'] = $params['dgrpval']; // } - - if (empty($s1)) { - $this->str = $prop; - } - - if (empty($par)) { - $v = $min; - } + $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.", + "levelreq" => "To level requirements" + ]; - $max = (int) $params['max']; +if (empty($s1)) { + if (array_key_exists($prop, $i_params)) { + $this->str = "$min " . $i_params[$prop]; + } else { + $this->str = $prop; + } +} - if ($min == $max) { - $max = ''; - } + if (empty($par)) { + $v = $min; + } - if (empty($this->skilltabsDesc)){ - - foreach ($this->skilltabs as $s) { - $sql = "SELECT String FROM strings WHERE Key=?"; - $this->skilltabsDesc[] = PDO_FetchRow($sql, [$s]); - } - } - //ddump($this->skilltabsDescClean); + $max = (int) $params['max']; - /* - * Descval 1 - * - * - * $format = 'The %s contains %d monkeys'; - echo sprintf($format, $num, $location); - * - * - * - */ - if ($params['descval'] == 1 || $params['descval'] == '') { + if ($min == $max) { + $max = ''; + } - if ($params['descfunc'] == 1) { - if (!empty($max)) { - $max = "-" . $max; - } - $this->str = "+$min$max $s1"; - } + if (empty($this->skilltabsDesc)) { - if ($params['descfunc'] == 2) { - $this->str = "$v% $s1"; - } + foreach ($this->skilltabs as $s) { + $sql = "SELECT String FROM strings WHERE Key=?"; + $this->skilltabsDesc[] = PDO_FetchRow($sql, [$s]); + } + } + //ddump($this->skilltabsDescClean); - if ($params['descfunc'] == 3) { - $this->str = "$s1"; - } + /* + * Descval 1 + * + * + * $format = 'The %s contains %d monkeys'; + echo sprintf($format, $num, $location); + * + * + * + */ + if ($params['descval'] == 1 || $params['descval'] == '') { - if ($params['descfunc'] == 4) { - $this->str = "+$v% $s1"; - } + if ($params['descfunc'] == 1) { + if (!empty($max)) { + $max = "-" . $max; + } + $this->str = "+$min$max $s1"; + } - if ($params['descfunc'] == 5) { - $this->str = ($v * 100 / 128) . " $s1"; - } + if ($params['descfunc'] == 2) { + $this->str = "$v% $s1"; + } - if ($params['descfunc'] == 6) { - $this->str = "+$par $s1 $s2"; - } + if ($params['descfunc'] == 3) { + $this->str = "$s1"; + } - if ($params['descfunc'] == 7) { - $this->str = "$v% $s1 $s2"; - } - if ($params['descfunc'] == 8) { - $this->str = "+$v% $s1 $s2"; - } + if ($params['descfunc'] == 4) { + $this->str = "+$v% $s1"; + } - if ($params['descfunc'] == 9) { - $this->str = "$v $s1 $s2"; - } + if ($params['descfunc'] == 5) { + $this->str = ($v * 100 / 128) . " $s1"; + } - if ($params['descfunc'] == 10) { - $this->str = ($v * 100 / 128) . " $s1 $s2"; - } + if ($params['descfunc'] == 6) { + $this->str = "+$par $s1 $s2"; + } - if ($params['descfunc'] == 11) { + if ($params['descfunc'] == 7) { + $this->str = "$v% $s1 $s2"; + } + if ($params['descfunc'] == 8) { + $this->str = "+$v% $s1 $s2"; + } - //var_dump($params); + if ($params['descfunc'] == 9) { + $this->str = "$v $s1 $s2"; + } - if ($par == '') { - $min = (int) $min; - $this->str = sprintf($s1, (100 / $min)); - } else { - $par = (int) $par; - $this->str = sprintf($s1, (100 / $par)); - } - } + if ($params['descfunc'] == 10) { + $this->str = ($v * 100 / 128) . " $s1 $s2"; + } - if ($params['descfunc'] == 12) { - $this->str = "+$v $s1"; - } + if ($params['descfunc'] == 11) { - if ($params['descfunc'] == 13) { - $chars = [ - "ama" => "ModStr3a", - "pal" => "ModStr3b", - "nec" => "ModStr3c", - "sor" => "ModStr3d", - "bar" => "ModStr3e", - "dru" => "ModStre8a", - "ass" => "ModStre8b" - ]; - $sql = "SELECT `String` FROM `strings` WHERE `Key`='{$chars[$prop]}'"; - $s1 = PDO_FetchOne($sql); - $this->str = "+$min $s1"; - } + //var_dump($params); - if ($params['descfunc'] == 14) { + if ($par == '') { + $min = (int) $min; + $this->str = sprintf($s1, (100 / $min)); + } else { + $par = (int) $par; + $this->str = sprintf($s1, (100 / $par)); + } + } + + if ($params['descfunc'] == 12) { + $this->str = "+$v $s1"; + } + + if ($params['descfunc'] == 13) { + $chars = [ + "ama" => "ModStr3a", + "pal" => "ModStr3b", + "nec" => "ModStr3c", + "sor" => "ModStr3d", + "bar" => "ModStr3e", + "dru" => "ModStre8a", + "ass" => "ModStre8b" + ]; + $sql = "SELECT `String` FROM `strings` WHERE `Key`='{$chars[$prop]}'"; + $s1 = PDO_FetchOne($sql); + $this->str = "+$min $s1"; + } + + if ($params['descfunc'] == 14) { - $sql = "SELECT class + $sql = "SELECT class FROM `charstats` WHERE `StrSkillTab1`='{$this->skilltabs[$par]}' OR `StrSkillTab2`='{$this->skilltabs[$par]}' OR `StrSkillTab3`='{$this->skilltabs[$par]}'"; - $class = PDO_FetchOne($sql); + $class = PDO_FetchOne($sql); - //ddump($class); + //ddump($class); - $s1 = $this->skilltabsDesc[$par]['String']; + $s1 = $this->skilltabsDesc[$par]['String']; - //ddump($s1); + //ddump($s1); - $this->str = sprintf($s1, $min); + $this->str = sprintf($s1, $min); - if (!isset($par)) { - $this->str = "Par is not set."; - } - } - if ($params['descfunc'] == 15) { - $sql = "SELECT skill FROM `skills` WHERE `Id`='$par'"; - $skill = PDO_FetchOne($sql); - $this->str = sprintf($s1, $min, $params['max'], $skill); - } + if (!isset($par)) { + $this->str = "Par is not set."; + } + } + if ($params['descfunc'] == 15) { + $sql = "SELECT skill FROM `skills` WHERE `Id`='$par'"; + $skill = PDO_FetchOne($sql); + $this->str = sprintf($s1, $min, $params['max'], $skill); + } - if ($params['descfunc'] == 16) { - $sql = "SELECT skill FROM `skills` WHERE `Id`='$par'"; - $aura = PDO_FetchOne($sql); - if (!$max) { - $this->str = "Level $min $aura Aura When Equipped "; - } else { - $this->str = "Level $min to $max $aura Aura When Equipped "; - } - } + if ($params['descfunc'] == 16) { + $sql = "SELECT skill FROM `skills` WHERE `Id`='$par'"; + $aura = PDO_FetchOne($sql); + if (!$max) { + $this->str = "Level $min $aura Aura When Equipped "; + } else { + $this->str = "Level $min to $max $aura Aura When Equipped "; + } + } - if ($params['descfunc'] == 17) { - $this->str = "$v $s1 (Increases near [time])"; - } + if ($params['descfunc'] == 17) { + $this->str = "$v $s1 (Increases near [time])"; + } - if ($params['descfunc'] == 18) { - $this->str = "$v% $s1 (Increases near [time])"; - } + if ($params['descfunc'] == 18) { + $this->str = "$v% $s1 (Increases near [time])"; + } - if ($params['descfunc'] == 19) { - $this->str = ""; - } + if ($params['descfunc'] == 19) { + $this->str = ""; + } - if ($params['descfunc'] == 20) { - $this->str = ($v) . "% $s1"; - } + if ($params['descfunc'] == 20) { + $this->str = ($v) . "% $s1"; + } - if ($params['descfunc'] == 21) { - $this->str = ($v * -1) . " $s1"; - } - if ($params['descfunc'] == 22) { - $this->str = "$v% $s1 [MonType]"; - } + if ($params['descfunc'] == 21) { + $this->str = ($v * -1) . " $s1"; + } + if ($params['descfunc'] == 22) { + $this->str = "$v% $s1 [MonType]"; + } - if ($params['descfunc'] == 23) { - $this->str = "$v% $s1 [Monster]"; - } + if ($params['descfunc'] == 23) { + $this->str = "$v% $s1 [Monster]"; + } - if ($params['descfunc'] == 24) { - $string = str_replace("\\", "", $s1); - $sql = "SELECT skill FROM `skills` WHERE `Id`='$par'"; - $skill = PDO_FetchOne($sql); - $this->str = "+$min to Skill Charges Or Something"; - $this->str = sprintf("Level $max $skill " . $string, $min, $min); - } + if ($params['descfunc'] == 24) { + $string = str_replace("\\", "", $s1); + $sql = "SELECT skill FROM `skills` WHERE `Id`='$par'"; + $skill = PDO_FetchOne($sql); + $this->str = "+$min to Skill Charges Or Something"; + $this->str = sprintf("Level $max $skill " . $string, $min, $min); + } - if ($params['descfunc'] == 25) { - $this->str = ""; - } + if ($params['descfunc'] == 25) { + $this->str = ""; + } - if ($params['descfunc'] == 26) { - $this->str = ""; - } + if ($params['descfunc'] == 26) { + $this->str = ""; + } - if ($params['descfunc'] == 27) { - $sql = "SELECT skill,charclass FROM `skills` WHERE `Id`='$par'"; - $res = PDO_FetchRow($sql); - $sql = "SELECT `skill` FROM `skills` WHERE `skilldesc`='$par' OR `Id`='$par'"; - $skill = PDO_FetchOne($sql); - $class = $this->charClass[$res['charclass']]; + if ($params['descfunc'] == 27) { + $sql = "SELECT skill,charclass FROM `skills` WHERE `Id`='$par'"; + $res = PDO_FetchRow($sql); + $sql = "SELECT `skill` FROM `skills` WHERE `skilldesc`='$par' OR `Id`='$par'"; + $skill = PDO_FetchOne($sql); + $class = $this->charClass[$res['charclass']]; - $this->str = "+$min to $skill ($class Only)"; - } + $this->str = "+$min to $skill ($class Only)"; + } - if ($params['descfunc'] == 28) { - $sql = "SELECT `skill` FROM `skills` WHERE `skilldesc`='$par' OR `Id`='$par'"; - $skill = PDO_FetchOne($sql); + if ($params['descfunc'] == 28) { + $sql = "SELECT `skill` FROM `skills` WHERE `skilldesc`='$par' OR `Id`='$par'"; + $skill = PDO_FetchOne($sql); - $this->str = "+$min to $skill "; - } - } - /* - * Descval 0 - * - * - * - * - * - * - * - */ else if ($params['descval'] == 0) { - if ($params['descfunc'] == 1) { - $this->str = "$s1"; - } + $this->str = "+$min to $skill "; + } + } + /* + * Descval 0 + * + * + * + * + * + * + * + */ else if ($params['descval'] == 0) { + if ($params['descfunc'] == 1) { + $this->str = "$s1"; + } - if ($params['descfunc'] == 2) { - $this->str = "$s1"; - } + if ($params['descfunc'] == 2) { + $this->str = "$s1"; + } - if ($params['descfunc'] == 3) { - $this->str = "$s1"; - } + if ($params['descfunc'] == 3) { + $this->str = "$s1"; + } - if ($params['descfunc'] == 4) { - $this->str = "$s1"; - } + if ($params['descfunc'] == 4) { + $this->str = "$s1"; + } - if ($params['descfunc'] == 5) { - $this->str = "$s1"; - } + if ($params['descfunc'] == 5) { + $this->str = "$s1"; + } - if ($params['descfunc'] == 6) { - $this->str = "$s1 $s2"; - } + if ($params['descfunc'] == 6) { + $this->str = "$s1 $s2"; + } - if ($params['descfunc'] == 7) { - $this->str = "$s1 $s2"; - } - if ($params['descfunc'] == 8) { - $this->str = "$s1 $s2"; - } + if ($params['descfunc'] == 7) { + $this->str = "$s1 $s2"; + } + if ($params['descfunc'] == 8) { + $this->str = "$s1 $s2"; + } - if ($params['descfunc'] == 9) { - $this->str = "$s1 $s2"; - } + if ($params['descfunc'] == 9) { + $this->str = "$s1 $s2"; + } - if ($params['descfunc'] == 10) { - $this->str = "$s1 $s2"; - } + if ($params['descfunc'] == 10) { + $this->str = "$s1 $s2"; + } - if ($params['descfunc'] == 11) { - $this->str = "Repairs 1 Durability In X seconds"; - } + if ($params['descfunc'] == 11) { + $this->str = "Repairs 1 Durability In X seconds"; + } - if ($params['descfunc'] == 12) { - $this->str = "$s1"; - } + if ($params['descfunc'] == 12) { + $this->str = "$s1"; + } - if ($params['descfunc'] == 13) { - $this->str = "to [class] Skill Levels"; - } + if ($params['descfunc'] == 13) { + $this->str = "to [class] Skill Levels"; + } - if ($params['descfunc'] == 14) { - $this->str = "to [skilltab] Skill Levels ([class] Only)"; - } - if ($params['descfunc'] == 15) { - $this->str = "[chance]to cast [slvl] [skill] on [event]"; - } + if ($params['descfunc'] == 14) { + $this->str = "to [skilltab] Skill Levels ([class] Only)"; + } + if ($params['descfunc'] == 15) { + $this->str = "[chance]to cast [slvl] [skill] on [event]"; + } - if ($params['descfunc'] == 16) { - $sql = "SELECT skill FROM `skills` WHERE `Id`='$par'"; - $aura = PDO_FetchOne($sql); - if (!$max) { - $this->str = "Level $min $aura Aura When Equipped "; - } else { - $this->str = "Level $min to $max $aura Aura When Equipped "; - } - } + if ($params['descfunc'] == 16) { + $sql = "SELECT skill FROM `skills` WHERE `Id`='$par'"; + $aura = PDO_FetchOne($sql); + if (!$max) { + $this->str = "Level $min $aura Aura When Equipped "; + } else { + $this->str = "Level $min to $max $aura Aura When Equipped "; + } + } - if ($params['descfunc'] == 17) { - $this->str = "$s1 (Increases near [time])"; - } + if ($params['descfunc'] == 17) { + $this->str = "$s1 (Increases near [time])"; + } - if ($params['descfunc'] == 18) { - $this->str = "$s1 (Increases near [time])"; - } + if ($params['descfunc'] == 18) { + $this->str = "$s1 (Increases near [time])"; + } - if ($params['descfunc'] == 19) { - $this->str = ""; - } + if ($params['descfunc'] == 19) { + $this->str = ""; + } - if ($params['descfunc'] == 20) { - $this->str = "$s1"; - } + if ($params['descfunc'] == 20) { + $this->str = "$s1"; + } - if ($params['descfunc'] == 21) { - $this->str = "$s1"; - } - if ($params['descfunc'] == 22) { - $this->str = "$s1 [MonType]"; - } + if ($params['descfunc'] == 21) { + $this->str = "$s1"; + } + if ($params['descfunc'] == 22) { + $this->str = "$s1 [MonType]"; + } - if ($params['descfunc'] == 23) { - $this->str = "$s1 [Monster]"; - } + if ($params['descfunc'] == 23) { + $this->str = "$s1 [Monster]"; + } - if ($params['descfunc'] == 24) { - $this->str = "to Skill Charges Or Something"; - } + if ($params['descfunc'] == 24) { + $this->str = "to Skill Charges Or Something"; + } - if ($params['descfunc'] == 25) { - $this->str = ""; - } + if ($params['descfunc'] == 25) { + $this->str = ""; + } - if ($params['descfunc'] == 26) { - $this->str = ""; - } + if ($params['descfunc'] == 26) { + $this->str = ""; + } - if ($params['descfunc'] == 27) { - $sql = "SELECT skill,charclass FROM `skills` WHERE `Id`='$par'"; - $res = PDO_FetchRow($sql); - $this->str = "+$min to {$res['skill']} ({$this->charClass[$res['charclass']]} Only)"; - } + if ($params['descfunc'] == 27) { + $sql = "SELECT skill,charclass FROM `skills` WHERE `Id`='$par'"; + $res = PDO_FetchRow($sql); + $this->str = "+$min to {$res['skill']} ({$this->charClass[$res['charclass']]} Only)"; + } - if ($params['descfunc'] == 28) { - $this->str = "to [skill] "; - } - } - /* - * Descval 2 - * - * - * - * - * - * - */ else if ($params['descval'] == 2) { - if ($params['descfunc'] == 1) { - $this->str = "$s1 +$v"; - } + if ($params['descfunc'] == 28) { + $this->str = "to [skill] "; + } + } + /* + * Descval 2 + * + * + * + * + * + * + */ else if ($params['descval'] == 2) { + if ($params['descfunc'] == 1) { + $this->str = "$s1 +$v"; + } - if ($params['descfunc'] == 2) { - $this->str = "$s1 $v%"; - } + if ($params['descfunc'] == 2) { + $this->str = "$s1 $v%"; + } - if ($params['descfunc'] == 3) { - $this->str = "$s1 $v"; - } + if ($params['descfunc'] == 3) { + $this->str = "$s1 $v"; + } - if ($params['descfunc'] == 4) { - $this->str = "$s1 $v%"; - } + if ($params['descfunc'] == 4) { + $this->str = "$s1 $v%"; + } - if ($params['descfunc'] == 5) { - $this->str = "$s1" . ($v * 100 / 128); - } + if ($params['descfunc'] == 5) { + $this->str = "$s1" . ($v * 100 / 128); + } - if ($params['descfunc'] == 6) { - $this->str = "$s1 $s2 +%v"; - } + if ($params['descfunc'] == 6) { + $this->str = "$s1 $s2 +%v"; + } - if ($params['descfunc'] == 7) { - $this->str = "$s1 $s2 $v% "; - } - if ($params['descfunc'] == 8) { - $this->str = "$s1 $s2 +$v% "; - } + if ($params['descfunc'] == 7) { + $this->str = "$s1 $s2 $v% "; + } + if ($params['descfunc'] == 8) { + $this->str = "$s1 $s2 +$v% "; + } - if ($params['descfunc'] == 9) { - $this->str = "$s1 $s2 $v"; - } + if ($params['descfunc'] == 9) { + $this->str = "$s1 $s2 $v"; + } - if ($params['descfunc'] == 10) { - $this->str = "$s1 $s2" . ($v * 100 / 128); - } + if ($params['descfunc'] == 10) { + $this->str = "$s1 $s2" . ($v * 100 / 128); + } - if ($params['descfunc'] == 11) { - $this->str = "Repairs 1 Durability In X seconds"; - } + if ($params['descfunc'] == 11) { + $this->str = "Repairs 1 Durability In X seconds"; + } - if ($params['descfunc'] == 12) { - $this->str = "$s1 +$v "; - } + if ($params['descfunc'] == 12) { + $this->str = "$s1 +$v "; + } - if ($params['descfunc'] == 13) { - $this->str = "to [class] Skill Levels +$v"; - } + if ($params['descfunc'] == 13) { + $this->str = "to [class] Skill Levels +$v"; + } - if ($params['descfunc'] == 14) { + if ($params['descfunc'] == 14) { - $sql = "SELECT class + $sql = "SELECT class FROM `charstats` WHERE `StrSkillTab1`='{$this->skilltabs[$par]}' OR `StrSkillTab2`='{$this->skilltabs[$par]}' OR `StrSkillTab3`='{$this->skilltabs[$par]}'"; - $class = PDO_FetchOne($sql); + $class = PDO_FetchOne($sql); - $this->str = "{$this->skilltabsDescClean[$par]['String']} ($class Only) +$max"; - } - if ($params['descfunc'] == 15) { - $this->str = "[chance]% to case [slvl] [skill] on [event]"; - } + $this->str = "{$this->skilltabsDescClean[$par]['String']} ($class Only) +$max"; + } + if ($params['descfunc'] == 15) { + $this->str = "[chance]% to case [slvl] [skill] on [event]"; + } - if ($params['descfunc'] == 16) { - $this->str = "Level [sLvl] [skill] Aura When Equipped "; - } + if ($params['descfunc'] == 16) { + $this->str = "Level [sLvl] [skill] Aura When Equipped "; + } - if ($params['descfunc'] == 17) { - $this->str = "s1 (Increases near [time]) $v $"; - } + if ($params['descfunc'] == 17) { + $this->str = "s1 (Increases near [time]) $v $"; + } - if ($params['descfunc'] == 18) { - $this->str = "$s1 (Increases near [time]) $v% "; - } + if ($params['descfunc'] == 18) { + $this->str = "$s1 (Increases near [time]) $v% "; + } - if ($params['descfunc'] == 19) { - $this->str = ""; - } + if ($params['descfunc'] == 19) { + $this->str = ""; + } - if ($params['descfunc'] == 20) { - $this->str = "% $s1" . ($v * -1); - } + if ($params['descfunc'] == 20) { + $this->str = "% $s1" . ($v * -1); + } - if ($params['descfunc'] == 21) { - $this->str = "$s1" . ($v * -1); - } - if ($params['descfunc'] == 22) { - $this->str = "$s1 [MonType] $v% "; - } + if ($params['descfunc'] == 21) { + $this->str = "$s1" . ($v * -1); + } + if ($params['descfunc'] == 22) { + $this->str = "$s1 [MonType] $v% "; + } - if ($params['descfunc'] == 23) { - $this->str = "s1 [Monster] $v%"; - } + if ($params['descfunc'] == 23) { + $this->str = "s1 [Monster] $v%"; + } - if ($params['descfunc'] == 24) { - $this->str = "to Skill Charges Or Something +$v "; - } + if ($params['descfunc'] == 24) { + $this->str = "to Skill Charges Or Something +$v "; + } - if ($params['descfunc'] == 25) { - $this->str = ""; - } + if ($params['descfunc'] == 25) { + $this->str = ""; + } - if ($params['descfunc'] == 26) { - $this->str = ""; - } + if ($params['descfunc'] == 26) { + $this->str = ""; + } - if ($params['descfunc'] == 27) { - $sql = "SELECT skill,charclass FROM `skills` WHERE `Id`='$par'"; - $res = PDO_FetchRow($sql); - $this->str = "+$min to {$res['skill']} ({$this->charClass[$res['charclass']]} Only)"; - } + if ($params['descfunc'] == 27) { + $sql = "SELECT skill,charclass FROM `skills` WHERE `Id`='$par'"; + $res = PDO_FetchRow($sql); + $this->str = "+$min to {$res['skill']} ({$this->charClass[$res['charclass']]} Only)"; + } - if ($params['descfunc'] == 28) { - $this->str = "+$v to [skill] "; - } - } + if ($params['descfunc'] == 28) { + $this->str = "+$v to [skill] "; + } + } - return $this->str; - } + return $this->str; + } }