Planet create

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

    • Planet create

      Hi,
      I want to when I create account give some metal/crystal/deuter mine lvl.
      I edit CreateOnePlanetRecord.php but don't work.
      Mayby someone know? It's simply I think. ?(



      PHP Source Code

      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: CreateOnePlanetRecord.php 2640 2013-03-23 19:23:26Z slaver7 $
      25. * @link http://2moons.cc/
      26. */
      27. function CreateOnePlanetRecord($Galaxy, $System, $Position, $Universe, $PlanetOwnerID, $PlanetName = '', $HomeWorld = false, $AuthLevel = 0)
      28. {
      29. global $LNG;
      30. $CONF = Config::getAll(NULL, $Universe);
      31. if (Config::get('max_galaxy') < $Galaxy || 1 > $Galaxy) {
      32. throw new Exception("Access denied for CreateOnePlanetRecord.php.<br>Try to create a planet at position:".$Galaxy.":".$System.":".$Position);
      33. }
      34. if (Config::get('max_system') < $System || 1 > $System) {
      35. throw new Exception("Access denied for CreateOnePlanetRecord.php.<br>Try to create a planet at position:".$Galaxy.":".$System.":".$Position);
      36. }
      37. if (Config::get('max_planets') < $Position || 1 > $Position) {
      38. throw new Exception("Access denied for CreateOnePlanetRecord.php.<br>Try to create a planet at position:".$Galaxy.":".$System.":".$Position);
      39. }
      40. if (CheckPlanetIfExist($Galaxy, $System, $Position, $Universe)) {
      41. return false;
      42. }
      43. $FieldFactor = Config::get('planet_factor');
      44. require('includes/PlanetData.php');
      45. $Pos = ceil($Position / (Config::get('max_planets') / count($PlanetData)));
      46. $TMax = $PlanetData[$Pos]['temp'];
      47. $TMin = $TMax - 40;
      48. $Fields = $PlanetData[$Pos]['fields'] * Config::get('planet_factor');
      49. $Types = array_keys($PlanetData[$Pos]['image']);
      50. $Type = $Types[array_rand($Types)];
      51. $Class = $Type.'planet'.($PlanetData[$Pos]['image'][$Type] < 10 ? '0' : '').$PlanetData[$Pos]['image'][$Type];
      52. $Name = !empty($PlanetName) ? $GLOBALS['DATABASE']->sql_escape($PlanetName) : $LNG['type_planet'][1];
      53. $GLOBALS['DATABASE']->query("INSERT INTO ".PLANETS." SET
      54. name = '".$Name."',
      55. universe = ".$Universe.",
      56. id_owner = ".$PlanetOwnerID.",
      57. galaxy = ".$Galaxy.",
      58. system = ".$System.",
      59. planet = ".$Position.",
      60. last_update = ".TIMESTAMP.",
      61. planet_type = '1',
      62. image = '".$Class."',
      63. diameter = ".floor(1000 * sqrt($Fields)).",
      64. field_max = ".(($HomeWorld) ? Config::get('initial_fields') : floor($Fields)).",
      65. temp_min = ".$TMin.",
      66. temp_max = ".$TMax.",
      67. metal = ".Config::get('metal_start').",
      68. metal_perhour = ".Config::get('metal_basic_income').",
      69. crystal = ".Config::get('crystal_start').",
      70. crystal_perhour = ".Config::get('crystal_basic_income').",
      71. deuterium = ".Config::get('deuterium_start').",
      72. deuterium_perhour = ".Config::get('deuterium_basic_income').";");
      73. return $GLOBALS['DATABASE']->GetInsertID();
      74. }
      Display All
    • Indeed just adding sql queries like hike says in the playerutilclass file