[MOD] Dot Map of Galaxy

    This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

    • [MOD] Dot Map of Galaxy

      Hi
      My english is no good.

      This mod is a galaxy dot map.
      The distribution of planets in each galaxy can be easily identified.
      A screenshot is attached.
      I hope this helps a lot. ^^




      1. Create a file.
      includes/game/ShowDotmapPage.class.php

      PHP Source Code: ShowDotmapPage.class.php

      1. <?php
      2. class ShowDotmapPage extends AbstractGamePage
      3. {
      4. public static $requireModule = 0;
      5. function __construct()
      6. {
      7. parent::__construct();
      8. $this->setWindow('popup');
      9. $this->initTemplate();
      10. }
      11. function show()
      12. {
      13. global $USER, $LNG, $PLANET;
      14. $galaxy = HTTP::_GP('galaxy', '');
      15. $db = Database::get();
      16. $config = Config::get();
      17. $galaxyList = array();
      18. if(!empty($galaxy) && $galaxy == 1 || $galaxy == 2 || $galaxy == 3 || $galaxy == 4 || $galaxy == 5 || $galaxy == 6 || $galaxy == 7 || $galaxy == 8 || $galaxy == 9)
      19. {
      20. $sql = "SELECT * FROM %%PLANETS%% WHERE galaxy = :galaxy AND universe = :universe AND planet_type = '1' ORDER BY system DESC, planet DESC;" ;
      21. $Resulta = $db->select($sql, array(
      22. ':universe' => Universe::current(),
      23. ':galaxy' => $galaxy
      24. ));
      25. foreach ($Resulta as $Row)
      26. {
      27. $galaxyList[$Row['system']][$Row['planet']] = 1;
      28. }
      29. $col = $config->max_system + 1;
      30. echo "<div style=float:left;margin-left:-140px>
      31. <table border=1px>
      32. <tr><td colspan=$col><h2>Dot map of Galaxy $galaxy </h2></td></tr>
      33. <tr><td></td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td><td>6</td><td>7</td>
      34. <td>8</td><td>9</td><td>10</td><td>11</td><td>12</td><td>13</td><td>14</td><td>15</td></tr>";
      35. for ($y = 1; $y <= $config->max_system; $y++) {
      36. echo "<tr><td>$y</td>";
      37. for ($x = 1; $x <= $config->max_planets; $x++) {
      38. if(isset($galaxyList[$y][$x])){
      39. echo "<td class='tooltip' data-tooltip-content=$galaxy:$y:$x><img src=styles/theme/gow/img/map.png></td>";
      40. }else{
      41. echo "<td><img src=styles/theme/gow/img/map1.png></td>";
      42. }
      43. }
      44. "</tr>";
      45. }
      46. echo "<table></div>";
      47. } //if end
      48. $this->assign(array(
      49. 'galaxyList' => $galaxyList,
      50. ));
      51. $this->display('page.dotmap.default.tpl');
      52. }
      53. }
      Display All


      2. Create a templates file.

      page.dotmap.default.tpl


      Source Code

      1. {block name="title" prepend}{$LNG.lm_banned}{/block}
      2. {block name="content"}
      3. <style>
      4. td{
      5. width:20px;
      6. font-size:1.3em;
      7. line-height:1.6em;
      8. }
      9. img{
      10. width:20px;
      11. height:20px;
      12. }
      13. </style>
      14. {/block}
      Display All


      3. Add it to the desired location in the page.galaxy.default file.
      <a href="game.php?page=dotmap&galaxy={$galaxy}" onclick="return Dialog.open(this.href, 520, 600);" href="#">DotMap of Galaxy {$galaxy}</a>

      4. The map.png and map1.png files are attached.

      Thanks. ^^
      Images
      • 01.JPG

        113.17 kB, 932×673, viewed 303 times
      • 02.png

        219.29 kB, 846×877, viewed 312 times
      Files
      • DotmapImage.zip

        (655 Byte, downloaded 139 times, last: )
      --------------------------------------------------------------------------------------

      The post was edited 2 times, last by noonn ().

    • looks great but i get errors

      class ShowDotmapPage extends AbstractGamePage { public static $requireModule = 0; function __construct() { parent::__construct(); $this->setWindow('popup'); $this->initTemplate(); } function show() { global $USER, $LNG, $PLANET; $galaxy = HTTP::_GP('galaxy', ''); $db = Database::get(); $config = Config::get(); $galaxyList = array(); if(!empty($galaxy) && $galaxy == 1 || $galaxy == 2 || $galaxy == 3 || $galaxy == 4 || $galaxy == 5 || $galaxy == 6 || $galaxy == 7 || $galaxy == 8 || $galaxy == 9) { $sql = "SELECT * FROM %%PLANETS%% WHERE galaxy = :galaxy AND universe = :universe AND planet_type = '1' ORDER BY system DESC, planet DESC;" ; $Resulta = $db->select($sql, array( ':universe' => Universe::current(), ':galaxy' => $galaxy )); foreach ($Resulta as $Row) { $galaxyList[$Row['system']][$Row['planet']] = 1; } $col = $config->max_system + 1; echo ""; for ($y = 1; $y <= $config->max_system; $y++) { echo ""; for ($x = 1; $x <= $config->max_planets; $x++) { if(isset($galaxyList[$y][$x])){ echo ""; }else{ echo ""; } } ""; } echo "


      sign(array( 'galaxyList' => $galaxyList, )); $this->display('page.dotmap.default.tpl'); } }

      USER ERROR
      Message: Class 'ShowDotmapPage' not found
      File: /game.php
      Line: 43
      URL: rifts.ca/game.php?page=dotmap&galaxy=1
      PHP-Version: 7.4.32
      PHP-API: cgi-fcgi
      Version: 2.8.1
      Debug Backtrace:
      #0 {main}

      disregard... fixed php file was missing "<?php" in the beginning
    • Russoll wrote:

      looks great but i get errors

      ..........
      Versions from 1.8 to 2.0 are available.
      The sauce is simple, so please take a look.
      The key is the foreach ($Resulta as $Row) part.
      Maybe this part is the problem.
      You can do it.
      :thumbup:
      --------------------------------------------------------------------------------------
    • Russoll wrote:

      its good works perfect. the beginning of the php file was missing <?php added it and works. also changed the alignment from -140px to 12px and its perfect

      Added <?php code.

      Very well done.
      Thank you for liking this mod.
      Have a nice day ^^

      :D
      --------------------------------------------------------------------------------------