SHARE
TWEET

Untitled

a guest Nov 8th, 2019 92 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. global $clock;
  3. global $conn;
  4. global $assetRepo;
  5. global $mapkey;
  6. $mon_name = json_decode(file_get_contents('https://raw.githubusercontent.com/cecpk/OSM-Rocketmap/master/static/data/pokemon.json'), true);
  7. $dex = json_decode(file_get_contents('https://raw.githubusercontent.com/KartulUdus/Professor-Poracle/master/src/util/description.json'), true);
  8. $stats = json_decode(file_get_contents('https://raw.githubusercontent.com/KartulUdus/Professor-Poracle/master/src/util/monsters.json'), true);
  9.  
  10. if(isset($_GET['pokemon'])){
  11. $pokemon = $_GET['pokemon'];
  12. if(empty($pokemon) || !is_numeric($pokemon) || $pokemon < 1 && $pokemon > 809 ){echo 'NO VALID/EMPTY ID';} else {
  13.  
  14. if(isset($_GET['form'])){$form=$_GET['form'];} else {$form='0';}
  15. if(!empty($stats[$pokemon. '_' . $form]['form']['name'])){
  16. $formname = $stats[$pokemon. '_' . $form]['form']['name'];} else {
  17.     $formname = 'Unknown form';
  18. }
  19.  
  20. $totalquery = $conn->query("select count(*) as total from pokemon");
  21. $totalrow = $totalquery->fetch_assoc();
  22. $totalquery->close();
  23.  
  24. if(!isset($_GET['form'])){
  25. $monquery = $conn->query("select pokemon_id as pid, (select count(pokemon_id) from pokemon where pokemon_id=" . $pokemon . " and form=0) as count, UNIX_TIMESTAMP(CONVERT_TZ(last_modified, '+00:00', @@global.time_zone)) as last_seen, latitude, longitude from pokemon where pokemon_id=" . $pokemon . " order by last_seen desc limit 1");
  26. $monrow = $monquery->fetch_assoc();
  27. $monquery->close();
  28. $monname = $mon_name[$pokemon]['name'];
  29.  
  30. $raidmonquery = $conn->query("select pokemon_id as pid, (select count(pokemon_id) from raid where pokemon_id=" . $pokemon . " and form=0) as count, UNIX_TIMESTAMP(CONVERT_TZ(last_scanned, '+00:00', @@global.time_zone)) as last_seen from raid where pokemon_id=" . $pokemon . " order by last_seen desc limit 1");
  31. $raidmonrow = $raidmonquery->fetch_assoc();
  32. $raidmonquery->close();
  33. $raidmonname = $mon_name[$pokemon]['name'];
  34. } else {
  35.     $monquery = $conn->query("select pokemon_id as pid, (select count(pokemon_id) from pokemon where pokemon_id=" . $pokemon . " and form=" . $form . ") as count, UNIX_TIMESTAMP(CONVERT_TZ(last_modified, '+00:00', @@global.time_zone)) as last_seen, latitude, longitude from pokemon where pokemon_id=" . $pokemon . " and form=" . $form . " order by last_seen desc limit 1");
  36.     $monrow = $monquery->fetch_assoc();
  37.     $monquery->close();
  38.     $monname = $mon_name[$pokemon]['name'] . ' (' . $formname . ')';
  39.    
  40.     $raidmonquery = $conn->query("select pokemon_id as pid, (select count(pokemon_id) from raid where pokemon_id=" . $pokemon . " and form=" . $form . ") as count, UNIX_TIMESTAMP(CONVERT_TZ(last_scanned, '+00:00', @@global.time_zone)) as last_seen from raid where pokemon_id=" . $pokemon . " order by last_seen desc limit 1");
  41.     $raidmonrow = $raidmonquery->fetch_assoc();
  42.     $raidmonquery->close();
  43.     $raidmonname = $mon_name[$pokemon]['name'] . ' (' . $formname . ')';
  44.     }
  45.  
  46. $monseen = $monrow['count'];
  47. $raidmonseen = $raidmonrow['count'];
  48. $total = $totalrow['total'];
  49. $spawnrate = number_format((($monseen / $total)*100), 2, '.', '');
  50. $lat = $monrow['latitude'];
  51. $lon = $monrow['longitude'];
  52. $last = $monrow['last_seen'];
  53. $raidlast = $raidmonrow['last_seen'];
  54.  
  55. if($monseen>0){
  56. $rarity = 'Common';
  57.  
  58. switch ($rarity) {
  59.     case $spawnrate == 0.00:
  60.     $rarity = 'New Spawn';
  61.         break;
  62.     case $spawnrate < 0.01:
  63.     $rarity = 'Ultra Rare';
  64.         break;
  65.     case $spawnrate < 0.03:
  66.     $rarity = 'Very Rare';
  67.         break;
  68.     case $spawnrate < 0.5:
  69.     $rarity = 'Rare';
  70.         break;
  71.     case $spawnrate < 0.1:
  72.     $rarity = 'Uncommon';
  73.         break;
  74. }
  75. } else {
  76.     $rarity = 'New Spawn';
  77. }
  78.  
  79. if(!$monrow || empty($monrow)){$monseen='0';$last='-';} else {$last = date('l jS \of F Y ' . $clock, $last);}
  80. if(!$raidmonrow || empty($raidmonrow)){$raidmonseen='0';$raidlast='-';} else {$raidlast = date('l jS \of F Y ' . $clock, $raidlast);}
  81.  
  82. $img = $assetRepo . 'pokemon_icon_' . str_pad($pokemon, 3, 0, STR_PAD_LEFT) . '_' . str_pad($form, 2, 0, STR_PAD_LEFT) . '.png';
  83.  
  84. // Perform check because of missing 719 - 807 in json
  85. if($pokemon < 808){
  86. if(empty($dex[$pokemon-1]['description'])){$desc='No description available';} else { $desc = $dex[$pokemon-1]['description']; }
  87. if(empty($stats[str_pad($pokemon, 1, 0, STR_PAD_LEFT) . '_' . str_pad($form, 1, 0, STR_PAD_LEFT)]['types'][0]['name'])){$type1='Unknown type(s)';} else { $type1 = $stats[str_pad($pokemon, 1, 0, STR_PAD_LEFT) . '_' . str_pad($form, 1, 0, STR_PAD_LEFT)]['types'][0]['emoji']. $stats[str_pad($pokemon, 1, 0, STR_PAD_LEFT) . '_' . str_pad($form, 1, 0, STR_PAD_LEFT)]['types'][0]['name']; }
  88. if(empty($stats[str_pad($pokemon, 1, 0, STR_PAD_LEFT) . '_' . str_pad($form, 1, 0, STR_PAD_LEFT)]['types'][1]['name'])){$type2='';} else { $type2 = ' / ' . $stats[str_pad($pokemon, 1, 0, STR_PAD_LEFT) . '_' . str_pad($form, 1, 0, STR_PAD_LEFT)]['types'][1]['emoji'] . $stats[str_pad($pokemon, 1, 0, STR_PAD_LEFT) . '_' . str_pad($form, 1, 0, STR_PAD_LEFT)]['types'][1]['name']; }
  89. } else {
  90.     if(empty($dex[$pokemon-90]['description'])){$desc='No description available';} else { $desc = $dex[$pokemon-90]['description']; }
  91. if(empty($dex[$pokemon-90]['types'][0])){$type1='Unknown type(s)';} else { $type1 = ucfirst($dex[$pokemon-90]['types'][0]); }
  92. if(empty($dex[$pokemon-90]['types'][1])){$type2='';} else { $type2 = ' / '. ucfirst($dex[$pokemon-90]['types'][1]); }
  93. }
  94.  
  95. // Replace mon image with placeholder sprite if image is not in assets yet
  96. if(!file_exists($img)){
  97.     $img='https://raw.githubusercontent.com/ZeChrales/PogoAssets/master/pokemon_icons/pokemon_icon_000.png';
  98.     }
  99. ?>
  100.  
  101. <div class="container">
  102. <div class="jumbotron-fluid">
  103.   <h4 class="display-6"><img src="<?= $img?>" class="dexmon"> <b><?= $monname?></b></h4>
  104.   <p class="lead"><?= $desc?></p>
  105.   <p class="lead"><b><?=$type1 . $type2?></b></p>
  106.   <hr class="my-4">
  107.  
  108. <h4 class="display-6">Recently seen</h4>
  109. <p class="lead">
  110. Wild: <span class="badge badge-secondary"><?= $monseen?></span> times<br>
  111. Raids: <span class="badge badge-secondary"><?= $raidmonseen?></span> times<br>
  112. Recently wild: <?= $last?><br>
  113. Recently in raids: <?=$raidlast?><br>
  114. Rarity: <?= $rarity?><br>
  115. Spawnrate: <?= $spawnrate?>%
  116. <hr class="my-4">
  117. <h4 class="display-6">Forms</h4>
  118. <?php
  119. $data = file_get_contents('https://raw.githubusercontent.com/KartulUdus/Professor-Poracle/master/src/util/monsters.json');
  120. $json = json_decode($data);?>
  121. <div class="table-responsive-sm">
  122. <table id="formTable" class="table table-striped table-bordered w-auto">
  123.   <thead>
  124.     <tr>
  125.       <th>Pic</th>
  126.       <th>Form</th>
  127.       <th>Pokedex</th>
  128.     </tr>
  129.   </thead>
  130.   <tbody>
  131. <?php foreach($json as $entry) if ($entry->id == $pokemon && $entry->form->name !== 'Shadow' && $entry->form->name !== 'Purified'){
  132.     if (empty($entry->form->name)){$formtext='No form'; $link = 'index.php?page=seen&pokemon=' . $pokemon;} else {$formtext = $entry->form->name;$link = 'index.php?page=seen&pokemon=' . $pokemon . '&form=' . $entry->form->id;}
  133.     if ($entry->form->id != $form){?>
  134.     <tr align='center' style='align-content:center;text-align:center;'>
  135.       <td class="align-middle"><img src='images/pokemon/pokemon_icon_<?=str_pad($entry->id, 3, 0, STR_PAD_LEFT)?>_<?=str_pad($entry->form->id, 2, 0, STR_PAD_LEFT)?>.png' height='96' width='96'></td>
  136.       <td class="align-middle"><?=$formtext?></td>
  137.       <td class="align-middle"><a href="<?=$link?>">Link</a></td>
  138.     </tr>
  139.     <?php }}?>
  140.   </tbody>
  141. </table>
  142. </div>
  143.  
  144. <hr class="my-4">
  145. <h4 class="display-6">Evolutions</h4>
  146. <?php
  147. $data = file_get_contents('https://raw.githubusercontent.com/KartulUdus/Professor-Poracle/master/src/util/description.json');
  148. $json = json_decode($data);
  149. $i=0;?>
  150.  
  151. <div class="table-responsive-sm">
  152. <table id="evoTable" class="table table-striped table-bordered w-auto">
  153.   <thead>
  154.     <tr>
  155.       <th>Evolution</th>
  156.       <th>Pokedex</th>
  157.     </tr>
  158.   </thead>
  159.   <tbody>
  160.   <?php
  161.   foreach($json as $entry) if($entry->pkdx_id == $pokemon){
  162.       if (!$entry->evolutions){break;}
  163.       ?>
  164.       <tr>
  165.   <td><?=$entry->evolutions[$i]->to?></td>
  166.   <td></td>
  167.   </tr>
  168.   <?php $i++;
  169.   }?>
  170.   </tbody>
  171.   </table>
  172.   </div>
  173.  
  174. <hr class="my-4">
  175. <?php if(!empty($mapkey)){
  176.     if($monseen>0){?>
  177. <h4 class="display-6">Location last seen</h4>
  178. <a href="https://maps.google.com/?q=<?=$lat. ',' .$lon?>"><img src="https://open.mapquestapi.com/staticmap/v5/map?locations=<?=$lat. ',' .$lon?>&key=<?=$mapkey?>&zoom=15&size=250,200" style="border: 1px solid grey;" class="minimap"></a><br>
  179. <hr class="my-4">
  180.     <?php }}?>
  181. <i class="fas fa-arrow-circle-left"></i> <a href="index.php?page=pokedex"> Return</a>
  182. </p>
  183. </div>
  184. </div>
  185.  
  186. <?php }} else {echo 'NO ID GIVEN';}?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top