Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. function getRocket()
  2. {
  3. global $conn;
  4. global $assetRepo;
  5.  
  6. $rocket = [];
  7. $rocket_name = json_decode(file_get_contents('https://raw.githubusercontent.com/whitewillem/PMSF/develop/static/data/grunttype.json'), true);
  8.  
  9. $sql = "SELECT latitude, longitude, name, image, UNIX_TIMESTAMP(CONVERT_TZ(incident_expiration, '+00:00', @@global.time_zone)) as stop, UNIX_TIMESTAMP(CONVERT_TZ(last_modified, '+00:00', @@global.time_zone)) as scanned, UNIX_TIMESTAMP(CONVERT_TZ(incident_start, '+00:00', @@global.time_zone)) as start, incident_grunt_type as type FROM pokestop WHERE name IS NOT NULL and incident_expiration > utc_timestamp() ORDER BY scanned desc;";
  10.  
  11. $result = $conn->query($sql);
  12.  
  13. // Check if mon available
  14. if ($result && $result->num_rows > 0) {
  15. while ($row = $result->fetch_object()) {
  16.  
  17. $row->rgender = $rocket_name[$row->type]['grunt'];
  18. $row->rtype = $rocket_name[$row->type]['type'];
  19.  
  20. $row->onefirst = $rocket_name[$row->type]['encounters']['first'];
  21. $row->onesecond = $rocket_name[$row->type]['encounters']['second'];
  22. $row->onethird = $rocket_name[$row->type]['encounters']['third'];
  23.  
  24. if (is_array($row->onefirst) || is_array($row->onesecond) || is_array($row->onethird)) {
  25. foreach ($row->onefirst as $row->first) {
  26. $row->rockfirst = $assetRepo . 'pokemon_icon_' . $row->first . '.png<br>';
  27. }
  28. foreach ($row->onesecond as $row->second) {
  29. $row->rocksecond = $assetRepo . 'pokemon_icon_' . $row->second . '.png<br>';
  30. }
  31. foreach ($row->onethird as $row->third) {
  32. $row->rockthird = $assetRepo . 'pokemon_icon_' . $row->third . '.png<br>';
  33. }
  34. }
  35. $rocket[] = $row;
  36. }
  37. return $rocket;
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement