[MOD] Planet image change

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

    • [MOD] Planet image change

      Hi
      My english is no good. ^^

      2Moons 1.8 to 2.0 available.
      This mode allows you to change the image of the selected planet.
      If there is a planet icon on the right, it will change as well.

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


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

      PHP Source Code: ShowEditimgPage.class

      1. <?php
      2. class ShowEditimgPage 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. $skdata = HTTP::_GP('sk', '');
      13. $db = Database::get();
      14. switch($skdata){
      15. case'change':
      16. $planetimage = HTTP::_GP('planetimage', '');
      17. $sql = "UPDATE %%PLANETS%% SET image = :pimg WHERE id = :planetID ;";
      18. $db->update($sql, array(
      19. ':planetID' => $PLANET['id'],
      20. ':pimg' => $planetimage
      21. ));
      22. $this->printMessage("<span style=font-size:1.2em;color:#58FA58>The image of the current planet has been changed.</span>", array(array(
      23. 'label' => "<font class=submit0>Move</font>",
      24. 'url' => 'game.php?page=editimg'
      25. )));
      26. }
      27. $this->assign(array(
      28. 'm1' => 1,
      29. ));
      30. $this->display('page.editimg.tpl');
      31. }
      32. }
      Display All

      2. Create a tpl file.
      templates/game/page.editimg.tpl

      HTML Source Code: page.editimg.tpl

      1. {block name="title" prepend}{$LNG.lm_statistics}{/block}
      2. {block name="content"}
      3. <style>
      4. </style>
      5. <div class="content_page">
      6. <div class="title fontsize12">
      7. Planet image change
      8. </div>
      9. <div style="text-align:center;line-height:1.5em;font-size:1.2em;color: #5ca6aa;background: #091d2e;padding:5px 0 0 0;">
      10. This mode allows you to change the image of the selected planet.
      11. </div>
      12. <form action="game.php?page=editimg&sk=change" method="post">
      13. <table style="width:100%">
      14. <tr class="title">
      15. <td colspan="4" style="font-size:1.3em;height:30px;">Choice</td>
      16. </tr>
      17. <tr>
      18. <td><img src="{$dpath}planeten/small/s_trockenplanet01.gif" width="50"> <input type="radio" name="planetimage" value="trockenplanet01"></td>
      19. <td><img src="{$dpath}planeten/small/s_trockenplanet02.gif" width="50"> <input type="radio" name="planetimage" value="trockenplanet02"></td>
      20. <td><img src="{$dpath}planeten/small/s_trockenplanet03.gif" width="50"> <input type="radio" name="planetimage" value="trockenplanet03"></td>
      21. <td><img src="{$dpath}planeten/small/s_trockenplanet04.gif" width="50"> <input type="radio" name="planetimage" value="trockenplanet04"></td>
      22. </tr>
      23. <tr>
      24. <td><img src="{$dpath}planeten/small/s_trockenplanet05.gif" width="50"> <input type="radio" name="planetimage" value="trockenplanet05"></td>
      25. <td><img src="{$dpath}planeten/small/s_trockenplanet06.gif" width="50"> <input type="radio" name="planetimage" value="trockenplanet06"></td>
      26. <td><img src="{$dpath}planeten/small/s_trockenplanet07.gif" width="50"> <input type="radio" name="planetimage" value="trockenplanet07"></td>
      27. <td><img src="{$dpath}planeten/small/s_trockenplanet08.gif" width="50"> <input type="radio" name="planetimage" value="trockenplanet08" ></td>
      28. </tr>
      29. <tr>
      30. <td><img src="{$dpath}planeten/small/s_trockenplanet09.gif" width="50"> <input type="radio" name="planetimage" value="trockenplanet09"></td>
      31. <td><img src="{$dpath}planeten/small/s_trockenplanet10.gif" width="50"> <input type="radio" name="planetimage" value="trockenplanet10"></td>
      32. <td><img src="{$dpath}planeten/small/s_dschjungelplanet01.gif" width="50"> <input type="radio" name="planetimage" value="dschjungelplanet01"></td>
      33. <td><img src="{$dpath}planeten/small/s_dschjungelplanet02.gif" width="50"> <input type="radio" name="planetimage" value="dschjungelplanet02"></td>
      34. </tr>
      35. <tr>
      36. <td><img src="{$dpath}planeten/small/s_dschjungelplanet03.gif" width="50"> <input type="radio" name="planetimage" value="dschjungelplanet03"></td>
      37. <td><img src="{$dpath}planeten/small/s_dschjungelplanet04.gif" width="50"> <input type="radio" name="planetimage" value="dschjungelplanet04"></td>
      38. <td><img src="{$dpath}planeten/small/s_dschjungelplanet05.gif" width="50"> <input type="radio" name="planetimage" value="dschjungelplanet05"></td>
      39. <td><img src="{$dpath}planeten/small/s_dschjungelplanet06.gif" width="50"> <input type="radio" name="planetimage" value="dschjungelplanet06"></td>
      40. </tr>
      41. <tr>
      42. <td><img src="{$dpath}planeten/small/s_dschjungelplanet07.gif" width="50"> <input type="radio" name="planetimage" value="dschjungelplanet07"></td>
      43. <td><img src="{$dpath}planeten/small/s_dschjungelplanet08.gif" width="50"> <input type="radio" name="planetimage" value="dschjungelplanet08"></td>
      44. <td><img src="{$dpath}planeten/small/s_dschjungelplanet09.gif" width="50"> <input type="radio" name="planetimage" value="dschjungelplanet09"></td>
      45. <td><img src="{$dpath}planeten/small/s_dschjungelplanet10.gif" width="50"> <input type="radio" name="planetimage" value="dschjungelplanet10"></td>
      46. </tr>
      47. <tr>
      48. <td><img src="{$dpath}planeten/small/s_eisplanet01.gif" width="50"> <input type="radio" name="planetimage" value="eisplanet01"></td>
      49. <td><img src="{$dpath}planeten/small/s_eisplanet02.gif" width="50"> <input type="radio" name="planetimage" value="eisplanet02"></td>
      50. <td><img src="{$dpath}planeten/small/s_eisplanet03.gif" width="50"> <input type="radio" name="planetimage" value="eisplanet03"></td>
      51. <td><img src="{$dpath}planeten/small/s_eisplanet04.gif" width="50"> <input type="radio" name="planetimage" value="eisplanet04"></td>
      52. </tr>
      53. <tr>
      54. <td><img src="{$dpath}planeten/small/s_eisplanet05.gif" width="50"> <input type="radio" name="planetimage" value="eisplanet05"></td>
      55. <td><img src="{$dpath}planeten/small/s_eisplanet06.gif" width="50"> <input type="radio" name="planetimage" value="eisplanet06"></td>
      56. <td><img src="{$dpath}planeten/small/s_eisplanet07.gif" width="50"> <input type="radio" name="planetimage" value="eisplanet07"></td>
      57. <td><img src="{$dpath}planeten/small/s_eisplanet08.gif" width="50"> <input type="radio" name="planetimage" value="eisplanet08"></td>
      58. </tr>
      59. <tr>
      60. <td><img src="{$dpath}planeten/small/s_eisplanet09.gif" width="50"> <input type="radio" name="planetimage" value="eisplanet09"></td>
      61. <td><img src="{$dpath}planeten/small/s_eisplanet10.gif" width="50"> <input type="radio" name="planetimage" value="eisplanet10"></td>
      62. <td><img src="{$dpath}planeten/small/s_wasserplanet01.gif" width="50"> <input type="radio" name="planetimage" value="wasserplanet01"></td>
      63. <td><img src="{$dpath}planeten/small/s_wasserplanet02.gif" width="50"> <input type="radio" name="planetimage" value="wasserplanet02"></td>
      64. </tr>
      65. <tr>
      66. <td><img src="{$dpath}planeten/small/s_wasserplanet03.gif" width="50"> <input type="radio" name="planetimage" value="wasserplanet03"></td>
      67. <td><img src="{$dpath}planeten/small/s_wasserplanet04.gif" width="50"> <input type="radio" name="planetimage" value="wasserplanet04"></td>
      68. <td><img src="{$dpath}planeten/small/s_wasserplanet05.gif" width="50"> <input type="radio" name="planetimage" value="wasserplanet05"></td>
      69. <td><img src="{$dpath}planeten/small/s_wasserplanet06.gif" width="50"> <input type="radio" name="planetimage" value="wasserplanet06"></td>
      70. </tr>
      71. <tr>
      72. <td><img src="{$dpath}planeten/small/s_wasserplanet07.gif" width="50"> <input type="radio" name="planetimage" value="wasserplanet07"></td>
      73. <td><img src="{$dpath}planeten/small/s_wasserplanet08.gif" width="50"> <input type="radio" name="planetimage" value="wasserplanet08"></td>
      74. <td><img src="{$dpath}planeten/small/s_wasserplanet09.gif" width="50"> <input type="radio" name="planetimage" value="wasserplanet09"></td>
      75. <td><img src="{$dpath}planeten/small/s_normaltempplanet01.gif" width="50"> <input type="radio" name="planetimage" value="normaltempplanet01"></td>
      76. </tr>
      77. <tr>
      78. <td><img src="{$dpath}planeten/small/s_normaltempplanet02.gif" width="50"> <input type="radio" name="planetimage" value="normaltempplanet02"></td>
      79. <td><img src="{$dpath}planeten/small/s_normaltempplanet03.gif" width="50"> <input type="radio" name="planetimage" value="normaltempplanet03"></td>
      80. <td><img src="{$dpath}planeten/small/s_normaltempplanet04.gif" width="50"> <input type="radio" name="planetimage" value="normaltempplanet04"></td>
      81. <td><img src="{$dpath}planeten/small/s_normaltempplanet05.gif" width="50"> <input type="radio" name="planetimage" value="normaltempplanet05"></td>
      82. </tr>
      83. <tr>
      84. <td><img src="{$dpath}planeten/small/s_normaltempplanet06.gif" width="50"> <input type="radio" name="planetimage" value="normaltempplanet06"></td>
      85. <td><img src="{$dpath}planeten/small/s_normaltempplanet07.gif" width="50"> <input type="radio" name="planetimage" value="normaltempplanet07"></td>
      86. <td><img src="{$dpath}planeten/small/s_wuestenplanet01.gif" width="50"> <input type="radio" name="planetimage" value="wuestenplanet01"></td>
      87. <td><img src="{$dpath}planeten/small/s_wuestenplanet02.gif" width="50"> <input type="radio" name="planetimage" value="wuestenplanet02"></td>
      88. </tr>
      89. <tr>
      90. <td><img src="{$dpath}planeten/small/s_wuestenplanet03.gif" width="50"> <input type="radio" name="planetimage" value="wuestenplanet03"></td>
      91. <td><img src="{$dpath}planeten/small/s_wuestenplanet04.gif" width="50"> <input type="radio" name="planetimage" value="wuestenplanet04"></td>
      92. </tr>
      93. <tr>
      94. <td> </td><td> </td><td colspan="2"><input type="submit" value="Change image"><br><br><br><br></td><td> </td><td> </td>
      95. </tr>
      96. </table>
      97. </form>
      98. </div>
      99. {/block}
      Display All

      3. Open the file
      templates/game/page.galaxy.default

      Find line
      .
      .
      <img src="{$dpath}planeten/small/s_{$currentPlanet.planet.image}.jpg" height="30" width="30" alt="">
      .
      .
      img line change ( jpg->gif )
      <img src="{$dpath}planeten/small/s_{$currentPlanet.planet.image}.gif" height="30" width="30" alt="">


      4. Add link.
      <a href="game.php?page=editimg">Planet image</a>

      Thanks.
      Images
      • planetimg.JPG

        131.69 kB, 1,147×688, viewed 175 times
      • planetimg2.JPG

        77.07 kB, 731×832, viewed 231 times
      --------------------------------------------------------------------------------------