当前位置: 首页>>代码示例>>PHP>>正文


PHP colorNumber函数代码示例

本文整理汇总了PHP中colorNumber函数的典型用法代码示例。如果您正苦于以下问题:PHP colorNumber函数的具体用法?PHP colorNumber怎么用?PHP colorNumber使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了colorNumber函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ShowTopNavigationBar

/**
 * ShowTopNavigationBar.php
 *
 * @version 1
 * @copyright 2008 By Chlorel for XNova
 */
function ShowTopNavigationBar($CurrentUser, $CurrentPlanet)
{
    global $lang, $_GET, $game_config;
    if ($CurrentUser) {
        if (!$CurrentPlanet) {
            $CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $CurrentUser['current_planet'] . "';", 'planets', true);
        }
        // Actualisation des ressources de la planete
        if ($CurrentUser['urlaubs_modus'] == 0) {
            PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time());
        } else {
            //doquery ( "UPDATE {{table}} SET `last_update` = ".time()." WHERE id_owner = ".$CurrentUser['id'],"planets");
            doquery("UPDATE {{table}} SET `deuterium_sintetizer_porcent` = 0, `metal_mine_porcent` = 0, `crystal_mine_porcent` = 0 WHERE id_owner = " . $CurrentUser['id'], "planets");
        }
        $NavigationTPL = gettemplate('topnav');
        $dpath = !$CurrentUser["dpath"] ? DEFAULT_SKINPATH : $CurrentUser["dpath"];
        $parse = $lang;
        $parse['dpath'] = $dpath;
        $parse['image'] = $CurrentPlanet['image'];
        $parse['show_umod_notice'] = $CurrentUser['urlaubs_modus'] ? '<table width="100%" style="border: 1px solid red; text-align:center;"><tr><td>Urlaubsmodus bis ' . date('d.m.Y h:i:s', $CurrentUser['urlaubs_modus_time']) . '</td></tr></table>' : '';
        // Genearation de la combo des planetes du joueur
        $parse['planetlist'] = '';
        $ThisUsersPlanets = SortUserPlanets($CurrentUser);
        while ($CurPlanet = mysql_fetch_array($ThisUsersPlanets)) {
            if ($CurPlanet["destruyed"] == 0) {
                $parse['planetlist'] .= "\n<option ";
                if ($CurPlanet['id'] == $CurrentUser['current_planet']) {
                    // Bon puisque deja on s'y trouve autant le marquer
                    $parse['planetlist'] .= "selected=\"selected\" ";
                }
                $parse['planetlist'] .= "value=\"?cp=" . $CurPlanet['id'] . "";
                $parse['planetlist'] .= "&amp;mode=" . $_GET['mode'];
                $parse['planetlist'] .= "&amp;re=0\">";
                // Nom et coordonnées de la planete
                $parse['planetlist'] .= "" . $CurPlanet['name'];
                $parse['planetlist'] .= "&nbsp;[" . $CurPlanet['galaxy'] . ":";
                $parse['planetlist'] .= "" . $CurPlanet['system'] . ":";
                $parse['planetlist'] .= "" . $CurPlanet['planet'];
                $parse['planetlist'] .= "]&nbsp;&nbsp;</option>";
            }
        }
        $energy = $CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"] . "/" . pretty_number($CurrentPlanet["energy_max"]);
        // Energie
        if ($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"] < 0) {
            $parse['energy'] = colorRed($energy);
        } else {
            $parse['energy'] = $energy;
        }
        // Metal
        $metal = pretty_number($CurrentPlanet["metal"]);
        if ($CurrentPlanet["metal"] > $CurrentPlanet["metal_max"]) {
            $parse['metal'] = colorRed($metal);
        } else {
            $parse['metal'] = $metal;
        }
        // Cristal
        $crystal = pretty_number($CurrentPlanet["crystal"]);
        if ($CurrentPlanet["crystal"] > $CurrentPlanet["crystal_max"]) {
            $parse['crystal'] = colorRed($crystal);
        } else {
            $parse['crystal'] = $crystal;
        }
        // Deuterium
        $deuterium = pretty_number($CurrentPlanet["deuterium"]);
        if ($CurrentPlanet["deuterium"] > $CurrentPlanet["deuterium_max"]) {
            $parse['deuterium'] = colorRed($deuterium);
        } else {
            $parse['deuterium'] = $deuterium;
        }
        // JAVASCRIPT REALTIME RESS
        $parse['energy_total'] = colorNumber(pretty_number(floor($CurrentPlanet['energy_max'] + $CurrentPlanet["energy_used"]) - $parse['energy_basic_income']));
        // Metal maximo
        if ($CurrentPlanet["metal_max"] * MAX_OVERFLOW < $CurrentPlanet["metal"]) {
            $parse['metal_max'] = '<font color="#ff0000">';
        } else {
            $parse['metal_max'] = '<font color="#00ff00">';
        }
        $parse['metal_max'] .= pretty_number($CurrentPlanet["metal_max"] / 1) . " {$lang['']}</font>";
        // Cristal maximo
        if ($CurrentPlanet["crystal_max"] * MAX_OVERFLOW < $CurrentPlanet["crystal"]) {
            $parse['crystal_max'] = '<font color="#ff0000">';
        } else {
            $parse['crystal_max'] = '<font color="#00ff00">';
        }
        $parse['crystal_max'] .= pretty_number($CurrentPlanet["crystal_max"] / 1) . " {$lang['']}";
        // Deuterio maximo
        if ($CurrentPlanet["deuterium_max"] * MAX_OVERFLOW < $CurrentPlanet["deuterium"]) {
            $parse['deuterium_max'] = '<font color="#ff0000">';
        } else {
            $parse['deuterium_max'] = '<font color="#00ff00">';
        }
        $parse['deuterium_max'] .= pretty_number($CurrentPlanet["deuterium_max"] / 1) . " {$lang['']}";
        if ($CurrentPlanet['energy_max'] == 0 && abs($CurrentPlanet['energy_used']) >= 0) {
            $plevel = 0;
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:ShowTopNavigationBar.php

示例2: BuildRessourcePage

function BuildRessourcePage($CurrentUser, $CurrentPlanet, $hide = '')
{
    global $lang, $ProdGrid, $resource, $reslist, $game_config, $_POST;
    includeLang('resources');
    if ($user['urlaubs_modus'] == 1) {
        message($lang['Vacation_mode'], $lang['Error'], "overview.php", 1);
    }
    $Caps = ProductionRate($CurrentUser, $CurrentPlanet);
    //print_r($Caps);
    $RessBodyTPL = gettemplate('resources');
    $RessRowTPL = gettemplate('resources_row');
    // Si c'est une lune ... pas de ressources produites
    if ($CurrentPlanet['planet_type'] == 3) {
        $game_config['metal_basic_income'] = 0;
        $game_config['crystal_basic_income'] = 0;
        $game_config['deuterium_basic_income'] = 0;
        $game_config['appolonium_basic_income'] = $game_config['appolonium_basic_income'];
    }
    if ($CurrentPlanet['planet_type'] == 1) {
        $game_config['appolonium_basic_income'] = 0;
    }
    $ValidList['percent'] = array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100);
    $SubQry = "";
    if ($_POST) {
        foreach ($_POST as $Field => $Value) {
            $FieldName = $Field . "_porcent";
            if (isset($CurrentPlanet[$FieldName])) {
                if (!in_array($Value, $ValidList['percent'])) {
                    header("Location: ./?s=" . UNI . "&page=resources&mode=resources");
                    exit;
                }
                $Value = $Value / 10;
                $CurrentPlanet[$FieldName] = $Value;
                $SubQry .= ", `" . $FieldName . "` = '" . $Value . "'";
            }
        }
    }
    $parse = $lang;
    $parse['production_level'] = 100;
    $post_porcent = $Caps['production_factor'];
    // -------------------------------------------------------------------------------------------------------
    // Mise a jour de l'espace de stockage
    $CurrentPlanet['metal_max'] = $Caps['metal_max'];
    $CurrentPlanet['crystal_max'] = $Caps['crystal_max'];
    $CurrentPlanet['deuterium_max'] = $Caps['deuterium_max'];
    $CurrentPlanet['appolonium_max'] = $Caps['appolonium_max'];
    // -------------------------------------------------------------------------------------------------------
    $parse['resource_row'] = "";
    $CurrentPlanet['metal_perhour'] = $Caps['metal_perhour'];
    $CurrentPlanet['crystal_perhour'] = $Caps['crystal_perhour'];
    $CurrentPlanet['deuterium_perhour'] = $Caps['deuterium_perhour'];
    $CurrentPlanet['appolonium_perhour'] = $Caps['appolonium_perhour'];
    $CurrentPlanet['energy_max'] = $Caps['energy_max'];
    $CurrentPlanet['energy_used'] = $Caps['energy_used'];
    $countforalt = 0;
    foreach ($reslist['prod'] as $ProdID) {
        $ignore = array(22, 23, 24, 25);
        if (!in_array($ProdID, $ignore)) {
            $countforalt++;
            $metal = $Caps[$ProdID]['metal_perhour'];
            $crystal = $Caps[$ProdID]['crystal_perhour'];
            $deuterium = $Caps[$ProdID]['deuterium_perhour'];
            $appolonium = $Caps[$ProdID]['appolonium_perhour'];
            $energy = $Caps[$ProdID]['energy_max'] + $Caps[$ProdID]['energy_used'];
            $Field = $resource[$ProdID] . "_porcent";
            $CurrRow = array();
            $CurrRow['name'] = $resource[$ProdID];
            $CurrRow['porcent'] = $CurrentPlanet[$Field];
            for ($Option = 10; $Option >= 0; $Option--) {
                $OptValue = $Option * 10;
                if ($Option == $CurrRow['porcent']) {
                    $OptSelected = " selected=selected";
                } else {
                    $OptSelected = "";
                }
                $CurrRow['option'] .= "<option value=\"" . $OptValue . "\"" . $OptSelected . ">" . $OptValue . "%</option>";
            }
            $CurrRow['type'] = $lang['tech'][$ProdID];
            $CurrRow['level'] = $ProdID > 200 ? $lang['quantity'] : $lang['level'];
            $CurrRow['level_type'] = $CurrentPlanet[$resource[$ProdID]];
            $CurrRow['metal_type'] = pretty_number($metal);
            $CurrRow['crystal_type'] = pretty_number($crystal);
            $CurrRow['deuterium_type'] = pretty_number($deuterium);
            $CurrRow['appolonium_type'] = pretty_number($appolonium);
            $CurrRow['energy_type'] = pretty_number($energy);
            $CurrRow['metal_type'] = colorNumber($CurrRow['metal_type']);
            $CurrRow['crystal_type'] = colorNumber($CurrRow['crystal_type']);
            $CurrRow['deuterium_type'] = colorNumber($CurrRow['deuterium_type']);
            $CurrRow['appolonium_type'] = colorNumber($CurrRow['appolonium_type']);
            $CurrRow['energy_type'] = colorNumber($CurrRow['energy_type']);
            $CurrRow['alt'] = "";
            if ($countforalt % 2 == 0) {
                $CurrRow['alt'] = "alt";
            }
            $parse['resource_row'] .= parsetemplate($RessRowTPL, $CurrRow);
        }
    }
    $parse['Production_of_resources_in_the_planet'] = str_replace('%s', $CurrentPlanet['name'], $lang['Production_of_resources_in_the_planet']);
    if ($CurrentPlanet['energy_max'] == 0 && $CurrentPlanet['energy_used'] > 0) {
        $parse['production_level'] = 0;
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:resources.php

示例3: BuildRessourcePage


//.........这里部分代码省略.........
                $energy *= 1 + ($CurrentUser['rpg_ingenieur'] * 0.05 + $CurrentUser['energy_tech'] * 0.01);
                $CurrentPlanet['energy_max'] += $energy;
            } else {
                $CurrentPlanet['energy_used'] += $energy;
            }
            $CurrentPlanet['metal_perhour'] += $metal;
            $CurrentPlanet['crystal_perhour'] += $crystal;
            if ($deuterium < 0) {
                $CurrentPlanet['deuterium_used'] = $deuterium;
            } else {
                $deuterium_offi += $deuterium * ($CurrentUser['rpg_geologue'] * 0.05);
                $deuterium *= 1 + $CurrentUser['rpg_geologue'] * 0.05;
                $CurrentPlanet['deuterium_perhour'] += $deuterium;
                $deuterium *= 0.01 * $post_porcent;
            }
            $metal = $metal * 0.01 * $post_porcent;
            $crystal = $crystal * 0.01 * $post_porcent;
            $Field = $resource[$ProdID] . "_porcent";
            $CurrRow = array();
            $CurrRow['name'] = $resource[$ProdID];
            $CurrRow['porcent'] = $CurrentPlanet[$Field];
            for ($Option = 10; $Option >= 0; $Option--) {
                $OptValue = $Option * 10;
                if ($Option == $CurrRow['porcent']) {
                    $OptSelected = " selected=selected";
                } else {
                    $OptSelected = "";
                }
                $CurrRow['option'] .= "<option value=\"" . $OptValue . "\"" . $OptSelected . ">" . $OptValue . "%</option>";
            }
            $CurrRow['type'] = $lang['tech'][$ProdID];
            $CurrRow['level'] = $ProdID > 200 ? $lang['quantity'] : $lang['level'];
            $CurrRow['level_type'] = $CurrentPlanet[$resource[$ProdID]];
            $CurrRow['metal_type'] = colorNumber(pretty_number(floor($metal)));
            $CurrRow['crystal_type'] = colorNumber(pretty_number(floor($crystal)));
            $CurrRow['deuterium_type'] = colorNumber(pretty_number(zround($deuterium)));
            $CurrRow['energy_type'] = colorNumber(pretty_number(zround($energy)));
            $parse['resource_row'] .= parsetemplate($RessRowTPL, $CurrRow);
        }
    }
    $parse['Production_of_resources_in_the_planet'] = str_replace('%s', $CurrentPlanet['name'], $lang['Production_of_resources_in_the_planet']);
    if ($CurrentPlanet['energy_max'] == 0 && abs($CurrentPlanet['energy_used']) >= 0) {
        $parse['production_level'] = 0;
    } elseif ($CurrentPlanet['energy_max'] > 0 && abs($CurrentPlanet['energy_used']) > $CurrentPlanet['energy_max']) {
        $parse['production_level'] = $CurrentPlanet['energy_max'] / abs($CurrentPlanet['energy_used']) * 100;
    } elseif ($CurrentPlanet['energy_max'] == 0 && abs($CurrentPlanet['energy_used']) > $CurrentPlanet['energy_max']) {
        $parse['production_level'] = 0;
    } else {
        $parse['production_level'] = 100;
    }
    if ($parse['production_level'] > 100) {
        $parse['production_level'] = 100;
    }
    $parse['metal_basic_income'] = $game_config['metal_basic_income'] * $game_config['resource_multiplier'];
    $parse['crystal_basic_income'] = $game_config['crystal_basic_income'] * $game_config['resource_multiplier'];
    $parse['deuterium_basic_income'] = $game_config['deuterium_basic_income'] * $game_config['resource_multiplier'];
    $parse['energy_basic_income'] = $game_config['energy_basic_income'] * $game_config['resource_multiplier'];
    if ($CurrentUser['energy_tech'] > 0) {
        $parse['energy_tech_bonus'] = '(+<font color="yellow">' . pretty_number(zround($energy_tech_bonus)) . '</font>)';
    } else {
        $parse['energy_tech_bonus'] = '<font color="yellow">-</font>';
    }
    if ($CurrentUser['rpg_geologue'] > 0) {
        $parse['metal_offi_bonus'] = '(+<font color="yellow">' . pretty_number(zround($metal_offi)) . '</font>)';
        $parse['crystal_offi_bonus'] = '(+<font color="yellow">' . pretty_number(zround($crystal_offi)) . '</font>)';
        $parse['deuterium_offi_bonus'] = '(+<font color="yellow">' . pretty_number(zround($deuterium_offi)) . '</font>)';
开发者ID:sonicmaster,项目名称:RPG,代码行数:67,代码来源:resources.php

示例4: echo_topnav


//.........这里部分代码省略.........
    $parse['image'] = $planetrow['image'];
    /*
      pequeño loop para agregar todos los planetas disponibles del mismo jugador...
    */
    $parse['planetlist'] = '';
    //pedimos todos los planetas que coincidan con el id del due�.
    $planets_list = doquery("SELECT id,name,galaxy,system,planet FROM {{table}} WHERE id_owner='{$user['id']}' ORDER BY sortID ASC", "planets");
    while ($p = mysql_fetch_array($planets_list)) {
        /*
          Cuando alguien selecciona destruir planeta, hay un tiempo en el que se vacia el slot
          del planeta, es mas que nada para dar tiempo a posible problema de hackeo o robo de cuenta.
        */
        if ($p["destruyed"] == 0) {
            //$pos_galaxy = doquery("SELECT * FROM {{table}} WHERE id_planet = {$p[id]}","galaxy",true);
            $parse['planetlist'] .= "<option ";
            if ($p["id"] == $user["current_planet"]) {
                $parse['planetlist'] .= 'selected="selected" ';
            }
            //Se selecciona el planeta actual
            $parse['planetlist'] .= 'value="?cp=' . $p['id'];
            if (isset($_GET['mode'])) {
                $parse['planetlist'] .= '&amp;mode=' . $_GET['mode'];
            }
            if (isset($_GET['gid'])) {
                $parse['planetlist'] .= '&amp;gid=' . $_GET['gid'];
            }
            if (isset($_GET['messageziel'])) {
                $parse['planetlist'] .= '&amp;messageziel=' . $_GET['messageziel'];
            }
            $parse['planetlist'] .= '&amp;re=0">';
            //Nombre [galaxy:system:planet]
            $parse['planetlist'] .= "{$p['name']} [{$p['galaxy']}:{$p['system']}:{$p['planet']}]</option>";
        }
    }
    /*
      Muestra los recursos, e indica si estos sobrepasan la capacidad de los almacenes
    */
    $resourceProducer = LWCore::getPlanet()->getProductionHandler()->getProductorObject('resource');
    $energyProd = $resourceProducer->getProduction('energy');
    $energy = pretty_number(($energyProd[1] - $energyProd[0]) * -3600) . "/" . pretty_number($energyProd[0] * 3600);
    //energy
    if ($energyProd[1] > $energyProd[0]) {
        $parse['energy'] = colorRed($energy);
    } else {
        $parse['energy'] = $energy;
    }
    //metal
    $metal = pretty_number(LWCore::getPlanet()->metal);
    $red = false;
    if ($resourceProducer->getProduction('metal') < 0) {
        if (LWCore::getPlanet()->metal < $resourceProducer->getSignificantLimit('metal')) {
            $red = true;
        }
    } else {
        if (LWCore::getPlanet()->metal > $resourceProducer->getSignificantLimit('metal')) {
            $red = true;
        }
    }
    if ($red) {
        $parse['metal'] = colorRed($metal);
    } else {
        $parse['metal'] = $metal;
    }
    //cristal
    $crystal = pretty_number(LWCore::getPlanet()->crystal);
    $red = false;
    if ($resourceProducer->getProduction('crystal') < 0) {
        if (LWCore::getPlanet()->crystal < $resourceProducer->getSignificantLimit('crystal')) {
            $red = true;
        }
    } else {
        if (LWCore::getPlanet()->crystal > $resourceProducer->getSignificantLimit('crystal')) {
            $red = true;
        }
    }
    if ($red) {
        $parse['crystal'] = colorRed($crystal);
    } else {
        $parse['crystal'] = $crystal;
    }
    //deuterium
    $deuterium = pretty_number(LWCore::getPlanet()->deuterium);
    $red = false;
    if ($resourceProducer->getProduction('deuterium') < 0) {
        if (LWCore::getPlanet()->deuterium < $resourceProducer->getSignificantLimit('deuterium')) {
            $red = true;
        }
    } else {
        if (LWCore::getPlanet()->deuterium > $resourceProducer->getSignificantLimit('deuterium')) {
            $red = true;
        }
    }
    if ($red) {
        $parse['deuterium'] = colorNumber($deuterium);
    } else {
        $parse['deuterium'] = $deuterium;
    }
    //esto es un hecho!
    echo parsetemplate(gettemplate('topnav'), $parse);
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:functions.php

示例5: colorNumber

//Total de los recursos
$parse['metal_total'] = colorNumber(floor($planetrow['metal_perhour'] * 0.01 * $parse['production_level']));
$parse['crystal_total'] = colorNumber(floor($planetrow['crystal_perhour'] * 0.01 * $parse['production_level']));
$parse['deuterium_total'] = colorNumber(floor($planetrow['deuterium_perhour'] * 0.01 * $parse['production_level']));
$parse['energy_total'] = colorNumber(floor($planetrow['energy_max'] - $planetrow["energy_used"]));
//tabla de valores extendidos
//colores de la tabla... no muy necesario creo yo...
$parse['daily_metal'] = colorNumber(number_format(floor($planetrow["metal_perhour"] * 24), 0, ",", "."));
$parse['weekly_metal'] = colorNumber(number_format(floor($planetrow["metal_perhour"] * 24 * 7), 0, ",", "."));
$parse['monthly_metal'] = colorNumber(number_format(floor($planetrow["metal_perhour"] * 24 * 30), 0, ",", "."));
$parse['daily_crystal'] = colorNumber(number_format(floor($planetrow["crystal_perhour"] * 24), 0, ",", "."));
$parse['weekly_crystal'] = colorNumber(number_format(floor($planetrow["crystal_perhour"] * 24 * 7), 0, ",", "."));
$parse['monthly_crystal'] = colorNumber(number_format(floor($planetrow["crystal_perhour"] * 24 * 30), 0, ",", "."));
$parse['daily_deuterium'] = colorNumber(number_format(floor($planetrow["deuterium_perhour"] * 24), 0, ",", "."));
$parse['weekly_deuterium'] = colorNumber(number_format(floor($planetrow["deuterium_perhour"] * 24 * 7), 0, ",", "."));
$parse['monthly_deuterium'] = colorNumber(number_format(floor($planetrow["deuterium_perhour"] * 24 * 30), 0, ",", "."));
//Porcentajes de minerias llenas
$parse['metal_storage'] = floor($planetrow["metal"] / $planetrow["metal_max"] * 100) . $lang['o/o'];
$parse['crystal_storage'] = floor($planetrow["crystal"] / $planetrow["crystal_max"] * 100) . $lang['o/o'];
$parse['deuterium_storage'] = floor($planetrow["deuterium"] / $planetrow["deuterium_max"] * 100) . $lang['o/o'];
//Las barras de porcentaje
$parse['metal_storage_bar'] = floor($planetrow["metal"] / $planetrow["metal_max"] * 100) * 2.5;
$parse['crystal_storage_bar'] = floor($planetrow["crystal"] / $planetrow["crystal_max"] * 100) * 2.5;
$parse['deuterium_storage_bar'] = floor($planetrow["deuterium"] / $planetrow["deuterium_max"] * 100) * 2.5;
//Color de la barra de metal
if ($parse['metal_storage_bar'] > 100 * 2.5) {
    $parse['metal_storage_bar'] = 250;
    $parse['metal_storage_barcolor'] = '#C00000';
} elseif ($parse['metal_storage_bar'] > 80 * 2.5) {
    $parse['metal_storage_barcolor'] = '#C0C000';
} else {
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:resources.php

示例6: BuildRessourcePage


//.........这里部分代码省略.........
            $energy = floor(eval($ProdGrid[$ProdID]['formule']['energy']) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_ingenieur'] * 0.05));
            if ($energy > 0) {
                $CurrentPlanet['energy_max'] += $energy;
            } else {
                $CurrentPlanet['energy_used'] += $energy;
            }
            $CurrentPlanet['metal_perhour'] += $metal;
            $CurrentPlanet['crystal_perhour'] += $crystal;
            $CurrentPlanet['deuterium_perhour'] += $deuterium;
            $metal_ref = $metal * 0.01 * $post_porcent;
            $crystal_ref = $crystal * 0.01 * $post_porcent;
            $deuterium_ref = $deuterium * 0.01 * $post_porcent;
            $energy_ref = $energy;
            $Field = $resource[$ProdID] . "_porcent";
            $CurrRow = array();
            $CurrRow['name'] = $resource[$ProdID];
            $CurrRow['porcent'] = $CurrentPlanet[$Field];
            for ($Option = 10; $Option >= 0; $Option--) {
                $OptValue = $Option * 10;
                if ($Option == $CurrRow['porcent']) {
                    $OptSelected = " selected=selected";
                } else {
                    $OptSelected = "";
                }
                $CurrRow['option'] .= "<option value=\"" . $OptValue . "\"" . $OptSelected . ">" . $OptValue . "%</option>";
            }
            $CurrRow['type'] = $lang['tech'][$ProdID];
            $CurrRow['level'] = $ProdID > 200 ? $lang['quantity'] : $lang['level'];
            $CurrRow['level_type'] = $CurrentPlanet[$resource[$ProdID]];
            $metal_type = pretty_number(abs($metal_ref));
            $crystal_type = pretty_number(abs($crystal_ref));
            $deuterium_type = pretty_number(abs($deuterium_ref));
            $CurrRow['energy_type'] = pretty_number($energy_ref);
            $CurrRow['metal_type'] = colorNumber($metal_type);
            $CurrRow['crystal_type'] = colorNumber($crystal_type);
            $CurrRow['deuterium_type'] = colorNumber($deuterium_type);
            if (abs($CurrentPlanet['energy_used']) > $CurrentPlanet['energy_max']) {
                $CurrRow['energy_type'] = colorNumber($CurrRow['energy_type'] * -1);
            } elseif (abs($CurrentPlanet['energy_used']) > 0 && $CurrentPlanet['energy_max'] == 0) {
                $CurrRow['energy_type'] = colorNumber($CurrRow['energy_type'] * -1);
            } else {
                $CurrRow['energy_type'] = colorNumber($CurrRow['energy_type']);
            }
            if ($CurrRow['type'] == "M") {
                $CurrRow['energy_type'] = colorNumber($CurrRow['energy_type'] * -1);
            }
            $parse['resource_row'] .= parsetemplate($RessRowTPL, $CurrRow);
        }
    }
    $parse['Production_of_resources_in_the_planet'] = str_replace('%s', $CurrentPlanet['name'], $lang['Production_of_resources_in_the_planet']);
    if ($CurrentPlanet['energy_max'] == 0 && $CurrentPlanet['energy_used'] > 0) {
        $production_level = 0;
    } elseif ($CurrentPlanet['energy_max'] > 0 && abs($CurrentPlanet['energy_used']) > $CurrentPlanet['energy_max']) {
        $production_level = floor($CurrentPlanet['energy_max'] / abs($CurrentPlanet['energy_used']) * 100);
    } elseif ($CurrentPlanet['energy_max'] == 0 && abs($CurrentPlanet['energy_used']) > $CurrentPlanet['energy_max']) {
        $production_level = 0;
    } else {
        $production_level = 100;
    }
    if ($production_level > 100) {
        $production_level = 100;
    }
    $parse['metal_basic_income'] = $game_config['metal_basic_income'] * $game_config['resource_multiplier'];
    $parse['crystal_basic_income'] = $game_config['crystal_basic_income'] * $game_config['resource_multiplier'];
    $parse['deuterium_basic_income'] = $game_config['deuterium_basic_income'] * $game_config['resource_multiplier'];
    $parse['energy_basic_income'] = $game_config['energy_basic_income'] * $game_config['resource_multiplier'];
开发者ID:sonicmaster,项目名称:RPG,代码行数:67,代码来源:BuildRessourcePage.php

示例7: colorNumber

         if ($gid == 12) {
             $page .= colorNumber(pretty_number(-($res['energy'] - $dif['energy']))) . '</th><th>';
         } else {
             $page .= colorNumber(pretty_number($res['energy'] - $dif['energy'])) . '</th><th>';
         }
     } elseif ($planetrow[$resource[$gid]] + $level > $planetrow[$resource[$gid]]) {
         $page .= $planetrow[$resource[$gid]] + $level . '</th><th>';
         if ($gid != 4) {
             $page .= pretty_number($res['res']) . '</th><th>';
             $page .= colorNumber(pretty_number($res['res'] - $dif['res'])) . '</th><th>';
         }
         $page .= pretty_number($res['energy']) . '</th><th>';
         if ($gid == 12) {
             $page .= colorNumber(pretty_number(-($res['energy'] - $dif['energy']))) . '</th><th>';
         } else {
             $page .= colorNumber(pretty_number($res['energy'] - $dif['energy'])) . '</th><th>';
         }
     } else {
         $page .= '<font color="#FF0000">';
         $page .= $planetrow[$resource[$gid]] + $level . '</font></th><th>';
         if ($gid != 4) {
             $page .= pretty_number($res['res']) . '</th><th>';
             $page .= pretty_number($res['res'] - $dif['res']) . '</th><th>';
         }
         $page .= pretty_number($res['energy']) . '</th><th>';
         $page .= pretty_number($res['energy'] - $dif['energy']) . '</th><th>';
     }
     $page .= '</th></tr>';
     $level++;
 }
 $page .= '</table>';
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:infos.php

