but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ // include game definitions, path url and so on include 'config.script.php'; $PLANETS_PER_QUADRANT = 25; // 09/05/08 AC: Increased number of generated planets include $game_path . 'include/sql.php'; include $game_path . 'include/global.php'; include $game_path . 'include/functions.php'; include $game_path . 'include/libs/world.php'; $game = new game(); $db = new sql($config['server'] . ":" . $config['port'], $config['game_database'], $config['user'], $config['password']); // create sql-object for db-connection for ($i = 0; $i < $PLANETS_PER_QUADRANT; $i++) { create_planet(0, 'quadrant', 1); } for ($i = 0; $i < $PLANETS_PER_QUADRANT; $i++) { create_planet(0, 'quadrant', 2); } for ($i = 0; $i < $PLANETS_PER_QUADRANT; $i++) { create_planet(0, 'quadrant', 3); } for ($i = 0; $i < $PLANETS_PER_QUADRANT; $i++) { create_planet(0, 'quadrant', 4); } echo $PLANETS_PER_QUADRANT;
public function Install($log = INSTALL_LOG_FILE_NPC) { // We don't use the global variable here since this function can be called also // by the installation script. $environment = $this->db->queryrow('SELECT * FROM config LIMIT 0 , 1'); $ACTUAL_TICK = $environment['tick_id']; $this->sdl->start_job('Ramona basic system', $log); // First of all retrieve the BOT quick storage table if (!($Bot_exe = $this->db->query('SELECT * FROM FHB_Bot LIMIT 0,1'))) { // Create the table if does not exists $sql = "CREATE TABLE IF NOT EXISTS `FHB_Bot` (\n `id` int(2) NOT NULL AUTO_INCREMENT,\n `user_id` mediumint(8) unsigned NOT NULL DEFAULT '0',\n `user_name` varchar(32) NOT NULL DEFAULT '',\n `user_tick` int(10) NOT NULL DEFAULT '0',\n `user_race` tinyint(3) NOT NULL DEFAULT '0',\n `user_loginname` varchar(32) NOT NULL DEFAULT '',\n `planet_id` mediumint(8) unsigned NOT NULL DEFAULT '0',\n `ship_t_1` int(10) NOT NULL DEFAULT '0',\n `ship_t_2` int(10) NOT NULL DEFAULT '0',\n `bot_tick` int(11) NOT NULL DEFAULT '0',\n PRIMARY KEY (`id`)\n ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1"; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> cannot create FHB_bot table - ABORTED', $log); return; } // Should work now $Bot_exe = $this->db->query('SELECT * FROM FHB_Bot LIMIT 0,1'); } // Check if the BOT exists $num_bot = $this->db->num_rows($Bot_exe); if ($num_bot < 1) { $sql = 'INSERT INTO FHB_Bot (user_id,user_name,user_tick,user_race,user_loginname,planet_id,ship_t_1,ship_t_2) VALUES ("0","","0","0","","0","0","0")'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> cannot insert FHB_bot data - ABORTED', $log); return; } } // So now we should have valid data $this->bot = $this->db->queryrow('SELECT * FROM FHB_Bot LIMIT 0,1'); // Check whether the bot already lives if ($this->bot['user_id'] == 0) { $sql = 'INSERT INTO user (user_id, user_active, user_name, user_loginname, user_password, user_email, user_auth_level, user_race, user_gfxpath, user_skinpath, user_registration_time, user_registration_ip, user_birthday, user_gender, plz, country,user_enable_sig,user_message_sig, user_signature, user_notepad, user_options, message_basement) VALUES (' . FERENGI_USERID . ',1, "Quark(NPC)", "Bot", "' . md5("bundu") . '", "*****@*****.**", ' . STGC_BOT . ', 5, "' . DEFAULT_GFX_PATH . '", "skin1/", ' . time() . ', "100.0.0.1", "20.04.2007", "w", 76149 , "DE",1,"<br><br><p><b>I.A. of the Ferengi Trade Guild</b></p>", "I live in the computing centre Karlsruhe - so now however conclusion with merry","","","")'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> could not create Ramona - ABORTED', $log); return; } $this->sdl->log('Ramona is created', $log); // Update BOT card $sql = 'UPDATE FHB_Bot SET user_id="' . FERENGI_USERID . '", user_name="Quark(NPC)", user_tick="' . $ACTUAL_TICK . '", user_loginname="Bot", user_race="5" WHERE id="' . $this->bot['id'] . '"'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> could not update Ramona ID card - ABORTED', $log); return; } // Avoid a DB query $this->bot['user_id'] = FERENGI_USERID; } // Check whether the bot has a planet if ($this->bot['planet_id'] == 0) { $this->sdl->log('<b>Ramona needs a new body</b>', $log); while ($this->bot['planet_id'] == 0 or $this->bot['planet_id'] == 'empty') { $this->sdl->log('New planet', $log); $this->db->lock('starsystems_slots'); $this->bot['planet_id'] = create_planet($this->bot['user_id'], 'quadrant', 4); $this->db->unlock(); if ($this->bot['planet_id'] == 0) { $this->sdl->log('<b>Error:</b> could not create Ramona\'s planet - ABORTED', $log); return; } $sql = 'UPDATE user SET user_points = "400", user_planets = "1", last_active = "4294967295", user_attack_protection = "' . ($ACTUAL_TICK + 1500) . '", user_capital = "' . $this->bot['planet_id'] . '", active_planet = "' . $this->bot['planet_id'] . '" WHERE user_id = "' . $this->bot['user_id'] . '"'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> Could not update Ramona\'s attack protection info - CONTINUED', $log); } // Bot gets better values for her body, she should always looks good $this->sdl->log('Better values for the Planet', $log); $sql = 'UPDATE planets SET planet_points = 500,building_1 = 9,building_2 = 9,building_3 = 9, building_4 = 9,building_5 = 9,building_6 = 9,building_7 = 9,building_8 = 9, building_9 = 9,building_10 = 9,building_11 = 9,building_12 = 9,building_13 = 9, unit_1 = 2000,unit_2 = 2000,unit_3 = 2000,unit_4 = 500,unit_5 = 500,unit_6=500, planet_name = "Dealer Base", research_1 = 9,research_2 = 9,research_3 = 9,research_4 = 9,research_5 = 9, workermine_1 = 1600,workermine_2 = 1600,workermine_3 = 1600,resource_4 = 4000 WHERE planet_owner = ' . $this->bot['user_id'] . ' and planet_id=' . $this->bot['planet_id']; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> Could not improve Ramona\'s planet - CONTINUED', $log); } $sql = 'UPDATE FHB_Bot SET planet_id=' . $this->bot['planet_id'] . ' WHERE user_id = ' . $this->bot['user_id']; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> could not update Ramona ID card with planet info - CONTINUED', $log); } } } // Check whether the ship already has templates $reloading = 0; if ($this->bot['ship_t_1'] == 0) { $sql = 'INSERT INTO ship_templates (owner, timestamp, name, description, race, ship_torso, ship_class, component_1, component_2, component_3, component_4, component_5, component_6, component_7, component_8, component_9, component_10, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, value_9, value_10, value_11, value_12, value_13, value_14, value_15, resource_1, resource_2, resource_3, resource_4, unit_5, unit_6, min_unit_1, min_unit_2, min_unit_3, min_unit_4, max_unit_1, max_unit_2, max_unit_3, max_unit_4, rof, rof2, max_torp, buildtime) VALUES ("' . $this->bot['user_id'] . '","' . time() . '","NPC Quark Trade","Transport","' . $this->bot['user_race'] . '",1,0, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, "50","50","0","250","250", "40","40","40","50","9.99", "40","40","1","1","0", "200000","200000","200000","40000","5000","5000", "5000","2500","2500","5000", "5000","2500","2500",2000, 1, 0, 0, 0)'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> could not save BOT template 1 - ABORTED', $log); return; } // Update ship template id with the freshly created one $this->bot['ship_t_1'] = $this->db->insert_id(); $reloading++; } if ($this->bot['ship_t_2'] == 0) { $sql = 'INSERT INTO ship_templates (owner, timestamp, name, description, race, ship_torso, ship_class, component_1, component_2, component_3, component_4, component_5, component_6, component_7, component_8, component_9, component_10, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, value_9, value_10, value_11, value_12, value_13, value_14, value_15, resource_1, resource_2, resource_3, resource_4, unit_5, unit_6, min_unit_1, min_unit_2, min_unit_3, min_unit_4, max_unit_1, max_unit_2, max_unit_3, max_unit_4, rof, rof2, max_torp, buildtime) VALUES ("' . $this->bot['user_id'] . '","' . time() . '","NPC Quark Hunter","Combat ship","' . $this->bot['user_race'] . '",3,0, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1, "4000","4000","100","6000","6000", "60","60","60","60","9.99", "60","60","1","1","0", "500000","500000","500000","50000","5000","10000", "10000","2500","2500","5000", "5000","2500","2500",2000, 30, 30, 5000, 0)'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> could not save BOT template 2 - ABORTED', $log); return; } // Update ship template id with the freshly created one $this->bot['ship_t_2'] = $this->db->insert_id(); $reloading++; } if ($reloading > 0) { $this->sdl->log('Update BOT ship templates', $log); $sql = 'UPDATE FHB_Bot SET ship_t_1 = ' . $this->bot['ship_t_1'] . ', ship_t_2 = ' . $this->bot['ship_t_2'] . ' WHERE user_id = ' . $this->bot['user_id']; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> could not update Ramona ID card with ship templates info - CONTINUED', $log); } } $this->sdl->finish_job('Ramona basic system', $log); // ######################################################################################## // ######################################################################################## // Change the BOT password $this->ChangePassword($log); }
public function Install($log = INSTALL_LOG_FILE_NPC) { // We don't use the global variable here since this function can be called also // by the installation script. $environment = $this->db->queryrow('SELECT * FROM config LIMIT 0 , 1'); $ACTUAL_TICK = $environment['tick_id']; $FUTURE_SHIP = $environment['future_ship']; $this->sdl->start_job('SevenOfNine basic system', $log); $Bot_exe = $this->db->query('SELECT * FROM borg_bot LIMIT 0,1'); // Create BOT table if it doesn't exist if ($Bot_exe === false) { $sql = 'CREATE TABLE `' . $this->db->login['database'] . '`.`borg_bot` ( `id` INT( 2 ) NOT NULL AUTO_INCREMENT , `user_id` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT \'0\', `planet_id` SMALLINT( 5 ) UNSIGNED NOT NULL DEFAULT \'0\', `ship_template1` INT( 10 ) UNSIGNED NOT NULL DEFAULT \'0\', `ship_template2` INT( 10 ) UNSIGNED NOT NULL DEFAULT \'0\', `ship_template3` INT( 10 ) UNSIGNED NOT NULL DEFAULT \'0\', `user_tick` INT( 10 ) NOT NULL , `attack_quadrant` TINYINT( 3 ) UNSIGNED NOT NULL DEFAULT \'' . BORG_QUADRANT . '\', `attacked_user1` MEDIUMINT( 8 ) UNSIGNED NOT NULL , `attacked_user2` MEDIUMINT( 8 ) UNSIGNED NOT NULL , `attacked_user3` MEDIUMINT( 8 ) UNSIGNED NOT NULL , `attacked_user4` MEDIUMINT( 8 ) UNSIGNED NOT NULL , `last_attacked` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT \'0\', `wrath_size` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT \'30\', PRIMARY KEY ( `id` ) ) ENGINE = MYISAM'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> cannot create borg_bot table - ABORTED', $log); return; } } $num_bot = $this->db->num_rows($Bot_exe); if ($num_bot < 1) { $sql = 'INSERT INTO borg_bot (user_id,user_tick,planet_id,ship_template1,ship_template2,ship_template3) VALUES ("0","0","0","0","0","0")'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> could not insert borg_bot data - ABORTED', $log); return; } } //So now we give the bot some data so that it is also Registered $this->bot = $this->db->queryrow('SELECT * FROM borg_bot LIMIT 0,1'); //Check whether the bot already lives if ($this->bot['user_id'] == 0) { $this->sdl->log('We need to create SevenOfNine', $log); $sql = 'INSERT INTO user (user_id, user_active, user_name, user_loginname, user_password, user_email, user_auth_level, user_race, user_gfxpath, user_skinpath, user_registration_time, user_registration_ip, user_birthday, user_gender, plz, country, user_enable_sig,user_message_sig, user_signature, user_notepad, user_options, message_basement) VALUES (' . BORG_USERID . ', 1, "Borg(NPC)", "BorgBot", "' . md5("borgcube") . '", "*****@*****.**", ' . STGC_BOT . ', ' . BORG_RACE . ', "/stfc_gfx/", "skin1/", ' . time() . ', "127.0.0.1", "23.05.2008", "", 16162 , "IT", 1, "<br><br><p><b>We are the Borg, resistance is futile</b></p>", "' . BORG_SIGNATURE . '","", "", "")'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> could not create SevenOfNine - ABORTED', $log); return; } $sql = 'UPDATE borg_bot SET user_id="' . BORG_USERID . '", user_tick="' . $ACTUAL_TICK . '" WHERE id="' . $this->bot['id'] . '"'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> could not update borg_bot table - ABORTED', $log); return; } // Avoid a DB query $this->bot['user_id'] = BORG_USERID; } // end user bot creation // Check whether the bot has a planet if ($this->bot['planet_id'] == 0) { $this->sdl->log('<b>SevenOfNine needs new body</b>', $log); while ($this->bot['planet_id'] == 0 or $this->bot['planet_id'] == 'empty') { $this->sdl->log('Create new planet', $log); $this->db->lock('starsystems_slots'); $this->bot['planet_id'] = create_planet($this->bot['user_id'], 'quadrant', BORG_QUADRANT); $this->db->unlock(); if ($this->bot['planet_id'] == 0) { $this->sdl->log('<b>Error:</b> could not create SevenOfNine\'s planet - ABORTED', $log); return; } $sql = 'UPDATE user SET user_points = "400", user_planets = "1", last_active = "4294967295", user_capital = "' . $this->bot['planet_id'] . '", active_planet = "' . $this->bot['planet_id'] . '" WHERE user_id = ' . $this->bot['user_id']; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> could not update SevenOfNine\'s attack protection info - CONTINUED', $log); } // That one is for resetting the Borg Targets List $sql = 'TRUNCATE TABLE borg_target'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> could not reset borg_target - CONTINUED', $log); } //Bot gets best values for his body, he should also look good $this->sdl->log('Give best values to the planet', $log); $sql = 'UPDATE planets SET planet_points = 1200,building_1 = 9,building_2 = 15,building_3 = 15, building_4 = 15,building_5 = 16,building_6 = 9,building_7 = 15,building_8 = 9, building_9 = 9,building_10 = 35,building_11 = 9,building_12 = 15,building_13 = 35, unit_1 = 20000,unit_2 = 10000,unit_3 = 5000,unit_4 = 5000,unit_5 = 0,unit_6 = 0, planet_name = "Unimatrix Zero", research_1 = 15,research_2 = 15,research_3 = 15,research_4 = 15,research_5 = 9, workermine_1 = 1600,workermine_2 = 1600,workermine_3 = 1600,resource_4 = 4000 WHERE planet_owner = ' . $this->bot['user_id'] . ' and planet_id=' . $this->bot['planet_id']; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> could not improve SevenOfNine\'s planet - CONTINUED', $log); } $sql = 'UPDATE borg_bot SET planet_id=' . $this->bot['planet_id'] . ' WHERE user_id = ' . $this->bot['user_id']; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> could not update SevenOfNine ID card with planet info - CONTINUED', $log); } } // end while } // end planet creation // Check whether the ship already has templates $reload = 0; if ($this->bot['ship_template1'] == 0) { /** * Brief comments of SECOND prototype of Borg Sphere: * * Light weapons: 420 * Heavy weapons: 1176 * Planetary weapons: 8 * Hull: 2970 * Shield: 6241 * * Reaction: 8 * Readiness: 17 * Agility: 36 * Experience: 50 * Warp: 10 (Borg has transwarp engines) * * Sensors: 48 * Camouflage: 0 * Energy available: 160 * Energy used: 140 * * Resources needed for construction: * * Metal: 50000 * Minerals: 50000 * Dilithium: 50000 * Workers: 500 * Technicians: 100 * Physicians: 10 * * Minimum crew: * * Drone simple: 196 * Assault drone: 0 * Elite drone: 0 * Commander drone: 4 * * Maximum crew: * * Drone simple: 196 * Assault drone: 0 * Elite drone: 0 * Commander drone: 4 */ $reload++; $sql = 'INSERT INTO ship_templates (owner, timestamp, name, description, race, ship_torso, ship_class, component_1, component_2, component_3, component_4, component_5, component_6, component_7, component_8, component_9, component_10, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, value_9, value_10, value_11, value_12, value_13, value_14, value_15, resource_1, resource_2, resource_3, resource_4, unit_5, unit_6, min_unit_1, min_unit_2, min_unit_3, min_unit_4, max_unit_1, max_unit_2, max_unit_3, max_unit_4, buildtime, rof, rof2, max_torp) VALUES ("' . $this->bot['user_id'] . '","' . time() . '","' . BORG_SPHERE . '","Exploration ship","' . BORG_RACE . '",6,2, -1,-1,-1,-1,-1, -1,-1,-1,-1,-1, "420","1176","8","2970","6241", "8","17","36","50","10", "48","0","160","140","0", "50000","50000","50000","500","100","10", "196","0","0","4", "196","0","0","4", 0, 8, 6, 85)'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> could not save BOT template 1 - ABORTED', $log); return; } // Update ship template id with the freshly created one $this->bot['ship_template1'] = $this->db->insert_id(); } if ($this->bot['ship_template2'] == 0) { /** * Brief comments of SECOND prototype of Borg Cube: * * Light weapons: 420 * Heavy weapons: 1176 * Planetary weapons: 140 * Hull: 7796 * Shield: 11441 * * Reaction: 8 * Readiness: 20 * Agility: 22 * Experience: 50 * Warp: 10 (Borg has transwarp engines) * * Sensors: 42 * Camouflage: 0 * Energy available: 300 * Energy used: 300 * * Resources needed for construction: * * Metal: 500000 * Minerals: 500000 * Dilithium: 500000 * Workers: 50000 * Technicians: 10000 * Physicians: 1000 * * Minimum crew: * * Drone simple: 294 * Assault drone: 0 * Elite drone: 0 * Commander drone: 6 * * Maximum crew: * * Drone simple: 9294 * Assault drone: 6000 * Elite drone: 3000 * Commander drone: 6 */ $reload++; $sql = 'INSERT INTO ship_templates (owner, timestamp, name, description, race, ship_torso, ship_class, component_1, component_2, component_3, component_4, component_5, component_6, component_7, component_8, component_9, component_10, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, value_9, value_10, value_11, value_12, value_13, value_14, value_15, resource_1, resource_2, resource_3, resource_4, unit_5, unit_6, min_unit_1, min_unit_2, min_unit_3, min_unit_4, max_unit_1, max_unit_2, max_unit_3, max_unit_4, buildtime, rof, rof2, max_torp) VALUES ("' . $this->bot['user_id'] . '","' . time() . '","' . BORG_CUBE . '","Assimilation ship","' . BORG_RACE . '",9,3, -1,-1,-1,-1,-1, -1,-1,-1,-1,-1, "420","1176","140","7796","11441", "8","20","22","50","10", "42","0","300","300","0", "500000","500000","500000","50000","39","16", "294","0","0","6", "9294","6000","3000","6", 0, 21, 11, 1000)'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> Could not save BOT template 2 - ABORTED', $log); return; } // Update ship template id with the freshly created one $this->bot['ship_template2'] = $this->db->insert_id(); } if ($this->bot['ship_template3'] == 0) { /** * Brief comments of THIRD prototype of Borg Cube: * * Light weapons: 420 * Heavy weapons: 1176 * Planetary weapons: 140 * Torpedoes: 800 * ROF: 16 * Hull: 12623 * Shield: 22882 * * Reaction: 8 * Readiness: 28 * Agility: 15 * Experience: 50 * Warp: 10 (Borg has transwarp engines) * * Sensors: 70 * Camouflage: 0 * Energy available: 600 * Energy used: 600 * * Resources needed for construction: * * Metal: 500000 * Minerals: 500000 * Dilithium: 500000 * Workers: 50000 * Technicians: 250 * Physicians: 250 * * Minimum crew: * * Drone simple: 10000 * Assault drone: 2500 * Elite drone: 2500 * Commander drone: 500 * * Maximum crew: * * Drone simple: 65000 <--- Max 65535 * Assault drone: 21000 * Elite drone: 15000 * Commander drone: 5000 */ $reload++; $sql = 'INSERT INTO ship_templates (owner, timestamp, name, description, race, ship_torso, ship_class, component_1, component_2, component_3, component_4, component_5, component_6, component_7, component_8, component_9, component_10, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, value_9, value_10, value_11, value_12, value_13, value_14, value_15, resource_1, resource_2, resource_3, resource_4, unit_5, unit_6, min_unit_1, min_unit_2, min_unit_3, min_unit_4, max_unit_1, max_unit_2, max_unit_3, max_unit_4, buildtime, rof, rof2, max_torp) VALUES ("' . $this->bot['user_id'] . '","' . time() . '","' . BORG_TACT . '","Combat Ship","' . BORG_RACE . '",11,3, -1,-1,-1,-1,-1, -1,-1,-1,-1,-1, "420","1176","140","12623","22882", "8","28","15","50","10", "70","0","600","600","0", "500000","500000","500000","50000","250","250", "10000","2500","2500","500", "65000","21000","15000","5000", 0, 34, 22, 5000)'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> Could not save BOT template 3 - ABORTED ' . $sql, $log); return; } // Update ship template id with the freshly created one $this->bot['ship_template3'] = $this->db->insert_id(); } if ($this->bot['unimatrixzero_tp'] == 0) { /** * Brief comments of FIRST prototype of Unimatrix Zero: * * Light weapons: 1 * Heavy weapons: 1 * Planetary weapons: 1 * Torpedoes: 25000 * ROF: 25 * Hull: 850000 * Shield: 850000 * * Reaction: 5 * Readiness: 80 * Agility: 5 * Experience: 100 * Warp: 10 (Borg has transwarp engines) * * Sensors: 80 * Camouflage: 0 * Energy available: 10000 * Energy used: 10000 * * Resources needed for construction: * * Metal: 1 * Minerals: 1 * Dilithium: 1 * Workers: 1 * Technicians: 1 * Physicians: 1 * * Minimum crew: * * Drone simple: 65000 * Assault drone: 25000 * Elite drone: 25000 * Commander drone: 5000 * * Maximum crew: * * Drone simple: 65000 <--- Max 65535 * Assault drone: 25000 * Elite drone: 25000 * Commander drone: 5000 */ $reload++; $sql = 'INSERT INTO ship_templates (owner, timestamp, name, description, race, ship_torso, ship_class, component_1, component_2, component_3, component_4, component_5, component_6, component_7, component_8, component_9, component_10, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, value_9, value_10, value_11, value_12, value_13, value_14, value_15, resource_1, resource_2, resource_3, resource_4, unit_5, unit_6, min_unit_1, min_unit_2, min_unit_3, min_unit_4, max_unit_1, max_unit_2, max_unit_3, max_unit_4, buildtime, rof, rof2, max_torp) VALUES (' . $this->bot['user_id'] . ',' . time() . ', "' . BORG_UM0 . '", "Main Borg Base", ' . BORG_RACE . ',12,3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1, 850000, 850000, 5, 80, 5, 100, 10, 80, 0, 10000, 10000, 0, 1, 1, 1, 1, 1, 1, 65000, 25000, 25000, 5000, 65000, 25000, 25000, 5000, 0, 25, 25, 25000)'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> Could not save BOT Unimatrix Zero - ABORTED ' . $sql, $log); return; } // Update ship template id with the freshly created one $this->bot['unimatrixzero_tp'] = $this->db->insert_id(); } if ($reload > 0) { $this->sdl->log('Ship templates built', $log); $sql = 'UPDATE borg_bot SET ship_template1 = ' . $this->bot['ship_template1'] . ', ship_template2 = ' . $this->bot['ship_template2'] . ', ship_template3 = ' . $this->bot['ship_template3'] . ', unimatrixzero_tp = ' . $this->bot['unimatrixzero_tp'] . ' WHERE user_id = ' . $this->bot['user_id']; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> Could not update SevenOfNine ID card with ship templates info - CONTINUED', $log); } } $this->sdl->finish_job('SevenOfNine basic system', $log); // ######################################################################################## // ######################################################################################## // Change the BOT password $this->ChangePassword($log); // Future Humans $this->sdl->start_job('Future Humans Setup&Maintenance', $log); if ($FUTURE_SHIP == 0) { $sql = 'SELECT count(*) AS fhship_check FROM ship_templates WHERE template_id = ' . $FUTURE_SHIP; $result = $this->db->queryrow($sql); if ($result['fhship_check'] == 0) { // We put the Future Humans Ship Template in the DB $sql = 'INSERT INTO ship_templates (owner, timestamp, name, description, race, ship_torso, ship_class, component_1, component_2, component_3, component_4, component_5, component_6, component_7, component_8, component_9, component_10, value_1, value_2, value_3, value_4, value_5, value_6, value_7, value_8, value_9, value_10, value_11, value_12, value_13, value_14, value_15, resource_1, resource_2, resource_3, resource_4, unit_5, unit_6, min_unit_1, min_unit_2, min_unit_3, min_unit_4, max_unit_1, max_unit_2, max_unit_3, max_unit_4, buildtime, rof, max_torp) VALUES ("' . FUTURE_HUMANS_UID . '","' . time() . '","Prometeus","Anti-Borg, Multirole, Heavy Assault Ship",12,11,3, -1,-1,-1,-1,-1, -1,-1,-1,-1,-1, "5000","5000","280","21000","15000", "36","40","48","46","9.99", "65","0","480","480","0", "35000","300000","300000","2900","65","15", "150","100","85","15", "400","200","150","25", 2000, 3, 500)'; if (!$this->db->query($sql)) { $this->sdl->log('<b>Error:</b> could not insert Future Humans Ship Template - ABORTED', $log); return; } $FUTURE_SHIP = $this->db->insert_id(); if (!$this->db->query('UPDATE config SET future_ship = ' . $FUTURE_SHIP)) { $this->sdl->log('<b>Error:</b> could not update future ship template id - CONTINUED', $log); } $this->sdl->log('Template created with id ' . $FUTURE_SHIP, $log); } } $this->sdl->finish_job('Future Humans Setup&Maintenance', $log); }
} // Then create the others while ($planets_to_go > 0) { // Create the system $_temp = create_system('sector', $capital_system['sector_id'], 0); $_system_id = $_temp[0]; $game->out('Created system: ' . $_system_id . '<br>'); // Retrieve available slots $sql = 'SELECT system_max_planets FROM starsystems WHERE system_id = ' . $_system_id; if (($new_system = $db->queryrow($sql)) === false) { message(DATABASE_ERROR, 'Could not query solar system data'); } $game->out('Available slots: ' . $new_system['system_max_planets'] . '<br>'); // Fill all the slots available for ($p = 0; $p < $new_system['system_max_planets']; $p++) { $planet_id = create_planet(0, 'system', $_system_id); $game->out('Created planet: ' . $planet_id . '<br>'); // Update required security forces $sql = 'UPDATE planets SET planet_owner = ' . $user_id . ', planet_owned_date = ' . time() . ', planet_owner_enum = ' . ($n_planets - 1) . ', planet_available_points = ' . $MAX_POINTS[0] . ', unit_1 = ceil(pow(planet_owner_enum*' . MIN_TROOPS_PLANET . ',1+planet_owner_enum*0.01)/2) WHERE planet_id = ' . $planet_id; if (!$db->query($sql)) { message(DATABASE_ERROR, 'Could not update planets data!'); } $game->out('Updated required security troops of planet: ' . $planet_id . '<br>'); // ############################################################################# // Add History Record in planet details; log_code = 25
You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ $game->init_player(); check_auth(STGC_DEVELOPER); if (empty($_GET['id_type'])) { die('Usage: id_type=[quadrant,sector,system]&id_value=[integer]&n=[integer]<br><br>Optional: user_id=[integer]'); } if (!in_array($_GET['id_type'], array('quadrant', 'sector', 'system'))) { die('Usage: id_type=[quadrant,sector,system]&id_value=[integer]&n=[integer]<br><br>Optional: user_id=[integer]'); } if (empty($_GET['id_value'])) { die('Usage: id_type=[quadrant,sector,system]&id_value=[integer]&n=[integer]<br><br>Optional: user_id=[integer]'); } if (empty($_GET['n'])) { die('Usage: id_type=[quadrant,sector,system]&id_value=[integer]&n=[integer]<br><br>Optional: user_id=[integer]'); } include_once 'include/libs/world.php'; if (!empty($_GET['user_id'])) { $user_id = (int) $_GET['user_id']; } else { $user_id = false; } $results = array(); for ($i = 0; $i < $_GET['n']; ++$i) { $results[] = create_planet($user_id, $_GET['id_type'], $_GET['id_value']); } for ($i = 0; $i < count($results); ++$i) { $game->out('Created new planet with ID <b>' . $results[$i] . '</b><br>'); }
function create_planet($user_id, $id_type, $id_value, $selected_type = 'r', $race = 0) { include_once 'include/libs/world.php'; return create_planet($user_id, $id_type, $id_value, $selected_type, $race); }