Mod resource bonus

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

    • Mod resource bonus

      here I spread the mode of endless purchases of bonus resources, it is compatible with the versions 1,7,3 1,8-1,9 :D
    • for 1.7

      create a file
      class.ShowResPage.php

      PHP Source Code: class.ShowResPage.php

      1. <?php
      2. class ShowResPage extends AbstractPage
      3. {
      4. function __construct()
      5. {
      6. global $USER;
      7. parent::__construct();
      8. }
      9. function show()
      10. {
      11. global $USER ,$LNG,$PLANET;
      12. $modo = HTTP::_GP('modo', '', UTF8_SUPPORT);
      13. $id = HTTP::_GP('id',0);
      14. if($USER['darkmatter'] <= 10000) {
      15. $resto = 10000 - $USER['darkmatter'];
      16. $this->printMessage("No, no! You do not have enough dark matter to do business with me! Come back when you have. ".$resto." unit dark matter!");
      17. exit;
      18. }elseif($modo == "ricevi"){
      19. $USER['darkmatter'] -= 10000;
      20. $PLANET['metal'] += 50000000;
      21. $PLANET['deuterium'] += 20000000;
      22. $PLANET['crystal'] += 35000000;
      23. $this->printMessage("The Agreement with Graferex was successfull you recieve: <br><li>Metal: 50.000.000</li>
      24. <li>Crystal: 35.000.000</li>
      25. <li>Deuterium: 20.000.000</li>", true, array("game.php?page=res", 3));
      26. }else{
      27. $this->tplObj->assign_vars(array(
      28. 'USERNAME'=> $USER['username'],
      29. ));
      30. $this->display('res.tpl');
      31. }
      32. }
      33. private function redirectToHome()
      34. {
      35. $this->redirectTo('game.php?page=res');
      36. }
      37. }
      Display All
      then create a file
      res.tpl

      Smarty-Template: res.tpl

      1. {block name="title" prepend}Res{/block}
      2. {block name="content"}
      3. <table style="width:650px">
      4. <tbody><tr>
      5. <th colspan="2">
      6. Resource Pack
      7. </th>
      8. </tr><tr>
      9. <td><img src="styles/theme/gow/img/mercado.png" width="650px" height="298px"></td></tr>
      10. <td style="text-align:left;">
      11. Hello Emperor <font color="lime"><b>{$USERNAME}</b></font>! Today is your lucky day! I introduce myself, I am far orgini Graferex a merchant in exchange for Dark Matter I can offer you huge amounts of resources, want to buy something? <br><br>For <b><font color=red>10.000</font></b> units of dark matter you can buy:<br>
      12. <br>
      13. <center><li>Metal: <font color=red>50.000.000</font></li>
      14. <li>Crystal: <font color=red>35.000.000</font></li>
      15. <li>Deuterium: <font color=red>20.000.000</font></li>
      16. <ul>
      17. </ul></center>
      18. </td>
      19. </tr>
      20. <tr>
      21. <td colspan="2">
      22. <form action="game.php?page=res&modo=ricevi" method="POST">
      23. <input type="submit" class="buttona" name="risorse" value="Buy Resources">
      24. </form>
      25. </td>
      26. </tr>
      27. </tbody><th colspan="1" style="text-align:center"></table>{/block}
      Display All
      then
      main.navigation.tpl

      Smarty-Template: main.navigation.tpl

      1. <li><a href="game.php?page=res"style="color:lime">Buy Resources</a></li>
      and script
      jquery.countdown.js

      JavaScript Source Code: jquery.coundown.js

      1. /* jQuery countdown plugin
      2. * version 1.0 (12/01/2008)
      3. * developed by Alessandro Feijdz?
      4. * alef@feijo.pro.br
      5. * format_interval fn based on drupal homonym function
      6. */
      7. (function($) {
      8. var vInt=0; // this variable controls the loop
      9. var refresh=1; // refresh when a time finish
      10. var interval=1000; // the loop interval
      11. // this function autostarts the infinite loop, every second, triggers the countdown fn
      12. jQuery.autocountdown = function () {
      13. $('.countdown2').countdown2(); // trigger the fn
      14. vInt=setInterval("$('.countdown2').countdown2();", interval); // set the loop
      15. }
      16. // countdown function, update second-by-second the time to finish
      17. jQuery.fn.countdown2 = function (options) {
      18. var defaults = { // set up default options
      19. refresh: 1, // refresh when a time finish
      20. interval: 1000, // the loop interval
      21. cdClass: 'countdown2', // the class to apply this plugin
      22. granularity: 4,
      23. label: ['w ', 'd ', 'h', 'm:', ''],
      24. units: [604800, 86400, 3600, 60, 1]
      25. };
      26. if (options && options.label) {
      27. $.extend(defaults.label, options.label);
      28. delete options.label;
      29. }
      30. if (options && options.units) {
      31. $.extend(defaults.units, options.units);
      32. delete options.units;
      33. }
      34. $.extend(defaults, options);
      35. // pad fn, add left zeros to the string
      36. var pad = function (value, length) {
      37. value = String(value);
      38. length = parseInt(length) || 2;
      39. while (value.length < length)
      40. value = "0" + value;
      41. if (value<1) value = "00";
      42. return value;
      43. };
      44. var format_interval = function (timestamp) {
      45. var label = defaults.label;
      46. var units = defaults.units;
      47. var granularity = defaults.granularity;
      48. output = '';
      49. for (i=1; i<=units.length; i++) {
      50. value=units[i];
      51. if (timestamp >= value) {
      52. var val=pad(Math.floor(timestamp / value), 2);
      53. val = val>0 ? val : '00';
      54. output += val + label[i];
      55. timestamp %= value;
      56. granularity--;
      57. }
      58. else if (value==1) output += '00'; // we need the final seconds to allways show 00, i.e., 03:00
      59. if (granularity == 0)
      60. break;
      61. }
      62. if (output.length<3) output = '00:'+output;
      63. return output ? output : '00:00';
      64. }
      65. // the countdown core
      66. return this.each(function() {
      67. secs=$(this).attr('secs');
      68. $(this).html(format_interval(secs));
      69. secs--;
      70. if (secs<1) {
      71. $(this).attr('secs', '...');
      72. clearInterval(vInt);
      73. if (refresh)
      74. window.location.href = window.location.href;
      75. } else
      76. $(this).attr('secs', secs);
      77. });
      78. }
      79. $.autocountdown(); // loop
      80. })(jQuery);
      Display All
    • for 1.8-1,9


      create a file
      ShowResPage.class.php

      PHP Source Code

      1. <?php
      2. class ShowResPage extends AbstractGamePage
      3. {
      4. function __construct()
      5. {
      6. global $USER;
      7. parent::__construct();
      8. }
      9. function show()
      10. {
      11. global $USER ,$LNG,$PLANET;
      12. $modo = HTTP::_GP('modo', '', UTF8_SUPPORT);
      13. $id = HTTP::_GP('id',0);
      14. if($USER['darkmatter'] <= 10000) {
      15. $resto = 10000 - $USER['darkmatter'];
      16. $this->printMessage("No, no! You do not have enough dark matter to do business with me! Come back when you have. ".$resto." unit dark matter!");
      17. exit;
      18. }elseif($modo == "ricevi"){
      19. $USER['darkmatter'] -= 10000;
      20. $PLANET['metal'] += 50000000;
      21. $PLANET['deuterium'] += 20000000;
      22. $PLANET['crystal'] += 35000000;
      23. $this->printMessage("The Agreement with Graferex was successfull you recieve: <br><li>Metal: 50.000.000</li>
      24. <li>Crystal: 35.000.000</li>
      25. <li>Deuterium: 20.000.000</li>", true, array("game.php?page=res", 3));
      26. }else{
      27. $this->tplObj->assign_vars(array(
      28. 'USERNAME'=> $USER['username'],
      29. ));
      30. $this->display('res.tpl');
      31. }
      32. }
      33. private function redirectToHome()
      34. {
      35. $this->redirectTo('game.php?page=res');
      36. }
      37. }
      Display All




      then create a file

      Source Code

      1. res.tpl
      2. {block name="title" prepend}Res{/block}
      3. {block name="content"}
      4. <table style="width:650px">
      5. <tbody><tr>
      6. <th colspan="2">
      7. Resource Pack
      8. </th>
      9. </tr><tr>
      10. <td><img src="styles/theme/gow/img/mercado.png" width="650px" height="298px"></td></tr>
      11. <td style="text-align:left;">
      12. Hello Emperor <font color="lime"><b>{$USERNAME}</b></font>! Today is your lucky day! I introduce myself, I am far orgini Graferex a merchant in exchange for Dark Matter I can offer you huge amounts of resources, want to buy something? <br><br>For <b><font color=red>10.000</font></b> units of dark matter you can buy:<br>
      13. <br>
      14. <center><li>Metal: <font color=red>50.000.000</font></li>
      15. <li>Crystal: <font color=red>35.000.000</font></li>
      16. <li>Deuterium: <font color=red>20.000.000</font></li>
      17. <ul>
      18. </ul></center>
      19. </td>
      20. </tr>
      21. <tr>
      22. <td colspan="2">
      23. <form action="game.php?page=res&modo=ricevi" method="POST">
      24. <input type="submit" class="buttona" name="risorse" value="Buy Resources">
      25. </form>
      26. </td>
      27. </tr>
      28. </tbody><th colspan="1" style="text-align:center"></table>{/block}
      29. then
      30. main.navigation.tpl
      31. <li><a href="game.php?page=res"style="color:lime">Buy Resources</a></li>
      32. and script
      33. jquery.countdown.js
      34. /* jQuery countdown plugin
      35. * version 1.0 (12/01/2008)
      36. * developed by Alessandro Feijdz?
      37. * alef@feijo.pro.br
      38. * format_interval fn based on drupal homonym function
      39. */
      40. (function($) {
      41. var vInt=0; // this variable controls the loop
      42. var refresh=1; // refresh when a time finish
      43. var interval=1000; // the loop interval
      44. // this function autostarts the infinite loop, every second, triggers the countdown fn
      45. jQuery.autocountdown = function () {
      46. $('.countdown2').countdown2(); // trigger the fn
      47. vInt=setInterval("$('.countdown2').countdown2();", interval); // set the loop
      48. }
      49. // countdown function, update second-by-second the time to finish
      50. jQuery.fn.countdown2 = function (options) {
      51. var defaults = { // set up default options
      52. refresh: 1, // refresh when a time finish
      53. interval: 1000, // the loop interval
      54. cdClass: 'countdown2', // the class to apply this plugin
      55. granularity: 4,
      56. label: ['w ', 'd ', 'h', 'm:', ''],
      57. units: [604800, 86400, 3600, 60, 1]
      58. };
      59. if (options && options.label) {
      60. $.extend(defaults.label, options.label);
      61. delete options.label;
      62. }
      63. if (options && options.units) {
      64. $.extend(defaults.units, options.units);
      65. delete options.units;
      66. }
      67. $.extend(defaults, options);
      68. // pad fn, add left zeros to the string
      69. var pad = function (value, length) {
      70. value = String(value);
      71. length = parseInt(length) 2;
      72. while (value.length < length)
      73. value = "0" + value;
      74. if (value<1) value = "00";
      75. return value;
      76. };
      77. var format_interval = function (timestamp) {
      78. var label = defaults.label;
      79. var units = defaults.units;
      80. var granularity = defaults.granularity;
      81. output = '';
      82. for (i=1; i<=units.length; i++) {
      83. value=units;
      84. if (timestamp >= value) {
      85. var val=pad(Math.floor(timestamp / value), 2);
      86. val = val>0 ? val : '00';
      87. output += val + label[i];
      88. timestamp %= value;
      89. granularity--;
      90. }
      91. else if (value==1) output += '00'; // we need the final seconds to allways show 00, i.e., 03:00
      92. if (granularity == 0)
      93. break;
      94. }
      95. if (output.length<3) output = '00:'+output;
      96. return output ? output : '00:00';
      97. }
      98. // the countdown core
      99. return this.each(function() {
      100. secs=$(this).attr('secs');
      101. $(this).html(format_interval(secs));
      102. secs--;
      103. if (secs<1) {
      104. $(this).attr('secs', '...');
      105. clearInterval(vInt);
      106. if (refresh)
      107. window.location.href = window.location.href;
      108. } else
      109. $(this).attr('secs', secs);
      110. });
      111. }
      112. $.autocountdown(); // loop
      113. })(jQuery);
      Display All