Missles problem

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

    • Missles problem

      Hi ;)
      I have problem with missles attack.
      I search on file, but I find nothing.

      Problem: When I want send missle attack I have allways communique: ,,The planet doesnt exist".
    • @Hike
      I don't think it's tpl file. Mayby .php file?


      Look on tpl file:


      {if $action == 'sendMissle'}
      <form action="?page=fleetMissile" method="post">
      <input type="hidden" name="galaxy" value="{$galaxy}">
      <input type="hidden" name="system" value="{$system}">
      <input type="hidden" name="planet" value="{$planet}">
      <input type="hidden" name="type" value="{$type}">
      <table style="width:654px;position:relative;top:-40px;left:0px">
      <tr>
      <th colspan="2">{$LNG.gl_missil_launch} [{$galaxy}:{$system}:{$planet}]</th>
      </tr>
      <tr>
      <td>{$missile_count} <input type="text" name="SendMI" size="2" maxlength="7"></td>
      <td>{$LNG.gl_objective}:
      {html_options name=Target options=$MissleSelector}
      </td>
      </tr>
      <tr>
      <th colspan="2" style="text-align:center"><input type="submit" value="{$LNG.gl_missil_launch_action}"></th>
      </tr>
      </table>
      </form>
      {/if}

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

    • @Hike
      I dont's see nothing wrong:


      MissionCacheMIP.php:

      PHP Source Code: MissionCacheMIP

      1. class MissionCaseMIP extends MissionFunctions
      2. {
      3. function __construct($Fleet)
      4. {
      5. $this->_fleet = $Fleet;
      6. }
      7. function TargetEvent()
      8. {
      9. global $resource, $reslist;
      10. $SQL = "";
      11. $elementIDs = array_merge($reslist['defense'], $reslist['missile']);
      12. foreach($elementIDs as $elementID)
      13. {
      14. $SQL .= PLANETS.".".$resource[$elementID].", ";
      15. }
      16. $QryTarget = "SELECT ".USERS.".lang, ".USERS.".shield_tech, ".PLANETS.".id, ".PLANETS.".name, ".PLANETS.".id_owner, ".substr($SQL, 0, -2)."
      17. FROM ".PLANETS.", ".USERS."
      18. WHERE ".PLANETS.".id = '".$this->_fleet['fleet_end_id']."' AND
      19. ".PLANETS.".id_owner = ".USERS.".id;";
      20. $targetData = $GLOBALS['DATABASE']->getFirstRow($QryTarget);
      21. if($this->_fleet['fleet_end_type'] == 3)
      22. {
      23. $targetData[$resource[502]] = $GLOBALS['DATABASE']->getFirstCell("SELECT ".$resource[502]." FROM ".PLANETS." WHERE id_luna = ".$this->_fleet['fleet_end_id'].";");
      24. }
      25. $OwnerInfo = $GLOBALS['DATABASE']->getFirstRow("SELECT lang, military_tech FROM ".USERS." WHERE id = '".$this->_fleet['fleet_owner']."';");
      26. $Target = (!in_array($this->_fleet['fleet_target_obj'], $reslist['defense']) || $this->_fleet['fleet_target_obj'] == 502 || $this->_fleet['fleet_target_obj'] == 0) ? 401 : $this->_fleet['fleet_target_obj'];
      27. $targetDefensive = array();
      28. foreach($elementIDs as $elementID)
      29. {
      30. $targetDefensive[$elementID] = $targetData[$resource[$elementID]];
      31. }
      32. unset($targetDefensive[502]);
      33. $SQL = "";
      34. $LNG = $this->getLanguage($GLOBALS['CONFIG'][$this->_fleet['fleet_universe']]['lang'], array('L18N', 'FLEET', 'TECH'));
      35. if ($targetData[$resource[502]] >= $this->_fleet['fleet_amount'])
      36. {
      37. $message = $LNG['sys_irak_no_att'];
      38. $where = $this->_fleet['fleet_end_type'] == 3 ? 'id_luna' : 'id';
      39. $SQL .= "UPDATE ".PLANETS." SET ".$resource[502]." = ".$resource[502]." - ".$this->_fleet['fleet_amount']." WHERE ".$where." = ".$targetData['id'].";";
      40. }
      41. else
      42. {
      43. if ($targetData[$resource[502]] > 0)
      44. {
      45. $where = $this->_fleet['fleet_end_type'] == 3 ? 'id_luna' : 'id';
      46. $GLOBALS['DATABASE']->query("UPDATE ".PLANETS." SET ".$resource[502]." = 0 WHERE ".$where." = ".$targetData['id'].";");
      47. }
      48. $targetDefensive = array_filter($targetDefensive);
      49. if(!empty($targetDefensive))
      50. {
      51. require_once 'calculateMIPAttack.php';
      52. $irak = calculateMIPAttack($targetData["shield_tech"], $OwnerInfo["military_tech"], $this->_fleet['fleet_amount'], $targetDefensive, $Target, $targetData[$resource[502]]);
      53. $irak = array_filter($irak);
      54. $message = sprintf($LNG['sys_irak_def'], $targetData[$resource[502]]).'<br><br>';
      55. ksort($irak, SORT_NUMERIC);
      56. foreach ($irak as $Element => $destroy)
      57. {
      58. $message .= $LNG['tech'][$Element].' (- '.$destroy.')<br>';
      59. if(in_array($Element, $reslist['one']))
      60. $SQL .= "UPDATE ".PLANETS." SET ".$resource[$Element]." = '0' WHERE id = ".$targetData['id'].";";
      61. else
      62. $SQL .= "UPDATE ".PLANETS." SET ".$resource[$Element]." = ".$resource[$Element]." - ".$destroy." WHERE id = ".$targetData['id'].";";
      63. }
      64. }
      65. else
      66. {
      67. $message = $LNG['sys_irak_no_def'];
      68. }
      69. }
      70. $UserPlanet = $GLOBALS['DATABASE']->getFirstRow("SELECT name FROM ".PLANETS." WHERE id = ".$this->_fleet['fleet_start_id'].";");
      71. $OwnerLink = $UserPlanet['name']." [".$this->_fleet['fleet_start_galaxy'].":".$this->_fleet['fleet_start_system'].":".$this->_fleet['fleet_start_planet']."]";
      72. $TargetLink = $targetData['name']." [".$this->_fleet['fleet_end_galaxy'].":".$this->_fleet['fleet_end_system'].":".$this->_fleet['fleet_end_planet']."]";
      73. $Message = sprintf($LNG['sys_irak_mess'], $this->_fleet['fleet_amount'], $OwnerLink, $TargetLink).$message;
      74. SendSimpleMessage($this->_fleet['fleet_owner'], 0, $this->_fleet['fleet_start_time'], 3, $LNG['sys_mess_tower'], $LNG['sys_irak_subject'], $Message);
      75. SendSimpleMessage($this->_fleet['fleet_target_owner'], 0, $this->_fleet['fleet_start_time'], 3, $LNG['sys_mess_tower'], $LNG['sys_irak_subject'], $Message);
      76. $SQL .= "DELETE FROM ".FLEETS." WHERE fleet_id = '".$this->_fleet['fleet_id']."';";
      77. $GLOBALS['DATABASE']->multi_query($SQL);
      78. }
      79. function EndStayEvent()
      80. {
      81. return;
      82. }
      83. function ReturnEvent()
      84. {
      85. return;
      86. }
      87. }
      Display All



      And

      ClassShowGalaxyPage.php

      PHP Source Code: ClassShowGalaxyPage.php

      1. <?php
      2. /**
      3. * 2Moons
      4. * Copyright (C) 2012 Jan Kröpke
      5. *
      6. * This program is free software: you can redistribute it and/or modify
      7. * it under the terms of the GNU General Public License as published by
      8. * the Free Software Foundation, either version 3 of the License, or
      9. * (at your option) any later version.
      10. *
      11. * This program is distributed in the hope that it will be useful,
      12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
      13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
      14. * GNU General Public License for more details.
      15. *
      16. * You should have received a copy of the GNU General Public License
      17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
      18. *
      19. * @package 2Moons
      20. * @author Jan Kröpke <info@2moons.cc>
      21. * @copyright 2012 Jan Kröpke <info@2moons.cc>
      22. * @license http://www.gnu.org/licenses/gpl.html GNU GPLv3 License
      23. * @version 1.7.3 (2013-05-19)
      24. * @info $Id: class.ShowGalaxyPage.php 2640 2013-03-23 19:23:26Z slaver7 $
      25. * @link http://2moons.cc/
      26. */
      27. require_once('includes/classes/class.FleetFunctions.php');
      28. require_once('includes/classes/class.GalaxyRows.php');
      29. class ShowGalaxyPage extends AbstractPage
      30. {
      31. public static $requireModule = MODULE_RESEARCH;
      32. function __construct()
      33. {
      34. parent::__construct();
      35. }
      36. public function show()
      37. {
      38. global $USER, $PLANET, $resource, $LNG, $reslist, $CONF;
      39. $action = HTTP::_GP('action', '');
      40. $galaxyLeft = HTTP::_GP('galaxyLeft', '');
      41. $galaxyRight = HTTP::_GP('galaxyRight', '');
      42. $systemLeft = HTTP::_GP('systemLeft', '');
      43. $systemRight = HTTP::_GP('systemRight', '');
      44. $galaxy = min(max(HTTP::_GP('galaxy', (int) $PLANET['galaxy']), 1), Config::get('max_galaxy'));
      45. $system = min(max(HTTP::_GP('system', (int) $PLANET['system']), 1), Config::get('max_system'));
      46. $planet = min(max(HTTP::_GP('planet', (int) $PLANET['planet']), 1), Config::get('max_planets'));
      47. $type = HTTP::_GP('type', 1);
      48. $current = HTTP::_GP('current', 0);
      49. if (!empty($galaxyLeft))
      50. $galaxy = max($galaxy - 1, 1);
      51. elseif (!empty($galaxyRight))
      52. $galaxy = min($galaxy + 1, Config::get('max_galaxy'));
      53. if (!empty($systemLeft))
      54. $system = max($system - 1, 1);
      55. elseif (!empty($systemRight))
      56. $system = min($system + 1, Config::get('max_system'));
      57. if ($galaxy != $PLANET['galaxy'] || $system != $PLANET['system'])
      58. {
      59. if($PLANET['deuterium'] < Config::get('deuterium_cost_galaxy'))
      60. {
      61. $this->printMessage($LNG['gl_no_deuterium_to_view_galaxy'], array("game.php?page=galaxy", 3));
      62. exit;
      63. } else {
      64. $PLANET['deuterium'] -= Config::get('deuterium_cost_galaxy');
      65. }
      66. }
      67. $targetDefensive = $reslist['defense'];
      68. $targetDefensive[] = 502;
      69. $MissleSelector[0] = $LNG['gl_all_defenses'];
      70. foreach($targetDefensive as $Element)
      71. {
      72. $MissleSelector[$Element] = $LNG['tech'][$Element];
      73. }
      74. $galaxyRows = new GalaxyRows;
      75. $galaxyRows->setGalaxy($galaxy);
      76. $galaxyRows->setSystem($system);
      77. $Result = $galaxyRows->getGalaxyData();
      78. $this->tplObj->loadscript('galaxy.js');
      79. $this->tplObj->assign_vars(array(
      80. 'GalaxyRows' => $Result,
      81. 'planetcount' => sprintf($LNG['gl_populed_planets'], count($Result)),
      82. 'action' => $action,
      83. 'galaxy' => $galaxy,
      84. 'system' => $system,
      85. 'planet' => $planet,
      86. 'type' => $type,
      87. 'current' => $current,
      88. 'maxfleetcount' => FleetFunctions::GetCurrentFleets($USER['id']),
      89. 'fleetmax' => FleetFunctions::GetMaxFleetSlots($USER),
      90. 'currentmip' => $PLANET[$resource[503]],
      91. 'recyclers' => $PLANET[$resource[209]],
      92. 'spyprobes' => $PLANET[$resource[210]],
      93. 'missile_count' => sprintf($LNG['gl_missil_to_launch'], $PLANET[$resource[503]]),
      94. 'spyShips' => array(210 => $USER['spio_anz']),
      95. 'settings_fleetactions' => $USER['settings_fleetactions'],
      96. 'current_galaxy' => $PLANET['galaxy'],
      97. 'current_system' => $PLANET['system'],
      98. 'current_planet' => $PLANET['planet'],
      99. 'planet_type' => $PLANET['planet_type'],
      100. 'max_planets' => Config::get('max_planets'),
      101. 'MissleSelector' => $MissleSelector,
      102. 'ShortStatus' => array(
      103. 'vacation' => $LNG['gl_short_vacation'],
      104. 'banned' => $LNG['gl_short_ban'],
      105. 'inactive' => $LNG['gl_short_inactive'],
      106. 'longinactive' => $LNG['gl_short_long_inactive'],
      107. 'noob' => $LNG['gl_short_newbie'],
      108. 'strong' => $LNG['gl_short_strong'],
      109. 'enemy' => $LNG['gl_short_enemy'],
      110. 'friend' => $LNG['gl_short_friend'],
      111. 'member' => $LNG['gl_short_member'],
      112. ),
      113. ));
      114. $this->display('page.galaxy.default.tpl');
      115. }
      116. }
      Display All
    • Hello there are in total or 4 errors in the missiles files, i had to fix them on my game some time ago, i guess i probably posted something about those fix on the github account :)

      Regards
    • No i dont fix anything on my github, its outdated and full of errors, i mean the official 2moons github

      Regards