Advertisement
Guest User

Untitled

a guest
Jun 19th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 10.33 KB | None | 0 0
  1. <?php
  2. if (empty($_REQUEST['creature'])) {
  3.     //SHOW MONSTERS LIST
  4.     $allowed_order_by = array('name', 'exp', 'health', 'summonable', 'convinceable', 'race');
  5.     $order = $_REQUEST['order'];
  6.     //generate sql query
  7.     if ($_REQUEST['desc'] == 1) {
  8.         $desc = " DESC";
  9.     }
  10.     if ($order == 'name') {
  11.         $whereandorder = ' ORDER BY name' . $desc;
  12.     } elseif ($order == 'exp') {
  13.         $whereandorder = ' ORDER BY exp' . $desc . ', name';
  14.     } elseif ($order == 'health') {
  15.         $whereandorder = ' ORDER BY health' . $desc . ', name';
  16.     } elseif ($order == 'summonable') {
  17.         $whereandorder = ' AND summonable = 1 ORDER BY mana' . $desc;
  18.     } elseif ($order == 'convinceable') {
  19.         $whereandorder = ' AND convinceable = 1 ORDER BY mana' . $desc;
  20.     } elseif ($order == 'race') {
  21.         $whereandorder = ' ORDER BY race' . $desc . ', name';
  22.     } else {
  23.         $whereandorder = ' ORDER BY name';
  24.     }
  25.     //send query to database
  26.     $monsters = $SQL->query('SELECT * FROM ' . $SQL->tableName('z_monsters') . ' WHERE hide_creature != 1' . $whereandorder);
  27.     $main_content.= '<TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><TR BGCOLOR=' . $config['site']['vdarkborder'] . '>';
  28.     if ($order == 'name' && !isset($_REQUEST['desc'])) {
  29.         $main_content.= '<TD CLASS=white width="200"><B><a href="?subtopic=creatures&order=name&desc=1"><font CLASS=white>Name DESC</a></B></TD>';
  30.     } else {
  31.         $main_content.= '<TD CLASS=white width="200"><B><a href="?subtopic=creatures&order=name"><font CLASS=white>Name</a></B></TD>';
  32.     }
  33.     if ($order == 'health' && !isset($_REQUEST['desc'])) {
  34.         $main_content.= '<TD CLASS=white><B><a href="?subtopic=creatures&order=health&desc=1"><font CLASS=white>Health<br/>DESC</a></B></TD>';
  35.     } else {
  36.         $main_content.= '<TD CLASS=white><B><a href="?subtopic=creatures&order=health"><font CLASS=white>Health</a></B></TD>';
  37.     }
  38.     if ($order == 'exp' && !isset($_REQUEST['desc'])) {
  39.         $main_content.= '<TD CLASS=white><B><a href="?subtopic=creatures&order=exp&desc=1"><font CLASS=white>Experience<br/>DESC</a></B></TD>';
  40.     } else {
  41.         $main_content.= '<TD CLASS=white><B><a href="?subtopic=creatures&order=exp"><font CLASS=white>Experience</a></B></TD>';
  42.     }
  43.     if ($order == 'summonable' && !isset($_REQUEST['desc'])) {
  44.         $main_content.= '<TD CLASS=white><B><a href="?subtopic=creatures&order=summonable&desc=1"><font CLASS=white>Summonable<br/>Mana DESC</a></B></TD>';
  45.     } else {
  46.         $main_content.= '<TD CLASS=white><B><a href="?subtopic=creatures&order=summonable"><font CLASS=white>Summonable<br/>Mana</a></B></TD>';
  47.     }
  48.     if ($order == 'convinceable' && !isset($_REQUEST['desc'])) {
  49.         $main_content.= '<TD CLASS=white><B><a href="?subtopic=creatures&order=convinceable&desc=1"><font CLASS=white>Convinceable<br/>Mana DESC</a></B></TD>';
  50.     } else {
  51.         $main_content.= '<TD CLASS=white><B><a href="?subtopic=creatures&order=convinceable"><font CLASS=white>Convinceable<br/>Mana</a></B></TD>';
  52.     }
  53.     if ($order == 'race' && !isset($_REQUEST['desc'])) {
  54.         $main_content.= '<TD CLASS=white><B><a href="?subtopic=creatures&order=race&desc=1"><font CLASS=white>Race<br/>DESC</a></B></TD></TR>';
  55.     } else {
  56.         $main_content.= '<TD CLASS=white><B><a href="?subtopic=creatures&order=race"><font CLASS=white>Race</a></B></TD></TR>';
  57.     }
  58.     foreach ($monsters as $monster) {
  59.         if (is_int($number_of_rows / 2)) {
  60.             $bgcolor = $config['site']['lightborder'];
  61.         } else {
  62.             $bgcolor = $config['site']['darkborder'];
  63.         }
  64.         $number_of_rows++;
  65.         $main_content.= '<TR BGCOLOR="' . $bgcolor . '"><TD><a href="?subtopic=creatures&creature=' . urlencode($monster['name']) . '">' . $monster['name'] . '</a></TD><TD>' . $monster['health'] . '</TD><TD>' . $monster['exp'] . '</TD>';
  66.         if ($monster['summonable']) {
  67.             $main_content.= '<TD>' . $monster['mana'] . '</TD>';
  68.         } else {
  69.             $main_content.= '<TD>---</TD>';
  70.         }
  71.         if ($monster['convinceable']) {
  72.             $main_content.= '<TD>' . $monster['mana'] . '</TD>';
  73.         } else {
  74.             $main_content.= '<TD>---</TD>';
  75.         }
  76.         $main_content.= '<TD>' . ucwords($monster['race']) . '</TD></TR>';
  77.     }
  78.     $main_content.= '</TABLE>';
  79. } else
  80. //SHOW INFORMATION ABOUT MONSTER
  81. {
  82.     $monster_name = stripslashes(trim(ucwords($_REQUEST['creature'])));
  83.     $monster = $SQL->query('SELECT * FROM ' . $SQL->tableName('z_monsters') . ' WHERE ' . $SQL->fieldName('hide_creature') . ' != 1 AND ' . $SQL->fieldName('name') . ' = ' . $SQL->quote($monster_name) . ';')->fetch();
  84.     if (isset($monster['name'])) {
  85.         $main_content.= '<center><h2>' . $monster['name'] . '</h2></center><TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%><tr><td>
  86. <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=60%>';
  87.         if (is_int($number_of_rows / 2)) {
  88.             $bgcolor = $config['site']['darkborder'];
  89.         } else {
  90.             $bgcolor = $config['site']['lightborder'];
  91.         }
  92.         $number_of_rows++;
  93.         $main_content.= '<tr BGCOLOR="' . $bgcolor . '"><td width="100"><b>Health: </b></td><td>' . $monster['health'] . '</td></tr>';
  94.         if (is_int($number_of_rows / 2)) {
  95.             $bgcolor = $config['site']['darkborder'];
  96.         } else {
  97.             $bgcolor = $config['site']['lightborder'];
  98.         }
  99.         $number_of_rows++;
  100.         $main_content.= '<tr BGCOLOR="' . $bgcolor . '"><td width="100"><b>Give<br/>Experience: </b></td><td>' . $monster['exp'] . '</td></tr>';
  101.         if (is_int($number_of_rows / 2)) {
  102.             $bgcolor = $config['site']['darkborder'];
  103.         } else {
  104.             $bgcolor = $config['site']['lightborder'];
  105.         }
  106.         $number_of_rows++;
  107.         $main_content.= '<tr BGCOLOR="' . $bgcolor . '"><td width="100"><b>Speed like: </b></td><td>' . $monster['speed_lvl'] . ' level';
  108.         if ($monster['use_haste']) {
  109.             $main_content.= ' (Can use haste)</td></tr>';
  110.         } else {
  111.             $main_content.= '</td></tr>';
  112.         }
  113.         if ($monster['summonable'] == 1) {
  114.             if (is_int($number_of_rows / 2)) {
  115.                 $bgcolor = $config['site']['darkborder'];
  116.             } else {
  117.                 $bgcolor = $config['site']['lightborder'];
  118.             }
  119.             $number_of_rows++;
  120.             $main_content.= '<tr BGCOLOR="' . $bgcolor . '"><td width="100"><b>Summon: </b></td><td>' . $monster['mana'] . ' mana</td></tr>';
  121.         } else {
  122.             if (is_int($number_of_rows / 2)) {
  123.                 $bgcolor = $config['site']['darkborder'];
  124.             } else {
  125.                 $bgcolor = $config['site']['lightborder'];
  126.             }
  127.             $number_of_rows++;
  128.             $main_content.= '<tr BGCOLOR="' . $bgcolor . '"><td width="100"><b>Summon: </b></td><td>Impossible</td></tr>';
  129.         }
  130.         if ($monster['convinceable'] == 1) {
  131.             if (is_int($number_of_rows / 2)) {
  132.                 $bgcolor = $config['site']['darkborder'];
  133.             } else {
  134.                 $bgcolor = $config['site']['lightborder'];
  135.             }
  136.             $number_of_rows++;
  137.             $main_content.= '<tr BGCOLOR="' . $bgcolor . '"><td width="100"><b>Convince: </b></td><td>' . $monster['mana'] . ' mana</td></tr>';
  138.         } else {
  139.             if (is_int($number_of_rows / 2)) {
  140.                 $bgcolor = $config['site']['darkborder'];
  141.             } else {
  142.                 $bgcolor = $config['site']['lightborder'];
  143.             }
  144.             $number_of_rows++;
  145.             $main_content.= '<tr BGCOLOR="' . $bgcolor . '"><td width="100"><b>Convince: </b></td><td>Impossible</td></tr>';
  146.         }
  147.         $main_content.= '</TABLE></td><td align=left>
  148. <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=40%>
  149. <tr><td align=left>';
  150.         if (file_exists('images/images/monsters/' . $monster['gfx_name'])) {
  151.             $main_content.= '<img src="images/monsters/' . $monster['gfx_name'] . '" height="128" width="128">';
  152.         } else {
  153.             $main_content.= '<img src="images/monsters/nophoto.png" height="128" width="128">';
  154.         }
  155.         $main_content.= '</td></tr>
  156. </TABLE></td></tr><tr><td>
  157. <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=4 WIDTH=100%>';
  158.         if (!empty($monster['immunities'])) {
  159.             if (is_int($number_of_rows / 2)) {
  160.                 $bgcolor = $config['site']['darkborder'];
  161.             } else {
  162.                 $bgcolor = $config['site']['lightborder'];
  163.             }
  164.             $number_of_rows++;
  165.             $main_content.= '<tr BGCOLOR="' . $bgcolor . '"><td width="100"><b>Immunities: </b></td><td width="100%">' . $monster['immunities'] . '</td></tr>';
  166.         }
  167.         if (!empty($monster['voices'])) {
  168.             if (is_int($number_of_rows / 2)) {
  169.                 $bgcolor = $config['site']['darkborder'];
  170.             } else {
  171.                 $bgcolor = $config['site']['lightborder'];
  172.             }
  173.             $number_of_rows++;
  174.             $main_content.= '<tr BGCOLOR="' . $bgcolor . '"><td width="100"><b>Voices: </b></td><td width="100%">' . $monster['voices'] . '</td></tr>';
  175.         }
  176.         $main_content.= '</TABLE></td></tr>
  177. </TABLE>';
  178.     } else {
  179.         $main_content.= 'Monster with name <b>' . $monster_name . '</b> doesn\'t exist.<br/></br><center><form action="?subtopic=creatures" METHOD=post><div class="BigButton" style="background-image:url(' . $layout_name . '/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url(' . $layout_name . '/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="' . $layout_name . '/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
  180.     }
  181.     //back button
  182.     $main_content.= '<br/></br><center><form action="?subtopic=creatures" METHOD=post><div class="BigButton" style="background-image:url(' . $layout_name . '/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url(' . $layout_name . '/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="' . $layout_name . '/images/buttons/_sbutton_back.gif" ></div></div></form></center>';
  183. }
  184. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement