diff --git a/src/add_declare.php b/src/add_declare.php index 08a8348..b2d6eaf 100644 --- a/src/add_declare.php +++ b/src/add_declare.php @@ -32,37 +32,31 @@ define('INSIDE' , true); define('INSTALL' , false); require_once dirname(__FILE__) .'/application/bootstrap.php'; +$mode = Wootook::getRequest()->getPost('mode'); - includeLang('admin'); +if ($mode == 'addit') { + $adapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_write'); + $adapter->insert() + ->into($adapter->getTable('declared')) + ->set('declarator', $user->getId()) + ->set('declarator_name', $user->getUsername()) + ->set('declared_1', Wootook::getRequest()->getPost('dec1')) + ->set('declared_2', Wootook::getRequest()->getPost('dec2')) + ->set('declared_3', Wootook::getRequest()->getPost('dec2')) + ->set('reason', Wootook::getRequest()->getPost('reason')) + ->execute() + ; - $mode = $_POST['mode']; + $adapter->update() + ->into($adapter->getTable('users')) + ->set('multi_validated', 1) + ; - $PageTpl = gettemplate("add_declare"); - $parse = $lang; + message("Merci, votre demande a ete prise en compte. Les autres joueurs que vous avez implique doivent egalement et imperativement suivre cette procedure aussi.", "Ajout"); +} - if ($mode == 'addit') { - $declarator = $user['id']; - $declarator_name = addslashes(htmlspecialchars($user['username'])); - $decl1 = addslashes(htmlspecialchars($_POST['dec1'])); - $decl2 = addslashes(htmlspecialchars($_POST['dec2'])); - $decl3 = addslashes(htmlspecialchars($_POST['dec3'])); - $reason1 = addslashes(htmlspecialchars($_POST['reason'])); +includeLang('admin'); +$Page = parsetemplate(gettemplate("add_declare"), $lang); - $QryDeclare = "INSERT INTO {{table}} SET "; - $QryDeclare .= "`declarator` = '". $declarator ."', "; - $QryDeclare .= "`declarator_name` = '". $declarator_name ."', "; $QryDeclare .= "`declared_1` = '". $decl1 ."', "; - $QryDeclare .= "`declared_2` = '". $decl2 ."', "; - $QryDeclare .= "`declared_3` = '". $decl3 ."', "; - $QryDeclare .= "`reason` = '". $reason1 ."' "; +display($Page, "Declaration d\'IP partagee", false, '', true); - doquery( $QryDeclare, "declared"); - doquery("UPDATE {{table}} SET multi_validated ='1' WHERE username='{$user['username']}'","users"); - - AdminMessage ( "Merci, votre demande a ete prise en compte. Les autres joueurs que vous avez implique doivent egalement et imperativement suivre cette procedure aussi.", "Ajout" ); - } - $Page = parsetemplate($PageTpl, $parse); - - display ($Page, "Declaration d\'IP partagee", false, '', true); - - -?> \ No newline at end of file diff --git a/src/annonce.php b/src/annonce.php index c4fe5b9..9c0b506 100644 --- a/src/annonce.php +++ b/src/annonce.php @@ -31,35 +31,26 @@ define('INSIDE' , true); define('INSTALL' , false); require_once dirname(__FILE__) .'/application/bootstrap.php'; -$users = doquery("SELECT * FROM {{table}} WHERE id='".$user['id']."';", 'users'); -$annonce = doquery("SELECT * FROM {{table}} ", 'annonce'); -$action = $_GET['action']; + +$readAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_read'); +$writeAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_write'); + +$action = isset($_GET['action']) ? $_GET['action'] : null; if ($action == 5) { - $metalvendre = $_POST['metalvendre']; - $cristalvendre = $_POST['cristalvendre']; - $deutvendre = $_POST['deutvendre']; - - $metalsouhait = $_POST['metalsouhait']; - $cristalsouhait = $_POST['cristalsouhait']; - $deutsouhait = $_POST['deutsouhait']; - - while ($v_annonce = $users->fetch(PDO::FETCH_BOTH)) { - $user = $v_annonce['username']; - $galaxie = $v_annonce['galaxy']; - $systeme = $v_annonce['system']; - } - - doquery("INSERT INTO {{table}} SET -user='{$user}', -galaxie='{$galaxie}', -systeme='{$systeme}', -metala='{$metalvendre}', -cristala='{$cristalvendre}', -deuta='{$deutvendre}', -metals='{$metalsouhait}', -cristals='{$cristalsouhait}', -deuts='{$deutsouhait}'" , "annonce"); + $writeAdapter->insert() + ->into($writeAdapter->getTable('annonce')) + ->set('user', $user->getUsername()) + ->set('galaxie', $planet->getGalaxy()) + ->set('systeme', $planet->getSystem()) + ->set('metala', Wootook::getRequest()->getParam('metalvendre')) + ->set('cristala', Wootook::getRequest()->getParam('cristalvendre')) + ->set('deuta', Wootook::getRequest()->getParam('deutvendre')) + ->set('metals', Wootook::getRequest()->getParam('metalsouhait')) + ->set('cristals', Wootook::getRequest()->getParam('cristalsouhait')) + ->set('deuts', Wootook::getRequest()->getParam('deutsouhait')) + ->execute() + ; $page2 .= << @@ -73,7 +64,7 @@ HTML; } if ($action != 5) { - $annonce = doquery("SELECT * FROM {{table}} ORDER BY `id` DESC ", "annonce"); + $statement = $readAdapter->select()->from(array('annonce' => $readAdapter->getTable('annonce')))->order('id', 'DESC')->prepare(); $page2 = "
@@ -82,12 +73,9 @@ if ($action != 5) { Petites Annonces Infos de livraisonRessources à vendreRessources souhaitéesAction VendeurGalaxieSystèmeMétalCristalDeuteriumMétalCristalDeuteriumDelet - - - - "; - while ($b = $annonce->fetch(PDO::FETCH_BOTH)) { + + foreach ($statement as $b) { $page2 .= ' '; $page2 .= $b["user"] ; $page2 .= ''; @@ -119,4 +107,3 @@ if ($action != 5) { display($page2); } -?> \ No newline at end of file diff --git a/src/application/code/core/Legacies/Empire.php b/src/application/code/core/Legacies/Empire.php index 777a466..eb5b24b 100644 --- a/src/application/code/core/Legacies/Empire.php +++ b/src/application/code/core/Legacies/Empire.php @@ -99,6 +99,7 @@ class Legacies_Empire const ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK = 123; const ID_RESEARCH_EXPEDITION_TECHNOLOGY = 124; const ID_RESEARCH_ASTROPHYSICS = 124; + const ID_RESEARCH_ORE_MINING = 125; const ID_RESEARCH_GRAVITON_TECHNOLOGY = 199; const ID_SHIP_LIGHT_TRANSPORT = 202; @@ -116,6 +117,7 @@ class Legacies_Empire const ID_SHIP_DEATH_STAR = 214; const ID_SHIP_BATTLECRUISER = 215; const ID_SHIP_SUPERNOVA = 216; + const ID_SHIP_ORE_MININER = 217; const ID_DEFENSE_ROCKET_LAUNCHER = 401; const ID_DEFENSE_LIGHT_LASER = 402; @@ -144,6 +146,7 @@ class Legacies_Empire const ID_MISSION_DESTROY = 9; const ID_MISSION_MISSILES = 10; const ID_MISSION_EXPEDITION = 15; + const ID_MISSION_ORE_MINING = 16; public static function getFieldName($id) { @@ -155,4 +158,4 @@ class Legacies_Empire return $fieldsAlias[$id]; } -} \ No newline at end of file +} diff --git a/src/application/code/core/Legacies/Empire/Block/Planet/Shipyard/Item.php b/src/application/code/core/Legacies/Empire/Block/Planet/Shipyard/Item.php index d134b45..0b42ac2 100644 --- a/src/application/code/core/Legacies/Empire/Block/Planet/Shipyard/Item.php +++ b/src/application/code/core/Legacies/Empire/Block/Planet/Shipyard/Item.php @@ -42,6 +42,11 @@ class Legacies_Empire_Block_Planet_Shipyard_Item return $this->getPlanet()->getElement($this->getItemId()); } + public function getClass() + { + return $this->getLabel('class'); + } + public function getResourcesNeeded($qty) { return $this->getPlanet()->getShipyard()->getResourcesNeeded($this->getItemId(), $qty); @@ -77,4 +82,4 @@ class Legacies_Empire_Block_Planet_Shipyard_Item } return $resourceConfig; } -} \ No newline at end of file +} diff --git a/src/application/code/core/Wootook.php b/src/application/code/core/Wootook.php index a199ad7..f293c70 100644 --- a/src/application/code/core/Wootook.php +++ b/src/application/code/core/Wootook.php @@ -244,7 +244,7 @@ class Wootook } $userLocale = Wootook_Player_Model_Session::getSingleton()->getData('locale'); - if ($userLocale !== null) { + if ($userLocale !== null && in_array($userLocale, $availableLocales)) { return $userLocale; } @@ -270,8 +270,8 @@ class Wootook return self::getDefaultLocale(); } - $preferredLocale = key($locales); - $preferredPriority = current($locales); + $preferredLocale = current($availableLocales); + $preferredPriority = 0; foreach ($locales as $locale => $piority) { if (!in_array($locale, $availableLocales)) { continue; @@ -281,6 +281,7 @@ class Wootook $preferredLocale = $locale; } } + var_dump($preferredLocale); Wootook_Player_Model_Session::getSingleton()->setData('locale', $preferredLocale); diff --git a/src/application/code/core/Wootook/Core/DateTime.php b/src/application/code/core/Wootook/Core/DateTime.php index 28b12d0..3f201dc 100644 --- a/src/application/code/core/Wootook/Core/DateTime.php +++ b/src/application/code/core/Wootook/Core/DateTime.php @@ -292,4 +292,4 @@ class Wootook_Core_DateTime return $this->_mktime($parts); } } -} \ No newline at end of file +} diff --git a/src/application/code/core/Wootook/Empire/Block/Planet/Builder/ItemAbstract.php b/src/application/code/core/Wootook/Empire/Block/Planet/Builder/ItemAbstract.php index 0c6c31d..ebf6f20 100644 --- a/src/application/code/core/Wootook/Empire/Block/Planet/Builder/ItemAbstract.php +++ b/src/application/code/core/Wootook/Empire/Block/Planet/Builder/ItemAbstract.php @@ -7,6 +7,13 @@ abstract class Wootook_Empire_Block_Planet_Builder_ItemAbstract protected $_planet = null; protected $_itemId = null; + protected $_labels = null; + + public function __construct() + { + $this->_labels = Wootook_Empire_Helper_Config_Labels::getSingleton(); + } + public function setPlayer(Wootook_Player_Model_Entity $player) { $this->_player = $player; @@ -56,38 +63,24 @@ abstract class Wootook_Empire_Block_Planet_Builder_ItemAbstract return $this->getStaticUrl('infos.php', array('gid' => $this->getItemId())); } + public function getLabel($type) + { + return $this->_labels[$this->getItemId()][$type]; + } + public function getItemImageUrl() { - // TODO : Upgrade theme - return $this->getSkinUrl('graphics/gebaeude/' . $this->getItemId() . '.gif'); + return $this->getSkinUrl($this->getLabel('image')); } public function getName() { - static $lang = null; - if ($lang === null) { - // FIXME: implement a cleaner way to get names - $lang = includeLang('tech'); - } - - if (isset($lang['tech']) && isset($lang['tech'][$this->getItemId()])) { - return $this->__($lang['tech'][$this->getItemId()]); - } - return ''; + return $this->getLabel('name'); } public function getDescription() { - static $lang = null; - if ($lang === null) { - // FIXME: implement a cleaner way to get names - $lang = includeLang('tech'); - } - - if (isset($lang['res']) && isset($lang['res']['descriptions']) && isset($lang['res']['descriptions'][$this->getItemId()])) { - return $this->__($lang['res']['descriptions'][$this->getItemId()]); - } - return ''; + return $this->getLabel('description'); } public function getResourceName($resourceId) @@ -115,4 +108,4 @@ abstract class Wootook_Empire_Block_Planet_Builder_ItemAbstract abstract public function getResourcesNeeded($level); abstract public function getBuildingTime($level); -} \ No newline at end of file +} diff --git a/src/application/code/core/Wootook/Empire/Helper/Config/Labels.php b/src/application/code/core/Wootook/Empire/Helper/Config/Labels.php new file mode 100644 index 0000000..94297a2 --- /dev/null +++ b/src/application/code/core/Wootook/Empire/Helper/Config/Labels.php @@ -0,0 +1,51 @@ +_initData("locale/{$locale}/labels"); + return $this; + } + + protected function _load() + { + // NOP + return $this; + } + + protected function _save() + { + // NOP + return $this; + } + + protected function _delete() + { + // NOP + return $this; + } +} diff --git a/src/application/code/core/Wootook/Empire/Model/Planet.php b/src/application/code/core/Wootook/Empire/Model/Planet.php index 614118f..4dc76f7 100644 --- a/src/application/code/core/Wootook/Empire/Model/Planet.php +++ b/src/application/code/core/Wootook/Empire/Model/Planet.php @@ -101,7 +101,9 @@ class Wootook_Empire_Model_Planet $coords['type'] = $type; } - $collection = new Wootook_Empire_Resource_Planet_Collection('core_read'); + $adapter = Wootook_Core_Database_ConnectionManager::getSingleton() + ->getConnection('core_read'); + $collection = new Wootook_Empire_Resource_Planet_Collection($adapter); $collection->addCoordsToFilter($coords['galaxy'], $coords['system'], $coords['position'], $coords['type']) ->setPage(1, 1); @@ -196,7 +198,7 @@ class Wootook_Empire_Model_Planet return $this->getPlanet()->getGalaxyData(); } - public function updateStorages($time = null) + public function updateStorages() { Math::setPrecision(50); $resources = Wootook_Empire_Helper_Config_Resources::getSingleton(); @@ -388,15 +390,14 @@ class Wootook_Empire_Model_Planet $time = new Wootook_Core_DateTime(); } - $timeDiff = clone $time; - $timeDiff->diff($time); + $timeDiff = $time->diff($this->getLastUpdate()); foreach ($resources->getAllDatas() as $resourceId => $resourceConfig) { if (!$resourceConfig['storage_field']) { continue; } - $production = Math::mul($this->getData($resourceConfig['production_field']), $timeDiff->getTimestamp() / 3600); + $production = Math::mul($this->getData($resourceConfig['production_field']), $timeDiff / 3600); $resourceValue = Math::add($this->getData($resourceConfig['field']), $production); $this->setData($resourceConfig['field'], Math::min($resourceValue, $this->getData($resourceConfig['storage_field']))); } @@ -413,7 +414,7 @@ class Wootook_Empire_Model_Planet if (!isset($production[$buildingId])) { return null; } - $class = $production[$buildingId][Legacies_Empire::RESOURCE_CLASS]; + $class = $production[$buildingId]; $reflection = new ReflectionClass($class); self::$_productionInstances[$buildingId] = $reflection->newInstance(); } diff --git a/src/application/design/frontend/base/default/scripts/empire/planet/shipyard/item.phtml b/src/application/design/frontend/base/default/scripts/empire/planet/shipyard/item.phtml index 3500700..ec6e2b0 100644 --- a/src/application/design/frontend/base/default/scripts/empire/planet/shipyard/item.phtml +++ b/src/application/design/frontend/base/default/scripts/empire/planet/shipyard/item.phtml @@ -2,6 +2,7 @@

escape($this->getName())?>

+

__('Class %s', $this->escape($this->getClass()))?>

__('Current count: %s', $this->renderNumber($this->getQty()))?>

diff --git a/src/application/gamedata/legacies/default/locale/fr_FR/labels.php b/src/application/gamedata/legacies/default/locale/fr_FR/labels.php new file mode 100644 index 0000000..699aca2 --- /dev/null +++ b/src/application/gamedata/legacies/default/locale/fr_FR/labels.php @@ -0,0 +1,407 @@ + array( + 'name' => 'Mine de métal', + 'description' => "

La mine de métal exploite les profondeurs géologiques à la recherche de ressources riches en métaux, puis les raffine et crée ensuite les alliages les plus solides.

Principales matières premières pour la construction de structures planétaires et de vaisseaux, les métaux permettent d'asseoir votre domination sur l'univers.

", + 'image' => 'graphics/buildings/metal-mine.png' + ), + + Legacies_Empire::ID_BUILDING_CRISTAL_MINE => array( + 'name' => 'Mine de cristal', + 'description' => "

La mine de cristal développe l'exploitation des minéraux entrant dans la comosition des systèmes électroniques.

Ces matériaux vous permettront d'augmenter la capacité de calculs de vos laboratoires ainsi que de ceux de vos systèmes de combat.

", + 'image' => 'graphics/buildings/cristal-mine.png' + ), + + Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER => array( + 'name' => "Synthétiseur de deutérium", + 'description' => "

Le synthétiseur de deutérium permet d'exploiter les sources d'hydrogène lourd. Disponible en faible quantité sur les planètes telluriques et plus répandu sur les planètes géantes gazeuses, le deutérium et tritium composent votre principale source d'hydrogène lourd.

", + 'image' => 'graphics/buildings/deuterium-syntherizer.png' + ), + + Legacies_Empire::ID_BUILDING_SOLAR_PLANT => array( + 'name' => 'Centrale électrique solaire', + 'description' => '', + 'image' => 'graphics/buildings/solar-plant.png' + ), + + Legacies_Empire::ID_BUILDING_FUSION_REACTOR => array( + 'name' => 'Réacteur à fusion nucléaire', + 'description' => '', + 'image' => 'graphics/buildings/fusion-reactor.png' + ), + + Legacies_Empire::ID_BUILDING_ROBOTIC_FACTORY => array( + 'name' => 'Usine de robots', + 'description' => '', + 'image' => 'graphics/buildings/robotic-factory.png' + ), + + Legacies_Empire::ID_BUILDING_NANITE_FACTORY => array( + 'name' => 'Usine de nanites', + 'description' => '', + 'image' => 'graphics/buildings/nanite-factory.png' + ), + + Legacies_Empire::ID_BUILDING_SHIPYARD => array( + 'name' => 'Chantier spatial', + 'description' => '', + 'image' => 'graphics/buildings/shipyard.png' + ), + + Legacies_Empire::ID_BUILDING_METAL_STORAGE => array( + 'name' => 'Hangar de métal', + 'description' => '', + 'image' => 'graphics/buildings/metal-storage.png' + ), + + Legacies_Empire::ID_BUILDING_CRISTAL_STORAGE => array( + 'name' => 'Hangar de cristal', + 'description' => '', + 'image' => 'graphics/buildings/cristal-storage.png' + ), + + Legacies_Empire::ID_BUILDING_DEUTERIUM_TANK => array( + 'name' => 'Réservoir de deutérium', + 'description' => '', + 'image' => 'graphics/buildings/deuterium-tank.png' + ), + + Legacies_Empire::ID_BUILDING_RESEARCH_LAB => array( + 'name' => 'Laboratoire de recherche', + 'description' => '', + 'image' => 'graphics/buildings/research-lab.png' + ), + + Legacies_Empire::ID_BUILDING_TERRAFORMER => array( + 'name' => 'Terraformeur', + 'description' => '', + 'image' => 'graphics/buildings/terraformer.png' + ), + + Legacies_Empire::ID_BUILDING_ALLIANCE_DEPOT => array( + 'name' => 'Dépôt de ravitaillement', + 'description' => '', + 'image' => 'graphics/buildings/alliance-depot.png' + ), + + Legacies_Empire::ID_BUILDING_MISSILE_SILO => array( + 'name' => 'Silo de missiles', + 'description' => '', + 'image' => 'graphics/buildings/missile-silo.png' + ), +// }}} + +// +// Moon buildings labels +// {{{ + Legacies_Empire::ID_BUILDING_LUNAR_BASE => array( + 'name' => 'Base lunaire', + 'description' => '', + 'image' => 'graphics/units/lunar-base.png' + ), + + Legacies_Empire::ID_BUILDING_SENSOR_PHALANX => array( + 'name' => 'Phalange de capteur', + 'description' => '', + 'image' => 'graphics/units/sensor-phalanx.png' + ), + + Legacies_Empire::ID_BUILDING_JUMP_GATE => array( + 'name' => 'Porte de saut spatial', + 'description' => '', + 'image' => 'graphics/units/jump-gate.png' + ), +// }}} + +// +// Technologies labels +// {{{ + Legacies_Empire::ID_RESEARCH_ESPIONAGE_TECHNOLOGY => array( + 'name' => 'Techniques d\'espionnage', + 'description' => '', + 'image' => 'graphics/technology/espionnage.png' + ), + + Legacies_Empire::ID_RESEARCH_COMPUTER_TECHNOLOGY => array( + 'name' => 'Recherche informatique', + 'description' => '', + 'image' => 'graphics/technology/computer.png' + ), + + Legacies_Empire::ID_RESEARCH_WEAPON_TECHNOLOGY => array( + 'name' => 'Technologies d\'armements', + 'description' => '', + 'image' => 'graphics/technology/weaponry.png' + ), + + Legacies_Empire::ID_RESEARCH_SHIELDING_TECHNOLOGY => array( + 'name' => 'Boucliers énergétiques', + 'description' => '', + 'image' => 'graphics/technology/shielding.png' + ), + + Legacies_Empire::ID_RESEARCH_ARMOUR_TECHNOLOGY => array( + 'name' => 'Structures spatiales', + 'description' => '', + 'image' => 'graphics/technology/armour.png' + ), + + Legacies_Empire::ID_RESEARCH_ENERGY_TECHNOLOGY => array( + 'name' => 'Nouvelles énergies', + 'description' => '', + 'image' => 'graphics/technology/energy.png' + ), + + Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY => array( + 'name' => 'Technologie hyperespace', + 'description' => '', + 'image' => 'graphics/technology/hyperspace-technology.png' + ), + + Legacies_Empire::ID_RESEARCH_COMBUSTION_DRIVE => array( + 'name' => 'Propulsion à combustion', + 'description' => '', + 'image' => 'graphics/technology/combustion-drive.png' + ), + + Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE => array( + 'name' => 'Propulsion à impulsion', + 'description' => '', + 'image' => 'graphics/technology/impulse-drive.png' + ), + + Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE => array( + 'name' => 'Propulsion hyperespace', + 'description' => '', + 'image' => 'graphics/technology/hyperspace-drive.png' + ), + + Legacies_Empire::ID_RESEARCH_LASER_TECHNOLOGY => array( + 'name' => 'Propriétés laser', + 'description' => '', + 'image' => 'graphics/technology/laser.png' + ), + + Legacies_Empire::ID_RESEARCH_ION_TECHNOLOGY => array( + 'name' => 'Propriétés des ions', + 'description' => '', + 'image' => 'graphics/technology/ion.png' + ), + + Legacies_Empire::ID_RESEARCH_PLASMA_TECHNOLOGY => array( + 'name' => 'Propriétés des plasma', + 'description' => '', + 'image' => 'graphics/technology/plasma.png' + ), + + Legacies_Empire::ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK => array( + 'name' => 'Réseau de recherche intergalactique', + 'description' => '', + 'image' => 'graphics/technology/intergalactic-research-network.png' + ), + + Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY => array( + 'name' => 'Technologie expéditions', + 'description' => '', + 'image' => 'graphics/technology/expedition.png' + ), + + Legacies_Empire::ID_RESEARCH_ORE_MINING => array( + 'name' => 'Exploitation minière', + 'description' => '', + 'image' => 'graphics/technology/ore-mining.png' + ), + + Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY => array( + 'name' => 'Graviton', + 'description' => '', + 'image' => 'graphics/technology/graviton.png' + ), +// }}} + +// +// Fleets labels +// {{{ + Legacies_Empire::ID_SHIP_LIGHT_TRANSPORT => array( + 'name' => 'Transporteur T5', + 'class' => 'Etalon', + 'description' => '', + 'image' => 'graphics/units/light-transport.png' + ), + + Legacies_Empire::ID_SHIP_LARGE_TRANSPORT => array( + 'name' => 'Transporteur T25', + 'class' => 'Buffle', + 'description' => '', + 'image' => 'graphics/units/large-transport.png' + ), + + Legacies_Empire::ID_SHIP_LIGHT_FIGHTER => array( + 'name' => 'Chasseur C50', + 'class' => 'Guêpe', + 'description' => '', + 'image' => 'graphics/units/light-fighter.png' + ), + + Legacies_Empire::ID_SHIP_HEAVY_FIGHTER => array( + 'name' => 'Chasseur C150', + 'class' => 'Frelon', + 'description' => '', + 'image' => 'graphics/units/heavy-fighter.png' + ), + + Legacies_Empire::ID_SHIP_CRUISER => array( + 'name' => 'Croiseur V400', + 'class' => 'Aigle', + 'description' => '', + 'image' => 'graphics/units/cruiser.png' + ), + + Legacies_Empire::ID_SHIP_BATTLESHIP => array( + 'name' => 'Vaisseau de bataille V1000', + 'class' => 'Faucon', + 'description' => '', + 'image' => 'graphics/units/battleship.png' + ), + + Legacies_Empire::ID_SHIP_COLONY_SHIP => array( + 'name' => 'Vaisseau de colonisation', + 'class' => 'Romulus', + 'description' => '', + 'image' => 'graphics/units/colony-ship.png' + ), + + Legacies_Empire::ID_SHIP_RECYCLER => array( + 'name' => 'Recycleur', + 'class' => 'Goule', + 'description' => '', + 'image' => 'graphics/units/recycler.png' + ), + + Legacies_Empire::ID_SHIP_SPY_DRONE => array( + 'name' => 'Sonde d\'espionnage', + 'class' => 'Moustique', + 'description' => '', + 'image' => 'graphics/units/spy-drone.png' + ), + + Legacies_Empire::ID_SHIP_BOMBER => array( + 'name' => 'Bombarider', + 'class' => 'Vengeur', + 'description' => '', + 'image' => 'graphics/units/terraformer.png' + ), + + Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => array( + 'name' => 'Satellite solaire', + 'class' => 'Râ', + 'description' => '', + 'image' => 'graphics/units/terraformer.png' + ), + + Legacies_Empire::ID_SHIP_DESTRUCTOR => array( + 'name' => 'Vaisseau de bataille V2000', + 'class' => 'Destructeur', + 'description' => '', + 'image' => 'graphics/units/terraformer.png' + ), + + Legacies_Empire::ID_SHIP_DEATH_STAR => array( + 'name' => 'Vaisseau mère M1', + 'class' => 'Vengeur', + 'description' => '', + 'image' => 'graphics/units/terraformer.png' + ), + + Legacies_Empire::ID_SHIP_BATTLECRUISER => array( + 'name' => 'Vaisseau de bataille V700', + 'class' => 'Dagon', + 'description' => '', + 'image' => 'graphics/units/terraformer.png' + ), + + Legacies_Empire::ID_SHIP_SUPERNOVA => array( + 'name' => 'Vaisseau mère M5', + 'class' => 'Annihilateur', + 'description' => '', + 'image' => 'graphics/units/terraformer.png' + ), + + Legacies_Empire::ID_SHIP_ORE_MININER => array( + 'name' => 'Vaisseau d\'exploitation', + 'class' => 'Onyx', + 'description' => '', + 'image' => 'graphics/units/terraformer.png' + ), +// }}} + +// +// Defenses labels +// {{{ + Legacies_Empire::ID_DEFENSE_ROCKET_LAUNCHER => array( + 'name' => 'Lance-missiles balistiques', + 'description' => '', + 'image' => 'graphics/defenses/rocket-launcher.png' + ), + + Legacies_Empire::ID_DEFENSE_LIGHT_LASER => array( + 'name' => 'Artillerie laser légère', + 'description' => '', + 'image' => 'graphics/defenses/light-laser.png' + ), + + Legacies_Empire::ID_DEFENSE_HEAVY_LASER => array( + 'name' => 'Artillerie laser lourde', + 'description' => '', + 'image' => 'graphics/defenses/heavy-laser.png' + ), + + Legacies_Empire::ID_DEFENSE_ION_CANNON => array( + 'name' => 'Canon à ions', + 'description' => '', + 'image' => 'graphics/defenses/ion-canon.png' + ), + + Legacies_Empire::ID_DEFENSE_GAUSS_CANNON => array( + 'name' => 'Canon à effet Gauss', + 'description' => '', + 'image' => 'graphics/defenses/gauss-canon.png' + ), + + Legacies_Empire::ID_DEFENSE_PLASMA_TURRET => array( + 'name' => 'Canon à plasma', + 'description' => '', + 'image' => 'graphics/defenses/plasma-turret.png' + ), + + Legacies_Empire::ID_DEFENSE_SMALL_SHIELD_DOME => array( + 'name' => 'Dôme bouclier', + 'description' => '', + 'image' => 'graphics/defenses/small-shield-dome.png' + ), + + Legacies_Empire::ID_DEFENSE_LARGE_SHIELD_DOME => array( + 'name' => 'Grand bouclier planétaire', + 'description' => '', + 'image' => 'graphics/defenses/large-shield-dome.png' + ), + + Legacies_Empire::ID_SPECIAL_ANTIBALLISTIC_MISSILE => array( + 'name' => 'Missile anti-balistique', + 'description' => '', + 'image' => 'graphics/defenses/antiballistic-missile.png' + ), +// }}} + +// +// Special labels +// {{{ + Legacies_Empire::ID_SPECIAL_INTERPLANETARY_MISSILE => array( + 'name' => 'Missile stratégique', + 'description' => '', + 'image' => 'graphics/defenses/interplanetary-missile.png' + ) +// }}} +); diff --git a/src/application/gamedata/legacies/default/production.php b/src/application/gamedata/legacies/default/production.php index 125faa4..545dcde 100644 --- a/src/application/gamedata/legacies/default/production.php +++ b/src/application/gamedata/legacies/default/production.php @@ -2,70 +2,17 @@ // // Buildings production // {{{ - Legacies_Empire::ID_BUILDING_METAL_MINE => array( - Legacies_Empire::RESOURCE_METAL => 40, - Legacies_Empire::RESOURCE_CRISTAL => 10, - Legacies_Empire::RESOURCE_DEUTERIUM => 0, - Legacies_Empire::RESOURCE_ENERGY => 0, - Legacies_Empire::RESOURCE_MULTIPLIER => 1.5, - Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Building_MetalMine' - ), - - Legacies_Empire::ID_BUILDING_CRISTAL_MINE => array( - Legacies_Empire::RESOURCE_METAL => 30, - Legacies_Empire::RESOURCE_CRISTAL => 15, - Legacies_Empire::RESOURCE_DEUTERIUM => 0, - Legacies_Empire::RESOURCE_ENERGY => 0, - Legacies_Empire::RESOURCE_MULTIPLIER => 1.6, - Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Building_CristalMine' - ), - - Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER => array( - Legacies_Empire::RESOURCE_METAL => 150, - Legacies_Empire::RESOURCE_CRISTAL => 50, - Legacies_Empire::RESOURCE_DEUTERIUM => 0, - Legacies_Empire::RESOURCE_ENERGY => 0, - Legacies_Empire::RESOURCE_MULTIPLIER => 1.5, - Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Building_DeuteriumSynthetiser' - ), - - Legacies_Empire::ID_BUILDING_SOLAR_PLANT => array( - Legacies_Empire::RESOURCE_METAL => 50, - Legacies_Empire::RESOURCE_CRISTAL => 20, - Legacies_Empire::RESOURCE_DEUTERIUM => 0, - Legacies_Empire::RESOURCE_ENERGY => 0, - Legacies_Empire::RESOURCE_MULTIPLIER => 1.5, - Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Building_SolarPlant' - ), - - Legacies_Empire::ID_BUILDING_FUSION_REACTOR => array( - Legacies_Empire::RESOURCE_METAL => 500, - Legacies_Empire::RESOURCE_CRISTAL => 200, - Legacies_Empire::RESOURCE_DEUTERIUM => 100, - Legacies_Empire::RESOURCE_ENERGY => 0, - Legacies_Empire::RESOURCE_MULTIPLIER => 1.8, - Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Building_FusionReactor' - ), + Legacies_Empire::ID_BUILDING_METAL_MINE => 'Legacies_Empire_Model_Planet_Building_MetalMine', + Legacies_Empire::ID_BUILDING_CRISTAL_MINE => 'Legacies_Empire_Model_Planet_Building_CristalMine', + Legacies_Empire::ID_BUILDING_DEUTERIUM_SYNTHETISER => 'Legacies_Empire_Model_Planet_Building_DeuteriumSynthetiser', + Legacies_Empire::ID_BUILDING_SOLAR_PLANT => 'Legacies_Empire_Model_Planet_Building_SolarPlant', + Legacies_Empire::ID_BUILDING_FUSION_REACTOR => 'Legacies_Empire_Model_Planet_Building_FusionReactor', // }}} // // Ships production // {{{ - Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => array( - Legacies_Empire::RESOURCE_METAL => 0, - Legacies_Empire::RESOURCE_CRISTAL => 2000, - Legacies_Empire::RESOURCE_DEUTERIUM => 500, - Legacies_Empire::RESOURCE_ENERGY => 0, - Legacies_Empire::RESOURCE_MULTIPLIER => 0.5, - Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Ship_SolarSatellite' - ), - Legacies_Empire::ID_SHIP_SUPERNOVA => array( - Legacies_Empire::RESOURCE_METAL => 0, - Legacies_Empire::RESOURCE_CRISTAL => 2000, - Legacies_Empire::RESOURCE_DEUTERIUM => 500, - Legacies_Empire::RESOURCE_ENERGY => 0, - Legacies_Empire::RESOURCE_MULTIPLIER => 0.5, - Legacies_Empire::RESOURCE_CLASS => 'Legacies_Empire_Model_Planet_Ship_Supernova' - ) + Legacies_Empire::ID_SHIP_SOLAR_SATELLITE => 'Legacies_Empire_Model_Planet_Ship_SolarSatellite', + Legacies_Empire::ID_SHIP_SUPERNOVA => 'Legacies_Empire_Model_Planet_Ship_Supernova' // }}} ); diff --git a/src/application/gamedata/legacies/default/requirements.php b/src/application/gamedata/legacies/default/requirements.php index 838a930..2ed5430 100644 --- a/src/application/gamedata/legacies/default/requirements.php +++ b/src/application/gamedata/legacies/default/requirements.php @@ -114,6 +114,10 @@ Legacies_Empire::ID_RESEARCH_IMPULSE_DRIVE => 3 ), + Legacies_Empire::ID_RESEARCH_ORE_MINING => array( + Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 2 + ), + Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY => array( Legacies_Empire::ID_BUILDING_RESEARCH_LAB => 12 ), @@ -207,6 +211,13 @@ Legacies_Empire::ID_RESEARCH_HYPERSPACE_TECHNOLOGY => 14, Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY => 3 ), + + Legacies_Empire::ID_SHIP_ORE_MININER => array( + Legacies_Empire::ID_BUILDING_SHIPYARD => 12, + Legacies_Empire::ID_RESEARCH_HYPERSPACE_DRIVE => 8, + Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY => 1, + Legacies_Empire::ID_RESEARCH_LASER_TECHNOLOGY => 16 + ), // }}} // diff --git a/src/application/gamedata/legacies/default/types.php b/src/application/gamedata/legacies/default/types.php index 76c773d..c67c74d 100644 --- a/src/application/gamedata/legacies/default/types.php +++ b/src/application/gamedata/legacies/default/types.php @@ -75,6 +75,7 @@ Legacies_Empire::ID_RESEARCH_PLASMA_TECHNOLOGY, Legacies_Empire::ID_RESEARCH_INTERGALACTIC_RESEARCH_NETWORK, Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY, + Legacies_Empire::ID_RESEARCH_ORE_MINING, Legacies_Empire::ID_RESEARCH_GRAVITON_TECHNOLOGY ), // }}} @@ -97,7 +98,8 @@ Legacies_Empire::ID_SHIP_DESTRUCTOR, Legacies_Empire::ID_SHIP_DEATH_STAR, Legacies_Empire::ID_SHIP_BATTLECRUISER, - Legacies_Empire::ID_SHIP_SUPERNOVA + Legacies_Empire::ID_SHIP_SUPERNOVA, + Legacies_Empire::ID_SHIP_ORE_MININER ), // }}} diff --git a/src/fleetback.php b/src/fleetback.php index d82571b..4075674 100644 --- a/src/fleetback.php +++ b/src/fleetback.php @@ -14,60 +14,64 @@ Last revision: 13/07/11 define('INSIDE' , true); define('INSTALL' , false); require_once dirname(__FILE__) .'/application/bootstrap.php'; - includeLang('fleet'); +includeLang('fleet'); - $BoxTitle = $lang['fl_error']; - $TxtColor = "red"; - $BoxMessage = $lang['fl_notback']; - if ( is_numeric($_POST['fleetid']) ) { - $fleetid = intval($_POST['fleetid']); +$BoxTitle = $lang['fl_error']; +$TxtColor = "red"; +$BoxMessage = $lang['fl_notback']; +if (isset($_POST['fleetid']) && is_numeric($_POST['fleetid'])) { + $fleetid = intval($_POST['fleetid']); - $FleetRow = doquery("SELECT * FROM {{table}} WHERE `fleet_id` = '". $fleetid ."';", 'fleets', true); - $i = 0; + $readAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_write'); + $FleetRow = $readAdapter->select() + ->from(array('fleet' => $readAdapter->getTable('fleets'))) + ->where('fleet_id', $fleetid) + ->prepare() + ->fetch() + ; + $i = 0; - if ($FleetRow['fleet_owner'] == $user['id']) { - if ($FleetRow['fleet_mess'] == 0 || $FleetRow['fleet_mess'] == 2) { - if ($FleetRow['fleet_end_stay'] != 0) { - // Faut calculer le temps reel de retour - if ($FleetRow['fleet_start_time'] > time()) { - // On a pas encore entamé le stationnement - // Il faut calculer la parcelle de temps ecoulée depuis le lancement de la flotte - $CurrentFlyingTime = time() - $FleetRow['start_time']; - } else { - // On est deja en stationnement - // Il faut donc directement calculer la durée d'un vol aller ou retour - $CurrentFlyingTime = $FleetRow['fleet_start_time'] - $FleetRow['start_time']; - } - } else { - // C'est quoi le stationnement ?? - // On calcule sagement la parcelle de temps ecoulée depuis le depart - $CurrentFlyingTime = time() - $FleetRow['start_time']; - } - // Allez houste au bout du compte y a la maison !! (E.T. phone home.............) - $ReturnFlyingTime = $CurrentFlyingTime + time(); + if ($FleetRow['fleet_owner'] == $user['id']) { + if ($FleetRow['fleet_mess'] == 0 || $FleetRow['fleet_mess'] == 2) { + if ($FleetRow['fleet_end_stay'] != 0) { + // Faut calculer le temps reel de retour + if ($FleetRow['fleet_start_time'] > time()) { + // On a pas encore entamé le stationnement + // Il faut calculer la parcelle de temps ecoulée depuis le lancement de la flotte + $CurrentFlyingTime = time() - $FleetRow['start_time']; + } else { + // On est deja en stationnement + // Il faut donc directement calculer la durée d'un vol aller ou retour + $CurrentFlyingTime = $FleetRow['fleet_start_time'] - $FleetRow['start_time']; + } + } else { + // C'est quoi le stationnement ?? + // On calcule sagement la parcelle de temps ecoulée depuis le depart + $CurrentFlyingTime = time() - $FleetRow['start_time']; + } + $ReturnFlyingTime = $CurrentFlyingTime + time(); - $QryUpdateFleet = "UPDATE {{table}} SET "; - $QryUpdateFleet .= "`fleet_start_time` = '". (time() - 1) ."', "; - $QryUpdateFleet .= "`fleet_end_stay` = '0', "; - $QryUpdateFleet .= "`fleet_end_time` = '". ($ReturnFlyingTime + 1) ."', "; - $QryUpdateFleet .= "`fleet_target_owner` = '". $user['id'] ."', "; - $QryUpdateFleet .= "`fleet_mess` = '1' "; - $QryUpdateFleet .= "WHERE "; - $QryUpdateFleet .= "`fleet_id` = '" . $fleetid . "';"; - doquery( $QryUpdateFleet, 'fleets'); + $writeAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_write'); + $writeAdapter->update() + ->into($writeAdapter->getTable('fleets')) + ->set('fleet_start_time', time()) + ->set('fleet_end_stay', 0) + ->set('fleet_end_time', $ReturnFlyingTime) + ->set('fleet_target_owner', $user->getId()) + ->set('fleet_mess', 1) + ->where('fleet_id', $fleetid) + ->execute() + ; - $BoxTitle = $lang['fl_sback']; - $TxtColor = "lime"; - $BoxMessage = $lang['fl_isback']; - } elseif ($FleetRow['fleet_mess'] == 1) { - $BoxMessage = $lang['fl_notback']; - } - } else { - $BoxMessage = $lang['fl_onlyyours']; - } - } + $BoxTitle = $lang['fl_sback']; + $TxtColor = "lime"; + $BoxMessage = $lang['fl_isback']; + } elseif ($FleetRow['fleet_mess'] == 1) { + $BoxMessage = $lang['fl_notback']; + } + } else { + $BoxMessage = $lang['fl_onlyyours']; + } +} - message ("". $BoxMessage ."", $BoxTitle, "fleet.". PHPEXT, 2); - -// ----------------------------------------------------------------------------------------------------------- -?> +message ($BoxMessage, $BoxTitle, "fleet.". PHPEXT, 2); diff --git a/src/floten1.php b/src/floten1.php index a3c0816..4ad8c27 100644 --- a/src/floten1.php +++ b/src/floten1.php @@ -255,14 +255,15 @@ $page .= "". $lang['fl_myplanets'] .""; $page .= ""; // Gestion des raccourcis vers ses propres colonies ou planetes -$kolonien = SortUserPlanets ( $user ); -$currentplanet = doquery("SELECT * FROM {{table}} WHERE id = '" . $user['current_planet'] . "'", 'planets', true); +$kolonien = $user->getPlanetCollection(); +$currentplanet = $user->getCurrentPlanet(); if ($kolonien->rowCount() > 1) { $i = 0; $w = 0; $tr = true; - while ($row = $kolonien->fetch(PDO::FETCH_BOTH)) { + foreach ($user->getPlanetCollection() as $userPlanet) { + /** @var Wootook_Empire_Model_Planet $userPlanet */ if ($w == 0 && $tr) { $page .= ""; $tr = false; @@ -273,17 +274,13 @@ if ($kolonien->rowCount() > 1) { $tr = true; } - if ($row['planet_type'] == 3) { - $row['name'] .= " ". $lang['fl_shrtcup3']; + $name = $userPlanet->getName(); + if ($userPlanet->getType() == Wootook_Empire_Model_Planet::TYPE_MOON) { + $name .= " " . $lang['fl_shrtcup3']; } - if ($currentplanet['galaxy'] == $row['galaxy'] && - $currentplanet['system'] == $row['system'] && - $currentplanet['planet'] == $row['planet'] && - $currentplanet['planet_type'] == $row['planet_type'] ) { -// $page .= ''.$row['name'].' '.$row['galaxy'].':'.$row['system'].':'.$row['planet'].''; - } else { - $page .= "". $row['name'] ." ". $row['galaxy'] .":". $row['system'] .":". $row['planet'] .""; + if ($currentplanet->getId() != $userPlanet->getId()) { + $page .= "getGalaxy() .",". $userPlanet->getSystem() .",". $userPlanet->getPosition() .",". $userPlanet->getType() ."); shortInfo();\">". $name . " ". $userPlanet->getCoords() .""; $w++; $i++; } @@ -315,9 +312,14 @@ $maxExpedition = $user->getElement(Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHN $ExpeditionEnCours = 0; $EnvoiMaxExpedition = 0; if ($maxExpedition >= 1) { - $maxexpde = doquery("SELECT 1 FROM {{table}} WHERE `fleet_owner` = '".$user['id']."' AND `fleet_mission` = '15';", 'fleets'); - $ExpeditionEnCours = $maxexpde->rowCount(); - $maxexpde->closeCursor(); + $ExpeditionEnCours = $readAdapter->select() + ->column(new Wootook_Core_Database_Sql_Placeholder_Expression('COUNT(*)')) + ->from(array('fleet' => $readAdapter->getTable('fleets'))) + ->where('fleet_owner', $user->getId()) + ->where('fleet_mission', Legacies_Empire::ID_MISSION_EXPEDITION) + ->prepare() + ->fetchColumn() + ; $EnvoiMaxExpedition = 1 + floor($maxExpedition / 3); } diff --git a/src/floten2.php b/src/floten2.php index 1f5f728..a679acd 100644 --- a/src/floten2.php +++ b/src/floten2.php @@ -182,21 +182,30 @@ if ($planetrow->isPlanet()) { $TableTitle = "{$planetrow->getCoords()} - {$lang['fl_moon']}"; } +$readAdapter = Wootook_Core_Database_ConnectionManager::getSingleton()->getConnection('core_read'); $maxExpedition = $user->getElement(Legacies_Empire::ID_RESEARCH_EXPEDITION_TECHNOLOGY); $ExpeditionEnCours = 0; $EnvoiMaxExpedition = 0; if ($maxExpedition >= 1) { - $maxexpde = doquery("SELECT 1 FROM {{table}} WHERE `fleet_owner` = '".$user['id']."' AND `fleet_mission` = '15';", 'fleets'); - $ExpeditionEnCours = $maxexpde->rowCount(); - $maxexpde->closeCursor(); + $ExpeditionEnCours = $readAdapter->select() + ->column(new Wootook_Core_Database_Sql_Placeholder_Expression('COUNT(*)')) + ->from(array('fleet' => $readAdapter->getTable('fleets'))) + ->where('fleet_owner', $user->getId()) + ->where('fleet_mission', Legacies_Empire::ID_MISSION_EXPEDITION) + ->prepare() + ->fetchColumn() + ; - $EnvoiMaxExpedition = 1 + floor($maxExpedition / 3); + $EnvoiMaxExpedition = 1 + floor(sqrt($maxExpedition)); } -$maxfleet = doquery("SELECT 1 FROM {{table}} WHERE `fleet_owner` = '".$user['id']."';", 'fleets'); - -$MaxFlyingFleets = $maxfleet->rowCount(); -$maxfleet->closeCursor(); +$MaxFlyingFleets = $readAdapter->select() + ->column(new Wootook_Core_Database_Sql_Placeholder_Expression('COUNT(*)')) + ->from(array('fleet' => $readAdapter->getTable('fleets'))) + ->where('fleet_owner', $user->getId()) + ->prepare() + ->fetchColumn() +; $page = ""; $page .= "