[MOD] build queue acceleration for 1.8 ver.

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

    • [MOD] build queue acceleration for 1.8 ver.

      1. build queue acceleration for darkmatter

      [Blocked Image: https://clip2net.com/clip/m500486/00e97-clip-71kb.jpg]

      Display Spoiler

      in \includes\pages\game\ShowBuildingsPage.class.php

      before

      PHP Source Code: ShowBuildingsPage.class.php

      1. public function show()
      add

      PHP Source Code: ShowBuildingsPage.class.php

      1. private function FastBuildingFromQueue()
      2. {
      3. global $PLANET, $USER, $resource;
      4. $CurrentQueue = unserialize($PLANET['b_building_id']);
      5. if (empty($CurrentQueue)){
      6. $PLANET['b_building_id'] = '';
      7. $PLANET['b_building'] = 0;
      8. return;
      9. }
      10. $Element = $CurrentQueue[0][0];
      11. $BuildMode = $CurrentQueue[0][4];
      12. $fast = $resource[$Element];
      13. if ($PLANET['planet_type']==3){
      14. $NeededDm = (1000*(($PLANET['b_building']-TIMESTAMP)/3600));
      15. }else{
      16. $NeededDm = (200*(($PLANET['b_building']-TIMESTAMP)/3600));
      17. }
      18. if($NeededDm < 10)
      19. $NeededDm=10;
      20. if ($USER['darkmatter'] >= $NeededDm){
      21. $USER['darkmatter'] -= $NeededDm;
      22. if ($BuildMode == 'destroy'){
      23. $PLANET['field_current'] -=1;
      24. $PLANET[$resource[$Element]] -= 1;
      25. $sql = "UPDATE %%PLANETS%% SET ".$fast." = ".$fast." - 1 WHERE id = :planetId;";
      26. }
      27. else{
      28. $PLANET['field_current'] +=1;
      29. $PLANET[$resource[$Element]] += 1;
      30. $sql = "UPDATE %%PLANETS%% SET ".$fast." = ".$fast." + 1 WHERE id = :planetId;";
      31. }
      32. Database::get()->update($sql, array(':planetId' => $PLANET['id']));
      33. array_shift($CurrentQueue);
      34. if (count($CurrentQueue) == 0) {
      35. $PLANET['b_building'] = 0;
      36. $PLANET['b_building_id'] = '';
      37. }else{
      38. $BuildEndTime = TIMESTAMP;
      39. $NewQueueArray = array();
      40. foreach($CurrentQueue as $ListIDArray) {
      41. if($Element == $ListIDArray[0])
      42. continue;
      43. $BuildEndTime += BuildFunctions::getBuildingTime($USER, $PLANET, $ListIDArray[0], NULL, $ListIDArray[4] == 'destroy');
      44. $ListIDArray[3] = $BuildEndTime;
      45. $NewQueueArray[] = $ListIDArray;
      46. }
      47. if(!empty($NewQueueArray)) {
      48. $PLANET['b_building'] = TIMESTAMP;
      49. $PLANET['b_building_id'] = serialize($NewQueueArray);
      50. $this->ecoObj->setData($USER, $PLANET);
      51. $this->ecoObj->SetNextQueueElementOnTop();
      52. list($USER, $PLANET) = $this->ecoObj->getData();
      53. }else{
      54. $PLANET['b_building'] = 0;
      55. $PLANET['b_building_id'] = '';
      56. }
      57. }
      58. return true;
      59. }
      60. }
      Display All
      after

      PHP Source Code: ShowBuildingsPage.class.php

      1. case 'destroy':
      2. $this->AddBuildingToQueue($Element, false);
      3. break;
      add

      PHP Source Code: ShowBuildingsPage.class.php

      1. case 'fast':
      2. $this->FastBuildingFromQueue();
      3. break;



      before

      PHP Source Code: ShowBuildingsPage.class.php

      1. $this->assign(array(
      2. 'BuildInfoList' => $BuildInfoList,
      add

      PHP Source Code: ShowBuildingsPage.class.php

      1. if ($PLANET['planet_type']==3){
      2. $dm_fast = floor(1000*($PLANET['b_building']-TIMESTAMP)/3600);
      3. }
      4. else{
      5. $dm_fast = floor(200*($PLANET['b_building']-TIMESTAMP)/3600);
      6. }



      after

      PHP Source Code: ShowBuildingsPage.class.php

      1. $this->assign(array(
      2. 'BuildInfoList' => $BuildInfoList,
      3. 'CanBuildElement' => $CanBuildElement,
      4. 'RoomIsOk' => $RoomIsOk,
      5. 'Queue' => $Queue,
      add

      PHP Source Code: ShowBuildingsPage.class.php

      1. 'need_dm' => $dm_fast,
      in \styles\templates\game\page.buildings.default.tpl
      after

      HTML Source Code: page.buildings.default.tpl

      1. <form action="game.php?page=buildings" method="post" class="build_form">
      2. <input type="hidden" name="cmd" value="cancel">
      3. <button type="submit" class="build_submit onlist">{$LNG.bd_cancel}</button>
      4. </form>

      add

      HTML Source Code: page.buildings.default.tpl

      1. <form action="game.php?page=buildings" method="post" class="build_form">
      2. <input type="hidden" name="cmd" value="fast">
      3. <button type="submit" class="build_submit onlist tooltip" data-tooltip-content="{$LNG.cost} : {if $need_dm<10}{10}{else}{($need_dm)}{/if} {$LNG.dm}">{$LNG.acceleration}</button>
      4. </form>



      in your lang INGAME.php

      add

      PHP Source Code: INGAME.php

      1. $LNG['dm'] = 'ТМ';
      2. $LNG['acceleration'] = 'ускорение';
      3. $LNG['cost'] = 'Цена';


      Good luck :thumbsup: [tt][spoiler][/spoiler][/tt]

      The post was edited 6 times, last by Kaizoku ().

    • Hello there

      I've edited the codes all ok but the fast finish button doesn't stop interacting when it doesn't stop

      prntscr.com/n9s531

      Do you give me a quick finish button Show BuildingsPage.class.php versem did not work? DM?
    • enesvtn
      Уберите xterium картинки смотри Антон увидит :) а то что Вы спрашиваете есть в стандартных сборках под проект 2moons-xterium на ветке 1.7 выдрать не сложно по коду