Advertisement
Flip

Untitled

Sep 24th, 2014
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.60 KB | None | 0 0
  1. <?
  2.     $race = array(
  3.         0 => "Any",
  4.         1 => "Human",
  5.         2 => "Elf",
  6.         3 => "Oroc",
  7.         4 => "Goblin",
  8.         5 => "Gnome",
  9.         6 => "Half-elf",
  10.         7 => "Felpuur",
  11.         8 => "Undead",
  12.         9 => "Construct",
  13.         10 => "Dwarf",
  14.         11 => "Angel",
  15.         12 => "Orc",
  16.         13 => "Merfolk",
  17.         14 => "Magical Being"
  18.     );
  19.     $role = array(
  20.         0 => "Any",
  21.         1 => "Tank",
  22.         2 => "Melee",
  23.         3 => "Ranged",
  24.         4 => "Healer",
  25.         5 => "Special"
  26.     );
  27.     $source = array(
  28.         0 => "Any",
  29.         1 => "Strength",
  30.         2 => "Agility",
  31.         3 => "Intellect",
  32.         4 => "Wisdom",
  33.         5 => "Special"
  34.     );
  35.     $t = $_POST['t'];
  36.     try {
  37.         $db = new PDO('sqlite:dotd.db3');
  38.         if ($t == "helmet") { $q = "SELECT * FROM equipment WHERE equipType = 3 ORDER BY ID DESC"; }
  39.         else if ($t == "chest") { $q = "SELECT * FROM equipment WHERE equipType = 4 ORDER BY ID DESC"; }
  40.         else if ($t == "pant") { $q = "SELECT * FROM equipment WHERE equipType = 6 ORDER BY ID DESC"; }
  41.         else if ($t == "boot") { $q = "SELECT * FROM equipment WHERE equipType = 7 ORDER BY ID DESC"; }
  42.         else if ($t == "glove") { $q = "SELECT * FROM equipment WHERE equipType = 5 ORDER BY ID DESC"; }
  43.         else if ($t == "mh") { $q = "SELECT * FROM equipment WHERE equipType = 1 ORDER BY ID DESC"; }
  44.         else if ($t == "oh") { $q = "SELECT * FROM equipment WHERE equipType = 2 OR equipType = 9 ORDER BY ID DESC"; }
  45.         else if ($t == "ring") { $q = "SELECT * FROM equipment WHERE equipType = 8 ORDER BY ID DESC"; }
  46.         else if ($t == "neck") { $q = "SELECT * FROM equipment WHERE equipType = 10 ORDER BY ID DESC"; }
  47.         else { $q = "SELECT * FROM ".$t." ORDER BY ID DESC"; }
  48.         $r = $db->query($q);
  49.         $x = 0;
  50.         while($row = $r->fetch(PDO::FETCH_NAMED)) {
  51.             $x++;
  52.             $c = ($x % 2 == 0 ? "even" : "odd");
  53.             if ($t == "general" || $t == "troop") {
  54.                 echo "<tr class=\"".$c."\"><td class=\"nowrap\"><a href=\"http://dotd.wikia.com/wiki/".$row['name']."\">".$row['name']."</a></td>";
  55.                 echo "<td class=\"nowrap\">Attack: ".$row['attack']."<br />Defense: ".$row['defense']."</td>";
  56.                 echo "<td class=\"nowrap\">".$race[$row['race']]."/".$role[$row['role']]."/".$source[$row['source']]."</td>";
  57.                 echo "<td>".$row['proc_desc']."</td><td>".($row['lore'] ? '<a href="#" onclick="toggle('.$row['id'].');return false">[Lore]</a>' : '')."</td></tr>";
  58.                 echo "<tr class=\"".$c." lore\" id=\"".$row['id']."\"><td colspan=\"100%\">".$row['lore']."</td></tr>";
  59.             }
  60.             else if ($t == "magic" || $t == "consumable") {
  61.                 echo "<tr class=\"".$c."\"><td class=\"nowrap\"><a href=\"http://dotd.wikia.com/wiki/".$row['name']."\">".$row['name']."</a></td>";
  62.                 echo "<td>".$row['proc_desc']."</td><td>".($row['lore'] ? '<a href="#" onclick="toggle('.$row['id'].');return false">[Lore]</a>' : '')."</td></tr>";
  63.                 echo "<tr class=\"".$c." lore\" id=\"".$row['id']."\"><td colspan=\"100%\">".$row['lore']."</td></tr>";
  64.             }
  65.             else if ($t == "legion") {
  66.                 echo "<tr class=\"".$c."\"><td class=\"nowrap\"><a href=\"http://dotd.wikia.com/wiki/".$row['name']."\">".$row['name']."</a></td>";
  67.                 echo "<td class=\"nowrap\">Generals: ".$row['num_gen']."<br />Troops: ".$row['num_trp']."</td>";
  68.                 echo "<td class=\"nowrap\">Bonus: ".$row['bonus']."%".($row['bonusSpecial'] == 0 ? '' : '<br />'.$row['bonusText'].'')."</td>";
  69.                 echo "<td>".$row['proc_desc']."</td><td>".($row['lore'] ? '<a href="#" onclick="toggle('.$row['id'].');return false">[Lore]</a>' : '')."</td></tr>";
  70.                 echo "<tr class=\"".$c." lore\" id=\"".$row['id']."\"><td colspan=\"100%\">".$row['lore']."</td></tr>";
  71.             }
  72.             else {
  73.                 echo "<tr class=\"".$c."\"><td class=\"nowrap\"><a href=\"http://dotd.wikia.com/wiki/".$row['name']."\">".$row['name']."</a></td>";
  74.                 echo "<td class=\"nowrap\">Attack: ".$row['attack']."<br />Defense: ".$row['defense']."".($row['perception'] == 0 ? '' : '<br />Perception: '.$row['perception'].'')."</td>";
  75.                 echo "<td class=\"nowrap\">".($row['unq'] == 0 ? '' : '[Unique]<br />').($row['eng'] == 0 ? '' : 'Energy: '.$row['eng'].'<br />').($row['sta'] == 0 ? '' : 'Stamina: '.$row['sta'].'<br />').($row['hnr'] == 0 ? '' : 'Honor: '.$row['hnr'].'<br />').($row['hlt'] == 0 ? '' : 'Health: '.$row['hlt'].'<br />').($row['atk'] == 0 ? '' : 'Attack: '.$row['atk'].'<br />').($row['def'] == 0 ? '' : 'Defense: '.$row['def'].'<br />').($row['power'] == 0 ? '' : 'Power: '.$row['power'])."</td>";
  76.                 echo "<td>".$row['proc_desc']."</td><td>".($row['lore'] ? '<a href="#" onclick="toggle('.$row['id'].');return false">[Lore]</a>' : '')."</td></tr>";
  77.                 echo "<tr class=\"".$c." lore\" id=\"".$row['id']."\"><td colspan=\"100%\">".$row['lore']."</td></tr>";
  78.             }
  79.         }
  80.         $db = null;
  81.     } catch (PDOException $e) {
  82.         echo "Error: ".$e->getMessage()."<br/>";
  83.         die();
  84.     }
  85. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement