Hello friends~.
This mod visually improves your planet by rendering it in 3D.
Your planet is displayed relative to the sun in the center, and if there is a moon or debris field on the planet, it is intuitively indicated next to the planet.
You can also issue fleet commands immediately, and rotate, zoom in/out, and move the solar system using the mouse.
Information is displayed at the bottom when you click on a planet, moon, or debris field.
Fleet commands (transport, deploy, harvest) are also available.
See screenshot
After everything is complete, the access address is yoursite/game.php?page=myplanet3d
1.
Create ShowMyplanet3dPage.class.php.
includes/games/ShowMyplanet3dPage.class.php
Display All
2. tpl file attached
page.myplanet3d.default.tpl
templates/game/page.myplanet3d.default.tpl


This mod visually improves your planet by rendering it in 3D.
Your planet is displayed relative to the sun in the center, and if there is a moon or debris field on the planet, it is intuitively indicated next to the planet.
You can also issue fleet commands immediately, and rotate, zoom in/out, and move the solar system using the mouse.
Information is displayed at the bottom when you click on a planet, moon, or debris field.
Fleet commands (transport, deploy, harvest) are also available.
See screenshot
After everything is complete, the access address is yoursite/game.php?page=myplanet3d
1.
Create ShowMyplanet3dPage.class.php.
includes/games/ShowMyplanet3dPage.class.php
PHP Source Code
- <?php
- /**
- * 2Moons - Three.js Solar System & Planet Resource Scanner Page
- *
- * @link https://github.com/jkroepke/2Moons
- *
- * Make by noonn
- */
- class ShowMyplanet3dPage extends AbstractGamePage
- {
- public static $requireModule = 0;
- function __construct()
- {
- parent::__construct();
- }
- function show()
- {
- global $USER,$PLANET, $resource,$reslist;
- $db = Database::get();
- $order =$USER['planet_sort_order'] == 1 ? 'DESC' : 'ASC';
- $sql = "SELECT * FROM %%PLANETS%% WHERE id_owner = :userID AND destruyed = '0' AND planet_type = '1' ORDER BY ";
- switch($USER['planet_sort'])
- {
- case 2:
- $sql .= 'name '.$order;
- break;
- case 1:
- $sql .= 'galaxy '.$order.', system '.$order.', planet '.$order;
- break;
- default:
- $sql .= 'id '.$order;
- break;
- }
- $PlanetsRAW = $db->select($sql, array(
- ':userID' => $USER['id']
- ));
- $PLANETS = array();$PlanetRess = new ResourceUpdate();
- foreach ($PlanetsRAW as$CPLANET)
- {
- list($USER, $CPLANET) =$PlanetRess->CalcResource($USER,$CPLANET, true);
- $PLANETS[] =$CPLANET;
- unset($CPLANET);
- }
- $planetList = array();
- foreach($PLANETS as$Planet)
- {
- $id =$Planet['id'];
- $moonSQL = "SELECT * FROM %%PLANETS%% WHERE galaxy = :galaxy AND system = :system AND planet = :planet AND planet_type = '3' AND destruyed = '0' LIMIT 1;";
- $moonRAW = $db->selectSingle($moonSQL, array(
- ':galaxy' => $Planet['galaxy'],
- ':system' => $Planet['system'],
- ':planet' => $Planet['planet']
- ));
- $moonData = null;
- if ($moonRAW) {
- list($USER,$moonRAW) = $PlanetRess->CalcResource($USER, $moonRAW, true);
- $moonData = array(
- 'id' => $moonRAW['id'],
- 'name' => $moonRAW['name'],
- 'galaxy' => $moonRAW['galaxy'],
- 'system' => $moonRAW['system'],
- 'planet' => $moonRAW['planet'],
- 'diameter' => $moonRAW['diameter'],
- 'temp' => $moonRAW['temp_min'],
- 'tempmax' => $moonRAW['temp_max'],
- 'metal' => floor($moonRAW['metal']),
- 'crystal' => floor($moonRAW['crystal']),
- 'deuterium' => floor($moonRAW['deuterium'])
- );
- }
- $debrisSQL = "SELECT der_metal, der_crystal FROM %%PLANETS%% WHERE galaxy = :galaxy AND system = :system AND planet = :planet LIMIT 1;";
- $debrisRAW = $db->selectSingle($debrisSQL, array(
- ':galaxy' => $Planet['galaxy'],
- ':system' => $Planet['system'],
- ':planet' => $Planet['planet']
- ));
- $debrisData = null;
- if ($debrisRAW && ($debrisRAW['der_metal'] > 0 || $debrisRAW['der_crystal'] > 0)) {
- $debrisData = array(
- 'id' => $Planet['id'],
- 'galaxy' => $Planet['galaxy'],
- 'system' => $Planet['system'],
- 'planet' => $Planet['planet'],
- 'metal' => floor($debrisRAW['der_metal']),
- 'crystal' => floor($debrisRAW['der_crystal'])
- );
- }
- $planetList[$id] = array(
- 'id' => $id,
- 'name' => $Planet['name'],
- 'image' => $Planet['image'],
- 'galaxy' => $Planet['galaxy'],
- 'system' => $Planet['system'],
- 'planet' => $Planet['planet'],
- 'diameter' => $Planet['diameter'],
- 'temp' => $Planet['temp_min'],
- 'tempmax' => $Planet['temp_max'],
- 'field_curr' => $Planet['field_current'],
- 'field_max' => CalculateMaxPlanetFields($Planet),
- 'metal' => floor($Planet['metal']),
- 'crystal' => floor($Planet['crystal']),
- 'deuterium' => floor($Planet['deuterium']),
- 'moon' => $moonData,
- 'debris' => $debrisData
- );
- }
- $this->tplObj->loadscript('galaxy.js');
- $this->assign(array(
- 'jsonPlanetList' => json_encode($planetList, JSON_UNESCAPED_UNICODE),
- 'dpath' => $USER['dpath'],
- 'gal' => $PLANET['galaxy'],
- 'sys' => $PLANET['system'],
- 'pla' => $PLANET['planet'],
- ));
- $this->display('page.myplanet3d.default.tpl');
- }
- }
2. tpl file attached
page.myplanet3d.default.tpl
templates/game/page.myplanet3d.default.tpl
--------------------------------------------------------------------------------------