From 171cdf5197b6ed004a02ef8c7b4fc51119d0207c Mon Sep 17 00:00:00 2001 From: Hash Borgir Date: Tue, 22 Mar 2022 04:54:42 -0600 Subject: [PATCH] Runeword Browser Beta Version --- genDocs.php | 189 +++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 187 insertions(+), 2 deletions(-) diff --git a/genDocs.php b/genDocs.php index 1c13886..88c5458 100755 --- a/genDocs.php +++ b/genDocs.php @@ -59,7 +59,6 @@ define('DB_FILE', $_SESSION['modname'] . ".db"); PDO_Connect("sqlite:" . DB_FILE); require_once "./src/D2Functions.php"; -require_once './src/D2ItemData.php'; $idata = new D2ItemData(); @@ -219,6 +218,19 @@ $htmltop = << @@ -229,9 +241,10 @@ $htmltop = << + + + Name + Item Types + Runes + Properties + + + + 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[1] = str_replace(' Rune', '', $strings[$rune['Rune1']]); + $rr[2] = str_replace(' Rune', '', $strings[$rune['Rune2']]); + $rr[3] = str_replace(' Rune', '', $strings[$rune['Rune3']]); + $rr[4] = str_replace(' Rune', '', $strings[$rune['Rune4']]); + $rr[5] = str_replace(' Rune', '', $strings[$rune['Rune5']]); + $rr[6] = str_replace(' Rune', '', $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){
+                        $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);
+                
+
+		$tableRowsRunes .= <<
+      

$name

+

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

+ + +

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

+ + +
    +
  • $props[1]
  • +
  • $props[2]
  • +
  • $props[3]
  • +
  • $props[4]
  • +
  • $props[5]
  • +
  • $props[6]
  • +
  • $props[7]
  • +
+ + + + +EOT; + } + + +echo $htmltop; +echo $tableTop; +echo $tableRowsRunes; +echo ""; +echo $htmlbottom; + + +}