thx mochitto, works slick!!
i edited it a bit to suite my wishes a bit more.(also reads pdef,mdef,patk, etc) in case you need it:
Code: Select all
$dir = "extension/dropcalc/src/items"; if ($handle = opendir($dir)) { while (false !== ($file = readdir($handle))) { if (strpos($file, ".xml") !== false) { echo "Loaded file $file...\n"; $file = $dir . "/" . $file; $item_list = array(); if (!($fp = fopen($file, "r"))) { echo "Cant open XML file: " . $file; continue; } $data = fread($fp, filesize($file)); fclose($fp); $xml_parser = xml_parser_create(); xml_parse_into_struct($xml_parser, $data, $vals, $index); xml_parser_free($xml_parser); foreach ($vals as $xml_element) { if ($xml_element["tag"] != "ITEM" && $xml_element["tag"] != "SET" && $xml_element["tag"] != "FOR" && $xml_element["tag"] != "ADD") continue; switch ($xml_element["type"]) { case "open": if ($xml_element["tag"] == "ITEM") { $item["id"] = $xml_element["attributes"]["ID"]; $item["type"] = $xml_element["attributes"]["TYPE"]; $item["name"] = $xml_element["attributes"]["NAME"]; } break; case "complete": if ($xml_element["tag"] == "SET" && array_key_exists("NAME", $xml_element["attributes"]) && $xml_element["level"] == 3) { $item[$xml_element["attributes"]["NAME"]] = $xml_element["attributes"]["VAL"]; } #adds "patk/matk/.." information for weapons if ($xml_element["tag"] == "SET" && array_key_exists("STAT", $xml_element["attributes"]) && $xml_element["level"] == 4) { $item[$xml_element["attributes"]["STAT"]] = $xml_element["attributes"]["VAL"]; } #adds "pdef/mdef/.." information for armor if ($xml_element["tag"] == "ADD" && array_key_exists("STAT", $xml_element["attributes"]) && $xml_element["level"] == 4) { $item[$xml_element["attributes"]["STAT"]] = $xml_element["attributes"]["VAL"]; } break; case "close": if ($xml_element["tag"] == "ITEM" && $xml_element["level"] == 2) { $item_list[$item["id"]] = $item; unset($item); } break; } } foreach ($item_list as $data) { #DB INSERT HERE #var_dump($data); } //print_r($item_list); <----- Thats the result array! (rob) //var_dump(count($item_list)); } } closedir($handle);}else{ echo "Cant open directory!";}
but anyone know where i can find fishing open rates, quest description information etc from client?
mochitto maybe you have a script for the recipe/char/augementation and skills xml?
lineage-realm.com - l2j based drop calculator.