Moving all planets

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

    • It is, but depending of number of planets you want to relocate, i mean, if you're in shared hosting, would not be performance-friendly.

      There is no automatic way unless you write a script/cronjob.
      Looking for good VPS to host your game? Use DigitalOcean and get 100$ bonus credit for 2 months!

      Check my mods here - stellaron.space/index.php?page=2Moons

      I can build any mod. Need my service? Contact me via PM
    • use this three mysqlcommands in your mysql table

      update uni1_planets set galaxy = 1;
      update uni1_users set galaxy = 1;
      update uni1_fleets set fleet_start_galaxy = 1 , fleet_end_galaxy = 1;

      if you use a modified version, take care that there are no other planet(galaxy) references. else you also have to update them.
    • mimikri wrote:

      use this three mysqlcommands in your mysql table

      update uni1_planets set galaxy = 1;
      update uni1_users set galaxy = 1;
      update uni1_fleets set fleet_start_galaxy = 1 , fleet_end_galaxy = 1;

      if you use a modified version, take care that there are no other planet(galaxy) references. else you also have to update them.
      i was thinking on planet relocation across g1 and conserve the same max number of systems. but yours shoud do it!
      Looking for good VPS to host your game? Use DigitalOcean and get 100$ bonus credit for 2 months!

      Check my mods here - stellaron.space/index.php?page=2Moons

      I can build any mod. Need my service? Contact me via PM
    • Thanks for reply!



      Qwa wrote:

      It is, but depending of number of planets you want to relocate, i mean, if you're in shared hosting, would not be performance-friendly.

      There is no automatic way unless you write a script/cronjob.
      I have server VPS.


      mimikri wrote:

      use this three mysqlcommands in your mysql table

      update uni1_planets set galaxy = 1;
      update uni1_users set galaxy = 1;
      update uni1_fleets set fleet_start_galaxy = 1 , fleet_end_galaxy = 1;

      if you use a modified version, take care that there are no other planet(galaxy) references. else you also have to update them.
      It will be a problem if I have planets in other galaxies, for example:

      2: 3: 3
      4: 3: 3 ?

      ?
    • it does not matter how many galaxys were used before,
      before making changes to the db,
      you always should do a backup of the db.
      so you can rollback within short time, if you see that it causes errors in your game.
      and you may do it at night, when there are not many people online, so it does not affect to much players if you break somthing.

      you never know, may you have an other fork of 2moons, then i could imagen other references.
    • Hey

      Here a quick script made in a few minutes, it is untested as i have no enviroment to test those type of scripts. You should not be far away with this script, if you get an error using it you can report it and i will apply a quick fix.

      Do not forget to backup database as its untested

      PS: execute this script without flying fleets

      The script depend on this variable: $allowedGalaxy = 1;

      if you set it to 2, all planets will moved accros g1 & g2

      PHP Source Code: movePlanets.php

      1. <?php
      2. define('MODE', 'JSON');
      3. define('ROOT_PATH', str_replace('\\', '/',dirname(__FILE__)).'/');
      4. set_include_path(ROOT_PATH);
      5. require 'includes/common.php';
      6. $allowedGalaxy = 1;
      7. $universe = 1;
      8. movePlanets($allowedGalaxy, $universe);
      9. $config = config::get();
      10. function movePlanets($allowedGalaxy, $universe){
      11. $sql = "SELECT * FROM %%PLANETS%% WHERE galaxy > :galaxy;";
      12. $UnauthorizedData = database::get()->select($sql, array(
      13. ':galaxy' => $allowedGalaxy
      14. ));
      15. foreach($UnauthorizedData as $Planet){
      16. $user_planet_id = $Planet['id'];
      17. $sql = "SELECT COUNT(*) as count FROM %%USERS%% WHERE id_planet != :id_planet;";
      18. $is_main_planet = database::get()->selectSingle($sql, array(
      19. ':id_planet' => $user_planet_id
      20. ), 'count');
      21. if (PlayerUtil::checkPosition($universe, $allowedGalaxy, $Planet['system'], $Planet['planet']) !== false && PlayerUtil::isPositionFree($universe, $allowedGalaxy, $Planet['system'], $Planet['planet']) !== false)
      22. {
      23. $sql = "UPDATE %%PLANETS%% SET galaxy = 1 WHERE id = :id_planet;";
      24. database::get()->update($sql, array(
      25. ':id_planet' => $user_planet_id
      26. ));
      27. $galaxy = 1;
      28. $system = $Planet['system'];
      29. $planet = $Planet['planet'];
      30. }else{
      31. $galaxy = $config->LastSettedGalaxyPos;
      32. $system = $config->LastSettedSystemPos;
      33. $planet = $config->LastSettedPlanetPos;
      34. do {
      35. $position = mt_rand(round($config->max_planets * 0.2), round($config->max_planets * 0.8));
      36. if ($planet < 3) {
      37. $planet += 1;
      38. } else {
      39. if ($system >= $config->max_system) {
      40. $system = 1;
      41. if($galaxy >= $allowedGalaxy) {
      42. $galaxy = 1;
      43. } else {
      44. $galaxy += 1;
      45. }
      46. } else {
      47. $system += 1;
      48. }
      49. }
      50. } while (PlayerUtil::isPositionFree($universe, $galaxy, $system, $position) === false);
      51. $sql = "UPDATE %%PLANETS%% SET galaxy = :galaxy, system = :system, planet = :planet WHERE id = :id_planet;";
      52. database::get()->update($sql, array(
      53. ':galaxy' => $galaxy,
      54. ':system' => $system,
      55. ':planet' => $planet,
      56. ':id_planet' => $user_planet_id
      57. ));
      58. $config->LastSettedGalaxyPos = $galaxy;
      59. $config->LastSettedSystemPos = $system;
      60. $config->LastSettedPlanetPos = $planet;
      61. }
      62. if($is_main_planet){
      63. $sql = "UPDATE %%USERS%% SET galaxy = :galaxy, system = :system, planet = :planet WHERE id_planet = :id_planet;";
      64. database::get()->update($sql, array(
      65. ':galaxy' => $galaxy,
      66. ':system' => $system,
      67. ':planet' => $planet,
      68. ':id_planet' => $user_planet_id
      69. ));
      70. }
      71. }
      72. }
      Display All
      - Xterium Template
      - War of Alliance Template
      - Antaris-Legacy Template
      - Ogame Template

      I can and will only help with instalation with hostings including cpanel or plesk and an teamviewer access

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