示例8: __construct

 public function __construct(&$CurrentPlanet, $CurrentUser)
 {
     global $ProdGrid, $lang, $resource, $reslist, $phpEx, $dpath, $game_config, $_GET, $xgp_root;
     include_once $xgp_root . 'includes/functions/IsTechnologieAccessible.' . $phpEx;
     include_once $xgp_root . 'includes/functions/GetElementPrice.' . $phpEx;
     include_once $xgp_root . 'includes/functions/CheckPlanetUsedFields.' . $phpEx;
     CheckPlanetUsedFields($CurrentPlanet);
     $parse = $lang;
     $Allowed['1'] = array(1, 2, 3, 4, 12, 14, 15, 21, 22, 23, 24, 31, 33, 34, 44);
     $Allowed['3'] = array(12, 14, 21, 22, 23, 24, 34, 41, 42, 43);
     if (isset($_GET['cmd'])) {
         $bDoItNow = false;
         $TheCommand = $_GET['cmd'];
         $Element = $_GET['building'];
         $ListID = $_GET['listid'];
         if (!in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
             unset($Element);
         }
         if (isset($Element)) {
             if (!strchr($Element, ",") && !strchr($Element, " ") && !strchr($Element, "+") && !strchr($Element, "*") && !strchr($Element, "~") && !strchr($Element, "=") && !strchr($Element, ";") && !strchr($Element, "'") && !strchr($Element, "#") && !strchr($Element, "-") && !strchr($Element, "_") && !strchr($Element, "[") && !strchr($Element, "]") && !strchr($Element, ".") && !strchr($Element, ":")) {
                 if (in_array(trim($Element), $Allowed[$CurrentPlanet['planet_type']])) {
                     $bDoItNow = true;
                 }
             } else {
                 header("location:game.php?page=buildings");
             }
         } elseif (isset($ListID)) {
             $bDoItNow = true;
         }
         if ($Element == 31 && $CurrentUser["b_tech_planet"] != 0) {
             $bDoItNow = false;
         }
         if (($Element == 21 or $Element == 14 or $Element == 15) && $CurrentPlanet["b_hangar"] != 0) {
             $bDoItNow = false;
         }
         if ($bDoItNow == true) {
             switch ($TheCommand) {
                 case 'cancel':
                     $this->CancelBuildingFromQueue($CurrentPlanet, $CurrentUser);
                     break;
                 case 'remove':
                     $this->RemoveBuildingFromQueue($CurrentPlanet, $CurrentUser, $ListID);
                     break;
                 case 'insert':
                     $this->AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, true);
                     break;
                 case 'destroy':
                     $this->AddBuildingToQueue($CurrentPlanet, $CurrentUser, $Element, false);
                     break;
             }
         }
         if ($_GET['r'] == 'overview') {
             header('location:game.php?page=overview');
         } else {
             header("Location: game.php?page=buildings&mode=buildings");
         }
     }
     SetNextQueueElementOnTop($CurrentPlanet, $CurrentUser);
     // $Queue = $this->ShowBuildingQueue($CurrentPlanet, $CurrentUser); // OLD CODE
     // START FIX BY JSTAR
     $Sprice = array();
     $Queue = $this->ShowBuildingQueue($CurrentPlanet, $CurrentUser, $Sprice);
     // END FIX BY JSTAR
     $this->BuildingSavePlanetRecord($CurrentPlanet);
     if ($Queue['lenght'] < MAX_BUILDING_QUEUE_SIZE) {
         $CanBuildElement = true;
     } else {
         $CanBuildElement = false;
     }
     $BuildingPage = "";
     $zaehler = 1;
     foreach ($lang['tech'] as $Element => $ElementName) {
         if (in_array($Element, $Allowed[$CurrentPlanet['planet_type']])) {
             $CurrentMaxFields = CalculateMaxPlanetFields($CurrentPlanet);
             if ($CurrentPlanet["field_current"] < $CurrentMaxFields - $Queue['lenght']) {
                 $RoomIsOk = true;
             } else {
                 $RoomIsOk = false;
             }
             if (IsTechnologieAccessible($CurrentUser, $CurrentPlanet, $Element)) {
                 $HaveRessources = IsElementBuyable($CurrentUser, $CurrentPlanet, $Element, true, false);
                 $parse = array();
                 $parse = $lang;
                 $parse['dpath'] = $dpath;
                 $parse['i'] = $Element;
                 $BuildingLevel = $CurrentPlanet[$resource[$Element]];
                 $parse['nivel'] = $BuildingLevel == 0 ? "" : " (" . $lang['bd_lvl'] . " " . $BuildingLevel . ")";
                 // ENERGIA AL LADO DE LOS EDIFICIOS #####################################################
                 $BuildLevelFactor = 10;
                 $BuildTemp = $CurrentPlanet['temp_max'];
                 $CurrentBuildtLvl = $BuildingLevel;
                 $BuildLevel = $CurrentBuildtLvl > 0 ? $CurrentBuildtLvl : 1;
                 $EnergyTechLevel = $CurrentUser["energy_tech"];
                 $Prod[4] = floor(eval($ProdGrid[$Element]['formule']['energy']) * $game_config['resource_multiplier']) * (1 + $CurrentUser['rpg_ingenieur'] * 0.05);
                 $ActualNeed = floor($Prod[4]);
                 $BuildLevel++;
                 $Prod[4] = floor(eval($ProdGrid[$Element]['formule']['energy']) * $game_config['resource_multiplier']) * (1 + $CurrentUser['rpg_ingenieur'] * 0.05);
                 $EnergyNeed = colorNumber(pretty_number(floor($Prod[4] - $ActualNeed)));
                 if ($Element >= 1 && $Element <= 3) {
                     $parse['energia'] = "(" . "<font color=#FF0000>" . $EnergyNeed . " " . $lang['Energy'] . "</font>" . ")";
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:class.ShowBuildingsPage.php

示例9: BuildRessourcePage

function BuildRessourcePage($CurrentUser, $CurrentPlanet)
{
    global $lang, $ProdGrid, $resource, $reslist, $game_config, $_POST;
    includeLang('resources');
    $RessBodyTPL = gettemplate('resources');
    $RessRowTPL = gettemplate('resources_row');
    $userInVacation = $CurrentUser['urlaubs_modus'] == 1 ? true : false;
    if ($CurrentPlanet['planet_type'] == 3 || $userInVacation == true) {
        message($lang['Ressource_PageNotAllowed'], $lang['Ressource_NotDisponible'], 'overview.php');
    }
    $ValidList['percent'] = array(100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 0);
    $SubQry = "";
    if ($_POST) {
        foreach ($_POST as $Field => $Value) {
            $FieldName = $Field . "_porcent";
            if (isset($CurrentPlanet[$FieldName])) {
                if (!in_array($Value, $ValidList['percent'])) {
                    header("Location: overview.php");
                    exit;
                }
                $Value = $Value / 10;
                $CurrentPlanet[$FieldName] = $Value;
                $SubQry .= ", `" . $FieldName . "` = '" . $Value . "'";
            }
        }
    }
    $parse = $lang;
    // -------------------------------------------------------------------------------------------------------
    // Mise a jour de l'espace de stockage
    $CurrentPlanet['metal_max'] = floor(BASE_STORAGE_SIZE * pow(1.5, $CurrentPlanet[$resource[22]])) * (1 + $CurrentUser['rpg_stockeur'] * 0.5);
    $CurrentPlanet['crystal_max'] = floor(BASE_STORAGE_SIZE * pow(1.5, $CurrentPlanet[$resource[23]])) * (1 + $CurrentUser['rpg_stockeur'] * 0.5);
    $CurrentPlanet['deuterium_max'] = floor(BASE_STORAGE_SIZE * pow(1.5, $CurrentPlanet[$resource[24]])) * (1 + $CurrentUser['rpg_stockeur'] * 0.5);
    // -------------------------------------------------------------------------------------------------------
    // Calcul du % de production et mise � jour des ressources
    $CurrentPlanet = PlanetResourceUpdate($user, $CurrentPlanet, time());
    // --------------------------------------------------------------------------------------------------------
    $parse['resource_row'] = "";
    $CurrentPlanet['metal_perhour'] = 0;
    $CurrentPlanet['crystal_perhour'] = 0;
    $CurrentPlanet['deuterium_perhour'] = 0;
    $CurrentPlanet['energy_max'] = 0;
    $CurrentPlanet['energy_used'] = 0;
    $BuildTemp = $CurrentPlanet['temp_max'];
    foreach ($reslist['prod'] as $ProdID) {
        if ($CurrentPlanet[$resource[$ProdID]] > 0 && isset($ProdGrid[$ProdID])) {
            $BuildLevelFactor = $CurrentPlanet[$resource[$ProdID] . "_porcent"];
            $BuildLevel = $CurrentPlanet[$resource[$ProdID]];
            $metal = floor(eval($ProdGrid[$ProdID]['formule']['metal']) * ($CurrentPlanet['porcent'] / 100) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_geologue'] * 0.05));
            $crystal = floor(eval($ProdGrid[$ProdID]['formule']['crystal']) * ($CurrentPlanet['porcent'] / 100) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_geologue'] * 0.05));
            $deuterium = floor(eval($ProdGrid[$ProdID]['formule']['deuterium']) * ($CurrentPlanet['porcent'] / 100) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_geologue'] * 0.05));
            $energy = floor(eval($ProdGrid[$ProdID]['formule']['energy']) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_ingenieur'] * 0.05));
            if ($energy > 0) {
                $CurrentPlanet['energy_max'] += $energy;
            } else {
                $CurrentPlanet['energy_used'] += $energy;
            }
            $CurrentPlanet['metal_perhour'] += $metal;
            $CurrentPlanet['crystal_perhour'] += $crystal;
            $CurrentPlanet['deuterium_perhour'] += $deuterium;
            $CurrRow = array();
            $CurrRow['name'] = $resource[$ProdID];
            $CurrRow['porcent'] = $BuildLevelFactor;
            foreach ($ValidList['percent'] as $Option) {
                $OptSelected = $Option / 10 == $CurrRow['porcent'] ? ' selected=selected' : '';
                $CurrRow['option'] .= "<option value=\"" . $Option . "\"" . $OptSelected . ">" . $Option . "%</option>";
            }
            $CurrRow['type'] = $lang['tech'][$ProdID];
            $CurrRow['level'] = $ProdID > 200 ? $lang['quantity'] : $lang['level'];
            $CurrRow['level_type'] = $CurrentPlanet[$resource[$ProdID]];
            $CurrRow['metal_type'] = colorNumber(pretty_number($metal));
            $CurrRow['crystal_type'] = colorNumber(pretty_number($crystal));
            $CurrRow['deuterium_type'] = colorNumber(pretty_number($deuterium));
            $CurrRow['energy_type'] = colorNumber(pretty_number($energy));
            $parse['resource_row'] .= parsetemplate($RessRowTPL, $CurrRow);
        }
    }
    $parse['Production_of_resources_in_the_planet'] = str_replace('%s', $CurrentPlanet['name'], $lang['Production_of_resources_in_the_planet']);
    $parse['production_level'] = $CurrentPlanet['porcent'];
    $parse['metal_basic_income'] = $game_config['metal_basic_income'] * $game_config['resource_multiplier'];
    $parse['crystal_basic_income'] = $game_config['crystal_basic_income'] * $game_config['resource_multiplier'];
    $parse['deuterium_basic_income'] = $game_config['deuterium_basic_income'] * $game_config['resource_multiplier'];
    $parse['energy_basic_income'] = $game_config['energy_basic_income'] * $game_config['resource_multiplier'];
    if ($CurrentPlanet['metal_max'] < $CurrentPlanet['metal']) {
        $parse['metal_max'] = "<font color=\"#ff0000\">";
    } else {
        $parse['metal_max'] = "<font color=\"#00ff00\">";
    }
    $parse['metal_max'] .= pretty_number($CurrentPlanet['metal_max'] / 1000) . " " . $lang['k'] . "</font>";
    if ($CurrentPlanet['crystal_max'] < $CurrentPlanet['crystal']) {
        $parse['crystal_max'] = "<font color=\"#ff0000\">";
    } else {
        $parse['crystal_max'] = "<font color=\"#00ff00\">";
    }
    $parse['crystal_max'] .= pretty_number($CurrentPlanet['crystal_max'] / 1000) . " " . $lang['k'] . "</font>";
    if ($CurrentPlanet['deuterium_max'] < $CurrentPlanet['deuterium']) {
        $parse['deuterium_max'] = "<font color=\"#ff0000\">";
    } else {
        $parse['deuterium_max'] = "<font color=\"#00ff00\">";
    }
    $parse['deuterium_max'] .= pretty_number($CurrentPlanet['deuterium_max'] / 1000) . " " . $lang['k'] . "</font>";
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:resources.php

示例10: ShowResourcesPage

function ShowResourcesPage($CurrentUser, $CurrentPlanet)
{
    global $lang, $ProdGrid, $resource, $reslist, $game_config;
    $parse = $lang;
    if ($CurrentPlanet['planet_type'] == 3) {
        $game_config['metal_basic_income'] = 0;
        $game_config['crystal_basic_income'] = 0;
        $game_config['deuterium_basic_income'] = 0;
        $game_config['darkmatter_basic_income'] = 0;
    }
    $ValidList['percent'] = array(0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100);
    $SubQry = "";
    if ($_POST) {
        foreach ($_POST as $Field => $Value) {
            $FieldName = $Field . "_porcent";
            if (isset($CurrentPlanet[$FieldName])) {
                if (!in_array($Value, $ValidList['percent'])) {
                    header("Location: game.php?page=ressources");
                    exit;
                }
                $Value = $Value / 10;
                $CurrentPlanet[$FieldName] = $Value;
                $SubQry .= ", `" . $FieldName . "` = '" . $Value . "'";
            }
        }
    }
    $parse['production_level'] = 100;
    if ($CurrentPlanet['energy_max'] == 0 && $CurrentPlanet['energy_used'] > 0) {
        $post_porcent = 0;
    } elseif ($CurrentPlanet['energy_max'] > 0 && $CurrentPlanet['energy_used'] + $CurrentPlanet['energy_max'] < 0) {
        $post_porcent = floor($CurrentPlanet['energy_max'] / ($CurrentPlanet['energy_used'] * -1) * 100);
    } else {
        $post_porcent = 100;
    }
    if ($post_porcent > 100) {
        $post_porcent = 100;
    }
    $CurrentPlanet['metal_max'] = (BASE_STORAGE_SIZE + 50000 * (roundUp(pow(1.6, $CurrentPlanet[$resource[22]])) - 1)) * (1 + $CurrentUser['rpg_stockeur'] * STOCKEUR);
    $CurrentPlanet['crystal_max'] = (BASE_STORAGE_SIZE + 50000 * (roundUp(pow(1.6, $CurrentPlanet[$resource[23]])) - 1)) * (1 + $CurrentUser['rpg_stockeur'] * STOCKEUR);
    $CurrentPlanet['deuterium_max'] = (BASE_STORAGE_SIZE + 50000 * (roundUp(pow(1.6, $CurrentPlanet[$resource[24]])) - 1)) * (1 + $CurrentUser['rpg_stockeur'] * STOCKEUR);
    $CurrentPlanet['darkmatter_max'] = (BASE_STORAGE_SIZE + 50000 * (roundUp(pow(1.6, $CurrentPlanet[$resource[25]])) - 1)) * (1 + $CurrentUser['rpg_stockeur'] * STOCKEUR);
    $parse['resource_row'] = "";
    $CurrentPlanet['metal_perhour'] = 0;
    $CurrentPlanet['crystal_perhour'] = 0;
    $CurrentPlanet['deuterium_perhour'] = 0;
    $CurrentPlanet['darkmatter_perhour'] = 0;
    $CurrentPlanet['energy_max'] = 0;
    $CurrentPlanet['energy_used'] = 0;
    $BuildTemp = $CurrentPlanet['temp_max'];
    foreach ($reslist['prod'] as $ProdID) {
        if ($CurrentPlanet[$resource[$ProdID]] > 0 && isset($ProdGrid[$ProdID])) {
            $BuildLevelFactor = $CurrentPlanet[$resource[$ProdID] . "_porcent"];
            $BuildLevel = $CurrentPlanet[$resource[$ProdID]];
            $metal = floor(eval($ProdGrid[$ProdID]['formule']['metal']) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_geologue'] * GEOLOGUE));
            $crystal = floor(eval($ProdGrid[$ProdID]['formule']['crystal']) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_geologue'] * GEOLOGUE));
            $deuterium = floor(eval($ProdGrid[$ProdID]['formule']['deuterium']) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_geologue'] * GEOLOGUE));
            $darkmatter = floor(eval($ProdGrid[$ProdID]['formule']['darkmatter']) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_geologue'] * GEOLOGUE));
            if ($ProdID >= 4) {
                $energy = floor(eval($ProdGrid[$ProdID]['formule']['energy']) * $game_config['resource_multiplier'] * (1 + $CurrentUser['rpg_ingenieur'] * INGENIEUR));
            } else {
                $energy = floor(eval($ProdGrid[$ProdID]['formule']['energy']) * $game_config['resource_multiplier']);
            }
            if ($energy > 0) {
                $CurrentPlanet['energy_max'] += $energy;
            } else {
                $CurrentPlanet['energy_used'] += $energy;
            }
            $CurrentPlanet['metal_perhour'] += $metal;
            $CurrentPlanet['crystal_perhour'] += $crystal;
            $CurrentPlanet['deuterium_perhour'] += $deuterium;
            $CurrentPlanet['darkmatter_perhour'] += $darkmatter;
            $metal = $metal * 0.01 * $post_porcent;
            $crystal = $crystal * 0.01 * $post_porcent;
            $deuterium = $deuterium * 0.01 * $post_porcent;
            $darkmatter = $darkmatter * 0.01 * $post_porcent;
            $energy = $energy * 0.01 * $post_porcent;
            $Field = $resource[$ProdID] . "_porcent";
            $CurrRow = array();
            $CurrRow['name'] = $resource[$ProdID];
            $CurrRow['porcent'] = $CurrentPlanet[$Field];
            for ($Option = 10; $Option >= 0; $Option--) {
                $OptValue = $Option * 10;
                if ($Option == $CurrRow['porcent']) {
                    $OptSelected = " selected=selected";
                } else {
                    $OptSelected = "";
                }
                $CurrRow['option'] .= "<option value=\"" . $OptValue . "\"" . $OptSelected . ">" . $OptValue . "%</option>";
            }
            $CurrRow['type'] = $lang['tech'][$ProdID];
            $CurrRow['level'] = $ProdID > 200 ? $lang['rs_amount'] : $lang['rs_lvl'];
            $CurrRow['level_type'] = $CurrentPlanet[$resource[$ProdID]];
            $CurrRow['metal_type'] = pretty_number($metal);
            $CurrRow['crystal_type'] = pretty_number($crystal);
            $CurrRow['deuterium_type'] = pretty_number($deuterium);
            $CurrRow['darkmatter_type'] = pretty_number($darkmatter);
            $CurrRow['energy_type'] = pretty_number($energy);
            $CurrRow['metal_type'] = colorNumber($CurrRow['metal_type']);
            $CurrRow['crystal_type'] = colorNumber($CurrRow['crystal_type']);
            $CurrRow['deuterium_type'] = colorNumber($CurrRow['deuterium_type']);
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:ShowResourcesPage.php

示例11: __construct

 public function __construct()
 {
     global $USER, $PLANET, $dpath, $LNG, $resource, $pricelist, $reslist, $CombatCaps, $ProdGrid, $CONF;
     $BuildID = request_var('gid', 0);
     $template = new template();
     $template->page_header();
     $template->page_footer();
     if (in_array($BuildID, $reslist['prod']) && $BuildID != 212) {
         $BuildLevelFactor = 10;
         $BuildTemp = $PLANET['temp_max'];
         $CurrentBuildtLvl = $PLANET[$resource[$BuildID]];
         $BuildEnergy = $USER[$resource[113]];
         $BuildLevel = $CurrentBuildtLvl > 0 ? $CurrentBuildtLvl : 1;
         $Prod[1] = floor(eval($ProdGrid[$BuildID]['formule']['metal']) * $CONF['resource_multiplier']) * (1 + $USER['rpg_geologue'] * GEOLOGUE);
         $Prod[2] = floor(eval($ProdGrid[$BuildID]['formule']['crystal']) * $CONF['resource_multiplier']) * (1 + $USER['rpg_geologue'] * GEOLOGUE);
         $Prod[3] = floor(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $CONF['resource_multiplier']) * (1 + $USER['rpg_geologue'] * GEOLOGUE);
         $BuildStartLvl = max($CurrentBuildtLvl - 2, 1);
         if ($BuildID >= 4) {
             $Prod[4] = floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']) * (1 + $USER['rpg_ingenieur'] * INGENIEUR);
         } else {
             $Prod[4] = floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']);
         }
         $ActualProd = floor($Prod[$BuildID]);
         if ($BuildID != 12) {
             $ActualNeed = floor($Prod[4]);
         } else {
             $ActualNeed = floor($Prod[3]);
         }
         $ProdFirst = 0;
         for ($BuildLevel = $BuildStartLvl; $BuildLevel < $BuildStartLvl + 15; $BuildLevel++) {
             $Prod[1] = floor(eval($ProdGrid[$BuildID]['formule']['metal']) * $CONF['resource_multiplier']);
             $Prod[2] = floor(eval($ProdGrid[$BuildID]['formule']['crystal']) * $CONF['resource_multiplier']);
             $Prod[3] = floor(eval($ProdGrid[$BuildID]['formule']['deuterium']) * $CONF['resource_multiplier']);
             if ($BuildID >= 4) {
                 $Prod[4] = floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']);
             } else {
                 $Prod[4] = floor(eval($ProdGrid[$BuildID]['formule']['energy']) * $CONF['resource_multiplier']);
             }
             $bloc['build_lvl'] = $CurrentBuildtLvl == $BuildLevel ? "<font color=\"#ff0000\">" . $BuildLevel . "</font>" : $BuildLevel;
             if ($BuildID != 12) {
                 $prod = pretty_number(floor($Prod[$BuildID]));
                 $prod_diff = colorNumber(pretty_number(floor($Prod[$BuildID] - $ActualProd)));
                 $need = colorNumber(pretty_number(floor($Prod[4])));
                 $need_diff = colorNumber(pretty_number(floor($Prod[4] - $ActualNeed)));
             } else {
                 $prod = pretty_number(floor($Prod[4]));
                 $prod_diff = colorNumber(pretty_number(floor($Prod[4] - $ActualProd)));
                 $need = colorNumber(pretty_number(floor($Prod[3])));
                 $need_diff = colorNumber(pretty_number(floor($Prod[3] - $ActualNeed)));
             }
             if ($ProdFirst == 0) {
                 if ($BuildID != 12) {
                     $ProdFirst = floor($Prod[$BuildID]);
                 } else {
                     $ProdFirst = floor($Prod[4]);
                 }
             }
             $ProductionTable[] = array('BuildLevel' => $BuildLevel, 'prod' => $prod, 'prod_diff' => $prod_diff, 'need' => $need, 'need_diff' => $need_diff);
         }
     } elseif (in_array($BuildID, $reslist['fleet'])) {
         for ($Type = 200; $Type < 500; $Type++) {
             if ($CombatCaps[$BuildID]['sd'][$Type] > 1) {
                 $RapidFire['to'][$LNG['tech'][$Type]] = $CombatCaps[$BuildID]['sd'][$Type];
             }
             if ($CombatCaps[$Type]['sd'][$BuildID] > 1) {
                 $RapidFire['from'][$LNG['tech'][$Type]] = $CombatCaps[$Type]['sd'][$BuildID];
             }
         }
         $FleetInfo[$LNG['in_struct_pt']] = pretty_number($pricelist[$BuildID]['metal'] + $pricelist[$BuildID]['crystal']);
         $FleetInfo[$LNG['in_shield_pt']] = pretty_number($CombatCaps[$BuildID]['shield']);
         $FleetInfo[$LNG['in_attack_pt']] = pretty_number($CombatCaps[$BuildID]['attack']);
         $FleetInfo[$LNG['in_capacity']] = pretty_number($pricelist[$BuildID]['capacity']);
         $FleetInfo[$LNG['in_base_speed']][] = pretty_number($pricelist[$BuildID]['speed']);
         $FleetInfo[$LNG['in_consumption']][] = pretty_number($pricelist[$BuildID]['consumption']);
         $FleetInfo[$LNG['in_base_speed']][] = pretty_number($pricelist[$BuildID]['speed2']);
         $FleetInfo[$LNG['in_consumption']][] = pretty_number($pricelist[$BuildID]['consumption2']);
     } elseif (in_array($BuildID, $reslist['defense'])) {
         for ($Type = 200; $Type < 500; $Type++) {
             if ($CombatCaps[$BuildID]['sd'][$Type] > 1) {
                 $RapidFire['to'][$LNG['tech'][$Type]] = $CombatCaps[$BuildID]['sd'][$Type];
             }
             if ($CombatCaps[$Type]['sd'][$BuildID] > 1) {
                 $RapidFire['from'][$LNG['tech'][$Type]] = $CombatCaps[$Type]['sd'][$BuildID];
             }
         }
         $FleetInfo[$LNG['in_struct_pt']] = pretty_number($pricelist[$BuildID]['metal'] + $pricelist[$BuildID]['crystal']);
         $FleetInfo[$LNG['in_shield_pt']] = pretty_number($CombatCaps[$BuildID]['shield']);
         $FleetInfo[$LNG['in_attack_pt']] = pretty_number($CombatCaps[$BuildID]['attack']);
     } elseif ($BuildID == 43 && $PLANET[$resource[43]] > 0) {
         $GateFleetList['jump'] = $this->DoFleetJump();
         $RestString = $this->GetNextJumpWaitTime($PLANET);
         if ($RestString['value'] != 0) {
             include_once ROOT_PATH . 'includes/functions/InsertJavaScriptChronoApplet.' . PHP_EXT;
             $template->assign_vars(array('gate_time_script' => InsertJavaScriptChronoApplet("Gate", "1", $RestString['value'], true), 'gate_script_go' => InsertJavaScriptChronoApplet("Gate", "1", $RestString['value'], false)));
         }
         $GateFleetList['start_link'] = BuildPlanetAdressLink($PLANET);
         $GateFleetList['moons'] = $this->BuildJumpableMoonCombo($USER, $PLANET);
         $GateFleetList['fleets'] = $this->BuildFleetListRows($PLANET);
     }
     $template->assign_vars(array('id' => $BuildID, 'name' => $LNG['info'][$BuildID]['name'], 'image' => $BuildID, 'description' => $LNG['info'][$BuildID]['description'], 'ProductionTable' => $ProductionTable, 'RapidFire' => $RapidFire, 'Level' => $CurrentBuildtLvl, 'FleetInfo' => $FleetInfo, 'GateFleetList' => $GateFleetList, 'in_jump_gate_jump' => $LNG['in_jump_gate_jump'], 'gate_ship_dispo' => $LNG['in_jump_gate_available'], 'in_level' => $LNG['in_level'], 'in_prod_p_hour' => $LNG['in_prod_p_hour'], 'in_difference' => $LNG['in_difference'], 'in_used_energy' => $LNG['in_used_energy'], 'in_prod_energy' => $LNG['in_prod_energy'], 'in_used_deuter' => $LNG['in_used_deuter'], 'in_rf_again' => $LNG['in_rf_again'], 'in_rf_from' => $LNG['in_rf_from'], 'in_jump_gate_select_ships' => $LNG['in_jump_gate_select_ships'], 'in_jump_gate_start_moon' => $LNG['in_jump_gate_start_moon'], 'in_jump_gate_finish_moon' => $LNG['in_jump_gate_finish_moon'], 'in_jump_gate_wait_time' => $LNG['in_jump_gate_wait_time']));
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:class.ShowInfosPage.php

示例12: ShowTopNavigationBar

/**
 * ShowTopNavigationBar.php
 *
 * @version 1
 * @copyright 2008 By Chlorel for XNova
 */
function ShowTopNavigationBar($CurrentUser, $CurrentPlanet)
{
    global $lang, $_GET;
    if ($CurrentUser) {
        if (!$CurrentPlanet) {
            $CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $CurrentUser['current_planet'] . "';", 'planets', true);
        }
        // Actualisation des ressources de la planete
        PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time());
        $NavigationTPL = gettemplate('topnav');
        $dpath = !$CurrentUser["dpath"] ? DEFAULT_SKINPATH : $CurrentUser["dpath"];
        $parse = $lang;
        $parse['dpath'] = $dpath;
        $parse['image'] = $CurrentPlanet['image'];
        // Genearation de la combo des planetes du joueur
        $parse['planetlist'] = '';
        $ThisUsersPlanets = SortUserPlanets($CurrentUser);
        while ($CurPlanet = mysql_fetch_array($ThisUsersPlanets)) {
            if ($CurPlanet["destruyed"] == 0) {
                $parse['planetlist'] .= "\n<option ";
                if ($CurPlanet['id'] == $CurrentUser['current_planet']) {
                    // Bon puisque deja on s'y trouve autant le marquer
                    $parse['planetlist'] .= "selected=\"selected\" ";
                }
                $parse['planetlist'] .= "value=\"?cp=" . $CurPlanet['id'] . "";
                $parse['planetlist'] .= "&amp;mode=" . $_GET['mode'];
                $parse['planetlist'] .= "&amp;re=0\">";
                // Nom et coordonnées de la planete
                $parse['planetlist'] .= "" . $CurPlanet['name'];
                $parse['planetlist'] .= "&nbsp;[" . $CurPlanet['galaxy'] . ":";
                $parse['planetlist'] .= "" . $CurPlanet['system'] . ":";
                $parse['planetlist'] .= "" . $CurPlanet['planet'];
                $parse['planetlist'] .= "]&nbsp;&nbsp;</option>";
            }
        }
        //*by sbdx
        //$energy = pretty_number($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) . "/" . pretty_number($CurrentPlanet["energy_max"]);
        $energy = $CurrentPlanet["energy_used"];
        // Energie
        $parse["energy_max"] = pretty_number($CurrentPlanet["energy_max"]);
        if ($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"] < 0) {
            $parse['energy'] = colorRed(pretty_number(abs($energy)));
        } else {
            $parse['energy'] = pretty_number(abs($energy));
        }
        // Metal
        $metal = pretty_number($CurrentPlanet["metal"]);
        if ($CurrentPlanet["metal"] > $CurrentPlanet["metal_max"]) {
            $parse['metal'] = colorRed($metal);
        } else {
            $parse['metal'] = $metal;
        }
        // Cristal
        $crystal = pretty_number($CurrentPlanet["crystal"]);
        if ($CurrentPlanet["crystal"] > $CurrentPlanet["crystal_max"]) {
            $parse['crystal'] = colorRed($crystal);
        } else {
            $parse['crystal'] = $crystal;
        }
        // Deuterium
        $deuterium = pretty_number($CurrentPlanet["deuterium"]);
        if ($CurrentPlanet["deuterium"] > $CurrentPlanet["deuterium_max"]) {
            $parse['deuterium'] = colorRed($deuterium);
        } else {
            $parse['deuterium'] = $deuterium;
        }
        // Max Energie
        $energy_max = pretty_number($CurrentPlanet["energy_max"]);
        if ($CurrentPlanet["energy_max"] > $CurrentPlanet["energy_max"]) {
            $parse['energy_max'] = colorRed($energy_max);
        } else {
            $parse['energy_max'] = $energy_max;
        }
        $parse['energy_total'] = colorNumber(pretty_number(floor($CurrentPlanet['energy_max'] + $CurrentPlanet["energy_used"])) - $parse['energy_basic_income']);
        // Metal maximo
        if ($CurrentPlanet["metal_max"] < $CurrentPlanet["metal"]) {
            $parse['metal_max'] = '<font color="#ff0000">';
        } else {
            $parse['metal_max'] = '<font color="#00ff00">';
        }
        $parse['metal_max'] .= pretty_number($CurrentPlanet["metal_max"] / 1) . " {$lang['']}</font>";
        // Cristal maximo
        if ($CurrentPlanet["crystal_max"] < $CurrentPlanet["crystal"]) {
            $parse['crystal_max'] = '<font color="#ff0000">';
        } else {
            $parse['crystal_max'] = '<font color="#00ff00">';
        }
        $parse['crystal_max'] .= pretty_number($CurrentPlanet["crystal_max"] / 1) . " {$lang['']}";
        // Deuterio maximo
        if ($CurrentPlanet["deuterium_max"] < $CurrentPlanet["deuterium"]) {
            $parse['deuterium_max'] = '<font color="#ff0000">';
        } else {
            $parse['deuterium_max'] = '<font color="#00ff00">';
        }
//.........这里部分代码省略.........
开发者ID:topstdio,项目名称:xnova,代码行数:101,代码来源:ShowTopNavigationBar.php

示例13: round

$parse['monthly_metal'] = round($planetrow["metal_perhour"] * 24 * 30 * 0.01 * $parse['production_level'] + $parse['metal_basic_income'] * 24 * 30);
$parse['daily_crystal'] = round($planetrow["crystal_perhour"] * 24 * 0.01 * $parse['production_level'] + $parse['crystal_basic_income'] * 24);
$parse['weekly_crystal'] = floor($planetrow["crystal_perhour"] * 24 * 7 * 0.01 * $parse['production_level'] + $parse['crystal_basic_income'] * 24 * 7);
$parse['monthly_crystal'] = floor($planetrow["crystal_perhour"] * 24 * 30 * 0.01 * $parse['production_level'] + $parse['crystal_basic_income'] * 24 * 30);
$parse['daily_deuterium'] = floor($planetrow["deuterium_perhour"] * 24 * 0.01 * $parse['production_level'] + $parse['deuterium_basic_income'] * 24);
$parse['weekly_deuterium'] = floor($planetrow["deuterium_perhour"] * 24 * 7 * 0.01 * $parse['production_level'] + $parse['deuterium_basic_income'] * 24 * 7);
$parse['monthly_deuterium'] = floor($planetrow["deuterium_perhour"] * 24 * 30 * 0.01 * $parse['production_level'] + $parse['deuterium_basic_income'] * 24 * 30);
$parse['daily_metal'] = colorNumber(pretty_number($parse["daily_metal"]));
$parse['weekly_metal'] = colorNumber(pretty_number($parse["weekly_metal"]));
$parse['monthly_metal'] = colorNumber(pretty_number($parse["monthly_metal"]));
$parse['daily_crystal'] = colorNumber(pretty_number($parse["daily_crystal"]));
$parse['weekly_crystal'] = colorNumber(pretty_number($parse["weekly_crystal"]));
$parse['monthly_crystal'] = colorNumber(pretty_number($parse["monthly_crystal"]));
$parse['daily_deuterium'] = colorNumber(pretty_number($parse["daily_deuterium"]));
$parse['weekly_deuterium'] = colorNumber(pretty_number($parse["weekly_deuterium"]));
$parse['monthly_deuterium'] = colorNumber(pretty_number($parse["monthly_deuterium"]));
//Porcentajes de minerias llenas
$parse['metal_storage'] = floor($planetrow["metal"] / $planetrow["metal_max"] * 100) . $lang['o/o'];
$parse['crystal_storage'] = floor($planetrow["crystal"] / $planetrow["crystal_max"] * 100) . $lang['o/o'];
$parse['deuterium_storage'] = floor($planetrow["deuterium"] / $planetrow["deuterium_max"] * 100) . $lang['o/o'];
//Las barras de porcentaje
$parse['metal_storage_bar'] = floor($planetrow["metal"] / $planetrow["metal_max"] * 100) * 2.5;
$parse['crystal_storage_bar'] = floor($planetrow["crystal"] / $planetrow["crystal_max"] * 100) * 2.5;
$parse['deuterium_storage_bar'] = floor($planetrow["deuterium"] / $planetrow["deuterium_max"] * 100) * 2.5;
//Color de la barra de metal
if ($parse['metal_storage_bar'] > 100 * 2.5) {
    $parse['metal_storage_bar'] = 250;
    $parse['metal_storage_barcolor'] = '#C00000';
} elseif ($parse['metal_storage_bar'] > 80 * 2.5) {
    $parse['metal_storage_barcolor'] = '#C0C000';
} else {
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:resources.php

示例14: echo_topnav

function echo_topnav()
{
    global $user, $planetrow, $galaxyrow, $mode, $messageziel, $gid, $lang;
    if (!$user) {
        return;
    }
    if (!$planetrow) {
        $planetrow = doquery("SELECT * FROM {{table}} WHERE id ={$user['current_planet']}", "planets", true);
    }
    calculate_resources_planet($planetrow);
    //Actualizacion de rutina
    //if(!$galaxyrow){ $galaxyrow = doquery("SELECT * FROM {{table}} WHERE id_planet = '".$planetrow["id"]."'","galaxy",true);}
    $dpath = !$user["dpath"] ? DEFAULT_SKINPATH : $user["dpath"];
    //-[Arrays]------------------------------------------------
    $parse = $lang;
    $parse['dpath'] = $dpath;
    $parse['image'] = $planetrow['image'];
    /*
      pequeño loop para agregar todos los planetas disponibles del mismo jugador...
    */
    ?>
<script language="JavaScript" src="scripts/flotten.js"></script>
<script language="JavaScript" src="scripts/ocnt.js"></script>
<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/thickbox.js"></script>
<link rel="stylesheet" href="scripts/thickbox.css" type="text/css" media="screen" />
<?php 
    $parse['planetlist'] = '';
    //pedimos todos los planetas que coincidan con el id del due�.
    $planets_list = doquery("SELECT id,name,galaxy,system,planet FROM {{table}} WHERE id_owner='{$user['id']}'", "planets");
    while ($p = mysql_fetch_array($planets_list)) {
        /*
          Cuando alguien selecciona destruir planeta, hay un tiempo en el que se vacia el slot
          del planeta, es mas que nada para dar tiempo a posible problema de hackeo o robo de cuenta.
        */
        if ($p["destruyed"] == 0) {
            //$pos_galaxy = doquery("SELECT * FROM {{table}} WHERE id_planet = {$p[id]}","galaxy",true);
            $parse['planetlist'] .= "<option ";
            if ($p["id"] == $user["current_planet"]) {
                $parse['planetlist'] .= 'selected="selected" ';
            }
            //Se selecciona el planeta actual
            $parse['planetlist'] .= "value=\"?cp={$p['id']}&amp;mode={$mode}&amp;gid={$gid}&amp;messageziel={$messageziel}&amp;re=0\">";
            //Nombre [galaxy:system:planet]
            $parse['planetlist'] .= "{$p['name']} [{$p['galaxy']}:{$p['system']}:{$p['planet']}]</option>";
        }
    }
    /* 
      Muestra los recursos, e indica si estos sobrepasan la capacidad de los almacenes
    */
    $energy = pretty_number($planetrow["energy_max"] - $planetrow["energy_used"]) . "/" . pretty_number($planetrow["energy_max"]);
    //energy
    if ($planetrow["energy_max"] - $planetrow["energy_used"] < 0) {
        $parse['energy'] = colorRed($energy);
    } else {
        $parse['energy'] = $energy;
    }
    //metal
    $metal = pretty_number($planetrow["metal"]);
    if ($planetrow["metal"] > $planetrow["metal_max"]) {
        $parse['metal'] = colorRed($metal);
    } else {
        $parse['metal'] = $metal;
    }
    //cristal
    $crystal = pretty_number($planetrow["crystal"]);
    if ($planetrow["crystal"] > $planetrow["crystal_max"]) {
        $parse['crystal'] = colorRed($crystal);
    } else {
        $parse['crystal'] = $crystal;
    }
    //deuterium
    $deuterium = pretty_number($planetrow["deuterium"]);
    if ($planetrow["deuterium"] > $planetrow["deuterium_max"]) {
        $parse['deuterium'] = colorNumber($deuterium);
    } else {
        $parse['deuterium'] = $deuterium;
    }
    //esto es un hecho!
    echo parsetemplate(gettemplate('topnav'), $parse);
}
开发者ID:sonicmaster,项目名称:RPG,代码行数:81,代码来源:functions.php

示例15: ShowTopNavigationBar

/**
 * ShowTopNavigationBar.php
 *
 * @version 1
 * @copyright 2008 By Chlorel for XNova
 */
function ShowTopNavigationBar($CurrentUser, $CurrentPlanet)
{
    global $lang, $_GET, $game_config;
    if ($CurrentUser) {
        if (!$CurrentPlanet) {
            $CurrentPlanet = doquery("SELECT * FROM {{table}} WHERE `id` = '" . $CurrentUser['current_planet'] . "';", 'planets', true);
        }
        // Aktualisieren der Planeten Ress
        PlanetResourceUpdate($CurrentUser, $CurrentPlanet, time());
        $NavigationTPL = gettemplate('topnav');
        $dpath = !$CurrentUser["dpath"] ? DEFAULT_SKINPATH : $CurrentUser["dpath"];
        $parse = $lang;
        $parse['dpath'] = $dpath;
        $parse['image'] = $CurrentPlanet['image'];
        // Genearation de la combo des planetes du joueur
        $parse['planetlist'] = '';
        $ThisUsersPlanets = SortUserPlanets($CurrentUser);
        while ($CurPlanet = mysql_fetch_array($ThisUsersPlanets)) {
            if ($CurPlanet["destruyed"] == 0) {
                $parse['planetlist'] .= "\n<option ";
                if ($CurPlanet['id'] == $CurrentUser['current_planet']) {
                    // Bon puisque deja on s'y trouve autant le marquer
                    $parse['planetlist'] .= "selected=\"selected\" ";
                }
                $parse['planetlist'] .= "value=\"?cp=" . $CurPlanet['id'] . "";
                $parse['planetlist'] .= "&amp;mode=" . $_GET['mode'];
                $parse['planetlist'] .= "&amp;re=0\">";
                // Nom et coordonnées de la planete
                $parse['planetlist'] .= "" . $CurPlanet['name'];
                $parse['planetlist'] .= "&nbsp;[" . $CurPlanet['galaxy'] . ":";
                $parse['planetlist'] .= "" . $CurPlanet['system'] . ":";
                $parse['planetlist'] .= "" . $CurPlanet['planet'];
                $parse['planetlist'] .= "]&nbsp;&nbsp;</option>";
            }
        }
        if ($CurrentPlanet['energy_max'] == 0 && $CurrentPlanet['energy_used'] > 0) {
            $production_level = 0;
        } elseif ($CurrentPlanet['energy_max'] > 0 && abs($CurrentPlanet['energy_used']) > $CurrentPlanet['energy_max']) {
            $production_level = floor($CurrentPlanet['energy_max'] / abs($CurrentPlanet['energy_used']) * 100);
        } elseif ($CurrentPlanet['energy_max'] == 0 && abs($CurrentPlanet['energy_used']) > $CurrentPlanet['energy_max']) {
            $production_level = 0;
        } else {
            $production_level = 100;
        }
        if ($production_level > 100) {
            $production_level = 100;
        }
        $energy = pretty_number($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"]) . "/" . pretty_number($CurrentPlanet["energy_max"]);
        // Energie
        if ($CurrentPlanet["energy_max"] + $CurrentPlanet["energy_used"] < 0) {
            $parse['energy'] = colorRed($energy);
        } else {
            $parse['energy'] = $energy;
        }
        // Metal
        $parse['metal'] = pretty_number($CurrentPlanet["metal"]);
        $parse['metal_js'] = str_replace(".", "", pretty_number($CurrentPlanet["metal"]));
        if ($CurrentPlanet["metal"] >= $CurrentPlanet["metal_max"]) {
            $parse['metal_per_hour'] = 0;
        } else {
            $metal = abs(floor($CurrentPlanet['metal_perhour'] * 0.01 * $production_level)) + $game_config['metal_basic_income'] * $game_config['resource_multiplier'];
            $parse['metal_per_hour'] = $metal / 3600;
        }
        // Cristal
        $parse['crystal'] = pretty_number($CurrentPlanet["crystal"]);
        $parse['crystal_js'] = str_replace(".", "", pretty_number($CurrentPlanet["crystal"]));
        if ($CurrentPlanet["crystal"] >= $CurrentPlanet["crystal_max"]) {
            $parse['crystal_per_hour'] = 0;
        } else {
            $crystal = abs(floor($CurrentPlanet['crystal_perhour'] * 0.01 * $production_level)) + $game_config['crystal_basic_income'] * $game_config['resource_multiplier'];
            $parse['crystal_per_hour'] = $crystal / 3600;
        }
        // Deuterium
        $parse['deuterium'] = pretty_number($CurrentPlanet["deuterium"]);
        $parse['deuterium_js'] = str_replace(".", "", pretty_number($CurrentPlanet["deuterium"]));
        if ($CurrentPlanet["deuterium"] >= $CurrentPlanet["deuterium_max"]) {
            $parse['deuterium_per_hour'] = 0;
        } else {
            $deuterium = abs(floor($CurrentPlanet['deuterium_perhour'] * 0.01 * $production_level)) + $game_config['deuterium_basic_income'] * $game_config['resource_multiplier'];
            $parse['deuterium_per_hour'] = $deuterium / 3600;
        }
        // Max Energie
        $energy_max = pretty_number($CurrentPlanet["energy_max"]);
        if ($CurrentPlanet["energy_max"] > $CurrentPlanet["energy_max"]) {
            $parse['energy_max'] = colorRed($energy_max);
        } else {
            $parse['energy_max'] = $energy_max;
        }
        $parse['energy_total'] = colorNumber(pretty_number(floor($CurrentPlanet['energy_max'] + $CurrentPlanet["energy_used"])) - $parse['energy_basic_income']);
        $parse['speed'] = $game_config['resource_multiplier'];
        // Metal maximum
        if ($CurrentPlanet["metal_max"] < $CurrentPlanet["metal"]) {
            $parse['metal_max'] = '<font color="#ff0000">';
        } else {
//.........这里部分代码省略.........
开发者ID:sonicmaster,项目名称:RPG,代码行数:101,代码来源:ShowTopNavigationBar.php


注:本文中的colorNumber函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。