Skip to content

Commit

Permalink
Updated page display
Browse files Browse the repository at this point in the history
Updated signature image generator
Navigation menu has been finalized
Some deprectaed templates has been removed
Fixed registration
Fixed galaxy notices messages

Signed-off-by: Gregory PLANCHAT <[email protected]>
  • Loading branch information
gplanchat committed Oct 24, 2011
1 parent ec7e40e commit 6d61e93
Show file tree
Hide file tree
Showing 67 changed files with 10,177 additions and 940 deletions.
65 changes: 4 additions & 61 deletions admin/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function DisplayGameSettingsPage ( $CurrentUser ) {
includeLang('admin/settings');

if (in_array((int) $CurrentUser['authlevel'], array(LEVEL_ADMIN))) {
if ($_POST['opt_save'] == "1") {
if (isset($_POST['opt_save']) && $_POST['opt_save'] == "1") {
// Jeu Ouvert ou Ferm� !
if (isset($_POST['closed']) && $_POST['closed'] == 'on') {
$gameConfig['game_disable'] = "1";
Expand Down Expand Up @@ -189,64 +189,8 @@ function DisplayGameSettingsPage ( $CurrentUser ) {
$gameConfig['enable_bbcode'] = $_POST['bbcode_field'];
}

// Activation du jeu
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['game_disable'] ."' WHERE `config_name` = 'game_disable';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['close_reason'] ."' WHERE `config_name` = 'close_reason';", 'config');
$gameConfig->save();

//Stats

doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['stat_settings'] ."' WHERE `config_name` = 'stat_settings';", 'config');


// Configuration du Jeu
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['forum_url'] ."' WHERE `config_name` = 'forum_url';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['game_name'] ."' WHERE `config_name` = 'game_name';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['game_speed'] ."' WHERE `config_name` = 'game_speed';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['fleet_speed'] ."' WHERE `config_name` = 'fleet_speed';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['resource_multiplier'] ."' WHERE `config_name` = 'resource_multiplier';", 'config');

// Page Generale
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewNewsFrame'] ."' WHERE `config_name` = 'OverviewNewsFrame';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewNewsText'] ."' WHERE `config_name` = 'OverviewNewsText';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewExternChat'] ."' WHERE `config_name` = 'OverviewExternChat';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewExternChatCmd'] ."' WHERE `config_name` = 'OverviewExternChatCmd';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewBanner'] ."' WHERE `config_name` = 'OverviewBanner';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['OverviewClickBanner'] ."' WHERE `config_name` = 'OverviewClickBanner';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['ForumBannerFrame'] ."' WHERE `config_name` = 'ForumBannerFrame';", 'config');

//Bannière
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['banner_source_post'] ."' WHERE `config_name` = 'banner_source_post';", 'config');

// Lien supplémentaire dans le menu
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['link_enable'] ."' WHERE `config_name` = 'link_enable';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['link_name'] ."' WHERE `config_name` = 'link_name';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['link_url'] ."' WHERE `config_name` = 'link_url';", 'config');

// Options Planete
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['initial_fields'] ."' WHERE `config_name` = 'initial_fields';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['metal_basic_income'] ."' WHERE `config_name` = 'metal_basic_income';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['crystal_basic_income'] ."' WHERE `config_name` = 'crystal_basic_income';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['deuterium_basic_income'] ."' WHERE `config_name` = 'deuterium_basic_income';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['energy_basic_income'] ."' WHERE `config_name` = 'energy_basic_income';", 'config');

//Bot antimulti
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['bot_name'] ."' WHERE `config_name` = 'bot_name';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['bot_adress'] ."' WHERE `config_name` = 'bot_adress';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['ban_duration'] ."' WHERE `config_name` = 'ban_duration';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['enable_bot'] ."' WHERE `config_name` = 'enable_bot';", 'config');


//Réglage du BBCode
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['enable_bbcode'] ."' WHERE `config_name` = 'enable_bbcode';", 'config');


//Controle des pages
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['enable_announces'] ."' WHERE `config_name` = 'enable_announces';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['enable_marchand'] ."' WHERE `config_name` = 'enable_marchand';", 'config');
doquery("UPDATE {{table}} SET `config_value` = '". $gameConfig['enable_notes'] ."' WHERE `config_name` = 'enable_notes';", 'config');

// Mode Debug
doquery("UPDATE {{table}} SET `config_value` = '" .$gameConfig['debug'] ."' WHERE `config_name` ='debug'", 'config');
AdminMessage ('Options changees avec succes !', 'Succes', '?');
} else {

Expand Down Expand Up @@ -295,7 +239,7 @@ function DisplayGameSettingsPage ( $CurrentUser ) {
$parse['bannerframe'] = ($gameConfig['ForumBannerFrame'] == 1) ? " checked = 'checked' ":"";

$PageTPL = gettemplate('admin/options_body');
$Page .= parsetemplate( $PageTPL, $parse );
$Page = parsetemplate( $PageTPL, $parse );

display ( $Page, $lang['adm_opt_title'], false, '', true );
}
Expand All @@ -305,6 +249,5 @@ function DisplayGameSettingsPage ( $CurrentUser ) {
return $Page;
}

$Page = DisplayGameSettingsPage ( $user );
$Page = DisplayGameSettingsPage($user);

?>
18 changes: 9 additions & 9 deletions admin/statbuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@

$StatDate = time();
// Rotation des statistiques
doquery ( "DELETE FROM {{table}} WHERE `stat_code` = '2';" , 'statpoints');
doquery ( "DELETE FROM {{table}} WHERE `stat_code` >= '10';" , 'statpoints');
doquery ( "UPDATE {{table}} SET `stat_code` = `stat_code` + '1';" , 'statpoints');

$GameUsers = doquery("SELECT * FROM {{table}} WHERE authlevel<3", 'users');

while ($CurUser = $GameUsers->fetch(PDO::FETCH_ASSOC)) {
// Recuperation des anciennes statistiques
$OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '".$CurUser['id']."';",'statpoints');
$OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `id_owner` = '".$CurUser['id']."';", 'statpoints', true);
if ($OldStatRecord) {
$OldTotalRank = $OldStatRecord['total_rank'];
$OldTechRank = $OldStatRecord['tech_rank'];
Expand Down Expand Up @@ -81,7 +81,7 @@
$GCount = $TTechCount;
$GPoints = $TTechPoints;
$UsrPlanets = doquery("SELECT * FROM {{table}} WHERE `id_owner` = '". $CurUser['id'] ."';", 'planets');
while ($CurPlanet = mysql_fetch_assoc($UsrPlanets) ) {
while ($CurPlanet = $UsrPlanets->fetch(PDO::FETCH_ASSOC)) {
$Points = GetBuildPoints ( $CurPlanet );
$TBuildCount += $Points['BuildCount'];
$GCount += $Points['BuildCount'];
Expand Down Expand Up @@ -134,7 +134,7 @@

$Rank = 1;
$RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `tech_points` DESC;", 'statpoints');
while ($TheRank = mysql_fetch_assoc($RankQry) ) {
while ($TheRank = $RankQry->fetch(PDO::FETCH_ASSOC)) {
$QryUpdateStats = "UPDATE {{table}} SET ";
$QryUpdateStats .= "`tech_rank` = '". $Rank ."' ";
$QryUpdateStats .= "WHERE ";
Expand All @@ -145,7 +145,7 @@

$Rank = 1;
$RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `build_points` DESC;", 'statpoints');
while ($TheRank = mysql_fetch_assoc($RankQry) ) {
while ($TheRank = $RankQry->fetch(PDO::FETCH_ASSOC) ) {
$QryUpdateStats = "UPDATE {{table}} SET ";
$QryUpdateStats .= "`build_rank` = '". $Rank ."' ";
$QryUpdateStats .= "WHERE ";
Expand All @@ -156,7 +156,7 @@

$Rank = 1;
$RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `defs_points` DESC;", 'statpoints');
while ($TheRank = mysql_fetch_assoc($RankQry) ) {
while ($TheRank = $RankQry->fetch(PDO::FETCH_ASSOC)) {
$QryUpdateStats = "UPDATE {{table}} SET ";
$QryUpdateStats .= "`defs_rank` = '". $Rank ."' ";
$QryUpdateStats .= "WHERE ";
Expand All @@ -167,7 +167,7 @@

$Rank = 1;
$RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `fleet_points` DESC;", 'statpoints');
while ($TheRank = mysql_fetch_assoc($RankQry) ) {
while ($TheRank = $RankQry->fetch(PDO::FETCH_ASSOC)) {
$QryUpdateStats = "UPDATE {{table}} SET ";
$QryUpdateStats .= "`fleet_rank` = '". $Rank ."' ";
$QryUpdateStats .= "WHERE ";
Expand All @@ -178,7 +178,7 @@

$Rank = 1;
$RankQry = doquery("SELECT * FROM {{table}} WHERE `stat_type` = '1' AND `stat_code` = '1' ORDER BY `total_points` DESC;", 'statpoints');
while ($TheRank = mysql_fetch_assoc($RankQry) ) {
while ($TheRank = $RankQry->fetch(PDO::FETCH_ASSOC)) {
$QryUpdateStats = "UPDATE {{table}} SET ";
$QryUpdateStats .= "`total_rank` = '". $Rank ."' ";
$QryUpdateStats .= "WHERE ";
Expand All @@ -192,7 +192,7 @@

while ($CurAlly = $GameAllys->fetch(PDO::FETCH_ASSOC)) {
// Recuperation des anciennes statistiques
$OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '2' AND `id_owner` = '".$CurAlly['id']."';",'statpoints');
$OldStatRecord = doquery ("SELECT * FROM {{table}} WHERE `stat_type` = '2' AND `id_owner` = '".$CurAlly['id']."';",'statpoints', true);
if ($OldStatRecord) {
$OldTotalRank = $OldStatRecord['total_rank'];
$OldTechRank = $OldStatRecord['tech_rank'];
Expand Down
8 changes: 4 additions & 4 deletions admin/statfunctions.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function GetTechnoPoints ( $CurrentUser ) {
foreach ( $reslist['tech'] as $n => $Techno ) {
if ( $CurrentUser[ $resource[ $Techno ] ] > 0 ) {
for ( $Level = 1; $Level < $CurrentUser[ $resource[ $Techno ] ]; $Level++ ) {
$Units = $pricelist[ $Techno ]['metal'] + $pricelist[ $Techno ]['crystal'] + $pricelist[ $Techno ]['deuterium'];
$Units = $pricelist[ $Techno ]['metal'] + $pricelist[ $Techno ]['cristal'] + $pricelist[ $Techno ]['deuterium'];
$LevelMul = pow( $pricelist[ $Techno ]['factor'], $Level );
$TechPoints += ($Units * $LevelMul);
$TechCounts += 1;
Expand All @@ -57,7 +57,7 @@ function GetBuildPoints ( $CurrentPlanet ) {
foreach($reslist['build'] as $n => $Building) {
if ( $CurrentPlanet[ $resource[ $Building ] ] > 0 ) {
for ( $Level = 1; $Level < $CurrentPlanet[ $resource[ $Building ] ]; $Level++ ) {
$Units = $pricelist[ $Building ]['metal'] + $pricelist[ $Building ]['crystal'] + $pricelist[ $Building ]['deuterium'];
$Units = $pricelist[ $Building ]['metal'] + $pricelist[ $Building ]['cristal'] + $pricelist[ $Building ]['deuterium'];
$LevelMul = pow( $pricelist[ $Building ]['factor'], $Level );
$BuildPoints += ($Units * $LevelMul);
$BuildCounts += 1;
Expand All @@ -77,7 +77,7 @@ function GetDefensePoints ( $CurrentPlanet ) {
$DefensePoints = 0;
foreach($reslist['defense'] as $n => $Defense) {
if ($CurrentPlanet[ $resource[ $Defense ] ] > 0) {
$Units = $pricelist[ $Defense ]['metal'] + $pricelist[ $Defense ]['crystal'] + $pricelist[ $Defense ]['deuterium'];
$Units = $pricelist[ $Defense ]['metal'] + $pricelist[ $Defense ]['cristal'] + $pricelist[ $Defense ]['deuterium'];
$DefensePoints += ($Units * $CurrentPlanet[ $resource[ $Defense ] ]);
$DefenseCounts += $CurrentPlanet[ $resource[ $Defense ] ];
}
Expand All @@ -95,7 +95,7 @@ function GetFleetPoints ( $CurrentPlanet ) {
$FleetPoints = 0;
foreach($reslist['fleet'] as $n => $Fleet) {
if ($CurrentPlanet[ $resource[ $Fleet ] ] > 0) {
$Units = $pricelist[ $Fleet ]['metal'] + $pricelist[ $Fleet ]['crystal'] + $pricelist[ $Fleet ]['deuterium'];
$Units = $pricelist[ $Fleet ]['metal'] + $pricelist[ $Fleet ]['cristal'] + $pricelist[ $Fleet ]['deuterium'];
$FleetPoints += ($Units * $CurrentPlanet[ $resource[ $Fleet ] ]);
$FleetCounts += $CurrentPlanet[ $resource[ $Fleet ] ];
}
Expand Down
4 changes: 1 addition & 3 deletions application/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
defined('ROOT_PATH') || define('ROOT_PATH', dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR);
defined('APPLICATION_PATH') || define('APPLICATION_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);

defined('PHPEXT') || define('PHPEXT', require 'extension.inc');
defined('PHPEXT') || define('PHPEXT', 'php');

defined('VERSION') || define('VERSION', '2011.1');

Expand All @@ -87,8 +87,6 @@ function __autoload($class) {

$lang = array();

define('TEMPLATE_DIR', realpath(ROOT_PATH . '/templates/'));
define('TEMPLATE_NAME', 'OpenGame');
define('DEFAULT_LANG', 'fr');

include(ROOT_PATH . 'includes/debug.class.'.PHPEXT);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?php
/**
* This file is part of Wootook
*
* @license http://www.gnu.org/licenses/agpl-3.0.txt
* @see http://www.wootook.com/
*
* Copyright (c) 2011-Present, Grégory PLANCHAT <[email protected]>
* All rights reserved.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* 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 Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* --> NOTICE <--
* This file is part of the core development branch, changing its contents will
* make you unable to use the automatic updates manager. Please refer to the
* documentation for further information about customizing Wootook.
*
*/

/**
*
* Enter description here ...
* @author Greg
*
*/
class Legacies_Empire_Block_Planet_Shipyard_Queue_Item
extends Wootook_Empire_Block_Planet_Builder_Queue_ItemAbstract
{
protected $_itemIdField = 'research_id';

public function getLevel()
{
return $this->getPlanet()->getElement($this->getItemId());
}

public function getResourcesNeeded($level)
{
return $this->getPlanet()->getShipyard()->getResourcesNeeded($this->getItemId(), 1);
}

public function getBuildingTime($qty)
{
return $this->getPlanet()->getShipyard()->getBuildingTime($this->getItemId(), $qty);
}

public function getResourcesConfigForLevel($qty)
{
$resources = $this->getResourcesNeeded($qty);

$resourceConfig = array();
foreach ($resources as $resourceId => $resourceValue) {
$resourceConfig[$resourceId] = new Wootook_Object(array(
'resource_id' => $resourceId,
'value' => $resourceValue
));

$amount = $this->getPlanet()->getResourceAmount($resourceId);
if (Math::comp($amount, $resourceValue) < 0) {
$resourceConfig[$resourceId]->setData('requirement', Math::sub($amount, $resourceValue));
} else {
$resourceConfig[$resourceId]->setData('overflow', Math::sub($amount, $resourceValue));
}
}
return $resourceConfig;
}

public function getResourcesConfigForNextLevel()
{
return $this->getResourcesConfigForLevel($this->getNextLevel());
}

public function getBuildingTimeForNextLevel()
{
return $this->getBuildingTime($this->getNextLevel());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,12 @@ public function appendQueue($shipId, $qty, $time)
return $this;
}

$this->enqueue($shipId, $qty, $time);
$this->enqueue(array(
'ship_id' => $shipId,
'qty' => $qty,
'created_at' => $time,
'updated_at' => $time
));
$this->_currentPlanet->setData('b_hangar_id', $this->serialize());

foreach ($remainingAmounts as $resourceId => $resourceAmount) {
Expand Down
8 changes: 4 additions & 4 deletions application/code/core/Legacies/Officers/Model/Observer.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ public static function planetUpdateListener($eventData)
if ($user->getData('lvl_minier') < $level) {
$difference = $level - $user->getData('lvl_minier');
if ($difference == 1) {
Wootook::getSession(Legacies_Empire_Model_User::SESSION_KEY)
Wootook::getSession(Wootook_Empire_Model_User::SESSION_KEY)
->addInfo('You gained 1 miner level.');
} else {
Wootook::getSession(Legacies_Empire_Model_User::SESSION_KEY)
Wootook::getSession(Wootook_Empire_Model_User::SESSION_KEY)
->addInfo('You gained %1$d miner level.', (int) $difference);
}
}
Expand All @@ -58,10 +58,10 @@ public static function planetUpdateListener($eventData)
if ($user->getData('lvl_raid') < $level) {
$difference = $level - $user->getData('lvl_raid');
if ($difference == 1) {
Wootook::getSession(Legacies_Empire_Model_User::SESSION_KEY)
Wootook::getSession(Wootook_Empire_Model_User::SESSION_KEY)
->addInfo('You gained 1 raider level.');
} else {
Wootook::getSession(Legacies_Empire_Model_User::SESSION_KEY)
Wootook::getSession(Wootook_Empire_Model_User::SESSION_KEY)
->addInfo('You gained %1$d raider level.', (int) $difference);
}
}
Expand Down
Loading

0 comments on commit 6d61e93

Please sign in to comment.