[MOD] Finds Debris

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

    • [MOD] Finds Debris

      Hi
      My english is no good.

      2Moons 1.8 to 2.0 available.
      This is a mod for finding Debris Field.
      Ranked by metal or crystal size.

      A screenshot is attached.
      I hope this helps a lot.


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

      PHP Source Code: ShowDebrisearchPage.class.php

      1. <?php
      2. class ShowDebrisearchPage extends AbstractGamePage
      3. {
      4. public static $requireModule = 0;
      5. function __construct()
      6. {
      7. parent::__construct();
      8. }
      9. function show()
      10. {
      11. global $USER, $PLANET, $LNG ;
      12. $edit = HTTP::_GP('edit', '');
      13. $db = Database::get();
      14. /* ###### Activate to show only admin. #######
      15. if($USER['authlevel'] != 3){
      16. $this->printMessage("This is an invalid page.", array(array(
      17. 'label' => "Back",
      18. 'url' => 'game.php?page=overview'
      19. )));
      20. }
      21. */
      22. switch($edit)
      23. {
      24. default:
      25. $sql = "SELECT der_metal, der_crystal, galaxy, system, planet FROM %%PLANETS%% WHERE universe = :uni ORDER BY (der_metal + (der_crystal * 2)) DESC LIMIT 150;";
      26. $search = $db->select($sql, array(
      27. ':uni' => Universe::current()
      28. ));
      29. break;
      30. case 'met':
      31. $sql = "SELECT der_metal, der_crystal, galaxy, system, planet FROM %%PLANETS%% WHERE universe = :uni ORDER BY der_metal DESC LIMIT 150;";
      32. $search = $db->select($sql, array(
      33. ':uni' => Universe::current()
      34. ));
      35. break;
      36. case 'cry':
      37. $sql = "SELECT der_metal, der_crystal, galaxy, system, planet FROM %%PLANETS%% WHERE universe = :uni ORDER BY der_crystal DESC LIMIT 150;";
      38. $search = $db->select($sql, array(
      39. ':uni' => Universe::current()
      40. ));
      41. break;
      42. }
      43. $SearchResult = array();
      44. $i = 1;
      45. foreach($search as $s)
      46. {
      47. $SearchResult[] = array(
      48. 'rank' => $i,
      49. 'der_metal' => number_format($s['der_metal']),
      50. 'der_crystal' => number_format($s['der_crystal']),
      51. 'galaxy1' => $s['galaxy'],
      52. 'system1' => $s['system'],
      53. 'planet1' => $s['planet'],
      54. );
      55. $i++;
      56. }
      57. $this->assign(array(
      58. 'SearchResult' => $SearchResult,
      59. ));
      60. $this->display('page.debriSearch.tpl');
      61. }
      62. }
      Display All



      2. Create a templates file.

      templates\game\page.debriSearch.tpl

      Source Code: page.debriSearch.tpl

      1. {block name="title" prepend}{$LNG.lm_banned}{/block}
      2. {block name="content"}
      3. <style>
      4. .fontsize12{
      5. font-size:1.2em;
      6. }
      7. </style>
      8. <div class="content_page">
      9. <div class="title">
      10. Debri Status
      11. </div>
      12. <table width="100%" border="0" cellpadding="0" cellspacing="1">
      13. <tr>
      14. <th colspan="4" style="text-align:center;background-color:transparent;height:30px;color:#fff;font-weight:700;font-size:14px">Debris Zone Ranking(1 ~ 150)</th>
      15. </tr>
      16. <tr style="color:green">
      17. <td colspan="4" style="height:25px" class="fontsize12">Choice->
      18. <a href="game.php?page=debrisearch" class="fontsize12">【Metal + Crystal】</a>
      19. <a href="game.php?page=debrisearch&edit=met" class="fontsize12">【Metal】</a>
      20. <a href="game.php?page=debrisearch&edit=cry" class="fontsize12">【Crystal】</a>
      21. </td>
      22. </tr>
      23. <tr class="title" >
      24. <th height="27px" class="fontsize12">No.</th>
      25. <th class="fontsize12">Coordinate</th>
      26. <th class="fontsize12">Metal</th>
      27. <th class="fontsize12">Crystal</th>
      28. </tr>
      29. {foreach item=SearchInfo from=$SearchResult}
      30. <tr>
      31. <td class="fontsize12">{$SearchInfo.rank}</td>
      32. <td style="height:27px;" class="fontsize12">
      33. <a href="game.php?page=galaxy&galaxy={$SearchInfo.galaxy1}&system={$SearchInfo.system1}">[{$SearchInfo.galaxy1}:{$SearchInfo.system1}:{$SearchInfo.planet1}]</a></td>
      34. <td class="fontsize12">{$SearchInfo.der_metal}</td>
      35. <td class="fontsize12">{$SearchInfo.der_crystal}</td>
      36. </tr>
      37. {/foreach}
      38. </table>
      39. </div>
      40. {/block}
      Display All

      3. Add link.
      <a href="game.php?page=debrisearch">Debris field</a>

      Thanks. ^^
      Images
      • debri.JPG

        89.46 kB, 912×766, viewed 187 times
      --------------------------------------------------------------------------------------

      The post was edited 1 time, last by noonn ().