Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $todata = "/home/all/data";
- if (!isset($_GET['name'])) {
- $main_content .= '
- <table style="font:14px/15px Tahoma, Helvetica, sans-serif;">
- <ul>
- ';
- $path = $todata . "/monster/";
- $folder = opendir($path);
- $i = 3;
- $monsters = array();
- while ($filename = readdir($folder)) {
- if ($filename == "." || $filename == "..")
- continue;
- $temp = explode(".", $filename);
- if ($temp[1] == "xml") {
- $nazwa = $temp[0];
- if ($nazwa != "monsters") {
- $monster = simplexml_load_file($path . $nazwa . '.xml');
- $monsters[$nazwa] = $monster['name'];
- }
- }
- }
- asort($monsters);
- foreach ($monsters as $nazwa => $name) {
- $begin = ($i % 2) ? '<tr><td>' : '<td>';
- $end = ($i % 2) ? '</td>' : '</td></tr>';
- $main_content .= $begin . '<li><a href="?subtopic=monsters&name=' . $nazwa . '">' . $name . '</a></li>' . $end;
- $i++;
- }
- $main_content .= '
- </ul>
- </table>
- ';
- } else {
- $file_items = $todata . "/items/items.xml";
- $monster_path = $todata . "/monster/";
- $imagefolder = "assets/monsters/";
- $monster_name = $_REQUEST['name'];
- include("assets/ids.inc");
- $name = "";
- $exp = 0;
- $hp = 0;
- $looktype = 0;
- $file = $monster_path . $monster_name . ".xml";
- $f = @fopen($file, "r");
- if ($f) {
- $contents = fread($f, filesize($file));
- fclose($f);
- $tags = explode("<", $contents);
- foreach ($tags as $tag) {
- if (substr($tag, 0, 7) == "monster") {
- $temp = stristr($tag, " name=\"");
- $temp2 = explode("\"", $temp);
- $name = $temp2[1];
- }
- if (substr($tag, 0, 7) == "monster") {
- $temp = stristr($tag, " experience=\"");
- $temp2 = explode("\"", $temp);
- $exp = $temp2[1];
- }
- if (substr($tag, 0, 6) == "health") {
- $temp = stristr($tag, " max=\"");
- $temp2 = explode("\"", $temp);
- $hp = $temp2[1];
- }
- if (substr($tag, 0, 4) == "look") {
- $temp = stristr($tag, " type=\"");
- $temp2 = explode("\"", $temp);
- $looktype = $temp2[1];
- }
- if (substr($tag, 0, 7) == "defense") {
- $temp = stristr($tag, " immunity=\"");
- $temp2 = explode("\"", $temp);
- $immunitys[] = $temp2[1];
- }
- if (substr($tag, 0, 6) == "summon") {
- $temp = stristr($tag, " name=\"");
- $temp2 = explode("\"", $temp);
- $summons[] = $temp2[1];
- }
- }
- $temp = stristr($contents, "<attacks>");
- $attacks = explode("</attacks>", $temp);
- $attack = explode("<attack", $attacks[0]);
- $melee = false;
- $distance = false;
- $fire_spell = false;
- $energy_spell = false;
- $poison_spell = false;
- $explosion_rune = false;
- $sudden_death_rune = false;
- $bersek_spell = false;
- $self_healing = false;
- $summons[] = "";
- $immunitys[] = "";
- foreach ($attack as $temp) {
- if (stristr($temp, "type=\"melee\"")) {
- $melee = true;
- continue;
- }
- if (stristr($temp, "type=\"distance\"")) {
- $distance = true;
- continue;
- }
- if ((stristr($temp, "type=\"instant\"") || stristr($temp, "type=\"rune\"")) && (stristr($temp, "name=\"great fireball\"") || stristr($temp, "name=\"exevo gran mas vis\""))) {
- $fire_spell = true;
- continue;
- }
- if ((stristr($temp, "type=\"instant\"") || stristr($temp, "type=\"rune\"")) && (stristr($temp, "name=\"exevo gran vis lux\""))) {
- $energy_spell = true;
- continue;
- }
- if ((stristr($temp, "type=\"instant\"") || stristr($temp, "type=\"rune\"")) && (stristr($temp, "name=\"exura"))) {
- $self_healing = true;
- continue;
- }
- if ($tmp = stristr($temp, "name=\"")) {
- $temp2 = explode("\"", $tmp);
- $special_attacks = $special_attacks . $temp2[1] . ", ";
- continue;
- }
- if ($tmp = stristr($temp, "type=\"")) {
- $temp2 = explode("\"", $tmp);
- $special_attacks = $special_attacks . $temp2[1] . ", ";
- continue;
- }
- }
- $main_content .= ("<img src=\"$imagefolder$looktype.gif\">\n<br>\n<b>Name:</b> $name\n<br>\n<b>Exp:</b> $exp\n<br>\n<b>Health:</b> $hp\n<br>\n<b>Defense:</b> \n<ul style='padding-left:20px;'>\n");
- foreach ($immunitys as $temp) {
- if (!$temp)
- continue;
- $main_content .= ("<li>$temp<br>\n");
- }
- $main_content .= ("</ul><br>\n<b>Summons:</b> \n<ul style='padding-left:20px;'>\n");
- foreach ($summons as $temp) {
- if (!$temp)
- continue;
- $main_content .= ("<li>$temp<br>\n");
- }
- $main_content .= ("</ul>");
- $main_content .= ("\n\n<br><b>Attack with:</b> \n<br>\n");
- if ($melee)
- $main_content .= ("Close combat, ");
- if ($distance)
- $main_content .= ("Distance attacks, ");
- if ($fire_spell)
- $main_content .= ("Fire spells, ");
- if ($energy_spell)
- $main_content .= ("Energy spells, ");
- if ($poison_spell)
- $main_content .= ("Poison spells, ");
- if ($explosion_rune)
- $main_content .= ("Explosions, ");
- if ($sudden_death_rune)
- $main_content .= ("Sudden Deaths, ");
- if ($bersek_spell)
- $main_content .= ("Berserk, ");
- if ($self_healing)
- $main_content .= ("Self healing, ");
- if ($special_attacks)
- $main_content .= ("$special_attacks");
- $temp = stristr($contents, "<loot>");
- $lootnode = explode("</loot>", $temp);
- $loot = explode("<item", $lootnode[0]);
- $ids[] = "";
- foreach ($loot as $itemid) {
- if ($idpos = stristr($itemid, "id=\"")) {
- $temp = explode("\"", $idpos);
- $id = $temp[1];
- $ids[] = $id;
- }
- }
- $f2 = @fopen($file_items, "r");
- if ($f2) {
- $itemnames[] = "";
- $items_contents = fread($f2, filesize($file_items));
- fclose($f2);
- $items = explode("<item ", $items_contents);
- foreach ($ids as $itemid) {
- $found = false;
- foreach ($items as $item_node) {
- if (stristr($item_node, "id=\"$itemid\"")) {
- $temp = stristr($item_node, "name=\"");
- $temp2 = explode("\"", $temp);
- $itemnames[] = $temp2[1];
- $found = true;
- break;
- }
- }
- if (!$found) {
- $itemnames[] = $itemid;
- }
- }
- $main_content .= ("\n<br><br>\n<b>Loot:</b> \n<ul style='padding-left:20px;'>\n");
- foreach ($itemnames as $itemid) {
- if (!$item)
- continue;
- if ($itemid != "" && $itemid != "0" && $itemid != "0000") {
- $main_content .= ("<li>$item[$itemid]<br>\n");
- }
- }
- $main_content .= ("</ul>\n");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement